mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-12 01:54:57 +00:00
seperate code for lines in clipboard into extra function
allows to add hook for replacing those functions with code in an extension
This commit is contained in:
parent
a91a49cd56
commit
b90392191a
|
@ -91,6 +91,79 @@ class SeedDMS_View_Clipboard extends SeedDMS_Bootstrap_Style {
|
||||||
echo $content;
|
echo $content;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return row of clipboard for a folder
|
||||||
|
*
|
||||||
|
* @param object $folder
|
||||||
|
* @return string rendered html content
|
||||||
|
*/
|
||||||
|
public function folderClipboardRow($folder) { /* {{{ */
|
||||||
|
$dms = $this->params['dms'];
|
||||||
|
|
||||||
|
$content = '';
|
||||||
|
$comment = $folder->getComment();
|
||||||
|
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
|
||||||
|
$content .= "<tr draggable=\"true\" rel=\"folder_".$folder->getID()."\" class=\"folder table-row-folder\" formtoken=\"".createFormKey('movefolder')."\">";
|
||||||
|
$content .= "<td><a draggable=\"false\" href=\"out.ViewFolder.php?folderid=".$folder->getID()."&showtree=".showtree()."\"><img draggable=\"false\" src=\"".$this->getMimeIcon(".folder")."\" width=\"24\" height=\"24\" border=0></a></td>\n";
|
||||||
|
$content .= "<td><a draggable=\"false\" href=\"out.ViewFolder.php?folderid=".$folder->getID()."&showtree=".showtree()."\">" . htmlspecialchars($folder->getName()) . "</a>";
|
||||||
|
if($comment) {
|
||||||
|
$content .= "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>";
|
||||||
|
}
|
||||||
|
$content .= "</td>\n";
|
||||||
|
$content .= "<td>\n";
|
||||||
|
$content .= "<div class=\"list-action\"><a class=\"removefromclipboard\" rel=\"F".$folder->getID()."\" msg=\"".getMLText('splash_removed_from_clipboard')."\" title=\"".getMLText('rm_from_clipboard')."\"><i class=\"icon-remove\"></i></a></div>";
|
||||||
|
$content .= "</td>\n";
|
||||||
|
$content .= "</tr>\n";
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return row of clipboard for a document
|
||||||
|
*
|
||||||
|
* @param object $document
|
||||||
|
* @return string rendered html content
|
||||||
|
*/
|
||||||
|
public function documentClipboardRow($document, $previewer) { /* {{{ */
|
||||||
|
$dms = $this->params['dms'];
|
||||||
|
|
||||||
|
$content = '';
|
||||||
|
$comment = $document->getComment();
|
||||||
|
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
|
||||||
|
$latestContent = $this->callHook('documentLatestContent', $document);
|
||||||
|
if($latestContent === null)
|
||||||
|
$latestContent = $document->getLatestContent();
|
||||||
|
if($latestContent) {
|
||||||
|
$previewer->createPreview($latestContent);
|
||||||
|
$version = $latestContent->getVersion();
|
||||||
|
$status = $latestContent->getStatus();
|
||||||
|
|
||||||
|
$content .= "<tr draggable=\"true\" rel=\"document_".$document->getID()."\" class=\"table-row-document\" formtoken=\"".createFormKey('movedocument')."\">";
|
||||||
|
|
||||||
|
if (file_exists($dms->contentDir . $latestContent->getPath())) {
|
||||||
|
$content .= "<td><a draggable=\"false\" href=\"../op/op.Download.php?documentid=".$document->getID()."&version=".$version."\">";
|
||||||
|
if($previewer->hasPreview($latestContent)) {
|
||||||
|
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"40\"src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
|
||||||
|
} else {
|
||||||
|
$content .= "<img draggable=\"false\" class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
|
||||||
|
}
|
||||||
|
$content .= "</a></td>";
|
||||||
|
} else
|
||||||
|
$content .= "<td><img draggable=\"false\" class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\"></td>";
|
||||||
|
|
||||||
|
$content .= "<td><a draggable=\"false\" href=\"out.ViewDocument.php?documentid=".$document->getID()."&showtree=".showtree()."\">" . htmlspecialchars($document->getName()) . "</a>";
|
||||||
|
if($comment) {
|
||||||
|
$content .= "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>";
|
||||||
|
}
|
||||||
|
$content .= "</td>\n";
|
||||||
|
$content .= "<td>\n";
|
||||||
|
$content .= "<div class=\"list-action\"><a class=\"removefromclipboard\" rel=\"D".$document->getID()."\" msg=\"".getMLText('splash_removed_from_clipboard')."\" _href=\"../op/op.RemoveFromClipboard.php?folderid=".(isset($this->params['folder']) ? $this->params['folder']->getID() : '')."&id=".$document->getID()."&type=document\" title=\"".getMLText('rm_from_clipboard')."\"><i class=\"icon-remove\"></i></a></div>";
|
||||||
|
$content .= "</td>\n";
|
||||||
|
$content .= "</tr>";
|
||||||
|
}
|
||||||
|
return $content;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return clipboard content rendered as html
|
* Return clipboard content rendered as html
|
||||||
*
|
*
|
||||||
|
@ -112,19 +185,13 @@ class SeedDMS_View_Clipboard extends SeedDMS_Bootstrap_Style {
|
||||||
foreach($clipboard['folders'] as $folderid) {
|
foreach($clipboard['folders'] as $folderid) {
|
||||||
/* FIXME: check for access rights, which could have changed after adding the folder to the clipboard */
|
/* FIXME: check for access rights, which could have changed after adding the folder to the clipboard */
|
||||||
if($folder = $dms->getFolder($folderid)) {
|
if($folder = $dms->getFolder($folderid)) {
|
||||||
$comment = $folder->getComment();
|
$txt = $this->callHook('folderClipboardItem', $folder, 'clipboard');
|
||||||
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
|
if(is_string($txt))
|
||||||
$content .= "<tr draggable=\"true\" rel=\"folder_".$folder->getID()."\" class=\"folder table-row-folder\" formtoken=\"".createFormKey('movefolder')."\">";
|
$content .= $txt;
|
||||||
$content .= "<td><a draggable=\"false\" href=\"out.ViewFolder.php?folderid=".$folder->getID()."&showtree=".showtree()."\"><img draggable=\"false\" src=\"".$this->imgpath."folder.png\" width=\"24\" height=\"24\" border=0></a></td>\n";
|
else {
|
||||||
$content .= "<td><a draggable=\"false\" href=\"out.ViewFolder.php?folderid=".$folder->getID()."&showtree=".showtree()."\">" . htmlspecialchars($folder->getName()) . "</a>";
|
$content .= $this->folderClipboardRow($folder);
|
||||||
if($comment) {
|
|
||||||
$content .= "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>";
|
|
||||||
}
|
}
|
||||||
$content .= "</td>\n";
|
|
||||||
$content .= "<td>\n";
|
|
||||||
$content .= "<div class=\"list-action\"><a class=\"removefromclipboard\" rel=\"F".$folderid."\" msg=\"".getMLText('splash_removed_from_clipboard')."\" _href=\"../op/op.RemoveFromClipboard.php?folderid=".(isset($this->params['folder']) ? $this->params['folder']->getID() : '')."&id=".$folderid."&type=folder\" title=\"".getMLText('rm_from_clipboard')."\"><i class=\"icon-remove\"></i></a></div>";
|
|
||||||
$content .= "</td>\n";
|
|
||||||
$content .= "</tr>\n";
|
|
||||||
$foldercount++;
|
$foldercount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,40 +200,15 @@ class SeedDMS_View_Clipboard extends SeedDMS_Bootstrap_Style {
|
||||||
foreach($clipboard['docs'] as $docid) {
|
foreach($clipboard['docs'] as $docid) {
|
||||||
/* FIXME: check for access rights, which could have changed after adding the document to the clipboard */
|
/* FIXME: check for access rights, which could have changed after adding the document to the clipboard */
|
||||||
if($document = $dms->getDocument($docid)) {
|
if($document = $dms->getDocument($docid)) {
|
||||||
$comment = $document->getComment();
|
$document->verifyLastestContentExpriry();
|
||||||
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
|
$txt = $this->callHook('documentClipboardItem', $document, $previewer, 'clipboard');
|
||||||
$latestContent = $this->callHook('documentLatestContent', $document);
|
if(is_string($txt))
|
||||||
if($latestContent === null)
|
$content .= $txt;
|
||||||
$latestContent = $document->getLatestContent();
|
else {
|
||||||
if($latestContent) {
|
$content .= $this->documentClipboardRow($document, $previewer);
|
||||||
$previewer->createPreview($latestContent);
|
|
||||||
$version = $latestContent->getVersion();
|
|
||||||
$status = $latestContent->getStatus();
|
|
||||||
|
|
||||||
$content .= "<tr draggable=\"true\" rel=\"document_".$docid."\" class=\"table-row-document\" formtoken=\"".createFormKey('movedocument')."\">";
|
|
||||||
|
|
||||||
if (file_exists($dms->contentDir . $latestContent->getPath())) {
|
|
||||||
$content .= "<td><a draggable=\"false\" href=\"../op/op.Download.php?documentid=".$docid."&version=".$version."\">";
|
|
||||||
if($previewer->hasPreview($latestContent)) {
|
|
||||||
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"40\"src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
|
|
||||||
} else {
|
|
||||||
$content .= "<img draggable=\"false\" class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
|
|
||||||
}
|
|
||||||
$content .= "</a></td>";
|
|
||||||
} else
|
|
||||||
$content .= "<td><img draggable=\"false\" class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\"></td>";
|
|
||||||
|
|
||||||
$content .= "<td><a draggable=\"false\" href=\"out.ViewDocument.php?documentid=".$docid."&showtree=".showtree()."\">" . htmlspecialchars($document->getName()) . "</a>";
|
|
||||||
if($comment) {
|
|
||||||
$content .= "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>";
|
|
||||||
}
|
|
||||||
$content .= "</td>\n";
|
|
||||||
$content .= "<td>\n";
|
|
||||||
$content .= "<div class=\"list-action\"><a class=\"removefromclipboard\" rel=\"D".$docid."\" msg=\"".getMLText('splash_removed_from_clipboard')."\" _href=\"../op/op.RemoveFromClipboard.php?folderid=".(isset($this->params['folder']) ? $this->params['folder']->getID() : '')."&id=".$docid."&type=document\" title=\"".getMLText('rm_from_clipboard')."\"><i class=\"icon-remove\"></i></a></div>";
|
|
||||||
$content .= "</td>\n";
|
|
||||||
$content .= "</tr>";
|
|
||||||
$doccount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$doccount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user