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

133 lines
4.3 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-05-21 08:01:09 +00:00
global $LoggedUser, $HeavyInfo, $UserSubscriptions, $ThreadInfo, $ForumsDoublePost;
2013-01-23 08:00:38 +00:00
2013-04-13 08:00:19 +00:00
if ($LoggedUser['DisablePosting']) {
return;
}
if (!isset($TextareaCols)) {
$TextareaCols = 70;
}
if (!isset($TextareaRows)) {
$TextareaRows = 8;
}
if (!isset($InputAction)) {
$InputAction = 'reply';
}
if (!isset($InputTitle)) {
$InputTitle = 'Post comment';
}
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-01-23 08:00:38 +00:00
by <strong><?=Users::format_username($LoggedUser['ID'], true, true, true, true)?></strong> Just now
</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">
<?=Users::show_avatar($LoggedUser['Avatar'], $LoggedUser['Username'], $HeavyInfo['DisableAvatars'])?>
</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-04-13 08:00:19 +00:00
<form class="send_form center" name="reply" id="quickpostform" 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?>" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="<?=$InputName?>" value="<?=$InputID?>" />
<div id="quickreplytext">
<?
echo $ReplyText->getBuffer();
?>
<br />
</div>
<div class="preview_submit">
<?
// Forum thread logic
// This might use some more abstraction
if ($ForumID) { ?>
<? if (!in_array($InputID, $UserSubscriptions)) { ?>
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>
<?
}
if ($ThreadInfo['LastPostAuthorID'] == $LoggedUser['ID']
&& (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
<? }
if (!$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>