Merge branch 'master' of ssh://repo.or.cz/srv/git/phpmyadmin/roccivic into rte

This commit is contained in:
Rouslan Placella 2011-05-24 13:01:02 +01:00
commit db0d4b84b8
33 changed files with 607 additions and 239 deletions

View File

@ -137,6 +137,8 @@ vim: expandtab ts=4 sw=4 sts=4 tw=78
<abbr title="Frequently Asked Questions">FAQ</abbr> 3.6)</a></li>
<li>support mysqli, the improved MySQL extension <a href="#faq1_17">
(see <abbr title="Frequently Asked Questions">FAQ</abbr> 1.17)</a></li>
<li>create, edit, call, export and drop stored procedures and functions</li>
<li>create, edit, export and drop events and triggers</li>
<li>communicate in <a href="http://www.phpmyadmin.net/home_page/translations.php">62 different languages</a>
</li>
<li>synchronize two databases residing on the same as well as remote servers
@ -5082,6 +5084,8 @@ Jakub Wilk, Thomas Michael Winningham, Vilius Zigmantas, &quot;Manuzhai&quot;.
<li><a href="http://www.wikipedia.org/wiki/Secure_Sockets_Layer">SSL (Secure
Sockets Layer)</a>
- a cryptographic protocol which provides secure communication on the Internet.</li>
<li><a href="http://en.wikipedia.org/wiki/Stored_procedure">Stored procedure</a>
- a subroutine available to applications accessing a relational database system</li>
<li><a href="http://www.wikipedia.org/wiki/SQL">SQL</a>
- Structured Query Language</li>
<li><a href="http://www.wikipedia.org/wiki/Table_%28database%29">table</a>
@ -5093,6 +5097,9 @@ Jakub Wilk, Thomas Michael Winningham, Vilius Zigmantas, &quot;Manuzhai&quot;.
- a type of archive file format: the Tape ARchive format.</li>
<li><a href="http://www.wikipedia.org/wiki/TCP">TCP (Transmission Control Protocol)</a>
- one of the core protocols of the Internet protocol suite.</li>
<li><a href="http://en.wikipedia.org/wiki/Database_trigger">trigger</a>
- a procedural code that is automatically executed in response to
certain events on a particular table or view in a database</li>
<li><a href="http://www.acko.net/node/56">UFPDF</a>
- Unicode/UTF-8 extension for FPDF</li>
<li><a href="http://www.wikipedia.org/wiki/URL">URL (Uniform Resource Locator)</a>

41
db_events.php Normal file
View File

@ -0,0 +1,41 @@
<?php
/**
*
*/
require_once './libraries/common.inc.php';
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
$GLOBALS['js_include'][] = 'db_events.js';
require_once './libraries/common.lib.php';
require_once './libraries/db_common.inc.php';
require_once './libraries/db_info.inc.php';
/**
* Create labels for the list
*/
$titles = PMA_buildActionTitles();
/**
* Displays the header
*/
require_once './libraries/header.inc.php';
/**
* Displays the tabs
*/
require_once './libraries/db_links.inc.php';
/**
* Displays the list of events
*/
require_once './libraries/db_events.inc.php';
/**
* Displays the footer
*/
require './libraries/footer.inc.php';
?>

41
db_routines.php Normal file
View File

@ -0,0 +1,41 @@
<?php
/**
*
*/
require_once './libraries/common.inc.php';
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
$GLOBALS['js_include'][] = 'db_routines.js';
require_once './libraries/common.lib.php';
require_once './libraries/db_common.inc.php';
require_once './libraries/db_info.inc.php';
/**
* Create labels for the list
*/
$titles = PMA_buildActionTitles();
/**
* Displays the header
*/
require_once './libraries/header.inc.php';
/**
* Displays the tabs
*/
require_once './libraries/db_links.inc.php';
/**
* Displays the list of routines
*/
require_once './libraries/db_routines.inc.php';
/**
* Displays the footer
*/
require './libraries/footer.inc.php';
?>

View File

