showing the clipboard will filter out those objects which are no longer available

This commit is contained in:
Uwe Steinmann 2014-06-06 15:08:44 +02:00
parent a85a620d80
commit 3301dbeda5

View File

@ -1237,12 +1237,10 @@ $(function() {
function mainClipboard($clipboard){ /* {{{ */
$dms = $this->params['dms'];
$content = '';
if(!$clipboard['docs'] && !$clipboard['folders']) {
$content .= "<div class=\"alert\">".getMLText("drag_icon_here")."</div>";
} else {
$content .= "<table class=\"table\">";
$foldercount = $doccount = 0;
if($clipboard['folders']) {
foreach($clipboard['folders'] as $folderid) {
/* FIXME: check for access rights, which could have changed after adding the folder to the clipboard */
if($folder = $dms->getFolder($folderid)) {
$comment = $folder->getComment();
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
@ -1257,12 +1255,14 @@ $(function() {
$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++;
}
}
}
$previewer = new SeedDMS_Preview_Previewer($this->params['cachedir'], 40);
if($clipboard['docs']) {
foreach($clipboard['docs'] as $docid) {
/* FIXME: check for access rights, which could have changed after adding the document to the clipboard */
if($document = $dms->getDocument($docid)) {
$comment = $document->getComment();
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
@ -1293,12 +1293,21 @@ $(function() {
$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++;
}
}
}
}
/* $foldercount or $doccount will only count objects which are
* actually available
*/
if($foldercount || $doccount) {
$content = "<table class=\"table\">".$content;
$content .= "</table>";
} else {
}
$content .= "<div class=\"alert\">".getMLText("drag_icon_here")."</div>";
return $content;
} /* }}} */
@ -1309,7 +1318,7 @@ $(function() {
*/
function printClipboard($clipboard){ /* {{{ */
$this->contentHeading(getMLText("clipboard"), true);
echo "<div id=\"main-clipboard\" class=\"well\" ondragover=\"allowDrop(event)\" ondrop=\"onAddClipboard(event)\">\n";
echo "<div id=\"main-clipboard\" _class=\"well\" ondragover=\"allowDrop(event)\" ondrop=\"onAddClipboard(event)\">\n";
echo $this->mainClipboard($clipboard);
echo "</div>\n";
} /* }}} */