ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 11023


Ignore:
Timestamp:
Mar 16, 2009, 2:59:05 PM (11 years ago)
Author:
ebihara
Message:

merged changes from the kawahara_3585 branch

Location:
OpenPNE3/plugins/opCommunityTopicPlugin/trunk
Files:
9 edited
5 copied

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/pc_frontend/modules/communityTopic/templates/_topicCommentListBox.php

    r10596 r11023  
    66<ul class="articleList">
    77<?php foreach ($communityTopic as $topic): ?>
    8 <li><span class="date"><?php echo op_format_date($topic->getCreatedAt(), 'XShortDateJa') ?></span><?php echo link_to(op_truncate($topic->getName(), 36).' ('.$topic->countCommunityTopicComments().')', 'communityTopic_show', $topic).' ('.$topic->getCommunity()->getName().')' ?></li>
     8<li><span class="date"><?php echo op_format_date($topic->getUpdatedAt(), 'XShortDateJa') ?></span><?php echo link_to(op_truncate($topic->getName(), 36).' ('.$topic->countCommunityTopicComments().')', 'communityTopic_show', $topic).' ('.$topic->getCommunity()->getName().')' ?></li>
    99<?php endforeach; ?>
    1010</ul>
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/pc_frontend/modules/communityTopic/templates/showSuccess.php

    r10557 r11023  
    66</div>
    77<dl>
    8 <dt><?php echo nl2br(op_format_date($communityTopic->getCreatedAt(), 'XDateTimeJaBr')) ?></dt>
     8<dt><?php echo nl2br(op_format_date($communityTopic->getTopicUpdatedAt(), 'XDateTimeJaBr')) ?></dt>
    99<dd>
    1010<div class="title">
     
    1212</div>
    1313<div class="name">
    14 <p><?php echo link_to($communityTopic->getMember()->getName(), 'member/profile?id='.$communityTopic->getMember()->getId()) ?></p>
     14<p><?php if ($_member = $communityTopic->getMember()) : ?><?php echo link_to($_member->getName(), 'member/profile?id='.$_member->getId()) ?><?php endif; ?></p>
    1515</div>
    1616<div class="body">
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/pc_frontend/modules/communityTopicComment/templates/_list.php

    r10510 r11023  
    99<?php foreach ($commentPager->getResults() as $comment): ?>
    1010<dl>
    11 <dt><?php echo nl2br(op_format_date($comment->getUpdatedAt(), 'XDateTimeJaBr')) ?></dt>
     11<dt><?php echo nl2br(op_format_date($comment->getCreatedAt(), 'XDateTimeJaBr')) ?></dt>
    1212<dd>
    1313<div class="title">
    14 <?php echo link_to($comment->getMember()->getName(), 'member/profile?id='.$comment->getMember()->getId()) ?><?php if ($comment->isDeletable($sf_user->getMemberId())): ?> <?php echo link_to(__('Delete'), '@communityTopic_comment_delete_confirm?id='.$comment->getId()) ?><?php endif; ?>
     14<p class="heading"><strong><?php echo $comment->getNumber() ?></strong>:
     15<?php if ($_member = $comment->getMember()) : ?> <?php echo link_to($_member->getName(), 'member/profile?id='.$_member->getId()) ?><?php endif; ?>
     16<?php if ($comment->isDeletable($sf_user->getMemberId())): ?>
     17 <?php echo link_to(__('Delete'), '@communityTopic_comment_delete_confirm?id='.$comment->getId()) ?>
     18<?php endif; ?>
     19</p>
    1520</div>
    16 <div class="body"><?php echo op_url_cmd(nl2br($comment->getBody())) ?></div>
     21<div class="body">
     22<p class="text">
     23<?php echo op_url_cmd(nl2br($comment->getBody())) ?>
     24</p>
     25</div>
     26</dd>
    1727</dl>
    1828<?php endforeach; ?>
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/config/schema.yml

    r10384 r11023  
    55    id: ~
    66    community_id: { type: integer, required: true, foreignTable: community, foreignReference: id, onDelete: cascade }
    7     member_id: { type: integer, required: true, foreignTable: member, foreignReference: id }
     7    member_id: { type: integer, foreignTable: member, foreignReference: id, onDelete: setnull }
    88    name: { type: longvarchar, required: true }
    99    body: { type: longvarchar, required: true }
    1010    created_at: ~
    1111    updated_at: ~
     12    topic_updated_at: { type: timestamp }
    1213
    1314  community_topic_comment:
    1415    id: ~
    1516    community_topic_id: { type: integer, required: true, foreignTable: community_topic, foreignReference: id, onDelete: cascade }
    16     member_id: { type: integer, required: true, foreignTable: member, foreignReference: id }
     17    member_id: { type: integer, foreignTable: member, foreignReference: id, onDelete: setnull }
     18    number: { type: integer, required: true, default: 0 }
    1719    body: { type: longvarchar, required: true }
    1820    created_at: ~
    19     updated_at: ~
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/form/CommunityTopicCommentForm.class.php

    r10384 r11023  
    2424    unset($this['community_topic_id']);
    2525    unset($this['member_id']);
     26    unset($this['number']);
    2627    unset($this['created_at']);
    27     unset($this['updated_at']);
    2828  }
    2929
     
    3232    $communityTopicComment = parent::save($con);
    3333    $communityTopic = $communityTopicComment->getCommunityTopic();
    34     $communityTopic->setUpdatedAt($communityTopicComment->getUpdatedAt());
     34    $communityTopic->setUpdatedAt($communityTopicComment->getCreatedAt());
    3535    $communityTopic->save();
    3636  }
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/form/CommunityTopicForm.class.php

    r10438 r11023  
    2727    unset($this['created_at']);
    2828    unset($this['updated_at']);
     29    unset($this['topic_updated_at']);
    2930
    3031    $this->setWidget('name', new sfWidgetFormInput());
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/model/CommunityTopic.php

    r10409 r11023  
    2525    return $this->getCommunity()->isPrivilegeBelong($memberId);
    2626  }
     27
     28  public function isTopicModified()
     29  {
     30    return (
     31      $this->isColumnModified(CommunityTopicPeer::NAME) ||
     32      $this->isColumnModified(CommunityTopicPeer::BODY)
     33    );
     34  }
     35
     36  public function save(PropelPDO $con = null)
     37  {
     38    if ($this->isTopicModified() && !$this->isColumnModified(CommunityTopicPeer::TOPIC_UPDATED_AT))
     39    {
     40      $this->setTopicUpdatedAt(time());
     41    }
     42   
     43    parent::save($con);
     44  }
    2745}
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/model/CommunityTopicComment.php

    r10386 r11023  
    1515    return ($this->getMemberId() === $memberId || $this->getCommunityTopic()->isEditable($memberId));
    1616  }
     17
     18  public function save(PropelPDO $con = null)
     19  {
     20    if ($this->isNew() && !$this->isColumnModified(CommunityTopicCommentPeer::NUMBER))
     21    {
     22      $this->setNumber(CommunityTopicCommentPeer::getMaxNumber($this->getCommunityTopicId()) + 1);
     23    }
     24
     25    parent::save($con);
     26  }
    1727}
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/model/CommunityTopicCommentPeer.php

    r10010 r11023  
    2929    return $pager;
    3030  }
     31
     32  public static function getMaxNumber($communityTopicId)
     33  {
     34    $criteria = new Criteria();
     35    $criteria->clearSelectColumns()->addSelectColumn(self::NUMBER);
     36    $criteria->add(self::COMMUNITY_TOPIC_ID, $communityTopicId);
     37    $criteria->addDescendingOrderByColumn(self::NUMBER);
     38    $criteria->setLimit(1);
     39
     40    $stmt = self::doSelectStmt($criteria);
     41    $row = $stmt->fetch(PDO::FETCH_NUM);
     42
     43
     44    return (int)$row[0];
     45  }
    3146}
Note: See TracChangeset for help on using the changeset viewer.