diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-12-28 17:28:28 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-12-28 17:28:28 +0000 |
commit | cbb50049a575a64e481f94e0a51280507d3d19ba (patch) | |
tree | 056cea04c14c952eff70a3254d6c2ac83d2ce40e | |
parent | d6ef968a679f97e60d62bfae7ac2856cb8334591 (diff) | |
download | forums-cbb50049a575a64e481f94e0a51280507d3d19ba.tar forums-cbb50049a575a64e481f94e0a51280507d3d19ba.tar.gz forums-cbb50049a575a64e481f94e0a51280507d3d19ba.tar.bz2 forums-cbb50049a575a64e481f94e0a51280507d3d19ba.tar.xz forums-cbb50049a575a64e481f94e0a51280507d3d19ba.zip |
- 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
-rw-r--r-- | phpBB/adm/style/acp_language.html | 6 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_language.php | 147 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 9 | ||||
-rw-r--r-- | phpBB/includes/utf/utf_tools.php | 8 | ||||
-rw-r--r-- | phpBB/language/en/mcp.php | 1 | ||||
-rw-r--r-- | phpBB/styles/subSilver/template/mcp_post.html | 2 |
6 files changed, 67 insertions, 106 deletions
diff --git a/phpBB/adm/style/acp_language.html b/phpBB/adm/style/acp_language.html index d7a4a31901..37b1e032f2 100644 --- a/phpBB/adm/style/acp_language.html +++ b/phpBB/adm/style/acp_language.html @@ -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> <input type="submit" class="button2" name="change" value="{L_SELECT}" /> </fieldset> diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index abd01b6263..94a79fa2d3 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -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 * @@ -1030,6 +1029,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 */ function print_language_entries(&$lang_ary, $key_prefix = '', $input_field = true) @@ -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') . ' <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) { + // 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="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"> </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="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 ($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>'; diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 48756c640e..d175cfa3fe 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -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'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']); + $topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&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&p=$post_id&f=$forum_id"), @@ -124,10 +127,12 @@ class mcp_queue 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), 'U_MCP_WARN_USER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', - 'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&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'] . '&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) ? '&mode=unapproved_topics' : '&mode=unapproved_posts')) . "&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']), diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index 5453a3f985..ed803df7e6 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -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'); +} + ?>
\ No newline at end of file diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php index 8c3e3e049f..47cd8ed20a 100644 --- a/phpBB/language/en/mcp.php +++ b/phpBB/language/en/mcp.php @@ -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', diff --git a/phpBB/styles/subSilver/template/mcp_post.html b/phpBB/styles/subSilver/template/mcp_post.html index 0f695881ac..b355f6388d 100644 --- a/phpBB/styles/subSilver/template/mcp_post.html +++ b/phpBB/styles/subSilver/template/mcp_post.html @@ -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> |