Initial commit
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Mon, 13 Feb 2012 12:31:01 +0000 (13:31 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Mon, 13 Feb 2012 12:31:01 +0000 (13:31 +0100)
Change-Id: I098ea9952dd326401e2b51ad66b061c42ca4f3d7

75 files changed:
Classes/Controller/AjaxController.php [new file with mode: 0644]
Classes/Controller/BaseController.php [new file with mode: 0644]
Classes/Controller/ImporterController.php [new file with mode: 0644]
Classes/Controller/QuestionController.php [new file with mode: 0644]
Classes/Controller/RatingController.php [new file with mode: 0644]
Classes/Controller/ReviewController.php [new file with mode: 0644]
Classes/Domain/Model/Discussion.php [new file with mode: 0644]
Classes/Domain/Model/Question.php [new file with mode: 0644]
Classes/Domain/Model/Rating.php [new file with mode: 0644]
Classes/Domain/Model/Review.php [new file with mode: 0644]
Classes/Domain/Model/Reviewcomment.php [new file with mode: 0644]
Classes/Domain/Repository/DiscussionRepository.php [new file with mode: 0644]
Classes/Domain/Repository/QuestionRepository.php [new file with mode: 0644]
Classes/Domain/Repository/RatingRepository.php [new file with mode: 0644]
Classes/Domain/Repository/ReviewRepository.php [new file with mode: 0644]
Classes/Domain/Repository/ReviewcommentRepository.php [new file with mode: 0644]
Classes/Utils/Repository/XmlitemRepository.php [new file with mode: 0644]
Classes/Utils/Session.php [new file with mode: 0644]
Classes/Utils/Xmlitem.php [new file with mode: 0644]
Classes/ViewHelpers/DisplayFinalRatingViewHelper.php [new file with mode: 0644]
Classes/ViewHelpers/DisplayTextAndCodeViewHelper.php [new file with mode: 0644]
Classes/ViewHelpers/ForViewHelper.php [new file with mode: 0644]
Classes/ViewHelpers/ForeachViewHelper.php [new file with mode: 0644]
Classes/ViewHelpers/ImplodeViewHelper.php [new file with mode: 0644]
Classes/ViewHelpers/InArrayViewHelper.php [new file with mode: 0644]
Configuration/FlexForms/flexform_list.xml [new file with mode: 0644]
Configuration/TCA/tca.php [new file with mode: 0644]
Configuration/TypoScript/setup.txt [new file with mode: 0644]
Resources/Private/Language/locallang.xml [new file with mode: 0644]
Resources/Private/Language/locallang_db.xml [new file with mode: 0644]
Resources/Private/Language/locallang_mod.xml [new file with mode: 0644]
Resources/Private/Layouts/standard.html [new file with mode: 0644]
Resources/Private/Layouts/standard.orig.html [new file with mode: 0644]
Resources/Private/Partials/discussion.html [new file with mode: 0644]
Resources/Private/Partials/discussionMessage.html [new file with mode: 0644]
Resources/Private/Partials/questionDetail.html [new file with mode: 0644]
Resources/Private/Partials/questionOverview.html [new file with mode: 0644]
Resources/Private/Partials/rating.old.html [new file with mode: 0644]
Resources/Private/Partials/rating1.html [new file with mode: 0644]
Resources/Private/Partials/rating2.html [new file with mode: 0644]
Resources/Private/Partials/ratingFinalRatingBox.html [new file with mode: 0644]
Resources/Private/Partials/ratingFinalViewBox.html [new file with mode: 0644]
Resources/Private/Partials/ratingOverviewBox.html [new file with mode: 0644]
Resources/Private/Partials/reviewOverview.html [new file with mode: 0644]
Resources/Private/Templates/Ajax/Index.html [new file with mode: 0644]
Resources/Private/Templates/Importer/Index.html [new file with mode: 0644]
Resources/Private/Templates/Question/Index.html [new file with mode: 0644]
Resources/Private/Templates/Question/Info.html [new file with mode: 0644]
Resources/Private/Templates/Question/ShowStep1.html [new file with mode: 0644]
Resources/Private/Templates/Question/ShowStep1.orig.html [new file with mode: 0644]
Resources/Private/Templates/Question/ShowStep2.html [new file with mode: 0644]
Resources/Private/Templates/Question/ShowStep2.orig.html [new file with mode: 0644]
Resources/Private/Templates/Question/ShowStep3.html [new file with mode: 0644]
Resources/Private/Templates/Question/ShowStep3.orig.html [new file with mode: 0644]
Resources/Private/Templates/Question/ShowStep4.html [new file with mode: 0644]
Resources/Private/Templates/Question/ShowStep4.orig.html [new file with mode: 0644]
Resources/Private/Templates/Review/EditQuestion.html [new file with mode: 0644]
Resources/Private/Templates/Review/Index.html [new file with mode: 0644]
Resources/Private/Templates/Review/Show.html [new file with mode: 0644]
Resources/Public/CSS/tx_questionrating_main.css [new file with mode: 0644]
Resources/Public/Icons/icon_tx_questionrating_discussion.gif [new file with mode: 0644]
Resources/Public/Icons/icon_tx_questionrating_question.gif [new file with mode: 0644]
Resources/Public/Icons/icon_tx_questionrating_rating.gif [new file with mode: 0644]
Resources/Public/Icons/icon_tx_questionrating_review.gif [new file with mode: 0644]
Resources/Public/Icons/icon_tx_questionrating_reviewcomment.gif [new file with mode: 0644]
Resources/Public/Images/logo.gif [new file with mode: 0644]
Resources/Public/Images/pfeil-close.gif [new file with mode: 0644]
Resources/Public/Images/pfeil.gif [new file with mode: 0644]
Resources/Public/Images/rating_bg.gif [new file with mode: 0644]
Resources/Public/JavaScript/extjs_discussion.js [new file with mode: 0644]
Resources/Public/JavaScript/tx_questionrating_main.js [new file with mode: 0644]
ext_emconf.php [new file with mode: 0644]
ext_localconf.php [new file with mode: 0644]
ext_tables.php [new file with mode: 0644]
ext_tables.sql [new file with mode: 0644]

diff --git a/Classes/Controller/AjaxController.php b/Classes/Controller/AjaxController.php
new file mode 100644 (file)
index 0000000..49e6bb9
--- /dev/null
@@ -0,0 +1,108 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+class Tx_Questionrating_Controller_AjaxController extends Tx_Questionrating_Controller_BaseController {
+
+
+       /**
+        * @var Tx_Questionrating_Domain_Repository_RatingRepository
+        */
+       protected $ratingRepository;
+
+
+       /**
+        * Initializes the current action
+        *
+        * @return void
+        */
+       public function initializeAction() {
+               parent::initializeAction();
+               $this->ratingRepository = t3lib_div::makeInstance('Tx_Questionrating_Domain_Repository_RatingRepository');
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @param string $filter
+        * @return void
+        */
+       public function indexAction(Tx_Questionrating_Domain_Model_Question $question, $filter) {
+               $discussionRepository = t3lib_div::makeInstance('Tx_Questionrating_Domain_Repository_DiscussionRepository');
+               $filterArray = explode(',', $filter);
+               $route = $filterArray[0];
+               $getLeader = 0;
+               unset($filterArray[0]);
+               if (count($filterArray) > 0) {
+                       if($key = array_search('-1', $filterArray)) {
+                               $getLeader = 1;
+                       }
+                       $discussions = $discussionRepository->findByQuestionAndFilter($question, $route, $filterArray, $getLeader);
+               }
+               else {
+                       $discussions = $question->getDiscussions();
+               }
+               $allowDiscussion = 0;
+               $rating = $this->ratingRepository->findByQuestionAndUser($question, $this->currentUser);
+               if ((!empty($rating) || $this->isLeader) && ($question->getStatus() == 'discuss')) {
+                       $allowDiscussion = 1;
+               }
+               $this->view->assign('allowDiscussion', $allowDiscussion);
+               $this->view->assign('discussions', $discussions);
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @param string $toUser
+        * @param string $message
+        * @param string $filter
+        * @return void
+        */
+       public function sendAction(Tx_Questionrating_Domain_Model_Question $question, $toUser, $message, $filter) {
+               $rating = $this->ratingRepository->findByQuestionAndUser($question, $this->currentUser);
+               if ($question->getStatus() == 'discuss' && (!empty($rating) || $this->isLeader)) {
+                       $message = $GLOBALS['TSFE']->csConvObj->conv($message, 'utf-8', $GLOBALS['TSFE']->renderCharset);
+                       if (!empty($message) && (($currentUser->uid != $toUser) || ($this->isLeader && $toUser != -1 ))) {
+                               $newDiscussion = t3lib_div::makeInstance('Tx_Questionrating_Domain_Model_Discussion');
+                               $newDiscussion->setMessage($message);
+                               $newDiscussion->setFromUser($this->currentUser);
+                               $newDiscussion->setFromLeader($this->isLeader);
+                               if ($toUser > 0) {
+                                       $user = $this->userRepository->findByUid((int)$toUser);
+                                       $newDiscussion->setToUser($user);
+                               } elseif($toUser < 0) {
+                                       $newDiscussion->setToLeader(1);
+                               }
+                               $newDiscussion->setQuestion($question);
+                               $question->addDiscussion($newDiscussion);
+                       }
+                       // $persistenceManager = t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager');
+                       // $persistenceManager->persistAll();
+               }
+               $this->uriBuilder->setTargetPageType(1268404925);
+               $this->uriBuilder->setFormat('html');
+               $ajaxGetMessageUrl = $this->uriBuilder->uriFor('index', array('question' => $question, 'filter' => $filter), 'Ajax');
+               $this->redirectToURI($ajaxGetMessageUrl);
+       }
+
+}
\ No newline at end of file
diff --git a/Classes/Controller/BaseController.php b/Classes/Controller/BaseController.php
new file mode 100644 (file)
index 0000000..d6c6c68
--- /dev/null
@@ -0,0 +1,84 @@
+<?php\r
+/***************************************************************\r
+*  Copyright notice\r
+*\r
+*  (c) 2010\r
+*  All rights reserved\r
+*\r
+*  This script is part of the TYPO3 project. The TYPO3 project is\r
+*  free software; you can redistribute it and/or modify\r
+*  it under the terms of the GNU General Public License as published by\r
+*  the Free Software Foundation; either version 2 of the License, or\r
+*  (at your option) any later version.\r
+*\r
+*  The GNU General Public License can be found at\r
+*  http://www.gnu.org/copyleft/gpl.html.\r
+*\r
+*  This script is distributed in the hope that it will be useful,\r
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+*  GNU General Public License for more details.\r
+*\r
+*  This copyright notice MUST APPEAR in all copies of the script!\r
+***************************************************************/\r
+\r
+\r
+class Tx_Questionrating_Controller_BaseController extends Tx_MvcExtjs_ExtJS_Controller_ActionController {\r
+\r
+       /**\r
+        * Initializes the current action\r
+        *\r
+        * @return void\r
+        */\r
+       protected function initializeView(Tx_Extbase_MVC_View_ViewInterface $view) {\r
+               $this->userRepository = t3lib_div::makeInstance('Tx_Extbase_Domain_Repository_FrontendUserRepository');\r
+               $this->groupRepository = t3lib_div::makeInstance('Tx_Extbase_Domain_Repository_FrontendUserGroupRepository');\r
+               if ($GLOBALS['TSFE']->fe_user->user['uid'] != NULL) {\r
+                       $this->currentUser = $this->userRepository->findByUid((int) $GLOBALS['TSFE']->fe_user->user['uid']);\r
+                       $view->assign('currentUser', $this->currentUser);\r
+                       if ($this->settings['leaderGroupUid'] != NULL) {\r
+                               $this->leaderGroup = $this->groupRepository->findByUid(intval($this->settings['leaderGroupUid']));\r
+                       } else {\r
+                               throw new Tx_Extbase_Exception('leaderGroupUid must be set');\r
+                       }\r
+                       $view->assign('leaderGroup', $this->leaderGroup);\r
+\r
+                       if ($this->settings['technicalReviewGroupUid'] != NULL) {\r
+                               $this->technicalReviewGroup = $this->groupRepository->findByUid(intval($this->settings['technicalReviewGroupUid']));\r
+                               $view->assign('technicalReviewGroup', $this->technicalReviewGroup);\r
+                       }\r
+                       if ($this->settings['translationReviewGroupUid'] != NULL) {\r
+                               $this->translationReviewGroup = $this->groupRepository->findByUid(intval($this->settings['translationReviewGroupUid']));\r
+                               $view->assign('translationReviewGroup', $this->translationReviewGroup);\r
+                       }\r
+\r
+                       $groups = $this->currentUser->getUsergroup();\r
+                       $this->isLeader = 0;\r
+                       $this->isReview = 0;\r
+                       $this->isTechnicalReview = 0;\r
+                       $this->isTranslationReview = 0;\r
+                       foreach ($groups as $group) {\r
+                               $currentGroupUid = $group->getUid();\r
+                               if ($currentGroupUid == $this->leaderGroup->getUid()) {\r
+                                       $this->isLeader = 1;\r
+                               }\r
+                               if ($currentGroupUid == $this->technicalReviewGroup->getUid()) {\r
+                                       $this->isTechnicalReview = 1;\r
+                               }\r
+                               if ($currentGroupUid == $this->translationReviewGroup->getUid()) {\r
+                                       $this->isTranslationReview = 1;\r
+                               }\r
+                       }\r
+                       if ($this->isTechnicalReview || $this->isTranslationReview) {\r
+                               $this->isReview = 1;\r
+                       }\r
+                       $view->assign('isLeader', $this->isLeader);\r
+                       $view->assign('isReview', $this->isReview);\r
+                       $view->assign('isTechnicalReview', $this->isTechnicalReview);\r
+                       $view->assign('isTranslationReview', $this->isTranslationReview);\r
+               } else {\r
+                       throw new Tx_Extbase_Exception('you are not logged in');\r
+               }\r
+               parent::initializeView($view);\r
+       }\r
+}\r
diff --git a/Classes/Controller/ImporterController.php b/Classes/Controller/ImporterController.php
new file mode 100644 (file)
index 0000000..a6e1d1d
--- /dev/null
@@ -0,0 +1,97 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+class Tx_Questionrating_Controller_ImporterController extends Tx_Questionrating_Controller_BaseController {
+
+       /**
+        * @var Tx_Questionrating_Domain_Repository_QuestionRepository
+        */
+       protected $questionRepository;
+
+       /**
+        * @var Tx_Questionrating_Utils_Repository_XmlitemRepository
+        */
+       protected $xmlitemRepository;
+
+       /**
+        * Initializes the current action
+        *
+        * @return void
+        */
+       public function initializeAction() {
+               parent::initializeAction();
+               $this->questionRepository = t3lib_div::makeInstance('Tx_Questionrating_Domain_Repository_QuestionRepository');
+               $this->xmlitemRepository = t3lib_div::makeInstance('Tx_Questionrating_Utils_Repository_XmlitemRepository');
+       }
+
+       /**
+        * Initializes the current view
+        *
+        * @return void
+        */
+       protected function initializeView(Tx_Extbase_MVC_View_ViewInterface $view) {
+               parent::initializeView($view);
+               if (!$this->isLeader) {
+                       $this->redirect('index', 'Question');
+               }
+       }
+
+       /**
+        * Index action for this controller.
+        *
+        * @return string The rendered view
+        */
+       public function indexAction() {
+               $xmlitemArray = $this->xmlitemRepository->findByStatus('experts');
+               $this->view->assign('xmlitemArray', $xmlitemArray);
+       }
+
+       /**
+        * Import a question from XML-file to DB
+        *
+        * @param array $importIds
+        * @return void
+        */
+       public function importAction($importIds) {
+               $importXmlitems = array();
+               foreach ($importIds as $id) {
+                       $xmlitem = $this->xmlitemRepository->findById($id);
+                       if ($xmlitem->getInDb()) {
+                               $questions = $this->questionRepository->findByXmlId($xmlitem->getId());
+                               foreach ($questions as $question) {
+                                       $question->setActive(FALSE);
+                                       $this->questionRepository->update($question);
+                               }
+                       }
+                       $question = t3lib_div::makeInstance('Tx_Questionrating_Domain_Model_Question');
+                       $question->importXmlitem($xmlitem);
+                       $this->questionRepository->add($question);
+                       $xmlitem->setStatus('rating');
+                       $this->xmlitemRepository->update($xmlitem);
+               }
+               $this->redirect('index', 'Question');
+       }
+
+}
\ No newline at end of file
diff --git a/Classes/Controller/QuestionController.php b/Classes/Controller/QuestionController.php
new file mode 100644 (file)
index 0000000..66d6054
--- /dev/null
@@ -0,0 +1,283 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+class Tx_Questionrating_Controller_QuestionController extends Tx_Questionrating_Controller_BaseController {
+
+       /**
+        * @var Tx_Questionrating_Domain_Repository_QuestionRepository
+        */
+       protected $questionRepository;
+
+       /**
+        * @var Tx_Questionrating_Domain_Repository_RatingRepository
+        */
+       protected $ratingRepository;
+
+       /**
+        * @var Tx_Questionrating_Domain_Repository_DiscussionRepository
+        */
+       protected $discussionRepository;
+
+       /**
+        * @var Tx_Questionrating_Utils_Session
+        */
+       protected $session;
+
+       /**
+        * Initializes the current action
+        *
+        * @return void
+        */
+       public function initializeAction() {
+               parent::initializeAction();
+               $this->session = t3lib_div::makeInstance('Tx_Questionrating_Utils_Session');
+               $this->questionRepository = t3lib_div::makeInstance('Tx_Questionrating_Domain_Repository_QuestionRepository');
+               $this->ratingRepository = t3lib_div::makeInstance('Tx_Questionrating_Domain_Repository_RatingRepository');
+               $this->discussionRepository = t3lib_div::makeInstance('Tx_Questionrating_Domain_Repository_DiscussionRepository');
+       }
+
+       /**
+        * Index action for this controller.
+        *
+        * @return string The rendered view
+        */
+       public function indexAction() {
+               $this->view->assign('showall', $this->session->get('showall'));
+               $this->view->assign('openQuestions', $this->questionRepository->findByStatusAndIsActive('open'));
+
+               if ($this->session->get('showall') || $this->isLeader) {
+                       $discussQuestions = $this->questionRepository->findByStatusAndIsActive('discuss');
+                       $finalQuestions = $this->questionRepository->findByStatusFinalOrReview();
+                       $closeQuestions = $this->questionRepository->findByStatusAndIsActive('close');
+               } else {
+                       $discussQuestions = $this->questionRepository->findByStatusAndUser('discuss', $this->currentUser);
+                       $finalQuestions = $this->questionRepository->findByStatusFinalOrReviewAndUser($this->currentUser);
+                       $closeQuestions = $this->questionRepository->findByStatusAndUser('close', $this->currentUser);
+               }
+               $this->view->assign('discussQuestions', $discussQuestions);
+               $this->view->assign('finalQuestions', $finalQuestions);
+               $this->view->assign('closeQuestions', $closeQuestions);
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @param Tx_Questionrating_Domain_Model_Rating $rating
+        * @param string $message
+        * @return void
+        *
+        * @dontvalidate $rating
+        */
+       public function showStep1Action(Tx_Questionrating_Domain_Model_Question $question, Tx_Questionrating_Domain_Model_Rating $rating = NULL, $message = '') {
+               $allowEdit = 1;
+               if ($rating == NULL) {
+                       if (!$this->isLeader) {
+                               $rating = $this->ratingRepository->findByQuestionAndUser($question, $this->currentUser);
+                               if (empty($rating)) {
+                                       $rating = t3lib_div::makeInstance('Tx_Questionrating_Domain_Model_Rating');
+                                       $rating->setUser($this->currentUser);
+                                       $rating->setQuestion($question);
+                                       $this->ratingRepository->add($rating);
+                                       $persistenceManager = t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager');
+                                       $persistenceManager->persistAll();
+                               } elseif ($rating->getRatingValue() !== NULL) {
+                                       $discussions = $this->discussionRepository->findByQuestionAndFromUser($question, $this->currentUser);
+                                       if (!empty($discussions) && is_object($discussions[0])) {
+                                               $message = $discussions[0]->getMessage();
+                                       }
+                                       if ($rating->getRatingValue() > 0) {
+                                               $allowEdit = 0;
+                                       }
+                               }
+                       }
+                       $allRatings = $this->ratingRepository->findByQuestion($question);
+                       if (count($allRatings) >= 6) {
+                               $question->setStatus('discuss');
+                               $this->questionRepository->update($question);
+                       }
+               }
+               $this->view->assign('question', $question);
+               $this->view->assign('rating', $rating);
+               $this->view->assign('message', $message);
+               $this->view->assign('allowEdit', $allowEdit);
+       }
+
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @return void
+        */
+       public function showStep2Action(Tx_Questionrating_Domain_Model_Question $question) {
+               $this->assignRatingArray($question);
+               $allowDiscussion = 0;
+               $rating = $this->ratingRepository->findByQuestionAndUser($question, $this->currentUser);
+               if (!empty($rating) || $this->isLeader)
+                       $allowDiscussion = 1;
+               $this->view->assign('question', $question);
+               $this->view->assign('allowDiscussion', $allowDiscussion);
+               $this->generateDiscussionJsCode($question, $allowDiscussion);
+       }
+
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @return void
+        */
+       public function closeDiscussionAction(Tx_Questionrating_Domain_Model_Question $question) {
+               if ($this->isLeader) {
+                       $question->setStatus('final');
+                       $this->questionRepository->update($question);
+               }
+               $this->redirect('index');
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @param Tx_Questionrating_Domain_Model_Rating $rating
+        * @return void
+        *
+        * @dontvalidate $rating
+        */
+       public function showStep3Action(Tx_Questionrating_Domain_Model_Question $question, Tx_Questionrating_Domain_Model_Rating $rating = NULL) {
+               $renderFinalRatingBox = FALSE;
+               $renderFinalRatingReviewBox = FALSE;
+               if (!$this->isLeader) {
+                       $finalRating = $this->ratingRepository->findByQuestionAndUser($question, $this->currentUser);
+                       if (!empty($finalRating) && !$finalRating->getFinalRating()) {
+                               $renderFinalRatingBox = TRUE;
+                               if ($rating != NULL) {
+                                       $finalRating = $rating;
+                               }
+                               $this->view->assign('finalRating', $finalRating);
+                       }
+               } elseif ($question->getStatus() == 'review') {
+                       $renderFinalRatingReviewBox = TRUE;
+               }
+
+               $this->view->assign('renderFinalRatingBox', $renderFinalRatingBox);
+               $this->view->assign('renderFinalViewBox', !$renderFinalRatingBox);
+               $this->view->assign('renderFinalRatingReviewBox', $renderFinalRatingReviewBox);
+               $this->assignRatingArray($question);
+               $this->view->assign('question', $question);
+               $this->generateDiscussionJsCode($question, 0);
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @return void
+        */
+       public function showStep4Action(Tx_Questionrating_Domain_Model_Question $question) {
+               if ($this->isLeader) {
+                       $ratingOverall = 0;
+                       foreach ($question->getRatings() as $rating) {
+                               $ratingOverall += $rating->getFinalRatingValue();
+                       }
+                       $this->view->assign('ratingOverall', round($ratingOverall/6));
+                       $allowDiscussion = 0;
+                       $this->assignRatingArray($question);
+                       $this->view->assign('question', $question);
+                       $this->view->assign('allowDiscussion', $allowDiscussion);
+                       $this->generateDiscussionJsCode($question, $allowDiscussion);
+               } else {
+                       $this->redirect('index');
+               }
+       }
+
+       /**
+        * @return void
+        */
+       public function toggleShowallAction() {
+               $showall = $this->session->get('showall');
+               $showall = $showall ? FALSE : TRUE;
+
+               $this->session->set('showall', $showall);
+               $this->redirect('index');
+       }
+
+       /**
+        * Info action for this controller.
+        *
+        * @return void
+        */
+       public function infoAction() {
+               $this->view->assign('infoText', $this->settings['infoText']);
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @param integer $allowDiscussion
+        * @return void
+        */
+       protected function generateDiscussionJsCode(Tx_Questionrating_Domain_Model_Question $question, $allowDiscussion) {
+               $this->initializeExtJSAction();
+               $this->uriBuilder->setTargetPageType(1268404925);
+               $this->uriBuilder->setFormat('html');
+               $ajaxUrl = $this->uriBuilder->uriFor('index', array(), 'Ajax');
+               $ajaxGetMessageUrl = $this->uriBuilder->uriFor('index', array('question'=>$question), 'Ajax');
+               $ajaxSendMessageUrl = $this->uriBuilder->uriFor('send', array('question'=>$question), 'Ajax');
+               $this->addJsFile('extjs_discussion.js');
+
+                       // variables
+               $this->addJsInlineCode('
+                       this.allowDiscussion = ' . $allowDiscussion . ';
+                       Questionrating.Question.include.init(this);
+                       this.params = {};
+                       this.ajaxGetMessageUrl = "' . $ajaxGetMessageUrl . '";
+                       this.ajaxSendMessageUrl = "' . $ajaxSendMessageUrl . '";
+                       this.extKey = "tx_questionrating_pi1";
+                       this.messageBodyUpdater = new Ext.Updater("messageBody");
+                       this.currentUserId = ' . $this->currentUser->getUid() . ';
+
+                       this.params[this.extKey+"[filter]"] = "both";
+                       this.messageBodyUpdater.showLoadIndicator = null;
+                       this.messageBodyUpdater.startAutoRefresh(100,this.ajaxGetMessageUrl,this.params);
+               ');
+
+               $this->outputJsCode();
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @return void
+        */
+       protected function assignRatingArray(Tx_Questionrating_Domain_Model_Question $question) {
+               $ratingArray = array();
+               $allowPost = $this->isLeader ? TRUE : FALSE;
+               foreach ($question->getRatings() as $currentRating) {
+                       $ratingInfos = array();
+                       $ratingInfos['rating'] = $currentRating;
+                       $fromUserResult = $this->discussionRepository->findByQuestionAndFromUser($question, $currentRating->getUser());
+                       $ratingInfos['sendcount'] = empty($fromUserResult) ? 0 : count($fromUserResult);
+                       $toUserResult = $this->discussionRepository->findByQuestionAndToUser($question, $currentRating->getUser());
+                       $ratingInfos['receivecount'] = empty($toUserResult) ? 0 : count($toUserResult);
+                       $ratingArray[] = $ratingInfos;
+                       if ($currentRating->getUser() == $this->currentUser) {
+                               $allowPost = TRUE;
+                       }
+               }
+               $this->view->assign('allowPost', $allowPost);
+               $this->view->assign('ratingArray', $ratingArray);
+       }
+
+}
diff --git a/Classes/Controller/RatingController.php b/Classes/Controller/RatingController.php
new file mode 100644 (file)
index 0000000..cb19fa6
--- /dev/null
@@ -0,0 +1,171 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+class Tx_Questionrating_Controller_RatingController extends Tx_Questionrating_Controller_BaseController {
+
+       /**
+        * @var Tx_Questionrating_Domain_Repository_RatingRepository
+        */
+        protected $ratingRepository;
+
+       /**
+        * @var Tx_Questionrating_Domain_Repository_QuestionRepository
+        */
+       protected $questionRepository;
+
+
+       /**
+        * Initializes the current action
+        *
+        * @return void
+        */
+       public function initializeAction() {
+               parent::initializeAction();
+               $this->questionRepository = t3lib_div::makeInstance('Tx_Questionrating_Domain_Repository_QuestionRepository');
+               $this->ratingRepository = t3lib_div::makeInstance('Tx_Questionrating_Domain_Repository_RatingRepository');
+       }
+
+       /**
+        * Override getErrorFlashMessage to present nice flash error messages.
+        *
+        * @return string
+        */
+       protected function getErrorFlashMessage() {
+               $errorMessage = false;
+
+               switch ($this->actionMethodName) {
+                       case 'ratingStep1Action':
+                               $errorMessage = 'Unable to save the rating';
+                               break;
+                       default :
+                               $errorMessage = parent::getErrorFlashMessage();
+               }
+
+               return $errorMessage;
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @param Tx_Questionrating_Domain_Model_Rating $rating
+        * @param string $message
+        * @return void
+        */
+       public function ratingStep1Action(Tx_Questionrating_Domain_Model_Question $question, Tx_Questionrating_Domain_Model_Rating $rating, $message = '') {
+               if (!empty($message) && $rating->getRatingValue() >= 0) {
+                       $newDiscussion = t3lib_div::makeInstance('Tx_Questionrating_Domain_Model_Discussion');
+                       $newDiscussion->setMessage($message);
+                       $newDiscussion->setFromUser($this->currentUser);
+                       $newDiscussion->setFromLeader($this->isLeader);
+                       $newDiscussion->setQuestion($question);
+                       $question->addDiscussion($newDiscussion);
+               }
+               $rating->setFinalRatingValue($rating->getRatingValue());
+               $this->ratingRepository->update($rating);
+               // $this->flashMessages->add('Your rating was updated.');
+               $this->redirect('index', 'Question');
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @param Tx_Questionrating_Domain_Model_Rating $rating
+        * @return void
+        */
+       public function ratingStep3Action(Tx_Questionrating_Domain_Model_Question $question, Tx_Questionrating_Domain_Model_Rating $rating) {
+               $rating->setFinalRating(1);
+               $this->ratingRepository->update($rating);
+               $persistenceManager = t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager');
+               $persistenceManager->persistAll();
+
+               $countFinalRating = $this->ratingRepository->countFinalRatingByQuestion($question);
+               if ($countFinalRating >= 6) {
+                       $question->setStatus('review');
+                       $this->questionRepository->update($question);
+               }
+               $this->redirect('index', 'Question');
+       }
+
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @param array $finalRatingValueArray
+        * @return void
+        * @todo validate using Extbase/Fluid if possible (see commentblock at end of this file)
+        */
+       public function closeReviewAction(Tx_Questionrating_Domain_Model_Question $question, $finalRatingValueArray) {
+               if ($this->isLeader) {
+                       $ratingOverall = 0;
+                       foreach ($question->getRatings() as $rating) {
+                               if (in_array($rating->getUid(),array_keys($finalRatingValueArray))) {
+                                       $finalRatingValue = $finalRatingValueArray[$rating->getUid()];
+                                               // @todo Extbase validator
+                                       if ($finalRatingValue <= 100 && $finalRatingValue >= 0) {
+                                               $rating->setFinalRatingValue($finalRatingValue);
+                                       }
+                               }
+                               $ratingOverall += $rating->getFinalRatingValue();
+                       }
+                       $xmlitemRepository = t3lib_div::makeInstance('Tx_Questionrating_Utils_Repository_XmlitemRepository');
+                       $xmlitem = $xmlitemRepository->findById($question->getXmlId());
+                       $xmlitem->setStatus('rated');
+                       $xmlitem->setRating(round($ratingOverall / 6));
+                       $xmlitemRepository->update($xmlitem);
+                       $xmlitemRepository->moveToOutputDir($xmlitem);
+                       $question->setStatus('close');
+                       $this->questionRepository->update($question);
+               }
+               $this->redirect('index', 'Question');
+       }
+
+       /**
+        * @dontverifyrequesthash
+        *
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @param array $ratings
+        * @return void
+        */
+       /*
+        * temporary solution works but data is not validated
+        * http://lists.typo3.org/pipermail/typo3-project-typo3v4mvc/2010-January/002618.html
+        * mapAndValidate (bzw $targetObjectValidator->isValid) erwartet Tx_Extbase_MVC_Controller_Arguments und nicht wie in Doku steht object
+
+<f:form method="post" controller="Rating" action="closeReview" name="question" object="{question}"  >
+  <f:for each="{question.ratings}" as="rating">
+    <div class="smallform smallform-sub rating">
+      <p>
+        <f:form.textbox name="ratings[{rating.uid}][finalRatingValue]" size="3" value="{rating.finalRatingValue}" />
+        <f:form.hidden name="ratings[{rating.uid}][__identity]"  value="{rating.uid}"/>
+      </p><br/>
+    </div>
+  </f:for>
+</f:form>
+
+       public function closeReviewAction(Tx_Questionrating_Domain_Model_Question $question, $ratings) {
+               var_dump($question->getUid());
+               //var_dump($this->propertyMapper->map(array('ratings'), array('ratings' => $ratings), $question));
+               var_dump($this->propertyMapper->mapAndValidate(array('ratings'), array('ratings' => $ratings), $question,array(),t3lib_div::makeInstance('Tx_Extbase_MVC_Controller_ArgumentsValidator')));
+
+       }
+       */
+}
diff --git a/Classes/Controller/ReviewController.php b/Classes/Controller/ReviewController.php
new file mode 100644 (file)
index 0000000..6dbf68b
--- /dev/null
@@ -0,0 +1,232 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+class Tx_Questionrating_Controller_ReviewController extends Tx_Questionrating_Controller_BaseController {
+
+
+       /**
+        * @var Tx_Questionrating_Domain_Repository_ReviewRepository
+        */
+       protected $reviewRepository;
+
+       /**
+        * @var Tx_Questionrating_Domain_Repository_ReviewcommentRepository
+        */
+       protected $reviewcommentRepository;
+
+
+       /**
+        * @var Tx_Questionrating_Utils_Repository_XmlitemRepository
+        */
+       protected $xmlitemRepository;
+
+       /**
+        * @var integer
+        */
+       protected $technicalVotesNeeded;
+
+       /**
+        * Initializes the current action
+        *
+        * @return void
+        */
+       public function initializeAction() {
+               parent::initializeAction();
+               $this->reviewRepository = t3lib_div::makeInstance('Tx_Questionrating_Domain_Repository_ReviewRepository');
+               $this->reviewcommentRepository = t3lib_div::makeInstance('Tx_Questionrating_Domain_Repository_ReviewcommentRepository');
+               $this->xmlitemRepository = t3lib_div::makeInstance('Tx_Questionrating_Utils_Repository_XmlitemRepository');
+               $this->xmlitemRepository->setUploadFolder('review/');
+               $this->xmlitemRepository->setOutputFolder('import/');
+               $this->technicalVotesNeeded = empty($this->settings['technicalReviewVotes']) 
+                       ? 2 
+                       : intval($this->settings['technicalReviewVotes']);
+       }
+
+       protected function initializeView(Tx_Extbase_MVC_View_ViewInterface $view) {
+               parent::initializeView($view);
+               if (!$this->isReview && !$this->isLeader) {
+                       throw new Tx_Extbase_Exception('forbidden');
+               }
+       }
+
+       /**
+        * Index action for this controller.
+        *
+        * @return void
+        */
+       public function indexAction() {
+               $this->xmlitemRepository->setUploadFolder('');
+               $this->xmlitemRepository->setOutputFolder('review/');
+               $xmlitemArray = $this->xmlitemRepository->findByStatus('experts');
+               // $xmlitemArray = $this->xmlitemRepository->findByStatus('rating');
+               foreach ($xmlitemArray as $xmlitem) {
+                       $review = t3lib_div::makeInstance('Tx_Questionrating_Domain_Model_Review');
+                       $review->setXmlId($xmlitem->getId());
+                       $review->setHeadline($xmlitem->getQuestiontext());
+                       $review->setStatus('technical');
+                       $this->reviewRepository->add($review);
+                       $this->xmlitemRepository->moveToOutputDir($xmlitem);
+               }
+               $persistenceManager = t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager');
+               $persistenceManager->persistAll();
+               if ($this->isTechnicalReview || $this->isLeader) {
+                       $technicalReviews = $this->reviewRepository->findByStatus('technical');
+                       $this->view->assign('technicalReviews', $technicalReviews);
+               }
+
+               if ($this->isTranslationReview || $this->isLeader) {
+                       $translationReviews = $this->reviewRepository->findByStatus('translation');
+                       $this->view->assign('translationReviews', $translationReviews);
+               }
+
+       }
+
+       /**
+        * Show action for this controller.
+        *
+        * @param Tx_Questionrating_Domain_Model_Review $review
+        * @param Tx_Questionrating_Domain_Model_Reviewcomment $reviewcomment
+        * @param string $vote
+        * @return void
+        *
+        * @dontvalidate $reviewcomment
+        * @dontvalidate $vote
+        */
+       public function showAction(Tx_Questionrating_Domain_Model_Review $review, Tx_Questionrating_Domain_Model_Reviewcomment $reviewcomment = NULL, $vote = 0) {
+               $status = $review->getStatus();
+               if ($status == 'technical') {
+                       $xmlitem = $this->xmlitemRepository->findById($review->getXmlid());
+                       $question = t3lib_div::makeInstance('Tx_Questionrating_Domain_Model_Question');
+                       $question->importXmlitem($xmlitem);
+                       $this->view->assign('review', $review);
+                       $this->view->assign('vote', $vote);
+                       $this->view->assign('question', $question);
+                       $this->view->assign('reviewcomment', $reviewcomment);
+               } elseif ($status == 'translation') {
+                       $this->redirect('editQuestion', 'Review', NULL, array('review'=>$review));
+               } else {
+                       $this->redirect('index');
+               }
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Review $review
+        * @param Tx_Questionrating_Domain_Model_Reviewcomment $reviewcomment
+        * @param string $vote
+        * @return void
+        */
+       public function saveCommentAction(Tx_Questionrating_Domain_Model_Review $review, Tx_Questionrating_Domain_Model_Reviewcomment $reviewcomment, $vote = 0) {
+               $message = $reviewcomment->getMessage();
+               if ($vote) {
+                       $votes = $review->getVotes()+1;
+                       $review->setVotes($votes);
+                       $message .= "\n Autocomment: Review ok";
+
+                       if ($votes >= $this->technicalVotesNeeded) {
+                               $review->setStatus('translation');
+                       }
+               }
+
+               $message = trim($message);
+
+               if (!empty($message)) {
+                       $reviewcomment->setMessage($message);
+                       $reviewcomment->setUser($this->currentUser);
+                       $reviewcomment->setReview($review);
+                       $review->addReviewcomment($reviewcomment);
+                       $this->reviewcommentRepository->add($reviewcomment);
+               }
+
+               // $this->redirect('show', 'Review', NULL, array('review'=>$review));
+               $this->redirect('index');
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Review $review
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @return string The rendered view
+        *
+        * @dontvalidate $question
+        * @dontverifyrequesthash
+        */
+       public function editQuestionAction(Tx_Questionrating_Domain_Model_Review $review, Tx_Questionrating_Domain_Model_Question $question = NULL) {
+               if ($question === NULL) {
+                       $xmlitem = $this->xmlitemRepository->findById($review->getXmlid());
+                       $question = t3lib_div::makeInstance('Tx_Questionrating_Domain_Model_Question');
+                       $question->importXmlitem($xmlitem);
+               }
+               $status = $review->getStatus();
+               if ($status == 'technical') {
+                       $setCorrectAnswer = 1;
+               } else {
+                       $setCorrectAnswer = 0;
+               }
+               $this->view->assign('setCorrectAnswer', $setCorrectAnswer);
+               $this->view->assign('review', $review);
+               $this->view->assign('question', $question);
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Review $review
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @param array $correctanswer
+        * @return void
+        *
+        * @dontverifyrequesthash
+        *
+        */
+       public function saveQuestionAction(Tx_Questionrating_Domain_Model_Review $review, Tx_Questionrating_Domain_Model_Question $question, $correctanswer = NULL) {
+               $moveXmlitemToOutputDir = FALSE;
+               $status = $review->getStatus();
+               $review->setHeadline($question->getQuestionTitle());
+               if ($status == 'technical') {
+                       $question->setCorrectanswer($correctanswer);
+                       $review->setVotes(0);
+                       $reviewcomment = t3lib_div::makeInstance('Tx_Questionrating_Domain_Model_Reviewcomment');
+                       $reviewcomment->setMessage('Autocomment: Question updated');
+                       $reviewcomment->setUser($this->currentUser);
+                       $reviewcomment->setReview($review);
+                       $review->addReviewcomment($reviewcomment);
+                       $this->reviewcommentRepository->add($reviewcomment);
+               } elseif ($status == 'translation') {
+                       $review->setStatus('close');
+                       $moveXmlitemToOutputDir = TRUE;
+               }
+               $xmlitem = $this->xmlitemRepository->findById($review->getXmlid());
+               $xmlitem->updateByQuestion($question);
+               $this->xmlitemRepository->update($xmlitem);
+               $this->reviewRepository->update($review);
+
+               if ($moveXmlitemToOutputDir) {
+                       $this->xmlitemRepository->moveToOutputDir($xmlitem);
+               }
+
+               $persistenceManager = t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager');
+               $persistenceManager->persistAll();
+               // $this->redirect('editQuestion', 'Review', NULL, array('review'=>$review));
+               $this->redirect('show', 'Review', NULL, array('review' => $review));
+       }
+
+}
diff --git a/Classes/Domain/Model/Discussion.php b/Classes/Domain/Model/Discussion.php
new file mode 100644 (file)
index 0000000..4885cc4
--- /dev/null
@@ -0,0 +1,183 @@
+<?php
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 <>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ *
+ * @scope prototype
+ * @entity
+ */
+class Tx_Questionrating_Domain_Model_Discussion extends Tx_Extbase_DomainObject_AbstractEntity {
+
+       /**
+        * @var DateTime
+        */
+       protected $crdate;
+
+       /**
+        * @var Tx_Extbase_Domain_Model_FrontendUser
+        */
+       protected $fromUser;
+
+       /**
+        * @var integer
+        */
+       protected $fromLeader;
+
+       /**
+        * @var Tx_Extbase_Domain_Model_FrontendUser
+        */
+       protected $toUser;
+
+       /**
+        * @var integer
+        */
+       protected $toLeader;
+
+
+       /**
+        * @var Tx_Questionrating_Domain_Model_Question
+        * @lazy
+        */
+       protected $question;
+
+       /**
+        * @var string
+        */
+       protected $message;
+
+       /**
+       * @return
+       */
+       public function __construct() {
+               $this->crdate = $GLOBALS['EXEC_TIME'];
+               $this->toUser = 0;
+       }
+
+       /**
+        * @param DateTime $crdate
+        * @return void
+        */
+       public function setCrdate(DateTime $crdate) {
+               $this->crdate = $crdate;
+       }
+
+       /**
+        * @return DateTime
+        */
+       public function getCrdate() {
+               return $this->crdate;
+       }
+
+       /**
+        * @param Tx_Extbase_Domain_Model_FrontendUser $user
+        * @return void
+        */
+       public function setFromUser(Tx_Extbase_Domain_Model_FrontendUser $user) {
+               $this->fromUser = $user;
+       }
+
+       /**
+        * @return Tx_Extbase_Domain_Model_FrontendUser
+        */
+       public function getFromUser() {
+               return $this->fromUser;
+       }
+
+       /**
+        * @return integer
+        */
+       public function getFromLeader() {
+               return $this->fromLeader;
+       }
+
+       /**
+        * @param integer $fromLeader
+        * @return void
+        */
+       public function setFromLeader($fromLeader) {
+               $this->fromLeader = $fromLeader;
+       }
+
+       /**
+        * @param Tx_Extbase_Domain_Model_FrontendUser $user
+        * @return void
+        */
+       public function setToUser(Tx_Extbase_Domain_Model_FrontendUser $user) {
+               $this->toUser = $user;
+       }
+
+       /**
+        * @return Tx_Extbase_Domain_Model_FrontendUser
+        */
+       public function getToUser() {
+               return $this->toUser;
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @return void
+        */
+       public function setQuestion(Tx_Questionrating_Domain_Model_Question $question) {
+               $this->question = $question;
+       }
+
+       /**
+        * @return Tx_Questionrating_Domain_Model_Question
+        */
+       public function getQuestion() {
+               return $this->question;
+       }
+
+       /**
+        * @return string
+        */
+       public function getMessage() {
+               return $this->message;
+       }
+
+       /**
+        * @param integer $message
+        * @return void
+        */
+       public function setMessage($message) {
+               $this->message = $message;
+       }
+
+       /**
+        * @return integer
+        */
+       public function getToLeader() {
+               return $this->toLeader;
+       }
+
+       /**
+        * @param integer $toLeader
+        * @return void
+        */
+       public function setToLeader($toLeader) {
+               $this->toLeader = $toLeader;
+       }
+
+}
\ No newline at end of file
diff --git a/Classes/Domain/Model/Question.php b/Classes/Domain/Model/Question.php
new file mode 100644 (file)
index 0000000..848d59d
--- /dev/null
@@ -0,0 +1,461 @@
+<?php
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 <>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ *
+ * @scope prototype
+ * @entity
+ */
+class Tx_Questionrating_Domain_Model_Question extends Tx_Extbase_DomainObject_AbstractEntity {
+
+       /**
+        * @var string
+        */
+       protected $xmlId;
+
+       /**
+        * @var string
+        */
+       protected $status;
+
+       /**
+        * @var boolean
+        */
+       protected $active;
+
+       /**
+        * @var string
+        * @validate notEmpty;
+        *
+        */
+       protected $questiontext;
+
+       /**
+        * @var string
+        */
+       protected $answer1text;
+
+       /**
+        * @var string
+        */
+       protected $answer2text;
+
+       /**
+        * @var string
+        */
+       protected $answer3text;
+
+       /**
+        * @var string
+        */
+       protected $answer4text;
+
+       /**
+        * @var string
+        */
+       protected $answer5text;
+
+       /**
+        * @var string
+        */
+       protected $answer6text;
+
+       /**
+        * @var string
+        */
+       protected $answer7text;
+
+       /**
+        * @var string
+        */
+       protected $answer8text;
+
+       /**
+        * @var string
+        */
+       protected $answer9text;
+
+       /**
+        * @var string
+        */
+       protected $answer10text;
+
+       /**
+        * @var string
+        */
+       protected $correctanswer;
+
+       /**
+        * @var Tx_Extbase_Persistence_ObjectStorage<Tx_Questionrating_Domain_Model_Rating>
+        * @lazy
+        */
+       protected $ratings;
+
+       /**
+        * @var Tx_Extbase_Persistence_ObjectStorage<Tx_Questionrating_Domain_Model_Discussion>
+        * @lazy
+        */
+       protected $discussions;
+
+       /**
+       * @return
+       */
+       public function __construct() {
+               $this->ratings = new Tx_Extbase_Persistence_ObjectStorage();
+               $this->discussions = new Tx_Extbase_Persistence_ObjectStorage();
+               $this->status = 'open';
+               $this->active = TRUE;
+       }
+
+       /**
+        * @return string
+        */
+       public function getXmlId() {
+               return $this->xmlId;
+       }
+
+       /**
+        * @param string $xml_id
+        * @return void
+        */
+       public function setXmlId($xml_id) {
+               $this->xmlId = $xml_id;
+       }
+
+       /**
+        * @return string
+        */
+       public function getStatus() {
+               return $this->status;
+       }
+
+       /**
+        * @param string $status
+        * @return void
+        */
+       public function setStatus($status) {
+               $this->status = $status;
+       }
+
+       /**
+        * @return boolean
+        */
+       public function getActive() {
+               return $this->active;
+       }
+
+       /**
+        * @param boolean $active
+        * @return void
+        */
+       public function setActive($active) {
+               $this->active = $active;
+       }
+
+       /**
+        * @return string
+        */
+       public function getQuestiontext() {
+               return $this->questiontext;
+       }
+
+       /**
+        * @param string $questiontext
+        * @return void
+        */
+       public function setQuestiontext($questiontext) {
+               $this->questiontext = $questiontext;
+       }
+
+       /**
+        * @return string
+        */
+       public function getAnswer1text() {
+               return $this->answer1text;
+       }
+
+       /**
+        * @param string $answer1text
+        * @return void
+        */
+       public function setAnswer1text($answer1text) {
+               $this->answer1text = $answer1text;
+       }
+
+       /**
+        * @return string
+        */
+       public function getAnswer2text() {
+               return $this->answer2text;
+       }
+
+       /**
+        * @param string $answer2text
+        * @return void
+        */
+       public function setAnswer2text($answer2text) {
+               $this->answer2text = $answer2text;
+       }
+
+       /**
+        * @return string
+        */
+       public function getAnswer3text() {
+               return $this->answer3text;
+       }
+
+       /**
+        * @param string $answer3text
+        * @return void
+        */
+       public function setAnswer3text($answer3text) {
+               $this->answer3text = $answer3text;
+       }
+
+       /**
+        * @return string
+        */
+       public function getAnswer4text() {
+               return $this->answer4text;
+       }
+
+       /**
+        * @param string $answer4text
+        * @return void
+        */
+       public function setAnswer4text($answer4text) {
+               $this->answer4text = $answer4text;
+       }
+
+       /**
+        * @return string
+        */
+       public function getAnswer5text() {
+               return $this->answer5text;
+       }
+
+       /**
+        * @param string $answer5text
+        * @return void
+        */
+       public function setAnswer5text($answer5text) {
+               $this->answer5text = $answer5text;
+       }
+
+       /**
+        * @return string
+        */
+       public function getAnswer6text() {
+               return $this->answer6text;
+       }
+
+       /**
+        * @param string $answer6text
+        * @return void
+        */
+       public function setAnswer6text($answer6text) {
+               $this->answer6text = $answer6text;
+       }
+
+       /**
+        * @return string
+        */
+       public function getAnswer7text() {
+               return $this->answer7text;
+       }
+
+       /**
+        * @param string $answer7text
+        * @return void
+        */
+       public function setAnswer7text($answer7text) {
+               $this->answer7text = $answer7text;
+       }
+
+       /**
+        * @return string
+        */
+       public function getAnswer8text() {
+               return $this->answer8text;
+       }
+
+       /**
+        * @param string $answer8text
+        * @return void
+        */
+       public function setAnswer8text($answer8text) {
+               $this->answer8text = $answer8text;
+       }
+
+       /**
+        * @return string
+        */
+       public function getAnswer9text() {
+               return $this->answer9text;
+       }
+
+       /**
+        * @param string $answer9text
+        * @return void
+        */
+       public function setAnswer9text($answer9text) {
+               $this->answer9text = $answer9text;
+       }
+
+       /**
+        * @return string
+        */
+       public function getAnswer10text() {
+               return $this->answer10text;
+       }
+
+       /**
+        * @param string $answer10text
+        * @return void
+        */
+       public function setAnswer10text($answer10text) {
+               $this->answer10text = $answer10text;
+       }
+
+       /**
+        * @return array
+        */
+       public function getAnswers() {
+               $answers = array();
+               for ($i = 1; $i <= 10; $i++) {
+                       $currentAnswer = 'answer' . $i . 'text';
+                       if (!empty($this->$currentAnswer)) {
+                               $answers[$i] = $this->$currentAnswer;
+                       }
+               }
+               return $answers;
+       }
+
+       public function getAllAnswers() {
+               $answers = array();
+               for ($i = 1; $i <= 10; $i++) {
+                       $currentAnswer = 'answer' . $i . 'text';
+                       $answers[$i] = $this->$currentAnswer;
+               }
+               return $answers;
+       }
+
+               /**
+        * @return array
+        */
+       public function getCorrectanswer() {
+               return explode(',', $this->correctanswer);
+       }
+
+       /**
+        * @param array $correctanswer
+        * @return void
+        */
+       public function setCorrectanswer($correctanswer) {
+               $newValues = array();
+               foreach ($correctanswer as $value) {
+                       $newValues[] = (int)$value;
+               }
+               $this->correctanswer = implode(',', $newValues);
+       }
+
+       /**
+        * @return Tx_Extbase_Persistence_ObjectStorage
+        */
+       public function getRatings() {
+               return $this->ratings;
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Rating $rating
+        * @return void
+        */
+       public function addRating(Tx_Questionrating_Domain_Model_Rating $rating) {
+               $this->ratings->attach($rating);
+       }
+
+       /**
+        * @param Tx_Extbase_Persistence_ObjectStorage $ratings
+        * @return void
+        */
+       public function setRatings(Tx_Extbase_Persistence_ObjectStorage $ratings) {
+               $this->ratings = $ratings;
+       }
+
+
+       /**
+        * @return Tx_Extbase_Persistence_ObjectStorage
+        */
+       public function getDiscussions() {
+               return $this->discussions;
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Discussion $rating
+        * @return void
+        */
+       public function addDiscussion(Tx_Questionrating_Domain_Model_Discussion $discussion) {
+               $this->discussions->attach($discussion);
+       }
+
+       /**
+        * @param Tx_Extbase_Persistence_ObjectStorage $discussions
+        * @return void
+        */
+       public function setDiscussions(Tx_Extbase_Persistence_ObjectStorage $discussions) {
+               $this->discussions = $discussions;
+       }
+
+       /**
+        * @return string
+        */
+       public function getQuestionTitle() {
+               $title = strpos($this->questiontext, "<br") > 0 ? substr($this->questiontext, 0, strpos($this->questiontext, "<br")) : $this->questiontext;
+               // if (strlen($title) > 30)
+               // $title = substr($title, 0, 30) . '...';
+               return $title;
+       }
+
+       /**
+        * @param Tx_Questionrating_Utils_Xmlitem $xmlitem
+        *
+        */
+       public function importXmlitem(Tx_Questionrating_Utils_Xmlitem $xmlitem) {
+               $this->xmlId = $xmlitem->getId();
+               $this->questiontext = $xmlitem->getQuestiontext();
+               $answerCount = 1;
+               $correctanswer = array();
+               foreach ($xmlitem->getAnswers() as $answers) {
+                       $currentAnswerVar = 'answer' . $answerCount . 'text';
+                       $this->$currentAnswerVar = $answers['text'];
+                       if ($answers['correct']) {
+                               $correctanswer[] = $answerCount;
+                       }
+                       $answerCount++;
+               }
+               $this->setCorrectanswer($correctanswer);
+
+       }
+}
\ No newline at end of file
diff --git a/Classes/Domain/Model/Rating.php b/Classes/Domain/Model/Rating.php
new file mode 100644 (file)
index 0000000..7ca7341
--- /dev/null
@@ -0,0 +1,148 @@
+<?php
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 <>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ *
+ * @scope prototype
+ * @entity
+ */
+class Tx_Questionrating_Domain_Model_Rating extends Tx_Extbase_DomainObject_AbstractEntity {
+
+       /**
+        * @var Tx_Extbase_Domain_Model_FrontendUser
+        */
+       protected $user;
+       
+       /**
+        * @var Tx_Questionrating_Domain_Model_Question
+        * @lazy
+        */
+       protected $question;    
+
+       /**
+        * @var integer
+        * @validate NumberRange(startRange = 0, endRange = 99)
+        * @validate Integer
+        */
+       protected $ratingValue;
+
+       /**
+        * @var boolean
+        */
+       protected $finalRating;
+
+       /**
+        * @var integer
+        * @validate NumberRange(startRange = 0, endRange = 99)
+        * @validate Integer
+        */
+       protected $finalRatingValue;
+
+       /**
+       * @return void
+       */
+       public function __construct() {
+               $this->ratingValue = NULL;      
+       }
+       
+       /**
+        * @param Tx_Extbase_Domain_Model_FrontendUser $user 
+        * @return void
+        */
+       public function setUser(Tx_Extbase_Domain_Model_FrontendUser $user) {
+               $this->user = $user;
+       }
+
+       /**
+        * @return Tx_Extbase_Domain_Model_FrontendUser
+        */
+       public function getUser() {
+               return $this->user;
+       }
+       
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question 
+        * @return void
+        */
+       public function setQuestion(Tx_Questionrating_Domain_Model_Question $question) {
+               $this->question = $question;
+       }
+
+       /**
+        * @return Tx_Questionrating_Domain_Model_Question
+        */
+       public function getQuestion() {
+               return $this->question;
+       }
+       
+
+       /**
+        * @return integer
+        */
+       public function getRatingValue() {
+               return $this->ratingValue;
+       }
+
+       /**
+        * @param integer $ratingValue
+        * @return void
+        */
+       public function setRatingValue($ratingValue) {
+               $this->ratingValue = $ratingValue;
+       }
+
+       /**
+        * @return boolean
+        */
+       public function getFinalRating() {
+               return $this->finalRating;
+       }
+
+       /**
+        * @param boolean $finalRating
+        * @return void
+        */
+       public function setFinalRating($finalRating) {
+               $this->finalRating = $finalRating;
+       }
+       
+       /**
+        * @return integer
+        * 
+        */
+       public function getFinalRatingValue() {
+               return $this->finalRatingValue;
+       }
+
+       /**
+        * @param integer $finalRatingValue
+        * @return void
+        */
+       public function setFinalRatingValue($finalRatingValue) {
+               $this->finalRatingValue = $finalRatingValue;
+       }
+               
+
+}
\ No newline at end of file
diff --git a/Classes/Domain/Model/Review.php b/Classes/Domain/Model/Review.php
new file mode 100644 (file)
index 0000000..9d87d08
--- /dev/null
@@ -0,0 +1,153 @@
+<?php
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 <>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ *
+ * @scope prototype
+ * @entity
+ */
+class Tx_Questionrating_Domain_Model_Review extends Tx_Extbase_DomainObject_AbstractEntity {
+
+       /**
+        * @var string
+        */
+       protected $xmlId;
+
+       /**
+        * @var string
+        */
+       protected $headline;
+
+       /**
+        * @var string
+        */
+       protected $status;
+
+       /**
+        * @var integer
+        * @validate Integer
+        */
+       protected $votes;
+
+       /**
+        * @var Tx_Extbase_Persistence_ObjectStorage<Tx_Questionrating_Domain_Model_Reviewcomment>
+        * @lazy
+        */
+       protected $reviewcomments;
+
+       /**
+       * @return
+       */
+       public function __construct() {
+               $this->reviewcomments = new Tx_Extbase_Persistence_ObjectStorage();
+               $this->votes = 0;
+               // $this->status = 'technical';
+       }
+
+       /**
+        * @return string
+        */
+       public function getXmlId() {
+               return $this->xmlId;
+       }
+
+       /**
+        * @param string $xml_id
+        * @return void
+        */
+       public function setXmlId($xml_id) {
+               $this->xmlId = $xml_id;
+       }
+
+       /**
+        * @return string
+        */
+       public function getHeadline() {
+               return $this->headline;
+       }
+
+       /**
+        * @param string $headline
+        * @return void
+        */
+       public function setHeadline($headline) {
+               $this->headline = $headline;
+       }
+
+       /**
+        * @return string
+        */
+       public function getStatus() {
+               return $this->status;
+       }
+
+       /**
+        * @param string $status
+        * @return void
+        */
+       public function setStatus($status) {
+               $this->status = $status;
+       }
+
+       /**
+        * @return integer
+        */
+       public function getVotes() {
+               return $this->votes;
+       }
+
+       /**
+        * @param integer $votes
+        * @return void
+        */
+       public function setVotes($votes) {
+               $this->votes = $votes;
+       }
+
+       /**
+        * @return Tx_Extbase_Persistence_ObjectStorage
+        */
+       public function getReviewcomments() {
+               return $this->reviewcomments;
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Reviewcomment $reviewcomment
+        * @return void
+        */
+       public function addReviewcomment(Tx_Questionrating_Domain_Model_Reviewcomment $reviewcomment) {
+               $this->reviewcomments->attach($reviewcomment);
+       }
+
+       /**
+        * @param Tx_Extbase_Persistence_ObjectStorage $reviewcomments
+        * @return void
+        */
+       public function setReviewcomments(Tx_Extbase_Persistence_ObjectStorage $reviewcomments) {
+               $this->reviewcomments = $reviewcomments;
+       }
+
+
+}
\ No newline at end of file
diff --git a/Classes/Domain/Model/Reviewcomment.php b/Classes/Domain/Model/Reviewcomment.php
new file mode 100644 (file)
index 0000000..f0dcffc
--- /dev/null
@@ -0,0 +1,119 @@
+<?php
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 <>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ *
+ * @scope prototype
+ * @entity
+ */
+class Tx_Questionrating_Domain_Model_Reviewcomment extends Tx_Extbase_DomainObject_AbstractEntity {
+
+       /**
+        * @var DateTime
+        */
+       protected $crdate;
+
+       /**
+        * @var string
+        */
+       protected $message;
+
+       /**
+        * @var Tx_Questionrating_Domain_Model_Review
+        * @lazy
+        */
+       protected $review;
+
+       /**
+        * @var Tx_Extbase_Domain_Model_FrontendUser
+        */
+       protected $user;
+
+       public function __construct() {
+               $this->crdate = $GLOBALS['EXEC_TIME'];
+       }
+
+       /**
+        * @param DateTime $crdate
+        * @return void
+        */
+       public function setCrdate(DateTime $crdate) {
+               $this->crdate = $crdate;
+       }
+
+       /**
+        * @return DateTime
+        */
+       public function getCrdate() {
+               return $this->crdate;
+       }
+
+
+       /**
+        * @return string
+        */
+       public function getMessage() {
+               return $this->message;
+       }
+
+       /**
+        * @param string $message
+        * @return void
+        */
+       public function setMessage($message) {
+               $this->message = $message;
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Review $review
+        * @return void
+        */
+       public function setReview(Tx_Questionrating_Domain_Model_Review $review) {
+               $this->review = $review;
+       }
+
+       /**
+        * @return Tx_Questionrating_Domain_Model_Review
+        */
+       public function getReview() {
+               return $this->review;
+       }
+
+       /**
+        * @param Tx_Extbase_Domain_Model_FrontendUser $user
+        * @return void
+        */
+       public function setUser(Tx_Extbase_Domain_Model_FrontendUser $user) {
+               $this->user = $user;
+       }
+
+       /**
+        * @return Tx_Extbase_Domain_Model_FrontendUser
+        */
+       public function getUser() {
+               return $this->user;
+       }
+
+}
\ No newline at end of file
diff --git a/Classes/Domain/Repository/DiscussionRepository.php b/Classes/Domain/Repository/DiscussionRepository.php
new file mode 100644 (file)
index 0000000..68b353c
--- /dev/null
@@ -0,0 +1,142 @@
+<?php
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * A repository for Discussion
+ */
+class Tx_Questionrating_Domain_Repository_DiscussionRepository extends Tx_Extbase_Persistence_Repository {
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @param Tx_Extbase_Domain_Model_FrontendUser $user
+        * @return mixed Tx_Questionrating_Domain_Model_Discussion
+        */
+       public function findByQuestionAndFromUser(Tx_Questionrating_Domain_Model_Question $question, Tx_Extbase_Domain_Model_FrontendUser $user) {
+               $query = $this->createQuery();
+               $result = $query->matching(
+                               $query->logicalAnd(
+                                       $query->equals('question', $question),
+                                       $query->equals('from_user', $user)
+                               )
+                       )->execute();
+               return $result;
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @param Tx_Extbase_Domain_Model_FrontendUser $user
+        * @return mixed Tx_Questionrating_Domain_Model_Discussion
+        */
+       public function findByQuestionAndToUser(Tx_Questionrating_Domain_Model_Question $question, Tx_Extbase_Domain_Model_FrontendUser $user) {
+               $query = $this->createQuery();
+               $result = $query->matching(
+                               $query->logicalAnd(
+                                       $query->equals('question', $question),
+                                       $query->equals('to_user', $user)
+                               )
+                       )->execute();
+               return $result;
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @param string $route
+        * @param array $userUidArray
+        * @param integer $getLeader
+        * @return mixed Tx_Questionrating_Domain_Model_Discussion
+        */
+       public function findByQuestionAndFilter(Tx_Questionrating_Domain_Model_Question $question, $route, $userUidArray, $getLeader = 0) {
+               $query = $this->createQuery();
+               $userQuery = NULL;
+
+                       // @todo find a cleaner solution
+               switch($route) {
+                       case 'to':
+                               if($getLeader) {
+                                       $userQuery = $query->logicalOr(
+                                               $query->equals('to_user', $userUidArray),
+                                               $query->equals('to_leader', $getLeader)
+                                       );
+                               }
+                               else {
+                                       $userQuery = $query->logicalAnd(
+                                               $query->equals('to_user', $userUidArray),
+                                               $query->equals('to_leader', $getLeader)
+                                       );
+                               }
+                               break;
+                       case 'from':
+                               if($getLeader) {
+                                       $userQuery = $query->logicalOr(
+                                               $query->equals('from_user', $userUidArray),
+                                               $query->equals('from_leader', $getLeader)
+                                       );
+                               }
+                               else {
+                                       $userQuery = $query->logicalAnd(
+                                               $query->equals('from_user', $userUidArray),
+                                               $query->equals('from_leader', $getLeader)
+                                       );
+                               }
+                               break;
+                       default :
+                               $userQuery = $query->logicalOr(
+                                       $query->equals('to_user', $userUidArray),
+                                       $query->equals('from_user', $userUidArray)
+                               );
+
+                               if($getLeader) {
+                                       $leaderQuery = $query->logicalOr(
+                                               $query->equals('to_leader', $getLeader),
+                                               $query->equals('from_leader', $getLeader)
+                                       );
+                                       $userQuery = $query->logicalOr($userQuery, $leaderQuery);
+                               }
+                               else {
+                                       // form_user = 0 OR to_user = 0 AND (to_user = 0 AND to_leader = 0 OR from_user = 0 AND from_leader = 0)
+                                       $toleaderQuery = $query->logicalAnd(
+                                               $query->equals('to_user', $userUidArray),
+                                               $query->equals('to_leader', $getLeader)
+                                       );
+                                       $fromleaderQuery = $query->logicalAnd(
+                                               $query->equals('from_user', $userUidArray),
+                                               $query->equals('from_leader', $getLeader)
+                                       );
+                                       $leaderQuery = $query->logicalOr($toleaderQuery, $fromleaderQuery);
+                                       $userQuery = $query->logicalAnd($userQuery, $leaderQuery);
+                               }
+                               break;
+               }
+
+               $result = $query->matching(
+                       $query->logicalAnd(
+                               $userQuery,
+                               $query->equals('question', $question)
+                       )
+               )->execute();
+
+               return $result;
+       }
+}
diff --git a/Classes/Domain/Repository/QuestionRepository.php b/Classes/Domain/Repository/QuestionRepository.php
new file mode 100644 (file)
index 0000000..eb13a87
--- /dev/null
@@ -0,0 +1,99 @@
+<?php
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * A repository for Question
+ */
+class Tx_Questionrating_Domain_Repository_QuestionRepository extends Tx_Extbase_Persistence_Repository {
+
+       /**
+        * @return mixed
+        */
+       public function findByStatusFinalOrReview() {
+               $query = $this->createQuery();
+               $result = $query->matching(
+                               $query->logicalAnd(
+                                       $query->logicalOr(
+                                               $query->equals('status', 'final'),
+                                               $query->equals('status', 'review')
+                                       ),
+                                       $query->equals('active', '1')
+                               )
+                       )->execute();
+               return $result;
+       }
+
+       /**
+        * @param string $status
+        * @return mixed
+        */
+       public function findByStatusAndIsActive($status) {
+               $query = $this->createQuery();
+               $result = $query->matching(
+                               $query->logicalAnd(
+                                       $query->equals('status', $status),
+                                       $query->equals('active', '1')
+                               )
+                       )->execute();
+               return $result;
+       }
+
+       /**
+        * @param string $status
+        * @param Tx_Extbase_Domain_Model_FrontendUser $user
+        */
+       public function findByStatusAndUser($status, Tx_Extbase_Domain_Model_FrontendUser $user) {
+               $query = $this->createQuery();
+               $result = $query->statement('SELECT question.* FROM ' .
+                                                                                       'tx_questionrating_domain_model_question as question, ' .
+                                                                                       'tx_questionrating_domain_model_rating as rating ' .
+                                                                                       'WHERE ' .
+                                                                                       'question.status = "' . $status . '" AND ' .
+                                                                                       'question.active = 1 AND ' .
+                                                                                       'question.uid = rating.question AND ' .
+                                                                                       'rating.user = ' . $user->getUid()
+                                                                       )->execute();
+               return $result;
+       }
+
+       /**
+        * @param Tx_Extbase_Domain_Model_FrontendUser $user
+        */
+       public function findByStatusFinalOrReviewAndUser(Tx_Extbase_Domain_Model_FrontendUser $user) {
+               $query = $this->createQuery();
+               $result = $query->statement('SELECT question.* FROM ' .
+                                                                                       'tx_questionrating_domain_model_question as question, ' .
+                                                                                       'tx_questionrating_domain_model_rating as rating ' .
+                                                                                       'WHERE ' .
+                                                                                       '(question.status = "final" OR ' .
+                                                                                       'question.status = "review") AND ' .
+                                                                                       'question.active = 1 AND ' .
+                                                                                       'question.uid = rating.question AND ' .
+                                                                                       'rating.user = ' . $user->getUid()
+                                                                       )->execute();
+               return $result;
+       }
+
+}
\ No newline at end of file
diff --git a/Classes/Domain/Repository/RatingRepository.php b/Classes/Domain/Repository/RatingRepository.php
new file mode 100644 (file)
index 0000000..782584a
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * A repository for Rating
+ */
+class Tx_Questionrating_Domain_Repository_RatingRepository extends Tx_Extbase_Persistence_Repository {
+       
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @param Tx_Extbase_Domain_Model_FrontendUser $user
+        * @return mixed Tx_Questionrating_Domain_Model_Rating
+        */
+       public function findByQuestionAndUser(Tx_Questionrating_Domain_Model_Question $question, 
+               Tx_Extbase_Domain_Model_FrontendUser $user) {
+               $query = $this->createQuery();
+               $result = $query->matching(
+                               $query->logicalAnd(
+                                       $query->equals('question', $question),
+                                       $query->equals('user', $user)
+                               )
+                       )->execute();
+               return $result[0];
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @return integer
+        */     
+       public function countFinalRatingByQuestion(Tx_Questionrating_Domain_Model_Question $question) {
+               $query = $this->createQuery();
+               $result = $query->matching(
+                               $query->logicalAnd(
+                                       $query->equals('question',$question),
+                                       $query->equals('final_rating', '1')
+                               )
+                       )->execute();
+               return count($result);
+       }
+}
\ No newline at end of file
diff --git a/Classes/Domain/Repository/ReviewRepository.php b/Classes/Domain/Repository/ReviewRepository.php
new file mode 100644 (file)
index 0000000..c9efb28
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * A repository for Review
+ */
+class Tx_Questionrating_Domain_Repository_ReviewRepository extends Tx_Extbase_Persistence_Repository {
+
+
+}
\ No newline at end of file
diff --git a/Classes/Domain/Repository/ReviewcommentRepository.php b/Classes/Domain/Repository/ReviewcommentRepository.php
new file mode 100644 (file)
index 0000000..fce5a7a
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * A repository for Reviewcomment
+ */
+class Tx_Questionrating_Domain_Repository_ReviewcommentRepository extends Tx_Extbase_Persistence_Repository {
+
+
+}
\ No newline at end of file
diff --git a/Classes/Utils/Repository/XmlitemRepository.php b/Classes/Utils/Repository/XmlitemRepository.php
new file mode 100644 (file)
index 0000000..70c6cc0
--- /dev/null
@@ -0,0 +1,125 @@
+<?php
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 <>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+class Tx_Questionrating_Utils_Repository_XmlitemRepository {
+
+       /**
+        * @var string
+        */
+       protected $uploadFolder;
+
+       /**
+        * @var array
+        */
+       protected $findAllResultCache = NULL;
+
+       public function __construct() {
+               $this->setUploadFolder('import/');
+               $this->setOutputFolder('rated/');
+       }
+
+       public function findByStatus($status) {
+               $result = array();
+               $findAllResult = $this->findAll();
+               foreach ($findAllResult as $current) {
+                       if ($current->getStatus() == $status) {
+                               $result[] = $current;
+                       }
+               }
+               return $result;
+       }
+
+       public function findById($id) {
+               $result = array();
+               $findAllResult = $this->findAll();
+               foreach ($findAllResult as $current) {
+                       if ($current->getId() == $id) {
+                               $result[] = $current;
+                       }
+               }
+               return count($result) == 1 ? $result[0] : NULL;
+       }
+
+
+       public function findAll() {
+               if ($this->findAllResultCache === NULL)  {
+                       $questionRepository = t3lib_div::makeInstance('Tx_Questionrating_Domain_Repository_QuestionRepository');
+                       $xmlFiles = $this->getXmlFiles();
+                       $result = array();
+                       foreach ($xmlFiles as $currentFile) {
+                               $xmlitem = t3lib_div::makeInstance('Tx_Questionrating_Utils_Xmlitem');
+                               $xmlitem->loadXml($this->uploadFolder, $currentFile);
+                               $question = $questionRepository->findByXmlId($xmlitem->getId());
+                               if (!empty($question)) {
+                                       $xmlitem->setInDb(1);
+                               } else {
+                                       $xmlitem->setInDb(0);
+                               }
+                               $result[] = $xmlitem;
+                       }
+                       $this->findAllResultCache = $result;
+               } else {
+                       $result = $this->findAllResultCache;
+               }
+               return $result;
+       }
+
+       public function update(Tx_Questionrating_Utils_Xmlitem $xmlitem) {
+               file_put_contents($xmlitem->getPathFilename(), $xmlitem->getXml()->asXML());
+       }
+
+       public function moveToOutputDir(Tx_Questionrating_Utils_Xmlitem $xmlitem) {
+               rename($xmlitem->getPathFilename(), $this->outputFolder . $xmlitem->getFilename());
+               $xmlitem->setPath($this->outputFolder);
+       }
+
+       protected function getXmlFiles() {
+               $xmlFiles = array();
+               $filesInUploaddir = scandir($this->uploadFolder);
+               foreach ($filesInUploaddir as $currentFile) {
+                       if (strtolower(pathinfo($currentFile, PATHINFO_EXTENSION)) === 'xml') {
+                               $xmlFiles[] = $currentFile;
+                       }
+               }
+               return $xmlFiles;
+       }
+
+       public function setUploadFolder($folder) {
+               $this->uploadFolder = t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT') . '/uploads/tx_questionrating/' . $folder;
+               $this->createDir($this->uploadFolder);
+       }
+
+       public function setOutputFolder($folder) {
+               $this->outputFolder = t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT') . '/uploads/tx_questionrating/' . $folder;
+               $this->createDir($this->outputFolder);
+       }
+
+       protected function createDir($dir) {
+               if (!is_dir($dir))
+                       t3lib_div::mkdir($dir);
+       }
+
+}
diff --git a/Classes/Utils/Session.php b/Classes/Utils/Session.php
new file mode 100644 (file)
index 0000000..1dad9e0
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 <>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+class Tx_Questionrating_Utils_Session {
+
+       /**
+        * @var string
+        */
+       protected $sessionPrefix = 'Questionrating';
+
+       /**
+        * @var array
+        */
+       protected $sessionData = 'Questionrating';      
+
+       /**
+        * @return void
+        */
+       public function __construct() {
+               $this->sessionData = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->sessionPrefix);
+       }
+
+       /**
+        * @param string $key
+        * @param string $value
+        * @return void
+        */
+       public function set($key,$value) {
+               $this->sessionData[$key] = $value;
+               $GLOBALS['TSFE']->fe_user->setKey('ses', $this->sessionPrefix, $this->sessionData);
+               $GLOBALS['TSFE']->storeSessionData();
+       }
+
+       /**
+        * @param string $key
+        * @return array session-data entry
+        */
+       public function get($key) {
+               return $this->sessionData[$key];
+       }
+
+}
\ No newline at end of file
diff --git a/Classes/Utils/Xmlitem.php b/Classes/Utils/Xmlitem.php
new file mode 100644 (file)
index 0000000..b75416a
--- /dev/null
@@ -0,0 +1,293 @@
+<?php
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 <>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+class Tx_Questionrating_Utils_Xmlitem {
+
+       /**
+        * @var string
+        */
+       protected $id;
+
+       /**
+        * @var string
+        */
+       protected $questiontext;
+
+       /**
+        * @var string
+        */
+       protected $author;
+
+       /**
+        * @var string
+        */
+       protected $status;
+
+       /**
+        * @var array
+        */
+       protected $answers;
+
+       /**
+        * @var integer
+        */
+       protected $inDb;
+
+       /**
+        * @var integer
+        */
+       protected $rating = NULL;
+
+       /**
+        * @var SimpleXMLElement
+        */
+       protected $xml;
+
+       /**
+        * @var string
+        */
+       protected $filename;
+
+       /**
+        * @var string
+        */
+       protected $path;
+
+       /**
+        * @param string $filename
+        */
+       public function loadXml($path, $filename) {
+               $this->filename = $filename;
+               $this->path = $path;
+               $this->xml = simplexml_load_file($path . $filename);
+
+                       // break if xml can't be read
+                       // should never happen :-)
+               if (!is_object($this->xml)) {
+                       echo 'error reading XML File';
+                       var_dump($this);
+                       die();
+               }
+
+               $this->id = (string)$this->xml['id'];
+               $this->questiontext = $this->getTextandCode($this->xml->question);
+               $this->author = (string)$this->xml['author'];
+               $this->status = (string)$this->xml['status'];
+               $this->answers = array();
+               foreach ($this->xml->answers->option as $answer) {
+                       $currentAnswer = array();
+                       $currentAnswer['text'] = $this->getTextandCode($answer);
+                       $currentAnswer['correct'] = ($answer['correct'] === 'true');
+                       $this->answers[] = $currentAnswer;
+               }
+       }
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        *
+        */
+       public function updateByQuestion(Tx_Questionrating_Domain_Model_Question $question) {
+               $this->setQuestiontext($question->getQuestiontext());
+               unset($this->xml->answers->option);
+               $correctanswer = $question->getCorrectanswer();
+               if (empty($correctanswer[0])) {
+                       $tempQuestion = t3lib_div::makeInstance('Tx_Questionrating_Domain_Model_Question');
+                       $tempQuestion->importXmlitem($this);
+                       $correctanswer = $tempQuestion->getCorrectanswer();
+               }
+               $this->answers = array();
+               foreach ($question->getAnswers() as $id => $answer) {
+                       $currentAnswer = array();
+                       $currentAnswer['text'] = $answer;
+                       $option = $this->xml->answers->addChild('option');
+                       if (in_array($id, $correctanswer)) {
+                               $option->addAttribute('correct', 'true');
+                               $currentAnswer['correct'] = TRUE;
+                       } else {
+                               $option->addAttribute('correct', 'false');
+                               $currentAnswer['correct'] = FALSE;
+                       }
+                       $this->setTextandCode($option, $answer);
+                       $this->answers[] = $currentAnswer;
+               }
+       }
+
+       /**
+        * @param SimpleXMLElement $xml
+        * @return string
+        */
+       protected function getTextandCode(SimpleXMLElement $xml) {
+               $returnValue = (string)$xml;
+               foreach ($xml->code as $code) {
+                       $returnValue .= '<code>' . (string)$code . '</code>';
+               }
+
+               return $returnValue;
+       }
+
+       /**
+        * @param SimpleXMLElement $xml
+        * @param string $text
+        */
+       protected function setTextandCode(SimpleXMLElement $xml, $text) {
+               preg_match_all('/<code>(.*)<\/code>/iUs', $text, $codeTextArray);
+               $xml[0] = preg_replace('/<code>(.*)<\/code>/iUs', '', $text);
+               if (!empty($codeTextArray)) {
+                       foreach ($codeTextArray[1] as $codeText) {
+                               $this->addCData($xml->addChild('code'), $codeText);
+                       }
+               }
+       }
+
+       /**
+        * @return string
+        */
+       public function getId() {
+               return $this->id;
+       }
+
+       /**
+        * @return string
+        */
+       public function getQuestiontext() {
+               return $this->questiontext;
+       }
+
+       /**
+        * @param string $questiontext
+        * @return void
+        */
+       public function setQuestiontext($questiontext) {
+               $this->questiontext = $questiontext;
+               $this->setTextandCode($this->xml->question, $questiontext);
+       }
+
+       /**
+        * @return string
+        */
+       public function getAuthor() {
+               return $this->author;
+       }
+
+       /**
+        * @return string
+        */
+       public function getStatus() {
+               return $this->status;
+       }
+
+       /**
+        * @param string $status
+        * @return void
+        */
+       public function setStatus($status) {
+               $this->status = $status;
+               $this->xml['status'] = $status;
+       }
+
+       /**
+        * @return array
+        */
+       public function getAnswers() {
+               return $this->answers;
+       }
+
+       /**
+        * @return string
+        */
+       public function getRating() {
+               return $this->rating;
+       }
+
+       /**
+        * @param string $rating
+        * @return void
+        */
+       public function setRating($rating) {
+               $this->rating = $rating;
+               $this->xml['rating'] = $rating;
+       }
+
+       /**
+        * @return string
+        */
+       public function getFilename() {
+               return $this->filename;
+       }
+
+       /**
+        * @return string
+        */
+       public function getPath() {
+               return $this->path;
+       }
+
+       /**
+        * @param string $rating
+        * @return void
+        */
+       public function setPath($path) {
+               $this->path = $path;
+       }
+
+
+       /**
+        * @return string
+        */
+       public function getPathFilename() {
+               return $this->path . $this->filename;
+       }
+
+
+       /**
+        * @return SimpleXMLElement
+        */
+       public function getXml() {
+               return $this->xml;
+       }
+
+       /**
+        * @return integer
+        */
+       public function getInDb() {
+               return $this->inDb;
+       }
+
+       /**
+        * @param integer $inDb
+        * @return void
+        */
+       public function setInDb($inDb) {
+               $this->inDb = $inDb;
+       }
+
+       private function addCData($xml, $text) {
+               $node= dom_import_simplexml($xml);
+               $no = $node->ownerDocument;
+               $node->appendChild($no->createCDATASection($text));
+       }
+
+}
\ No newline at end of file
diff --git a/Classes/ViewHelpers/DisplayFinalRatingViewHelper.php b/Classes/ViewHelpers/DisplayFinalRatingViewHelper.php
new file mode 100644 (file)
index 0000000..efb5ec3
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+
+class Tx_Questionrating_ViewHelpers_DisplayFinalRatingViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
+
+
+       /**
+        * @param Tx_Questionrating_Domain_Model_Question $question
+        * @param Tx_Extbase_Domain_Model_FrontendUser $currentUser
+        * @return boolean
+        */
+       public function render($question, $currentUser) {
+               $displayFinalRating = TRUE;
+               foreach($question->getRatings() as $rating) {
+                       if($rating->getUser() == $currentUser && !$rating->getFinalRating()) {
+                               $displayFinalRating = FALSE;
+                       }
+               }
+               return $displayFinalRating;
+       }
+}
\ No newline at end of file
diff --git a/Classes/ViewHelpers/DisplayTextAndCodeViewHelper.php b/Classes/ViewHelpers/DisplayTextAndCodeViewHelper.php
new file mode 100644 (file)
index 0000000..5d53e99
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+
+class Tx_Questionrating_ViewHelpers_DisplayTextAndCodeViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
+
+
+       /**
+        * @return string
+        */
+       public function render() {
+               $output = '';
+               $content = $this->renderChildren();
+               $codeOpenTags = explode('&lt;code&gt;', $content);
+               $output .= $this->normalText($codeOpenTags[0]);
+               unset($codeOpenTags[0]);
+               foreach ($codeOpenTags as $codeOpenTag) {
+                       $parts = explode('&lt;/code&gt;', $codeOpenTag);
+                       if (count($parts) == 1) {
+                               $output .= $this->normalText($parts[0]);
+                       } else {
+                               $output .= $this->codeText($parts[0]);
+                               $output .= $this->normalText($parts[1]);
+                       }
+               }
+               return $output;
+       }
+
+       /**
+        * @param string $text
+        * @return string
+        */
+       protected function normalText($text) {
+               return nl2br($text);
+       }
+
+       /**
+        * @param string $text
+        * @return string
+        */
+       protected function codeText($text) {
+               return '<pre>' . $text . '</pre>';
+       }
+
+}
\ No newline at end of file
diff --git a/Classes/ViewHelpers/ForViewHelper.php b/Classes/ViewHelpers/ForViewHelper.php
new file mode 100644 (file)
index 0000000..5ef56d9
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+
+class Tx_Questionrating_ViewHelpers_ForViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
+
+       /**
+       * @param integer $start The searched value
+       * @param integer $until The array
+       * @param string $as
+       * @param array $array
+       * @param string $arrayValue
+       *
+       * @return string
+       */
+       public function render($start, $until, $as = null, $array = null, $arrayValue = null) {
+               $returnValue = '';
+               if (is_object($array)) {
+                       if (!$array instanceof Traversable) {
+                               throw new Tx_Fluid_Core_ViewHelper_Exception('ForViewHelper only supports arrays and objects implementing Traversable interface' , 1248728393);
+                       }
+                       $array = $this->convertToArray($array);
+               }
+               for($i = (int)$start; $i<(int)$until; $i++) {
+                       if ($array !== null && $arrayValue !== null && count($array) > $i) {
+                               $this->templateVariableContainer->add($arrayValue, $array[$i]);
+                       } elseif($arrayValue !== null) {
+                               $this->templateVariableContainer->add($arrayValue, null);
+                       }
+                       if($as !== null) {
+                               $this->templateVariableContainer->add($as, $i);
+                       }
+
+                       $returnValue .= $this->renderChildren();
+
+                       if ($arrayValue !== null) {
+                               $this->templateVariableContainer->remove($arrayValue);
+                       }
+                       if ($as !== null) {
+                               $this->templateVariableContainer->remove($as);
+                       }
+               }
+               return $returnValue;
+       }
+
+
+        /**
+        * copied from class Tx_Fluid_ViewHelpers_ForViewHelper
+        *
+        * Turns the given object into an array.
+        * The object has to implement the Traversable interface
+        *
+        * @param Traversable $object The object to be turned into an array. If the object implements Iterator the key will be preserved.
+        * @return array The resulting array
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       protected function convertToArray(Traversable $object) {
+               $array = array();
+               foreach ($object as $keyValue => $singleElement) {
+                       // $array[$keyValue] = $singleElement;
+                       $array[] = $singleElement;
+               }
+               return $array;
+       }
+
+}
\ No newline at end of file
diff --git a/Classes/ViewHelpers/ForeachViewHelper.php b/Classes/ViewHelpers/ForeachViewHelper.php
new file mode 100644 (file)
index 0000000..5ee4a3f
--- /dev/null
@@ -0,0 +1,146 @@
+<?php
+
+/*                                                                        *
+ * This script belongs to the FLOW3 package "Fluid".                      *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License as published by the *
+ * Free Software Foundation, either version 3 of the License, or (at your *
+ * option) any later version.                                             *
+ *                                                                        *
+ * This script is distributed in the hope that it will be useful, but     *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
+ * General Public License for more details.                               *
+ *                                                                        *
+ * You should have received a copy of the GNU Lesser General Public       *
+ * License along with the script.                                         *
+ * If not, see http://www.gnu.org/licenses/lgpl.html                      *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+
+/**
+ * Loop view helper which can be used to interate over array.
+ * Implements what a basic foreach()-PHP-method does.
+ *
+ * = Examples =
+ *
+ * <code title="Simple Loop">
+ * <f:for each="{0:1, 1:2, 2:3, 3:4}" as="foo">{foo}</f:for>
+ * </code>
+ * <output>
+ * 1234
+ * </output>
+ *
+ * <code title="Output array key">
+ * <ul>
+ *   <f:for each="{fruit1: 'apple', fruit2: 'pear', fruit3: 'banana', fruit4: 'cherry'}" as="fruit" key="label">
+ *     <li>{label}: {fruit}</li>
+ *   </f:for>
+ * </ul>
+ * </code>
+ * <output>
+ * <ul>
+ *   <li>fruit1: apple</li>
+ *   <li>fruit2: pear</li>
+ *   <li>fruit3: banana</li>
+ *   <li>fruit4: cherry</li>
+ * </ul>
+ * </output>
+ *
+ * @version $Id: ForViewHelper.php 1734 2009-11-25 21:53:57Z stucki $
+ * @package Fluid
+ * @subpackage ViewHelpers
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @api
+ * @scope prototype
+ */
+// copied from core and aplly patch http://forge.typo3.org/issues/show/6459
+class Tx_Questionrating_ViewHelpers_ForeachViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
+
+       /**
+        * Iterates through elements of $each and renders child nodes
+        *
+        * @param array $each The array or SplObjectStorage to iterated over
+        * @param string $as The name of the iteration variable
+        * @param string $key The name of the variable to store the current array key
+        * @param string $loop Special Var to contain useful Information about the For lifecylce
+        * @param boolean $reverse If enabled, the iterator will start with the last element and proceed reversely
+        * @return string Rendered string
+        * @author Sebastian Kurf├╝rst <sebastian@typo3.org>
+        * @author Bastian Waidelich <bastian@typo3.org>
+        * @author Robert Lemke <robert@typo3.org>
+        * @api
+        */
+       public function render($each, $as, $key = '', $loop = '', $reverse = FALSE) {
+               $output = '';
+               if ($each === NULL) {
+                       return '';
+               }
+               if (is_object($each)) {
+                       if (!$each instanceof Traversable) {
+                               throw new Tx_Fluid_Core_ViewHelper_Exception('ForViewHelper only supports arrays and objects implementing Traversable interface' , 1248728393);
+                       }
+                       $each = $this->convertToArray($each);
+               }
+
+               if ($reverse === TRUE) {
+                       $each = array_reverse($each);
+               }
+
+               $output = '';
+               if ($loop !== ''){
+                       $loop = array(
+                               'first'         => TRUE,
+                               'last'          => FALSE,
+                               'current'       => 1,
+                               'odd'           => TRUE,
+                               'even'          => FALSE,
+                               'length'        => count($each)
+                       );
+               }
+               foreach ($each as $keyValue => $singleElement) {
+                       if($loop !== '')
+                               $this->templateVariableContainer->add("loop", $loop);
+
+                       $this->templateVariableContainer->add($as, $singleElement);
+                       if ($key !== '') {
+                               $this->templateVariableContainer->add($key, $keyValue);
+                       }
+                       $output .= $this->renderChildren();
+                       $this->templateVariableContainer->remove($as);
+                       if ($key !== '') {
+                               $this->templateVariableContainer->remove($key);
+                       }
+
+                       if($loop !== ''){
+                               $this->templateVariableContainer->remove("loop");
+                               $loop['current']++;
+                               $loop['first'] = FALSE;
+                               $loop['last'] = $loop['current'] == $loop["length"] ? TRUE : FALSE;
+                               $loop['odd'] = ($loop['current'] % 2)>0 ? TRUE : FALSE;
+                               $loop['even'] = ($loop['current'] % 2)>0 ? FALSE : TRUE;
+                       }
+               }
+               return $output;
+       }
+
+       /**
+        * Turns the given object into an array.
+        * The object has to implement the Traversable interface
+        *
+        * @param Traversable $object The object to be turned into an array. If the object implements Iterator the key will be preserved.
+        * @return array The resulting array
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       protected function convertToArray(Traversable $object) {
+               $array = array();
+               foreach ($object as $keyValue => $singleElement) {
+                       $array[$keyValue] = $singleElement;
+               }
+               return $array;
+       }
+}
+
+?>
\ No newline at end of file
diff --git a/Classes/ViewHelpers/ImplodeViewHelper.php b/Classes/ViewHelpers/ImplodeViewHelper.php
new file mode 100644 (file)
index 0000000..c633fc3
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+
+class Tx_Questionrating_ViewHelpers_ImplodeViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
+
+
+       /**
+        * @param array $array
+        * @param string $glue
+        * @return string
+        */
+       public function render($array, $glue = ',') {
+               return implode($glue, $array);
+       }
+}
\ No newline at end of file
diff --git a/Classes/ViewHelpers/InArrayViewHelper.php b/Classes/ViewHelpers/InArrayViewHelper.php
new file mode 100644 (file)
index 0000000..7862792
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+
+/*
+ * 
+ * <f:if condition="{dw:inArray(needle:'{inquiryObj.name}' array:'{testarray}')}">
+ * <f:then>
+ * JA
+ * </f:then>
+ * <f:else>
+ * NEIN
+ * </f:else>
+ * </f:if>
+ */
+
+
+class Tx_Questionrating_ViewHelpers_InArrayViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
+
+       /**
+       * @param mixed $needle The searched value
+       * @param mixed $array The array
+       * @param boolean
+       */
+       public function render($needle, $array) {
+               if (is_object($array)) {
+                       if (!$array instanceof Traversable) {
+                               throw new Tx_Fluid_Core_ViewHelper_Exception('InArrayViewHelper only supports arrays and objects implementing Traversable interface' , 1248728393);
+                       }
+                       $array = $this->convertToArray($array);
+               }
+               return in_array($needle, $array);
+       }
+       
+        /**
+        * copied from class Tx_Fluid_ViewHelpers_ForViewHelper
+        * 
+        * Turns the given object into an array.
+        * The object has to implement the Traversable interface
+        *
+        * @param Traversable $object The object to be turned into an array. If the object implements Iterator the key will be preserved.
+        * @return array The resulting array
+        * @author Bastian Waidelich <bastian@typo3.org>
+        */
+       protected function convertToArray(Traversable $object) {
+               $array = array();
+               foreach ($object as $keyValue => $singleElement) {
+                       $array[$keyValue] = $singleElement;
+               }
+               return $array;
+       }
+}
diff --git a/Configuration/FlexForms/flexform_list.xml b/Configuration/FlexForms/flexform_list.xml
new file mode 100644 (file)
index 0000000..feaf7cd
--- /dev/null
@@ -0,0 +1,25 @@
+<T3DataStructure>
+  <sheets>
+    <sDEF>
+      <ROOT>
+        <TCEforms>
+          <sheetTitle>Options</sheetTitle>
+        </TCEforms>
+        <type>array</type>
+        <el>
+          <settings.infoText>
+            <TCEforms>
+              <label>InfoText</label>
+              <config>
+                <type>text</type>
+                <cols>52</cols>
+                <rows>5</rows>
+              </config>
+              <defaultExtras>richtext[cut|copy|paste|formatblock|bold|italic|underline|left|center|right|orderedlist|unorderedlist|outdent|indent|link|image|line|chMode]:rte_transform[mode=ts_css]</defaultExtras>
+            </TCEforms>
+          </settings.infoText>
+        </el>
+      </ROOT>
+    </sDEF>
+  </sheets>
+</T3DataStructure>
\ No newline at end of file
diff --git a/Configuration/TCA/tca.php b/Configuration/TCA/tca.php
new file mode 100644 (file)
index 0000000..505abaa
--- /dev/null
@@ -0,0 +1,502 @@
+<?php
+if (!defined ('TYPO3_MODE'))   die ('Access denied.');
+
+$TCA['tx_questionrating_domain_model_question'] = array (
+       'ctrl' => $TCA['tx_questionrating_domain_model_question']['ctrl'],
+       'interface' => array (
+               'showRecordFieldList' => 'hidden,xml_id,status,active,questiontext,answer1text,answer2text,answer3text,answer4text,answer5text,answer6text,answer7text,answer8text,answer9text,answer10text,correctanswer,ratings,discussions'
+       ),
+       'feInterface' => $TCA['tx_questionrating_domain_model_question']['feInterface'],
+       'columns' => array (
+               'hidden' => array (
+                       'exclude' => 1,
+                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
+                       'config'  => array (
+                               'type'    => 'check',
+                               'default' => '0'
+                       )
+               ),
+               'xml_id' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.xml_id',
+                       'config' => array (
+                               'type' => 'input',
+                               'size' => '30',
+                               'eval' => 'trim',
+                       )
+               ),
+               'status' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.status',
+                       'config' => array (
+                               'type' => 'select',
+                               'items' => array (
+                                       array('LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.status.I.0', 'open'),
+                                       array('LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.status.I.1', 'discuss'),
+                                       array('LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.status.I.2', 'final'),
+                               ),
+                               'size' => 1,
+                               'maxitems' => 1,
+                       )
+               ),
+               'active' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.active',
+                       'config' => array (
+                               'type' => 'check',
+                               'default' => 1,
+                       )
+               ),
+               'questiontext' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.questiontext',
+                       'config' => array (
+                               'type' => 'text',
+                               'cols' => '30',
+                               'rows' => '5',
+                       )
+               ),
+               'answer1text' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.answer1text',
+                       'config' => array (
+                               'type' => 'text',
+                               'cols' => '30',
+                               'rows' => '5',
+                       )
+               ),
+               'answer2text' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.answer2text',
+                       'config' => array (
+                               'type' => 'text',
+                               'cols' => '30',
+                               'rows' => '5',
+                       )
+               ),
+               'answer3text' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.answer3text',
+                       'config' => array (
+                               'type' => 'text',
+                               'cols' => '30',
+                               'rows' => '5',
+                       )
+               ),
+               'answer4text' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.answer4text',
+                       'config' => array (
+                               'type' => 'text',
+                               'cols' => '30',
+                               'rows' => '5',
+                       )
+               ),
+               'answer5text' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.answer5text',
+                       'config' => array (
+                               'type' => 'text',
+                               'cols' => '30',
+                               'rows' => '5',
+                       )
+               ),
+               'answer6text' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.answer6text',
+                       'config' => array (
+                               'type' => 'text',
+                               'cols' => '30',
+                               'rows' => '5',
+                       )
+               ),
+               'answer7text' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.answer7text',
+                       'config' => array (
+                               'type' => 'text',
+                               'cols' => '30',
+                               'rows' => '5',
+                       )
+               ),
+               'answer8text' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.answer8text',
+                       'config' => array (
+                               'type' => 'text',
+                               'cols' => '30',
+                               'rows' => '5',
+                       )
+               ),
+               'answer9text' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.answer9text',
+                       'config' => array (
+                               'type' => 'text',
+                               'cols' => '30',
+                               'rows' => '5',
+                       )
+               ),
+               'answer10text' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.answer10text',
+                       'config' => array (
+                               'type' => 'text',
+                               'cols' => '30',
+                               'rows' => '5',
+                       )
+               ),
+               'correctanswer' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.correctanswer',
+                       'config' => array (
+                               'type' => 'input',
+                               'size' => '30',
+                               'eval' => 'trim',
+                       )
+               ),
+               'ratings' => array(
+                       'exclude' => 0,
+                       'label'   => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.ratings',
+                       'config' => array(
+                               'type' => 'inline',
+                               'foreign_table' => 'tx_questionrating_domain_model_rating',
+                               'foreign_field' => 'question',
+                               'appearance' => array(
+                                       'newRecordLinkPosition' => 'bottom',
+                                       'collapseAll' => 1,
+                                       'expandSingle' => 1,
+                               ),
+                       )
+               ),
+               'discussions' => array(
+                       'exclude' => 0,
+                       'label'   => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_question.discussions',
+                       'config' => array(
+                               'type' => 'inline',
+                               'foreign_table' => 'tx_questionrating_domain_model_discussion',
+                               'foreign_field' => 'question',
+                               'appearance' => array(
+                                       'newRecordLinkPosition' => 'bottom',
+                                       'collapseAll' => 1,
+                                       'expandSingle' => 1,
+                               ),
+                       )
+               ),
+       ),
+       'types' => array (
+               '0' => array('showitem' => 'hidden;;1;;1-1-1, xml_id, status, active, questiontext, answer1text, answer2text, answer3text, answer4text, answer5text, answer6text, answer7text, answer8text, answer9text, answer10text, correctanswer,ratings,discussions')
+       ),
+       'palettes' => array (
+               '1' => array('showitem' => '')
+       )
+);
+
+$TCA['tx_questionrating_domain_model_rating'] = array (
+       'ctrl' => $TCA['tx_questionrating_domain_model_rating']['ctrl'],
+       'interface' => array (
+               'showRecordFieldList' => 'hidden,user,question,rating_value,final_rating,final_rating_value'
+       ),
+       'feInterface' => $TCA['tx_questionrating_rating']['feInterface'],
+       'columns' => array (
+               'hidden' => array (
+                       'exclude' => 1,
+                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
+                       'config'  => array (
+                               'type'    => 'check',
+                               'default' => '0'
+                       )
+               ),
+               'user' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_rating.user',
+                       'config' => array (
+                               'type' => 'select',
+                               'foreign_table' => 'fe_users',
+                               'maxitems' => 1,
+                       )
+               ),
+               'question' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_rating.question',
+                       'config' => array (
+                               'type' => 'select',
+                               'foreign_table' => 'tx_questionrating_domain_model_question',
+                               'maxitems' => 1,
+                       )
+               ),
+               'rating_value' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_rating.rating',
+                       'config' => array (
+                               'type'     => 'input',
+                               'size'     => '4',
+                               'max'      => '4',
+                               'eval'     => 'int',
+                               'checkbox' => '0',
+                               'range'    => array (
+                                       'upper' => '1000',
+                                       'lower' => '10'
+                               ),
+                               'default' => 0
+                       )
+               ),
+               'final_rating' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_rating.final_rating',
+                       'config' => array (
+                               'type' => 'check',
+                       )
+               ),
+               'final_rating_value' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_rating.final_rating_value',
+                       'config' => array (
+                               'type'     => 'input',
+                               'size'     => '4',
+                               'max'      => '4',
+                               'eval'     => 'int',
+                               'checkbox' => '0',
+                               'range'    => array (
+                                       'upper' => '1000',
+                                       'lower' => '10'
+                               ),
+                               'default' => 0
+                       )
+               ),
+       ),
+       'types' => array (
+               '0' => array('showitem' => 'hidden;;1;;1-1-1, user, question, rating_value, final_rating, final_rating_value')
+       ),
+       'palettes' => array (
+               '1' => array('showitem' => '')
+       )
+);
+
+$TCA['tx_questionrating_domain_model_discussion'] = array (
+       'ctrl' => $TCA['tx_questionrating_domain_model_discussion']['ctrl'],
+       'interface' => array (
+               'showRecordFieldList' => 'hidden,from_user,from_leader,to_user,to_leader,question,message'
+       ),
+       'feInterface' => $TCA['tx_questionrating_domain_model_discussion']['feInterface'],
+       'columns' => array (
+               'hidden' => array (
+                       'exclude' => 1,
+                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
+                       'config'  => array (
+                               'type'    => 'check',
+                               'default' => '0'
+                       )
+               ),
+               'from_user' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_discussion.from_user',
+                       'config' => array (
+                               'type' => 'select',
+                               'foreign_table' => 'fe_users',
+                               'maxitems' => 1,
+                       )
+               ),
+               'from_leader' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_discussion.from_leader',
+                       'config' => array (
+                               'type' => 'check',
+                       )
+               ),
+               'to_user' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_discussion.to_user',
+                       'config' => array (
+                               'type' => 'select',
+                               'foreign_table' => 'fe_users',
+                               'maxitems' => 1,
+                       )
+               ),
+               'to_leader' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_discussion.to_leader',
+                       'config' => array (
+                               'type' => 'check',
+                       )
+               ),
+               'question' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_discussion.question',
+                       'config' => array (
+                               'type' => 'select',
+                               'foreign_table' => 'tx_questionrating_domain_model_question',
+                               'maxitems' => 1,
+                       )
+               ),
+               'message' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_discussion.message',
+                       'config' => array (
+                               'type' => 'text',
+                               'cols' => '30',
+                               'rows' => '5',
+                       )
+               ),
+       'crdate' => array (
+               'exclude' => 1,
+               'label' => 'Creation date',
+               'config' => array (
+                       'type' => 'none',
+                       'format' => 'date',
+                       'eval' => 'date',
+
+               )
+                       ),
+       ),
+       'types' => array (
+               '0' => array('showitem' => 'hidden;;1;;1-1-1, from_user, from_leader, to_user,from_leader question, message')
+       ),
+       'palettes' => array (
+               '1' => array('showitem' => '')
+       )
+);
+
+$TCA['tx_questionrating_domain_model_review'] = array (
+       'ctrl' => $TCA['tx_questionrating_domain_model_review']['ctrl'],
+       'interface' => array (
+               'showRecordFieldList' => 'hidden,xml_id,headline,status,votes,reviewcomments'
+       ),
+       'feInterface' => $TCA['tx_questionrating_domain_model_review']['feInterface'],
+       'columns' => array (
+               'hidden' => array (
+                       'exclude' => 1,
+                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
+                       'config'  => array (
+                               'type'    => 'check',
+                               'default' => '0'
+                       )
+               ),
+               'xml_id' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_review.xml_id',
+                       'config' => array (
+                               'type' => 'input',
+                               'size' => '30',
+                       )
+               ),
+               'headline' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_review.headline',
+                       'config' => array (
+                               'type' => 'text',
+                               'cols' => '30',
+                               'rows' => '5',
+                       )
+               ),
+               'status' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_review.status',
+                       'config' => array (
+                               'type' => 'input',
+                               'size' => '30',
+                       )
+               ),
+               'votes' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_review.votes',
+                       'config' => array (
+                               'type'     => 'input',
+                               'size'     => '4',
+                               'max'      => '4',
+                               'eval'     => 'int',
+                               'checkbox' => '0',
+                               'range'    => array (
+                                       'upper' => '1000',
+                                       'lower' => '10'
+                               ),
+                               'default' => 0
+                       )
+               ),
+               'reviewcomments' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_review.reviewcomments',
+                                               'config' => array(
+                                                       'type' => 'inline',
+                                                       'foreign_table' => 'tx_questionrating_domain_model_reviewcomment',
+                                                       'foreign_field' => 'review',
+                                                       'appearance' => array(
+                                                               'newRecordLinkPosition' => 'bottom',
+                                                               'collapseAll' => 1,
+                                                               'expandSingle' => 1,
+                                                       ),
+                                               )
+               ),
+       ),
+       'types' => array (
+               '0' => array('showitem' => 'hidden;;1;;1-1-1, xml_id, headline, status, votes, reviewcomments')
+       ),
+       'palettes' => array (
+               '1' => array('showitem' => '')
+       )
+);
+
+
+
+$TCA['tx_questionrating_domain_model_reviewcomment'] = array (
+       'ctrl' => $TCA['tx_questionrating_domain_model_reviewcomment']['ctrl'],
+       'interface' => array (
+               'showRecordFieldList' => 'hidden,message,review,user'
+       ),
+       'feInterface' => $TCA['tx_questionrating_domain_model_reviewcomment']['feInterface'],
+       'columns' => array (
+               'hidden' => array (
+                       'exclude' => 1,
+                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
+                       'config'  => array (
+                               'type'    => 'check',
+                               'default' => '0'
+                       )
+               ),
+               'message' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_reviewcomment.message',
+                       'config' => array (
+                               'type' => 'text',
+                               'cols' => '30',
+                               'rows' => '5',
+                       )
+               ),
+               'review' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_reviewcomment.review',
+                                               'config' => array (
+                                                       'type' => 'select',
+                                                       'foreign_table' => 'tx_questionrating_domain_model_review',
+                                                       'maxitems' => 1,
+                                               )
+               ),
+               'user' => array (
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:questionrating/Resources/Private/Language/locallang_db.xml:tx_questionrating_domain_model_reviewcomment.user',
+                                               'config' => array (
+                                                       'type' => 'select',
+                                                       'foreign_table' => 'fe_users',
+                                                       'maxitems' => 1,
+                                               )
+               ),
+               'crdate' => array (
+                       'exclude' => 1,
+                       'label' => 'Creation date',
+                       'config' => array (
+                               'type' => 'none',
+                               'format' => 'date',
+                               'eval' => 'date',
+
+                       )
+               ),
+       ),
+       'types' => array (
+               '0' => array('showitem' => 'hidden;;1;;1-1-1, message, review, user')
+       ),
+       'palettes' => array (
+               '1' => array('showitem' => '')
+       )
+);
+
+?>
\ No newline at end of file
diff --git a/Configuration/TypoScript/setup.txt b/Configuration/TypoScript/setup.txt
new file mode 100644 (file)
index 0000000..accfa54
--- /dev/null
@@ -0,0 +1,14 @@
+questionrating_pi1 < ajax
+questionrating_pi1.config.additionalHeaders >
+questionrating_pi1 {  
+       typeNum = 1268404925
+       10 < tt_content.list.20.questionrating_pi1
+}
+
+plugin.tx_questionrating {
+       settings {
+               leaderGroupUid = {$plugin.tx_questionrating.leaderGroupUid}
+               technicalReviewGroupUid = {$plugin.tx_questionrating.technicalReviewGroupUid}
+               translationReviewGroupUid = {$plugin.tx_questionrating.translationReviewGroupUid}
+       }
+}
diff --git a/Resources/Private/Language/locallang.xml b/Resources/Private/Language/locallang.xml
new file mode 100644 (file)
index 0000000..2b608be
--- /dev/null
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <type>module</type>
+               <description>Language labels for plugin &quot;tx_qr_pi1&quot;</description>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="leader_label">Leader:</label>
+                       <label index="userlogin_label">Logged in as:</label>
+                       <label index="step">Step</label>
+                       <label index="rating_label">Rating:</label>
+                       <label index="rating_label_long">Rating (1=difficult ... 99=easy):</label>
+                       <label index="step_1_description">Questions which have to be rated.</label>
+                       <label index="step_2_description">Questions which are discussed.</label>
+                       <label index="step_3_description">Questions opened for the final rating.</label>
+                       <label index="step_4_description">Questions that have been exported.</label>
+                       <label index="propertyName_questiontext">Question</label>
+                       <label index="headline_id">id</label>
+                       <label index="headline_question">question</label>
+                       <label index="step_1_headline_right">sme</label>
+                       <label index="step_2_headline_right">sme</label>
+                       <label index="step_3_headline_right">final rating</label>
+                       <label index="step_4_headline_right"></label>
+               </languageKey>
+               <languageKey index="default_x" type="array">
+                       <label index="leader_label">Leader:</label>
+                       <label index="userlogin_label">Angemeldet als:</label>
+                       <label index="step">Step</label>
+                       <label index="rating_label">Rating:</label>
+                       <label index="rating_label_long">Rating (1=difficult ... 99=easy):</label>
+                       <label index="step_1_description">Fragen, die zur Bewertung offen stehen.</label>
+                       <label index="step_2_description">Fragen, die diskutiert werden.</label>
+                       <label index="step_3_description">Fragen, die zur finalen Bewertung offen stehen bzw. abgeschlossen sind.</label>
+                       <label index="step_4_description">Fragen, die exportiert wurden.</label>
+                       <label index="step_1_headline_id">id</label>
+                       <label index="step_2_headline_id">id</label>
+                       <label index="step_3_headline_id">id</label>
+                       <label index="step_4_headline_id">id</label>
+                       <label index="step_1_headline_question">question</label>
+                       <label index="step_2_headline_question">question</label>
+                       <label index="step_3_headline_question">question</label>
+                       <label index="step_4_headline_question">question</label>
+                       <label index="step_1_headline_right">sme</label>
+                       <label index="step_2_headline_right">sme</label>
+                       <label index="step_3_headline_right">final rating</label>
+                       <label index="step_4_headline_right"></label>
+               </languageKey>
+       </data>
+</T3locallang>
diff --git a/Resources/Private/Language/locallang_db.xml b/Resources/Private/Language/locallang_db.xml
new file mode 100644 (file)
index 0000000..e9a2e65
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <type>database</type>
+               <description>Language labels for database tables/fields belonging to extension 'questionrating'</description>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="tx_questionrating_domain_model_question">question</label>
+                       <label index="tx_questionrating_domain_model_question.xml_id">xml_id</label>
+                       <label index="tx_questionrating_domain_model_question.status.I.0">open</label>
+                       <label index="tx_questionrating_domain_model_question.status.I.1">discuss</label>
+                       <label index="tx_questionrating_domain_model_question.status.I.2">final</label>
+                       <label index="tx_questionrating_domain_model_question.status">status</label>
+                       <label index="tx_questionrating_domain_model_question.active">active</label>
+                       <label index="tx_questionrating_domain_model_question.questiontext">questiontext</label>
+                       <label index="tx_questionrating_domain_model_question.answer1text">answer1text</label>
+                       <label index="tx_questionrating_domain_model_question.answer2text">answer2text</label>
+                       <label index="tx_questionrating_domain_model_question.answer3text">answer3text</label>
+                       <label index="tx_questionrating_domain_model_question.answer4text">answer4text</label>
+                       <label index="tx_questionrating_domain_model_question.answer5text">answer5text</label>
+                       <label index="tx_questionrating_domain_model_question.answer6text">answer6text</label>
+                       <label index="tx_questionrating_domain_model_question.answer7text">answer7text</label>
+                       <label index="tx_questionrating_domain_model_question.answer8text">answer8text</label>
+                       <label index="tx_questionrating_domain_model_question.answer9text">answer9text</label>
+                       <label index="tx_questionrating_domain_model_question.answer10text">answer10text</label>
+                       <label index="tx_questionrating_domain_model_question.correctanswer">correctanswer</label>
+                       <label index="tx_questionrating_domain_model_question.ratings">ratings</label>
+                       <label index="tx_questionrating_domain_model_question.discussions">discussions</label>
+                       <label index="tx_questionrating_domain_model_rating">rating</label>
+                       <label index="tx_questionrating_domain_model_rating.user">user</label>
+                       <label index="tx_questionrating_domain_model_rating.question">question</label>
+                       <label index="tx_questionrating_domain_model_rating.rating">rating</label>
+                       <label index="tx_questionrating_domain_model_rating.final_rating">final_rating</label>
+                       <label index="tx_questionrating_domain_model_rating.final_rating_value">final_rating_value</label>
+                       <label index="tx_questionrating_domain_model_discussion">discussion</label>
+                       <label index="tx_questionrating_domain_model_discussion.from_user">from_user</label>
+                       <label index="tx_questionrating_domain_model_discussion.from_leader">from_leader</label>
+                       <label index="tx_questionrating_domain_model_discussion.to_user">to_user</label>
+                       <label index="tx_questionrating_domain_model_discussion.to_leader">to_leader</label>
+                       <label index="tx_questionrating_domain_model_discussion.question">question</label>
+                       <label index="tx_questionrating_domain_model_discussion.message">message</label>
+                       <label index="tx_questionrating_domain_model_review">domain_model_review</label>
+                       <label index="tx_questionrating_domain_model_review.xml_id">xml_id</label>
+                       <label index="tx_questionrating_domain_model_review.headline">headline</label>
+                       <label index="tx_questionrating_domain_model_review.status">status</label>
+                       <label index="tx_questionrating_domain_model_review.votes">votes</label>
+                       <label index="tx_questionrating_domain_model_review.reviewcomments">reviewcomments</label>
+                       <label index="tx_questionrating_domain_model_reviewcomment">domain_model_reviewcomment</label>
+                       <label index="tx_questionrating_domain_model_reviewcomment.message">message</label>
+                       <label index="tx_questionrating_domain_model_reviewcomment.review">review</label>
+                       <label index="tx_questionrating_domain_model_reviewcomment.user">user</label>
+                       <label index="tt_content.list_type_pi1">Question Rating</label>
+                       <label index="tt_content.list_type_pi2">Question Rating Import</label>
+               </languageKey>
+       </data>
+</T3locallang>
\ No newline at end of file
diff --git a/Resources/Private/Language/locallang_mod.xml b/Resources/Private/Language/locallang_mod.xml
new file mode 100644 (file)
index 0000000..9185fae
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <type>module</type>
+               <description>Language labels for extension 'questionrating'</description>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="pi1_title">Question Rating</label>
+                       <label index="pi1_plus_wiz_description">Question Rating</label>
+                       <label index="pi2_title">Question Rating Import</label>
+                       <label index="pi2_plus_wiz_description">Question Rating Import</label>
+               </languageKey>
+       </data>
+</T3locallang>
\ No newline at end of file
diff --git a/Resources/Private/Layouts/standard.html b/Resources/Private/Layouts/standard.html
new file mode 100644 (file)
index 0000000..bca42f8
--- /dev/null
@@ -0,0 +1,5 @@
+
+
+<script type="text/javascript" src="{f:uri.resource(path: 'JavaScript/tx_questionrating_main.js')}"></script>
+
+          <f:render section="content" />
diff --git a/Resources/Private/Layouts/standard.orig.html b/Resources/Private/Layouts/standard.orig.html
new file mode 100644 (file)
index 0000000..00c663b
--- /dev/null
@@ -0,0 +1,37 @@
+
+
+<script type="text/javascript" src="{f:uri.resource(path: 'JavaScript/tx_questionrating_main.js')}"></script>
+<link href="{f:uri.resource(path: 'CSS/tx_questionrating_main.css')}" rel="stylesheet" />
+
+               <div class="main">
+                       <div class="head">
+                               <f:link.action controller="Question"><img src="{f:uri.resource(path: 'Images/logo.gif')}" /></f:link.action>
+<!--                           <f:link.action controller="Question"><f:image src="EXT:questionrating/EXT:questionrating/Resources/Images/logo.gif" alt="" /></f:link.action> -->
+                               <div class="headline">
+                                       <p class="mainheadline">Certified TYPO3 Integrator</p>
+                                       <p class="subheadline">Question-rating</p>
+                               </div>
+                               <f:if condition='{isLeader}' >
+                               <f:then>
+                                       <div class="box">
+                                               <p><f:translate key="leader_label">###LOGINLABEL###</f:translate> <b>{currentUser.username}</b></p>
+                                               <p class="small"><f:link.action additionalParams="{logintype: 'logout'}">Logout</f:link.action> <f:link.action controller="Importer">Importtool</f:link.action></p>
+                                       </div>
+                               </f:then>
+                               <f:else>
+                                       <div class="box login">
+                                               <p><f:translate key="userlogin_label">###LOGINLABEL###</f:translate> <b>{currentUser.username}</b></p>
+                                               <p class="small"><f:link.action additionalParams="{logintype: 'logout'}">Logout</f:link.action></p>
+                                       </div>
+                                       </f:else>
+                               </f:if>
+                               <div class="box">
+                                       <p class="center"><b><f:link.action controller="Question" action="info">Rating Instructions</f:link.action></b></p>
+                                       <p class="center"><b><a href="/?id=70"">Main menu</a></b></p>
+                               </div>
+
+                       </div>
+                       <div class="content">
+                                       <f:render section="content" />
+                       </div>
+               </div>
diff --git a/Resources/Private/Partials/discussion.html b/Resources/Private/Partials/discussion.html
new file mode 100644 (file)
index 0000000..243f08a
--- /dev/null
@@ -0,0 +1,66 @@
+{namespace qr = Tx_Questionrating_ViewHelpers}
+<!-- ###DISCUSSION_MAIN### start -->
+
+                               <table class="discussion" border="0" cellspacing="0" cellpadding="0">
+                                       <tr>
+                                               <th class="mainhead">Discussion</th>
+                                               <th class="small-right disable">
+                                                       <f:if condition="{allowDiscussion}">
+                                                       <f:if condition="{isLeader}">
+                                                               <input type="button" value="STOP DISCUSSION" onClick="location.href='{f:uri.action(action: 'closeDiscussion', arguments:{question: question})}'" />
+                                                       </f:if>
+                                                       </f:if>
+                                               </th>
+                                               <th class="arrow"><img onclick="toggle('discussionTable',this,'{f:uri.resource(path: 'Images/pfeil.gif')}','{f:uri.resource(path: 'Images/pfeil-close.gif')}')" id="discussionToggleArrow" src="{f:uri.resource(path: 'Images/pfeil.gif')}" /></th>
+                                       </tr>
+                               </table>
+                               <div id="discussionTable">
+                               <table class="discussion discussion-subtable" border="0" cellspacing="0" cellpadding="0">
+                                               <thead>
+                                                       <tr>
+                                                               <td colspan="2" class="filter"><b>Filter:</b>
+                                                                       <select style="width:115px;" id="route" size="1">
+                                                                               <option value="both">both</option>
+                                                                               <option value="to">to</option>
+                                                                               <option value="from">from</option>
+                                                                       </select>
+                                                                       <input type="checkbox" id="filter_0" value="0" /> ALL
+                                                                       <qr:foreach each="{question.ratings}" as="rating" loop="loop">
+                                                                               <input type="checkbox" id="filter_{loop.current}" value="{rating.user.uid}" /> {rating.user.username}
+                                                                       </qr:foreach>
+                                                                       <input type="checkbox" id="filter_7" value="-1" />  <span class="leader">{leaderGroup.title}</span> </td>
+                                                               <td class="small-right filter button"><input style="width:55px;" id="set" type="button" value="SET" /></td>
+                                                               <td class="small-right filter button"><input style="width:85px;" id="showAll" type="button" value="SHOW ALL" /></td>
+                                                       </tr>
+                                               </thead>
+                                       </table>
+                                       <div  id='messageBody'>
+                                               <f:render partial="discussionMessage" arguments="{discussions: question.discussions, leaderGroup: leaderGroup, isLeader: isLeader, currentUser: currentUser, allowDiscussion: allowDiscussion}"/>
+
+                                       </div>
+                                       <f:if condition="{allowDiscussion}">
+                                       <table class="discussion discussion-subtable" border="0" cellspacing="0" cellpadding="0">
+
+                                       <tfoot>
+                                               <tr>
+                                                       <td colspan="3" class="comment"><b>Comment to:</b> <span class="select-spacer">&#160;</span>
+                                                       <input type="radio" name="sendto" checked="checked" value="0" id="sendto_0" onclick="Questionrating.Question.plugin.changeSendto(this.value)" /> ALL
+                                                       <qr:foreach each="{question.ratings}" as="rating" loop="loop">
+                                                               <f:if condition="{rating.user} != {currentUser}">
+                                                                       <input type="radio" name="sendto" id="sendto_{rating.user.uid}" value="{rating.user.uid}" onclick="Questionrating.Question.plugin.changeSendto(this.value);" /> {rating.user.username}
+                                                               </f:if>
+                                                       </qr:foreach>
+                                                       <f:if condition="{isLeader} != 1">
+                                                               <input type="radio" name="sendto" id="sendto_-1" value="-1" onclick="Questionrating.Question.plugin.changeSendto(this.value)" /> <span class="leader">{leaderGroup.title}</span> </td>
+                                                       </f:if>
+                                               </tr>
+                                               <tr>
+                                                       <td colspan="2" class="comment-input"><input style="width:800px;" type="text" id="messageInput" size="100" /> </td>
+                                                       <td  class="comment-input small-right button"><input  style="width:70px;" type="button" value="SEND" id="send" /></td>
+                                               </tr>
+                                       </tfoot>
+                               </table>
+                               </f:if>
+                               </div>
+
+<!-- ###DISCUSSION_MAIN### end -->
\ No newline at end of file
diff --git a/Resources/Private/Partials/discussionMessage.html b/Resources/Private/Partials/discussionMessage.html
new file mode 100644 (file)
index 0000000..ed6c1e3
--- /dev/null
@@ -0,0 +1,57 @@
+{namespace qr = Tx_Questionrating_ViewHelpers}
+                                       <table class="discussion discussion-subtable" border="0" cellspacing="0" cellpadding="0">
+                                       <tbody>
+
+                                       <f:for each="{discussions}" as="discussion">
+                                               <!-- ###DISCUSSION_ROW### start -->
+                                               <tr>
+                                                       <td width="100">
+                                                               <f:if condition="{qr:inArray(needle:'{leaderGroup}' array:'{discussion.fromUser.usergroups}')}">
+                                                                       <f:then>
+                                                                       <h1  class="{f:if(condition: '{isLeader}', then: 'highlight')}">
+                                                                               {discussion.fromUser.username} ({leaderGroup.title})
+                                                                       </h1>
+                                                               </f:then>
+                                                               <f:else>
+                                                                               <h1  class="{f:if(condition: '{currentUser} == {discussion.fromUser}', then: 'highlight')}">
+                                                                                       {discussion.fromUser.username}
+                                                                               </h1>
+                                                               </f:else>
+                                                               </f:if>
+                                                                       &gt;&gt;
+                                                               <f:if condition="{discussion.toUser}">
+                                                                       <f:then>
+                                                                       <b class="{f:if(condition: '{currentUser} == {discussion.toUser}', then: 'highlight')}">
+                                                                               {discussion.toUser.username}
+                                                                       </b>
+                                                                       </f:then>
+                                                                       <f:else>
+                                                                               <f:if condition="{discussion.toLeader}">
+                                                                                       <f:then>
+                                                                                               <b class="{f:if(condition: '{isLeader}', then: 'highlight')}">
+                                                                                                       {leaderGroup.title}
+                                                                                               </b>
+                                                                                       </f:then>
+                                                                                       <f:else>
+                                                                                               <b class="">All</b>
+                                                                                       </f:else>
+                                                                               </f:if>
+                                                                       </f:else>
+                                                               </f:if>
+                                                                       <br/><f:format.date format="H:i:s">{discussion.crdate}</f:format.date></td>
+                                                       <td class="messagetext">{discussion.message}</td>
+                                                       <td class="small-right button">
+                                                       <f:if condition="{qr:inArray(needle:'{leaderGroup}' array:'{discussion.fromUser.usergroups}')}">
+                                                               <f:then>
+                                                                       <input style="width:100px;" type="button" value="REPLY" {f:if(condition: '{allowDiscussion}', then: 'onclick="Questionrating.Question.plugin.changeSendto(-1);"', else: 'disabled')} />
+                                                               </f:then>
+                                                               <f:else>
+                                                                       <input style="width:100px;" type="button" value="REPLY" {f:if(condition: '{allowDiscussion}', then: 'onclick="Questionrating.Question.plugin.changeSendto({discussion.fromUser.uid});"', else: 'disabled')} />
+                                                               </f:else>
+                                                       </f:if>
+                                                       </td>
+                                               </tr>
+                                               <!-- ###DISCUSSION_ROW### end -->
+                                       </f:for>
+                                       </tbody>
+                                       </table>
\ No newline at end of file
diff --git a/Resources/Private/Partials/questionDetail.html b/Resources/Private/Partials/questionDetail.html
new file mode 100644 (file)
index 0000000..79be206
--- /dev/null
@@ -0,0 +1,64 @@
+{namespace qr = Tx_Questionrating_ViewHelpers}
+<!-- ###QUESTION_MAIN### begin -->
+
+                               <table class="question" border="0"  cellspacing="0" cellpadding="0">
+                                       <thead>
+                                               <tr>
+                                                       <th class="mainhead"><f:translate key="headline_question">###TABLE_HEADLINE_QUESTION###</f:translate></th>
+                                                       <th class="small-right" width="75"><b>ID: {question.xmlId}</b></th>
+                                                       <th ><f:format.crop maxCharacters="30" append=" ...">{question.questionTitle}</f:format.crop></th>
+                                                       <th class="small-right"><input style="width:110px;" type="button" value="OVERVIEW" onclick="window.location.href='{f:uri.action(controller: 'Question')}'" /></th>
+                                                       <th class="arrow"><img  onclick="toggle('questionBody',this,'{f:uri.resource(path: 'Images/pfeil.gif')}','{f:uri.resource(path: 'Images/pfeil-close.gif')}');" src="{f:uri.resource(path: 'Images/pfeil.gif')}" /></th>
+                                               </tr>
+                                       </thead>
+                                       <tbody id='questionBody'>
+                                               <tr>
+                                                       <td colspan="5" class="spacer"></td>
+                                               </tr>
+                                               <tr>
+                                                       <td><b>Q:</b></td>
+                                                       <td colspan="3" class="questiontext"><qr:displayTextAndCode>{question.questiontext}</qr:displayTextAndCode></td>
+                                                       <td></td>
+                                               </tr>
+                                               <tr>
+                                                       <td><b>A:</b></td>
+                                                       <td colspan="3">
+                                                               <f:for each="{question.answers}" key="id" as="answer">
+                                                                       <!-- ###ANSWER### begin -->
+                                                                       <f:if condition="{showToggleButton}!=1">
+                                                                               <f:then>
+                                                                                       <f:if condition="{qr:inArray(needle:'{id}' array:'{question.correctanswer}')}">
+                                                                                               <f:then>
+                                                                                                       <div style="padding-bottom:1em;" class="highlight" id="answer_{id}"><qr:displayTextAndCode>({id}.) {answer}</qr:displayTextAndCode></div>
+                                                                                               </f:then>
+                                                                                               <f:else>
+                                                                                                       <div style="padding-bottom:1em;" class="" id="answer_{id}"><qr:displayTextAndCode>({id}.) {answer}</qr:displayTextAndCode></div>
+                                                                                               </f:else>
+                                                                                       </f:if>
+                                                                               </f:then>
+                                                                               <f:else>
+                                                                                       <div style="padding-bottom:1em;" class="" id="answer_{id}"><qr:displayTextAndCode>({id}.) {answer}</qr:displayTextAndCode></div>
+                                                                               </f:else>
+                                                                       </f:if>
+                                                                       <!-- ###ANSWER### end -->
+                                                               </f:for>
+                                                       </td>
+                                                       <td></td>
+                                               </tr>
+                                               <f:if condition="{showToggleButton}">
+                                               <!-- ###ANSWER_SHOW_CORRECT_BUTTON### begin -->
+                                               <tr>
+                                                       <td colspan="5" align="center"><input style="width:220px;" type="button" onclick="showHideCorrectAnswer('<qr:implode array="{question.correctanswer}" />',this)" value="SHOW CORRECT ANSWER" /></td>
+                                               </tr>
+                                               <!-- ###ANSWER_SHOW_CORRECT_BUTTON### end -->
+                                               </f:if>
+                                       </tbody>
+                                       <tfoot>
+                                               <tr>
+                                                       <td colspan="5" class="final"></td>
+                                               </tr>
+                                       </tfoot>
+                               </table>
+
+
+<!-- ###QUESTION_MAIN### end -->
diff --git a/Resources/Private/Partials/questionOverview.html b/Resources/Private/Partials/questionOverview.html
new file mode 100644 (file)
index 0000000..e6eeac9
--- /dev/null
@@ -0,0 +1,77 @@
+{namespace qr = Tx_Questionrating_ViewHelpers}
+                               <!-- ###TABLE### begin -->
+                               <table class="overview" border="0" cellspacing="0" cellpadding="0">
+                                       <thead>
+                                       <tr>
+                                               <th class="mainhead"><f:translate key="step">###STEP###</f:translate> {currentStep}</th>
+                                               <th colspan="6" class="small-right"><f:translate key="step_{currentStep}_description">###DESCRIPTION###</f:translate></th>
+                                               <th class="arrow"><img  onclick="toggle('{currentStep}',this,'{f:uri.resource(path: 'Images/pfeil.gif')}','{f:uri.resource(path: 'Images/pfeil-close.gif')}');" src="{f:uri.resource(path: 'Images/pfeil.gif')}" /></th>
+                                       </tr>
+                                       </thead>
+                                       <tbody id="{currentStep}">
+                                       <tr>
+                                               <th class="sub"><f:translate key="headline_id">###TABLE_HEADLINE_ID###</f:translate></th>
+                                               <th class="sub"><f:translate key="headline_question">###TABLE_HEADLINE_QUESTION###</f:translate></th>
+                                               <th colspan="6" class="sub"><f:translate key="step_{currentStep}_headline_right">###TABLE_HEADLINE_SME###</f:translate></th>
+                                       </tr>
+                                       <f:if condition="{currentStep} < 3">
+                                               <f:then>
+                                               <!-- ###QUESTION_ROW### begin -->
+                                               <f:for each="{questions}" as="question">
+                                                       <tr>
+                                                               <td><b>{question.xmlId}</b></td>
+                                                               <td><f:link.action action="{action}" arguments="{question: question}"><f:format.crop maxCharacters="30" append=" ...">{question.questionTitle}</f:format.crop></f:link.action></td>
+                                                               <!-- ###USER_CELL### begin -->
+                                                               <qr:for start="0" until="6" array="{question.ratings}" arrayValue="rating">
+                                                                       <f:if condition="{rating}">
+                                                                               <f:then>
+                                                                                       <td class="sme">{rating.user.username}</td>
+                                                                               </f:then>
+                                                                               <f:else>
+                                                                                               <td class="sme highlight">&#160;</td>
+                                                                               </f:else>
+                                                                       </f:if>
+                                                               </qr:for>
+                                                               <!-- ###USER_CELL### end -->
+                                                       </tr>
+                                               </f:for>
+                                               <!-- ###QUESTION_ROW### end -->
+                                               </f:then>
+                                               <f:else>
+                                                       <f:for each="{questions}" as="question">
+                                                                       <tr>
+                                                                               <td><b>{question.xmlId}</b></td>
+                                                                               <td><f:link.action action="{action}" arguments="{question: question}"><f:format.crop maxCharacters="30" append=" ...">{question.questionTitle}</f:format.crop></f:link.action></td>
+                                                                               <!-- ###USER_CELL### begin -->
+                                                                               <qr:for start="0" until="6" array="{question.ratings}" arrayValue="rating">
+                                                                                       <f:if condition="{rating.finalRating}">
+                                                                                               <f:then>
+                                                                                                       <td class="sme">
+                                                                                                               <f:if condition="{qr:displayFinalRating(question:'{question}' currentUser:'{currentUser}')}">
+                                                                                                                       <f:then>
+                                                                                                                               <b>{rating.finalRatingValue}</b>
+                                                                                                                       </f:then>
+                                                                                                                       <f:else>
+                                                                                                                                {rating.user.username}
+                                                                                                                       </f:else>
+                                                                                                               </f:if>
+                                                                                                       </td>
+                                                                                               </f:then>
+                                                                                               <f:else>
+                                                                                                       <td class="sme highlight">{rating.user.username}</td>
+                                                                                               </f:else>
+                                                                                       </f:if>
+                                                                               </qr:for>
+                                                                               <!-- ###USER_CELL### end -->
+                                                                       </tr>
+                                                       </f:for>
+                                               </f:else>
+                                       </f:if>
+                                       </tbody>
+                                       <tfoot>
+                                       <tr>
+                                               <td colspan="8" class="final"></td>
+                                       </tr>
+                                       </tfoot>
+                               </table>
+                               <!-- ###TABLE### end -->
diff --git a/Resources/Private/Partials/rating.old.html b/Resources/Private/Partials/rating.old.html
new file mode 100644 (file)
index 0000000..a279bd3
--- /dev/null
@@ -0,0 +1,28 @@
+<!-- ###RATING_MAIN### begin -->
+                               <table class="rating" border="0"  cellspacing="0" cellpadding="0">
+                                       <thead>
+                                       <tr>
+                                               <th class="mainhead">Rating</th>
+                                               <th class="small-right {f:if(condition: '{currentStep} != 1', then: 'disable')}"><f:translate key="step">###STEPLABEL###</f:translate> 1</th>
+                                               <th class="small-right {f:if(condition: '{currentStep} != 2', then: 'disable')}"><f:translate key="step">###STEPLABEL###</f:translate> 2</th>
+                                               <th class="small-right {f:if(condition: '{currentStep} != 3', then: 'disable')}"><f:translate key="step">###STEPLABEL###</f:translate> 3</th>
+                                               <th class="small-right {f:if(condition: '{currentStep} != 4', then: 'disable')}"><f:translate key="step">###STEPLABEL###</f:translate> 4</th>
+
+                                               <th class="arrow"><img onclick="toggle('ratingBody',this,'{f:uri.resource(path: 'Images/pfeil.gif')}','{f:uri.resource(path: 'Images/pfeil-close.gif')}')" src="{f:uri.resource(path: 'Images/pfeil.gif')}" /></th>
+                                       </tr>
+                                       </thead>
+                                       <tbody id="ratingBody">
+                                       <tr>
+                                               <td class="bg" colspan="6">
+
+                                                       <f:render section="ratingDetail" />
+                                               </td>
+                                       </tr>
+                                       </tbody>
+                                       <tfoot>
+                                       <tr>
+                                               <td colspan="6" class="final"></td>
+                                       </tr>
+                                       </tfoot>
+                               </table>
+<!-- ###RATING_MAIN### end -->
\ No newline at end of file
diff --git a/Resources/Private/Partials/rating1.html b/Resources/Private/Partials/rating1.html
new file mode 100644 (file)
index 0000000..e4d6240
--- /dev/null
@@ -0,0 +1,17 @@
+<!-- ###RATING_MAIN### begin -->
+                               <table class="rating" border="0"  cellspacing="0" cellpadding="0">
+                                       <thead>
+                                       <tr>
+                                               <th class="mainhead">Rating</th>
+                                               <th class="small-right {f:if(condition: '{currentStep} != 1', then: 'disable')}"><f:translate key="step">###STEPLABEL###</f:translate> 1</th>
+                                               <th class="small-right {f:if(condition: '{currentStep} != 2', then: 'disable')}"><f:translate key="step">###STEPLABEL###</f:translate> 2</th>
+                                               <th class="small-right {f:if(condition: '{currentStep} != 3', then: 'disable')}"><f:translate key="step">###STEPLABEL###</f:translate> 3</th>
+                                               <th class="small-right {f:if(condition: '{currentStep} != 4', then: 'disable')}"><f:translate key="step">###STEPLABEL###</f:translate> 4</th>
+
+                                               <th class="arrow"><img onclick="toggle('ratingBody',this,'{f:uri.resource(path: 'Images/pfeil.gif')}','{f:uri.resource(path: 'Images/pfeil-close.gif')}')" src="{f:uri.resource(path: 'Images/pfeil.gif')}" /></th>
+                                       </tr>
+                                       </thead>
+                                       <tbody id="ratingBody">
+                                       <tr>
+                                               <td class="bg" colspan="6">
+
diff --git a/Resources/Private/Partials/rating2.html b/Resources/Private/Partials/rating2.html
new file mode 100644 (file)
index 0000000..3f387b6
--- /dev/null
@@ -0,0 +1,10 @@
+                                               </td>
+                                       </tr>
+                                       </tbody>
+                                       <tfoot>
+                                       <tr>
+                                               <td colspan="6" class="final"></td>
+                                       </tr>
+                                       </tfoot>
+                               </table>
+<!-- ###RATING_MAIN### end -->
diff --git a/Resources/Private/Partials/ratingFinalRatingBox.html b/Resources/Private/Partials/ratingFinalRatingBox.html
new file mode 100644 (file)
index 0000000..ed802e3
--- /dev/null
@@ -0,0 +1,8 @@
+                                                                                       <!-- ###STEP3_CELL_FINAL_RATING_BOX### end -->
+                                                                                       <div class="smallform smallform-sub rating">
+                                                                                               <f:form method="post" controller="Rating" action="ratingStep3" name="rating" object="{rating}" arguments="{question : question}">
+                                                                                                       <p><f:form.textbox property="finalRatingValue" size="3" /></p><br/>
+                                                                                                       <f:form.submit style="width:120px;" value="FINAL RATING" />
+                                                                                               </f:form>
+                                                                                        </div>
+                                                                                        <!-- ###STEP3_CELL_FINAL_RATING_BOX### end -->
\ No newline at end of file
diff --git a/Resources/Private/Partials/ratingFinalViewBox.html b/Resources/Private/Partials/ratingFinalViewBox.html
new file mode 100644 (file)
index 0000000..32de2f2
--- /dev/null
@@ -0,0 +1,6 @@
+                                                                                <f:if condition="{rating.finalRating}">
+                                                                                <div class="smallform smallform-sub {f:if(condition: '{rating.user} == {currentUser}', then: 'highlight')}">
+                                                                                                <p class="final-rating-text"><b>Final Rating:</b></p>
+                                                                                        <span class="big">{rating.finalRatingValue}</span>
+                                                                                </div>
+                                                                                </f:if>
\ No newline at end of file
diff --git a/Resources/Private/Partials/ratingOverviewBox.html b/Resources/Private/Partials/ratingOverviewBox.html
new file mode 100644 (file)
index 0000000..8638072
--- /dev/null
@@ -0,0 +1,10 @@
+                                                                                <div class="smallform {f:if(condition: '{ratingInfo.rating.user} == {currentUser}', then: 'highlight')}">
+                                                                                        <h1>{ratingInfo.rating.user.username}</h1>
+                                                                                        <p><b><f:translate key="rating_label">###RATINGLABEL###</f:translate></b> <span class="big">{ratingInfo.rating.ratingValue}</span></p>
+                                                                                        <p><b>Comments:</b></p>
+                                                                                        <p class="small"><a href="#" onclick="return Questionrating.Question.plugin.showDiscussion('from',{ratingInfo.rating.user.uid});">sent</a> <span id="sendcount_{ratingInfo.rating.user.username}">({ratingInfo.sendcount})</span></p>
+                                                                                        <p class="small"><a href="#" onclick="return Questionrating.Question.plugin.showDiscussion('to',{ratingInfo.rating.user.uid});">receive</a> <span id="receivecount_{ratingInfo-rating.user.username}">({ratingInfo.receivecount})</span></p><br/>
+                                                                                        <f:if condition="{allowDiscussion}">
+                                                                                               <input style="width:120px;" type="button" value="DISCUSS" onClick="Questionrating.Question.plugin.showDiscussion('both',{ratingInfo.rating.user.uid});"/>
+                                                                                        </f:if>
+                                                                                </div>
diff --git a/Resources/Private/Partials/reviewOverview.html b/Resources/Private/Partials/reviewOverview.html
new file mode 100644 (file)
index 0000000..820c4f5
--- /dev/null
@@ -0,0 +1,31 @@
+{namespace qr = Tx_Questionrating_ViewHelpers}
+        <!-- ###TABLE### begin -->
+        <table class="overview" border="0" cellspacing="0" cellpadding="0">
+          <thead>
+          <tr>
+            <th class="mainhead"><f:translate key="review_{currentStep}">{currentStep}</f:translate></th>
+            <th colspan="6" class="small-right"><f:translate key="review_{currentStep}_description"></f:translate></th>
+            <th class="arrow"><img  onclick="toggle('review_{currentStep}',this,'{f:uri.resource(path: 'Images/pfeil.gif')}','{f:uri.resource(path: 'Images/pfeil-close.gif')}');" src="{f:uri.resource(path: 'Images/pfeil.gif')}" /></th>
+           </tr>
+           </thead>
+           <tbody id="review_{currentStep}">
+           <tr>
+             <th class="sub"><f:translate key="headline_id">###TABLE_HEADLINE_ID###</f:translate></th>
+             <th class="sub"><f:translate key="headline_question">###TABLE_HEADLINE_QUESTION###</f:translate></th>
+             <th colspan="6" class="sub"><f:translate key="step_{currentStep}_headline_right">Votes</f:translate></th>
+           </tr>
+               <f:for each="{reviews}" as="review">          
+                   <tr>
+                     <td><b>{review.xmlId}</b></td>
+                     <td><f:link.action action="show" arguments="{review: review}"><f:format.crop maxCharacters="30" append=" ...">{review.headline}</f:format.crop></f:link.action></td>
+                     <td colspan="6">{review.votes}</td>
+                   </tr>
+               </f:for>
+           </tbody>
+           <tfoot>           
+           <tr>
+             <td colspan="8" class="final"></td>
+           </tr>
+           </tfoot>         
+        </table>
+        <!-- ###TABLE### end -->
\ No newline at end of file
diff --git a/Resources/Private/Templates/Ajax/Index.html b/Resources/Private/Templates/Ajax/Index.html
new file mode 100644 (file)
index 0000000..bacd6a6
--- /dev/null
@@ -0,0 +1 @@
+<f:render partial="discussionMessage" arguments="{discussions: discussions, leaderGroup: leaderGroup, isLeader: isLeader, currentUser: currentUser, allowDiscussion: allowDiscussion}"/>
\ No newline at end of file
diff --git a/Resources/Private/Templates/Importer/Index.html b/Resources/Private/Templates/Importer/Index.html
new file mode 100644 (file)
index 0000000..cd6eec7
--- /dev/null
@@ -0,0 +1,53 @@
+<f:layout name="standard.html" />
+
+<f:section name="content">
+<f:form method="post" controller="Importer" action="import" name="importer" >
+<p><f:form.submit  value="IMPORT" /></p>
+                               <table class="overview" border="0" cellspacing="0" cellpadding="0">
+                                       <thead>
+                                       <tr>
+                                               <th class="mainhead">Importtool</th>
+                                               <th colspan="2" class="small-right"><input style="width:110px;" type="button" value="OVERVIEW" onclick="window.location.href='{f:uri.action(controller: 'Question')}'" /></th>
+                                               <th class="arrow"><img  onclick="toggle('importBody',this,'{f:uri.resource(path: 'Images/pfeil.gif')}','{f:uri.resource(path: 'Images/pfeil-close.gif')}');" src="{f:uri.resource(path: 'Images/pfeil.gif')}" /></th>
+                                        </tr>
+                                        </thead>
+                                        <tbody id="importBody">
+                                        <tr>
+                                                <th class="sub">Import</th>
+                                                <th class="sub">ID</th>
+                                                <th class="sub">Question</th>
+                                                <th class="sub">Author</th>
+                                        </tr>        
+                               <!-- ###IMPORT_CONTENT_OVERVIEW_QUESTION### begin -->
+                               <f:for each="{xmlitemArray}" as="xmlitem">
+                                       <tr>
+                                               <td>
+                                               <f:if condition="{xmlitem.inDb}">
+                                                       <f:then>
+                                                               <f:form.checkbox name="importIds[]" value="{xmlitem.id}" checked="0" /> <br /> 
+                                                               <span class="warning"><b>Rating aktiv</b></span>
+                                                       </f:then>
+                                                       <f:else>
+                                                               <f:form.checkbox name="importIds[]" value="{xmlitem.id}" checked="1" />
+                                                       </f:else>
+                                               </f:if>
+                                               </td>
+                                               <td>{xmlitem.id}</td>
+                                               <td><f:format.html>{xmlitem.questionText}</f:format.html></td>
+                                               <td>{xmlitem.author}</td>
+                                       </tr>
+                               </f:for>   
+                       
+                       <!-- ###IMPORT_CONTENT_OVERVIEW_QUESTION### end -->
+
+                                        </tbody>
+                                        <tfoot>           
+                                        <tr>
+                                                <td colspan="4" class="final"></td>
+                                        </tr>
+                                        </tfoot>
+                               </table>
+<br />
+<f:form.submit  value="IMPORT" />
+</f:form>
+</f:section>
\ No newline at end of file
diff --git a/Resources/Private/Templates/Question/Index.html b/Resources/Private/Templates/Question/Index.html
new file mode 100644 (file)
index 0000000..d1773cb
--- /dev/null
@@ -0,0 +1,27 @@
+
+<f:layout name="standard.html" />
+
+<f:section name="content">
+
+<!-- ###OVERVIEW_MAIN### begin -->
+                               <h1>Question overview</h1>
+                               <!-- ###ERROR_BOX### -->
+                               <f:flashMessages class="error" />
+                               <f:if condition="{isLeader}">        
+                               <f:if condition="{closeQuestions}">
+                                       <f:render partial="questionOverview" arguments="{questions: closeQuestions, currentStep: 4, action: 'showStep4', currentUser: currentUser}"/>
+                               </f:if>
+                               </f:if>
+                               <f:if condition="{finalQuestions}">
+                                       <f:render partial="questionOverview" arguments="{questions: finalQuestions, currentStep: 3, action: 'showStep3', currentUser: currentUser}"/>
+                               </f:if>
+                               <f:if condition="{discussQuestions}">
+                                       <f:render partial="questionOverview" arguments="{questions: discussQuestions, currentStep: 2, action: 'showStep2', currentUser: currentUser}"/>
+                               </f:if>
+                               <f:if condition="{openQuestions}">
+                                       <f:render partial="questionOverview" arguments="{questions: openQuestions, currentStep: 1, action: 'showStep1', currentUser: currentUser}"/>
+                               </f:if>
+                               <br />
+                               <input type="checkbox" {f:if(condition: '{showall}', then: 'checked')}  onclick="location.href='{f:uri.action(action: 'toggleShowall')}'" /> 
+                                show all questions
+</f:section>    
diff --git a/Resources/Private/Templates/Question/Info.html b/Resources/Private/Templates/Question/Info.html
new file mode 100644 (file)
index 0000000..1cfda6f
--- /dev/null
@@ -0,0 +1,6 @@
+<f:layout name="standard.html" />
+
+<f:section name="content">
+       <f:format.html>{infoText}</f:format.html>
+       <p><f:link.action controller="Question">zur Rating-&Uuml;bersicht</f:link.action></p>
+</f:section>
\ No newline at end of file
diff --git a/Resources/Private/Templates/Question/ShowStep1.html b/Resources/Private/Templates/Question/ShowStep1.html
new file mode 100644 (file)
index 0000000..8d491a4
--- /dev/null
@@ -0,0 +1,45 @@
+<f:layout name="standard.html" />
+
+<f:section name="content">
+
+                               <!-- ###ERROR_BOX### -->
+                               <f:flashMessages class="error" />
+                               <f:render partial="questionDetail" arguments="{question: question, showToggleButton: 1}"/>
+                               <f:if condition='{isLeader} != 1'>
+                                       <f:render partial="rating1" arguments="{currentStep: 1}" />
+
+                                                       <!-- ###STEP1### begin -->
+                                                       <div class="bigform">
+                                                               <f:if condition='{allowEdit}'>
+                                                                       <f:then>
+                                                                               <f:form.errors for="rating">
+                                                                                       <div class="error">
+                                                                                               <f:for each="{error.errors}" as="errorDetail">
+                                                                                                        {errorDetail.message}
+                                                                                               </f:for>
+                                                                                       </div>
+                                                                               </f:form.errors>
+                                                                               <f:form method="post" controller="Rating" action="ratingStep1" name="rating" object="{rating}" arguments="{question : question}">
+                                                                                       <h1>{currentUser.username}</h1>
+                                                                                       <p class="field"><b><f:translate key="rating_label_long">###RATINGLABEL###</f:translate></b><br/>
+                                                                                       <f:form.textbox property="ratingValue" size="3" value="{f:if(condition: '{rating.ratingValue}', then: '{rating.ratingValue}')}"/> </p>
+                                                                                       <p class="field"><b>Comment:</b><br/>
+                                                                                       <f:form.textarea name="message" rows="5" cols="100" value="{message}"/> </p><br/>
+                                                                                       <f:form.submit style="width: 120px;" value="1ST RATING" />
+                                                                               </f:form>
+                                                                       </f:then>
+                                                                       <f:else>
+                                                                               <h1>{currentUser.username}</h1>
+                                                                               <p class="field"><b><f:translate key="rating_label">###RATINGLABEL###</f:translate></b><br/>
+                                                                                {rating.ratingValue} </p><br />
+                                                                               <p class="field"><b>Comment:</b><br/>
+                                                                                {message} </p><br/>
+                                                                       </f:else>
+                                                               </f:if>
+                                                       </div>
+                                                       <!-- ###STEP1### end -->
+
+                                       <f:render partial="rating2" arguments="{currentStep: 1}" />
+                               </f:if>
+</f:section>
+
diff --git a/Resources/Private/Templates/Question/ShowStep1.orig.html b/Resources/Private/Templates/Question/ShowStep1.orig.html
new file mode 100644 (file)
index 0000000..45ea9ce
--- /dev/null
@@ -0,0 +1,44 @@
+<f:layout name="standard.html" />
+
+<f:section name="content">
+
+                               <!-- ###ERROR_BOX### -->
+                               <f:renderFlashMessages class="error" />
+                               <f:render partial="questionDetail" arguments="{question: question, showToggleButton: 1}"/>
+                               <f:if condition='{isLeader} != 1'>
+                                       <f:render partial="rating" arguments="{currentStep: 1}" />
+                               </f:if>
+</f:section>
+
+<f:section name="ratingDetail">
+                                                       <!-- ###STEP1### begin -->
+                                                       <div class="bigform">
+                                                               <f:if condition='{allowEdit}'>
+                                                                       <f:then>
+                                                                               <f:form.errors for="rating">
+                                                                                       <div class="error">
+                                                                                               <f:for each="{error.errors}" as="errorDetail">
+                                                                                                        {errorDetail.message}
+                                                                                               </f:for>
+                                                                                       </div>
+                                                                               </f:form.errors>
+                                                                               <f:form method="post" controller="Rating" action="ratingStep1" name="rating" object="{rating}" arguments="{question : question}">
+                                                                                       <h1>{currentUser.username}</h1>
+                                                                                       <p class="field"><b><f:translate key="rating_label_long">###RATINGLABEL###</f:translate></b><br/>
+                                                                                       <f:form.textbox property="ratingValue" size="3" value="{f:if(condition: '{rating.ratingValue}', then: '{rating.ratingValue}')}"/> </p>
+                                                                                       <p class="field"><b>Comment:</b><br/>
+                                                                                       <f:form.textarea name="message" rows="5" cols="100" value="{message}"/> </p><br/>
+                                                                                       <f:form.submit style="width: 120px;" value="1ST RATING" />
+                                                                               </f:form>
+                                                                       </f:then>
+                                                                       <f:else>
+                                                                               <h1>{currentUser.username}</h1>
+                                                                               <p class="field"><b><f:translate key="rating_label">###RATINGLABEL###</f:translate></b><br/>
+                                                                                {rating.ratingValue} </p><br />
+                                                                               <p class="field"><b>Comment:</b><br/>
+                                                                                {message} </p><br/>
+                                                                       </f:else>
+                                                               </f:if>
+                                                       </div>
+                                                       <!-- ###STEP1### end -->
+</f:section>
diff --git a/Resources/Private/Templates/Question/ShowStep2.html b/Resources/Private/Templates/Question/ShowStep2.html
new file mode 100644 (file)
index 0000000..8616cc8
--- /dev/null
@@ -0,0 +1,28 @@
+{namespace qr = Tx_Questionrating_ViewHelpers}
+<f:layout name="standard.html" />
+
+<f:section name="content">
+
+                               <!-- ###ERROR_BOX### -->
+                               <f:flashMessages class="error" />
+                               <f:render partial="questionDetail" arguments="{question: question, showToggleButton: 0}"/>
+                               <f:render partial="rating1" arguments="{currentStep: 2}" />
+
+                                                       <!-- ###STEP2### start -->
+                                                       <table  class="rating-sub" cellspacing="0" cellpadding="0">
+                                                               <tr>
+                                                                       <f:for each="{ratingArray}" as="ratingInfo">
+                                                                       <!-- ###STEP2_CELL### start -->
+                                                                       <td>
+                                                                               <f:render partial="ratingOverviewBox" arguments="{ratingInfo: ratingInfo, currentUser: currentUser, allowDiscussion: allowDiscussion}" />
+                                                                       </td>
+                                                                       <!-- ###STEP2_CELL### end -->
+                                                               </f:for>
+                                                               </tr>
+                                                       </table>
+                                                       <!-- ###STEP2### end -->
+
+                               <f:render partial="rating2" arguments="{currentStep: 2}" />
+                               <f:render partial="discussion" arguments="{question: question, leaderGroup: leaderGroup, isLeader: isLeader, currentUser: currentUser, allowDiscussion: allowDiscussion}"/>
+</f:section>
+
diff --git a/Resources/Private/Templates/Question/ShowStep2.orig.html b/Resources/Private/Templates/Question/ShowStep2.orig.html
new file mode 100644 (file)
index 0000000..67f540c
--- /dev/null
@@ -0,0 +1,28 @@
+{namespace qr = Tx_Questionrating_ViewHelpers}
+<f:layout name="standard.html" />
+
+<f:section name="content">
+
+                               <!-- ###ERROR_BOX### -->
+                               <f:renderFlashMessages class="error" />
+                               <f:render partial="questionDetail" arguments="{question: question, showToggleButton: 0}"/>
+                               <f:render partial="rating" arguments="{currentStep: 2}" />
+                               <f:render partial="discussion" arguments="{question: question, leaderGroup: leaderGroup, isLeader: isLeader, currentUser: currentUser, allowDiscussion: allowDiscussion}"/>
+</f:section>
+
+<f:section name="ratingDetail">
+                                                       <!-- ###STEP2### start -->
+                                                       <table  class="rating-sub" cellspacing="0" cellpadding="0">
+                                                               <tr>
+                                                                       <f:for each="{ratingArray}" as="ratingInfo">
+                                                                       <!-- ###STEP2_CELL### start -->
+                                                                       <td>
+                                                                               <f:render partial="ratingOverviewBox" arguments="{ratingInfo: ratingInfo, currentUser: currentUser, allowDiscussion: allowDiscussion}" />
+                                                                       </td>
+                                                                       <!-- ###STEP2_CELL### end -->
+                                                               </f:for>
+                                                               </tr>
+                                                       </table>
+                                                       <!-- ###STEP2### end -->
+</f:section>
+
diff --git a/Resources/Private/Templates/Question/ShowStep3.html b/Resources/Private/Templates/Question/ShowStep3.html
new file mode 100644 (file)
index 0000000..c7eb044
--- /dev/null
@@ -0,0 +1,75 @@
+{namespace qr = Tx_Questionrating_ViewHelpers}
+<f:layout name="standard.html" />
+
+<f:section name="content">
+
+                               <!-- ###ERROR_BOX### -->
+                               <f:flashMessages class="error" />
+                               <f:render partial="questionDetail" arguments="{question: question, showToggleButton: 0}"/>
+                               <f:render partial="rating1" arguments="{currentStep: 3}" />
+
+                                               <f:if condition="{renderFinalRatingReviewBox}">
+                                                       <f:then>
+                                                               <f:render section="ratingDetailReview" />
+                                                       </f:then>
+                                                       <f:else>
+                                                               <f:render section="ratingDetailNormal" />
+                                                       </f:else>
+                                               </f:if>
+</f:section>
+
+<f:section name="ratingDetailNormal">
+                                                       <!-- ###STEP2### start -->
+                                                       <table  class="rating-sub" cellspacing="0" cellpadding="0">
+                                                               <tr>
+                                                                       <f:for each="{ratingArray}" as="ratingInfo">
+                                                                       <!-- ###STEP2_CELL### start -->
+                                                                       <td>
+                                                                               <f:render partial="ratingOverviewBox" arguments="{ratingInfo: ratingInfo, currentUser: currentUser, allowDiscussion: 0}" />
+                                                                               <f:if condition="{renderFinalViewBox}">
+                                                                                       <f:render partial="ratingFinalViewBox" arguments="{rating: ratingInfo.rating, currentUser: currentUser}" />
+                                                                               </f:if>
+                                                                               <f:if condition="{renderFinalRatingBox}">
+                                                                                       <f:if condition="{ratingInfo.rating.user}=={currentUser}">
+                                                                                               <f:render partial="ratingFinalRatingBox" arguments="{question: question, rating: finalRating}" />
+                                                                                       </f:if>
+                                                                               </f:if>
+                                                                       </td>
+                                                                       <!-- ###STEP2_CELL### end -->
+                                                               </f:for>
+                                                               </tr>
+                                                       </table>
+                                                       <!-- ###STEP2### end -->
+</f:section>
+
+<f:section name="ratingDetailReview">
+                                                       <!-- ###STEP2### start -->
+<f:form method="post" controller="Rating" action="closeReview" name="rating" arguments="{question : question}" >
+                                                       <table  class="rating-sub" cellspacing="0" cellpadding="0">
+                                                               <tr>
+                                                                       <f:for each="{ratingArray}" as="ratingInfo">
+                                                                       <!-- ###STEP2_CELL### start -->
+                                                                       <td>
+                                                                               <f:render partial="ratingOverviewBox" arguments="{ratingInfo: ratingInfo, currentUser: currentUser, allowDiscussion: 0}" />
+                                                                               <f:if condition="{renderFinalViewBox}">
+                                                                                       <f:render partial="ratingFinalViewBox" arguments="{rating: ratingInfo.rating, currentUser: currentUser}" />
+                                                                               </f:if>
+                                                                               <div class="smallform smallform-sub rating">
+                                                                                       <p><f:form.textbox name="finalRatingValueArray[{ratingInfo.rating.uid}]" size="3" value="{ratingInfo.rating.finalRatingValue}"/> </p><br/>
+                                                                               </div>
+                                                                       </td>
+                                                                       <!-- ###STEP2_CELL### end -->
+                                                               </f:for>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td colspan="5">&#160;</td>
+                                                                       <td align="right"><f:form.submit style="width:120px;margin-right:5px;"  value="CLOSE"  /></td>
+                                                               </tr>
+                                                       </table>
+</f:form>
+                                                       <!-- ###STEP2### end -->
+
+                               <f:render partial="rating2" arguments="{currentStep: 3}" />
+                               <f:render partial="discussion" arguments="{question: question, leaderGroup: leaderGroup, isLeader: isLeader, currentUser: currentUser, allowDiscussion: 0}"/>
+</f:section>
+
diff --git a/Resources/Private/Templates/Question/ShowStep3.orig.html b/Resources/Private/Templates/Question/ShowStep3.orig.html
new file mode 100644 (file)
index 0000000..8986d1c
--- /dev/null
@@ -0,0 +1,76 @@
+{namespace qr = Tx_Questionrating_ViewHelpers}
+<f:layout name="standard.html" />
+
+<f:section name="content">
+
+                               <!-- ###ERROR_BOX### -->
+                               <f:renderFlashMessages class="error" />
+                               <f:render partial="questionDetail" arguments="{question: question, showToggleButton: 0}"/>
+                               <f:render partial="rating" arguments="{currentStep: 3}" />
+                               <f:render partial="discussion" arguments="{question: question, leaderGroup: leaderGroup, isLeader: isLeader, currentUser: currentUser, allowDiscussion: 0}"/>
+</f:section>
+
+<f:section name="ratingDetail">
+                                               <f:if condition="{renderFinalRatingReviewBox}">
+                                                       <f:then>
+                                                               <f:render section="ratingDetailReview" />
+                                                       </f:then>
+                                                       <f:else>
+                                                               <f:render section="ratingDetailNormal" />
+                                                       </f:else>
+                                               </f:if>
+</f:section>
+
+<f:section name="ratingDetailNormal">
+                                                       <!-- ###STEP2### start -->
+                                                       <table  class="rating-sub" cellspacing="0" cellpadding="0">
+                                                               <tr>
+                                                                       <f:for each="{ratingArray}" as="ratingInfo">
+                                                                       <!-- ###STEP2_CELL### start -->
+                                                                       <td>
+                                                                               <f:render partial="ratingOverviewBox" arguments="{ratingInfo: ratingInfo, currentUser: currentUser, allowDiscussion: 0}" />
+                                                                               <f:if condition="{renderFinalViewBox}">
+                                                                                       <f:render partial="ratingFinalViewBox" arguments="{rating: ratingInfo.rating, currentUser: currentUser}" />
+                                                                               </f:if>
+                                                                               <f:if condition="{renderFinalRatingBox}">
+                                                                                       <f:if condition="{ratingInfo.rating.user}=={currentUser}">
+                                                                                               <f:render partial="ratingFinalRatingBox" arguments="{question: question, rating: finalRating}" />
+                                                                                       </f:if>
+                                                                               </f:if>
+                                                                       </td>
+                                                                       <!-- ###STEP2_CELL### end -->
+                                                               </f:for>
+                                                               </tr>
+                                                       </table>
+                                                       <!-- ###STEP2### end -->
+</f:section>
+
+<f:section name="ratingDetailReview">
+                                                       <!-- ###STEP2### start -->
+<f:form method="post" controller="Rating" action="closeReview" name="rating" arguments="{question : question}" >
+                                                       <table  class="rating-sub" cellspacing="0" cellpadding="0">
+                                                               <tr>
+                                                                       <f:for each="{ratingArray}" as="ratingInfo">
+                                                                       <!-- ###STEP2_CELL### start -->
+                                                                       <td>
+                                                                               <f:render partial="ratingOverviewBox" arguments="{ratingInfo: ratingInfo, currentUser: currentUser, allowDiscussion: 0}" />
+                                                                               <f:if condition="{renderFinalViewBox}">
+                                                                                       <f:render partial="ratingFinalViewBox" arguments="{rating: ratingInfo.rating, currentUser: currentUser}" />
+                                                                               </f:if>
+                                                                               <div class="smallform smallform-sub rating">
+                                                                                       <p><f:form.textbox name="finalRatingValueArray[{ratingInfo.rating.uid}]" size="3" value="{ratingInfo.rating.finalRatingValue}"/> </p><br/>
+                                                                               </div>
+                                                                       </td>
+                                                                       <!-- ###STEP2_CELL### end -->
+                                                               </f:for>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td colspan="5">&#160;</td>
+                                                                       <td align="right"><f:form.submit style="width:120px;margin-right:5px;"  value="CLOSE"  /></td>
+                                                               </tr>
+                                                       </table>
+</f:form>
+                                                       <!-- ###STEP2### end -->
+
+
+</f:section>
\ No newline at end of file
diff --git a/Resources/Private/Templates/Question/ShowStep4.html b/Resources/Private/Templates/Question/ShowStep4.html
new file mode 100644 (file)
index 0000000..e1bfa28
--- /dev/null
@@ -0,0 +1,37 @@
+{namespace qr = Tx_Questionrating_ViewHelpers}
+<f:layout name="standard.html" />
+
+<f:section name="content">
+
+        <!-- ###ERROR_BOX### -->
+        <f:flashMessages class="error" />
+        <f:render partial="questionDetail" arguments="{question: question, showToggleButton: 0}"/>
+        <f:render partial="rating1" arguments="{currentStep: 4}" />
+
+               <!-- ###STEP2### start -->
+               <table  class="rating-sub" cellspacing="0" cellpadding="0">
+                 <tr>
+                   <f:for each="{ratingArray}" as="ratingInfo">
+                   <!-- ###STEP2_CELL### start -->
+                   <td>
+                     <f:render partial="ratingOverviewBox" arguments="{ratingInfo: ratingInfo, currentUser: currentUser, allowDiscussion: 0}" />
+                     <f:render partial="ratingFinalViewBox" arguments="{rating: ratingInfo.rating, currentUser: currentUser}" />
+                   </td>
+                  <!-- ###STEP2_CELL### end -->
+                 </f:for>                                    
+                 </tr>
+                 <tr>
+                   <td colspan="6">
+                     <div class="bigform" style="margin-left:0px;"><center>
+                         <p ><b class="final-rating-text">Final Rating Overall:</b></p>
+                       <span class="big">{ratingOverall}</span></center>
+                     </div>                     
+                   </td>
+                 </tr>
+               </table>
+              <!-- ###STEP2### end -->
+
+        <f:render partial="rating2" arguments="{currentStep: 4}" />
+        <f:render partial="discussion" arguments="{question: question, leaderGroup: leaderGroup, isLeader: isLeader, currentUser: currentUser, allowDiscussion: 0}"/>        
+</f:section>
+
diff --git a/Resources/Private/Templates/Question/ShowStep4.orig.html b/Resources/Private/Templates/Question/ShowStep4.orig.html
new file mode 100644 (file)
index 0000000..739689a
--- /dev/null
@@ -0,0 +1,38 @@
+{namespace qr = Tx_Questionrating_ViewHelpers}
+<f:layout name="standard.html" />
+
+<f:section name="content">
+
+        <!-- ###ERROR_BOX### -->
+        <f:renderFlashMessages class="error" />
+        <f:render partial="questionDetail" arguments="{question: question, showToggleButton: 0}"/>
+        <f:render partial="rating" arguments="{currentStep: 4}" />
+        <f:render partial="discussion" arguments="{question: question, leaderGroup: leaderGroup, isLeader: isLeader, currentUser: currentUser, allowDiscussion: 0}"/>        
+</f:section>
+
+
+<f:section name="ratingDetail">
+               <!-- ###STEP2### start -->
+               <table  class="rating-sub" cellspacing="0" cellpadding="0">
+                 <tr>
+                   <f:for each="{ratingArray}" as="ratingInfo">
+                   <!-- ###STEP2_CELL### start -->
+                   <td>
+                     <f:render partial="ratingOverviewBox" arguments="{ratingInfo: ratingInfo, currentUser: currentUser, allowDiscussion: 0}" />
+                     <f:render partial="ratingFinalViewBox" arguments="{rating: ratingInfo.rating, currentUser: currentUser}" />
+                   </td>
+                  <!-- ###STEP2_CELL### end -->
+                 </f:for>                                    
+                 </tr>
+                 <tr>
+                   <td colspan="6">
+                     <div class="bigform" style="margin-left:0px;"><center>
+                         <p ><b class="final-rating-text">Final Rating Overall:</b></p>
+                       <span class="big">{ratingOverall}</span></center>
+                     </div>                     
+                   </td>
+                 </tr>
+               </table>
+              <!-- ###STEP2### end -->
+</f:section>
+
diff --git a/Resources/Private/Templates/Review/EditQuestion.html b/Resources/Private/Templates/Review/EditQuestion.html
new file mode 100644 (file)
index 0000000..8f19f75
--- /dev/null
@@ -0,0 +1,88 @@
+{namespace qr = Tx_Questionrating_ViewHelpers}
+<f:layout name="standard.html" />
+
+<f:section name="content">
+                               <h1>Edit question</h1>
+                               <!-- ###ERROR_BOX### -->
+                               <f:flashMessages class="error" />
+                                                               <f:form.errors for="question">
+                                                                               <div class="error">
+                                                                                               <f:translate key="propertyName_{error.propertyName}">{error.propertyName}</f:translate>:
+                                                                                               <f:for each="{error.errors}" as="errorDetail">
+                                                                                                               {errorDetail.message}
+                                                                                               </f:for>
+                                                                               </div>
+                                                               </f:form.errors>
+<f:form method="post" controller="Review" action="saveQuestion" name="question" object="{question}" arguments="{review: review}">
+
+<!-- ###QUESTION_MAIN### begin -->
+
+                               <table class="question" border="0"  cellspacing="0" cellpadding="0">
+                                       <thead>
+                                       <tr>
+                                               <th class="mainhead"><f:translate key="headline_question">###TABLE_HEADLINE_QUESTION###</f:translate></th>
+                                               <th class="small-right" width="75"><b>ID: {question.xmlId}</b></th>
+                                               <th ><f:format.crop maxCharacters="30" append=" ...">{question.questionTitle}</f:format.crop></th>
+                                               <th class="small-right"><input style="width:110px;" type="button" value="OVERVIEW" onclick="window.location.href='{f:uri.action(controller: 'Question')}'" /></th>
+                                               <th class="arrow"><img  onclick="toggle('questionBody',this,'{f:uri.resource(path: 'Images/pfeil.gif')}','{f:uri.resource(path: 'Images/pfeil-close.gif')}');" src="{f:uri.resource(path: 'Images/pfeil.gif')}" /></th>
+                                       </tr>
+                                       </thead>
+                                       <tbody id='questionBody'>
+
+                                       <tr>
+                                               <td colspan="5" class="spacer"></td>
+                                       </tr>
+                                       <tr>
+                                               <td><b>Q:</b></td>
+                                               <td colspan="3" class="questiontext"><qr:displayTextAndCode>{question.questiontext}</qr:displayTextAndCode></td>
+                                               <td></td>
+                                       </tr>
+                                       <tr>
+                                               <td><b></b></td>
+                                               <td colspan="3" class="questiontext"><f:form.textarea property="questiontext" rows="5" cols="100" /></td>
+                                               <td></td>
+                                       </tr>
+                                       <tr>
+                                               <td><b>A:</b></td>
+                                               <td colspan="3">
+                                                       <f:for each="{question.allAnswers}" key="id" as="answer">
+                                                               <!-- ###ANSWER### begin -->
+                                                               <f:if condition="{qr:inArray(needle:'{id}' array:'{question.correctanswer}')}">
+                                                                       <f:then>
+                                                                               <div style="padding-bottom:1em;" class="highlight" id="answer_{id}"><qr:displayTextAndCode>({id}.) {answer}</qr:displayTextAndCode></div>
+                                                                               <div style="padding-bottom:1em;" class="highlight">
+                                                                                               <f:if condition="{setCorrectAnswer}">Is correct: <f:form.checkbox name="correctanswer[]" value="{id}" checked="1"/><br /></f:if>
+                                                                                               <f:form.textarea property="answer{id}text" rows="5" cols="100" />
+                                                                               </div>
+                                                                       </f:then>
+                                                                       <f:else>
+                                                                               <div style="padding-bottom:1em;" class="" id="answer_{id}"><qr:displayTextAndCode>({id}.) {answer}</qr:displayTextAndCode></div>
+                                                                               <div style="padding-bottom:1em;" class="">
+                                                                                               <f:if condition="{setCorrectAnswer}">Is correct: <f:form.checkbox name="correctanswer[]" value="{id}" checked="0"/><br /></f:if>
+                                                                                               <f:form.textarea property="answer{id}text" rows="5" cols="100" />
+                                                                               </div>
+                                                                       </f:else>
+                                                               </f:if>
+                                                               <!-- ###ANSWER### end -->
+                                                       </f:for>
+                                               </td>
+                                               <td></td>
+                                       </tr>
+                                       <tr>
+                                               <td colspan="5" align="center">
+                                               <f:form.hidden property="xmlId" />
+                                               <f:form.submit style="width: 120px;" value="Submit" /></td>
+                                       </tr>
+                                       </tbody>
+                                       <tfoot>
+                                       <tr>
+                                               <td colspan="5" class="final"></td>
+                                       </tr>
+                                       </tfoot>
+                               </table>
+
+
+<!-- ###QUESTION_MAIN### end -->
+</f:form>
+
+</f:section>
diff --git a/Resources/Private/Templates/Review/Index.html b/Resources/Private/Templates/Review/Index.html
new file mode 100644 (file)
index 0000000..f06efee
--- /dev/null
@@ -0,0 +1,17 @@
+<f:layout name="standard.html" />
+
+<f:section name="content">
+                               <h1>Review overview</h1>
+                               <!-- ###ERROR_BOX### -->
+                               <f:flashMessages class="error" />
+
+
+                               <f:if condition="{technicalReviews}">
+                                       <f:render partial="reviewOverview" arguments="{reviews: technicalReviews, currentStep: 'technical', currentUser: currentUser}"/>
+                               </f:if>
+                               <f:if condition="{translationReviews}">
+                                       <f:render partial="reviewOverview" arguments="{reviews: translationReviews, currentStep: 'translation', currentUser: currentUser}"/>
+                               </f:if>
+
+
+</f:section>    
diff --git a/Resources/Private/Templates/Review/Show.html b/Resources/Private/Templates/Review/Show.html
new file mode 100644 (file)
index 0000000..85de1c5
--- /dev/null
@@ -0,0 +1,102 @@
+<f:layout name="standard.html" />
+
+<f:section name="content">
+                               <h1>Review</h1>
+                               <!-- ###ERROR_BOX### -->
+                               <f:flashMessages class="error" />
+
+                               <f:render partial="questionDetail" arguments="{question: question, showToggleButton: 0}"/>
+
+                               <table class="rating" border="0"  cellspacing="0" cellpadding="0">
+                                       <thead>
+                                       <tr>
+                                               <th class="mainhead">Review Status</th>
+
+                                               <th class="arrow"><img onclick="toggle('ratingBody',this,'{f:uri.resource(path: 'Images/pfeil.gif')}','{f:uri.resource(path: 'Images/pfeil-close.gif')}')" src="{f:uri.resource(path: 'Images/pfeil.gif')}" /></th>
+                                       </tr>
+                                       </thead>
+                                       <tbody id="ratingBody">
+                                       <tr>
+                                               <td colspan="6">
+                                                       <div>Votes: {review.votes}</div>
+                                                       <div><f:link.action action="editQuestion" arguments="{review: review}">edit Question</f:link.action></div>
+                                               </td>
+                                       </tr>
+                                       </tbody>
+                                       <tfoot>
+                                       <tr>
+                                               <td colspan="6" class="final"></td>
+                                       </tr>
+                                       </tfoot>
+                               </table>
+
+                               <table class="discussion" border="0" cellspacing="0" cellpadding="0">
+                                       <tr>
+                                               <th class="mainhead">Comments</th>
+                                               <th class="small-right disable">
+                                               </th>
+                                               <th class="arrow"><img onclick="toggle('discussionTable',this,'{f:uri.resource(path: 'Images/pfeil.gif')}','{f:uri.resource(path: 'Images/pfeil-close.gif')}')" id="discussionToggleArrow" src="{f:uri.resource(path: 'Images/pfeil.gif')}" /></th>
+                                       </tr>
+                               </table>
+                               <div id="discussionTable">
+
+                                       <table class="discussion discussion-subtable" border="0" cellspacing="0" cellpadding="0">
+                                       <tbody>
+
+                                       <f:for each="{review.reviewcomments}" as="comment">
+
+                                               <!-- ###DISCUSSION_ROW### start -->
+                                               <tr>
+                                                       <td width="100">
+                                                               {comment.user.username}<br/>
+                                                               <f:format.date format="H:i:s">{comment.crdate}</f:format.date></td>
+                                                       <td class="messagetext"><f:format.nl2br>{comment.message}</f:format.nl2br></td>
+                                                       <td class="small-right button">&#160;</td>
+                                               </tr>
+                                               <!-- ###DISCUSSION_ROW### end -->
+                                       </f:for>
+                                       </tbody>
+                                       </table>
+                               </div>
+
+                               <table class="rating" border="0"  cellspacing="0" cellpadding="0">
+                                       <thead>
+                                       <tr>
+                                               <th class="mainhead">Submit Comment</th>
+
+                                               <th class="arrow"><img onclick="toggle('ratingBody',this,'{f:uri.resource(path: 'Images/pfeil.gif')}','{f:uri.resource(path: 'Images/pfeil-close.gif')}')" src="{f:uri.resource(path: 'Images/pfeil.gif')}" /></th>
+                                       </tr>
+                                       </thead>
+                                       <tbody id="ratingBody">
+                                       <tr>
+                                               <td class="bg" colspan="6">
+
+                                                       <div class="bigform">
+                                                       <f:form.errors for="reviewcomment">
+                                                               <div class="error">
+                                                                               <f:translate key="propertyName_{error.propertyName}">{error.propertyName}</f:translate>:
+                                                                               <f:for each="{error.errors}" as="errorDetail">
+                                                                                               {errorDetail.message}
+                                                                               </f:for>
+                                                               </div>
+                                                       </f:form.errors>
+                                                       <f:form method="post" controller="Review" action="saveComment" name="reviewcomment" object="{reviewcomment}" arguments="{review: review}">
+                                                               <h1>{currentUser.username}</h1>
+                                                               <p class="field"><b>Comment:</b><br/>
+                                                               <f:form.textarea property="message" rows="5" cols="100" /> </p><br/>
+                                                               <p class="field"><b>Review done:</b>
+                                                               <f:form.checkbox name="vote" value="1" checked="{vote}"/> </p><br/>
+                                                               <f:form.submit style="width: 120px;" value="Submit" />
+                                                       </f:form>
+                                                       </div>
+                                               </td>
+                                       </tr>
+                                       </tbody>
+                                       <tfoot>
+                                       <tr>
+                                               <td colspan="6" class="final"></td>
+                                       </tr>
+                                       </tfoot>
+                               </table>
+
+</f:section>
diff --git a/Resources/Public/CSS/tx_questionrating_main.css b/Resources/Public/CSS/tx_questionrating_main.css
new file mode 100644 (file)
index 0000000..7bdd3b9
--- /dev/null
@@ -0,0 +1,417 @@
+// taken from reset.css
+html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}del,ins{text-decoration:none;}
+
+.main {
+       background-color:#fff;
+       width:960px;
+       margin:0px auto;
+       text-align:left;
+       font-family:Arial;
+}
+
+.head {
+       margin-left: 10px;
+       margin-top: 15px;
+  &