seeddms-code/views/bootstrap/class.LogManagement.php

164 lines
5.5 KiB
PHP
Raw Normal View History

2012-12-14 07:53:13 +00:00
<?php
/**
* Implementation of LogManagement view
*
* @category DMS
* @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");
/**
* Class which outputs the html page for LogManagement view
*
* @category DMS
* @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@
*/
class SeedDMS_View_LogManagement extends SeedDMS_Bootstrap_Style {
2012-12-14 07:53:13 +00:00
function filelist($entries, $mode) { /* {{{ */
$print_header = true;
2012-12-14 07:53:13 +00:00
foreach ($entries as $entry){
if ($print_header){
print "<form action=\"out.RemoveLog.php\" method=\"get\">\n";
2012-12-14 07:53:13 +00:00
print "<table class=\"table-condensed\">\n";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
2012-12-14 07:53:13 +00:00
print "<th>".getMLText("creation_date")."</th>\n";
print "<th>".getMLText("file_size")."</th>\n";
print "<th></th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$print_header=false;
}
print "<tr>\n";
print "<td><input type=\"checkbox\" name=\"logname[]\" value=\"".$entry."\"/></td>\n";
2012-12-14 07:53:13 +00:00
print "<td><a href=\"out.LogManagement.php?logname=".$entry."\">".$entry."</a></td>\n";
print "\n";
2013-02-08 08:07:35 +00:00
print "<td>".getLongReadableDate(filectime($this->contentdir.$entry))."</td>\n";
print "<td>".SeedDMS_Core_File::format_filesize(filesize($this->contentdir.$entry))."</td>\n";
2012-12-14 07:53:13 +00:00
print "<td>";
print "<a href=\"out.RemoveLog.php?mode=".$mode."&logname=".$entry."\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("rm_file")."</a>";
2012-12-14 07:53:13 +00:00
print "&nbsp;";
2013-01-24 09:24:06 +00:00
print "<a href=\"../op/op.Download.php?logname=".$entry."\" class=\"btn btn-mini\"><i class=\"icon-download\"></i> ".getMLText("download")."</a>";
print "&nbsp;";
2013-01-24 09:24:06 +00:00
print "<a data-target=\"#logViewer\" data-cache=\"false\" href=\"out.LogManagement.php?logname=".$entry."\" role=\"button\" class=\"btn btn-mini\" data-toggle=\"modal\"><i class=\"icon-eye-open\"></i> ".getMLText('view')." …</a>";
2012-12-14 07:53:13 +00:00
print "</td>\n";
print "</tr>\n";
}
if ($print_header) printMLText("empty_notify_list");
else print "<tr><td><i class=\"icon-arrow-up\"></i></td><td colspan=\"2\"><button type=\"submit\" class=\"btn\"><i class=\"icon-remove\"></i> ".getMLText('remove_marked_files')."</button></td></tr></table></form>\n";
2015-12-16 06:14:04 +00:00
} /* }}} */
function js() { /* {{{ */
2016-01-28 15:50:06 +00:00
header('Content-Type: application/javascript');
2014-11-24 12:11:00 +00:00
?>
$(document).ready( function() {
$('i.icon-arrow-up').on('click', function(e) {
//var checkBoxes = $("input[type=checkbox]");
//checkBoxes.prop("checked", !checkBoxes.prop("checked"));
$('input[type=checkbox]').prop('checked', true);
});
});
<?php
} /* }}} */
2012-12-14 07:53:13 +00:00
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
2013-02-08 08:07:35 +00:00
$this->contentdir = $this->params['contentdir'];
$logname = $this->params['logname'];
$mode = $this->params['mode'];
2012-12-14 07:53:13 +00:00
if(!$logname) {
2013-03-06 14:19:15 +00:00
$this->htmlStartPage(getMLText("log_management"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
2012-12-14 07:53:13 +00:00
$this->contentHeading(getMLText("log_management"));
$entries = array();
$wentries = array();
2013-02-08 08:13:57 +00:00
$handle = opendir($this->contentdir);
if($handle) {
while ($e = readdir($handle)){
if (is_dir($this->contentdir.$e)) continue;
if (strpos($e,".log")==FALSE) continue;
if (strcmp($e,"current.log")==0) continue;
if(substr($e, 0, 6) == 'webdav') {
$wentries[] = $e;
} else {
$entries[] = $e;
}
}
2013-02-08 08:13:57 +00:00
closedir($handle);
2012-12-14 07:53:13 +00:00
2013-02-08 08:13:57 +00:00
sort($entries);
sort($wentries);
$entries = array_reverse($entries);
$wentries = array_reverse($wentries);
}
?>
<ul class="nav nav-tabs" id="logtab">
<li <?php echo ($mode == 'web') ? 'class="active"' : ''; ?>><a data-target="#web" data-toggle="tab">web</a></li>
<li <?php echo ($mode == 'webdav') ? 'class="active"' : ''; ?>><a data-target="#webdav" data-toggle="tab">webdav</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane <?php echo ($mode == 'web') ? 'active' : ''; ?>" id="web">
<?php
$this->contentContainerStart();
$this->filelist($entries, 'web');
$this->contentContainerEnd();
?>
</div>
<div class="tab-pane <?php echo ($mode == 'webdav') ? 'active' : ''; ?>" id="webdav">
<?php
$this->contentContainerStart();
$this->filelist($wentries, 'webdav');
$this->contentContainerEnd();
?>
</div>
</div>
<div class="modal hide" style="width: 900px; margin-left: -450px;" id="logViewer" tabindex="-1" role="dialog" aria-labelledby="docChooserLabel" aria-hidden="true">
<div class="modal-body">
<p>Please wait, until document tree is loaded </p>
</div>
<div class="modal-footer">
2013-09-05 20:51:01 +00:00
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true"><?php print getMLText("close"); ?></button>
</div>
</div>
<?php
$this->htmlEndPage();
2013-02-08 08:07:35 +00:00
} elseif(file_exists($this->contentdir.$logname)){
echo $logname."<pre>\n";
2013-02-08 08:07:35 +00:00
readfile($this->contentdir.$logname);
2012-12-14 07:53:13 +00:00
echo "</pre>\n";
} else {
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
2012-12-14 07:53:13 +00:00
}
} /* }}} */
}
?>