mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 20:21:16 +00:00
add batch operation to change owner
This commit is contained in:
parent
cac7608e0b
commit
966a6eb976
|
@ -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);
|
||||
|
|
|
@ -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());
|
||||
});
|
||||
});
|
||||
<?php
|
||||
// $this->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("<i class=\"fa fa-search\"></i> ".getMLText('search'));
|
||||
|
||||
?>
|
||||
</form>
|
||||
<?php
|
||||
if($totaldocs) {
|
||||
ob_start();
|
||||
$this->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'), "<i class=\"fa fa-download\"></i> ".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'), "<i class=\"fa fa-user\"></i> ".getMLText("change_owner"), false, true)."\n";
|
||||
$content = ob_get_clean();
|
||||
$this->printAccordion(getMLText('change_owner'), $content);
|
||||
}
|
||||
|
||||
?>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
// }}}
|
||||
|
@ -704,6 +752,10 @@ function typeahead() { /* {{{ */
|
|||
}
|
||||
$this->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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user