<{include file="db:profile_header.html"}>
<{if $profile_tribesform}>
<{if $hideForm}>
<div class="profile-form outer">
  <h2 class="head">
    <a href="#add-group" onclick ="$('#profile-tribes-form').toggle(400);" name="add-group"><img src="images/toggle.png" />&nbsp;<{$lang_tribesform_title}></a>
  </h2>
  <div id="profile-tribes-form" class="profile-album-form" style="display: none">
    <{includeq file='db:system_common_form.html' form=$profile_tribesform}>
  </div>
</div>
<{else}>
<{includeq file='db:system_common_form.html' form=$profile_tribesform}>
<{/if}>
<{/if}>
<{if $profile_tribeuserform}>
<{if $hideForm}>
<div class="profile-form outer">
  <h2 class="head">
    <a href="#add-user" onclick ="$('#profile-tribeuser-form').toggle(400);" name="add-user"><img src="images/toggle.png" />&nbsp;<{$lang_tribeuserform_title}></a>
  </h2>
  <div id="profile-tribeuser-form" class="profile-album-form" style="display: none">
    <{includeq file='db:system_common_form.html' form=$profile_tribeuserform}>
  </div>
</div>
<{else}>
<{includeq file='db:system_common_form.html' form=$profile_tribeuserform}>
<{/if}>
<{/if}>
<{if $profile_editpostform}>
<{if $hideForm}>
<div class="profile-form outer">
  <h2 class="head">
    <a href="#edit-post" onclick ="$('#profile-post-form').toggle(400);" name="edit-post"><img src="images/toggle.png" />&nbsp;<{$lang_editpostform_title}></a>
  </h2>
  <div id="profile-post-form" class="profile-album-form" style="display: none">
    <{includeq file='db:system_common_form.html' form=$profile_editpostform}>
  </div>
</div>
<{else}>
<{includeq file='db:system_common_form.html' form=$profile_editpostform}>
<{/if}>
<{/if}>
<{if $profile_tribe}>
<{if !$profile_tribe_posts}>
<div id="profile-tribes-description" class="outer">
  <h2 class="head"><{$profile_tribe.title}></h2>
  <div class="even">
	<{if $profile_tribe.tribe_img}>
	<div id="profile-tribes-picture"><{$profile_tribe.tribe_content}></div>
	<{/if}>
	<{$profile_tribe.tribe_desc}>
    <p id="profile-tribes-statistics">
      <strong><{$lang_creation_time}>:</strong> <{$profile_tribe.creation_time_short}>,
      <strong><{$lang_topics}>:</strong> <{$profile_tribe_topics_count}>,
      <strong><{$lang_views}>:</strong> <{$profile_tribe.counter}>,
      <strong><{$lang_members}>:</strong> <{$profile_tribe_members|@count}>
    </p>
    <div class="clear"></div>
  </div>
</div>
<{/if}>
<{if $showContent && $profile_tribe_topics|@count > 0}>
<div id="profile-tribes-discussions" class="outer">
  <table width="100%" cellspacing="1" cellpadding="4">
	<tbody>
	  <tr align="center">
		<th><{$lang_topic_title}></th>
		<th><{$lang_topic_author}></th>
		<th><{$lang_topic_replies}></th>
		<th><{$lang_topic_views}></th>
		<th><{$lang_topic_last_post_time}></th>
	  </tr>
	  <{foreach item=topic from=$profile_tribe_topics}>
	  <{cycle values='even,odd' assign=class}>
	  <tr class="<{$class}>">
		<td><{if $topic.closedIcon}><{$topic.closedIcon}> <{/if}><{$topic.itemLink}></td>
		<td align="center"><{$topic.poster_uname}></td>
		<td align="center"><{$topic.replies}></td>
		<td align="center"><{$topic.views}></td>
		<td align="right"><{$topic.last_post_time}> <{$topic.lastItemLink}></td>
	  </tr>
	  <{/foreach}>
	  <{if $profile_tribe_topics_pagenav}>
	  <tr>
		<td colspan="5" align="right"><{$profile_tribe_topics_pagenav}></td>
	  </tr>
	  <{/if}>
	</tbody>
  </table>
</div>
<{/if}>
<{if $showContent && $profile_tribe_posts|@count > 0}>
<div id="profile-tribes-discussions" class="outer">
  <h2 class="head"><{$lang_discussions}> - <{$profile_tribe_topic.title}><{if $profile_tribe_topic.closed}> (<{$lang_closed}>)<{/if}></h2>
  <table width="100%" cellspacing="1" cellpadding="4">
	<tbody>
	  <{foreach item=post from=$profile_tribe_posts}>
	  <{cycle values='even,odd' assign=class}>
	  <tr class="<{$class}>">
		<td width="120px">
		  <{if $post.poster_avatar}><{$post.poster_avatar}><br /><{/if}>
		  <{$post.poster_uname}><br />
		  <{$post.post_time}>
		  <{if $isOwner || $post.userCanEditAndDelete}>
		  <br /><{$post.editItemLink}><{$post.deleteItemLink}>
		  <{/if}>
		  <{if $post.post_id == $profile_tribe_topic.post_id && ($isOwner || $profile_tribe_topic.userCanEditAndDelete)}>
		  <{$profile_tribe_topic.toggleCloseLink}>
		  <{/if}>
		</td>
		<td>
		  <a name="post<{$post.post_id}>"></a>
		  <{if $post.title}><strong><{$post.title}></strong><br /><br /><{/if}>
		  <{$post.body}>
		  <{if $post.poster_signature}><br /><br />--------------------<br /><{$post.poster_signature}><{/if}>
		</td>
	  </tr>
	  <{/foreach}>
	  <{if $profile_tribe_posts_pagenav}>
	  <tr>
		<td colspan="5" align="right"><{$profile_tribe_posts_pagenav}></td>
	  </tr>
  <{/if}>
	</tbody>
  </table>
