[TYPO3-mvc] EXT: mvc_extjs some changes for the ActionController

dennis ahrens dennis.ahrens at googlemail.com
Wed Jan 13 17:01:25 CET 2010


Hi List,

i'm working on a BE-Modul based on mvc_extjs and i've done some
changes to the ActionController.

i've fixed a small issue that made the loading of CSS files and JS
files impossible when you tried loading from a BE-Module.
and i have changed the signature of includeJsLibrary() - i've added
the extName to the signature, that allows me to load JS files located
in another EXT.
at least i've added a default layout (border) for the module panel -
cause i couldn't get extjs to render my module code without a layout.

i hope this is the right place to put things related to the EXT:
mvc_extjs up for discussion.

the changes are attached.

regards
Dennis
-------------- next part --------------
### Eclipse Workspace Patch 1.0
#P mvc_extjs
Index: Classes/ExtJS/Controller/ActionController.php
===================================================================
--- Classes/ExtJS/Controller/ActionController.php	(revision 27464)
+++ Classes/ExtJS/Controller/ActionController.php	(working copy)
@@ -229,8 +229,11 @@
 		if (!@is_file($this->extPath . $cssFile)) {
 			die('File "' . $this->extPath . $cssFile . '" not found!');
 		}
-		
-		$this->pageRendererObject->addCssFile( $this->extRelPath . $cssFile, $rel, $media, $title, $compressed, $forceOnTop);
+		if (TYPO3_MODE === 'FE') {
+			$this->pageRendererObject->addCssFile($this->extRelPath . $cssFile, $rel, $media, $title, $compressed, $forceOnTop);
+		} else {
+			$this->pageRendererObject->addCssFile('../' . $this->extRelPath . $cssFile, $rel, $media, $title, $compressed, $forceOnTop);
+		}
 	}
 	
 	/**
@@ -249,19 +252,31 @@
 	* @param string $name
 	* @param string $file file to be included, relative to this extension's Javascript directory
 	* @param string $type
-	* @param int $section 	t3lib_pageRendererObject::PART_HEADER (0) or t3lib_pageRendererObject::PART_FOOTER (1)
+	* @param string $extName the name of the extension, the file is located
 	* @param boolean $compressed	flag if library is compressed
 	* @param boolean $forceOnTop	flag if added library should be inserted at begin of this block
 	* @return void	
 	*/
-	public function addJsLibrary($name, $file, $type = 'text/javascript', $compressed = TRUE, $forceOnTop = FALSE) {
+	public function addJsLibrary($name, $file, $extName = NULL, $type = 'text/javascript', $compressed = TRUE, $forceOnTop = FALSE) {
 		$jsFile = 'Resources/Public/JavaScript/' . $file;
 		
-		if (!@is_file($this->extPath . $jsFile)) {
-			die('File "' . $this->extPath . $jsFile . '" not found!');
+		$extRelPath = $this->extRelPath;
+		$extPath = $this->extPath;
+		
+		if($extName != NULL) {
+			$extPath = t3lib_extMgm::extPath($extName);
+			$extRelPath = substr($extPath, strlen(PATH_site));
+		}
+			
+		if (!@is_file($extPath . $jsFile)) {
+			die('File "' . $extPath . $jsFile . '" not found!');
 		}
 		
-		$this->pageRendererObject->addJsLibrary($name, $this->extRelPath . $jsFile, $type, $compressed, $forceOnTop);
+		if (TYPO3_MODE === 'FE') {
+			$this->pageRendererObject->addJsLibrary($name, $extRelPath . $jsFile, $type, $compressed, $forceOnTop);
+		} else {
+			$this->pageRendererObject->addJsLibrary($name, '../' . $extRelPath . $jsFile, $type, $compressed, $forceOnTop);
+		}
 	}
 	
 	/**
@@ -524,6 +539,7 @@
 					},{
 						region: "center",
 						xtype: "panel",
+						layout: "border",
 						' . $content . '
 					}]
 				});


More information about the TYPO3-project-typo3v4mvc mailing list