Solution Technologies
Управление сайтом без ограничений
{**
 * XS2:
 *
 * This file is developed by Solutecs, LLC for the purpose of the company
 * and is provided together with XS2 Framework as and inherent part of the
 * system. This file can be used on the terms of License Agreement.
 *
 * +7 (495) 585-0833 / 13 Rusakovskaya street, Moscow 107140 Russia
 *
 * @link http://www.solutecs.com
 * @copyright ©1998-2007 Solutecs, LLC
 * @version 1.XX
 *}



{* Поведение: показывает все сообщения в теме *}
{* Параметры: 0:thread.NodId *}

{if $thread.NType eq "thread"}

  {literal}
    <style type="text/css">
      h4 { display: block; margin: 1pt; cursor: pointer; }
      .messageBar { border: 1px solid black; padding: 1pt; margin: 1pt; margin-top: 10pt; padding-top: 4pt; padding-bottom: 3pt; }
      .messageChildren { margin: 0px; padding: 0px; }
      .authorNName a, .authorNName { color: darkblue; text-decoration: none; }
    </style>
  {/literal}

  {xs2GetBranch var="messages" ParId=$thread.NodId NType="message"}
  {append var="posts" value=$thread}
  {foreach from=$messages item="message"}
    {append var="posts" value=$message from=$posts}
  {/foreach}

  <script type="text/javascript" src="{xs2Href mod="forum" obj="thread" met="js"}"></script>

  <script type="text/javascript">

    function initThread(){ldelim}
      {strip}
        window.messages = {ldelim}
          {foreach from=$posts item="message" name="messageLoop"}
            {if not $smarty.foreach.messageLoop.first} ,{/if}
            {$message.NodId}:[
              0,
              0,
              0,
              0,
              {$message.NDeep-$thread.NDeep|default:0},
              {$message.ParseIcons|default:1},
              {$message.ParseLineBreaks|default:1},
              {$message.Deleted|default:0},
              {if not $message.NName}0{else}1{/if},
              {if not $message.Text}0{else}1{/if},
              {$message.Author[0].NodId|default:0},
              {if ($message.RtCnt-$message.LtCnt) > 1}1{else}0{/if}]
          {/foreach}
        {rdelim};
        {append var="authors" value=$anonymousLabel}
        {foreach from=$messages key="step" item="message" name="authorLoop"}
          {append var="authors" from=$authors key=$message.Author[0].NodId|default:0 value=$message.Author[0].NName|default:$anonymousLabel}
        {/foreach}
        {append var="authors" from=$authors key=$thread.Author[0].NodId|default:0 value=$thread.Author[0].NName|default:$anonymousLabel}
        {append var="authors" from=$authors key=$forumCurrentUser.NodId|default:0 value=$forumCurrentUser.NName|default:$anonymousLabel}
      {/strip}

      window.users = {xs2Php2Js value=$authors};
      window.currentUser = {$forumCurrentUser.NodId|default:0};
      window.templates = {ldelim}{rdelim};
      window.hrefs = {ldelim}{rdelim};
      hrefs.message = {ldelim}'obj':'message', 'met':'show'{rdelim};
      hrefs.author = {ldelim}'obj':'user', 'met':'info'{rdelim};
      hrefs.loader = {ldelim}'obj':"message", "met":"load"{rdelim};

      templates.loadingTimeout = {$loadingTimeout};
      templates.deleteConfirm = "{$deleteConfirm}";
      templates.emptyMessageNNameLabel = "{$emptyMessageNNameLabel}";
      templates.emptyMessageTextLabel = '{$emptyMessageTextLabel}';
      templates.deletedMessageLabel = "{$deletedMessageLabel}";
      templates.loadingLabel = "{$LoadingLabel}";
      templates.sendingLabel = "{$SendingLabel}";
      templates.sendLabel = "{$sendLabel}";
      templates.editLabel = "{$editLabel}";
      templates.cancelLabel = "{$cancelLabel}";
      templates.deleteLabel = "{$deleteLabel}";
      templates.branchLabel = "{$branchLabel}";
      templates.replyLabel = "{$replyLabel}";
      templates.showPageLabel = "{$showMessagePageLabel}";
      templates.showUserInfoLabel = "{$showUserInfoLabel}";
      templates.singleLevelShift = {$singleLevelShift};
      templates.authorNNameLabel = {ldelim}'begin':'{$authorNNameLabelBegin}', 'end':'{$authorNNameLabelEnd}'{rdelim};
      templates.barItemDelim = {ldelim}'left':'{$barItemLeftDelim}', 'right':'{$barItemRightDelim}'{rdelim};

    {rdelim};

  </script>

  {strip}

    {xs2Fetch mod="forum" met="path" atr=$thread.NodId}
    {assign var="prevMsg" value=$thread}

    {foreach from=$posts item="message" name="messageLoop"}

      {assign var="closeChildren" value=$prevMsg.NDeep-$message.NDeep+1}
      {if $closeChildren > 0 and not $smarty.foreach.messageLoop.first}
        {* Закрываем блок детей *}
        {" "|indent:$closeChildren:"</div>"}
      {/if}

      {assign var="depth" value=$message.NDeep-$thread.NDeep}
      {assign var="depthShift" value=$depth*$singleLevelShift}

      <div style="background-color:{cycle values="`$messageColorOdd`,`$messageColorEven`"};margin-left:{$depthShift}px">

        <h4 id="messageHeader{$message.NodId}"  onClick="toggleMessage({$message.NodId})">
          {$message.NName|ForumParseIcons:$message.ParseIcons|ForumParseLineBreaks:$message.ParseLineBreaks|ForumParseMessageNName:$message.Deleted}
          {if not $message.Deleted}
            {$authorNNameLabelBegin}{$message.Author[0].NName|default:$anonymousLabel}{$authorNNameLabelEnd}
          {/if}
        </h4>

        {assign var="loadedStatus" value="not"}
        {assign var="styleDisplay" value="none"}

        {if $depth < $levelToLoad}
          {assign var="loadedStatus" value="yes"}
        {/if}

        {if $depth < $levelToShow}
          {assign var="styleDisplay" value="block"}
        {/if}

        <div style="display:{$styleDisplay}" id="messageText{$message.NodId}" loaded="{$loadedStatus}">
          {if $message.Text and not $message.Deleted}
            {$message.Text|ForumParseIcons:$message.ParseIcons|ForumParseLineBreaks:$message.ParseLineBreaks}
          {/if}
        </div>

        <div style="display:{$styleDisplay}" id="messageBar{$message.NodId}" class="messageBar">

          {$barItemLeftDelim}
            <a href="{xs2Href mod="forum" obj="message" met="show" atr=$message.NodId}">
              {$showMessagePageLabel}
            </a>
          {$barItemRightDelim}

          {if $message.Author[0].NodId > 0}
            {$barItemLeftDelim}
              <a href="{xs2Href mod="forum" obj="user" met="info" atr=$message.Author[0].NodId}">
                {$showUserInfoLabel}
              </a>
            {$barItemRightDelim}
          {/if}

          {if $forumCurrentUser.NodId > 0}
            {$barItemLeftDelim}
              <span onClick="addMessage({$message.NodId})" style="cursor:pointer">
                {$replyLabel}
              </span>
            {$barItemRightDelim}
          {/if}

          {if $forumCurrentUser.NodId > 0 and $forumCurrentUser.NodId == $message.Author[0].NodId}
            {$barItemLeftDelim}
              <span onClick="editMessage({$message.NodId})" style="cursor:pointer">
                {$editLabel}
              </span>
            {$barItemRightDelim}
          {/if}

          {if $forumCurrentUser.NodId > 0 and $forumCurrentUser.NodId == $message.Author[0].NodId}
            {$barItemLeftDelim}
              <span onClick="deleteMessage({$message.NodId})" style="cursor:pointer">
                {$deleteLabel}
              </span>
            {$barItemRightDelim}
          {/if}

          {if ($message.RtCnt-$message.LtCnt) > 1}
            {$barItemLeftDelim}
              <span onClick="toggleBranch({$message.NodId})" style="cursor:pointer">
                {$branchLabel}
              </span>
            {$barItemRightDelim}
          {/if}

        </div>

      </div>

      <div id="messageChildren{$message.NodId}" class="messageChildren"> {* Открываем блок детей *}
      {assign var="prevMsg" value=$message}

    {/foreach}

    {assign var="closeChildren" value=$prevMsg.NDeep-$thread.NDeep+1}
    {" "|indent:$closeChildren:"</div>"}

    <div style="display:none">
      {* Скрытый источник данных *}
      <div id="formSource">
        {* Шаблон формы редактирования сообщения *}
        {xs2Fetch mod="forum" obj="message" met="edit"}
      </div>
      {* Отправляющий форму фрейм *}
      <iframe src="{xs2Href mod="forum" obj="config" met="blank"}" name="senderFrame"></iframe>
      {* Подгружающий сообщение элемент *}
      <div id="loaderBox"></div>
    </div>

  {/strip}

{else}

  <p>{$NoThreadFoundErrorMessage}</p>

{/if}
Copyright ©1998-2008 Солютекс. Все права защищены.
Этот сайт сделан в designLab | Работает на технологии XS2
Условия использования | О защите конфиденциальности