Changeset 55 for trunk/frontend
- Timestamp:
- 12/20/05 11:44:03 (3 years ago)
- Files:
-
- trunk/frontend/config/logging.yml (modified) (1 diff)
- trunk/frontend/config/routing.yml (modified) (1 diff)
- trunk/frontend/config/view.yml (modified) (1 diff)
- trunk/frontend/lib/helper/AnswerHelper.php (modified) (1 diff)
- trunk/frontend/lib/helper/QuestionHelper.php (modified) (1 diff)
- trunk/frontend/lib/myUser.class.php (modified) (1 diff)
- trunk/frontend/modules/administrator (added)
- trunk/frontend/modules/administrator/actions (added)
- trunk/frontend/modules/administrator/actions/actions.class.php (added)
- trunk/frontend/modules/administrator/config (added)
- trunk/frontend/modules/administrator/config/.sf (added)
- trunk/frontend/modules/administrator/config/security.yml (added)
- trunk/frontend/modules/administrator/config/view.yml (added)
- trunk/frontend/modules/administrator/lib (added)
- trunk/frontend/modules/administrator/lib/.sf (added)
- trunk/frontend/modules/administrator/templates (added)
- trunk/frontend/modules/administrator/templates/_user_options.php (added)
- trunk/frontend/modules/administrator/templates/usersSuccess.php (added)
- trunk/frontend/modules/administrator/validate (added)
- trunk/frontend/modules/administrator/validate/.sf (added)
- trunk/frontend/modules/answer/templates/_answer.php (modified) (1 diff)
- trunk/frontend/modules/moderator (added)
- trunk/frontend/modules/moderator/actions (added)
- trunk/frontend/modules/moderator/actions/actions.class.php (added)
- trunk/frontend/modules/moderator/config (added)
- trunk/frontend/modules/moderator/config/.sf (added)
- trunk/frontend/modules/moderator/config/security.yml (added)
- trunk/frontend/modules/moderator/lib (added)
- trunk/frontend/modules/moderator/lib/.sf (added)
- trunk/frontend/modules/moderator/templates (added)
- trunk/frontend/modules/moderator/templates/_answer_options.php (added)
- trunk/frontend/modules/moderator/templates/_question_options.php (added)
- trunk/frontend/modules/moderator/templates/reportedAnswersSuccess.php (added)
- trunk/frontend/modules/moderator/templates/reportedQuestionsSuccess.php (added)
- trunk/frontend/modules/moderator/templates/unpopularTagsSuccess.php (added)
- trunk/frontend/modules/moderator/validate (added)
- trunk/frontend/modules/moderator/validate/.sf (added)
- trunk/frontend/modules/question/templates/_question_list.php (modified) (2 diffs)
- trunk/frontend/modules/question/templates/showSuccess.php (modified) (2 diffs)
- trunk/frontend/modules/sidebar/templates/_administration.php (added)
- trunk/frontend/modules/sidebar/templates/_moderation.php (added)
- trunk/frontend/modules/sidebar/templates/defaultSuccess.php (modified) (1 diff)
- trunk/frontend/modules/sidebar/templates/questionSuccess.php (modified) (1 diff)
- trunk/frontend/modules/tag/actions/actions.class.php (modified) (2 diffs)
- trunk/frontend/modules/tag/templates/_question_tags.php (modified) (1 diff)
- trunk/frontend/modules/user/actions/actions.class.php (modified) (2 diffs)
- trunk/frontend/modules/user/config/security.yml (added)
- trunk/frontend/modules/user/config/view.yml (modified) (1 diff)
- trunk/frontend/modules/user/templates/reportAnswerSuccess.php (added)
- trunk/frontend/modules/user/templates/reportQuestionSuccess.php (added)
- trunk/frontend/modules/user/templates/showSuccess.php (modified) (3 diffs)
- trunk/frontend/templates/layout.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/frontend/config/logging.yml
r2 r55 1 1 prod: 2 level: err2 level: warning 3 3 4 4 dev: trunk/frontend/config/routing.yml
r44 r55 53 53 url: /password_request 54 54 param: { module: user, action: passwordRequest } 55 56 user_report_question: 57 url: /report_question/:id 58 param: { module: user, action: reportQuestion } 59 60 user_report_answer: 61 url: /report_answer/:id 62 param: { module: user, action: reportAnswer } 55 63 56 64 # login trunk/frontend/config/view.yml
r20 r55 19 19 slots: 20 20 sidebar: [sidebar, default] 21 22 use_default_slots: on 23 trunk/frontend/lib/helper/AnswerHelper.php
r39 r55 49 49 } 50 50 51 function link_to_report_answer($answer, $user) 52 { 53 use_helper('Javascript'); 54 55 $text = '[report to moderator]'; 56 if ($user->isAuthenticated()) 57 { 58 $has_already_reported_answer = ReportAnswerPeer::retrieveByPk($answer->getId(), $user->getSubscriberId()); 59 if ($has_already_reported_answer) 60 { 61 // already spam for this user 62 return '[reported as spam]'; 63 } 64 else 65 { 66 return link_to_remote($text, array( 67 'url' => '@user_report_answer?id='.$answer->getId(), 68 'update' => array('success' => 'report_answer_'.$answer->getId()), 69 'loading' => "Element.show('indicator')", 70 'complete' => "Element.hide('indicator');".visual_effect('highlight', 'report_answer_'.$answer->getId()), 71 )); 72 } 73 } 74 else 75 { 76 return link_to_login($text); 77 } 78 } 79 51 80 ?> trunk/frontend/lib/helper/QuestionHelper.php
r38 r55 18 18 } 19 19 20 function link_to_report_question($question, $user) 21 { 22 use_helper('Javascript'); 23 24 $text = '[report to moderator]'; 25 if ($user->isAuthenticated()) 26 { 27 $has_already_reported_question = ReportQuestionPeer::retrieveByPk($question->getId(), $user->getSubscriberId()); 28 if ($has_already_reported_question) 29 { 30 // already spam for this user 31 return '[reported as spam]'; 32 } 33 else 34 { 35 return link_to_remote($text, array( 36 'url' => '@user_report_question?id='.$question->getId(), 37 'update' => array('success' => 'report_question_'.$question->getId()), 38 'loading' => "Element.show('indicator')", 39 'complete' => "Element.hide('indicator');".visual_effect('highlight', 'report_question_'.$question->getId()), 40 )); 41 } 42 } 43 else 44 { 45 return link_to_login($text); 46 } 47 } 48 20 49 ?> trunk/frontend/lib/myUser.class.php
r44 r55 9 9 10 10 $this->addCredential('subscriber'); 11 12 if ($user->getIsModerator()) 13 { 14 $this->addCredential('moderator'); 15 } 16 17 if ($user->getIsAdministrator()) 18 { 19 $this->addCredential('administrator'); 20 } 21 11 22 $this->setAttribute('nickname', $user->getNickname(), 'subscriber'); 12 23 } trunk/frontend/modules/answer/templates/_answer.php
r40 r55 8 8 <?php echo $answer->getHtmlBody() ?> 9 9 <div class="subtitle" style="margin-top: -8px">answered by <?php echo link_to_profile($answer->getUser()) ?> on <?php echo format_date($answer->getCreatedAt(), 'f') ?></div> 10 <div class="options" id="report_answer_<?php echo $answer->getId() ?>"> 11 <?php echo link_to_report_answer($answer, $user) ?> 12 <?php echo include_partial('moderator/answer_options', array('answer' => $answer)) ?> 13 </div> 10 14 </div> 11 15 trunk/frontend/modules/question/templates/_question_list.php
r38 r55 14 14 <?php echo truncate_text(strip_tags($question->getHtmlBody()), 200) ?> 15 15 16 <div class=" tags">16 <div class="options"> 17 17 18 18 <?php if ($question->getAnswers()): ?> … … 30 30 </div> 31 31 32 <div class="options" id="report_question_<?php echo $question->getId() ?>"> 33 <?php echo link_to_report_question($question, $user) ?> 34 <?php include_partial('moderator/question_options', array('question' => $question)) ?> 35 </div> 36 32 37 </div> 33 38 </div> trunk/frontend/modules/question/templates/showSuccess.php
r48 r55 1 <?php use_helpers('Date', 'Answer' ) ?>1 <?php use_helpers('Date', 'Answer', 'Question') ?> 2 2 3 3 <h1></h1> … … 14 14 <div class="question_body"> 15 15 <?php echo $question->getHtmlBody() ?> 16 <div class="options" id="report_question_<?php echo $question->getId() ?>"> 17 <?php echo link_to_report_question($question, $user) ?> 18 <?php include_partial('moderator/question_options', array('question' => $question)) ?> 19 </div> 16 20 </div> 17 21 </div> trunk/frontend/modules/sidebar/templates/defaultSuccess.php
r38 r55 11 11 <h2>browse askeet</h2> 12 12 <?php echo include_partial('rss_links') ?> 13 14 <?php echo include_partial('sidebar/moderation') ?> 15 16 <?php echo include_partial('sidebar/administration') ?> trunk/frontend/modules/sidebar/templates/questionSuccess.php
r38 r55 28 28 </div> 29 29 <?php endif ?> 30 31 <?php echo include_partial('sidebar/moderation') ?> 32 33 <?php echo include_partial('sidebar/administration') ?> trunk/frontend/modules/tag/actions/actions.class.php
r53 r55 41 41 42 42 // clear the question tag list fragment in cache 43 $this->getContext()->getViewCacheManager()->remove('@question?stripped_title='.$this->question->getStrippedTitle(), 'fragment_question_tags'); 43 if (SF_CACHE) 44 { 45 $this->getContext()->getViewCacheManager()->remove('@question?stripped_title='.$this->question->getStrippedTitle(), 'fragment_question_tags'); 46 } 44 47 } 45 48 … … 61 64 62 65 // clear the question tag list fragment in cache 63 $this->getContext()->getViewCacheManager()->remove('@question?stripped_title='.$this->question->getStrippedTitle(), 'fragment_question_tags'); 66 if (SF_CACHE) 67 { 68 $this->getContext()->getViewCacheManager()->remove('@question?stripped_title='.$this->question->getStrippedTitle(), 'fragment_question_tags'); 69 } 64 70 } 65 71 trunk/frontend/modules/tag/templates/_question_tags.php
r53 r55 17 17 <?php echo link_to($tag, '@tag?tag='.$tag, 'rel=tag') ?> 18 18 <?php endif ?> 19 20 <?php if ($user->hasCredential('moderator')): ?> 21 <?php echo link_to('[remove tag]', 'moderator/deleteTagForQuestion?tag='.$tag.'&question_id='.$question->getId(), 'confirm=Are you sure you want to delete this tag for this question?') ?> 22 <?php endif ?> 19 23 </li> 20 24 <?php endforeach ?> trunk/frontend/modules/user/actions/actions.class.php
r48 r55 166 166 } 167 167 168 public function executeReportQuestion() 169 { 170 $this->question = QuestionPeer::retrieveByPk($this->getRequestParameter('id')); 171 $this->forward404Unless($this->question); 172 173 $spam = new ReportQuestion(); 174 $spam->setQuestionId($this->question->getId()); 175 $spam->setUserId($this->getUser()->getSubscriberId()); 176 $spam->save(); 177 } 178 179 public function executeReportAnswer() 180 { 181 $this->answer = AnswerPeer::retrieveByPk($this->getRequestParameter('id')); 182 $this->forward404Unless($this->answer); 183 184 $spam = new ReportAnswer(); 185 $spam->setAnswerId($this->answer->getId()); 186 $spam->setUserId($this->getUser()->getSubscriberId()); 187 $spam->save(); 188 } 189 168 190 public function handleErrorLogin() 169 191 { … … 200 222 $this->subscriber->setEmail($this->getRequestParameter('email')); 201 223 $this->subscriber->setHasPaypal($this->getRequestParameter('has_paypal'), 0); 224 $this->subscriber->setWantToBeModerator($this->getRequestParameter('want_to_be_moderator')); 202 225 } 203 226 trunk/frontend/modules/user/config/view.yml
r20 r55 4 4 interestedSuccess: 5 5 has_layout: off 6 7 reportQuestionSuccess: 8 has_layout: off 9 10 reportAnswerSuccess: 11 has_layout: off trunk/frontend/modules/user/templates/showSuccess.php
r46 r55 1 1 <?php use_helpers('Date', 'Question', 'Text', 'Object') ?> 2 2 3 <h1><?php echo $subscriber ?>'s profile</h1> 3 <h1><?php echo $subscriber ?>'s profile 4 <?php if ($subscriber->getIsModerator()): ?> [moderator]<?php endif ?> 5 <?php if ($subscriber->getIsAdministrator()): ?> [administrator]<?php endif ?> 6 </h1> 7 8 <?php echo include_partial('administrator/user_options', array('subscriber' => $subscriber)) ?> 4 9 5 10 <?php if ($subscriber->getId() == $user->getSubscriberId()): ?> … … 26 31 <br class="clearleft" /> 27 32 28 <?php echo form_error('has_paypal') ?>29 33 <label for="has_paypal">paypal account?</label> 30 34 <?php echo object_checkbox_tag($subscriber, 'getHasPaypal') ?> … … 40 44 <?php echo input_password_tag('password_bis', '', 'size=30') ?> 41 45 <br class="clearleft" /> 46 47 <?php if (!$subscriber->getIsModerator()): ?> 48 <label for="want_to_be_moderator">do you want to be a moderator?</label> 49 <?php echo object_checkbox_tag($subscriber, 'getWantToBeModerator') ?> 50 <br class="clearleft" /> 51 <?php endif ?> 42 52 43 53 </fieldset> trunk/frontend/templates/layout.php
r40 r55 27 27 <ul> 28 28 <?php if ($user->isAuthenticated()): ?> 29 <li><?php echo link_to($user->getAttribute('nickname', '', 'subscriber').' profile', '@current_user_profile') ?></li> 29 30 <li><?php echo link_to('sign out', '@logout') ?></li> 30 <li><?php echo link_to($user->getAttribute('nickname', '', 'subscriber').' profile', '@current_user_profile') ?></li>31 31 <?php else: ?> 32 32 <li><?php echo link_to('sign in/register', '@login') ?></li>
