diff --git a/Classes/Controller/PageController.php b/Classes/Controller/PageController.php
new file mode 100755
index 0000000..cc5f370
--- /dev/null
+++ b/Classes/Controller/PageController.php
@@ -0,0 +1,233 @@
+
+*
+* 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 3 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!
+***************************************************************/
+
+
+/**
+ *
+ *
+ * @package sokoban
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ *
+ */
+class Tx_Sokoban_Controller_PageController extends Tx_Extbase_MVC_Controller_ActionController {
+
+ /**
+ * pageRepository
+ *
+ * @var Tx_Sokoban_Domain_Repository_PageRepository
+ */
+ protected $pageRepository;
+ /**
+ * contentElementRepository
+ *
+ * @var Tx_Sokoban_Domain_Repository_ContentElementRepository
+ */
+ protected $contentElementRepository;
+ /**
+ * backendLayoutRepository
+ *
+ * @var Tx_Sokoban_Domain_Repository_BackendLayoutRepository
+ */
+ protected $backendLayoutRepository;
+ /**
+ * persistenceManager
+ *
+ * @var Tx_Extbase_Persistence_Manager
+ */
+ protected $persistenceManager;
+
+ /**
+ * injectPageRepository
+ *
+ * @param Tx_Sokoban_Domain_Repository_PageRepository $pageRepository
+ * @return void
+ */
+ public function injectPageRepository(Tx_Sokoban_Domain_Repository_PageRepository $pageRepository) {
+ $this->pageRepository = $pageRepository;
+ }
+ /**
+ * injectContentElementRepository
+ *
+ * @param Tx_Sokoban_Domain_Repository_ContentElementRepository $contentElementRepository
+ * @return void
+ */
+ public function injectContentElementRepository(Tx_Sokoban_Domain_Repository_ContentElementRepository $contentElementRepository) {
+ $this->contentElementRepository = $contentElementRepository;
+ }
+ /**
+ * injectBackendLayoutRepository
+ *
+ * @param Tx_Sokoban_Domain_Repository_BackendLayoutRepository $backendLayoutRepository
+ * @return void
+ */
+ public function injectBackendLayoutRepository(Tx_Sokoban_Domain_Repository_BackendLayoutRepository $backendLayoutRepository) {
+ $this->backendLayoutRepository = $backendLayoutRepository;
+ }
+ /**
+ * injectPersistenceManager
+ *
+ * @param Tx_Extbase_Persistence_ManagerInterface $persistenceManager
+ * @return void
+ */
+ public function injectPersistenceManager(Tx_Extbase_Persistence_ManagerInterface $persistenceManager) {
+ $this->persistenceManager = $persistenceManager;
+ }
+
+ /**
+ * action new
+ *
+ * @return string The rendered new action
+ */
+ public function newAction() {
+
+ }
+
+ /**
+ * action create
+ *
+ * @param integer $parentPageId
+ * @validate $parentPageId NotEmpty
+ * @validate $parentPageId Integer
+ * @param integer $limit
+ * @validate $limit Integer
+ * @return string The rendered create action
+ */
+ public function createAction($parentPageId, $limit=999) {
+ $levels = new SimpleXMLElement($this->processLevelFile());
+
+ $levelTitel = (String) $levels->Title;
+ $email = (String) $levels->Email;
+ $attributes = $levels->LevelCollection->attributes();
+ $copyright = (String) $attributes['Copyright'];
+
+ $parentPage = $this->pageRepository->findByUid($parentPageId);
+
+ $levelRootPage = new Tx_Sokoban_Domain_Model_Page();
+ $levelRootPage->setTitle($levelTitel);
+ $levelRootPage->setParentPage($parentPage);
+ $levelRootPage->setPid($parentPageId);
+ $this->pageRepository->add($levelRootPage);
+ $this->persistenceManager->persistAll();
+
+ $levelRootPageContent = new Tx_Sokoban_Domain_Model_ContentElement();
+ $levelRootPageContent->setTitle('Copyright: '.$copyright.' E-Mail: '.$email);
+ $levelRootPageContent->setCType('header');
+ $levelRootPageContent->setParentPage($levelRootPage);
+ $levelRootPageContent->setPid($levelRootPage->getUid());
+ $this->contentElementRepository->add($levelRootPageContent);
+ $this->persistenceManager->persistAll();
+
+ $i = 0;
+ foreach($levels->LevelCollection->Level as $level){
+ $colPos = 1;
+ if($i<$limit){
+ $levelPage = new Tx_Sokoban_Domain_Model_Page();
+ $levelPage->setTitle($levelTitel.' '.($i+1));
+ $levelPage->setParentPage($levelRootPage);
+ $levelPage->setPid($levelRootPage->getUid());
+ $this->pageRepository->add($levelPage);
+ $this->persistenceManager->persistAll();
+
+ $attributes = $level->attributes();
+ $height = (String) $attributes['Height'];
+ $width = (String) $attributes['Width'];
+ $backendLayoutConfig = '
+ backend_layout {
+ rowCount = '.$height.'
+ colCount = '.$width.'
+ rows {
+ ';
+ $colPosList = array();
+ for($r=1; $r<=$height; $r++){
+ $backendLayoutConfig .= '
+ '.$r.' {
+ columns {
+ ';
+ $rows = $level->children();
+ $rowString = (String) $rows->L[($r-1)];
+ $cols = str_split($rowString);
+ for($c=1; $c<=$width; $c++){
+ $backendLayoutConfig .= '
+ '.$c.' {
+ name = '.$r.' '.$c.'
+ colPos = '.$colPos.'
+ }
+ ';
+ $colPosList[] = $colPos;
+ $content = new Tx_Sokoban_Domain_Model_ContentElement();
+ $content->setTitle(($cols[($c-1)]?$cols[($c-1)]:' '));
+ $content->setCType('header');
+ $content->setColPos($colPos);
+ $content->setParentPage($levelPage);
+ $content->setPid($levelPage->getUid());
+ $this->contentElementRepository->add($content);
+ $this->persistenceManager->persistAll();
+
+ $colPos++;
+ }
+ $backendLayoutConfig .= '
+ }
+ }
+ ';
+ }
+ $backendLayoutConfig .= '
+ }
+ }
+ ';
+ $backendLayout = new Tx_Sokoban_Domain_Model_BackendLayout();
+ $backendLayout->setTitle($levelTitel.' '.($i+1));
+ $backendLayout->setConfig($backendLayoutConfig);
+ $backendLayout->setParentPage($levelPage);
+ $backendLayout->setPid($levelPage->getUid());
+ $this->backendLayoutRepository->add($backendLayout);
+ $this->persistenceManager->persistAll();
+
+ $levelPage->setTsConfig('
+ SOKOBAN.isLevel = 1
+ mod.SHARED.colPos_list = '.implode(',', $colPosList).'
+ ');
+ $levelPage->setBackendLayout($backendLayout);
+ $this->pageRepository->update($levelPage);
+ $this->persistenceManager->persistAll();
+ }
+ $i++;
+ }
+
+ $this->flashMessageContainer->add('Your new Page was created.');
+
+ $this->redirect('new');
+ }
+
+ public function processLevelFile(){
+ $levelFile = t3lib_div::upload_to_tempfile($_FILES['tx_sokoban_tools_sokobancreatesokobanlevels']['tmp_name']['levelFile']);
+
+ $levelFileContent = file_get_contents($levelFile);
+
+ t3lib_div::unlink_tempfile($levelFile);
+ return $levelFileContent;
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Classes/Domain/Model/BackendLayout.php b/Classes/Domain/Model/BackendLayout.php
new file mode 100755
index 0000000..1fd5c5d
--- /dev/null
+++ b/Classes/Domain/Model/BackendLayout.php
@@ -0,0 +1,127 @@
+
+*
+* 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 3 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!
+***************************************************************/
+
+
+/**
+ *
+ *
+ * @package sokoban
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ *
+ */
+class Tx_Sokoban_Domain_Model_BackendLayout extends Tx_Extbase_DomainObject_AbstractEntity {
+
+ /**
+ * title
+ *
+ * @var string
+ */
+ protected $title;
+
+ /**
+ * config
+ *
+ * @var string
+ */
+ protected $config;
+
+ /**
+ * parentPage
+ *
+ * @var Tx_Sokoban_Domain_Model_Page
+ */
+ protected $parentPage;
+
+ /**
+ * __construct
+ *
+ * @return void
+ */
+ public function __construct() {
+
+ }
+
+ /**
+ * Returns the title
+ *
+ * @return string $title
+ */
+ public function getTitle() {
+ return $this->title;
+ }
+
+ /**
+ * Sets the title
+ *
+ * @param string $title
+ * @return void
+ */
+ public function setTitle($title) {
+ $this->title = $title;
+ return $this;
+ }
+
+ /**
+ * Returns the config
+ *
+ * @return string $config
+ */
+ public function getConfig() {
+ return $this->config;
+ }
+
+ /**
+ * Sets the config
+ *
+ * @param string $config
+ * @return void
+ */
+ public function setConfig($config) {
+ $this->config = $config;
+ return $this;
+ }
+
+ /**
+ * Returns the parentPage
+ *
+ * @return Tx_Sokoban_Domain_Model_Page $parentPage
+ */
+ public function getParentPage() {
+ return $this->parentPage;
+ }
+
+ /**
+ * Sets the parentPage
+ *
+ * @param Tx_Sokoban_Domain_Model_Page $parentPage
+ * @return void
+ */
+ public function setParentPage(Tx_Sokoban_Domain_Model_Page $parentPage) {
+ $this->parentPage = $parentPage;
+ return $this;
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Classes/Domain/Model/ContentElement.php b/Classes/Domain/Model/ContentElement.php
new file mode 100755
index 0000000..902c826
--- /dev/null
+++ b/Classes/Domain/Model/ContentElement.php
@@ -0,0 +1,154 @@
+
+*
+* 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 3 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!
+***************************************************************/
+
+
+/**
+ *
+ *
+ * @package sokoban
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ *
+ */
+class Tx_Sokoban_Domain_Model_ContentElement extends Tx_Extbase_DomainObject_AbstractEntity {
+
+ /**
+ * title
+ *
+ * @var string
+ */
+ protected $title;
+
+ /**
+ * cType
+ *
+ * @var string
+ */
+ protected $cType;
+
+ /**
+ * colPos
+ *
+ * @var string
+ */
+ protected $colPos;
+
+ /**
+ * parentPage
+ *
+ * @var Tx_Sokoban_Domain_Model_Page
+ */
+ protected $parentPage;
+
+ /**
+ * __construct
+ *
+ * @return void
+ */
+ public function __construct() {
+
+ }
+
+ /**
+ * Returns the title
+ *
+ * @return string $title
+ */
+ public function getTitle() {
+ return $this->title;
+ }
+
+ /**
+ * Sets the title
+ *
+ * @param string $title
+ * @return void
+ */
+ public function setTitle($title) {
+ $this->title = $title;
+ return $this;
+ }
+
+ /**
+ * Returns the cType
+ *
+ * @return string $cType
+ */
+ public function getCType() {
+ return $this->cType;
+ }
+
+ /**
+ * Sets the cType
+ *
+ * @param string $cType
+ * @return void
+ */
+ public function setCType($cType) {
+ $this->cType = $cType;
+ return $this;
+ }
+
+ /**
+ * Returns the colPos
+ *
+ * @return string $colPos
+ */
+ public function getColPos() {
+ return $this->colPos;
+ }
+
+ /**
+ * Sets the colPos
+ *
+ * @param string $colPos
+ * @return void
+ */
+ public function setColPos($colPos) {
+ $this->colPos = $colPos;
+ return $this;
+ }
+
+ /**
+ * Returns the parentPage
+ *
+ * @return Tx_Sokoban_Domain_Model_Page $parentPage
+ */
+ public function getParentPage() {
+ return $this->parentPage;
+ }
+
+ /**
+ * Sets the parentPage
+ *
+ * @param Tx_Sokoban_Domain_Model_Page $parentPage
+ * @return void
+ */
+ public function setParentPage(Tx_Sokoban_Domain_Model_Page $parentPage) {
+ $this->parentPage = $parentPage;
+ return $this;
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Classes/Domain/Model/Page.php b/Classes/Domain/Model/Page.php
new file mode 100755
index 0000000..e94972d
--- /dev/null
+++ b/Classes/Domain/Model/Page.php
@@ -0,0 +1,154 @@
+
+*
+* 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 3 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!
+***************************************************************/
+
+
+/**
+ *
+ *
+ * @package sokoban
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ *
+ */
+class Tx_Sokoban_Domain_Model_Page extends Tx_Extbase_DomainObject_AbstractEntity {
+
+ /**
+ * title
+ *
+ * @var string
+ */
+ protected $title;
+
+ /**
+ * tsConfig
+ *
+ * @var string
+ */
+ protected $tsConfig;
+
+ /**
+ * parentPage
+ *
+ * @var Tx_Sokoban_Domain_Model_Page
+ */
+ protected $parentPage;
+
+ /**
+ * backendLayout
+ *
+ * @var Tx_Sokoban_Domain_Model_BackendLayout
+ */
+ protected $backendLayout;
+
+ /**
+ * __construct
+ *
+ * @return void
+ */
+ public function __construct() {
+
+ }
+
+ /**
+ * Returns the title
+ *
+ * @return string $title
+ */
+ public function getTitle() {
+ return $this->title;
+ }
+
+ /**
+ * Sets the title
+ *
+ * @param string $title
+ * @return void
+ */
+ public function setTitle($title) {
+ $this->title = $title;
+ return $this;
+ }
+
+ /**
+ * Returns the tsConfig
+ *
+ * @return string $tsConfig
+ */
+ public function getTsConfig() {
+ return $this->tsConfig;
+ }
+
+ /**
+ * Sets the tsConfig
+ *
+ * @param string $tsConfig
+ * @return void
+ */
+ public function setTsConfig($tsConfig) {
+ $this->tsConfig = $tsConfig;
+ return $this;
+ }
+
+ /**
+ * Returns the parentPage
+ *
+ * @return Tx_Sokoban_Domain_Model_Page $parentPage
+ */
+ public function getParentPage() {
+ return $this->parentPage;
+ }
+
+ /**
+ * Sets the parentPage
+ *
+ * @param Tx_Sokoban_Domain_Model_Page $parentPage
+ * @return void
+ */
+ public function setParentPage(Tx_Sokoban_Domain_Model_Page $parentPage) {
+ $this->parentPage = $parentPage;
+ return $this;
+ }
+
+ /**
+ * Returns the backendLayout
+ *
+ * @return Tx_Sokoban_Domain_Model_BackendLayout $backendLayout
+ */
+ public function getBackendLayout() {
+ return $this->backendLayout;
+ }
+
+ /**
+ * Sets the backendLayout
+ *
+ * @param Tx_Sokoban_Domain_Model_BackendLayout $backendLayout
+ * @return void
+ */
+ public function setBackendLayout(Tx_Sokoban_Domain_Model_BackendLayout $backendLayout) {
+ $this->backendLayout = $backendLayout;
+ return $this;
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Classes/Domain/Repository/BackendLayoutRepository.php b/Classes/Domain/Repository/BackendLayoutRepository.php
new file mode 100644
index 0000000..54d9414
--- /dev/null
+++ b/Classes/Domain/Repository/BackendLayoutRepository.php
@@ -0,0 +1,37 @@
+
+*
+* 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 3 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!
+***************************************************************/
+
+
+/**
+ *
+ *
+ * @package sokoban
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ *
+ */
+class Tx_Sokoban_Domain_Repository_BackendLayoutRepository extends Tx_Extbase_Persistence_Repository {
+
+}
+?>
\ No newline at end of file
diff --git a/Classes/Domain/Repository/ContentElementRepository.php b/Classes/Domain/Repository/ContentElementRepository.php
new file mode 100644
index 0000000..6f80483
--- /dev/null
+++ b/Classes/Domain/Repository/ContentElementRepository.php
@@ -0,0 +1,37 @@
+
+*
+* 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 3 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!
+***************************************************************/
+
+
+/**
+ *
+ *
+ * @package sokoban
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ *
+ */
+class Tx_Sokoban_Domain_Repository_ContentElementRepository extends Tx_Extbase_Persistence_Repository {
+
+}
+?>
\ No newline at end of file
diff --git a/Classes/Domain/Repository/PageRepository.php b/Classes/Domain/Repository/PageRepository.php
new file mode 100755
index 0000000..3806e40
--- /dev/null
+++ b/Classes/Domain/Repository/PageRepository.php
@@ -0,0 +1,37 @@
+
+*
+* 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 3 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!
+***************************************************************/
+
+
+/**
+ *
+ *
+ * @package sokoban
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ *
+ */
+class Tx_Sokoban_Domain_Repository_PageRepository extends Tx_Extbase_Persistence_Repository {
+
+}
+?>
\ No newline at end of file
diff --git a/Classes/Hooks/class.tx_sokoban_cmslayout.php b/Classes/Hooks/class.tx_sokoban_cmslayout.php
new file mode 100644
index 0000000..1be7813
--- /dev/null
+++ b/Classes/Hooks/class.tx_sokoban_cmslayout.php
@@ -0,0 +1,215 @@
+
+*
+* 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 3 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!
+***************************************************************/
+
+
+/**
+ *
+ *
+ * @package sokoban
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ *
+ */
+class tx_sokoban_cmslayout implements tx_cms_layout_tt_content_drawItemHook {
+ var $pObj;
+ /**
+ * Preprocesses the preview rendering of a content element.
+ *
+ * @param tx_cms_layout $parentObject: Calling parent object
+ * @param boolean $drawItem: Whether to draw the item using the default functionalities
+ * @param string $headerContent: Header content
+ * @param string $itemContent: Item content
+ * @param array $row: Record row of tt_content
+ * @return void
+ */
+ public function preProcess(tx_cms_layout &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row){
+ $this->pObj = $parentObject;
+ $tsParser = new t3lib_TSparser();
+ $tsParser->parse($parentObject->pageRecord['TSconfig']);
+ $pageTSconfig = $tsParser->setup;
+ if($pageTSconfig['SOKOBAN.']['isLevel']==1){
+ if($row['colPos']==1){
+ $GLOBALS['SOBE']->doc->JScodeLibArray[] = '';
+ $GLOBALS['SOBE']->doc->styleSheetFile2 = $GLOBALS['BACK_PATH'].'../typo3conf/ext/sokoban/Resources/Public/Css/sokoban.css';
+ if(t3lib_div::_GP('sokobanSkipAnimation')==1){
+ $GLOBALS['SOBE']->doc->JScodeLibArray[] = '';
+ }
+ }
+ if($row['header'] == '@' || $row['header'] == '+'){//player
+ $controls = $this->letTheDragonsFly($row);
+ $GLOBALS['SOBE']->doc->JScodeLibArray[] = '';
+ }
+ }
+ }
+
+ public function letTheDragonsFly($row){
+ $tsParser = new t3lib_TSparser();
+ $backendLayoutRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'backend_layout', 'pid='.$row['pid']);
+ $tsParser->parse($backendLayoutRecord[0]['config']);
+ $backendLayout = $tsParser->setup;
+ $player['x'] = $row['colPos'] % $backendLayout['backend_layout.']['colCount'];
+ $player['y'] = ceil($row['colPos'] / $backendLayout['backend_layout.']['colCount']);
+ $player['row'] = array(
+ 'uid' => $row['uid'],
+ 'pid' => $row['pid'],
+ 'colPos' => $row['colPos'],
+ 'header' => $row['header'],
+ );
+ $move['up'] = array();
+ $this->createMove($player, 'up', $backendLayout, $move['up']);
+ $move['right'] = array();
+ $this->createMove($player, 'right', $backendLayout, $move['right']);
+ $move['down'] = array();
+ $this->createMove($player, 'down', $backendLayout, $move['down']);
+ $move['left'] = array();
+ $this->createMove($player, 'left', $backendLayout, $move['left']);
+ //t3lib_div::debug($move);
+ return $this->createControls($move);
+ }
+ public function createControls($moves){
+ $controls = '';
+
+ if(t3lib_div::_GP('sokobanSkipAnimation')!=1){
+ $controls .= '
';
+ return $controls;
+ }
+ public function createMove($field, $direction, $backendLayout, &$updatedFields){
+ $neighbourCoords = $this->getNeighbourCoords($field, $direction);
+ if($neighbourCoords['x']>0
+ && $neighbourCoords['x']<=$backendLayout['backend_layout.']['colCount']
+ && $neighbourCoords['y']>0
+ && $neighbourCoords['y']<=$backendLayout['backend_layout.']['rowCount']){//nachbarfeld ist im spielfeld
+ $neighbourField = $this->getField($neighbourCoords, $backendLayout);
+ if($neighbourField['row']['header']!='#'){//nachbarfeld ist keine wand
+ $fieldHeader = $field['row']['header'];
+ $neighbourFieldHeader = $neighbourField['row']['header'];
+ $field['row']['header'] = $this->createFieldType($fieldHeader, ' ');
+ $neighbourField['row']['header'] = $this->createFieldType($neighbourFieldHeader, $fieldHeader);
+ $updatedFields[$field['row']['uid']] = $field;
+ $updatedFields[$neighbourField['row']['uid']] = $neighbourField;
+
+ if($neighbourFieldHeader=='$'
+ || $neighbourFieldHeader=='*'){//nachbarfeld ist eine box
+ $nextNeighbourCoords = $this->getNeighbourCoords($neighbourField, $direction);
+ $nextNeighbourField = $this->getField($nextNeighbourCoords, $backendLayout);
+ if($nextNeighbourField['row']['header']!='#'//next nachbarfeld ist keine wand
+ && ($nextNeighbourField['row']['header']!='$'
+ && $nextNeighbourField['row']['header']!='*')){//next nachbarfeld ist keine box
+ $nextNeighbourFieldHeader = $nextNeighbourField['row']['header'];
+ $nextNeighbourField['row']['header'] = $this->createFieldType($nextNeighbourFieldHeader, $neighbourFieldHeader);
+ $updatedFields[$nextNeighbourField['row']['uid']] = $nextNeighbourField;
+ } else {
+ $updatedFields = array();
+ }
+ }
+ } else {
+ $updatedFields = array();
+ }
+ } else {
+ $updatedFields = array();
+ }
+ }
+ public function createFieldType($field, $overlay){
+ if($overlay == '@' || $overlay == '+'){
+ if($field == '.' || $field == '*'){
+ $fieldType = '+';
+ } elseif($field == ' ' || $field == '$'){
+ $fieldType = '@';
+ }
+ } elseif($overlay == '$' || $overlay == '*'){
+ if($field == '.'){
+ $fieldType = '*';
+ } elseif($field == ' '){
+ $fieldType = '$';
+ }
+ } elseif($overlay == ' '){
+ if($field == '@'){
+ $fieldType = ' ';
+ } elseif($field == '+'){
+ $fieldType = '.';
+ }
+ }
+ return $fieldType;
+ }
+ public function getNeighbourCoords($field, $direction){
+ switch($direction){
+ case 'up':
+ $neighbourCoords['x'] = $field['x'];
+ $neighbourCoords['y'] = $field['y']-1;
+ break;
+ case 'right':
+ $neighbourCoords['x'] = $field['x']+1;
+ $neighbourCoords['y'] = $field['y'];
+ break;
+ case 'down':
+ $neighbourCoords['x'] = $field['x'];
+ $neighbourCoords['y'] = $field['y']+1;
+ break;
+ case 'left':
+ $neighbourCoords['x'] = $field['x']-1;
+ $neighbourCoords['y'] = $field['y'];
+ break;
+ }
+ return $neighbourCoords;
+ }
+ public function getField($coords, $backendLayout){
+ $colPos = (($coords['y']-1) * $backendLayout['backend_layout.']['colCount'])+$coords['x'];
+ $fieldRow = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,pid,colPos,header', 'tt_content', 'colPos='.$colPos.' AND pid='.$this->pObj->id);
+ //t3lib_div::debug($fieldRow);
+ return array('x'=>$coords['x'], 'y'=>$coords['y'], 'row'=>$fieldRow[0]);
+ }
+}
+?>
\ No newline at end of file
diff --git a/Configuration/ExtensionBuilder/settings.yaml b/Configuration/ExtensionBuilder/settings.yaml
new file mode 100755
index 0000000..0904d98
--- /dev/null
+++ b/Configuration/ExtensionBuilder/settings.yaml
@@ -0,0 +1,95 @@
+#
+# Extension Builder settings for extension sokoban
+# generated 2011-08-11
+#
+# See http://www.yaml.org/spec/1.2/spec.html
+#
+
+---
+
+########### Overwrite settings ###########
+#
+# These settings only apply, if the roundtrip feature of the extension builder
+# is enabled in the extension manager
+#
+# Usage:
+# nesting reflects the file structure
+# a setting applies to a file or recursive to all files and subfolders
+#
+# merge:
+# means for classes: All properties ,methods and method bodies
+# of the existing class will be modified according to the new settings
+# but not overwritten
+#
+# for locallang xml files: Existing keys and labels are always
+# preserved (renaming in the GUI has only influence on the property and method names)
+#
+# for other files: You will find a Split token at the end of the file
+# After this token you can write whatever you want and it will be appended
+# everytime the code is generated
+#
+# keep:
+# files are never overwritten
+# These settings may break the functionality of the extension builder!
+# Handle with care!
+#
+#
+
+############ extension settings ##############
+
+emConf:
+ dependencies: cms,extbase,fluid
+
+overwriteSettings:
+ Classes:
+ Controller: merge
+ Domain:
+ Model: merge
+ Repository: merge
+
+ Configuration:
+ #TCA: merge
+ #TypoScript: keep
+
+ Resources:
+ Private:
+ Language:
+ #locallang.xml: merge
+ #Templates: keep
+
+ ext_icon.gif: keep
+
+# ext_localconf.php: merge
+
+# ext_tables.php: merge
+
+# ext_tables.sql: merge
+
+## ext_autoload.php is only needed in special cases ##
+createAutoloadRegistry: false
+
+######### settings for classBuilder #############################
+#
+# here you may define default parent classes for your classes
+# these settings only apply for new generated classes
+# you may also just change the parent class in the generated class file.
+# It will be kept on next code generation, if the overwrite settings
+# are configured to merge it
+#
+# Experimental!!
+#################################################################
+
+classBuilder:
+
+ Controller:
+ parentClass: Tx_Extbase_MVC_Controller_ActionController
+
+ Model:
+ AbstractEntity:
+ parentClass: Tx_Extbase_DomainObject_AbstractEntity
+
+ AbstractValueObject:
+ parentClass: Tx_Extbase_DomainObject_AbstractValueObject
+
+ Repository:
+ parentClass: Tx_Extbase_Persistence_Repository
\ No newline at end of file
diff --git a/Configuration/TypoScript/constants.txt b/Configuration/TypoScript/constants.txt
new file mode 100755
index 0000000..80b0292
--- /dev/null
+++ b/Configuration/TypoScript/constants.txt
@@ -0,0 +1,14 @@
+module.tx_sokoban {
+ view {
+ # cat=module.tx_sokoban/file; type=string; label=Path to template root (BE)
+ templateRootPath = EXT:sokoban/Resources/Private/Backend/Templates/
+ # cat=module.tx_sokoban/file; type=string; label=Path to template partials (BE)
+ partialRootPath = EXT:sokoban/Resources/Private/Backend/Partials/
+ # cat=module.tx_sokoban/file; type=string; label=Path to template layouts (BE)
+ layoutRootPath = EXT:sokoban/Resources/Private/Backend/Layouts/
+ }
+ persistence {
+ # cat=module.tx_sokoban//a; type=int+; label=Default storage PID
+ storagePid = 0
+ }
+}
\ No newline at end of file
diff --git a/Configuration/TypoScript/setup.txt b/Configuration/TypoScript/setup.txt
new file mode 100755
index 0000000..7d1b54d
--- /dev/null
+++ b/Configuration/TypoScript/setup.txt
@@ -0,0 +1,48 @@
+# Module configuration
+module.tx_sokoban {
+ persistence {
+ storagePid = {$module.tx_sokoban.persistence.storagePid}
+ classes {
+ Tx_Sokoban_Domain_Model_Page {
+ newRecordStoragePid = {$module.tx_sokoban.persistence.storagePid}
+ mapping {
+ tableName = pages
+ columns {
+ title.mapOnProperty = title
+ TSconfig.mapOnProperty = tsConfig
+ pid.mapOnProperty = parentPage
+ backend_layout.mapOnProperty = backendLayout
+ }
+ }
+ }
+ Tx_Sokoban_Domain_Model_ContentElement {
+ newRecordStoragePid = {$module.tx_sokoban.persistence.storagePid}
+ mapping {
+ tableName = tt_content
+ columns {
+ header.mapOnProperty = title
+ CType.mapOnProperty = cType
+ colPos.mapOnProperty = colPos
+ pid.mapOnProperty = parentPage
+ }
+ }
+ }
+ Tx_Sokoban_Domain_Model_BackendLayout {
+ newRecordStoragePid = {$module.tx_sokoban.persistence.storagePid}
+ mapping {
+ tableName = backend_layout
+ columns {
+ title.mapOnProperty = title
+ config.mapOnProperty = config
+ pid.mapOnProperty = parentPage
+ }
+ }
+ }
+ }
+ }
+ view {
+ templateRootPath = {$module.tx_sokoban.view.templateRootPath}
+ partialRootPath = {$module.tx_sokoban.view.partialRootPath}
+ layoutRootPath = {$module.tx_sokoban.view.layoutRootPath}
+ }
+}
\ No newline at end of file
diff --git a/ExtensionBuilder.json b/ExtensionBuilder.json
new file mode 100755
index 0000000..0577c51
--- /dev/null
+++ b/ExtensionBuilder.json
@@ -0,0 +1 @@
+{"modules":[{"config":{"position":[16,56]},"name":"New Model Object","value":{"actionGroup":{"actions":["create"]},"name":"Page","objectsettings":{"aggregateRoot":true,"description":"","type":"Entity","uid":"624779408684"},"propertyGroup":{"properties":[{"propertyDescription":"","propertyIsExcludeField":false,"propertyIsRequired":false,"propertyName":"title","propertyType":"String","uid":"26917979526"},{"propertyDescription":"","propertyIsExcludeField":false,"propertyIsRequired":false,"propertyName":"tsConfig","propertyType":"Text","uid":"14184745947"}]},"relationGroup":{"relations":[{"advancedSettings":{"inlineEditing":false,"lazyLoading":true,"propertyIsExcludeField":false,"relationDescription":"","relationType":"zeroToOne"},"relationName":"parentPage","relationWire":"[wired]","uid":"1080414201811","inlineEditing":false,"lazyLoading":true,"propertyIsExcludeField":false,"relationDescription":"","relationType":"zeroToOne"},{"advancedSettings":{"inlineEditing":false,"lazyLoading":true,"propertyIsExcludeField":false,"relationDescription":"","relationType":"zeroToOne"},"relationName":"backendLayout","relationWire":"[wired]","uid":"51657990858","inlineEditing":false,"lazyLoading":true,"propertyIsExcludeField":false,"relationDescription":"","relationType":"zeroToOne"}]}}},{"config":{"position":[16,1019]},"name":"New Model Object","value":{"actionGroup":{"actions":[]},"name":"BackendLayout","objectsettings":{"aggregateRoot":false,"description":"","type":"Entity","uid":"1005810083114"},"propertyGroup":{"properties":[{"propertyDescription":"","propertyIsExcludeField":false,"propertyIsRequired":false,"propertyName":"title","propertyType":"String","uid":"336721276421"},{"propertyDescription":"","propertyIsExcludeField":false,"propertyIsRequired":false,"propertyName":"config","propertyType":"String","uid":"664874820703"}]},"relationGroup":{"relations":[{"advancedSettings":{"inlineEditing":false,"lazyLoading":true,"propertyIsExcludeField":false,"relationDescription":"","relationType":"zeroToOne"},"relationName":"parentPage","relationWire":"[wired]","uid":"940961563104","inlineEditing":false,"lazyLoading":true,"propertyIsExcludeField":false,"relationDescription":"","relationType":"zeroToOne"}]}}},{"config":{"position":[375,78]},"name":"New Model Object","value":{"actionGroup":{"actions":[]},"name":"ContentElement","objectsettings":{"aggregateRoot":false,"description":"","type":"Entity","uid":"842570599920"},"propertyGroup":{"properties":[{"propertyDescription":"","propertyIsExcludeField":false,"propertyIsRequired":false,"propertyName":"title","propertyType":"String","uid":"781062075285"}]},"relationGroup":{"relations":[{"advancedSettings":{"inlineEditing":false,"lazyLoading":true,"propertyIsExcludeField":false,"relationDescription":"","relationType":"zeroToOne"},"relationName":"parentPage","relationWire":"[wired]","uid":"1202234897139","inlineEditing":false,"lazyLoading":true,"propertyIsExcludeField":false,"relationDescription":"","relationType":"zeroToOne"}]}}}],"properties":{"backendModules":[{"description":"","key":"createSokobanLevels","mainModule":"tools","name":"Create Sokoban Levels","tabLabel":"Create Sokoban Levels"}],"description":"Play Sokoban in TYPO3","extensionKey":"sokoban","name":"Sokoban","originalExtensionKey":"","persons":[{"company":"","email":"mail@marco-huber.de","name":"Marco Huber","role":"Developer"}],"plugins":[],"state":"alpha","version":""},"wires":[{"src":{"moduleId":0,"terminal":"relationWire_0","uid":"1080414201811"},"tgt":{"moduleId":0,"terminal":"SOURCES","uid":"624779408684"}},{"src":{"moduleId":0,"terminal":"relationWire_1","uid":"51657990858"},"tgt":{"moduleId":1,"terminal":"SOURCES","uid":"1005810083114"}},{"src":{"moduleId":1,"terminal":"relationWire_0","uid":"940961563104"},"tgt":{"moduleId":0,"terminal":"SOURCES","uid":"624779408684"}},{"src":{"moduleId":2,"terminal":"relationWire_0","uid":"1202234897139"},"tgt":{"moduleId":0,"terminal":"SOURCES","uid":"624779408684"}}],"log":{"last_modified":"2011-08-11 09:00","extension_builder_version":"1.0","be_user":"Marco Huber (2)"}}
\ No newline at end of file
diff --git a/Resources/Private/.htaccess b/Resources/Private/.htaccess
new file mode 100755
index 0000000..dfc0272
--- /dev/null
+++ b/Resources/Private/.htaccess
@@ -0,0 +1 @@
+deny from all
\ No newline at end of file
diff --git a/Resources/Private/Backend/Layouts/Default.html b/Resources/Private/Backend/Layouts/Default.html
new file mode 100755
index 0000000..44c759a
--- /dev/null
+++ b/Resources/Private/Backend/Layouts/Default.html
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Resources/Private/Backend/Partials/FormErrors.html b/Resources/Private/Backend/Partials/FormErrors.html
new file mode 100755
index 0000000..3602f09
--- /dev/null
+++ b/Resources/Private/Backend/Partials/FormErrors.html
@@ -0,0 +1,13 @@
+
+
+
\ No newline at end of file
diff --git a/Resources/Private/Backend/Partials/Page/FormFields.html b/Resources/Private/Backend/Partials/Page/FormFields.html
new file mode 100755
index 0000000..b6ad364
--- /dev/null
+++ b/Resources/Private/Backend/Partials/Page/FormFields.html
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/Resources/Private/Backend/Templates/Page/New.html b/Resources/Private/Backend/Templates/Page/New.html
new file mode 100755
index 0000000..ba6e51e
--- /dev/null
+++ b/Resources/Private/Backend/Templates/Page/New.html
@@ -0,0 +1,42 @@
+
+
+This template displays a NEW form for the current domain object.
+
+If you modify this template, do not forget to change the overwrite settings
+in /Configuration/ExtensionBuilder/settings.yaml:
+ Resources:
+ Private:
+ Templates:
+ New.html: keep
+
+Otherwise your changes will be overwritten the next time you save the extension in the extension builder
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Resources/Private/Language/locallang.xml b/Resources/Private/Language/locallang.xml
new file mode 100755
index 0000000..0962c4d
--- /dev/null
+++ b/Resources/Private/Language/locallang.xml
@@ -0,0 +1,20 @@
+
+
+
+ module
+ Language labels for the Sokoban extension in the FRONTEND
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Resources/Private/Language/locallang_createsokobanlevels.xml b/Resources/Private/Language/locallang_createsokobanlevels.xml
new file mode 100755
index 0000000..b322850
--- /dev/null
+++ b/Resources/Private/Language/locallang_createsokobanlevels.xml
@@ -0,0 +1,14 @@
+
+
+
+ module
+ Language labels for backend module Create Sokoban Levels belonging to extension 'sokoban'
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Resources/Private/Language/locallang_csh_tx_sokoban_domain_model_backendlayout.xml b/Resources/Private/Language/locallang_csh_tx_sokoban_domain_model_backendlayout.xml
new file mode 100755
index 0000000..5773855
--- /dev/null
+++ b/Resources/Private/Language/locallang_csh_tx_sokoban_domain_model_backendlayout.xml
@@ -0,0 +1,15 @@
+
+
+
+ Context Sensitive Help (CSH) for table tx_sokoban_domain_model_backendlayout
+ CSH
+ tx_sokoban_domain_model_backendlayout
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Resources/Private/Language/locallang_csh_tx_sokoban_domain_model_contentelement.xml b/Resources/Private/Language/locallang_csh_tx_sokoban_domain_model_contentelement.xml
new file mode 100755
index 0000000..0d739e8
--- /dev/null
+++ b/Resources/Private/Language/locallang_csh_tx_sokoban_domain_model_contentelement.xml
@@ -0,0 +1,14 @@
+
+
+
+ Context Sensitive Help (CSH) for table tx_sokoban_domain_model_contentelement
+ CSH
+ tx_sokoban_domain_model_contentelement
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Resources/Private/Language/locallang_csh_tx_sokoban_domain_model_page.xml b/Resources/Private/Language/locallang_csh_tx_sokoban_domain_model_page.xml
new file mode 100755
index 0000000..1e9769b
--- /dev/null
+++ b/Resources/Private/Language/locallang_csh_tx_sokoban_domain_model_page.xml
@@ -0,0 +1,16 @@
+
+
+
+ Context Sensitive Help (CSH) for table tx_sokoban_domain_model_page
+ CSH
+ tx_sokoban_domain_model_page
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Resources/Private/Language/locallang_db.xml b/Resources/Private/Language/locallang_db.xml
new file mode 100755
index 0000000..4e91cfe
--- /dev/null
+++ b/Resources/Private/Language/locallang_db.xml
@@ -0,0 +1,23 @@
+
+
+
+ database
+ Language labels for database tables/fields belonging to extension 'sokoban'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Resources/Public/Css/sokoban.css b/Resources/Public/Css/sokoban.css
new file mode 100644
index 0000000..aba74aa
--- /dev/null
+++ b/Resources/Public/Css/sokoban.css
@@ -0,0 +1,111 @@
+table.t3-page-columns,
+table.t3-gridTable {
+ width: auto;
+}
+.sokoban-skip-animation td.t3-gridCell,
+.sokoban-skip-animation td.t3-page-column {
+ max-width: 50px; min-width: 50px; overflow: hidden;
+}
+.sokoban-skip-animation td.t3-page-colHeader,
+.sokoban-skip-animation td.t3-row-header {
+ max-width: 50px; min-width: 50px; overflow: hidden;
+}
+.sokoban-skip-animation div.t3-page-colHeader,
+.sokoban-skip-animation div.t3-row-header {
+ margin: 0; padding: 0; width: 0; height: 0;
+}
+.sokoban-skip-animation div.t3-page-colHeader-icons {
+ opacity: 1; visibility: hidden; display: none;
+}
+.sokoban-skip-animation div.t3-page-colHeader-label {
+ opacity: 1; visibility: hidden; display: none;
+}
+.sokoban-skip-animation td.t3-gridCell div.t3-page-ce {
+ margin: 0; padding: 0;
+}
+.sokoban-skip-animation h4.t3-page-ce-header {
+ opacity: 1; visibility: hidden; display: none;
+}
+.sokoban-skip-animation div.t3-page-ce-body {
+ margin: 0; padding: 0; width: 50px; height: 50px;
+}
+.sokoban-skip-animation div.t3-page-ce div.t3-page-ce-type {
+ opacity: 1; visibility: hidden; display: none;
+}
+div.t3-page-ce div.sokoban-free,
+div.t3-page-ce.active div.sokoban-free {
+ background-color: transparent;
+}
+div.t3-page-ce div.sokoban-wall,
+div.t3-page-ce.active div.sokoban-wall {
+ background-color: #FF0000;
+}
+div.t3-page-ce div.sokoban-player,
+div.t3-page-ce.active div.sokoban-player {
+ background-color: #0000FF;
+}
+div.t3-page-ce div.sokoban-playergoal,
+div.t3-page-ce.active div.sokoban-playergoal {
+ background-color: #00AA99;
+}
+div.t3-page-ce div.sokoban-box,
+div.t3-page-ce.active div.sokoban-box {
+ background-color: #FFCC00;
+}
+div.t3-page-ce div.sokoban-boxgoal,
+div.t3-page-ce.active div.sokoban-boxgoal {
+ background-color: #00CC00;
+}
+div.t3-page-ce div.sokoban-goal,
+div.t3-page-ce.active div.sokoban-goal {
+ background-color: #CCFFCC;
+}
+
+.sokoban-left {
+ float: left;
+}
+.sokoban-right {
+ float: right;
+}
+.sokoban-clearfix:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;}
+.sokoban-clearfix {display:block;}
+
+#sokoban-controls {
+ width: 120px;
+}
+#sokoban-legend {
+ width: 110px;
+}
+#sokoban-legend div {
+ text-align: center;
+}
+
+#sokoban-controller {
+ position: relative;
+ width: 110px;
+ height: 110px;
+}
+#sokoban-controller a {
+ position: absolute;
+ display: block;
+ width: 30px;
+ height: 30px;
+ background-color: #7F7F7F;
+ text-align: center;
+}
+#sokoban-controller a.sokoban-controls-up {
+ top: 20px;
+ left: 40px;
+}
+#sokoban-controller a.sokoban-controls-right {
+ top: 50px;
+ right: 10px;
+}
+#sokoban-controller a.sokoban-controls-down {
+ bottom: 0;
+ left: 40px;
+}
+#sokoban-controller a.sokoban-controls-left {
+ top: 50px;
+ left: 10px;
+}
\ No newline at end of file
diff --git a/Resources/Public/Icons/relation.gif b/Resources/Public/Icons/relation.gif
new file mode 100755
index 0000000..db61d7e
Binary files /dev/null and b/Resources/Public/Icons/relation.gif differ
diff --git a/Resources/Public/Icons/tx_sokoban_domain_model_backendlayout.gif b/Resources/Public/Icons/tx_sokoban_domain_model_backendlayout.gif
new file mode 100755
index 0000000..37ba37b
Binary files /dev/null and b/Resources/Public/Icons/tx_sokoban_domain_model_backendlayout.gif differ
diff --git a/Resources/Public/Icons/tx_sokoban_domain_model_contentelement.gif b/Resources/Public/Icons/tx_sokoban_domain_model_contentelement.gif
new file mode 100755
index 0000000..37ba37b
Binary files /dev/null and b/Resources/Public/Icons/tx_sokoban_domain_model_contentelement.gif differ
diff --git a/Resources/Public/Icons/tx_sokoban_domain_model_page.gif b/Resources/Public/Icons/tx_sokoban_domain_model_page.gif
new file mode 100755
index 0000000..6cc5f16
Binary files /dev/null and b/Resources/Public/Icons/tx_sokoban_domain_model_page.gif differ
diff --git a/Resources/Public/Javascript/sokoban.js b/Resources/Public/Javascript/sokoban.js
new file mode 100644
index 0000000..001a748
--- /dev/null
+++ b/Resources/Public/Javascript/sokoban.js
@@ -0,0 +1,184 @@
+var sokobanSkipAnimation,
+ sokobanControls,
+ gridTable,
+ gridCell,
+ ceBody,
+ rowHeader,
+ colHeader,
+ colHeaderIcons,
+ colHeaderLabel,
+ contentElement,
+ contentElementHeader,
+ contentElementType;
+function getBackgroundColor(){
+ ceBody.select('div strong a').each(function(element){
+ ceBodyContent = element;
+ ceBodyContent.setStyle('display', 'none');
+ ceBodyContentText = Ext.getDom(ceBodyContent).innerHTML;
+ switch(ceBodyContentText){
+ case '#': //Wall
+ cssclass = 'sokoban-wall';
+ break;
+ case '@': //Player
+ case '+': //Player on goal
+ if(ceBodyContentText == '@'){
+ cssclass = 'sokoban-player';
+ } else {
+ cssclass = 'sokoban-playergoal';
+ }
+ break;
+ case '$': //Box
+ cssclass = 'sokoban-box';
+ break;
+ case '*': //Box on goal
+ cssclass = 'sokoban-boxgoal';
+ break;
+ case '.': //Goal
+ cssclass = 'sokoban-goal';
+ break;
+ default: //Free
+ cssclass = 'sokoban-free';
+ break;
+ }
+ });
+ return cssclass;
+}
+function cleanLayoutRecursive(gridCell){
+ if(sokobanSkipAnimation == 1){
+ cleanLayout();
+ } else {
+ gridCell.select('.t3-page-colHeader-label').each(function(element){
+ colHeaderLabel = element;
+ colHeaderLabel.hide({
+ duration: 0,
+ callback: function(){
+ colHeaderLabel.setStyle('display', 'none');
+ }
+ });
+ });
+ gridCell.select('.t3-page-colHeader-icons').each(function(element){
+ colHeaderIcons = element;
+ colHeaderIcons.hide({
+ duration: 0,
+ callback: function(){
+ colHeaderIcons.setStyle('display', 'none');
+ gridCell.select('.t3-page-rowHeader').each(function(element){
+ rowHeader = element;
+ rowHeader.setStyle('margin', 0);
+ rowHeader.setStyle('padding', 0);
+ rowHeader.setStyle('width', 0);
+ rowHeader.setStyle('height', 0);
+ });
+ gridCell.select('.t3-page-colHeader').each(function(element){
+ colHeader = element;
+ colHeader.setStyle('margin', 0);
+ colHeader.setStyle('padding', 0);
+ colHeader.animate(
+ {
+ width: {to: 0, from: colHeader.getWidth()},
+ height: {to: 0, from: colHeader.getHeight()}
+ },
+ 0,
+ function(){
+ colHeader.setStyle('width', 0);
+ colHeader.setStyle('height', 0);
+ },
+ 'easeOut',
+ 'run'
+ );
+ });
+
+ }
+ });
+ });
+ gridCell.select('.t3-page-ce').each(function(element){
+ contentElement = element;
+ contentElement.setStyle('margin', 0);
+ contentElement.setStyle('padding', 0);
+ });
+ gridCell.select('.t3-page-ce-header').each(function(element){
+ contentElementHeader = element;
+ contentElementHeader.hide({
+ duration: 0,
+ callback: function(){
+ contentElementHeader.setStyle('display', 'none');
+ }
+ });
+ });
+ gridCell.select('.t3-page-ce-type').each(function(element){
+ contentElementType = element;
+ contentElementType.hide({
+ duration: 0,
+ callback: function(){
+ contentElementType.setStyle('display', 'none');
+ gridCell.select('.t3-page-ce-body').each(function(element){
+ ceBody = element;
+ ceBody.setStyle('margin', 0);
+ ceBody.setStyle('padding', 0);
+ ceBody.animate(
+ {
+ width: {to: 50, from: ceBody.getHeight()},
+ height: {to: 50, from: ceBody.getHeight()}
+ },
+ 0,
+ function(){
+ ceBody.addClass(getBackgroundColor());
+ gridCell.setStyle('maxWidth', '50px');
+ gridCell.setStyle('minWidth', '50px');
+ gridCell.setStyle('width', 50);
+ gridCell.setStyle('height', 50);
+ gridCell.setStyle('overflow', 'hidden');
+ if(Ext.get(gridCell).next('.t3-gridCell')){
+ cleanLayoutRecursive(Ext.get(gridCell).next('.t3-gridCell'));
+ } else {
+ if(Ext.get(gridCell).parent('tr').next('tr')){
+ Ext.get(gridCell).parent('tr').next('tr').select('.t3-gridCell:first').each(function(element){
+ cleanLayoutRecursive(element);
+ });
+ }
+ }
+ },
+ 'easeOut',
+ 'run'
+ );
+ });
+ }
+ });
+ });
+ }
+}
+function cleanLayout(){
+ Ext.select('.t3-gridTable').each(function(element){
+ gridTable = element;
+ gridTable.setStyle('width', 'auto');
+ gridTable.setStyle('height', 'auto');
+ if(sokobanSkipAnimation == 1){
+ gridTable.addClass('sokoban-skip-animation');
+ Ext.select('.t3-page-ce-body').each(function(element){
+ ceBody = element;
+ ceBody.addClass(getBackgroundColor());
+ });
+ } else {
+ element.select('.t3-gridCell:first').each(function(element){
+ gridCell = element;
+ cleanLayoutRecursive(gridCell);
+ });
+ }
+
+ });
+}
+function addControls(){
+ Ext.select('.t3-gridTable').each(function(element){
+ element.addClass('sokoban-left');
+ element.parent('.t3-gridContainer').addClass('sokoban-clearfix');
+
+ Ext.DomHelper.insertBefore(element, {tag: 'div', id: 'sokoban-controls', class: 't3-page-ce'});
+ Ext.getDom('sokoban-controls').innerHTML = sokobanControls;
+ Ext.get('sokoban-controls').addClass('sokoban-left');
+ });
+}
+
+Ext.onReady(function() {
+ addControls();
+ cleanLayout();
+});
\ No newline at end of file
diff --git a/Tests/Unit/Domain/Model/BackendLayoutTest.php b/Tests/Unit/Domain/Model/BackendLayoutTest.php
new file mode 100755
index 0000000..160aceb
--- /dev/null
+++ b/Tests/Unit/Domain/Model/BackendLayoutTest.php
@@ -0,0 +1,112 @@
+
+*
+* 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!
+***************************************************************/
+
+/**
+ * Test case for class Tx_Sokoban_Domain_Model_BackendLayout.
+ *
+ * @version $Id$
+ * @copyright Copyright belongs to the respective authors
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
+ *
+ * @package TYPO3
+ * @subpackage Sokoban
+ *
+ * @author Marco Huber
+ */
+class Tx_Sokoban_Domain_Model_BackendLayoutTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
+ /**
+ * @var Tx_Sokoban_Domain_Model_BackendLayout
+ */
+ protected $fixture;
+
+ public function setUp() {
+ $this->fixture = new Tx_Sokoban_Domain_Model_BackendLayout();
+ }
+
+ public function tearDown() {
+ unset($this->fixture);
+ }
+
+
+ /**
+ * @test
+ */
+ public function getTitleReturnsInitialValueForString() { }
+
+ /**
+ * @test
+ */
+ public function setTitleForStringSetsTitle() {
+ $this->fixture->setTitle('Conceived at T3CON10');
+
+ $this->assertSame(
+ 'Conceived at T3CON10',
+ $this->fixture->getTitle()
+ );
+ }
+
+ /**
+ * @test
+ */
+ public function getConfigReturnsInitialValueForString() { }
+
+ /**
+ * @test
+ */
+ public function setConfigForStringSetsConfig() {
+ $this->fixture->setConfig('Conceived at T3CON10');
+
+ $this->assertSame(
+ 'Conceived at T3CON10',
+ $this->fixture->getConfig()
+ );
+ }
+
+ /**
+ * @test
+ */
+ public function getParentPageReturnsInitialValueForTx_Sokoban_Domain_Model_Page() {
+ $this->assertEquals(
+ NULL,
+ $this->fixture->getParentPage()
+ );
+ }
+
+ /**
+ * @test
+ */
+ public function setParentPageForTx_Sokoban_Domain_Model_PageSetsParentPage() {
+ $dummyObject = new Tx_Sokoban_Domain_Model_Page();
+ $this->fixture->setParentPage($dummyObject);
+
+ $this->assertSame(
+ $dummyObject,
+ $this->fixture->getParentPage()
+ );
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Tests/Unit/Domain/Model/ContentElementTest.php b/Tests/Unit/Domain/Model/ContentElementTest.php
new file mode 100755
index 0000000..5499211
--- /dev/null
+++ b/Tests/Unit/Domain/Model/ContentElementTest.php
@@ -0,0 +1,95 @@
+
+*
+* 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!
+***************************************************************/
+
+/**
+ * Test case for class Tx_Sokoban_Domain_Model_ContentElement.
+ *
+ * @version $Id$
+ * @copyright Copyright belongs to the respective authors
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
+ *
+ * @package TYPO3
+ * @subpackage Sokoban
+ *
+ * @author Marco Huber
+ */
+class Tx_Sokoban_Domain_Model_ContentElementTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
+ /**
+ * @var Tx_Sokoban_Domain_Model_ContentElement
+ */
+ protected $fixture;
+
+ public function setUp() {
+ $this->fixture = new Tx_Sokoban_Domain_Model_ContentElement();
+ }
+
+ public function tearDown() {
+ unset($this->fixture);
+ }
+
+
+ /**
+ * @test
+ */
+ public function getTitleReturnsInitialValueForString() { }
+
+ /**
+ * @test
+ */
+ public function setTitleForStringSetsTitle() {
+ $this->fixture->setTitle('Conceived at T3CON10');
+
+ $this->assertSame(
+ 'Conceived at T3CON10',
+ $this->fixture->getTitle()
+ );
+ }
+
+ /**
+ * @test
+ */
+ public function getParentPageReturnsInitialValueForTx_Sokoban_Domain_Model_Page() {
+ $this->assertEquals(
+ NULL,
+ $this->fixture->getParentPage()
+ );
+ }
+
+ /**
+ * @test
+ */
+ public function setParentPageForTx_Sokoban_Domain_Model_PageSetsParentPage() {
+ $dummyObject = new Tx_Sokoban_Domain_Model_Page();
+ $this->fixture->setParentPage($dummyObject);
+
+ $this->assertSame(
+ $dummyObject,
+ $this->fixture->getParentPage()
+ );
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Tests/Unit/Domain/Model/PageTest.php b/Tests/Unit/Domain/Model/PageTest.php
new file mode 100755
index 0000000..04ec6fd
--- /dev/null
+++ b/Tests/Unit/Domain/Model/PageTest.php
@@ -0,0 +1,135 @@
+
+*
+* 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!
+***************************************************************/
+
+/**
+ * Test case for class Tx_Sokoban_Domain_Model_Page.
+ *
+ * @version $Id$
+ * @copyright Copyright belongs to the respective authors
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
+ *
+ * @package TYPO3
+ * @subpackage Sokoban
+ *
+ * @author Marco Huber
+ */
+class Tx_Sokoban_Domain_Model_PageTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
+ /**
+ * @var Tx_Sokoban_Domain_Model_Page
+ */
+ protected $fixture;
+
+ public function setUp() {
+ $this->fixture = new Tx_Sokoban_Domain_Model_Page();
+ }
+
+ public function tearDown() {
+ unset($this->fixture);
+ }
+
+
+ /**
+ * @test
+ */
+ public function getTitleReturnsInitialValueForString() { }
+
+ /**
+ * @test
+ */
+ public function setTitleForStringSetsTitle() {
+ $this->fixture->setTitle('Conceived at T3CON10');
+
+ $this->assertSame(
+ 'Conceived at T3CON10',
+ $this->fixture->getTitle()
+ );
+ }
+
+ /**
+ * @test
+ */
+ public function getTsConfigReturnsInitialValueForString() { }
+
+ /**
+ * @test
+ */
+ public function setTsConfigForStringSetsTsConfig() {
+ $this->fixture->setTsConfig('Conceived at T3CON10');
+
+ $this->assertSame(
+ 'Conceived at T3CON10',
+ $this->fixture->getTsConfig()
+ );
+ }
+
+ /**
+ * @test
+ */
+ public function getParentPageReturnsInitialValueForTx_Sokoban_Domain_Model_Page() {
+ $this->assertEquals(
+ NULL,
+ $this->fixture->getParentPage()
+ );
+ }
+
+ /**
+ * @test
+ */
+ public function setParentPageForTx_Sokoban_Domain_Model_PageSetsParentPage() {
+ $dummyObject = new Tx_Sokoban_Domain_Model_Page();
+ $this->fixture->setParentPage($dummyObject);
+
+ $this->assertSame(
+ $dummyObject,
+ $this->fixture->getParentPage()
+ );
+ }
+
+ /**
+ * @test
+ */
+ public function getBackendLayoutReturnsInitialValueForTx_Sokoban_Domain_Model_BackendLayout() {
+ $this->assertEquals(
+ NULL,
+ $this->fixture->getBackendLayout()
+ );
+ }
+
+ /**
+ * @test
+ */
+ public function setBackendLayoutForTx_Sokoban_Domain_Model_BackendLayoutSetsBackendLayout() {
+ $dummyObject = new Tx_Sokoban_Domain_Model_BackendLayout();
+ $this->fixture->setBackendLayout($dummyObject);
+
+ $this->assertSame(
+ $dummyObject,
+ $this->fixture->getBackendLayout()
+ );
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/doc/manual.sxw b/doc/manual.sxw
new file mode 100755
index 0000000..65a9b35
Binary files /dev/null and b/doc/manual.sxw differ
diff --git a/ext_emconf.php b/ext_emconf.php
new file mode 100755
index 0000000..2c7792a
--- /dev/null
+++ b/ext_emconf.php
@@ -0,0 +1,46 @@
+ 'Sokoban',
+ 'description' => 'Play Sokoban in TYPO3',
+ 'category' => '',
+ 'author' => 'Marco Huber',
+ 'author_email' => 'mail@marco-huber.de',
+ 'author_company' => '',
+ 'shy' => '',
+ 'dependencies' => 'cms,extbase,fluid',
+ 'conflicts' => '',
+ 'priority' => '',
+ 'module' => '',
+ 'state' => 'alpha',
+ 'internal' => '',
+ 'uploadfolder' => '0',
+ 'createDirs' => '',
+ 'modify_tables' => '',
+ 'clearCacheOnLoad' => 0,
+ 'lockType' => '',
+ 'version' => '',
+ 'constraints' => array(
+ 'depends' => array(
+ 'cms' => '',
+ 'extbase' => '',
+ 'fluid' => '',
+ ),
+ 'conflicts' => array(
+ ),
+ 'suggests' => array(
+ ),
+ ),
+);
+
+?>
\ No newline at end of file
diff --git a/ext_icon.gif b/ext_icon.gif
new file mode 100755
index 0000000..1a832d4
Binary files /dev/null and b/ext_icon.gif differ
diff --git a/ext_tables.php b/ext_tables.php
new file mode 100755
index 0000000..fa67873
--- /dev/null
+++ b/ext_tables.php
@@ -0,0 +1,35 @@
+ 'new, create',
+ ),
+ array(
+ 'access' => 'user,group',
+ 'icon' => 'EXT:' . $_EXTKEY . '/ext_icon.gif',
+ 'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_createsokobanlevels.xml',
+ )
+ );
+
+ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'][] = 'EXT:sokoban/Classes/Hooks/class.tx_sokoban_cmslayout.php:tx_sokoban_cmslayout';
+
+}
+
+
+t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'Sokoban');
+
+?>
\ No newline at end of file
diff --git a/ext_tables.sql b/ext_tables.sql
new file mode 100755
index 0000000..e69de29