Skip to content

Commit

Permalink
Merge pull request #1150 from MissAllSunday/quick_reply
Browse files Browse the repository at this point in the history
Quick reply
  • Loading branch information
Arantor committed Jan 7, 2014
2 parents b5f2a9f + 182a1c7 commit 580d71c
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 85 deletions.
61 changes: 29 additions & 32 deletions Sources/Display.php
Original file line number Diff line number Diff line change
Expand Up @@ -1140,43 +1140,40 @@ function Display()
}

// Load up the "double post" sequencing magic.
if (!empty($options['display_quick_reply']))
checkSubmitOnce('register');
$context['name'] = isset($_SESSION['guest_name']) ? $_SESSION['guest_name'] : '';
$context['email'] = isset($_SESSION['guest_email']) ? $_SESSION['guest_email'] : '';
if (!empty($options['use_editor_quick_reply']) && $context['can_reply'])
{
checkSubmitOnce('register');
$context['name'] = isset($_SESSION['guest_name']) ? $_SESSION['guest_name'] : '';
$context['email'] = isset($_SESSION['guest_email']) ? $_SESSION['guest_email'] : '';
if (!empty($options['use_editor_quick_reply']) && $context['can_reply'])
{
// Needed for the editor and message icons.
require_once($sourcedir . '/Subs-Editor.php');

// Now create the editor.
$editorOptions = array(
'id' => 'message',
'value' => '',
'labels' => array(
'post_button' => $txt['post'],
),
// add height and width for the editor
'height' => '250px',
'width' => '100%',
// We do XML preview here.
'preview_type' => 0,
);
create_control_richedit($editorOptions);
// Needed for the editor and message icons.
require_once($sourcedir . '/Subs-Editor.php');

// Store the ID.
$context['post_box_name'] = $editorOptions['id'];
// Now create the editor.
$editorOptions = array(
'id' => 'message',
'value' => '',
'labels' => array(
'post_button' => $txt['post'],
),
// add height and width for the editor
'height' => '250px',
'width' => '100%',
// We do XML preview here.
'preview_type' => 0,
);
create_control_richedit($editorOptions);

$context['attached'] = '';
$context['make_poll'] = isset($_REQUEST['poll']);
// Store the ID.
$context['post_box_name'] = $editorOptions['id'];

// Message icons - customized icons are off?
$context['icons'] = getMessageIcons($board);
$context['attached'] = '';
$context['make_poll'] = isset($_REQUEST['poll']);

if (!empty($context['icons']))
$context['icons'][count($context['icons']) - 1]['is_last'] = true;
}
// Message icons - customized icons are off?
$context['icons'] = getMessageIcons($board);

if (!empty($context['icons']))
$context['icons'][count($context['icons']) - 1]['is_last'] = true;
}

// Build the normal button array.
Expand Down
31 changes: 9 additions & 22 deletions Themes/default/Display.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,15 @@ function template_main()
echo '
<div class="plainbox" id="display_jump_to">&nbsp;</div>';

if ($context['can_reply'] && !empty($options['display_quick_reply']))
{
echo '
echo '
<a id="quickreply"></a>
<div class="tborder" id="quickreplybox">
<div class="cat_bar">
<h3 class="catbg">
<a href="javascript:oQuickReply.swap();" class="', $options['display_quick_reply'] > 1 ? 'toggle_up' : 'toggle_down', '" id="quickReplyExpand"></a>
<a href="javascript:oQuickReply.swap();">', $txt['quick_reply'], '</a>
', $txt['quick_reply'], '
</h3>
</div>
<div id="quickReplyOptions"', $options['display_quick_reply'] > 1 ? '' : ' style="display: none"', '>
<div id="quickReplyOptions">
<div class="roundframe">
<p class="smalltext lefttext">', $txt['quick_reply_desc'], '</p>
', $context['is_locked'] ? '<p class="alert smalltext">' . $txt['quick_reply_warning'] . '</p>' : '',
Expand Down Expand Up @@ -332,10 +329,6 @@ function onDocReceived(XMLDoc)
</div>
</div>
</div>';
}
else
echo '
<br class="clear" />';

// draft autosave available and the user has it enabled?
if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled']))
Expand All @@ -347,7 +340,7 @@ function onDocReceived(XMLDoc)
sLastNote: \'draft_lastautosave\',
sLastID: \'id_draft\',', !empty($context['post_box_name']) ? '
sSceditorID: \'' . $context['post_box_name'] . '\',' : '', '
sType: \'', !empty($options['display_quick_reply']) && $options['display_quick_reply'] > 2 ? 'quick' : 'quick', '\',
sType: \'', 'quick', '\',
iBoard: ', (empty($context['current_board']) ? 0 : $context['current_board']), ',
iFreq: ', (empty($modSettings['masterAutoSaveDraftsDelay']) ? 60000 : $modSettings['masterAutoSaveDraftsDelay'] * 1000), '
});
Expand All @@ -366,10 +359,9 @@ function onDocReceived(XMLDoc)
echo '
add_like_popup();';

