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

Changeset 12213


Ignore:
Timestamp:
Jul 9, 2009, 5:04:05 PM (11 years ago)
Author:
fukamachi
Message:

#4019 Add topic and event search to opCommunityTopicPlugin

Location:
OpenPNE3/plugins/opCommunityTopicPlugin/trunk
Files:
2 added
19 edited
7 copied

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/mobile_frontend/i18n/form_community.ja.xml

    r11205 r12213  
    1111        <target>トピック作成権限</target>
    1212      </trans-unit>
     13      <trans-unit id="3">
     14        <source>Keyword</source>
     15        <target>キーワード</target>
     16      </trans-unit>
     17      <trans-unit id="4">
     18        <source>Target</source>
     19        <target>検索対象</target>
     20      </trans-unit>
     21      <trans-unit id="5">
     22        <source>Type</source>
     23        <target>種類</target>
     24      </trans-unit>
     25      <trans-unit id="6">
     26        <source>In Community</source>
     27        <target>コミュニティ内</target>
     28      </trans-unit>
     29      <trans-unit id="7">
     30        <source>All Community</source>
     31        <target>すべてのコミュニティ</target>
     32      </trans-unit>
     33      <trans-unit id="7">
     34        <source>Comments</source>
     35        <target>コメント</target>
     36      </trans-unit>
    1337    </body>
    1438  </file>
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/mobile_frontend/i18n/messages.ja.xml

    r11207 r12213  
    4242        <source>Edit the topic</source>
    4343        <target>トピックを編集する</target>
     44      </trans-unit>
     45      <trans-unit id="">
     46        <source>Edit</source>
     47        <target>編集</target>
    4448      </trans-unit>
    4549      <trans-unit id="">
     
    135139        <target>コミュニティ最新イベント</target>
    136140      </trans-unit>
     141      <trans-unit id="">
     142        <source>Search Community Topics</source>
     143        <target>トピック検索</target>
     144      </trans-unit>
     145      <trans-unit id="">
     146        <source>Your search queries did not match any community topics.</source>
     147        <target>該当するトピックはありませんでした。</target>
     148      </trans-unit>
     149      <trans-unit id="">
     150        <source>Your search queries did not match any community events.</source>
     151        <target>該当するイベントはありませんでした。</target>
     152      </trans-unit>
    137153    </body>
    138154  </file>
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/mobile_frontend/modules/community/config/view.yml

    r11172 r12213  
    1212      target:   [after]
    1313      is_component: true
     14
     15    searchFormLine:
     16      template: [communityTopic, searchFormLine]
     17      parts:    [communityMember]
     18      target:   [after]
     19      is_component: false
     20
     21searchSuccess:
     22  customize:
     23    topicSearchLink:
     24      template: [communityTopic, topicSearchLink]
     25      parts:    [searchCommunity]
     26      target:   [after]
     27      is_component: false
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/mobile_frontend/modules/communityEvent/templates/listCommunitySuccess.php

    r11642 r12213  
    1010foreach ($pager->getResults() as $event)
    1111{
    12   $list[] = sprintf("%s<br>%s",
    13     op_format_date($event->getUpdatedAt(), 'XDateTime'),
    14     link_to(sprintf("%s(%d)",
     12  $list_str = op_format_date($event->getUpdatedAt(), 'XDateTime');
     13
     14  if ($event->getMemberId() === $sf_user->getMemberId())
     15  {
     16    $list_str .= sprintf('&nbsp;[%s]', link_to(__('Edit') ,'communityEvent_edit', $event));
     17  }
     18
     19  $list_str .= '<br>'
     20    .link_to(sprintf("%s(%d)",
    1521      op_truncate($event->getName(), 28),
    1622      $event->getCommunityEventComment()->count()
    17     ), 'communityEvent_show', $event)
    18   );
     23    ), 'communityEvent_show', $event);
     24
     25  $list[] = $list_str;
    1926}
    2027$options = array(
     
    3441<?php endif; ?>
    3542
     43<?php echo link_to(__('Create a new event'), 'communityEvent_new', $community) ?><br>
    3644<?php echo link_to(__('Community Top'), 'community/home?id='.$community->getId()) ?>
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/mobile_frontend/modules/communityEventComment/templates/_list.php

    r11171 r12213  
    22<hr>
    33<center>
    4 <?php echo __('Comments') ?><br>
     4<?php echo __('Comments', array(), 'form_community') ?><br>
    55<?php op_include_pager_total($commentPager) ?>
    66</center>
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/mobile_frontend/modules/communityTopic/templates/listCommunitySuccess.php

    r11642 r12213  
    1010foreach ($pager->getResults() as $topic)
    1111{
    12   $list[] = sprintf("%s<br>%s",
    13     op_format_date($topic->getUpdatedAt(), 'XDateTime'),
    14     link_to(sprintf("%s(%d)",
     12  $list_str = op_format_date($topic->getUpdatedAt(), 'XDateTime');
     13
     14  if ($topic->getMemberId() === $sf_user->getMemberId())
     15  {
     16    $list_str .= sprintf('&nbsp;[%s]', link_to(__('Edit') ,'communityEvent_edit', $topic));
     17  }
     18
     19  $list_str .= '<br>'
     20    .link_to(sprintf("%s(%d)",
    1521      op_truncate($topic->getName(), 28),
    1622      $topic->getCommunityTopicComment()->count()
    17     ), 'communityTopic_show', $topic)
    18   );
     23    ), 'communityTopic_show', $topic);
     24
     25  $list[] = $list_str;
    1926}
    2027$options = array(
     
    3441<?php endif; ?>
    3542
     43<?php echo link_to(__('Create a new topic'), 'communityTopic_new', $community) ?><br>
    3644<?php echo link_to(__('Community Top'), 'community/home?id='.$community->getId()) ?>
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/mobile_frontend/modules/communityTopicComment/templates/_list.php

    r11102 r12213  
    22<hr>
    33<center>
    4 <?php echo __('Comments') ?><br>
     4<?php echo __('Comments', array(), 'form_community') ?><br>
    55<?php op_include_pager_total($commentPager) ?>
    66</center>
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/pc_frontend/i18n/form_community.ja.xml

    r11205 r12213  
    1111        <target>トピック作成権限</target>
    1212      </trans-unit>
     13      <trans-unit id="3">
     14        <source>Date Updated</source>
     15        <target>更新日時</target>
     16      </trans-unit>
     17      <trans-unit id="4">
     18        <source>Keyword</source>
     19        <target>キーワード</target>
     20      </trans-unit>
     21      <trans-unit id="5">
     22        <source>Target</source>
     23        <target>検索対象</target>
     24      </trans-unit>
     25      <trans-unit id="6">
     26        <source>Type</source>
     27        <target>種類</target>
     28      </trans-unit>
     29      <trans-unit id="7">
     30        <source>In Community</source>
     31        <target>コミュニティ内</target>
     32      </trans-unit>
     33      <trans-unit id="8">
     34        <source>All Community</source>
     35        <target>すべてのコミュニティ</target>
     36      </trans-unit>
     37      <trans-unit id="9">
     38        <source>Comments</source>
     39        <target>コメント</target>
     40      </trans-unit>
    1341    </body>
    1442  </file>
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/pc_frontend/i18n/messages.ja.xml

    r11207 r12213  
    4242        <source>Edit the topic</source>
    4343        <target>トピックを編集する</target>
     44      </trans-unit>
     45      <trans-unit id="">
     46        <source>Edit</source>
     47        <target>編集</target>
    4448      </trans-unit>
    4549      <trans-unit id="">
     
    135139        <target>コミュニティ最新イベント</target>
    136140      </trans-unit>
     141      <trans-unit id="">
     142        <source>Search Community Topics</source>
     143        <target>トピック検索</target>
     144      </trans-unit>
     145      <trans-unit id="">
     146        <source>Your search queries did not match any community topics.</source>
     147        <target>該当するトピックはありませんでした。</target>
     148      </trans-unit>
     149      <trans-unit id="">
     150        <source>Your search queries did not match any community events.</source>
     151        <target>該当するイベントはありませんでした。</target>
     152      </trans-unit>
    137153    </body>
    138154  </file>
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/pc_frontend/modules/community/config/view.yml

    r11143 r12213  
    1212      target: [lastRow]
    1313      is_component: true
     14
     15    searchFormLine:
     16      template: [communityTopic, searchFormLine]
     17      parts: [communityHome]
     18      target: [after]
     19      is_component: false
     20
     21searchSuccess:
     22  customize:
     23    topicSearchLink:
     24      template: [communityTopic, topicSearchLink]
     25      parts:    [searchCommunity]
     26      target:   [after]
     27      is_component: false
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/pc_frontend/modules/communityEventComment/templates/_list.php

    r11143 r12213  
    22<div class="dparts commentList"><div class="parts">
    33<div class="partsHeading">
    4 <h3><?php echo __('Comments') ?></h3>
     4<h3><?php echo __('Comments', array(), 'form_community') ?></h3>
    55</div>
    66
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/pc_frontend/modules/communityTopicComment/templates/_list.php

    r11102 r12213  
    22<div class="dparts commentList"><div class="parts">
    33<div class="partsHeading">
    4 <h3><?php echo __('Comments') ?></h3>
     4<h3><?php echo __('Comments', array(), 'form_community') ?></h3>
    55</div>
    66
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/action/opCommunityTopicPluginTopicActions.class.php

    r12143 r12213  
    1818 * @author     Rimpei Ogawa <ogawa@tejimaya.com>
    1919 * @author     Shogo Kawahara <kawahara@tejimaya.net>
     20 * @author     Eitarow Fukamachi <fukamachi@tejimaya.net>
    2021 */
    2122
     
    189190  }
    190191
     192  /**
     193   * Executes search action
     194   *
     195   * @param sfRequest $request A request object
     196   */
     197  public function executeSearch($request)
     198  {
     199    $params = array(
     200      'keyword' => $request->getParameter('keyword'),
     201      'target' => $request->getParameter('target', 'in_community'),
     202      'type' => $request->getParameter('type', 'topic'),
     203      'id' => $request->getParameter('id'),
     204    );
     205
     206    $this->form = new PluginCommunityTopicSearchForm();
     207    $this->form->bind($params);
     208
     209    if ('event' === $request->getParameter('type'))
     210    {
     211      $table = Doctrine::getTable('CommunityEvent');
     212      $this->link_to_detail = 'communityEvent/show?id=%d';
     213      $this->type = 'event';
     214    }
     215    else
     216    {
     217      $table = Doctrine::getTable('CommunityTopic');
     218      $this->link_to_detail = 'communityTopic/show?id=%d';
     219      $this->type = 'topic';
     220    }
     221    $this->communityId = $request->getParameter('id');
     222
     223    $q = $table->getSearchQuery($request->getParameter('id'), $request->getParameter('target'), $request->getParameter('keyword'));
     224    $this->pager = $table->getResultListPager($q);
     225
     226    $this->isResult = false;
     227    if (null !== $request->getParameter('keyword') || null !== $request->getParameter('target') || null !== $request->getParameter('type'))
     228    {
     229      $this->isResult = true;
     230    }
     231
     232    return sfView::SUCCESS;
     233  }
     234
    191235  protected function processForm($request, sfForm $form)
    192236  {
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/filter/doctrine/PluginCommunityTopicFormFilter.class.php

    r11642 r12213  
    44 * PluginCommunityTopic form.
    55 *
    6  * @package    filters
     6 * @package    filter
    77 * @subpackage CommunityTopic *
    88 * @version    SVN: $Id: sfDoctrineFormTemplate.php 6174 2007-11-27 06:22:40Z fabien $
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/form/doctrine/PluginCommunityEventCommentForm.class.php

    r11642 r12213  
    2828    unset($this['created_at']);
    2929    unset($this['updated_at']);
     30
     31    $this->widgetSchema->setLabel('body', sfContext::getInstance()->getI18N()->__('Body', array(), 'community_event_form'));
    3032  }
    3133
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/form/doctrine/PluginCommunityTopicCommentForm.class.php

    r11642 r12213  
    3030    unset($this['created_at']);
    3131    unset($this['updated_at']);
     32
     33    $this->widgetSchema->setLabel('body', sfContext::getInstance()->getI18N()->__('Body', array(), 'community_topic_form'));
    3234  }
    3335
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/model/doctrine/PluginCommunityEventTable.class.php

    r11642 r12213  
    8585    return $pager;
    8686  }
     87
     88  public function getSearchQuery($communityId = null, $target = null, $keyword = null)
     89  {
     90    $q = $this->createQuery();
     91
     92    if ('all' !== $target && $communityId)
     93    {
     94      $q->where('community_id = ?', $communityId);
     95    }
     96
     97    if (!is_null($keyword))
     98    {
     99      $values = preg_split('/[\s ]+/u', $keyword);
     100      foreach ($values as $value)
     101      {
     102        $q->andWhere('(name LIKE ? OR body LIKE ?)', array('%'.$value.'%', '%'.$value.'%'));
     103      }
     104    }
     105
     106    $q->orderBy('updated_at DESC');
     107
     108    return $q;
     109  }
     110
     111  public function getResultListPager(Doctrine_Query $query, $page = 1, $size = 20)
     112  {
     113    $pager = new sfDoctrinePager('CommunityEvent', $size);
     114    $pager->setQuery($query);
     115    $pager->setPage($page);
     116    $pager->init();
     117
     118    return $pager;
     119  }
    87120}
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/model/doctrine/PluginCommunityTopicTable.class.php

    r12143 r12213  
    1515 * @subpackage CommunityTopicComment
    1616 * @author     Kousuke Ebihara <ebihara@tejimaya.com>
     17 * @author     Eitarow Fukamachi <fukamachi@tejimaya.net>
    1718 */
    1819class PluginCommunityTopicTable extends Doctrine_Table
     
    7172    return $pager;
    7273  }
     74
     75  public function getSearchQuery($communityId = null, $target = null, $keyword = null)
     76  {
     77    $q = $this->createQuery();
     78
     79    if ('all' !== $target && $communityId)
     80    {
     81      $q->where('community_id = ?', $communityId);
     82    }
     83
     84    if (!is_null($keyword))
     85    {
     86      $values = preg_split('/[\s ]+/u', $keyword);
     87      foreach ($values as $value)
     88      {
     89        $q->andWhere('(name LIKE ? OR body LIKE ?)', array('%'.$value.'%', '%'.$value.'%'));
     90      }
     91    }
     92
     93    $q->orderBy('updated_at DESC');
     94
     95    return $q;
     96  }
     97
     98  public function getResultListPager(Doctrine_Query $query, $page = 1, $size = 20)
     99  {
     100    $pager = new sfDoctrinePager('CommunityTopic', $size);
     101    $pager->setQuery($query);
     102    $pager->setPage($page);
     103    $pager->init();
     104
     105    return $pager;
     106  }
    73107}
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/opCommunityTopicPluginRouting.class.php

    r12143 r12213  
    4343      ),
    4444
     45      'communityTopic_search' => new sfDoctrineRoute(
     46        '/communityTopic/search/:id',
     47        array('module' => 'communityTopic', 'action' => 'search'),
     48        array('id' => '\d+'),
     49        array('model' => 'CommunityTopic', 'type' => 'object')
     50      ),
     51
     52      'communityTopic_search_all' => new sfRoute(
     53        '/communityTopic/search',
     54        array('module' => 'communityTopic', 'action' => 'search')
     55      ),
     56
    4557      'communityTopic_nodefaults' => new sfRoute(
    4658        '/communityTopic/*',
Note: See TracChangeset for help on using the changeset viewer.