Bug #18910 » 8621_class.tx_opendocs.php.diff
typo3/sysext/opendocs/class.tx_opendocs.php (working copy) | ||
---|---|---|
// load the language file
|
||
$GLOBALS['LANG']->includeLLFile('EXT:opendocs/locallang_opendocs.xml');
|
||
require_once(PATH_typo3.'interfaces/interface.backend_toolbaritem.php');
|
||
require_once(PATH_typo3 . 'interfaces/interface.backend_toolbaritem.php');
|
||
/**
|
||
... | ... | |
* @return void
|
||
*/
|
||
public function loadDocsFromUserSession() {
|
||
list($this->openDocs,) = $GLOBALS['BE_USER']->getModuleData('alt_doc.php', 'ses');
|
||
$this->recentDocs = $GLOBALS['BE_USER']->getModuleData('opendocs::recent');
|
||
list($this->openDocs, ) = $GLOBALS['BE_USER']->getModuleData('alt_doc.php', 'ses');
|
||
$this->recentDocs = $GLOBALS['BE_USER']->getModuleData('opendocs::recent');
|
||
}
|
||
/**
|
||
... | ... | |
$this->addCssToBackend();
|
||
$numDocs = count($this->openDocs);
|
||
$opendocsMenu = array();
|
||
$title = $GLOBALS['LANG']->getLL('toolbaritem', true);
|
||
// toolbar item icon
|
||
$opendocsMenu[] = '<a href="#" class="toolbar-item">';
|
||
$opendocsMenu[] = '<input type="text" id="tx-opendocs-counter" disabled="disabled" value="'.$numDocs.'" />';
|
||
$opendocsMenu[] = '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], t3lib_extMgm::extRelPath($this->EXTKEY).'opendocs.png', 'width="23" height="16"').' alt="Open Documents" title="Open Documents" /></a>';
|
||
$opendocsMenu[] = '<input type="text" id="tx-opendocs-counter" disabled="disabled" value="' . $numDocs . '" />';
|
||
$opendocsMenu[] = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], t3lib_extMgm::extRelPath($this->EXTKEY) . 'opendocs.png', 'width="23" height="16"') . ' alt="' . $title . '" title="' . $title . '" /></a>';
|
||
// toolbar item menu and initial content
|
||
$opendocsMenu[] = '<div class="toolbar-item-menu" style="display: none;">';
|
||
... | ... | |
$content = '';
|
||
if(count($openDocuments)) {
|
||
$entries[] = '<tr><th colspan="3">'.$GLOBALS['LANG']->getLL('open_docs', 1).'</th></tr>';
|
||
$entries[] = '<tr><th colspan="3">' . $GLOBALS['LANG']->getLL('open_docs', true) . '</th></tr>';
|
||
$i = 0;
|
||
foreach ($openDocuments as $md5sum => $openDocument) {
|
||
... | ... | |
// if there are "recent documents" in the list, add them
|
||
if(count($recentDocuments)) {
|
||
$entries[] = '<tr><th colspan="3">'.$GLOBALS['LANG']->getLL('recent_docs', 1).'</th></tr>';
|
||
$entries[] = '<tr><th colspan="3">' . $GLOBALS['LANG']->getLL('recent_docs', true) . '</th></tr>';
|
||
$i = 0;
|
||
foreach ($recentDocuments as $md5sum => $recentDocument) {
|
||
... | ... | |
}
|
||
if(count($entries)) {
|
||
$content = '<table class="list" cellspacing="0" cellpadding="0" border="0">'.implode('', $entries).'</table>';
|
||
$content = '<table class="list" cellspacing="0" cellpadding="0" border="0">' . implode('', $entries) . '</table>';
|
||
} else {
|
||
$content = '<div class="no-docs">'.$GLOBALS['LANG']->getLL('no_docs', 1).'</div>';
|
||
$content = '<div class="no-docs">' . $GLOBALS['LANG']->getLL('no_docs', 1) . '</div>';
|
||
}
|
||
return $content;
|
||
... | ... | |
$record = t3lib_BEfunc::getRecordWSOL($table, $uid);
|
||
$label = htmlspecialchars(strip_tags(t3lib_div::htmlspecialchars_decode($document[0])));
|
||
$icon = t3lib_iconWorks::getIconImage($table, $record, $GLOBALS['BACK_PATH']);
|
||
$link = $GLOBALS['BACK_PATH'].'alt_doc.php?'.$document[2];
|
||
$link = $GLOBALS['BACK_PATH'] . 'alt_doc.php?' . $document[2];
|
||
$firstRow = '';
|
||
if($isFirstDoc) {
|
||
... | ... | |
}
|
||
if (!$isRecentDoc) {
|
||
$title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.closeDoc', true);
|
||
|
||
// open document
|
||
$closeIcon = '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/closedok.gif', 'width="16" height="16"').' title="'.$GLOBALS['LANG']->getLL('rm.closeDoc', 1).'" alt="" />';
|
||
$closeIcon = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/closedok.gif', 'width="16" height="16"') . ' title="' . $title . '" alt="' . $title . '" />';
|
||
$entry = '
|
||
<tr id="opendocs-'.$table.'-'.$uid.'" class="opendoc'.$firstRow.'">
|
||
<td class="icon">'.$icon.'</td>
|
||
<td class="label"><a href="'.$link.'" target="content" onclick="TYPO3BackendOpenDocs.toggleMenu();">'.$label.'</a></td>
|
||
<td class="close" onclick="return TYPO3BackendOpenDocs.closeDocument(\''.$md5sum.'\');">'.$closeIcon.'</td>
|
||
<tr id="opendocs-' . $table . '-' . $uid . '" class="opendoc' . $firstRow . '">
|
||
<td class="icon">' . $icon . '</td>
|
||
<td class="label"><a href="' . $link . '" target="content" onclick="TYPO3BackendOpenDocs.toggleMenu();">' . $label . '</a></td>
|
||
<td class="close" onclick="return TYPO3BackendOpenDocs.closeDocument(\'' . $md5sum . '\');">' . $closeIcon . '</td>
|
||
</tr>';
|
||
} else {
|
||
// recently used document
|
||
... | ... | |
} else {
|
||
// recently used document
|
||
$entry = '
|
||
<tr id="opendocs-'.$table.'-'.$uid.'" class="recentdoc'.$firstRow.'">
|
||
<td class="icon">'.$icon.'</td>
|
||
<td class="label" colspan="2"><a href="'.$link.'" target="content" onclick="TYPO3BackendOpenDocs.toggleMenu();">'.$label.'</a></td>
|
||
<tr id="opendocs-' . $table . '-' . $uid . '" class="recentdoc' . $firstRow . '">
|
||
<td class="icon">' . $icon . '</td>
|
||
<td class="label" colspan="2"><a href="' . $link . '" target="content" onclick="TYPO3BackendOpenDocs.toggleMenu();">' . $label . '</a></td>
|
||
</tr>';
|
||
}
|
||
... | ... | |
* @return void
|
||
*/
|
||
protected function addJavascriptToBackend() {
|
||
$this->backendReference->addJavascriptFile(t3lib_extMgm::extRelPath($this->EXTKEY).'opendocs.js');
|
||
$this->backendReference->addJavascriptFile(t3lib_extMgm::extRelPath($this->EXTKEY) . 'opendocs.js');
|
||
}
|
||
/**
|
||
... | ... | |
* @return void
|
||
*/
|
||
protected function addCssToBackend() {
|
||
$this->backendReference->addCssFile('opendocs', t3lib_extMgm::extRelPath($this->EXTKEY).'opendocs.css');
|
||
$this->backendReference->addCssFile('opendocs', t3lib_extMgm::extRelPath($this->EXTKEY) . 'opendocs.css');
|
||
}
|
||
... | ... | |
public function updateNumberOfOpenDocsHook(&$params, &$ref) {
|
||
$params['JScode'] = '
|
||
if (top && top.TYPO3BackendOpenDocs) {
|
||
top.TYPO3BackendOpenDocs.updateNumberOfDocs('.count($this->openDocs).', true);
|
||
top.TYPO3BackendOpenDocs.updateNumberOfDocs(' . count($this->openDocs) . ', true);
|
||
}
|
||
';
|
||
}
|