--- /Users/claus/Zend/workspaces/DefaultWorkspace7/trunk/typo3/sysext/opendocs/class.tx_opendocs.php 2010-09-24 10:46:48.000000000 +0200 +++ htdocs/typo3_src/typo3/sysext/opendocs/class.tx_opendocs.php 2010-09-24 16:20:41.000000000 +0200 @@ -118,14 +118,14 @@ $recentDocuments = $this->recentDocs; $entries = array(); $content = ''; - + list(, $docDat) = $GLOBALS['BE_USER']->getModuleData('alt_doc.php', 'ses'); if (count($openDocuments)) { $entries[] = '' . $GLOBALS['LANG']->getLL('open_docs', true) . ''; $i = 0; foreach ($openDocuments as $md5sum => $openDocument) { $i++; - $entries[] = $this->renderMenuEntry($openDocument, $md5sum, false, ($i == 1)); + $entries[] = $this->renderMenuEntry($openDocument, $md5sum, false, ($i == 1), ($docDat == $md5sum)); } } @@ -154,7 +154,7 @@ * * @return array all recent documents as list-items */ - public function renderMenuEntry($document, $md5sum, $isRecentDoc = false, $isFirstDoc = false) { + public function renderMenuEntry($document, $md5sum, $isRecentDoc = false, $isFirstDoc = false, $isOpenDoc = false) { $table = $document[3]['table']; $uid = $document[3]['uid']; $record = t3lib_BEfunc::getRecordWSOL($table, $uid); @@ -175,7 +175,11 @@ $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.closeDoc', true); // open document + if (!$isOpenDoc) { $closeIcon = t3lib_iconWorks::getSpriteIcon('actions-document-close'); + } else { + $closeIcon = ''; + } $entry = ' @@ -273,6 +277,7 @@ // remove it from the list of the open documents, and store the status unset($this->openDocs[$md5sum]); + list(, $docDat) = $GLOBALS['BE_USER']->getModuleData('alt_doc.php', 'ses'); $GLOBALS['BE_USER']->pushModuleData('alt_doc.php', array($this->openDocs, $docDat)); $GLOBALS['BE_USER']->pushModuleData('opendocs::recent', $this->recentDocs); @@ -281,6 +286,21 @@ $this->renderAjax($params, $ajaxObj); } + + /** + * Checks if the current page's parameters match the parameters stored for the document entry + * in the Open Documents list. If matched, the document is currently open and TRUE is returned + * + * @param string $md5sum + * @return bool TRUE if document is open, otherwise FALSE + */ + public function isDocumentOpen($md5sum) { + $open = FALSE; + + #$checkAgainstMD5 = + return (bool) $open; + } + /** * renders the menu so that it can be returned as response to an AJAX call *