diff --git a/out/out.Search.php b/out/out.Search.php index f99a43d1a..d5c6a372e 100644 --- a/out/out.Search.php +++ b/out/out.Search.php @@ -53,6 +53,11 @@ $includecontent = false; if (isset($_GET["includecontent"]) && $_GET["includecontent"]) $includecontent = true; +$newowner = null; +if (isset($_GET["newowner"]) && is_numeric($_GET["newowner"]) && $_GET['newowner'] > 0) { + $newowner = $dms->getUser((int) $_GET['newowner']); +} + $fullsearch = ((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext') || !empty($_GET["fullsearch"])) && $settings->_enableFullSearch; if($fullsearch) { // Search in Fulltext {{{ @@ -553,6 +558,7 @@ if($settings->_showSingleSearchHit && count($entries) == 1) { $view->setParam('accessobject', $accessop); $view->setParam('query', $query); $view->setParam('includecontent', $includecontent); + $view->setParam('newowner', $newowner); $view->setParam('searchhits', $entries); $view->setParam('totalpages', $totalPages); $view->setParam('pagenumber', $pageNumber); diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index 85d79736e..4a05978ff 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -63,6 +63,10 @@ $(document).ready( function() { e.preventDefault(); window.location.href = $(this).attr('href')+'&includecontent='+($('#includecontent').prop('checked') ? '1' : '0'); }); + $('#changeowner').on('click', function(e) { + e.preventDefault(); + window.location.href = $(this).attr('href')+'&newowner='+($('#newowner').val()); + }); }); printFolderChooserJs("form1"); @@ -120,6 +124,29 @@ $(document).ready(function() { unlink($filename); } /* }}} */ + function changeowner() { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; + $entries = $this->params['searchhits']; + $newowner = $this->params['newowner']; + + if ($user->isAdmin()) { + $j = 0; + foreach($entries as $entry) { + if($entry->isType('document')) { + if($entry->getOwner()->getId() != $newowner->getId()) { + $entry->setOwner($newowner); + $j++; + } + } + } + $this->setParam('batchmsg', getMLText('batch_new_owner_msg', ['count'=>$j])); + } else { + } + + return self::show(); + } /* }}} */ + function opensearchsuggestion() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; @@ -524,7 +551,9 @@ function typeahead() { /* {{{ */ // }}} $this->formSubmit(" ".getMLText('search')); - +?> + +formField( @@ -541,10 +570,29 @@ function typeahead() { /* {{{ */ print $this->html_link('Search', array_merge($_GET, array('action'=>'export')), array('class'=>'btn btn-primary', 'id'=>'export'), " ".getMLText("export"), false, true)."\n"; $content = ob_get_clean(); $this->printAccordion(getMLText('export'), $content); + + ob_start(); + $users = $dms->getAllUsers(); + $options = array(); + foreach ($users as $currUser) { + $options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin().' - '.$currUser->getFullName()), false, array(array('data-subtitle', htmlspecialchars($currUser->getEmail())))); + } + $this->formField( + null, //getMLText("selection"), + array( + 'element'=>'select', + 'id'=>'newowner', + 'class'=>'chzn-select', + 'options'=>$options, + 'placeholder'=>getMLText('select_users'), + ) + ); + print $this->html_link('Search', array_merge($_GET, array('action'=>'changeowner')), array('class'=>'btn btn-primary', 'id'=>'changeowner'), " ".getMLText("change_owner"), false, true)."\n"; + $content = ob_get_clean(); + $this->printAccordion(getMLText('change_owner'), $content); } ?> - columnEnd(); $this->columnStart(8); + if($batchmsg = $this->getParam('batchmsg')) { + $this->contentHeading(getMLText('batch_operation_result')); + echo $this->infoMsg($batchmsg); + } $this->contentHeading(getMLText('search_results')); // Search Result {{{ $foldercount = $doccount = 0;