allow to change owner of folders, change owner only possible of search returned hits

This commit is contained in:
Uwe Steinmann 2022-08-18 20:41:11 +02:00
parent e1aaf3a7b8
commit 4eef2bd0b0

View File

@ -130,15 +130,15 @@ $(document).ready(function() {
$entries = $this->params['searchhits'];
$newowner = $this->params['newowner'];
if ($user->isAdmin()) {
$j = 0;
if($newowner && $user->isAdmin()) {
$j = $i = 0;
foreach($entries as $entry) {
if($entry->isType('document')) {
// 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 {
@ -570,10 +570,13 @@ 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);
}
if($total) {
ob_start();
$users = $dms->getAllUsers();
$options = array();
$options[] = array("-1", getMLText("choose_user"));
foreach ($users as $currUser) {
$options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin().' - '.$currUser->getFullName()), false, array(array('data-subtitle', htmlspecialchars($currUser->getEmail()))));
}
@ -587,9 +590,9 @@ function typeahead() { /* {{{ */
'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";
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("batch_change_owner"), false, true)."\n";
$content = ob_get_clean();
$this->printAccordion(getMLText('change_owner'), $content);
$this->printAccordion(getMLText('batch_change_owner'), $content);
}
?>