Gazelle/design/views/generic/reply/quickreply.php

153 lines
5.0 KiB
PHP
Raw Normal View History

2013-01-23 08:00:38 +00:00
<?php
/**
* This version of #quickpostform is used in all subsections
* Instead of modifying multiple places, just modify this one.
*
* To include it in a section use this example.
View::parse('generic/reply/quickreply.php', array(
'InputTitle' => 'Post reply',
'InputName' => 'thread',
'InputID' => $ThreadID,
'ForumID' => $ForumID,
'TextareaCols' => 90
));
* Note that InputName and InputID are the only required variables
* They're used to construct the $_POST.
*
* Eg
* <input name="thread" value="123" />
* <input name="groupid" value="321" />
*
* Globals are required as this template is included within a
* function scope.
2013-08-28 23:08:41 +00:00
*
* To add a "Subscribe" box for non-forum pages (like artist/collage/...
* comments), add a key 'SubscribeBox' to the array passed to View::parse.
* Example:
View::parse('generic/reply/quickreply.php', array(
'InputTitle' => 'Post comment',
'InputName' => 'groupid',
'InputID' => $GroupID,
'TextareaCols' => 65,
'SubscribeBox' => true
));
2013-01-23 08:00:38 +00:00
*/
2013-08-28 23:08:41 +00:00
global $HeavyInfo, $UserSubscriptions, $ThreadInfo, $ForumsDoublePost, $Document;
2013-01-23 08:00:38 +00:00
2013-08-28 23:08:41 +00:00
if (G::$LoggedUser['DisablePosting']) {
2013-04-13 08:00:19 +00:00
return;
}
if (!isset($TextareaCols)) {
$TextareaCols = 70;
}
if (!isset($TextareaRows)) {
$TextareaRows = 8;
}
if (!isset($InputAction)) {
$InputAction = 'reply';
}
if (!isset($InputTitle)) {
$InputTitle = 'Post comment';
}
2013-08-28 23:08:41 +00:00
if (!isset($Action)) {
$Action = '';
}
2013-01-23 08:00:38 +00:00
// TODO: Remove inline styles
// Old to do?
// TODO: Preview, come up with a standard, make it look like post or just a
// block of formatted BBcode, but decide and write some proper XHTML
$ReplyText = new TEXTAREA_PREVIEW('body', 'quickpost', '',
$TextareaCols, $TextareaRows, false, false, true, array(
'tabindex="1"',
'onkeyup="resize(\'quickpost\')"'
));
?>
<br />
<div id="reply_box">
<h3><?=$InputTitle?></h3>
<div class="box pad">
<table class="forum_post box vertical_margin hidden preview_wrap" id="preview_wrap_<?=$ReplyText->getID()?>">
<colgroup>
2013-04-13 08:00:19 +00:00
<? if (Users::has_avatars_enabled()) { ?>
2013-01-23 08:00:38 +00:00
<col class="col_avatar" />
<? } ?>
<col class="col_post_body" />
</colgroup>
<tr class="colhead_dark">
2013-05-21 08:01:09 +00:00
<td colspan="<?=(Users::has_avatars_enabled() ? 2 : 1)?>">
<div style="float: left;"><a href="#quickreplypreview">#XXXXXX</a>
2013-08-28 23:08:41 +00:00
by <strong><?=Users::format_username(G::$LoggedUser['ID'], true, true, true, true)?></strong> Just now
2013-01-23 08:00:38 +00:00
</div>
2013-04-13 08:00:19 +00:00
<div style="float: right;">
<a href="#quickreplypreview" class="brackets">Report</a>
2013-01-23 08:00:38 +00:00
&nbsp;
<a href="#">&uarr;</a>
</div>
</td>
</tr>
<tr>
<? if (Users::has_avatars_enabled()) { ?>
<td class="avatar" valign="top">
2013-08-28 23:08:41 +00:00
<?=Users::show_avatar(G::$LoggedUser['Avatar'], G::$LoggedUser['ID'], G::$LoggedUser['Username'], $HeavyInfo['DisableAvatars'])?>
2013-01-23 08:00:38 +00:00
</td>
<? } ?>
<td class="body" valign="top">
2013-04-13 08:00:19 +00:00
<div id="contentpreview" style="text-align: left;">
2013-01-23 08:00:38 +00:00
<div id="preview_<?=$ReplyText->getID()?>"></div>
</div>
</td>
</tr>
</table>
2013-08-28 23:08:41 +00:00
<form class="send_form center" name="reply" id="quickpostform" action="<?=$Action?>" method="post"<? if (!check_perms('users_mod')) { ?> onsubmit="quickpostform.submit_button.disabled=true;" <? } ?>>
2013-01-23 08:00:38 +00:00
<input type="hidden" name="action" value="<?=$InputAction?>" />
2013-08-28 23:08:41 +00:00
<input type="hidden" name="auth" value="<?=G::$LoggedUser['AuthKey']?>" />
2013-01-23 08:00:38 +00:00
<input type="hidden" name="<?=$InputName?>" value="<?=$InputID?>" />
<div id="quickreplytext">
<?
echo $ReplyText->getBuffer();
?>
<br />
</div>
<div class="preview_submit">
<?
2013-08-28 23:08:41 +00:00
if (isset($SubscribeBox) && !isset($ForumID) && Subscriptions::has_subscribed_comments($Document, $InputID) === false) { ?>
<input id="subscribebox" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''?> tabindex="2" />
<label for="subscribebox">Subscribe</label>
<?
}
2013-01-23 08:00:38 +00:00
// Forum thread logic
// This might use some more abstraction
2013-08-28 23:08:41 +00:00
if (isset($ForumID)) {
if (!Subscriptions::has_subscribed($InputID)) { ?>
2013-04-13 08:00:19 +00:00
<input id="subscribebox" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''?> tabindex="2" />
2013-01-23 08:00:38 +00:00
<label for="subscribebox">Subscribe</label>
<?
}
2013-08-28 23:08:41 +00:00
if ($ThreadInfo['LastPostAuthorID'] == G::$LoggedUser['ID']
2013-01-23 08:00:38 +00:00
&& (check_perms('site_forums_double_post')
|| in_array($ForumID, $ForumsDoublePost))
) {
?>
<input id="mergebox" type="checkbox" name="merge" tabindex="2" />
<label for="mergebox">Merge</label>
2013-04-13 08:00:19 +00:00
<? }
2013-08-28 23:08:41 +00:00
if (!G::$LoggedUser['DisableAutoSave']) { ?>
2013-01-23 08:00:38 +00:00
<script type="application/javascript">var storedTempTextarea = new StoreText('quickpost', 'quickpostform', <?=$InputID?>);</script>
2013-04-13 08:00:19 +00:00
<? }
}
?>
2013-01-23 08:00:38 +00:00
<input type="button" value="Preview" class="hidden button_preview_<?=$ReplyText->getID()?>" title="Preview text" tabindex="1" />
<input type="submit" value="Post reply" id="submit_button" tabindex="1" />
</div>
</form>
</div>
</div>