@ -58,14 +58,6 @@ $titles = PMA_buildActionTitles();
if ($num_tables == 0) {
echo '<p>' . __('No tables found in database') . '</p>' . "\n";
// Routines
require './libraries/db_routines.inc.php';
// Events
if (PMA_MYSQL_INT_VERSION > 50100) {
require './libraries/db_events.inc.php';
}
if (empty($db_is_information_schema)) {
require './libraries/display_create_table.lib.php';
} // end if (Create Table dialog)
@ -545,13 +537,6 @@ PMA_listNavigator($total_num_tables, $pos, $_url_params, 'db_structure.php', 'fr
<hr />
<?php
// Routines
require './libraries/db_routines.inc.php';
// Events
if (PMA_MYSQL_INT_VERSION > 50100) {
require './libraries/db_events.inc.php';
}
/**
* Work on the database

41
db_triggers.php Normal file
View File

@ -0,0 +1,41 @@
<?php
/**
*
*/
require_once './libraries/common.inc.php';
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
$GLOBALS['js_include'][] = 'display_triggers.js';
require_once './libraries/common.lib.php';
require_once './libraries/db_common.inc.php';
require_once './libraries/db_info.inc.php';
/**
* Create labels for the list
*/
$titles = PMA_buildActionTitles();
/**
* Displays the header
*/
require_once './libraries/header.inc.php';
/**
* Displays the tabs
*/
require_once './libraries/db_links.inc.php';
/**
* Displays the list of triggers
*/
require_once './libraries/display_triggers.inc.php';
/**
* Displays the footer
*/
require './libraries/footer.inc.php';
?>

67
js/db_events.js Normal file
View File

@ -0,0 +1,67 @@
$(document).ready(function() {
/**
* Ajax Event handler for 'Drop Event'
*
* @uses $.PMA_confirm()
* @uses PMA_ajaxShowMessage()
* @see $cfg['AjaxEnable']
*/
$('.drop_event_anchor').live('click', function(event) {
event.preventDefault();
/**
* @var curr_event_row Object reference to current event's row
*/
var $curr_event_row = $(this).parents('tr');
/**
* @var question String containing the question to be asked for confirmation
*/
var question = $curr_event_row.children('td').children('.drop_sql').text();
$(this).PMA_confirm(question, $(this).attr('href') , function(url) {
PMA_ajaxShowMessage(PMA_messages['strDroppingEvent']);
$.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function(data) {
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
$("#result_query").remove();
if ($('#event_list tr').length == 2) {
$('#event_list').remove();
$('#no_events').show();
} else {
$curr_event_row.hide("medium").remove();
}
}
else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error);
}
}) // end $.get()
}) // end $.PMA_confirm()
}) // end Drop Event
/**
* Ajax Event handler for 'Export Event'
*
* @see $cfg['AjaxEnable']
*/
$('.export_event_anchor').live('click', function(event) {
event.preventDefault();
/**
* @var button_options Object containing options for jQueryUI dialog buttons
*/
var button_options = {};
button_options[PMA_messages['strClose']] = function() {$(this).dialog("close").remove();}
/**
* @var button_options The export SQL query to display to the user
*/
var query = $(this).parents('tr').find('.create_sql').html();
// show dialog
$('<div><textarea>'+query+'</textarea></div>').dialog({
width: 450,
buttons: button_options
}).find('textarea').width('100%');
}); // end Export Procedure
}, 'top.frame_content'); //end $(document).ready() for Drop Event

67
js/db_routines.js Normal file
View File

@ -0,0 +1,67 @@
$(document).ready(function() {
/**
* Ajax Event handler for 'Drop Procedure'
*
* @uses $.PMA_confirm()
* @uses PMA_ajaxShowMessage()
* @see $cfg['AjaxEnable']
*/
$('.drop_procedure_anchor').live('click', function(event) {
event.preventDefault();
/**
* @var curr_proc_row Object containing reference to the current procedure's row
*/
var $curr_proc_row = $(this).parents('tr');
/**
* @var question String containing the question to be asked for confirmation
*/
var question = $curr_proc_row.children('td').children('.drop_sql').text();
$(this).PMA_confirm(question, $(this).attr('href'), function(url) {
PMA_ajaxShowMessage(PMA_messages['strDroppingProcedure']);
$.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function(data) {
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
$("#result_query").remove();
if ($('#routine_list tr').length == 2) {
$('#routine_list').remove();
$('#no_routines').show();
} else {
$curr_proc_row.hide("medium").remove();
}
}
else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error);
}
}) // end $.get()
}) // end $.PMA_confirm()
}); // end Drop Procedure
/**
* Ajax Event handler for 'Export Procedure'
*
* @see $cfg['AjaxEnable']
*/
$('.export_procedure_anchor').live('click', function(event) {
event.preventDefault();
/**
* @var button_options Object containing options for jQueryUI dialog buttons
*/
var button_options = {};
button_options[PMA_messages['strClose']] = function() {$(this).dialog("close").remove();}
/**
* @var button_options The export SQL query to display to the user
*/
var query = $(this).parents('tr').find('.create_sql').html();
// show dialog
$('<div><textarea>'+query+'</textarea></div>').dialog({
width: 450,
buttons: button_options
}).find('textarea').width('100%');
}); // end Export Procedure
}, 'top.frame_content'); //end $(document).ready() for Drop Procedure

View File

