diff --git a/CHANGELOG b/CHANGELOG index 873a00a9f..199a49b39 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -329,6 +329,8 @@ - fix possible xss attacks - saver way to collect plugin configuration - fix update of postgres database +- add hook displayPreviewThumb +- add searching for mimetype in database -------------------------------------------------------------------------------- Changes in version 5.1.39 diff --git a/op/op.Settings.php b/op/op.Settings.php index 2adf25d95..ea861fdec 100644 --- a/op/op.Settings.php +++ b/op/op.Settings.php @@ -293,7 +293,7 @@ if ($action == "saveSettings") // SETTINGS - ADVANCED - SERVER setStrValue("coreDir"); setStrValue("luceneClassDir"); - setIntValue("contentOffsetDir"); + setStrValue("contentOffsetDir"); setIntValue("maxDirID"); setIntValue("updateNotifyTime"); setIntValue("maxExecutionTime"); diff --git a/out/out.Search.php b/out/out.Search.php index a456b6e0b..368d29a1c 100644 --- a/out/out.Search.php +++ b/out/out.Search.php @@ -594,6 +594,21 @@ if($fullsearch) { } /* }}} */ + // Check to see if the search has been restricted to a particular + // mimetype. {{{ + $mimetype = []; + if (isset($_GET["mimetype"])) { + if (!is_array($_GET['mimetype'])) { + if(!empty($_GET['mimetype'])) + $mimetype[] = $_GET['mimetype']; + } else { + foreach($_GET["mimetype"] as $l) { + if($l) + $mimetype[] = $l; + } + } + } /* }}} */ + // status $status = isset($_GET['status']) ? $_GET['status'] : array(); /* @@ -695,6 +710,7 @@ if($fullsearch) { 'startFolder'=>$startFolder, 'owner'=>$ownerobjs, 'status'=>$status, + 'mimetype'=>$mimetype, 'creationstartdate'=>$created['from'], //$createstartdate ? $createstartdate : array(), 'creationenddate'=>$created['to'], //$createenddate ? $createenddate : array(), 'modificationstartdate'=>$modified['from'], diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index b8ac12770..888912e6c 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -2691,9 +2691,9 @@ $(function() { * * @param string text */ - function printInlineEdit($text, $object){ /* {{{ */ + function printInlineEditDocumentName($text, $object){ /* {{{ */ if(!empty($this->params['settings']->_inlineEditing)) { - echo "isType('document')) echo " data-document=\"".$object->getId()."\" data-formtoken=\"".createFormKey('setdocumentname')."\""; echo ">".$text; diff --git a/views/bootstrap/class.Charts.php b/views/bootstrap/class.Charts.php index a370f646d..2ee5b797e 100644 --- a/views/bootstrap/class.Charts.php +++ b/views/bootstrap/class.Charts.php @@ -246,34 +246,36 @@ $(document).ready( function() { protected function getSearchUrl($type, $item) { $dms = $this->params['dms']; + $settings = $this->params['settings']; $searchurl = null; switch($type) { case 'docsperuser': case 'sizeperuser': - $searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&owner%5B%5D='.$item['res']; + $searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&owner%5B%5D='.$item['res']; break; case 'foldersperuser': - $searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=2&owner%5B%5D='.$item['res']; + $searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=2&owner%5B%5D='.$item['res']; break; case 'docspercategory': - $searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&category%5B%5D='.$item['res']; + $searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&category%5B%5D='.$item['res']; break; case 'docsperstatus': - $searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&status%5B%5D='.$item['res']; + $searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&status%5B%5D='.$item['res']; break; case 'docspermonth': case 'sizepermonth': $startmonth = $item['key'].'-01'; $endmonth = date('Y-m-t', strtotime($startmonth)); - $searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&created%5Bfrom%5D='.$startmonth.'&created%5Bto%5D='.$endmonth; + $searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&created%5Bfrom%5D='.$startmonth.'&created%5Bto%5D='.$endmonth; break; case 'docspermimetype': + $searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&mimetype%5B%5D='.urlencode($item['key']); break; case 'docsaccumulated': $start = date('Y-m-d', $item['key']/1000); $end = date('Y-m-d', $item['key']/1000 + 86400); - $searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&created%5Bfrom%5D='.$start.'&created%5Bto%5D='.$end; + $searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&created%5Bfrom%5D='.$start.'&created%5Bto%5D='.$end; break; } return $searchurl; diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index e4efc13b9..4680e570f 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -547,6 +547,12 @@ $(document).ready(function() { callHook('extraTabs'); + if($tabs) { + foreach($tabs as $tabid=>$tab) { + echo ''; + } + } ?>
@@ -712,6 +718,8 @@ $(document).ready(function() { $openfilterdlg = true; if($status) $openfilterdlg = true; + if($mimetype) + $openfilterdlg = true; if($modifyenddate || $modifystartdate) $openfilterdlg = true; if($revisionstartdate || $revisionenddate) @@ -773,6 +781,22 @@ $(document).ready(function() { 'options'=>$options ) ); + $options = []; + foreach($dms->getMimeTypes() as $m) { + $options[] = array($m['mimeType'], $m['mimeType'], in_array($m['mimeType'], $mimetype)/*, array(array('data-subtitle', htmlspecialchars($m['c'].' ×')))*/); + } + $this->formField( + getMLText("mimetype"), + array( + 'element'=>'select', + 'class'=>'chzn-select', + 'name'=>'mimetype[]', + 'multiple'=>true, + 'attributes'=>array(array('data-placeholder', getMLText('select_mimetype')), array('data-no_results_text', getMLText('no_mimetype'))), + 'options'=>$options + ) + ); + $this->formField( getMLText("modified")." (".getMLText('from').")", $this->getDateChooser(!empty($modifystartdate) ? getReadableDate($modifystartdate) : null, "modified[from]", $this->params['session']->getLanguage()) @@ -1486,6 +1510,14 @@ $(document).ready(function() { echo "
\n"; } // }}} + + if($tabs) { + foreach($tabs as $tabid=>$tab) { + echo '
'; + echo $tab['content']; + echo "
\n"; + } + } ?> "; print ""; - $previewer->createPreview($file, $previewwidthdetail); if($file_exists) { + $previewer->createPreview($file, $previewwidthdetail); if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) { if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) { print "params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\">"; @@ -338,15 +338,15 @@ $(document).ready( function() { print "params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\">"; } } - } - if($previewer->hasPreview($file)) { - print("params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&file=".$file->getID()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($file->getMimeType())."\">"); - } else { - print "getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">"; - } - if($file_exists) { + if($previewer->hasPreview($file)) { + print("params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&file=".$file->getID()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($file->getMimeType())."\">"); + } else { + print "getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">"; + } if($accessobject->check_controller_access('Download', array('action'=>'run')) || $accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) print ""; + } else { + print "getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">"; } print ""; @@ -440,7 +440,7 @@ $(document).ready( function() { ?> : - printInlineEdit(htmlspecialchars($document->getName()), $document);?> + printInlineEditDocumentName(htmlspecialchars($document->getName()), $document);?> : @@ -747,23 +747,30 @@ $(document).ready( function() { $this->rowStart(); $this->columnStart(3); if ($file_exists) { - if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) { - if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) - print "params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">"; - } else { - if($accessobject->check_controller_access('Download', array('action'=>'version'))) - print "params['settings']->_httpRoot."op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">"; + $previewer->createPreview($latestContent); + $previewhtml = $this->callHook('documentPreviewThumb', $previewer, $latestContent->getDocument(), $latestContent); + if(is_string($previewhtml)) + echo $previewhtml; + else { + if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) { + if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) + print "params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">"; + } else { + if($accessobject->check_controller_access('Download', array('action'=>'version'))) + print "params['settings']->_httpRoot."op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">"; + } + if($previewer->hasPreview($latestContent)) { + print("params['settings']->_httpRoot."op/op.Preview.php?documentid=".$latestContent->getDocument()->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"); + } else { + print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } + if ($accessobject->check_controller_access('ViewOnline', array('action'=>'run')) || $accessobject->check_controller_access('Download', array('action'=>'version'))) { + print ""; + } } - } - $previewer->createPreview($latestContent); - if($previewer->hasPreview($latestContent)) { - print("params['settings']->_httpRoot."op/op.Preview.php?documentid=".$latestContent->getDocument()->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"); } else { print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; } - if ($file_exists && ($accessobject->check_controller_access('ViewOnline', array('action'=>'run')) || $accessobject->check_controller_access('Download', array('action'=>'version')))) { - print ""; - } // print "\n"; // print ""; diff --git a/views/bootstrap/styles/application.js b/views/bootstrap/styles/application.js index bb3affe27..cc8b8508c 100644 --- a/views/bootstrap/styles/application.js +++ b/views/bootstrap/styles/application.js @@ -721,8 +721,7 @@ $(document).ready( function() { window.history.back(); }); /* }}} */ - $("body").on("blur", "span.editable", function(e) { /* {{{ */ - console.log($(this).data('document')); + $("body").on("blur", "span.editdocname", function(e) { /* {{{ */ e.preventDefault(); $.post(seeddms_webroot+"op/op.Ajax.php", { command: "setdocumentname", id: $(this).data('document'), formtoken: $(this).data('formtoken'), name: $(this).text() }) .done(function( data ) { diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 74a662e25..c4fc9c16f 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -2641,9 +2641,9 @@ $(function() { * * @param string text */ - function printInlineEdit($text, $object){ /* {{{ */ + function printInlineEditDocumentName($text, $object){ /* {{{ */ if(!empty($this->params['settings']->_inlineEditing)) { - echo "isType('document')) echo " data-document=\"".$object->getId()."\" data-formtoken=\"".createFormKey('setdocumentname')."\""; echo ">".$text; diff --git a/views/bootstrap4/styles/application.js b/views/bootstrap4/styles/application.js index b81f9a439..aea1d6ff3 100644 --- a/views/bootstrap4/styles/application.js +++ b/views/bootstrap4/styles/application.js @@ -769,8 +769,7 @@ $(document).ready( function() { window.history.back(); }); /* }}} */ - $("body").on("blur", "span.editable", function(e) { /* {{{ */ - console.log($(this).data('document')); + $("body").on("blur", "span.editdocname", function(e) { /* {{{ */ e.preventDefault(); $.post(seeddms_webroot+"op/op.Ajax.php", { command: "setdocumentname", id: $(this).data('document'), formtoken: $(this).data('formtoken'), name: $(this).text() }) .done(function( data ) {