fix restore-default not showing after page load

setup script comments for fields that set constraints on user preferences (MaxDbLost, MaxTableList)
This commit is contained in:
Crack
2010-07-17 22:43:38 +02:00
parent b71edb5380
commit cf99d6511f
6 changed files with 22 additions and 25 deletions

View File

@@ -597,7 +597,6 @@ $(function() {
link.css({display: 'inline-block', opacity: 0.25});
if (link.hasClass('restore-default')) {
// restore-default is handled by markField
link.find('img').hide();
}
link.bind({
mouseenter: function() {$(this).css('opacity', 1);},

View File

@@ -313,7 +313,7 @@ class FormDisplay
$translated_path, $show_restore_default, $userprefs_allow, array &$js_default)
{
$name = PMA_lang_name($system_path);
$description = PMA_lang_desc($system_path);
$description = PMA_lang_name($system_path, 'desc', '');
$cf = ConfigFile::getInstance();
$value = $cf->get($work_path);
@@ -328,7 +328,8 @@ class FormDisplay
'doc' => $this->getDocLink($system_path),
'wiki' => $this->getWikiLink($system_path),
'show_restore_default' => $show_restore_default,
'userprefs_allow' => $userprefs_allow);
'userprefs_allow' => $userprefs_allow,
'userprefs_comment' => PMA_lang_name($system_path, 'cmt', ''));
if (isset($form->default[$system_path])) {
$opts['setvalue'] = $form->default[$system_path];
}

View File

@@ -105,6 +105,7 @@ function display_fieldset_top($title = '', $description = '', $errors = null, $a
* o setvalue - (string) shows button allowing to set poredefined value
* o show_restore_default - (boolean) whether show "restore default" button
* o userprefs_allow - whether user preferences are enabled for this field (null - no support, true/false - enabled/disabled)
* o userprefs_comment - (string) field comment
* o values - key - value paris for <select> fields
* o values_escaped - (boolean) tells whether values array is already escaped (defaults to false)
* o values_disabled - (array)list of disabled values (keys from values)
@@ -164,7 +165,6 @@ function display_input($path, $name, $description = '', $type, $value, $value_is
<span class="disabled-notice" title="<?php echo __('This setting is disabled, it will not be applied to your configuration') ?>"><?php echo __('Disabled') ?></span>
<?php endif; ?>
<?php if (!empty($description)) { ?><small><?php echo $description ?></small><?php } ?>
</th>
<td>
<?php
@@ -222,6 +222,11 @@ function display_input($path, $name, $description = '', $type, $value, $value_is
. '</textarea>';
break;
}
if ($is_setup_script && isset($opts['userprefs_comment']) && $opts['userprefs_comment']) {
?>
<a class="userprefs-comment" title="<?php echo htmlspecialchars($opts['userprefs_comment']) ?>"><img alt="comment" src="<?php echo $img_path ?>b_tblops.png" width="16" height="16" /></a>
<?php
}
if (isset($opts['setvalue']) && $opts['setvalue']) {
?>
<a class="set-value" href="#<?php echo "$path={$opts['setvalue']}" ?>" title="<?php echo sprintf(__('Set value: %s'), htmlspecialchars($opts['setvalue'])) ?>" style="display:none"><img alt="set-value" src="<?php echo $img_path ?>b_edit.png" width="16" height="16" /></a>

View File

@@ -57,37 +57,22 @@ function PMA_lang($lang_key)
}
/**
* Returns translated field name
* Returns translated field name/description or comment
*
* @param string $canonical_path
* @param string $type 'name', 'desc' or 'cmt'
* @param mixed $default
* @return string
*/
function PMA_lang_name($canonical_path)
function PMA_lang_name($canonical_path, $type = 'name', $default = 'key')
{
$lang_key = str_replace(
array('Servers/1/', '/'),
array('Servers/', '_'),
$canonical_path) . '_name';
$canonical_path) . '_' . $type;
return isset($GLOBALS["strConfig$lang_key"])
? $GLOBALS["strConfig$lang_key"]
: $lang_key;
}
/**
* Returns translated field description
*
* @param string $canonical_path
* @return string
*/
function PMA_lang_desc($canonical_path)
{
$lang_key = str_replace(
array('Servers/1/', '/'),
array('Servers/', '_'),
$canonical_path) . '_desc';
return isset($GLOBALS["strConfig$lang_key"])
? PMA_lang($lang_key)
: '';
: ($default == 'key' ? $lang_key : $default);
}
/**

View File

@@ -290,10 +290,12 @@ $strConfigLongtextDoubleTextarea_name = __('Bigger textarea for LONGTEXT');
$strConfigMainPageIconic_name = __('Use icons on main page');
$strConfigMaxCharactersInDisplayedSQL_desc = __('Maximum number of characters used when a SQL query is displayed');
$strConfigMaxCharactersInDisplayedSQL_name = __('Maximum displayed SQL length');
$strConfigMaxDbList_cmt = __('Users cannot set a higher value');
$strConfigMaxDbList_desc = __('Maximum number of databases displayed in left frame and database list');
$strConfigMaxDbList_name = __('Maximum databases');
$strConfigMaxRows_desc = __('Number of rows displayed when browsing a result set. If the result set contains more rows, &quot;Previous&quot; and &quot;Next&quot; links will be shown.');
$strConfigMaxRows_name = __('Maximum number of rows to display');
$strConfigMaxTableList_cmt = __('Users cannot set a higher value');
$strConfigMaxTableList_desc = __('Maximum number of tables displayed in table list');
$strConfigMaxTableList_name = __('Maximum tables');
$strConfigMemoryLimit_desc = __('The number of bytes a script is allowed to allocate, eg. [kbd]32M[/kbd] ([kbd]0[/kbd] for no limit)');

View File

@@ -195,6 +195,11 @@ ul.tabs li a:hover, ul.tabs li a:active {
margin-bottom: -3px;
}
.userprefs-comment {
cursor: help;
float: right;
}
/* forms */
fieldset {