@ -147,80 +147,6 @@ $(document).ready(function() {
}); // end $.PMA_confirm()
}); //end of Drop Table Ajax action
/**
* Ajax Event handler for 'Drop Event'
*
* @uses $.PMA_confirm()
* @uses PMA_ajaxShowMessage()
* @see $cfg['AjaxEnable']
*/
$('.drop_event_anchor').live('click', function(event) {
event.preventDefault();
/**
* @var curr_event_row Object reference to current event's row
*/
var curr_event_row = $(this).parents('tr');
/**
* @var curr_event_name String containing the name of {@link curr_event_row}
*/
var curr_event_name = $(curr_event_row).children('td:first').text();
/**
* @var question String containing the question to be asked for confirmation
*/
var question = 'DROP EVENT ' + curr_event_name;
$(this).PMA_confirm(question, $(this).attr('href') , function(url) {
PMA_ajaxShowMessage(PMA_messages['strDroppingEvent']);
$.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function(data) {
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
$(curr_event_row).hide("medium").remove();
}
else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error);
}
}) // end $.get()
}) // end $.PMA_confirm()
}) //end Drop Event
/**
* Ajax Event handler for 'Drop Procedure'
*
* @uses $.PMA_confirm()
* @uses PMA_ajaxShowMessage()
* @see $cfg['AjaxEnable']
*/
$('.drop_procedure_anchor').live('click', function(event) {
event.preventDefault();
/**
* @var curr_proc_row Object containing reference to the current procedure's row
*/
var curr_proc_row = $(this).parents('tr');
/**
* @var question String containing the question to be asked for confirmation
*/
var question = $(curr_proc_row).children('td').children('.drop_procedure_sql').val();
$(this).PMA_confirm(question, $(this).attr('href'), function(url) {
PMA_ajaxShowMessage(PMA_messages['strDroppingProcedure']);
$.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function(data) {
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
$(curr_event_row).hide("medium").remove();
}
else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error);
}
}) // end $.get()
}) // end $.PMA_confirm()
}) //end Drop Procedure
/**
* Ajax Event handler for 'Drop tracking'
*

67
js/display_triggers.js Normal file
View File

@ -0,0 +1,67 @@
$(document).ready(function() {
/**
* Ajax Event handler for 'Drop Trigger'
*
* @uses $.PMA_confirm()
* @uses PMA_ajaxShowMessage()
* @see $cfg['AjaxEnable']
*/
$(".drop_trigger_anchor").live('click', function(event) {
event.preventDefault();
/**
* @var curr_row Object reference to the current trigger's <tr>
*/
var $curr_trig_row = $(this).parents('tr');
/**
* @var question String containing the question to be asked for confirmation
*/
var question = $curr_trig_row.children('td').children('.drop_sql').text();
$(this).PMA_confirm(question, $(this).attr('href'), function(url) {
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
$.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function(data) {
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
$("#result_query").remove();
if ($('#trigger_list tr').length == 2) {
$('#trigger_list').remove();
$('#no_triggers').show();
} else {
$curr_trig_row.hide("medium").remove();
}
}
else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error);
}
}) // end $.get()
}) // end $.PMA_confirm()
}) // end $().live()
/**
* Ajax Event handler for 'Export Trigger'
*
* @see $cfg['AjaxEnable']
*/
$('.export_trigger_anchor').live('click', function(event) {
event.preventDefault();
/**
* @var button_options Object containing options for jQueryUI dialog buttons
*/
var button_options = {};
button_options[PMA_messages['strClose']] = function() {$(this).dialog("close").remove();}
/**
* @var button_options The export SQL query to display to the user
*/
var query = $(this).parents('tr').find('.create_sql').html();
// show dialog
$('<div><textarea>'+query+'</textarea></div>').dialog({
width: 450,
buttons: button_options
}).find('textarea').width('100%');
}); // end Export Procedure
}, 'top.frame_content'); //end $(document).ready() for Drop Trigger

View File

