<?php include VIEW_DIR.'mobile/common/menu/community.tpl'; ?>

<?php if (empty($this->_vars['com_names']['id'])): ?>
<form method="post" action="<?php e($this->_vars['action']['url']); ?>"><?php HTML::requires(); ?>
<?php if ($this->_vars['action']['complete']): ?>
	<?php // _e('Private community require approval from a moderator to join. Your request to join has been sent.'); ?>
	<?php _e('Updated'); ?><br><br>
	<?php loadPlugin::callFunc('hitsuji_banner', POSITION_MOBILE); ?><br>
<?php elseif ($this->_vars['action']['confirm']): ?>
<table border="0" width="<?php Theme::exec()->mainWidth(); ?>">
	<tr><td align="center" bgcolor="<?php Theme::exec()->bgTitleColor(); ?>"><img src="<?php e(BASE_URL); ?>resource/img/icons/connect.gif" width="16" height="16" alt="&gt;">&nbsp;<?php _e('Involved a Community'); ?></td></tr>
	<tr><td bgcolor="<?php Theme::exec()->bgColumnColor(); ?>"><?php _e('Visibility'); ?>:<br></td></tr>
	<tr><td><?php e($this->_vars['visibility'][$this->_vars['com_names']['visibility']]); ?><br></td></tr>

	<tr><td bgcolor="<?php Theme::exec()->bgColumnColor(); ?>"><?php _e('Bulletin'); ?>:<br></td></tr>
	<tr><td><?php e($this->_vars['bulletin'][$this->_vars['com_names']['bulletin']]); ?><br></td></tr>

<?php if (PERMISSION_REQUEST == $this->_vars['base']['community']['involved'] && !($this->_vars['com_names']['status'] & PERMISSION_INVITE)): ?>
	<tr><td bgcolor="<?php Theme::exec()->bgColumnColor(); ?>"><?php _e('Comment'); ?>:<br></td></tr>
	<tr><td><?php HTML::htmlBody($this->_vars['com_names']['comment']); ?><br></td></tr>
<?php endif; ?>
	<tr><td bgcolor="<?php Theme::exec()->bgColor(); ?>" align="center">
		<input type="submit" name="manip" value="<?php _e('Submit'); ?>">
		<input type="submit" name="<?php e($this->_vars['action']['goback']); ?>" value="<?php _e('Go back'); ?>">
	<br></td></tr>
</table>
<?php else: ?>
<table border="0" width="<?php Theme::exec()->mainWidth(); ?>">
	<tr><td align="center" bgcolor="<?php Theme::exec()->bgTitleColor(); ?>"><img src="<?php e(BASE_URL); ?>resource/img/icons/connect.gif" width="16" height="16" alt="&gt;">&nbsp;<?php _e('Involved a Community'); ?></td></tr>
	<tr><td bgcolor="<?php Theme::exec()->bgColumnColor(); ?>"><?php _e('Visibility'); ?>:<br></td></tr>
	<tr><td>
		<?php if (!empty($this->_vars['alert']['visibility'])): ?><font color="<?php Theme::exec()->alertColor(); ?>"><?php _e('Please select.'); ?></font><br><?php endif; ?>
		<?php HTML::radio('visibility', $this->_vars['visibility'], $this->_vars['com_names']['visibility'], '<br>'); ?>
	<br></td></tr>

	<tr><td bgcolor="<?php Theme::exec()->bgColumnColor(); ?>"><?php _e('Bulletin'); ?>:<br></td></tr>
	<tr><td>
		<?php if (!empty($this->_vars['alert']['bulletin'])): ?><font color="<?php Theme::exec()->alertColor(); ?>"><?php _e('Please select.'); ?></font><br><?php endif; ?>
		<?php HTML::radio('bulletin', $this->_vars['bulletin'], $this->_vars['com_names']['bulletin']); ?>
	<br></td></tr>

<?php if (PERMISSION_REQUEST == $this->_vars['base']['community']['involved'] && !($this->_vars['com_names']['status'] & PERMISSION_INVITE)): ?>

	<tr><td bgcolor="<?php Theme::exec()->bgColumnColor(); ?>"><?php _e('Comment'); ?>:<br></td></tr>
	<tr><td>
		<?php if (!empty($this->_vars['alert']['comment'])): ?><font color="<?php Theme::exec()->alertColor(); ?>"><?php _e('Please enter.'); ?></font><br><?php endif; ?>
		<?php HTML::mobileRichEditor('comment', $this->_vars['com_names']['comment'], _('Comment')); ?>
	<br></td></tr>
<?php endif; ?>
	<tr><td bgcolor="<?php Theme::exec()->bgColor(); ?>" align="center"><input type="submit" name="confirm" value="<?php _e('Confirm'); ?>"><br></td></tr>
</table>
<?php endif; ?>
</form>
<?php else: ?>
<table border="0" width="<?php Theme::exec()->mainWidth(); ?>">
	<tr><td align="center" bgcolor="<?php Theme::exec()->bgTitleColor(); ?>"><img src="<?php e(BASE_URL); ?>resource/img/icons/connect.gif" width="16" height="16" alt="&gt;">&nbsp;<?php _e('Involved a Community'); ?></td></tr>
	<tr><td bgcolor="<?php Theme::exec()->bgColor(); ?>" align="center">
<?php if ($this->_vars['com_names']['status'] & PERMISSION_MEMBERS): ?>
		<a href="<?php e(HTTP_ACTION); ?>community/setting/resign/<?php e($this->_vars['base']['community']['id']); ?>/delete/"><img src="<?php e(BASE_URL); ?>resource/img/icons/disconnect.gif" width="16" height="16" alt="&gt;">&nbsp;<?php _e('Resign'); ?></a><br>
<?php else: ?>
		<?php _e('You already have a pending member request for this community.'); ?><br>
<?php endif; ?>
		<br><?php loadPlugin::callFunc('hitsuji_banner', POSITION_MOBILE); ?><br>
	<br></td></tr>
</table>
<?php endif; ?>
