Index: mod1/index.php =================================================================== --- mod1/index.php (revision 39871) +++ mod1/index.php (working copy) @@ -57,6 +57,9 @@ class tx_damcatedit_module1 extends tx_dam_SCbase { + public $moduleContent; + + /** * Main function of the module. Write the content to $this->content */ @@ -76,7 +79,8 @@ if (($this->id && $access) || ($BE_USER->user['admin'] && !$this->id)) { // Draw the header. - $this->doc = t3lib_div::makeInstance('noDoc'); + $this->doc = t3lib_div::makeInstance('template'); + $this->doc->setModuleTemplate(t3lib_extMgm::extPath('dam_catedit') . 'mod1/mod_template.html'); $this->doc->backPath = $BACK_PATH; $this->doc->form='
'; $this->doc->styleSheetFile2 = t3lib_extMgm::extRelPath('dam') . 'res/css/stylesheet.css'; @@ -90,19 +94,6 @@ $this->doc->postCode .= $CMparts[2]; } - - - $this->doc->postCode=' - - '; - // Add JavaScript functions to the page: $this->doc->JScode=$this->doc->wrapScriptTags(' function jumpToUrl(URL) { // @@ -153,30 +144,33 @@ } if (top.fsMod) top.fsMod.recentIds["dam_cat"] = '.intval($this->id).'; + + top.content.nav_frame.refresh_nav(); '); // should be done on changes only, but that's not possible (tce_db.php react on 'pages' only) - t3lib_BEfunc::getSetUpdateSignal('updatePageTree'); + // is obviously not working with dam folder tree + //t3lib_BEfunc::setUpdateSignal('updatePageTree'); ###$headerSection = $this->doc->getHeader('pages',$this->pageinfo,$this->pageinfo['_thePath']).'
'.$LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.path',1).': '.t3lib_div::fixed_lgd_pre($this->pageinfo['_thePath'],50); - $this->content.=$this->doc->startPage($LANG->getLL('title')); - $this->content.=$this->doc->header($LANG->getLL('title')); - $this->content.=$this->doc->spacer(5); - ###$this->content.=$this->doc->section('',$this->doc->funcMenu($headerSection,t3lib_BEfunc::getFuncMenu($this->id,'SET[function]',$this->MOD_SETTINGS['function'],$this->MOD_MENU['function']))); - ###$this->content.=$this->doc->divider(5); + // title in document body + $this->content.= $this->doc->header($LANG->getLL('title')); + $this->content.= $this->doc->spacer(5); + // render module content + $this->content.= $this->moduleContent(); + + $page = $this->doc->startPage($LANG->getLL('title')); + $page.= $this->doc->moduleBody( + array(), + $this->getDocHeaderButtons(), + $this->getTemplateMarkers() + ); + $page .= $this->doc->endPage(); - // Render content: - $this->moduleContent(); - - - // ShortCut - if ($BE_USER->mayMakeShortcut()) { - $this->content.=$this->doc->spacer(20).$this->doc->section('',$this->doc->makeShortcutIcon('id',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name'])); - } - - $this->content.=$this->doc->spacer(10); + $this->content = $page; + } else { // If no access or if ID == zero @@ -194,9 +188,6 @@ * Prints out the module HTML */ function printContent() { - - $this->content.=$this->doc->endPage(); - $this->content = $this->doc->insertStylesAndJS($this->content); echo $this->content; } @@ -299,16 +290,93 @@ $dblist->generateList(); + $this->moduleContent.= ''; + $this->moduleContent.= $dblist->HTMLcode; + $this->moduleContent.= '
'; + $this->moduleContent.= $dblist->fieldSelectBox(); + } - $content.= '
'; - $content.= $dblist->HTMLcode; - $content.= '
'; - $content.= $dblist->fieldSelectBox(); + return $this->moduleContent; + + } + + /** + * Gets the filled markers that are used in the HTML template. + * + * @return array The filled marker array + */ + protected function getTemplateMarkers() { + $markers = array( + 'CONTENT' => $this->content, + 'TITLE' => $GLOBALS['LANG']->getLL('title'), + ); + + return $markers; + } + + /** + * Gets the buttons that shall be rendered in the docHeader. + * + * @return array Available buttons for the docHeader + */ + protected function getDocHeaderButtons() { + $buttons = array( + 'addcat'=> $this->getAddCategoryButton(), + 'shortcut' => $this->getShortcutButton(), + ); + + return $buttons; + } + + /** + * Gets the button to add a new category. + * + * @return string HTML representiation of the add category button + */ + protected function getAddCategoryButton($table='tx_dam_cat') { + global $BE_USER,$LANG,$BACK_PATH,$TCA,$TYPO3_CONF_VARS; + + $cmd = t3lib_div::_GPmerged('SLCMD'); + + if (is_array($cmd['SELECT']['txdamCat'])) { + $uid = intval(key($cmd['SELECT']['txdamCat'])); } + + $sysfolder = t3lib_div::makeInstance('tx_dam_sysfolder'); + $sysfolderUid = $sysfolder->getPidList(); + + //$result = ''; + $result = ''; - $this->content.= $content; + if(t3lib_div::int_from_ver(TYPO3_version) < 4004000) { + $result .= ''; + } else { + $result .= t3lib_iconWorks::getSpriteIcon('actions-document-new', array('title' => 'Create new record')); + } + + $result .= ''; + return $result; } + + + /** + * Gets the button to set a new shortcut in the backend (if current user is allowed to). + * + * @return string HTML representiation of the shortcut button + */ + protected function getShortcutButton() { + $result = ''; + if ($GLOBALS['BE_USER']->mayMakeShortcut()) { + $result = $this->doc->makeShortcutIcon('', 'function', $this->MCONF['name']); + } + + return $result; + } + + } Index: mod1/mod_template.html =================================================================== --- mod1/mod_template.html (revision 0) +++ mod1/mod_template.html (revision 0) @@ -0,0 +1,35 @@ + +
+ +
+
+
###BUTTONLIST_LEFT###
+
###BUTTONLIST_RIGHT###
+
+
+
+
+
+
+ +
+
+ ###CONTENT### +
+
+
+ + + + + +
###BUTTONS###
+ + + +###ADDCAT### + + + +###SHORTCUT### + Index: mod1/mod_template_tree.html =================================================================== --- mod1/mod_template_tree.html (revision 0) +++ mod1/mod_template_tree.html (revision 0) @@ -0,0 +1,35 @@ + +
+ +
+
+
###BUTTONLIST_LEFT###
+
###BUTTONLIST_RIGHT###
+
+
+
+
+
+
+ +
+
+ ###CONTENT### +
+
+
+ + + + + +
###BUTTONS###
+ + + + + + + +###REFRESH### + Index: mod1/tx_dam_catedit_navframe.php =================================================================== --- mod1/tx_dam_catedit_navframe.php (revision 39871) +++ mod1/tx_dam_catedit_navframe.php (working copy) @@ -79,6 +79,8 @@ var $doc; var $content; + + public $innerContent; // Internal, static: _GP var $currentSubScript; @@ -89,8 +91,8 @@ $this->doc = t3lib_div::makeInstance('template'); $this->doc->backPath = $BACK_PATH; + $this->doc->setModuleTemplate(t3lib_extMgm::extRelPath('dam_catedit') . 'mod1/mod_template_tree.html'); - $this->currentSubScript = t3lib_div::_GP('currentSubScript'); // Setting highlight mode: @@ -115,14 +117,14 @@ parent.list_frame.location.href=theUrl; } - '.($this->doHighlight?'hilight_row("dam_cat",highLightID+"_"+bank);':'').' + '.($this->doHighlight?'highlight_row("dam_cat",highLightID+"_"+bank);':'').' '.(!$GLOBALS['CLIENT']['FORMSTYLE'] ? '' : 'if (linkObj) {linkObj.blur();}').' return false; } // Call this function, refresh_nav(), from another script in the backend if you want to refresh the navigation frame (eg. after having changed a page title or moved pages etc.) - // See t3lib_BEfunc::getSetUpdateSignal() + // See t3lib_BEfunc::setUpdateSignal() function refresh_nav() { window.setTimeout("_refresh_nav();",0); } @@ -131,7 +133,7 @@ } // Highlighting rows in the page tree: - function hilight_row(frameSetModule,highLightID) { // + function highlight_row(frameSetModule,highLightID) { // // Remove old: theObj = document.getElementById(top.fsMod.navFrameHighlightedID[frameSetModule]); @@ -181,9 +183,6 @@ } '; - - - } @@ -197,10 +196,74 @@ function main() { global $LANG,$BACK_PATH,$TYPO3_CONF_VARS; - $this->content = ''; - $this->content.= $this->doc->startPage('Navigation'); + $this->content .= $this->getInnerContent(); + + $page = $this->doc->startPage($LANG->getLL('title')); + $page .= $this->doc->moduleBody( + array(), + $this->getDocHeaderButtons(), + $this->getTemplateMarkers() + ); + $page .= $this->doc->endPage(); + //$this->content .= $this->doc->spacer(10); + $this->content = $page; + + } + /** + * Gets the filled markers that are used in the HTML template. + * + * @return array The filled marker array + */ + protected function getTemplateMarkers() { + $markers = array( + 'CONTENT' => $this->content, + ); + + return $markers; + } + + /** + * Gets the buttons that shall be rendered in the docHeader. + * + * @return array Available buttons for the docHeader + */ + protected function getDocHeaderButtons() { + $buttons = array( + 'refresh' => $this->getRefreshButton(), + ); + + return $buttons; + } + + /** + * Gets the button to set a new shortcut in the backend (if current user is allowed to). + * + * @return string HTML representiation of the shortcut button + */ + protected function getRefreshButton() { + global $LANG,$BACK_PATH,$TYPO3_CONF_VARS; + + $result = ''; + + $result .= ' + '. + ' + '; + + return $result; + } + + /** + * Gets the content that will replace CONTENT marker. + * + * @return string HTML content + */ + protected function getInnerContent() { + + global $LANG,$BACK_PATH,$TYPO3_CONF_VARS; + // the trees $this->browseTrees = t3lib_div::makeInstance('tx_dam_browseTrees'); // show only categories: @@ -210,33 +273,27 @@ $this->browseTrees->treeObjArr['txdamCat']->modeSelIcons = false; $this->browseTrees->treeObjArr['txdamCat']->linkRootCat = true; - $this->content.= $this->browseTrees->getTrees(); + $this->innerContent = ''; + $this->innerContent .= $this->browseTrees->getTrees(); - $this->content.= ' -

- '. - ''. - $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.refresh',1).' -

-
'; - // Adding highlight - JavaScript - if ($this->doHighlight) $this->content .=$this->doc->wrapScriptTags(' - hilight_row("",top.fsMod.navFrameHighlightedID["dam_cat"]); - '); + if ($this->doHighlight) $this->innerContent .= $this->doc->wrapScriptTags(' + highlight_row("",top.fsMod.navFrameHighlightedID["dam_cat"]); + '); + + return $this->innerContent; + } - /** * Outputting the accumulated content to screen * * @return void */ function printContent() { - $this->content.= $this->doc->endPage(); echo $this->content; } - + } // Include extension?