</div>
<{/if}>
<{if $profile_addpostform}>
<{if $hideForm}>
<div class="profile-form outer">
  <h2 class="head">
	<a href="#add-post" onclick ="$('#profile-post-form').toggle(400);" name="add-post"><img src="images/toggle.png" />&nbsp;<{$lang_addpostform_title}></a>
  </h2>
  <div id="profile-post-form" style="display:none">
	<{includeq file='db:system_common_form.html' form=$profile_addpostform}>
  </div>
</div>
<{else}>
<{includeq file='db:system_common_form.html' form=$profile_addpostform}>
<{/if}>
<{/if}>
<{if $showContent && $profile_tribe_members|@count > 0 && !$profile_tribe_posts}>
<div id="profile-tribes-members" class="outer">
  <h2 class="head"><{$lang_members}></h2>
  <{foreach name=members item=member from=$profile_tribe_members}>
  <div class="profile-tribes-members-member" style="width:<{$itemwidth}>%">
	<{if $member.tribeuser_avatar}><{$member.tribeuser_avatar}><br /><{/if}><{if $member.owner}><{$lang_owner}><br /><{/if}><{$member.tribeuser_sender_link}>
	<{if $member.userCanEditAndDelete || ($userCanEditAndDelete && !$member.owner)}>
	<form action="<{$icms_url}>/modules/<{$icms_dirname}>/tribes.php" method="post">
	  <input type="hidden" value="<{$profile_tribe.tribes_id}>" name="tribes_id" />
	  <input type="hidden" value="<{xoAppUrl /modules/<{$icms_dirname}>/tribes.php}>?tribes_id=<{$profile_tribe.tribes_id}>" name="redirect_page" />
	  <input type="hidden" value="<{$member.tribeuser_id}>" name="tribeuser_id" />
	  <input type="hidden" value="1" name="confirm" />
	  <input type="hidden" value="deltribeuser" name="op" />
	  <{$token}>
	  <input name="submit" type="image" alt="<{$lang_delete}>" title="<{$lang_delete}>" src="<{$delete_image}>" style="vertical-align:middle" />
	</form>
	<{/if}>
  </div>
  <{if $smarty.foreach.members.iteration is div by $rowitems || $smarty.foreach.members.last == TRUE}>
  <div class="clear"></div>
  <{/if}>
  <{/foreach}>
</div>
<{/if}>
<{if !$showContent}><div class="resultMsg"><p><{$lang_joinfirst}></p></div><{/if}>
<div class="clear"></div>
<{if $showContent}><{includeq file='db:system_notification_select.html'}><{/if}>
<{/if}>
<{if $profile_tribes_search}>
<div id="profile-tribes-search" class="odd outer">
  <form method="post" action="tribes.php" id="searchtribes" name="searchttribes">
    <strong><{$lang_tribes_search}>:</strong>
    <input type="text" maxlength="255" size="20" name="search_title" id="search_title" />
    <input type="submit" value="<{$lang_tribes_search_submit}>" name="search_submit" />
  </form>
</div>
<div class="clear"></div>
<{/if}>
<{if $profile_tribes.search}>
<div class="profile-tribes-container outer">
<h2 class="head"><{$lang_tribes_search_title}></h2>
<{foreach name=tribes item=tribe from=$profile_tribes.search}>
<div class="profile-tribes-tribe" style="width:<{$itemwidth}>%">
  <{$tribe.picture_link}>
  <br /><{$tribe.title}><br />
</div>
<{if $smarty.foreach.tribes.iteration is div by $rowitems || $smarty.foreach.tribes.last == TRUE}>
<div class="clear"></div>
<{/if}>
<{/foreach}>
</div>
<{elseif $lang_search_noresults}>
<div class="resultMsg"><p><{$lang_search_noresults}></p></div>
<{/if}>
<{if $profile_tribes.own}>
<div class="profile-tribes-container outer">
<h2 class="head"><{$lang_tribes_own}></h2>
<{foreach name=tribes item=tribe from=$profile_tribes.own}>
<div class="profile-tribes-tribe" style="width:<{$itemwidth}>%">
  <{$tribe.picture_link}>
  <br /><{$tribe.title}><br />
  <{if $tribe.userCanEditAndDelete}>
  <{$tribe.editItemLink}><{$tribe.deleteItemLink}>
  <{/if}>
</div>
<{if $smarty.foreach.tribes.iteration is div by $rowitems || $smarty.foreach.tribes.last == TRUE}>
<div class="clear"></div>
<{/if}>
<{/foreach}>
</div>
<{/if}>
<{if $profile_tribes.member}>
<div class="profile-tribes-container outer">
<h2 class="head"><{$lang_tribes_membership}></h2>
<{foreach name=tribes item=tribe from=$profile_tribes.member}>
<div class="profile-tribes-tribe" style="width:<{$itemwidth}>%">
  <{$tribe.picture_link}>
  <br /><{$tribe.title}><br />
  <{if $tribe.userCanEditAndDelete}>
  <{$tribe.editItemLink}><{$tribe.deleteItemLink}>
  <{/if}>
</div>
<{if $smarty.foreach.tribes.iteration is div by $rowitems || $smarty.foreach.tribes.last == TRUE}>
<div class="clear"></div>
<{/if}>
<{/foreach}>
</div>
<{/if}>
<{if $icmspersistable_delete_confirm}>
<{$icmspersistable_delete_confirm}>
<{/if}>
<{if $lang_nocontent}><div class="resultMsg"><p><{$lang_nocontent}></p></div><{/if}>