2012-12-14 07:53:13 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of CategoryChooser view
|
|
|
|
*
|
|
|
|
* @category DMS
|
2013-02-14 11:10:53 +00:00
|
|
|
* @package SeedDMS
|
2012-12-14 07:53:13 +00:00
|
|
|
* @license GPL 2
|
|
|
|
* @version @version@
|
|
|
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
|
|
|
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
|
|
|
* 2010-2012 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Include parent class
|
|
|
|
*/
|
|
|
|
require_once("class.Bootstrap.php");
|
|
|
|
|
2016-04-26 11:43:02 +00:00
|
|
|
/**
|
|
|
|
* Include class to preview documents
|
|
|
|
*/
|
|
|
|
require_once("SeedDMS/Preview.php");
|
|
|
|
|
2012-12-14 07:53:13 +00:00
|
|
|
/**
|
|
|
|
* Class which outputs the html page for CategoryChooser view
|
|
|
|
*
|
|
|
|
* @category DMS
|
2013-02-14 11:10:53 +00:00
|
|
|
* @package SeedDMS
|
2012-12-14 07:53:13 +00:00
|
|
|
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
|
|
|
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
|
|
|
* 2010-2012 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
2013-02-14 11:10:53 +00:00
|
|
|
class SeedDMS_View_DropFolderChooser extends SeedDMS_Bootstrap_Style {
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2015-12-14 14:16:32 +00:00
|
|
|
function js() { /* {{{ */
|
2016-02-17 10:43:19 +00:00
|
|
|
header('Content-Type: application/javascript');
|
2015-12-14 14:16:32 +00:00
|
|
|
?>
|
2016-03-16 08:29:37 +00:00
|
|
|
$('.fileselect').click(function(ev) {
|
2015-12-14 14:16:32 +00:00
|
|
|
attr_filename = $(ev.currentTarget).attr('filename');
|
|
|
|
fileSelected(attr_filename);
|
|
|
|
});
|
2016-03-08 17:34:34 +00:00
|
|
|
$('#folderselect').click(function(ev) {
|
|
|
|
attr_foldername = $(ev.currentTarget).attr('foldername');
|
|
|
|
folderSelected(attr_foldername);
|
|
|
|
});
|
2015-12-14 14:16:32 +00:00
|
|
|
<?php
|
|
|
|
} /* }}} */
|
|
|
|
|
2012-12-14 07:53:13 +00:00
|
|
|
function show() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$dropfolderfile = $this->params['dropfolderfile'];
|
|
|
|
$form = $this->params['form'];
|
|
|
|
$dropfolderdir = $this->params['dropfolderdir'];
|
2015-09-03 13:16:20 +00:00
|
|
|
$cachedir = $this->params['cachedir'];
|
|
|
|
$previewwidth = $this->params['previewWidthList'];
|
2016-02-15 09:57:37 +00:00
|
|
|
$timeout = $this->params['timeout'];
|
2016-03-08 17:34:34 +00:00
|
|
|
$showfolders = $this->params['showfolders'];
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2016-02-15 09:57:37 +00:00
|
|
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
|
2015-09-03 13:16:20 +00:00
|
|
|
|
2012-12-14 07:53:13 +00:00
|
|
|
$dir = $dropfolderdir.'/'.$user->getLogin();
|
2013-02-08 15:03:53 +00:00
|
|
|
/* Check if we are still looking in the configured directory and
|
|
|
|
* not somewhere else, e.g. if the login was '../test'
|
|
|
|
*/
|
|
|
|
if(dirname($dir) == $dropfolderdir) {
|
|
|
|
if(is_dir($dir)) {
|
|
|
|
$d = dir($dir);
|
2015-09-03 13:16:20 +00:00
|
|
|
echo "<table class=\"table table-condensed\">\n";
|
|
|
|
echo "<thead>\n";
|
|
|
|
echo "<tr><th></th><th>".getMLText('name')."</th><th align=\"right\">".getMLText('file_size')."</th><th>".getMLText('date')."</th></tr>\n";
|
|
|
|
echo "</thead>\n";
|
|
|
|
echo "<tbody>\n";
|
|
|
|
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
2013-02-08 15:03:53 +00:00
|
|
|
while (false !== ($entry = $d->read())) {
|
|
|
|
if($entry != '..' && $entry != '.') {
|
2016-03-08 17:34:34 +00:00
|
|
|
if(!is_dir($dir.'/'.$entry)) {
|
2015-09-03 13:16:20 +00:00
|
|
|
$mimetype = finfo_file($finfo, $dir.'/'.$entry);
|
|
|
|
$previewer->createRawPreview($dir.'/'.$entry, 'dropfolder/', $mimetype);
|
|
|
|
echo "<tr><td style=\"min-width: ".$previewwidth."px;\">";
|
|
|
|
if($previewer->hasRawPreview($dir.'/'.$entry, 'dropfolder/')) {
|
|
|
|
echo "<img class=\"mimeicon\" width=\"".$previewwidth."\"src=\"../op/op.DropFolderPreview.php?filename=".$entry."&width=".$previewwidth."\" title=\"".htmlspecialchars($mimetype)."\">";
|
|
|
|
}
|
2016-03-16 08:29:37 +00:00
|
|
|
echo "</td><td><span style=\"cursor: pointer;\" class=\"fileselect\" filename=\"".$entry."\">".$entry."</span></td><td align=\"right\">".SeedDMS_Core_File::format_filesize(filesize($dir.'/'.$entry))."</td><td>".date('Y-m-d H:i:s', filectime($dir.'/'.$entry))."</td></tr>\n";
|
2016-03-08 17:34:34 +00:00
|
|
|
} elseif($showfolders) {
|
|
|
|
echo "<tr>";
|
|
|
|
echo "<td></td>";
|
|
|
|
echo "<td><span style=\"cursor: pointer;\" id=\"folderselect\" foldername=\"".$entry."\" >".$entry."</span></td><td align=\"right\"></td><td></td>";
|
|
|
|
echo "</tr>\n";
|
2013-02-08 15:03:53 +00:00
|
|
|
}
|
2012-12-14 07:53:13 +00:00
|
|
|
}
|
|
|
|
}
|
2015-09-03 13:16:20 +00:00
|
|
|
echo "</tbody>\n";
|
2013-02-08 15:03:53 +00:00
|
|
|
echo "</table>\n";
|
2016-03-08 17:34:34 +00:00
|
|
|
echo '<script src="../out/out.DropFolderChooser.php?action=js&'.$_SERVER['QUERY_STRING'].'"></script>'."\n";
|
2012-12-14 07:53:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} /* }}} */
|
|
|
|
}
|
|
|
|
?>
|