Added feature #15950: Use t3editor in file_edit to edit files in fileadmin
[Packages/TYPO3.CMS.git] / typo3 / sysext / t3editor / classes / class.tx_t3editor_hooks_tstemplateinfo.php
index 0eacf4b..c3deb2b 100644 (file)
@@ -30,19 +30,23 @@ require_once(t3lib_extMgm::extPath('t3editor', 'classes/class.tx_t3editor.php'))
 class tx_t3editor_hooks_tstemplateinfo {
 
        /**
-        *
         * @var tx_t3editor
         */
        protected $t3editor = NULL;
+       
+       /**
+        * @var string
+        */
+       protected $ajaxSaveType = 'tx_tstemplateinfo';
 
        /**
-        *
         * @return tx_t3editor
         */
        protected function getT3editor() {
                if ($this->t3editor == NULL) {
                        $this->t3editor = t3lib_div::makeInstance('tx_t3editor')
-                               ->setMode(tx_t3editor::MODE_TYPOSCRIPT);
+                               ->setMode(tx_t3editor::MODE_TYPOSCRIPT)
+                               ->setAjaxSaveType($this->ajaxSaveType);
                }
                return $this->t3editor;
        }
@@ -62,7 +66,6 @@ class tx_t3editor_hooks_tstemplateinfo {
 
                        // insert javascript code in document header
                        $pObj->JScode .= $t3editor->getJavascriptCode($pObj);
-                       $pObj->loadJavascriptLib(t3lib_extmgm::extRelPath('t3editor') . 'res/jslib/tx_tstemplateinfo/tx_tstemplateinfo.js');
                }
        }
 
@@ -119,7 +122,7 @@ class tx_t3editor_hooks_tstemplateinfo {
         */
        public function save($parameters, $pObj) {
                $savingsuccess = false;
-               if ($parameters['type'] == 'tx_tstemplateinfo') {
+               if ($parameters['type'] == $this->ajaxSaveType) {
 
                        $pageId = t3lib_div::_GP('pageId');
                        if (!is_numeric($pageId) || $pageId < 1) {