<{include file="db:profile_header.html"}>
<{if $profile_tribesform}>
<{if $hideForm}>
<div class="profile-form outer">
  <h2 class="head">
    <a href="#" onclick ="$('#profile-tribes-form').toggle(400);"><img src="images/toggle.gif" /></a>&nbsp;<{$lang_tribesform_title}>
  </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 $profile_tribesform}>&nbsp;<{/if}>
<{if $hideForm}>
<div class="profile-form outer">
  <h2 class="head">
    <a href="#" onclick ="$('#profile-tribeuser-form').toggle(400);"><img src="images/toggle.gif" /></a>&nbsp;<{$lang_tribeuserform_title}>
  </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="#" onclick ="$('#profile-post-form').toggle(400);"><img src="images/toggle.gif" /></a>&nbsp;<{$lang_editpostform_title}>
  </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}>
<div id="profile-tribes-container-single">
  <div id="profile-tribes-left">
    <div id="profile-tribes-description" class="outer">
      <h2 class="head"><{$profile_tribe.title}></h2>
      <p class="even"><{$profile_tribe.tribe_desc}></p>
    </div>
    <{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">
        <{if $member.tribeuser_avatar}><{$member.tribeuser_avatar}><br /><{/if}><{$member.tribeuser_sender_link}>
        <{if $member.userCanEditAndDelete || $userCanEditAndDelete}>
        <form action="<{$icms_url}>/modules/profile/tribes.php" method="post">
          <input type="hidden" value="<{$profile_tribe.tribes_id}>" name="tribes_id" />
          <input type="hidden" value="<{xoAppUrl /modules/profile/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 4 || $smarty.foreach.members.last == TRUE}>
      <div class="clear"></div>
      <{/if}>
      <{/foreach}>
    </div>
    <{/if}>
    <{if $showContent && $profile_tribe_topics|@count > 0}>
    <div id="profile-tribes-discussions" class="outer">
      <h2 class="head"><{$lang_discussions}></h2>
      <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="#" onclick ="$('#profile-post-form').toggle(400);"><img src="images/toggle.gif" /></a>&nbsp;<{$lang_addpostform_title}>
      </h2>
      <div id="profile-post-form" class="profile-album-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}><div id="profile-nocontent" class="outer"><p class="odd"><{$lang_joinfirst}></p></div><{/if}>
  </div>
  <div id="profile-tribes-right">
    <{if $profile_tribe.tribe_img}>
    <div id="profile-tribes-picture"><{$profile_tribe.tribe_content}></div>
    <{/if}>
    <div id="profile-tribes-statistics" class="outer">
      <h2 class="head"><{$lang_statistics}></h2>
      <p class="even"><strong><{$lang_clicks}>:</strong> <{$profile_tribe.counter}></p>
      <p class="odd"><strong><{$lang_members}>:</strong> <{$profile_tribe_members|@count}></p>
      <p class="even"><strong><{$lang_creation_time}>:</strong> <{$profile_tribe.creation_time_short}></p>
      <p class="odd"><strong><{$lang_topics}>:</strong> <{$profile_tribe_topics_count}></p>
      <p class="even"><strong><{$lang_owner}></strong></p>
      <p class="even" style="text-align:center;"><{if $profile_tribe.tribe_sender_avatar}><{$profile_tribe.tribe_sender_avatar}><br /><{/if}><{$profile_tribe.tribe_sender_link}></p>
    </div>
  </div>
</div>
<div class="clear"></div>
<{/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">
  <{$tribe.picture_link}>
  <br /><{$tribe.title}><br />
</div>
<{if $smarty.foreach.tribes.iteration is div by 4 || $smarty.foreach.tribes.last == TRUE}>
<div class="clear"></div>
<{/if}>
<{/foreach}>
</div>
<{elseif $lang_search_noresults}>
<div id="profile-nocontent" class="outer"><p class="odd"><{$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">
  <{$tribe.picture_link}>
  <br /><{$tribe.title}><br />
  <{if $tribe.userCanEditAndDelete}>
  <{$tribe.editItemLink}><{$tribe.deleteItemLink}>
  <{/if}>
</div>
<{if $smarty.foreach.tribes.iteration is div by 4 || $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">
  <{$tribe.picture_link}>
  <br /><{$tribe.title}><br />
  <{if $tribe.userCanEditAndDelete}>
  <{$tribe.editItemLink}><{$tribe.deleteItemLink}>
  <{/if}>
</div>
<{if $smarty.foreach.tribes.iteration is div by 4 || $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 id="profile-nocontent" class="outer"><p class="odd"><{$lang_nocontent}></p></div><{/if}>