Customizable window title (RFE #1408241).

This commit is contained in:
Michal Čihař
2006-02-22 11:20:57 +00:00
parent b105c6c0eb
commit 8b7b4ed53e
4 changed files with 46 additions and 27 deletions

View File

@@ -18,6 +18,8 @@ $Source$
Possibility to select SQL compatibility on import (RFE #1386132). Possibility to select SQL compatibility on import (RFE #1386132).
* main.php, lang/*: Better message for reloading privileges (RFE * main.php, lang/*: Better message for reloading privileges (RFE
#1420556). #1420556).
* Documentation.html, libraries/config.default.php,
libraries/header.inc.php: Customizable window title (RFE #1408241).
2006-02-22 Sebastian Mendel <cybot_tm@users.sourceforge.net> 2006-02-22 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* libraries/footer.inc.php: * libraries/footer.inc.php:

View File

@@ -1623,14 +1623,24 @@ ALTER TABLE `pma_column_comments`
t1, t2, t10). Currently implemented in the left panel (Light mode) t1, t2, t10). Currently implemented in the left panel (Light mode)
and in Database view, for the table list.</dd> and in Database view, for the table list.</dd>
<dt id="cfg_ShowHttpHostTitle">$cfg[ShowHttpHostTitle] boolean</dt> <dt id="cfg_TitleTable">$cfg[TitleTable] string</dt>
<dd>Shows the <abbr title="HyperText Transfer Protocol">HTTP</abbr> host name <dt id="cfg_TitleDatabase">$cfg[TitleDatabase] string</dt>
in window's title bar.</dd> <dt id="cfg_TitleServer">$cfg[TitleServer] string</dt>
<dt id="cfg_TitleDefault">$cfg[TitleDefault] string</dt>
<dt id="cfg_SetHttpHostTitle">$cfg[SetHttpHostTitle] string</dt> <dd>Allows you to specify window's title bar. Following magic string can
<dd>If <tt>$cfg['ShowHttpHostTitle']</tt> is <tt>TRUE</tt>, it shows the real be used to get special values:
<abbr title="HyperText Transfer Protocol">HTTP</abbr> host name, unless <dl>
an alternate name is set here.</dd> <dt><code>@HTTP_HOST@</code></dt>
<dd>HTTP host that runs phpMyAdmin</dd>
<dt><code>@SERVER@</code></dt>
<dd>MySQL server name</dd>
<dt><code>@DATABASE@</code></dt>
<dd>Currently opened database</dd>
<dt><code>@TABLE@</code></dt>
<dd>Currently opened table</dd>
<dt><code>@PHPMYADMIN@</code></dt>
<dd>phpMyAdmin with version</dd>
</dl>
<dt id="cfg_ErrorIconic">$cfg[ErrorIconic] boolean</dt> <dt id="cfg_ErrorIconic">$cfg[ErrorIconic] boolean</dt>
<dd>Uses icons for warnings, errors and informations.</dd> <dd>Uses icons for warnings, errors and informations.</dd>

View File

@@ -514,10 +514,11 @@ $cfg['NaturalOrder'] = TRUE; // Sort table and database in natura
// FIXME: // FIXME:
// 2004-05-08 rabus: We need to rearrange these variables. // 2004-05-08 rabus: We need to rearrange these variables.
$cfg['ShowHttpHostTitle'] = TRUE; // show HttpHost in browsers window title (true|false)? // Window title settings
$cfg['SetHttpHostTitle'] = ''; // if ShowHttpHostTitle=true, please set your host (server) $cfg['TitleTable'] = '@HTTP_HOST@ / @SERVER@ / @DATABASE@ / @TABLE@ | @PHPMYADMIN@';
// or an other string, wich should be shown in browsers window title. $cfg['TitleDatabase'] = '@HTTP_HOST@ / @SERVER@ / @DATABASE@ | @PHPMYADMIN@';
// If not set (or empty), the PMA will get your real Host-Adress. $cfg['TitleServer'] = '@HTTP_HOST@ / @SERVER@ | @PHPMYADMIN@';
$cfg['TitleDefault'] = '@HTTP_HOST@ | @PHPMYADMIN@';
$cfg['ErrorIconic'] = TRUE; // show some icons for warning, error and information messages (true|false)? $cfg['ErrorIconic'] = TRUE; // show some icons for warning, error and information messages (true|false)?
$cfg['MainPageIconic'] = TRUE; // show icons in list on main page and on menu tabs (true|false)? $cfg['MainPageIconic'] = TRUE; // show icons in list on main page and on menu tabs (true|false)?

View File

@@ -26,27 +26,33 @@ if (empty($GLOBALS['is_header_sent'])) {
require_once('./libraries/header_meta_style.inc.php'); require_once('./libraries/header_meta_style.inc.php');
// generate title // generate title
$title = ''; $title = str_replace(
if ($cfg['ShowHttpHostTitle']) { array(
$title .= (empty($GLOBALS['cfg']['SetHttpHostTitle']) && isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $GLOBALS['cfg']['SetHttpHostTitle']) . ' / '; '@HTTP_HOST@',
} '@SERVER@',
if (!empty($GLOBALS['cfg']['Server']) && isset($GLOBALS['cfg']['Server']['host'])) { '@DATABASE@',
$title.=str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['host']); '@TABLE@',
} '@PHPMYADMIN@',
if (isset($GLOBALS['db'])) { ),
$title .= ' / ' . str_replace('\'', '\\\'', $GLOBALS['db']); array(
} isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '',
if (isset($GLOBALS['table'])) { isset($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['Server']['host'] : '',
$title .= (empty($title) ? '' : ' ') . ' / ' . str_replace('\'', '\\\'', $GLOBALS['table']); isset($GLOBALS['db']) ? $GLOBALS['db'] : '',
} isset($GLOBALS['table']) ? $GLOBALS['table'] : '',
$title .= ' | phpMyAdmin ' . PMA_VERSION; 'phpMyAdmin ' . PMA_VERSION,
),
!empty($GLOBALS['table']) ? $GLOBALS['cfg']['TitleTable'] :
(!empty($GLOBALS['db']) ? $GLOBALS['cfg']['TitleDatabase'] :
(!empty($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['TitleServer'] :
$GLOBALS['cfg']['TitleDefault']))
);
?> ?>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
<!-- <!--
// Updates the title of the frameset if possible (ns4 does not allow this) // Updates the title of the frameset if possible (ns4 does not allow this)
if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown' if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
&& typeof(parent.document.title) == 'string') { && typeof(parent.document.title) == 'string') {
parent.document.title = '<?php echo PMA_sanitize($title); ?>'; parent.document.title = '<?php echo PMA_sanitize(str_replace('\'', '\\\'', $title)); ?>';
} }
<?php <?php
// Add some javascript instructions if required // Add some javascript instructions if required