Changeset 38
- Timestamp:
- 12/15/05 09:24:51 (3 years ago)
- Files:
-
- trunk/data/fixtures/test_data.yml (modified) (1 diff)
- trunk/data/sql/schema.sql (modified) (1 diff)
- trunk/frontend/config/app.yml (modified) (1 diff)
- trunk/frontend/config/routing.yml (modified) (3 diffs)
- trunk/frontend/lib/helper/AnswerHelper.php (modified) (3 diffs)
- trunk/frontend/lib/helper/GlobalHelper.php (modified) (3 diffs)
- trunk/frontend/lib/helper/QuestionHelper.php (modified) (1 diff)
- trunk/frontend/lib/helper/UserHelper.php (modified) (2 diffs)
- trunk/frontend/lib/myNewAccountValidator.class.php (added)
- trunk/frontend/modules/answer/actions/actions.class.php (modified) (1 diff)
- trunk/frontend/modules/answer/templates/_answer.php (modified) (1 diff)
- trunk/frontend/modules/answer/templates/_list.php (modified) (1 diff)
- trunk/frontend/modules/answer/templates/_vote_user.php (modified) (1 diff)
- trunk/frontend/modules/answer/templates/recentSuccess.php (modified) (2 diffs)
- trunk/frontend/modules/content (added)
- trunk/frontend/modules/content/actions (added)
- trunk/frontend/modules/content/actions/actions.class.php (added)
- trunk/frontend/modules/content/config (added)
- trunk/frontend/modules/content/config/.sf (added)
- trunk/frontend/modules/content/lib (added)
- trunk/frontend/modules/content/lib/.sf (added)
- trunk/frontend/modules/content/templates (added)
- trunk/frontend/modules/content/templates/_markdown_help.php (added)
- trunk/frontend/modules/content/templates/aboutSuccess.php (added)
- trunk/frontend/modules/content/templates/indexSuccess.php (added)
- trunk/frontend/modules/content/validate (added)
- trunk/frontend/modules/content/validate/.sf (added)
- trunk/frontend/modules/question/actions/actions.class.php (modified) (3 diffs)
- trunk/frontend/modules/question/templates/_interested_user.php (modified) (1 diff)
- trunk/frontend/modules/question/templates/_question_list.php (modified) (1 diff)
- trunk/frontend/modules/question/templates/addSuccess.php (modified) (1 diff)
- trunk/frontend/modules/question/templates/showSuccess.php (modified) (1 diff)
- trunk/frontend/modules/question/validate/add.yml (modified) (2 diffs)
- trunk/frontend/modules/sidebar/templates/_rss_links.php (added)
- trunk/frontend/modules/sidebar/templates/defaultSuccess.php (modified) (1 diff)
- trunk/frontend/modules/sidebar/templates/questionSuccess.php (modified) (2 diffs)
- trunk/frontend/modules/tag/actions/actions.class.php (modified) (2 diffs)
- trunk/frontend/modules/tag/config/view.yml (modified) (1 diff)
- trunk/frontend/modules/tag/templates/_question_tags.php (modified) (1 diff)
- trunk/frontend/modules/tag/templates/_tag_cloud.php (added)
- trunk/frontend/modules/tag/templates/popularSuccess.php (modified) (1 diff)
- trunk/frontend/modules/tag/templates/removeSuccess.php (added)
- trunk/frontend/modules/tag/templates/showSuccess.php (modified) (1 diff)
- trunk/frontend/modules/user/actions/actions.class.php (modified) (2 diffs)
- trunk/frontend/modules/user/templates/loginSuccess.php (modified) (2 diffs)
- trunk/frontend/modules/user/templates/passwordRequestSuccess.php (modified) (1 diff)
- trunk/frontend/modules/user/templates/showSuccess.php (modified) (1 diff)
- trunk/frontend/modules/user/validate/add.yml (added)
- trunk/frontend/templates/layout.php (modified) (3 diffs)
- trunk/lib/model/QuestionPeer.php (modified) (1 diff)
- trunk/lib/model/QuestionTagPeer.php (modified) (2 diffs)
- trunk/lib/model/User.php (modified) (2 diffs)
- trunk/test/frontend/contentActionsTest.php (added)
- trunk/web/css/layout.css (modified) (2 diffs)
- trunk/web/css/main.css (modified) (11 diffs)
- trunk/web/images/add_background.gif (added)
- trunk/web/images/askeet_logo.gif (modified) (previous)
- trunk/web/images/content_top.gif (added)
- trunk/web/images/first.gif (added)
- trunk/web/images/footer_background.gif (added)
- trunk/web/images/header_background.gif (added)
- trunk/web/images/interested_bubble.gif (added)
- trunk/web/images/last.gif (added)
- trunk/web/images/menu_left.gif (added)
- trunk/web/images/new_background.gif (added)
- trunk/web/images/next.gif (added)
- trunk/web/images/previous.gif (added)
- trunk/web/images/side_top.gif (added)
- trunk/web/images/symfony.gif (added)
- trunk/web/images/thumb_down.gif (added)
- trunk/web/images/thumb_up.gif (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/data/fixtures/test_data.yml
r31 r38 46 46 I have a very swell blog that talks 47 47 about my class and mates and pets and favorite movies. 48 49 q4: 50 title: Test4 51 user_id: anonymous 52 body: Test 53 54 q5: 55 title: Test4 56 user_id: anonymous 57 body: Test 58 59 q6: 60 title: Test4 61 user_id: anonymous 62 body: Test 48 63 49 64 Interest: trunk/data/sql/schema.sql
r23 r38 108 108 ) 109 109 Type=InnoDB; 110 # ----------------------------------------------------------------------- 111 # ask_question_tag 112 # ----------------------------------------------------------------------- 113 DROP TABLE IF EXISTS `ask_question_tag`; 114 115 CREATE TABLE `ask_question_tag`( 116 `question_id` INTEGER , 117 `user_id` INTEGER , 118 `created_at` DATETIME , 119 `tag` VARCHAR(100) , 120 `normalized_tag` VARCHAR(100) , 121 KEY `normalized_tag_index` (`normalized_tag`), 122 INDEX `ask_question_tag_FI_1` (`question_id`), 123 CONSTRAINT `ask_question_tag_FK_1` 124 FOREIGN KEY (`question_id`) 125 REFERENCES `ask_question` (`id`) 126 , 127 INDEX `ask_question_tag_FI_2` (`user_id`), 128 CONSTRAINT `ask_question_tag_FK_2` 129 FOREIGN KEY (`user_id`) 130 REFERENCES `ask_user` (`id`) 131 ) 132 Type=InnoDB; 133 110 134 111 135 trunk/frontend/config/app.yml
r27 r38 2 2 all: 3 3 pager: 4 homepage_max: 25 answers_max: 14 homepage_max: 5 5 answers_max: 5 6 6 users_max: 10 7 7 trunk/frontend/config/routing.yml
r34 r38 44 44 add_account: 45 45 url: /add_user 46 param: { module: user, action: new}46 param: { module: user, action: add } 47 47 48 48 user_require_password: … … 76 76 param: { module: tag, action: popular } 77 77 78 tag_remove: 79 url: /question/:stripped_title/tag/remove/:tag 80 param: { module: tag, action: remove } 81 78 82 # feeds 79 83 feed_recent_answers: … … 88 92 url: /feed/question/:stripped_title 89 93 param: { module: feed, action: question } 94 95 # content 96 about: 97 url: /about 98 param: { module: content, action: about } 90 99 91 100 # default rules trunk/frontend/lib/helper/AnswerHelper.php
r25 r38 22 22 use_helper('Javascript'); 23 23 24 $img = image_tag('thumb_'.$name.'.gif'); 25 24 26 if ($user->isAuthenticated()) 25 27 { … … 28 30 { 29 31 // already interested 30 return $ name;32 return $img; 31 33 } 32 34 else 33 35 { 34 36 // didn't declare interest yet 35 return link_to_remote($ name, array(37 return link_to_remote($img, array( 36 38 'url' => 'user/vote?id='.$answer->getId().'&score='.($name == 'up' ? 1 : -1), 37 39 'update' => array('success' => 'vote_'.$answer->getId()), … … 43 45 else 44 46 { 45 return link_to_login($ name);47 return link_to_login($img); 46 48 } 47 49 } trunk/frontend/lib/helper/GlobalHelper.php
r29 r38 3 3 function link_to_rss($name, $uri) 4 4 { 5 return link_to(image_tag('rss.gif', array('alt' => $name, 'title' => $name )), $uri);5 return link_to(image_tag('rss.gif', array('alt' => $name, 'title' => $name, 'align' => 'absmiddle')), $uri); 6 6 } 7 7 … … 29 29 30 30 // First and previous page 31 $navigation .= link_to( '«', $uri.'1');32 $navigation .= link_to( '<', $uri.$pager->getPreviousPage());31 $navigation .= link_to(image_tag('first.gif', 'align=absmiddle'), $uri.'1'); 32 $navigation .= link_to(image_tag('previous.gif', 'align=absmiddle'), $uri.$pager->getPreviousPage()).' '; 33 33 34 34 // Pages one by one … … 38 38 $links[] = link_to_unless($page == $pager->getPage(), $page, $uri.$page); 39 39 } 40 $navigation .= join(' -', $links);40 $navigation .= join(' ', $links); 41 41 42 42 // Next and last page 43 $navigation .= link_to('>', $uri.$pager->getNextPage());44 $navigation .= link_to( '»', $uri.$pager->getLastPage());43 $navigation .= ' '.link_to(image_tag('next.gif', 'align=absmiddle'), $uri.$pager->getNextPage()); 44 $navigation .= link_to(image_tag('last.gif', 'align=absmiddle'), $uri.$pager->getLastPage()); 45 45 } 46 46 trunk/frontend/lib/helper/QuestionHelper.php
r31 r38 13 13 } 14 14 15 function link_to_question($question) 16 { 17 return link_to($question->getTitle(), '@question?stripped_title='.$question->getStrippedTitle()); 18 } 19 15 20 ?> trunk/frontend/lib/helper/UserHelper.php
r25 r38 20 20 'update' => array('success' => 'block_'.$question->getId()), 21 21 'loading' => "Element.show('indicator')", 22 'complete' => "Element.hide('indicator');".visual_effect(' highlight', 'mark_'.$question->getId()),22 'complete' => "Element.hide('indicator');".visual_effect('pulsate', 'mark_'.$question->getId()), 23 23 )); 24 24 } … … 30 30 } 31 31 32 function link_to_profile($user) 33 { 34 if ($user->getNickname() == 'anonymous') 35 { 36 return 'anonymous'; 37 } 38 else 39 { 40 return link_to($user->__toString(), '@user_profile?nickname='.$user->getNickname()); 41 } 42 } 43 32 44 ?> trunk/frontend/modules/answer/actions/actions.class.php
r27 r38 14 14 { 15 15 $this->answer_pager = AnswerPeer::getRecentPager($this->getRequestParameter('page', 1)); 16 17 $this->setTitle('askeet! » recent answers'); 16 18 } 17 19 trunk/frontend/modules/answer/templates/_answer.php
r25 r38 1 <?php use_helper ('Date') ?>1 <?php use_helpers('Date', 'User') ?> 2 2 3 3 <div class="vote_block" id="vote_<?php echo $answer->getId() ?>"> 4 4 <?php echo include_partial('answer/vote_user', array('answer' => $answer)) ?> 5 5 </div> 6 posted by <?php echo $answer->getUser() ?> 7 on <?php echo format_date($answer->getCreatedAt(), 'p') ?> 8 <div> 6 7 <div class="answer_body"> 9 8 <?php echo $answer->getHtmlBody() ?> 9 <div class="subtitle">answered by <?php echo link_to_profile($answer->getUser()) ?> on <?php echo format_date($answer->getCreatedAt(), 'f') ?></div> 10 10 </div> 11 12 <br class="clearleft" /> trunk/frontend/modules/answer/templates/_list.php
r25 r38 2 2 3 3 <div id="answers"> 4 <?php foreach ($answers as $answer): ?>5 <div class="answer">6 <?php include_partial('answer/answer', array('answer' => $answer)) ?>7 </div>8 <?php endforeach ?>9 4 10 <div class="answer" id="add_answer"> 11 <?php echo form_remote_tag(array( 12 'url' => '@add_answer', 13 'update' => array('success' => 'add_answer'), 14 'loading' => "Element.show('indicator')", 15 'complete' => "Element.hide('indicator');".visual_effect('highlight', 'add_answer'), 16 )) ?> 17 <fieldset> 5 <?php foreach ($answers as $answer): ?> 6 <div class="answer"> 7 <?php include_partial('answer/answer', array('answer' => $answer)) ?> 8 </div> 9 <?php endforeach ?> 18 10 19 <div class="form-row"> 11 <div class="answer" id="add_answer"> 12 <?php echo form_remote_tag(array( 13 'url' => '@add_answer', 14 'update' => array('success' => 'add_answer'), 15 'loading' => "Element.show('indicator')", 16 'complete' => "Element.hide('indicator');".visual_effect('highlight', 'add_answer'), 17 ), 'class=form') ?> 18 <fieldset> 19 20 <label for="author">author:</label> 21 <div style="display: inline; float: left"> 20 22 <?php if ($user->isAuthenticated()): ?> 21 23 <?php echo $user->getNickname() ?> 22 24 <?php else: ?> 23 <?php echo ' Anonymous Coward' ?>24 <?php echo link_to_login(' login') ?>25 <?php echo 'anonymous coward' ?> 26 <?php echo link_to_login('[login]') ?> 25 27 <?php endif ?> 26 </div> 28 </div> 29 <br class="clearleft" /> 27 30 28 <div class="form-row">29 < label for="label">Your answer:</label>30 < ?php echo textarea_tag('body', $params->get('body')) ?>31 </div>31 <label for="body">your answer:</label> 32 <?php echo textarea_tag('body', $params->get('body'), 'size=40x10') ?> 33 <br class="clearleft" /> 34 <?php echo include_partial('content/markdown_help') ?> 32 35 33 </fieldset>36 </fieldset> 34 37 35 <div class="submit-row">36 38 <?php echo input_hidden_tag('question_id', $question->getId()) ?> 37 <?php echo submit_tag('answer it') ?> 38 </div> 39 </form> 40 </div> 39 <div class="right"> 40 <?php echo submit_tag('answer it') ?> 41 </div> 42 </form> 43 </div> 41 44 42 45 </div> trunk/frontend/modules/answer/templates/_vote_user.php
r20 r38 1 1 <?php use_helper('Answer') ?> 2 2 3 <span class="vote_up_mark" id="vote_up_<?php echo $answer->getId() ?>"> 3 <div class="vote_up_mark"><?php echo link_to_user_relevancy_up($user, $answer) ?></div> 4 <div class="vote_down_mark"><?php echo link_to_user_relevancy_down($user, $answer) ?></div> 5 6 <br class="clearleft" /> 7 8 <div class="vote_up_mark" id="vote_up_<?php echo $answer->getId() ?>"> 4 9 <?php echo $answer->getRelevancyUpPercent() ?>% 5 </span> <?php echo link_to_user_relevancy_up($user, $answer) ?> 6 7 <span class="vote_down_mark" id="vote_down_<?php echo $answer->getId() ?>"> 10 </div> 11 <div class="vote_down_mark" id="vote_down_<?php echo $answer->getId() ?>"> 8 12 <?php echo $answer->getRelevancyDownPercent() ?>% 9 </ span> <?php echo link_to_user_relevancy_down($user, $answer) ?>13 </div> trunk/frontend/modules/answer/templates/recentSuccess.php
r27 r38 1 <?php use_helpers('Date', 'Answer' ) ?>1 <?php use_helpers('Date', 'Answer', 'Question') ?> 2 2 3 3 <h1>recent answers</h1> … … 6 6 <?php foreach ($answer_pager->getResults() as $answer): ?> 7 7 <div class="answer"> 8 <?php include_partial('answer/answer', array('answer' => $answer)) ?> 8 <h2><?php echo link_to_question($answer->getQuestion()) ?></h2> 9 <?php include_partial('answer/answer', array('answer' => $answer)) ?> 9 10 </div> 10 11 <?php endforeach ?> trunk/frontend/modules/question/actions/actions.class.php
r25 r38 23 23 $c = new Criteria(); 24 24 $c->add(AnswerPeer::QUESTION_ID, $this->question->getId()); 25 $c->addDescendingOrderByColumn(AnswerPeer::RELEVANCY_UP); 25 26 $this->answers = AnswerPeer::doSelect($c); 27 28 $this->setTitle('askeet! » '.$this->question->getTitle()); 26 29 } 27 30 … … 29 32 { 30 33 $this->question_pager = QuestionPeer::getRecentPager($this->getRequestParameter('page', 1)); 34 35 $this->setTitle('askeet! » recent questions'); 31 36 } 32 37 … … 46 51 $user->isInterestedIn($question); 47 52 53 $question->addTagsForUser($this->getRequestParameter('tag'), $user->getId()); 54 48 55 return $this->redirect('@question?stripped_title='.$question->getStrippedTitle()); 49 56 } trunk/frontend/modules/question/templates/_interested_user.php
r20 r38 1 1 <?php use_helper('User') ?> 2 2 3 <div class="interested_mark" id="mark_<?php echo $question->getId() ?>"> 4 <?php echo $question->getInterestedUsers() ?> 3 <?php 4 $class = 'few_interests'; 5 if ($question->getInterestedUsers() > 1000) 6 { 7 $class = 'many_interests'; 8 } 9 else if ($question->getInterestedUsers() > 100) 10 { 11 $class = 'some_interests'; 12 } 13 ?> 14 15 <div class="interested_mark <?php echo $class ?>" id="mark_<?php echo $question->getId() ?>"> 16 <?php echo $question->getInterestedUsers().' ' ?> 5 17 </div> 6 18 7 <?php echo link_to_user_interested($user, $question) ?> 19 <div class="interested_link"><?php echo link_to_user_interested($user, $question) ?></div> 20 trunk/frontend/modules/question/templates/_question_list.php
r31 r38 1 <?php use_helpers('Text', 'Global', 'Question' ) ?>1 <?php use_helpers('Text', 'Global', 'Question', 'Date') ?> 2 2 3 3 <?php foreach($question_pager->getResults() as $question): ?> 4 <div class="question"> 4 5 <div class="interested_block" id="block_<?php echo $question->getId() ?>"> 5 6 <?php echo include_partial('question/interested_user', array('question' => $question)) ?> 6 7 </div> 7 8 8 <h2><?php echo link_to($question->getTitle(), '@question?stripped_title='.$question->getStrippedTitle()) ?></h2> 9 <h2><?php echo link_to_question($question) ?></h2> 10 11 <div class="subtitle">asked by <?php echo link_to_profile($question->getUser()) ?> on <?php echo format_date($question->getCreatedAt(), 'f') ?></div> 9 12 10 13 <div class="question_body"> 11 14 <?php echo truncate_text(strip_tags($question->getHtmlBody()), 200) ?> 15 16 <div class="tags"> 17 18 <?php if ($question->getAnswers()): ?> 19 <?php echo link_to(count($question->getAnswers()).' answer'.(count($question->getAnswers()) > 1 ? 's' : ''), '@question?stripped_title='.$question->getStrippedTitle()) ?> 20 <?php else: ?> 21 <?php echo link_to('answer it', '@question?stripped_title='.$question->getStrippedTitle()) ?> 22 <?php endif ?> 23 24 - 25 26 <?php if ($question->getTags()): ?> 27 tags: <?php echo tags_for_question($question) ?> 28 <?php endif ?> 29 30 </div> 31 12 32 </div> 13 tags: <?php echo tags_for_question($question) ?>33 </div> 14 34 <?php endforeach ?> 15 35 16 <div id="question_pager" >17 <?php echo pager_navigation($question_pager, '@popular_questions') ?>36 <div id="question_pager" class="right"> 37 <?php echo pager_navigation($question_pager, '@popular_questions') ?> 18 38 </div> trunk/frontend/modules/question/templates/addSuccess.php
r25 r38 1 <?php echo form_tag('@add_question') ?> 1 <?php use_helper('Javascript') ?> 2 3 <h1>ask a question</h1> 4 5 <div class="in_form"> 6 <p> 7 Have you looked for similar questions? Check if a related question already exists: The more interesting a 8 question is, the more people will be willing to answer it. 9 </p> 10 11 <p> 12 Be as accurate as you can when giving a title to your question. Keep it short and put the details 13 in the question body. 14 </p> 15 </div> 16 17 <?php echo form_tag('@add_question', 'class=form') ?> 2 18 3 19 <fieldset> 4 20 5 <div class="form-row"> 6 <?php echo form_error('title') ?> 7 <label for="title">Question title:</label> 8 <?php echo input_tag('title', $params->get('title')) ?> 9 </div> 21 <?php echo form_error('title') ?> 22 <label for="title">question:</label> 23 <?php echo input_tag('title', $params->get('title'), 'size=40') ?> 24 <br class="clearleft" /> 10 25 11 <div class="form-row"> 12 <?php echo form_error('body') ?> 13 <label for="label">Your question in details:</label> 14 <?php echo textarea_tag('body', $params->get('body')) ?> 15 </div> 26 <?php echo form_error('body') ?> 27 <label for="label">describe it:</label> 28 <?php echo textarea_tag('body', $params->get('body'), 'size=40x10') ?> 29 <br class="clearleft" /> 30 <?php echo include_partial('content/markdown_help') ?> 31 32 <?php echo form_error('tag') ?> 33 <label for="tag">tags:</label> 34 <?php echo input_auto_complete_tag('tag', '', '@tag_autocomplete', 'autocomplete=off', 'use_style=true') ?> 35 <br class="clearleft" /> 36 <div class="small in_form">example: askeet "how to"</div> 16 37 17 38 </fieldset> 18 39 19 <div class=" submit-row">40 <div class="right"> 20 41 <?php echo submit_tag('ask it') ?> 21 42 </div> trunk/frontend/modules/question/templates/showSuccess.php
r27 r38 1 1 <?php use_helpers('Date', 'Answer') ?> 2 2 3 <div class="interested_block"> 4 <?php echo include_partial('interested_user', array('question' => $question)) ?> 5 </div> 6 7 <h2><?php echo $question->getTitle() ?></h2> 8 9 <div class="question_body"> 10 <?php echo $question->getHtmlBody() ?> 3 <h1></h1> 4 5 <div class="question"> 6 <div class="interested_block"> 7 <?php echo include_partial('interested_user', array('question' => $question)) ?> 8 </div> 9 10 <h2><?php echo $question->getTitle() ?> <?php echo link_to_rss('this question feed', '@feed_question?stripped_title='.$question->getStrippedTitle()) ?></h2> 11 12 <div class="subtitle">asked by <?php echo link_to_profile($question->getUser()) ?> on <?php echo format_date($question->getCreatedAt(), 'f') ?></div> 13 14 <div class="question_body"> 15 <?php echo $question->getHtmlBody() ?> 16 </div> 11 17 </div> 12 18 13 < p><?php echo link_to_rss('this question feed', '@feed_question?stripped_title='.$question->getStrippedTitle()) ?></p>19 <h2>Answers</h2> 14 20 15 21 <?php include_partial('answer/list', array('question' => $question, 'answers' => $answers)) ?> trunk/frontend/modules/question/validate/add.yml
r25 r38 1 1 methods: 2 post: [title, body ]2 post: [title, body, tag] 3 3 4 4 names: … … 9 9 body: 10 10 required: Yes 11 required_msg: You must provide a brief context for your question11 required_msg: you must provide a brief context for your question 12 12 validators: bodyValidator 13 14 tag: 15 required: Yes 16 required_msg: you must provide some tags for your question 13 17 14 18 bodyValidator: trunk/frontend/modules/sidebar/templates/defaultSuccess.php
r27 r38 1 1 <?php use_helper('Global') ?> 2 2 3 <?php echo link_to_login('ask a new question', '@add_question') ?> 3 <div id="add_question"> 4 <?php echo link_to_login('ask a new question', '@add_question') ?> 5 </div> 4 6 5 <ul> 6 <li><?php echo link_to('popular questions', '@homepage') ?> <?php echo link_to_rss('popular questions', 'feed/popular') ?></li> 7 <li><?php echo link_to('latest questions', '@recent_questions') ?> <?php echo link_to_rss('latest questions', '@feed_recent_questions') ?></li> 8 <li><?php echo link_to('latest answers', '@recent_answers') ?> <?php echo link_to_rss('latest answers', '@feed_recent_answers') ?></li> 9 </ul> 7 <h2>popular tags</h2> 8 <?php echo include_partial('tag/tag_cloud', array('tags' => QuestionTagPeer::getPopularTags(20))) ?> 9 <div class="right" style="padding-top: 5px"><?php echo link_to('more popular tags »', '@popular_tags') ?></div> 10 11 <h2>browse askeet</h2> 12 <?php echo include_partial('rss_links') ?> trunk/frontend/modules/sidebar/templates/questionSuccess.php
r34 r38 1 <?php use_helper(' Javascript') ?>1 <?php use_helper('Global', 'Javascript') ?> 2 2 3 <?php echo link_to('ask a new question', 'question/new') ?> 3 <div id="add_question"> 4 <?php echo link_to_login('ask a new question', '@add_question') ?> 5 </div> 4 6 5 <ul> 6 <li><?php echo link_to('popular questions', 'question/list') ?> 7 <li><?php echo link_to('latest questions', 'question/recent') ?></li> 8 <li><?php echo link_to('latest answers', 'answer/recent') ?></li> 9 </ul> 7 <h2>browse askeet</h2> 8 <?php echo include_partial('rss_links') ?> 10 9 11 10 <h2>question tags</h2> … … 16 15 17 16 <?php if ($user->isAuthenticated()): ?> 18 <div>Add your own: 19 <?php echo form_remote_tag(array( 20 'url' => '@tag_add', 21 'update' => 'question_tags', 22 )) ?> 23 <?php echo input_hidden_tag('question_id', $question->getId()) ?> 24 <?php echo input_auto_complete_tag('tag', '', '@tag_autocomplete', 'autocomplete=off', 'use_style=true') ?> 25 <?php echo submit_tag('Tag') ?> 26 </form> 17 <div>add your own: 18 <?php echo form_remote_tag(array( 19 'url' => '@tag_add', 20 'update' => 'question_tags', 21 'loading' => "Element.show('indicator'); \$('tag').value = ''", 22 'complete' => "Element.hide('indicator');".visual_effect('highlight', 'question_tags'), 23 )) ?> 24 <?php echo input_hidden_tag('question_id', $question->getId()) ?> 25 <?php echo input_auto_complete_tag('tag', '', '@tag_autocomplete', 'autocomplete=off', 'use_style=true') ?> 26 <?php echo submit_tag('tag') ?> 27 </form> 27 28 </div> 28 29 <?php endif ?> trunk/frontend/modules/tag/actions/actions.class.php
r34 r38 14 14 { 15 15 $this->question_pager = QuestionPeer::getPopularByTag($this->getRequestParameter('tag'), $this->getRequestParameter('page', 1)); 16 17 $this->setTitle('askeet! » question tagged '.Tag::normalize($this->getRequestParameter('tag'))); 16 18 } 17 19 … … 67 69 } 68 70 71 public function executeRemove() 72 { 73 // disable web debug toolbar 74 $this->getRequest()->setAttribute('disable_web_debug', true, 'debug/web'); 75 76 $this->question = QuestionPeer::getQuestionFromTitle($this->getRequestParameter('stripped_title')); 77 $this->forward404Unless($this->question); 78 79 // remove tag for this user and question 80 $user = $this->getUser()->getSubscriber(); 81 $tag = $this->getRequestParameter('tag'); 82 83 $user->removeTag($this->question, $tag); 84 85 $this->tags = $this->question->getTags(); 86 } 87 69 88 public function executePopular() 70 89 { 71 90 $this->tags = QuestionTagPeer::getPopularTags(40); 91 92 $this->setTitle('askeet! » popular tags'); 72 93 } 73 94 } trunk/frontend/modules/tag/config/view.yml
r34 r38 6 6 has_layout: off 7 7 slots: [] 8 9 removeSuccess: 10 has_layout: off 11 slots: [] trunk/frontend/modules/tag/templates/_question_tags.php
r32 r38 1 <?php foreach($tags as $tag): ?> 2 <li><?php echo link_to($tag, '@tag?tag='.$tag, 'rel=tag') ?></li> 3 <?php endforeach ?> 1 <?php use_helper('Javascript') ?> 2 3 <?php if ($user->isAuthenticated()): ?> 4 <?php $user_tags = $user->getSubscriber()->getTagsFor($question) ?> 5 <ul> 6 <?php foreach ($question->getPopularTags(20) as $tag => $count): ?> 7 <li> 8 <?php if (isset($user_tags[$tag])): ?> 9 <?php echo link_to($user_tags[$tag], '@tag?tag='.$tag, 'rel=tag') ?> 10 <?php echo link_to_remote('[x]', array( 11 'url' => '@tag_remove?stripped_title='.$question->getStrippedTitle().'&tag='.$tag, 12 'update' => 'question_tags', 13 'loading' => "Element.show('indicator')", 14 'complete' => "Element.hide('indicator');".visual_effect('highlight', 'question_tags'), 15 )) ?> 16 <?php else: ?> 17 <?php echo link_to($tag, '@tag?tag='.$tag, 'rel=tag') ?> 18 <?php endif ?> 19 </li> 20 <?php endforeach ?> 21 </ul> 22 <?php else: ?> 23 <?php echo include_partial('tag/tag_cloud', array('tags' => QuestionTagPeer::getPopularTagsFor($question))) ?> 24 <?php endif ?> trunk/frontend/modules/tag/templates/popularSuccess.php
r34 r38 1 <h2>Popular tags</h2> 2 <ul id="tag_cloud"> 3 <?php foreach($tags as $tag => $count): ?> 4 <li class="tag_popularity_<?php echo $count ?>"><?php echo link_to($tag, '@tag?tag='.$tag, 'rel=tag') ?></li> 5 <?php endforeach ?> 6 </ul> 1 <h1>Popular tags</h1> 2 3 <?php echo include_partial('tag/tag_cloud', array('tags' => $tags)) ?> trunk/frontend/modules/tag/templates/showSuccess.php
r31 r38 1 <h1>popular questions for tag '<?php echo $request->getParameter('tag') ?>'</h1> 2 1 3 <?php echo include_partial('question/question_list', array('question_pager' => $question_pager)) ?> 2 4 <?php echo pager_navigation($question_pager, '@tag?tag='.$request->getParameter('tag')) ?> trunk/frontend/modules/user/actions/actions.class.php
r29 r38 58 58 $this->answers = $this->subscriber->getAnswersJoinQuestion(); 59 59 $this->questions = $this->subscriber->getQuestions(); 60 61 $this->setTitle('askeet! » '.$this->subscriber->__toString().'\'s profile'); 60 62 } 61 63 62 64 public function executeLogin() 63 65 { 66 $this->getRequest()->setAttribute('newaccount', false); 67 64 68 if ($this->getRequest()->getMethod() != sfRequest::POST) 65 69 { 66 70 // display the form 67 $this->getRequest()->getParameterHolder()->set('referer', $this->getRequest()->getReferer()); 71 $this->setTitle('askeet! » sign in / register'); 72 $this->getRequest()->getAttributeHolder()->set('referer', $this->getRequest()->getReferer()); 68 73 return sfView::SUCCESS; 69 74 } … … 122 127 } 123 128 129 public function executeAdd() 130 { 131 // process only POST requests 132 if ($this->getRequest()->getMethod() == sfRequest::POST) 133 { 134 $user = new User(); 135 $user->setNickname($this->getRequestParameter('nickname')); 136 $user->setEmail($this->getRequestParameter('email')); 137 $user->setPassword($this->getRequestParameter('password')); 138 139 $user->save(); 140 141 $this->forward('user', 'login'); 142 } 143 144 $this->getRequest()->setAttribute('newaccount', true); 145 $this->forward('user', 'login'); 146 } 147 124 148 public function handleErrorLogin() 125 149 { 126 150 return sfView::SUCCESS; 151 } 152 153 public function handleErrorAdd() 154 { 155 $this->getRequest()->setAttribute('newaccount', true); 156 157 return array('user', 'loginSuccess'); 127 158 } 128 159 trunk/frontend/modules/user/templates/loginSuccess.php
r29 r38 1 <?php use_helper('Validation') ?> 2 <?php echo form_tag('user/login') ?> 3 1 <?php use_helpers('Validation', 'Javascript') ?> 2 3 <h1>sign in / register</h1> 4 5 <div class="in_form"> 6 <p>Registration is free and required only to create a new question or rate an answer.</p> 7 </div> 8 9 <?php echo form_tag($request->getAttribute('newaccount', false) ? '@add_account' : '@login', 'id=login_form class=form') ?> 10 4 11 <fieldset> 5 12 6 <div class="form-row"> 7 <?php echo form_error('nickname') ?> 8 <label for="nickname">nickname:</label> 9 <?php echo input_tag('nickname', $params->get('nickname')) ?> 13 <?php echo form_error('nickname') ?> 14 <label for="nickname">nickname:</label> 15 <?php echo input_tag('nickname', $params->get('nickname')) ?> 16 <br class="clearleft"/> 17 18 <?php echo form_error('password') ?> 19 <label for="password">password:</label> 20 <?php echo input_password_tag('password') ?> <?php echo link_to('forgot your password?', '@user_require_password') ?> 21 <br class="clearleft"/> 22 23 <div class="in_form"> 24 <?php echo checkbox_tag('new', 1, $request->getAttribute('newaccount', false) ? 1 : 0, array('onclick' => 'toggleForm()')) ?> 25 <label for="new" style="display: inline; float: none">click here to create a new account</label> 10 26 </div> 11 12 <div class="form-row"> 13 <?php echo form_error('password') ?> 14 <label for="password">password:</label> 15 <?php echo input_password_tag('password') ?> 27 <br class="clearleft"/> 28 29 <