if (!empty($options['display_quick_reply']))
echo '
echo '
var oQuickReply = new QuickReply({
bDefaultCollapsed: ', !empty($options['display_quick_reply']) && $options['display_quick_reply'] > 1 ? 'false' : 'true', ',
bDefaultCollapsed: false,
iTopicId: ', $context['current_topic'], ',
iStart: ', $context['start'], ',
sScriptUrl: smf_scripturl,
Expand Down Expand Up @@ -433,7 +425,7 @@ function onDocReceived(XMLDoc)
sTemplateTopSubject: ', JavaScriptEscape($txt['topic'] . ': %subject% &nbsp;(' . $context['num_views_text'] . ')'), ',
sTemplateReasonEdit: ', JavaScriptEscape('<input type="text" style="width: 90%;" name="modify_reason" value="%modify_reason%" size="80" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text" />)'), ',
sTemplateReasonNormal: ', JavaScriptEscape('%modify_text'), ',
sErrorBorderStyle: ', JavaScriptEscape('1px solid red'), ($context['can_reply'] && !empty($options['display_quick_reply'])) ? ',
sErrorBorderStyle: ', JavaScriptEscape('1px solid red'), ($context['can_reply']) ? ',
sFormRemoveAccessKeys: \'postmodify\'' : '', '
});
Expand Down Expand Up @@ -865,16 +857,11 @@ function template_single_post($message, $force_alternate = null)
echo '
<ul class="quickbuttons">';

// Can they reply? Have they turned on quick reply?
if ($context['can_quote'] && !empty($options['display_quick_reply']))
// Can they reply?
if ($context['can_quote'])
echo '
<li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');" class="quote_button">', $txt['quote_action'], '</a></li>';

// So... quick reply is off, but they *can* reply?
elseif ($context['can_quote'])
echo '
<li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" class="quote_button">', $txt['quote_action'], '</a></li>';

// Can the user modify the contents of this post? Show the modify inline image.
if ($message['can_modify'])
echo '
Expand Down
10 changes: 0 additions & 10 deletions Themes/default/Profile.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1728,16 +1728,6 @@ function template_profile_theme_settings()
</dd>';

