diff options
-rw-r--r-- | phpBB/language/en/viewtopic.php | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/quickreply_editor.html | 58 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/quickreply_editor.html | 23 | ||||
-rw-r--r-- | phpBB/viewtopic.php | 45 |
4 files changed, 126 insertions, 2 deletions
diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php index 4252fa7542..5c28b94d4e 100644 --- a/phpBB/language/en/viewtopic.php +++ b/phpBB/language/en/viewtopic.php @@ -86,11 +86,13 @@ $lang = array_merge($lang, array( 'PRINT_TOPIC' => 'Print view', 'QUICK_MOD' => 'Quick-mod tools', + 'QUICKREPLY' => 'Quick Reply', 'QUOTE' => 'Quote', 'REPLY_TO_TOPIC' => 'Reply to topic', 'RETURN_POST' => '%sReturn to the post%s', + 'SHOW_QR' => 'Show Editor', 'SUBMIT_VOTE' => 'Submit vote', 'TOTAL_VOTES' => 'Total votes', diff --git a/phpBB/styles/prosilver/template/quickreply_editor.html b/phpBB/styles/prosilver/template/quickreply_editor.html new file mode 100644 index 0000000000..fbbcba9aba --- /dev/null +++ b/phpBB/styles/prosilver/template/quickreply_editor.html @@ -0,0 +1,58 @@ +<script type="text/javascript"> +// <![CDATA[ + function hide_qr(hide) + { + var qr = document.getElementById('qr_editor_div'); + var qr_show = document.getElementById('qr_showeditor_div'); + qr_show.style.display = (hide) ? '' : 'none'; + qr.style.display = (hide) ? 'none' : ''; + return true; + } + + onload_functions.push('hide_qr(true);'); + // ]]> +</script> +<form method="post" action="{U_QR_ACTION}"> + + <div class="panel" id="qr_editor_div"> + <div class="inner"><span class="corners-top"><span></span></span> + <div class="content"> + <h2>{L_QUICKREPLY}</h2> + + <fieldset class="fields1"> + <dl style="clear: left;"> + <dt><label for="subject">{L_SUBJECT}:</label></dt> + <dd><input type="text" name="subject" id="subject" size="45" maxlength="64" tabindex="2" value="{SUBJECT}" class="inputbox autowidth" /></dd> + </dl> + </fieldset> + + <div id="message-box"> + <textarea style="height: 9em;" name="message" rows="7" cols="76" tabindex="3" class="inputbox"></textarea> + </div> + + <fieldset class="submit-buttons"> + {S_FORM_TOKEN} + {S_HIDDEN_FIELDS} + <input type="submit" accesskey="s" tabindex="6" name="post" value="{L_SUBMIT}" class="button1" /> + </fieldset> + </div> + <span class="corners-bottom"><span></span></span></div> + </div> + <div class="panel" style="display: none" id="qr_showeditor_div" > + <div class="inner"><span class="corners-top"><span></span></span> + + <div class="content"> + <h2>{L_QUICKREPLY}</h2> + <fieldset class="submit-buttons"> + <input type="submit" name="show_qr" tabindex="1" class="button2" value="{L_SHOW_QR}" onclick="hide_qr(false);return false;"/> + </fieldset> + </div> + + + <span class="corners-bottom"><span></span></span></div> + </div> + + + +</form> + <hr />
\ No newline at end of file diff --git a/phpBB/styles/subsilver2/template/quickreply_editor.html b/phpBB/styles/subsilver2/template/quickreply_editor.html new file mode 100644 index 0000000000..286376633a --- /dev/null +++ b/phpBB/styles/subsilver2/template/quickreply_editor.html @@ -0,0 +1,23 @@ +<form method="post" action="{U_QR_ACTION}"> + + <table class="tablebg" width="100%" cellspacing="1"> + <tr> + <th align="center" colspan="2">{L_QUICKREPLY}</th> + </tr> + <tr> + <td class="row1" width="22%"><b class="genmed">{L_SUBJECT}:</b></td> + <td class="row2" width="78%"><input class="post" style="width:450px" type="text" name="subject" size="45" maxlength="64" tabindex="2" value="{SUBJECT}" /></td> + </tr> + <tr> + <td colspan="2" valign="top" align="center" style="width: 75%;"><textarea name="message" rows="7" cols="76" tabindex="3" style="width: 98%;"></textarea> </td></tr> + <tr> + <td class="cat" colspan="2" align="center"> + <input class="btnmain" type="submit" accesskey="s" tabindex="6" name="post" value="{L_SUBMIT}" /> + {S_FORM_TOKEN} + {S_HIDDEN_FIELDS} + </td> + </tr> + </table> + +</form> +<br clear="all" />
\ No newline at end of file diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 0387ae3a05..94f866a35c 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -41,6 +41,7 @@ $sort_dir = request_var('sd', $default_sort_dir); $update = request_var('update', false); +$s_can_vote = false; /** * @todo normalize? */ @@ -695,7 +696,7 @@ if (!empty($topic_data['poll_start'])) if ($update && $s_can_vote) { - if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id)) + if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id) || !check_form_key('posting')) { $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"); @@ -708,10 +709,14 @@ if (!empty($topic_data['poll_start'])) { $message = 'TOO_MANY_VOTE_OPTIONS'; } - else + else if (in_array(VOTE_CONVERTED, $cur_voted_id)) { $message = 'VOTE_CONVERTED'; } + else + { + $message = 'FORM_INVALID'; + } $message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>'); trigger_error($message); @@ -1422,6 +1427,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) { $s_first_unread = $first_unread = true; } + // $postrow = array( @@ -1598,6 +1604,41 @@ else if (!$all_marked_read) } } +// let's set up quick_reply +// TODO: introduce a per-forum and a per-user setting +if ($s_can_vote || $config['allow_quick_reply']) +{ + add_form_key('posting'); + if ($user->data['is_registered'] && $config['allow_quick_reply']) + { + + $s_attach_sig = $config['allow_sig'] && strlen($user->data['user_sig']) && $user->optionget('attachsig') && $auth->acl_get('f_sigs', $forum_id) && $auth->acl_get('u_sig'); + $s_smilies = $config['allow_smilies'] && $user->optionget('smilies') && $auth->acl_get('f_smilies', $forum_id); + $s_bbcode = $config['allow_bbcode'] && $user->optionget('bbcode') && $auth->acl_get('f_bbcode', $forum_id); + $s_notify = $config['allow_topic_notify'] && $user->data['user_notify']; + $qr_hidden_fields = array( + 'topic_cur_post_id' => $topic_data['topic_last_post_id'], + 'lastclick' => time(), + 'topic_id' => $topic_data['topic_id'], + 'forum_id' => $forum_id, + 'disable_bbcode' => !$s_bbcode, + 'disable_smilies' => !$s_smilies, + 'disable_magic_url' => !$config['allow_post_links'], + 'attach_sig' => $s_attach_sig, + 'notify' => $s_notify, + ); + + $template->assign_vars(array( + 'S_QUICK_REPLY' => true, + 'U_QR_ACTION' => append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id"), + 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), + 'SUBJECT' => 'Re: ' . censor_text($topic_data['topic_title']), + + )); + } +} + + // We overwrite $_REQUEST['f'] if there is no forum specified // to be able to display the correct online list. // One downside is that the user currently viewing this topic/post is not taken into account. |