@ -1601,46 +1601,6 @@ $(document).ready(function() {
}, 'top.frame_content'); //end $(document).ready for 'Create Table'
/**
* Attach Ajax event handlers for Drop Trigger. Used on tbl_structure.php
* @see $cfg['AjaxEnable']
*/
$(document).ready(function() {
$(".drop_trigger_anchor").live('click', function(event) {
event.preventDefault();
$anchor = $(this);
/**
* @var curr_row Object reference to the current trigger's <tr>
*/
var $curr_row = $anchor.parents('tr');
/**
* @var question String containing the question to be asked for confirmation
*/
var question = 'DROP TRIGGER IF EXISTS `' + $curr_row.children('td:first').text() + '`';
$anchor.PMA_confirm(question, $anchor.attr('href'), function(url) {
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
$.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function(data) {
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
$("#topmenucontainer")
.next('div')
.remove()
.end()
.after(data.sql_query);
$curr_row.hide("medium").remove();
}
else {
PMA_ajaxShowMessage(data.error);
}
}) // end $.get()
}) // end $.PMA_confirm()
}) // end $().live()
}, 'top.frame_content'); //end $(document).ready() for Drop Trigger
/**
* Attach Ajax event handlers for Drop Database. Moved here from db_structure.js
* as it was also required on db_create.php

View File

@ -3021,6 +3021,8 @@ function PMA_buildActionTitles() {
$titles['Empty'] = PMA_getIcon('b_empty.png', __('Empty'), true);
$titles['NoEmpty'] = PMA_getIcon('bd_empty.png', __('Empty'), true);
$titles['Edit'] = PMA_getIcon('b_edit.png', __('Edit'), true);
$titles['Export'] = PMA_getIcon('b_export.png', __('Export'), true);
$titles['Execute'] = PMA_getIcon('b_execute.png', __('Execute'), true);
return $titles;
}
?>

View File

@ -1365,7 +1365,7 @@ function PMA_DBI_get_definition($db, $which, $name, $link = null)
}
/**
* returns details about the TRIGGERs of a specific table
* returns details about the TRIGGERs for a specific table or database
*
* @uses PMA_DBI_fetch_result()
* @param string $db db name
@ -1374,20 +1374,25 @@ function PMA_DBI_get_definition($db, $which, $name, $link = null)
*
* @return array information about triggers (may be empty)
*/
function PMA_DBI_get_triggers($db, $table, $delimiter = '//')
function PMA_DBI_get_triggers($db, $table = '', $delimiter = '//')
{
$result = array();
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
// Note: in http://dev.mysql.com/doc/refman/5.0/en/faqs-triggers.html
// their example uses WHERE TRIGGER_SCHEMA='dbname' so let's use this
// instead of WHERE EVENT_OBJECT_SCHEMA='dbname'
$triggers = PMA_DBI_fetch_result("SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION, ACTION_TIMING, ACTION_STATEMENT, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA= '" . PMA_sqlAddslashes($db,true) . "' and EVENT_OBJECT_TABLE = '" . PMA_sqlAddslashes($table, true) . "';");
// Note: in http://dev.mysql.com/doc/refman/5.0/en/faqs-triggers.html
// their example uses WHERE TRIGGER_SCHEMA='dbname' so let's use this
// instead of WHERE EVENT_OBJECT_SCHEMA='dbname'
$query = "SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION, EVENT_OBJECT_TABLE, ACTION_TIMING, ACTION_STATEMENT, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA= '" . PMA_sqlAddslashes($db,true) . "';";
if (! empty($table)) {
$query .= " AND EVENT_OBJECT_TABLE = '" . PMA_sqlAddslashes($table, true) . "';";
}
} else {
$triggers = PMA_DBI_fetch_result("SHOW TRIGGERS FROM " . PMA_backquote(PMA_sqlAddslashes($db,true)) . " LIKE '" . PMA_sqlAddslashes($table, true) . "';");
$query = "SHOW TRIGGERS FROM " . PMA_backquote(PMA_sqlAddslashes($db,true));
if (! empty($table)) {
$query .= " LIKE '" . PMA_sqlAddslashes($table, true) . "';";
}
}
if ($triggers) {
if ($triggers = PMA_DBI_fetch_result($query)) {
foreach ($triggers as $trigger) {
if ($GLOBALS['cfg']['Server']['DisableIS']) {
$trigger['TRIGGER_NAME'] = $trigger['Trigger'];
@ -1398,6 +1403,7 @@ function PMA_DBI_get_triggers($db, $table, $delimiter = '//')
}
$one_result = array();
$one_result['name'] = $trigger['TRIGGER_NAME'];
$one_result['table'] = $trigger['EVENT_OBJECT_TABLE'];
$one_result['action_timing'] = $trigger['ACTION_TIMING'];
$one_result['event_manipulation'] = $trigger['EVENT_MANIPULATION'];

View File

@ -10,52 +10,91 @@ if (! defined('PHPMYADMIN')) {
$events = PMA_DBI_fetch_result('SELECT EVENT_NAME, EVENT_TYPE FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \'' . PMA_sqlAddslashes($db,true) . '\';');
if ($events) {
PMA_generate_slider_effect('events', __('Events'));
echo '<fieldset>' . "\n";
echo ' <legend>' . __('Events') . '</legend>' . "\n";
echo '<table border="0">';
$conditional_class_add = '';
$conditional_class_drop = '';
$conditional_class_export = '';
if ($GLOBALS['cfg']['AjaxEnable']) {
$conditional_class_add = 'class="add_event_anchor"';
$conditional_class_drop = 'class="drop_event_anchor"';
$conditional_class_export = 'class="export_event_anchor"';
}
echo '<fieldset>' . "\n";
echo ' <legend>' . __('Events') . '</legend>' . "\n";
if (! $events) {
echo __('There are no events to display.');
} else {
echo '<div style="display: none;" id="no_events">' . __('There are no events to display.') . '</div>';
echo '<table class="data" id="event_list">';
echo sprintf('<tr>
<th>%s</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>%s</th>
</tr>',
__('Name'),
__('Type'));
$ct=0;
$delimiter = '//';
if ($GLOBALS['cfg']['AjaxEnable']) {
$conditional_class = 'class="drop_event_anchor"';
} else {
$conditional_class = '';
}
foreach ($events as $event) {
// information_schema (at least in MySQL 5.1.22) does not return
// the full CREATE EVENT statement in a way that could be useful for us
// so we rely on PMA_DBI_get_definition() which uses SHOW CREATE EVENT
$definition = 'DROP EVENT ' . PMA_backquote($event['EVENT_NAME']) . $delimiter . "\n"
. PMA_DBI_get_definition($db, 'EVENT', $event['EVENT_NAME'])
. "\n";
$create_event = PMA_DBI_get_definition($db, 'EVENT', $event['EVENT_NAME']);
$definition = 'DROP EVENT IF EXISTS ' . PMA_backquote($event['EVENT_NAME'])
. $delimiter . "\n" . $create_event . "\n";
$sqlDrop = 'DROP EVENT ' . PMA_backquote($event['EVENT_NAME']);
echo sprintf('<tr class="%s">
<td><strong>%s</strong></td>
<td><span class="drop_sql" style="display:none;">%s</span><strong>%s</strong></td>
<td>%s</td>
<td><div class="create_sql" style="display: none;">%s</div>%s</td>
<td>%s</td>
<td>%s</td>
</tr>',
($ct%2 == 0) ? 'even' : 'odd',
$sqlDrop,
$event['EVENT_NAME'],
! empty($definition) ? PMA_linkOrButton('db_sql.php?' . $url_query . '&amp;sql_query=' . urlencode($definition) . '&amp;show_query=1&amp;db_query_force=1&amp;delimiter=' . urlencode($delimiter), $titles['Structure']) : '&nbsp;',
'<a ' . $conditional_class . ' href="sql.php?' . $url_query . '&amp;sql_query=' . urlencode($sqlDrop) . '" >' . $titles['Drop'] . '</a>',
! empty($definition) ? PMA_linkOrButton('db_sql.php?' . $url_query . '&amp;sql_query=' . urlencode($definition) . '&amp;show_query=1&amp;db_query_force=1&amp;delimiter=' . urlencode($delimiter), $titles['Edit']) : '&nbsp;',
$create_event,
'<a ' . $conditional_class_export . ' href="#" >' . $titles['Export'] . '</a>',
'<a ' . $conditional_class_drop . ' href="sql.php?' . $url_query . '&amp;sql_query=' . urlencode($sqlDrop) . '" >' . $titles['Drop'] . '</a>',
$event['EVENT_TYPE']);
$ct++;
}
echo '</table>';
echo '</fieldset>' . "\n";
echo '</div>' . "\n";
}
echo '</fieldset>' . "\n";
/**
* Display the state of the event scheduler
* and offer an option to toggle it.
*/
if (! empty($_GET['toggle_scheduler'])) {
$new_scheduler_state = $_GET['toggle_scheduler'];
if ($new_scheduler_state === 'ON' || $new_scheduler_state === 'OFF') {
PMA_DBI_query("SET GLOBAL event_scheduler='$new_scheduler_state'");
}
}
$es_state = PMA_DBI_fetch_value("SHOW GLOBAL VARIABLES LIKE 'event_scheduler'", 0, 1);
if ($es_state === 'ON' || $es_state === 'OFF') {
$es_change = ($es_state == 'ON') ? 'OFF' : 'ON';
echo '<fieldset>' . "\n" . PMA_getIcon('b_events.png') . __('The event scheduler is ') . $es_state . ':'
. ' <a href="db_events.php?' . $GLOBALS['url_query'] . '&amp;toggle_scheduler=' . $es_change . '">'
. __('Turn') . " $es_change\n"
. '</a>' . "\n"
. '</fieldset>' . "\n";
}
/**
* Display the form for adding a new event
*/
echo '<fieldset>' . "\n"
. ' <a href="db_events.php?' . $GLOBALS['url_query'] . '&amp;addevent=1" ' . $conditional_class_add . '>' . "\n"
. PMA_getIcon('b_event_add.png') . __('Add a new Event') . '</a>' . "\n"
. '</fieldset>' . "\n";
?>

View File

@ -93,6 +93,17 @@ if (! $db_is_information_schema) {
$tab_privileges['text'] = __('Privileges');
$tab_privileges['icon'] = 's_rights.png';
}
$tab_routines['link'] = 'db_routines.php';
$tab_routines['text'] = __('Routines');
$tab_routines['icon'] = 'b_routines.png';
$tab_events['link'] = 'db_events.php';
$tab_events['text'] = __('Events');
$tab_events['icon'] = 'b_events.png';
$tab_triggers['link'] = 'db_triggers.php';
$tab_triggers['text'] = __('Triggers');
$tab_triggers['icon'] = 'b_triggers.png';
}
/**
@ -110,6 +121,15 @@ if (! $db_is_information_schema) {
if ($is_superuser) {
$tabs[] =& $tab_privileges;
}
if (PMA_MYSQL_INT_VERSION >= 50002) {
$tabs[] =& $tab_routines;
}
if (PMA_MYSQL_INT_VERSION >= 50106) {
$tabs[] =& $tab_events;
}
if (PMA_MYSQL_INT_VERSION >= 50002) {
$tabs[] =& $tab_triggers;
}
}
if (PMA_Tracker::isActive()) {
$tabs[] =& $tab_tracking;

View File

@ -18,17 +18,33 @@ if (! defined('PHPMYADMIN')) {
exit;
}
// $url_query .= '&amp;goto=db_routines.php' . rawurlencode("?db=$db");
$routines = PMA_DBI_fetch_result('SELECT SPECIFIC_NAME,ROUTINE_NAME,ROUTINE_TYPE,DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA= \'' . PMA_sqlAddslashes($db,true) . '\';');
if ($routines) {
PMA_generate_slider_effect('routines', __('Routines'));
echo '<fieldset>' . "\n";
echo ' <legend>' . __('Routines') . '</legend>' . "\n";
echo '<table border="0">';
$conditional_class_add = '';
$conditional_class_drop = '';
$conditional_class_export = '';
if ($GLOBALS['cfg']['AjaxEnable']) {
$conditional_class_add = 'class="add_routine_anchor"';
$conditional_class_drop = 'class="drop_procedure_anchor"';
$conditional_class_export = 'class="export_procedure_anchor"';
}
echo '<fieldset>' . "\n";
echo ' <legend>' . __('Routines') . '</legend>' . "\n";
if (! $routines) {
echo __('There are no routines to display.');
} else {
echo '<div style="display: none;" id="no_routines">' . __('There are no routines to display.') . '</div>';
echo '<table class="data" id="routine_list">';
echo sprintf('<tr>
<th>%s</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>%s</th>
<th>%s</th>
</tr>',
@ -37,12 +53,6 @@ if ($routines) {
__('Return type'));
$ct=0;
$delimiter = '//';
if ($GLOBALS['cfg']['AjaxEnable']) {
$conditional_class = 'class="drop_procedure_anchor"';
} else {
$conditional_class = '';
}
foreach ($routines as $routine) {
// information_schema (at least in MySQL 5.0.45)
@ -50,9 +60,9 @@ if ($routines) {
// so we rely on PMA_DBI_get_definition() which
// uses SHOW CREATE
$create_proc = PMA_DBI_get_definition($db, $routine['ROUTINE_TYPE'], $routine['SPECIFIC_NAME']);
$definition = 'DROP ' . $routine['ROUTINE_TYPE'] . ' ' . PMA_backquote($routine['SPECIFIC_NAME']) . $delimiter . "\n"
. PMA_DBI_get_definition($db, $routine['ROUTINE_TYPE'], $routine['SPECIFIC_NAME'])
. "\n";
. $create_proc . "\n";
//if ($routine['ROUTINE_TYPE'] == 'PROCEDURE') {
// $sqlUseProc = 'CALL ' . $routine['SPECIFIC_NAME'] . '()';
@ -66,15 +76,16 @@ if ($routines) {
a method for running the function*/
//}
if ($routine['ROUTINE_TYPE'] == 'PROCEDURE') {
$sqlDropProc = 'DROP PROCEDURE ' . PMA_backquote($routine['SPECIFIC_NAME']);
$sqlDropProc = 'DROP PROCEDURE IF EXISTS ' . PMA_backquote($routine['SPECIFIC_NAME']);
} else {
$sqlDropProc = 'DROP FUNCTION ' . PMA_backquote($routine['SPECIFIC_NAME']);
$sqlDropProc = 'DROP FUNCTION IF EXISTS ' . PMA_backquote($routine['SPECIFIC_NAME']);
}
echo sprintf('<tr class="%s">
<td><input type="hidden" class="drop_procedure_sql" value="%s" /><strong>%s</strong></td>
<td><span class="drop_sql" style="display:none;">%s</span><strong>%s</strong></td>
<td>%s</td>
<td>%s</td>
<td><div class="create_sql" style="display: none;">%s</div>%s</td>
<td>%s</td>
<td>%s</td>
</tr>',
@ -82,13 +93,24 @@ if ($routines) {
$sqlDropProc,
$routine['ROUTINE_NAME'],
! empty($definition) ? PMA_linkOrButton('db_sql.php?' . $url_query . '&amp;sql_query=' . urlencode($definition) . '&amp;show_query=1&amp;db_query_force=1&amp;delimiter=' . urlencode($delimiter), $titles['Edit']) : '&nbsp;',
'<a ' . $conditional_class . ' href="sql.php?' . $url_query . '&amp;sql_query=' . urlencode($sqlDropProc) . '" >' . $titles['Drop'] . '</a>',
! empty($definition) ? PMA_linkOrButton('#', $titles['Execute']) : '&nbsp;',
$create_proc,
'<a ' . $conditional_class_export . ' href="#" >' . $titles['Export'] . '</a>',
'<a ' . $conditional_class_drop. ' href="sql.php?' . $url_query . '&amp;sql_query=' . urlencode($sqlDropProc) . '" >' . $titles['Drop'] . '</a>',
$routine['ROUTINE_TYPE'],
$routine['DTD_IDENTIFIER']);
$ct++;
}
echo '</table>';
echo '</fieldset>' . "\n";
echo '</div>' . "\n";
}
echo '</fieldset>' . "\n";
/**
* Display the form for adding a new routine
*/
echo '<fieldset>' . "\n"
. ' <a href="db_routines.php?' . $GLOBALS['url_query'] . '&amp;addroutine=1" class="' . $conditional_class_add . '">' . "\n"
. PMA_getIcon('b_routine_add.png') . __('Add a new Routine') . '</a>' . "\n"
. '</fieldset>' . "\n";
?>

View File

@ -0,0 +1,87 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
* @package phpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
$url_query .= '&amp;goto=tbl_triggers.php';
$triggers = PMA_DBI_get_triggers($db, $table);
$conditional_class_add = '';
$conditional_class_drop = '';
$conditional_class_export = '';
if ($GLOBALS['cfg']['AjaxEnable']) {
$conditional_class_add = 'class="add_trigger_anchor"';
$conditional_class_drop = 'class="drop_trigger_anchor"';
$conditional_class_export = 'class="export_trigger_anchor"';
}
echo '<fieldset>' . "\n";
echo ' <legend>' . __('Triggers') . '</legend>' . "\n";
if (! $triggers) {
echo __('There are no triggers to display.');
} else {
echo '<div style="display: none;" id="no_triggers">' . __('There are no triggers to display.') . '</div>';
echo '<table class="data" id="trigger_list">' . "\n";
// Print table header
echo "<tr>\n<th>" . __('Name') . "</th>\n";
if (empty($table)) {
// if we don't have a table name, we will be showing the per-database list.
// so we must specify which table each trigger belongs to
echo "<th>" . __('Table') . "</th>\n";
}
echo "<th>&nbsp;</th>\n";
echo "<th>&nbsp;</th>\n";
echo "<th>&nbsp;</th>\n";
echo "<th>" . __('Time') . "</th>\n";
echo "<th>" . __('Event') . "</th>\n";
echo "</tr>";
$ct=0;
$delimiter = '//';
// Print table contents
foreach ($triggers as $trigger) {
$drop_and_create = $trigger['drop'] . $delimiter . "\n" . $trigger['create'] . "\n";
$row = ($ct%2 == 0) ? 'even' : 'odd';
$editlink = PMA_linkOrButton('tbl_sql.php?' . $url_query . '&amp;sql_query='
. urlencode($drop_and_create) . '&amp;show_query=1&amp;delimiter=' . urlencode($delimiter), $titles['Edit']);
$exprlink = '<a ' . $conditional_class_export . ' href="#" >' . $titles['Export'] . '</a>';
$droplink = '<a ' . $conditional_class_drop . ' href="sql.php?' . $url_query . '&amp;sql_query='
. urlencode($trigger['drop']) . '" >' . $titles['Drop'] . '</a>';
echo "<tr class='noclick $row'>\n";
echo "<td><span class='drop_sql' style='display:none;'>{$trigger['drop']}</span>";
echo "<strong>{$trigger['name']}</strong></td>\n";
if (empty($table)) {
echo "<td><a href='tbl_triggers.php?db=$db&amp;table={$trigger['table']}'>";
echo $trigger['table'] . "</a></td>\n";
}
echo "<td>$editlink</td>\n";
echo "<td><div class='create_sql' style='display: none;'>{$trigger['create']}</div>$exprlink</td>\n";
echo "<td>$droplink</td>\n";
echo "<td>{$trigger['action_timing']}</td>\n";
echo "<td>{$trigger['event_manipulation']}</td>\n";
echo "</tr>\n";
$ct++;
}
echo '</table>';
}
echo '</fieldset>';
/**
* Display the form for adding a new trigger
*/
if (! empty($table)) {
echo '<fieldset>' . "\n"
. ' <a href="tbl_triggers.php?' . $GLOBALS['url_query'] . '&amp;addtrigger=1" class="' . $conditional_class_add . '">' . "\n"
. PMA_getIcon('b_trigger_add.png') . __('Add a new Trigger') . '</a>' . "\n"
. '</fieldset>' . "\n";
}
?>

View File

@ -39,6 +39,13 @@ $err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url($url_params);
*/
require_once './libraries/header.inc.php';
/**
* Ensure that $db_is_information_schema is not null
*/
if (! isset($db_is_information_schema)) {
$db_is_information_schema = false;
}
/**
* Displays links
*/
@ -61,7 +68,7 @@ $tabs['search']['icon'] = 'b_search.png';
$tabs['search']['text'] = __('Search');
$tabs['search']['link'] = 'tbl_select.php';
if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
if (!$db_is_information_schema) {
$tabs['insert']['icon'] = 'b_insrow.png';
$tabs['insert']['link'] = 'tbl_change.php';
$tabs['insert']['text'] = __('Insert');
@ -76,7 +83,7 @@ $tabs['export']['text'] = __('Export');
* Don't display "Import" and "Operations"
* for views and information_schema
*/
if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema)) {
if (! $tbl_is_view && !$db_is_information_schema) {
$tabs['import']['icon'] = 'b_tblimport.png';
$tabs['import']['link'] = 'tbl_import.php';
$tabs['import']['text'] = __('Import');
@ -90,13 +97,16 @@ if(PMA_Tracker::isActive()) {
$tabs['tracking']['text'] = __('Tracking');
$tabs['tracking']['link'] = 'tbl_tracking.php';
}
if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema)) {
if (! $db_is_information_schema && PMA_MYSQL_INT_VERSION >= 50002) {
$tabs['triggers']['link'] = 'tbl_triggers.php';
$tabs['triggers']['text'] = __('Triggers');
$tabs['triggers']['icon'] = 'b_triggers.png';
}
/**
* Views support a limited number of operations
*/
if ($tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema)) {
if ($tbl_is_view && !$db_is_information_schema) {
$tabs['operation']['icon'] = 'b_tblops.png';
$tabs['operation']['link'] = 'view_operations.php';
$tabs['operation']['text'] = __('Operations');

View File

@ -1,58 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
* @package phpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
$url_query .= '&amp;goto=tbl_structure.php';
$triggers = PMA_DBI_get_triggers($db, $table);
if ($triggers) {
echo '<div id="tabletriggers">' . "\n";
echo '<table class="data">' . "\n";
echo ' <caption class="tblHeaders">' . __('Triggers') . '</caption>' . "\n";
echo sprintf('<tr>
<th>%s</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>%s</th>
<th>%s</th>
</tr>',
__('Name'),
__('Time'),
__('Event'));
$ct=0;
$delimiter = '//';
if ($GLOBALS['cfg']['AjaxEnable']) {
$conditional_class = 'class="drop_trigger_anchor"';
} else {
$conditional_class = '';
}
foreach ($triggers as $trigger) {
$drop_and_create = $trigger['drop'] . $delimiter . "\n" . $trigger['create'] . "\n";
echo sprintf('<tr class="noclick %s">
<td><strong>%s</strong></td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
</tr>',
($ct%2 == 0) ? 'even' : 'odd',
$trigger['name'],
PMA_linkOrButton('tbl_sql.php?' . $url_query . '&amp;sql_query=' . urlencode($drop_and_create) . '&amp;show_query=1&amp;delimiter=' . urlencode($delimiter), $titles['Change']),
'<a ' . $conditional_class . ' href="sql.php?' . $url_query . '&sql_query=' . urlencode($trigger['drop']) . '" >' . $titles['Drop'] . '</a>',
$trigger['action_timing'],
$trigger['event_manipulation']);
$ct++;
}
echo '</table>';
echo '</div>' . "\n";
}
?>

View File

@ -933,8 +933,6 @@ if ($cfg['ShowStats']) {
}
// END - Calc Table Space
require './libraries/tbl_triggers.lib.php';
echo '<div class="clearfloat"></div>' . "\n";
/**

40
tbl_triggers.php Normal file
View File

@ -0,0 +1,40 @@
<?php
/**
*
*/
require_once './libraries/common.inc.php';
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
$GLOBALS['js_include'][] = 'display_triggers.js';
require_once './libraries/common.lib.php';
require_once './libraries/tbl_common.php';
/**
* Create labels for the list
*/
$titles = PMA_buildActionTitles();
/**
* Displays the header
*/
require_once './libraries/header.inc.php';
/**
* Displays the tabs
*/
require_once './libraries/tbl_links.inc.php';
/**
* Displays the list of triggers
*/
require_once './libraries/display_triggers.inc.php';
/**
* Displays the footer
*/
require './libraries/footer.inc.php';
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 927 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 969 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 927 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 969 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B