Changeset 3677
- Timestamp:
- 03/27/07 22:59:43 (2 years ago)
- Files:
-
- plugins/sfBBPlugin/config/config.php (modified) (1 diff)
- plugins/sfBBPlugin/config/schema.yml (modified) (1 diff)
- plugins/sfBBPlugin/data/fixtures/fixtures.yml (modified) (1 diff)
- plugins/sfBBPlugin/lib/helper/sfBBHelper.php (modified) (1 diff)
- plugins/sfBBPlugin/lib/model (modified) (1 prop)
- plugins/sfBBPlugin/lib/model/map/sfBBPostMapBuilder.php (modified) (1 diff)
- plugins/sfBBPlugin/lib/model/om/BasesfBBPost.php (modified) (11 diffs)
- plugins/sfBBPlugin/lib/model/om/BasesfBBPostPeer.php (modified) (4 diffs)
- plugins/sfBBPlugin/lib/model/sfBBForum.php (modified) (1 diff)
- plugins/sfBBPlugin/lib/model/sfBBPost.php (modified) (1 diff)
- plugins/sfBBPlugin/modules/sfBB/actions/actions.class.php (modified) (1 diff)
- plugins/sfBBPlugin/modules/sfBB/templates/indexSuccess.php (modified) (1 diff)
- plugins/sfBBPlugin/modules/sfBB/templates/viewForumSuccess.php (modified) (1 diff)
- plugins/sfBBPlugin/web/css/default.css (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfBBPlugin/config/config.php
r3670 r3677 38 38 ); 39 39 40 sfRouting::getInstance()->prependRoute( 41 'sf_bb_viewthread', 42 '/sfBB/viewthread/:id/:stripped_title', 43 array( 44 'module' => 'sfBB', 45 'action' => 'viewThread', 46 ), 47 array() 48 ); 49 40 50 sfRouting::getInstance()->prependRoute( 41 51 'sf_bb_viewpost', plugins/sfBBPlugin/config/schema.yml
r3667 r3677 26 26 id: 27 27 title: { type: varchar, size: 255 } 28 stripped_title: { type: varchar, size: 255 } 28 29 content: { type: longvarchar } 29 30 created_at: plugins/sfBBPlugin/data/fixtures/fixtures.yml
r3667 r3677 32 32 nickname: joebloggs 33 33 date_of_birth: '1976-01-01' 34 u2: 35 user_id: 2 36 nickname: superhaggis 37 date_of_birth: '1977-03-23' plugins/sfBBPlugin/lib/helper/sfBBHelper.php
r3667 r3677 38 38 $html .= link_to($user->getNickname(), '@sf_bb_viewuser?username='.$user->getNickname()); 39 39 $html .= ' on '; 40 $html .= format_date ($post->getCreatedAt());40 $html .= format_datetime($post->getCreatedAt()); 41 41 42 42 return $html; plugins/sfBBPlugin/lib/model
- Property svn:ignore set to
om/
map/
- Property svn:ignore set to
plugins/sfBBPlugin/lib/model/map/sfBBPostMapBuilder.php
r3667 r3677 37 37 $tMap->addColumn('TITLE', 'Title', 'string', CreoleTypes::VARCHAR, false, 255); 38 38 39 $tMap->addColumn('STRIPPED_TITLE', 'StrippedTitle', 'string', CreoleTypes::VARCHAR, false, 255); 40 39 41 $tMap->addColumn('CONTENT', 'Content', 'string', CreoleTypes::LONGVARCHAR, false); 40 42 plugins/sfBBPlugin/lib/model/om/BasesfBBPost.php
r3667 r3677 18 18 19 19 20 protected $stripped_title; 21 22 23 20 24 protected $content; 21 25 … … 73 77 74 78 return $this->title; 79 } 80 81 82 public function getStrippedTitle() 83 { 84 85 return $this->stripped_title; 75 86 } 76 87 … … 168 179 } 169 180 181 public function setStrippedTitle($v) 182 { 183 184 if ($this->stripped_title !== $v) { 185 $this->stripped_title = $v; 186 $this->modifiedColumns[] = sfBBPostPeer::STRIPPED_TITLE; 187 } 188 189 } 190 170 191 public function setContent($v) 171 192 { … … 262 283 $this->title = $rs->getString($startcol + 1); 263 284 264 $this->content = $rs->getString($startcol + 2); 265 266 $this->created_at = $rs->getTimestamp($startcol + 3, null); 267 268 $this->updated_at = $rs->getTimestamp($startcol + 4, null); 269 270 $this->user_id = $rs->getInt($startcol + 5); 271 272 $this->forum_id = $rs->getInt($startcol + 6); 273 274 $this->parent_id = $rs->getInt($startcol + 7); 285 $this->stripped_title = $rs->getString($startcol + 2); 286 287 $this->content = $rs->getString($startcol + 3); 288 289 $this->created_at = $rs->getTimestamp($startcol + 4, null); 290 291 $this->updated_at = $rs->getTimestamp($startcol + 5, null); 292 293 $this->user_id = $rs->getInt($startcol + 6); 294 295 $this->forum_id = $rs->getInt($startcol + 7); 296 297 $this->parent_id = $rs->getInt($startcol + 8); 275 298 276 299 $this->resetModified(); … … 278 301 $this->setNew(false); 279 302 280 return $startcol + 8;303 return $startcol + 9; 281 304 } catch (Exception $e) { 282 305 throw new PropelException("Error populating sfBBPost object", $e); … … 473 496 break; 474 497 case 2: 498 return $this->getStrippedTitle(); 499 break; 500 case 3: 475 501 return $this->getContent(); 476 502 break; 477 case 3:503 case 4: 478 504 return $this->getCreatedAt(); 479 505 break; 480 case 4:506 case 5: 481 507 return $this->getUpdatedAt(); 482 508 break; 483 case 5:509 case 6: 484 510 return $this->getUserId(); 485 511 break; 486 case 6:512 case 7: 487 513 return $this->getForumId(); 488 514 break; 489 case 7:515 case 8: 490 516 return $this->getParentId(); 491 517 break; … … 502 528 $keys[0] => $this->getId(), 503 529 $keys[1] => $this->getTitle(), 504 $keys[2] => $this->getContent(), 505 $keys[3] => $this->getCreatedAt(), 506 $keys[4] => $this->getUpdatedAt(), 507 $keys[5] => $this->getUserId(), 508 $keys[6] => $this->getForumId(), 509 $keys[7] => $this->getParentId(), 530 $keys[2] => $this->getStrippedTitle(), 531 $keys[3] => $this->getContent(), 532 $keys[4] => $this->getCreatedAt(), 533 $keys[5] => $this->getUpdatedAt(), 534 $keys[6] => $this->getUserId(), 535 $keys[7] => $this->getForumId(), 536 $keys[8] => $this->getParentId(), 510 537 ); 511 538 return $result; … … 530 557 break; 531 558 case 2: 559 $this->setStrippedTitle($value); 560 break; 561 case 3: 532 562 $this->setContent($value); 533 563 break; 534 case 3:564 case 4: 535 565 $this->setCreatedAt($value); 536 566 break; 537 case 4:567 case 5: 538 568 $this->setUpdatedAt($value); 539 569 break; 540 case 5:570 case 6: 541 571 $this->setUserId($value); 542 572 break; 543 case 6:573 case 7: 544 574 $this->setForumId($value); 545 575 break; 546 case 7:576 case 8: 547 577 $this->setParentId($value); 548 578 break; … … 556 586 if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); 557 587 if (array_key_exists($keys[1], $arr)) $this->setTitle($arr[$keys[1]]); 558 if (array_key_exists($keys[2], $arr)) $this->setContent($arr[$keys[2]]); 559 if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); 560 if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); 561 if (array_key_exists($keys[5], $arr)) $this->setUserId($arr[$keys[5]]); 562 if (array_key_exists($keys[6], $arr)) $this->setForumId($arr[$keys[6]]); 563 if (array_key_exists($keys[7], $arr)) $this->setParentId($arr[$keys[7]]); 588 if (array_key_exists($keys[2], $arr)) $this->setStrippedTitle($arr[$keys[2]]); 589 if (array_key_exists($keys[3], $arr)) $this->setContent($arr[$keys[3]]); 590 if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); 591 if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); 592 if (array_key_exists($keys[6], $arr)) $this->setUserId($arr[$keys[6]]); 593 if (array_key_exists($keys[7], $arr)) $this->setForumId($arr[$keys[7]]); 594 if (array_key_exists($keys[8], $arr)) $this->setParentId($arr[$keys[8]]); 564 595 } 565 596 … … 571 602 if ($this->isColumnModified(sfBBPostPeer::ID)) $criteria->add(sfBBPostPeer::ID, $this->id); 572 603 if ($this->isColumnModified(sfBBPostPeer::TITLE)) $criteria->add(sfBBPostPeer::TITLE, $this->title); 604 if ($this->isColumnModified(sfBBPostPeer::STRIPPED_TITLE)) $criteria->add(sfBBPostPeer::STRIPPED_TITLE, $this->stripped_title); 573 605 if ($this->isColumnModified(sfBBPostPeer::CONTENT)) $criteria->add(sfBBPostPeer::CONTENT, $this->content); 574 606 if ($this->isColumnModified(sfBBPostPeer::CREATED_AT)) $criteria->add(sfBBPostPeer::CREATED_AT, $this->created_at); … … 609 641 $copyObj->setTitle($this->title); 610 642 643 $copyObj->setStrippedTitle($this->stripped_title); 644 611 645 $copyObj->setContent($this->content); 612 646 plugins/sfBBPlugin/lib/model/om/BasesfBBPostPeer.php
r3667 r3677 14 14 15 15 16 const NUM_COLUMNS = 8;16 const NUM_COLUMNS = 9; 17 17 18 18 … … 27 27 28 28 29 const STRIPPED_TITLE = 'sf_bb_post.STRIPPED_TITLE'; 30 31 29 32 const CONTENT = 'sf_bb_post.CONTENT'; 30 33 … … 50 53 51 54 private static $fieldNames = array ( 52 BasePeer::TYPE_PHPNAME => array ('Id', 'Title', ' Content', 'CreatedAt', 'UpdatedAt', 'UserId', 'ForumId', 'ParentId', ),53 BasePeer::TYPE_COLNAME => array (sfBBPostPeer::ID, sfBBPostPeer::TITLE, sfBBPostPeer:: CONTENT, sfBBPostPeer::CREATED_AT, sfBBPostPeer::UPDATED_AT, sfBBPostPeer::USER_ID, sfBBPostPeer::FORUM_ID, sfBBPostPeer::PARENT_ID, ),54 BasePeer::TYPE_FIELDNAME => array ('id', 'title', ' content', 'created_at', 'updated_at', 'user_id', 'forum_id', 'parent_id', ),55 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )55 BasePeer::TYPE_PHPNAME => array ('Id', 'Title', 'StrippedTitle', 'Content', 'CreatedAt', 'UpdatedAt', 'UserId', 'ForumId', 'ParentId', ), 56 BasePeer::TYPE_COLNAME => array (sfBBPostPeer::ID, sfBBPostPeer::TITLE, sfBBPostPeer::STRIPPED_TITLE, sfBBPostPeer::CONTENT, sfBBPostPeer::CREATED_AT, sfBBPostPeer::UPDATED_AT, sfBBPostPeer::USER_ID, sfBBPostPeer::FORUM_ID, sfBBPostPeer::PARENT_ID, ), 57 BasePeer::TYPE_FIELDNAME => array ('id', 'title', 'stripped_title', 'content', 'created_at', 'updated_at', 'user_id', 'forum_id', 'parent_id', ), 58 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) 56 59 ); 57 60 58 61 59 62 private static $fieldKeys = array ( 60 BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Title' => 1, ' Content' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, 'UserId' => 5, 'ForumId' => 6, 'ParentId' => 7, ),61 BasePeer::TYPE_COLNAME => array (sfBBPostPeer::ID => 0, sfBBPostPeer::TITLE => 1, sfBBPostPeer:: CONTENT => 2, sfBBPostPeer::CREATED_AT => 3, sfBBPostPeer::UPDATED_AT => 4, sfBBPostPeer::USER_ID => 5, sfBBPostPeer::FORUM_ID => 6, sfBBPostPeer::PARENT_ID => 7, ),62 BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'title' => 1, ' content' => 2, 'created_at' => 3, 'updated_at' => 4, 'user_id' => 5, 'forum_id' => 6, 'parent_id' => 7, ),63 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )63 BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Title' => 1, 'StrippedTitle' => 2, 'Content' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, 'UserId' => 6, 'ForumId' => 7, 'ParentId' => 8, ), 64 BasePeer::TYPE_COLNAME => array (sfBBPostPeer::ID => 0, sfBBPostPeer::TITLE => 1, sfBBPostPeer::STRIPPED_TITLE => 2, sfBBPostPeer::CONTENT => 3, sfBBPostPeer::CREATED_AT => 4, sfBBPostPeer::UPDATED_AT => 5, sfBBPostPeer::USER_ID => 6, sfBBPostPeer::FORUM_ID => 7, sfBBPostPeer::PARENT_ID => 8, ), 65 BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'title' => 1, 'stripped_title' => 2, 'content' => 3, 'created_at' => 4, 'updated_at' => 5, 'user_id' => 6, 'forum_id' => 7, 'parent_id' => 8, ), 66 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) 64 67 ); 65 68 … … 118 121 119 122 $criteria->addSelectColumn(sfBBPostPeer::TITLE); 123 124 $criteria->addSelectColumn(sfBBPostPeer::STRIPPED_TITLE); 120 125 121 126 $criteria->addSelectColumn(sfBBPostPeer::CONTENT); plugins/sfBBPlugin/lib/model/sfBBForum.php
r3667 r3677 14 14 parent::setName($name); 15 15 $this->setStrippedName(sfBBTools::stripText($name)); 16 } 17 18 public function getThreads() 19 { 20 $c = new Criteria(); 21 $c->addDescendingOrderByColumn(sfBBPostPeer::CREATED_AT); 22 $c->addJoin(sfGuardUserPeer::ID, sfBBPostPeer::USER_ID, Criteria::LEFT_JOIN); 23 $c->add(sfBBPostPeer::PARENT_ID, null); 24 return sfBBPostPeer::doSelectJoinsfGuardUser($c); 16 25 } 17 26 plugins/sfBBPlugin/lib/model/sfBBPost.php
r3667 r3677 10 10 class sfBBPost extends BasesfBBPost 11 11 { 12 public function setTitle($title) 13 { 14 parent::setTitle($title); 15 $this->setStrippedTitle(sfBBTools::stripText($title)); 16 } 17 18 public function getNbReplies() 19 { 20 $c = new Criteria(); 21 $c->add(sfBBPostPeer::PARENT_ID, $this->getId()); 22 return sfBBPostPeer::doCount($c); 23 } 24 25 public function getNbViews() 26 { 27 28 } 29 30 public function getLatestReply() 31 { 32 $c = new Criteria(); 33 $c->add(sfBBPostPeer::PARENT_ID, $this->getId()); 34 $c->addJoin(sfGuardUserPeer::ID, sfBBPostPeer::USER_ID, Criteria::LEFT_JOIN); 35 $c->addDescendingOrderByColumn(sfBBPostPeer::CREATED_AT); 36 $c->setLimit(1); 37 $post = sfBBPostPeer::doSelectJoinsfGuardUser($c); 38 return $post[0]; 39 } 12 40 } plugins/sfBBPlugin/modules/sfBB/actions/actions.class.php
r3667 r3677 31 31 public function executeIndex() 32 32 { 33 $this->categories = sfBBCategoryPeer::doSelect(new Criteria()); 33 $c = new Criteria(); 34 $c->add(sfBBCategoryPeer::IS_LIVE, 1); 35 $this->categories = sfBBCategoryPeer::doSelect($c); 34 36 } 35 37 36 38 public function executeViewForum() 37 39 { 40 $c = new Criteria(); 41 $c->add(sfBBForumPeer::ID, $this->getRequestParameter('id')); 42 $c->add(sfBBForumPeer::IS_LIVE, 1); 43 $forum = sfBBForumPeer::doSelectOne($c); 44 45 $this->forward404Unless($forum instanceof sfBBForum); 46 47 $this->forum = $forum; 38 48 } 39 49 plugins/sfBBPlugin/modules/sfBB/templates/indexSuccess.php
r3667 r3677 5 5 <div id="category<?php echo $category->getId() ?>" class="category"> 6 6 <p class="category_header"><?php echo $category->getName() ?></p> 7 < div id="fora_header">8 < div id="forum_name">Forum Name</div>9 <div id="forum_threads">Threads</div>10 <div id="forum_posts">Posts</div>11 <div id="forum_recent">Last Post</div>12 </div>13 <div id="fora">7 <table id="fora"> 8 <tr> 9 <td class="forumheader_name">Name</td> 10 <td class="forumheader_threads">Threads</td> 11 <td class="forumheader_posts">Posts</td> 12 <td class="forumheader_recent">Last Post</td> 13 </tr> 14 14 <?php foreach ($category->getFora() as $forum): ?> 15 < div id="forum<?php echo $forum->getId() ?>" class="forum">16 < divclass="forum_name">15 <tr> 16 <td class="forum_name"> 17 17 <?php echo link_to($forum->getName(), '@sf_bb_viewforum?id='.$forum->getId().'&stripped_name='.$forum->getStrippedName()) ?><br /> 18 < ?php echo simple_format_text($forum->getDescription()) ?>19 </ div>20 < div class="forum_threads"><?php echo $forum->getNbThreads() ?></div>21 < div class="forum_posts"><?php echo $forum->getNbPosts() ?></div>22 < div class="forum_recent"><?php echo sfBB_lastpost($forum->getNewestPost()) ?></div>23 </ div>18 <span class="forum_description"><?php echo simple_format_text($forum->getDescription()) ?></span> 19 </td> 20 <td class="forum_threads"><?php echo $forum->getNbThreads() ?></td> 21 <td class="forum_posts"><?php echo $forum->getNbPosts() ?></td> 22 <td class="forum_recent"><?php echo sfBB_lastpost($forum->getNewestPost()) ?></td> 23 </tr> 24 24 <?php endforeach ?> 25 </ div>25 </table> 26 26 </div> 27 27 <?php endforeach ?> plugins/sfBBPlugin/modules/sfBB/templates/viewForumSuccess.php
r3667 r3677 1 <?php use_helper('sfBB') ?> 2 <div id="threads"> 3 <?php foreach ($forum->getThreads() as $thread): ?> 4 <div id="thread<?php echo $thread->getId() ?>" class="thread"> 5 <div class="thread_title"> 6 <?php echo link_to($thread->getTitle(), '@sf_bb_viewthread?id='.$thread->getId().'&stripped_title='.$thread->getStrippedTitle()) ?><br /> 7 </div> 8 <div class="thread_replies"><?php echo $thread->getNbReplies() ?></div> 9 <div class="thread_recent"><?php echo sfBB_lastpost($thread->getLatestReply()) ?></div> 10 </div> 11 <?php endforeach ?> 12 </div> plugins/sfBBPlugin/web/css/default.css
r3667 r3677 1 div#categories 1 div#categories, div#threads 2 2 { 3 3 font: 9pt Verdana; … … 5 5 float: left; 6 6 width: 980px; 7 background-color: # 00ccff;7 background-color: #bcbcbc; 8 8 } 9 9 10 div #categories div.category10 div.category 11 11 { 12 12 float: left; … … 16 16 } 17 17 18 div#categories div.categoryp.category_header18 p.category_header 19 19 { 20 20 padding: 2px; 21 background-color: # 22eeff;21 background-color: #cdcdcd; 22 22 font-size: 12pt; 23 23 font-weight: bold; 24 24 } 25 25 26 div#categories div.category div#fora_header 26 table#fora 27 27 { 28 float: left;29 background-color: #dddddd;30 28 padding: 2px; 31 width: 970px; 29 background-color: #ffffff; 30 width: 974px; 32 31 } 33 32 34 div#categories div.category div#fora_header div#forum_name33 td.forumheader_name 35 34 { 36 35 font-weight: bold; 37 36 width: 700px; 38 float: left;37 background-color: #dddddd; 39 38 } 40 39 41 div#categories div.category div#fora_header div#forum_threads40 td.forumheader_threads, td.forumheader_posts 42 41 { 42 font-weight: bold; 43 text-align: center; 44 background-color: #dddddd; 43 45 width: 50px; 44 float: left;45 text-align: center;46 46 } 47 47 48 div#categories div.category div#fora_header div#forum_posts 48 td.forumheader_recent 49 49 { 50 width: 50px; 51 float: left; 52 text-align: center; 50 font-weight: bold; 51 background-color: #dddddd; 53 52 } 54 53 55 div#categories div.category div#fora_header div#forum_recent 54 td.forum_name 56 55 { 57 width: 164px;58 f loat: left;56 font-size: 115%; 57 font-weight: bold; 59 58 } 60 59 61 62 div#categories div.category div#fora 60 td.forum_name span.forum_description 63 61 { 64 padding: 2px; 65 float: left; 66 background-color: #fafafa; 67 width: 970px; 62 font-size: 75%; 63 font-weight: normal; 68 64 } 69 65 70 div#categories div.category div#fora div.forum 66 td.forum_threads, td.forum_posts 71 67 { 72 float: left;73 width: 964px;74 }75 76 div#categories div.category div#fora div.forum div.forum_name77 {78 float: left;79 background-color: #eeeeee;80 width: 700px;81 height: 32px;82 }83 84 div#categories div.category div#fora div.forum div.forum_threads85 {86 float: left;87 width: 50px;88 68 font-weight: bold; 89 69 text-align: center; 90 70 } 91 92 div#categories div.category div#fora div.forum div.forum_posts93 {94 float: left;95 width: 50px;96 font-weight: bold;97 text-align: center;98 }99 100 div#categories div.category div#fora div.forum div.forum_recent101 {102 float: left;103 width: 164px;104 }105 106