Generalize doc_link()

This commit is contained in:
Jakub Vrana 2013-08-05 18:55:27 -07:00
parent 3cf3560a20
commit e7e5559df5
5 changed files with 25 additions and 15 deletions

View file

@ -60,7 +60,10 @@ if ($_POST) {
echo ($_POST["add_x"] || strpos($name, "\n") echo ($_POST["add_x"] || strpos($name, "\n")
? '<textarea id="name" name="name" rows="10" cols="40">' . h($name) . '</textarea><br>' ? '<textarea id="name" name="name" rows="10" cols="40">' . h($name) . '</textarea><br>'
: '<input name="name" id="name" value="' . h($name) . '" maxlength="64" autocapitalize="off">' : '<input name="name" id="name" value="' . h($name) . '" maxlength="64" autocapitalize="off">'
) . "\n" . ($collations ? html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $row["collation"]) . doc_link("charset-charsets.html") : ""); ) . "\n" . ($collations ? html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $row["collation"]) . doc_link(array(
'sql' => "charset-charsets.html",
'mssql' => "ms187963.aspx",
)) : "");
?> ?>
<script type='text/javascript'>focus(document.getElementById('name'));</script> <script type='text/javascript'>focus(document.getElementById('name'));</script>
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">

View file

@ -69,7 +69,12 @@ foreach ($row["source"] as $key => $val) {
<p> <p>
<?php echo lang('ON DELETE'); ?>: <?php echo html_select("on_delete", array(-1 => "") + explode("|", $on_actions), $row["on_delete"]); ?> <?php echo lang('ON DELETE'); ?>: <?php echo html_select("on_delete", array(-1 => "") + explode("|", $on_actions), $row["on_delete"]); ?>
<?php echo lang('ON UPDATE'); ?>: <?php echo html_select("on_update", array(-1 => "") + explode("|", $on_actions), $row["on_update"]); ?> <?php echo lang('ON UPDATE'); ?>: <?php echo html_select("on_update", array(-1 => "") + explode("|", $on_actions), $row["on_update"]); ?>
<?php echo doc_link("innodb-foreign-key-constraints.html"); ?> <?php echo doc_link(array(
'sql' => "innodb-foreign-key-constraints.html",
'pgsql' => "sql-createtable.html#SQL-CREATETABLE-REFERENCES",
'mssql' => "ms174979.aspx",
'oracle' => "clauses002.htm#sthref2903",
)); ?>
<p> <p>
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
<noscript><p><input type="submit" name="add" value="<?php echo lang('Add column'); ?>"></noscript> <noscript><p><input type="submit" name="add" value="<?php echo lang('Add column'); ?>"></noscript>

View file

@ -49,7 +49,7 @@ function select($result, $connection2 = null, $orgtables = array()) {
} }
$types[$j] = $field->type; $types[$j] = $field->type;
echo "<th" . ($orgtable != "" || $field->name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . h($name) echo "<th" . ($orgtable != "" || $field->name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . h($name)
. ($orgtables ? doc_link("explain-output.html#explain_" . strtolower($name)) : "") . ($orgtables ? doc_link(array('sql' => "explain-output.html#explain_" . strtolower($name))) : "")
; ;
} }
echo "</thead>\n"; echo "</thead>\n";
@ -452,21 +452,19 @@ function ini_bytes($ini) {
} }
/** Create link to database documentation /** Create link to database documentation
* @param string * @param array $jush => $path
* @return string HTML code * @return string HTML code
*/ */
function doc_link($path) { function doc_link($paths) {
global $jush, $connection; global $jush, $connection;
$urls = array( $urls = array(
'sql' => "http://dev.mysql.com/doc/refman/" . substr($connection->server_info, 0, 3) . "/en/", 'sql' => "http://dev.mysql.com/doc/refman/" . substr($connection->server_info, 0, 3) . "/en/",
/* not used: 'sqlite' => "http://www.sqlite.org/",
'sqlite' => "http://www.sqlite.org/", 'pgsql' => "http://www.postgresql.org/docs/" . substr($connection->server_info, 0, 3) . "/static/",
'pgsql' => "http://www.postgresql.org/docs/" . substr($connection->server_info, 0, 3) . "/static/", 'mssql' => "http://msdn.microsoft.com/library/",
'mssql' => "http://msdn.microsoft.com/library/", 'oracle' => "http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/",
'oracle' => "http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/",
*/
); );
return ($urls[$jush] ? "<a href='$urls[$jush]$path' target='_blank' rel='noreferrer'><sup>?</sup></a>" : ""); return ($paths[$jush] ? "<a href='$urls[$jush]$paths[$jush]' target='_blank' rel='noreferrer'><sup>?</sup></a>" : "");
} }
/** Return events to display help on mouse over /** Return events to display help on mouse over

View file

@ -22,7 +22,11 @@ foreach (process_list() as $i => $row) {
if (!$i) { if (!$i) {
echo "<thead><tr lang='en'>" . (support("kill") ? "<th>&nbsp;" : ""); echo "<thead><tr lang='en'>" . (support("kill") ? "<th>&nbsp;" : "");
foreach ($row as $key => $val) { foreach ($row as $key => $val) {
echo "<th>$key" . doc_link("show-processlist.html#processlist_" . strtolower($key)); echo "<th>$key" . doc_link(array(
'sql' => "show-processlist.html#processlist_" . strtolower($key),
'pgsql' => "monitoring-stats.html#PG-STAT-ACTIVITY-VIEW",
'oracle' => "../b14237/dynviews_2088.htm",
));
} }
echo "</thead>\n"; echo "</thead>\n";
} }

View file

@ -142,7 +142,7 @@ if ($_POST) {
<?php <?php
//! MAX_* limits, REQUIRE //! MAX_* limits, REQUIRE
echo "<table cellspacing='0'>\n"; echo "<table cellspacing='0'>\n";
echo "<thead><tr><th colspan='2'>" . lang('Privileges') . doc_link("grant.html#priv_level"); echo "<thead><tr><th colspan='2'>" . lang('Privileges') . doc_link(array('sql' => "grant.html#priv_level"));
$i = 0; $i = 0;
foreach ($grants as $object => $grant) { foreach ($grants as $object => $grant) {
echo '<th>' . ($object != "*.*" ? "<input name='objects[$i]' value='" . h($object) . "' size='10' autocapitalize='off'>" : "<input type='hidden' name='objects[$i]' value='*.*' size='10'>*.*"); //! separate db, table, columns, PROCEDURE|FUNCTION, routine echo '<th>' . ($object != "*.*" ? "<input name='objects[$i]' value='" . h($object) . "' size='10' autocapitalize='off'>" : "<input type='hidden' name='objects[$i]' value='*.*' size='10'>*.*"); //! separate db, table, columns, PROCEDURE|FUNCTION, routine