1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-13 03:54:57 +01:00

- add return links to approve details [#6252]

- lets decide on input field or textarea based on the entry length in language pack management [#6280]


git-svn-id: file:///svn/phpbb/trunk@6819 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2006-12-28 17:28:28 +00:00
parent d6ef968a67
commit cbb50049a5
6 changed files with 67 additions and 106 deletions

View File

@ -72,7 +72,7 @@
<h1>{L_MISSING_LANG_VARIABLES}</h1>
<p>{L_MISSING_VARS_EXPLAIN}</p>
<form id="missing" method="post" action="{U_MISSING_ACTION}">
<table cellspacing="1">
@ -104,14 +104,14 @@
<p>{L_LANGUAGE_ENTRIES_EXPLAIN}</p>
<form id="entries" method="post" action="{U_ENTRY_ACTION}">
<form id="lang_entries" method="post" action="{U_ENTRY_ACTION}">
<!-- IF S_FROM_STORE -->
<fieldset class="quick" style="float: left;">
<input type="submit" name="remove_store" value="{L_REMOVE_FROM_STORAGE_FOLDER}" class="button2" />
</fieldset>
<!-- ENDIF -->
<fieldset class="quick" style="float: right;">
<select name="language_file">{S_LANG_OPTIONS}</select>&nbsp;<input type="submit" class="button2" name="change" value="{L_SELECT}" />
</fieldset>

View File

@ -622,16 +622,15 @@ class acp_language
if (!$is_email_file)
{
$method = ($is_help_file) ? 'print_help_entries' : 'print_language_entries';
$tpl = '';
$name = (($this->language_directory) ? $this->language_directory . '/' : '') . $this->language_file;
if (isset($missing_vars[$name]) && sizeof($missing_vars[$name]))
{
$tpl .= $this->$method($missing_vars[$name], '* ');
$tpl .= $this->print_language_entries($missing_vars[$name], '* ');
}
$tpl .= $this->$method($lang);
$tpl .= $this->print_language_entries($lang);
$template->assign_var('TPL', $tpl);
unset($tpl);
@ -950,7 +949,7 @@ class acp_language
* {FILENAME} [{LANG_NAME}]
*
* @package language
* @copyright (c) 2006 phpBB Group
* @copyright (c) ' . date('Y') . ' phpBB Group
* @author {CHANGED} - {AUTHOR}
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@ -1029,6 +1028,35 @@ $lang = array_merge($lang, array(
}
}
/**
* Little helper to add some hardcoded template bits
*/
function add_input_field()
{
$keys = func_get_args();
$non_static = array_shift($keys);
$value = array_shift($keys);
if (!$non_static)
{
return '<strong>' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '</strong>';
}
// If more then 270 characters, then we present a textarea, else an input field
$textarea = (utf8_strlen($value) > 270) ? true : false;
$tpl = '';
$tpl .= ($textarea) ? '<textarea name="' : '<input type="text" name="';
$tpl .= 'entry[' . implode('][', array_map('utf8_htmlspecialchars', $keys)) . ']"';
$tpl .= ($textarea) ? ' cols="80" rows="5" style="width: 90%;">' : ' style="width: 90%" value="';
$tpl .= htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
$tpl .= ($textarea) ? '</textarea>' : '" />';
return $tpl;
}
/**
* Print language entries
*/
@ -1040,56 +1068,46 @@ $lang = array_merge($lang, array(
{
if (is_array($value))
{
// Write key
$tpl .= '
<tr>
<td class="row3" colspan="2">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<b>' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '</b></td>
<td class="row3" colspan="2">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<strong>' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '</strong></td>
</tr>';
foreach ($value as $_key => $_value)
{
if (is_array($_value))
{
// Write key
$tpl .= '
<tr>
<td class="row3" colspan="2">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '&nbsp; &nbsp;<b>' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '</b></td>
<td class="row3" colspan="2">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '&nbsp; &nbsp;<strong>' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '</strong></td>
</tr>';
foreach ($_value as $__key => $__value)
{
// Write key
$tpl .= '
<tr>
<td class="row1" style="white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<b>' . htmlspecialchars($__key, ENT_COMPAT, 'UTF-8') . '</b></td>
<td class="row1" style="white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<strong>' . htmlspecialchars($__key, ENT_COMPAT, 'UTF-8') . '</strong></td>
<td class="row2">';
if ($input_field)
{
$tpl .= '<input type="text" name="entry[' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '][' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '][' . htmlspecialchars($__key, ENT_COMPAT, 'UTF-8') . ']" value="' . htmlspecialchars($__value, ENT_COMPAT, 'UTF-8') . '" size="50" />';
}
else
{
$tpl .= '<b>' . htmlspecialchars($__value, ENT_COMPAT, 'UTF-8') . '</b>';
}
$tpl .= $this->add_input_field($input_field, $__value, $key, $_key, $__key);
$tpl .= '</td>
</tr>';
}
}
else
{
// Write key
$tpl .= '
<tr>
<td class="row1" style="white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<b>' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '</b></td>
<td class="row1" style="white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<strong>' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '</strong></td>
<td class="row2">';
if ($input_field)
{
$tpl .= '<input type="text" name="entry[' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '][' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . ']" value="' . htmlspecialchars($_value, ENT_COMPAT, 'UTF-8') . '" size="50" />';
}
else
{
$tpl .= '<b>' . htmlspecialchars($_value, ENT_COMPAT, 'UTF-8') . '</b>';
}
$tpl .= $this->add_input_field($input_field, $_value, $key, $_key);
$tpl .= '</td>
</tr>';
}
@ -1102,84 +1120,13 @@ $lang = array_merge($lang, array(
}
else
{
// Write key
$tpl .= '
<tr>
<td class="row1" style="white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<b>' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '</b></td>
<td class="row1" style="white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<strong>' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '</strong></td>
<td class="row2">';
if ($input_field)
{
$tpl .= '<input type="text" name="entry[' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . ']" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '" size="50" />';
}
else
{
$tpl .= '<b>' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '</b>';
}
$tpl .= '</td>
</tr>';
}
}
return $tpl;
}
/**
* Print help entries
*/
function print_help_entries(&$lang_ary, $key_prefix = '', $text_field = true)
{
$tpl = '';
foreach ($lang_ary as $key => $value)
{
if (is_array($value))
{
$tpl .= '
<tr>
<td class="row3" colspan="2">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<b>' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '</b></td>
</tr>';
foreach ($value as $_key => $_value)
{
$tpl .= '
<tr>
<td class="row1" style="width: 10%; white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<b>' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '</b></td>
<td class="row2">';
if ($text_field)
{
$tpl .= '<textarea name="entry[' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '][' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . ']" cols="80" rows="5" style="width: 90%;">' . htmlspecialchars($_value, ENT_COMPAT, 'UTF-8') . '</textarea>';
}
else
{
$tpl .= '<b>' . htmlspecialchars($_value, ENT_COMPAT, 'UTF-8') . '</b>';
}
$tpl .= '</td>
</tr>';
}
$tpl .= '
<tr>
<td class="spacer" colspan="2">&nbsp;</td>
</tr>';
}
else
{
$tpl .= '
<tr>
<td class="row1" style="width: 10%; white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<b>' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '</b></td>
<td class="row2">';
if ($text_field)
{
$tpl .= '<textarea name="entry[' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . ']" cols="80" rows="5" style="width: 90%;">' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '</textarea>';
}
else
{
$tpl .= '<b>' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '</b>';
}
$tpl .= $this->add_input_field($input_field, $value, $key);
$tpl .= '</td>
</tr>';

View File

@ -110,6 +110,9 @@ class mcp_queue
}
$message = smiley_text($message);
$post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
$topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']);
$template->assign_vars(array(
'S_MCP_QUEUE' => true,
'S_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&amp;p=$post_id&amp;f=$forum_id"),
@ -124,10 +127,12 @@ class mcp_queue
'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&amp;mode=user_notes&amp;u=' . $post_info['user_id']),
'U_MCP_WARN_USER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&amp;mode=warn_user&amp;u=' . $post_info['user_id']) : '',
'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;p=' . $post_info['post_id'] . '#p' . $post_info['post_id']),
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']),
'U_VIEW_POST' => $post_url,
'U_VIEW_TOPIC' => $topic_url,
'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue' . (($topic_id) ? '&amp;mode=unapproved_topics' : '&amp;mode=unapproved_posts')) . "&amp;start=$start\">", '</a>'),
'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'),
'RETURN_TOPIC_SIMPLE' => sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '<a href="' . $topic_url . '">', '</a>'),
'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']),
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']),
'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']),