echo '
<dt>
<label for="display_quick_reply">', $txt['display_quick_reply'], '</label>
</dt>
<dd>
<select name="default_options[display_quick_reply]" id="display_quick_reply">
<option value="0"', empty($context['member']['options']['display_quick_reply']) ? ' selected="selected"' : '', '>', $txt['display_quick_reply1'], '</option>
<option value="1"', !empty($context['member']['options']['display_quick_reply']) && $context['member']['options']['display_quick_reply'] == 1 ? ' selected="selected"' : '', '>', $txt['display_quick_reply2'], '</option>
<option value="2"', !empty($context['member']['options']['display_quick_reply']) && $context['member']['options']['display_quick_reply'] == 2 ? ' selected="selected"' : '', '>', $txt['display_quick_reply3'], '</option>
</select>
</dd>
<dt>
<label for="use_editor_quick_reply">', $txt['use_editor_quick_reply'], '</label>
</dt>
Expand Down
10 changes: 0 additions & 10 deletions Themes/default/Settings.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,6 @@ function template_options()
),
'default' => true,
),
array(
'id' => 'display_quick_reply',
'label' => $txt['display_quick_reply'],
'options' => array(
0 => $txt['display_quick_reply1'],
1 => $txt['display_quick_reply2'],
2 => $txt['display_quick_reply3'],
),
'default' => true,
),
array(
'id' => 'use_editor_quick_reply',
'label' => $txt['use_editor_quick_reply'],
Expand Down
4 changes: 0 additions & 4 deletions Themes/default/languages/Profile.english.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,6 @@
$txt['messages_per_page'] = 'Messages to display per page:';
$txt['per_page_default'] = 'forum default';
$txt['calendar_start_day'] = 'First day of the week on the calendar';
$txt['display_quick_reply'] = 'Use quick reply on topic display: ';
$txt['display_quick_reply1'] = 'don\'t show at all';
$txt['display_quick_reply2'] = 'show, off by default';
$txt['display_quick_reply3'] = 'show, on by default';
$txt['use_editor_quick_reply'] = 'Use full editor in Quick Reply';
$txt['display_quick_mod'] = 'Show quick-moderation as ';
$txt['display_quick_mod_none'] = 'don\'t show.';
Expand Down
2 changes: 1 addition & 1 deletion Themes/default/languages/Themes.english.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
$txt['themeadmin_list_reset_url'] = 'Base URL to the same directory';
$txt['themeadmin_list_reset_go'] = 'Attempt to reset all themes';

$txt['themeadmin_reset_tip'] = 'Each theme may have its own custom options for selection by your members. These include things like &quot;quick reply&quot;, avatars and signatures, layout options, and other similar options. Here you can change the defaults or reset everyone\'s options.<br /><br />Please note that some themes may use the default options, in which case they will not have their own options.';
$txt['themeadmin_reset_tip'] = 'Each theme may have its own custom options for selection by your members. These include things like avatars, signatures, layout options and other similar options. Here you can change the defaults or reset everyone\'s options.<br /><br />Please note that some themes may use the default options, in which case they will not have their own options.';
$txt['themeadmin_reset_defaults'] = 'Configure guest and new user options for this theme';
$txt['themeadmin_reset_defaults_current'] = 'options currently set.';
$txt['themeadmin_reset_members'] = 'Change current options for all members using this theme';
Expand Down
1 change: 0 additions & 1 deletion other/install_2-1_mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2061,7 +2061,6 @@ VALUES (1, 'name', '{$default_theme_name}'),
(1, 'drafts_autosave_enabled', '1'),
(1, 'drafts_show_saved_enabled', '1');

INSERT INTO {$db_prefix}themes (id_member, id_theme, variable, value) VALUES (-1, 1, 'display_quick_reply', '2');
INSERT INTO {$db_prefix}themes (id_member, id_theme, variable, value) VALUES (-1, 1, 'posts_apply_ignore_list', '1');
INSERT INTO {$db_prefix}themes (id_member, id_theme, variable, value) VALUES (-1, 1, 'return_to_post', '1');
# --------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion other/install_2-1_postgresql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2593,7 +2593,6 @@ INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'enable_ne
INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'forum_width', '90%');
INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'drafts_autosave_enabled', '1');
INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'drafts_show_saved_enabled', '1');
INSERT INTO {$db_prefix}themes (id_member, id_theme, variable, value) VALUES (-1, 1, 'display_quick_reply', '2');
INSERT INTO {$db_prefix}themes (id_member, id_theme, variable, value) VALUES (-1, 1, 'posts_apply_ignore_list', '1');
INSERT INTO {$db_prefix}themes (id_member, id_theme, variable, value) VALUES (-1, 1, 'return_to_post', '1');
# --------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion other/install_2-1_sqlite.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2212,7 +2212,6 @@ INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'enable_ne
INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'forum_width', '90%');
INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'drafts_autosave_enabled', '1');
INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'drafts_show_saved_enabled', '1');
INSERT INTO {$db_prefix}themes (id_member, id_theme, variable, value) VALUES (-1, 1, 'display_quick_reply', '2');
INSERT INTO {$db_prefix}themes (id_member, id_theme, variable, value) VALUES (-1, 1, 'posts_apply_ignore_list', '1');
INSERT INTO {$db_prefix}themes (id_member, id_theme, variable, value) VALUES (-1, 1, 'return_to_post', '1');
COMMIT;
Expand Down
2 changes: 1 addition & 1 deletion other/upgrade_2-1_mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ WHERE variable IN ('enableStickyTopics', 'guest_hideContacts', 'notify_new_regis
---# Cleaning up old theme settings.
DELETE FROM {$db_prefix}themes
WHERE variable IN ('show_board_desc', 'no_new_reply_warning');
WHERE variable IN ('show_board_desc', 'no_new_reply_warning', 'display_quick_reply');
---#
/******************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion other/upgrade_2-1_postgresql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ WHERE variable IN ('enableStickyTopics', 'guest_hideContacts', 'notify_new_regis
---# Cleaning up old theme settings.
DELETE FROM {$db_prefix}themes
WHERE variable IN ('show_board_desc', 'no_new_reply_warning');
WHERE variable IN ('show_board_desc', 'no_new_reply_warning', 'display_quick_reply');
---#
/******************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion other/upgrade_2-1_sqlite.sql
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ WHERE variable IN ('enableStickyTopics', 'guest_hideContacts', 'notify_new_regis
---# Cleaning up old theme settings.
DELETE FROM {$db_prefix}themes
WHERE variable IN ('show_board_desc', 'no_new_reply_warning');
WHERE variable IN ('show_board_desc', 'no_new_reply_warning', 'display_quick_reply');
---#
/******************************************************************************/
Expand Down

0 comments on commit 580d71c

Please sign in to comment.