mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-13 21:21:27 +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"])
|
if (isset($_GET["includecontent"]) && $_GET["includecontent"])
|
||||||
$includecontent = true;
|
$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;
|
$fullsearch = ((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext') || !empty($_GET["fullsearch"])) && $settings->_enableFullSearch;
|
||||||
if($fullsearch) {
|
if($fullsearch) {
|
||||||
// Search in Fulltext {{{
|
// Search in Fulltext {{{
|
||||||
|
@ -553,6 +558,7 @@ if($settings->_showSingleSearchHit && count($entries) == 1) {
|
||||||
$view->setParam('accessobject', $accessop);
|
$view->setParam('accessobject', $accessop);
|
||||||
$view->setParam('query', $query);
|
$view->setParam('query', $query);
|
||||||
$view->setParam('includecontent', $includecontent);
|
$view->setParam('includecontent', $includecontent);
|
||||||
|
$view->setParam('newowner', $newowner);
|
||||||
$view->setParam('searchhits', $entries);
|
$view->setParam('searchhits', $entries);
|
||||||
$view->setParam('totalpages', $totalPages);
|
$view->setParam('totalpages', $totalPages);
|
||||||
$view->setParam('pagenumber', $pageNumber);
|
$view->setParam('pagenumber', $pageNumber);
|
||||||
|
|
|
@ -63,6 +63,10 @@ $(document).ready( function() {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
window.location.href = $(this).attr('href')+'&includecontent='+($('#includecontent').prop('checked') ? '1' : '0');
|
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
|
<?php
|
||||||
// $this->printFolderChooserJs("form1");
|
// $this->printFolderChooserJs("form1");
|
||||||
|
@ -120,6 +124,29 @@ $(document).ready(function() {
|
||||||
unlink($filename);
|
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() { /* {{{ */
|
function opensearchsuggestion() { /* {{{ */
|
||||||
$dms = $this->params['dms'];
|
$dms = $this->params['dms'];
|
||||||
$user = $this->params['user'];
|
$user = $this->params['user'];
|
||||||
|
@ -524,7 +551,9 @@ function typeahead() { /* {{{ */
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
$this->formSubmit("<i class=\"fa fa-search\"></i> ".getMLText('search'));
|
$this->formSubmit("<i class=\"fa fa-search\"></i> ".getMLText('search'));
|
||||||
|
?>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
if($totaldocs) {
|
if($totaldocs) {
|
||||||
ob_start();
|
ob_start();
|
||||||
$this->formField(
|
$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";
|
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();
|
$content = ob_get_clean();
|
||||||
$this->printAccordion(getMLText('export'), $content);
|
$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>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
// }}}
|
// }}}
|
||||||
|
@ -704,6 +752,10 @@ function typeahead() { /* {{{ */
|
||||||
}
|
}
|
||||||
$this->columnEnd();
|
$this->columnEnd();
|
||||||
$this->columnStart(8);
|
$this->columnStart(8);
|
||||||
|
if($batchmsg = $this->getParam('batchmsg')) {
|
||||||
|
$this->contentHeading(getMLText('batch_operation_result'));
|
||||||
|
echo $this->infoMsg($batchmsg);
|
||||||
|
}
|
||||||
$this->contentHeading(getMLText('search_results'));
|
$this->contentHeading(getMLText('search_results'));
|
||||||
// Search Result {{{
|
// Search Result {{{
|
||||||
$foldercount = $doccount = 0;
|
$foldercount = $doccount = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user