View File

@ -1004,4 +1004,12 @@ function utf8_clean_string($text)
return $text;
}
/**
* A wrapper for htmlspecialchars($value, ENT_COMPAT, 'UTF-8')
*/
function utf8_htmlspecialchars(&$value)
{
return htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
}
?>

View File

@ -261,6 +261,7 @@ $lang = array_merge($lang, array(
'RETURN_POST' => '%sReturn to the post%s',
'RETURN_QUEUE' => '%sReturn to the queue%s',
'RETURN_REPORTS' => '%sReturn to the reports%s',
'RETURN_TOPIC_SIMPLE' => '%sReturn to the topic%s',
'SEARCH_POSTS_BY_USER' => 'Search posts by',
'SELECT_ACTION' => 'Select desired action',

View File

@ -45,7 +45,7 @@
<th colspan="2" align="center">{L_POST_DETAILS}</th>
</tr>
<tr>
<td class="row3" colspan="2" align="center"><span class="gensmall"><!-- IF S_MCP_QUEUE -->{RETURN_QUEUE}<!-- ELSEIF S_MCP_REPORT -->{RETURN_REPORTS}<!-- ELSE -->{RETURN_TOPIC}<!-- ENDIF --></span></td>
<td class="row3" colspan="2" align="center"><span class="gensmall"><!-- IF S_MCP_QUEUE -->{RETURN_QUEUE} | {RETURN_TOPIC_SIMPLE} | {RETURN_POST}<!-- ELSEIF S_MCP_REPORT -->{RETURN_REPORTS}<!-- ELSE -->{RETURN_TOPIC}<!-- ENDIF --></span></td>
</tr>
<tr>
<td class="row1"><b class="gen">{L_POST_SUBJECT}: </b></td>