restrict operation on selected documents

This commit is contained in:
Uwe Steinmann 2022-05-09 09:58:05 +02:00
parent 2aa67b93a0
commit 2b6a68cc28
2 changed files with 48 additions and 2 deletions

View File

@ -53,6 +53,11 @@ if (isset($_GET["task"])) {
$task = $_GET['task'];
}
$type = null;
if (isset($_GET["type"])) {
$type = $_GET['type'];
}
$allusers = $dms->getAllUsers($settings->_sortUsersInList);
if($view) {
@ -60,6 +65,7 @@ if($view) {
$view->setParam('rmuser', $rmuser);
$view->setParam('allusers', $allusers);
$view->setParam('task', $task);
$view->setParam('type', $type);
$view->setParam('cachedir', $settings->_cacheDir);
$view->setParam('rootfolder', $dms->getFolder($settings->_rootFolderID));
$view->setParam('conversionmgr', $conversionmgr);

View File

@ -43,8 +43,12 @@ $(document).ready( function() {
$('body').on('click', 'label.checkbox, td span', function(ev){
ev.preventDefault();
$('#kkkk.ajax').data('action', $(this).data('action'));
$('#kkkk.ajax').trigger('update', {userid: $(this).data('userid'), task: $(this).data('task')});
$('#kkkk.ajax').trigger('update', {userid: $(this).data('userid'), task: $(this).data('task'), type: $(this).data('type')});
});
$('body').on('click', '#selectall', function(ev){
$("input.markforprocess").each(function () { this.checked = !this.checked; });
ev.preventDefault();
});
});
<?php
} /* }}} */
@ -60,7 +64,9 @@ $(document).ready( function() {
$previewconverters = $this->params['previewconverters'];
$timeout = $this->params['timeout'];
$rmuser = $this->params['rmuser'];
$allusers = $this->params['allusers'];
$task = $this->params['task'];
$type = $this->params['type'];
if(!$task)
return;
@ -155,12 +161,23 @@ $(document).ready( function() {
break;
}
if($docs) {
echo '<form id="processform" action="../op/op.UsrMgr.php" method="post">';
echo '<input type="hidden" name="userid" value="'.$rmuser->getID().'">';
if($type) {
$kk = explode('_', $type, 2);
echo '<input type="hidden" name="status['.$kk[0].'][]" value="'.$kk[1].'">';
}
echo '<input type="hidden" name="task" value="'.$task.'">';
echo '<input type="hidden" name="action" value="removefromprocesses">';
echo '<input type="hidden" name="needsdocs" value="1">';
echo createHiddenFieldWithKey('removefromprocesses');
print "<table class=\"table table-condensed table-sm\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "<th><span id=\"selectall\"><i class=\"fa fa-arrows-h\" title=\"".getMLText('object_cleaner_toggle_checkboxes')."\"></i></span></th>\n";
print "</tr>\n</thead>\n<tbody>\n";
foreach($docs as $document) {
$document->verifyLastestContentExpriry();
@ -174,11 +191,33 @@ $(document).ready( function() {
$extracontent['below_title'] = $this->getListRowPath($document);
echo $this->documentListRowStart($document);
echo $this->documentListRow($document, $previewer, true, 0, $extracontent);
echo '<td>';
echo '<input type="checkbox" class="markforprocess" value="'.$document->getId().'" name="docs['.$document->getId().']">';
echo '</td>';
echo $this->documentListRowEnd($document);
}
}
}
echo "</tbody>\n</table>";
$options = array(array(0, getMLText('do_no_transfer_to_user')));
foreach ($allusers as $currUser) {
if ($currUser->isGuest() || ($currUser->getID() == $rmuser->getID()) )
continue;
if ($rmuser && $currUser->getID()==$rmuser->getID()) $selected=$count;
$options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin()." - ".$currUser->getFullName()));
}
$this->formField(
getMLText("transfer_process_to_user"),
array(
'element'=>'select',
'name'=>'assignTo',
'class'=>'chzn-select',
'options'=>$options
)
);
echo '<p><button type="submit" class="btn btn-primary"><i class="fa fa-remove"></i> '.getMLText('transfer').'</button>';
echo '</form>';
}
} /* }}} */
@ -186,6 +225,7 @@ $(document).ready( function() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$rmuser = $this->params['rmuser'];
$allusers = $this->params['allusers'];
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();
@ -291,7 +331,7 @@ $(document).ready( function() {
<?php
echo "<table class=\"table table-condensed table-sm\">";
foreach($out as $o) {
echo "<tr><td>".$o[3]."</td><td>".$o[4]."</td><td><input style=\"margin-top: 0px;\" type=\"checkbox\" name=\"status[".$o[1]."][]\" value=\"".$o[0]."\"></td><td><span data-action=\"printList\" data-userid=\"".$rmuser->getId()."\" data-task=\"".$o[1]."s_".$o[2]."\"><i class=\"fa fa-list\"></i></span></td></tr>";
echo "<tr><td>".$o[3]."</td><td>".$o[4]."</td><td><input style=\"margin-top: 0px;\" type=\"checkbox\" name=\"status[".$o[1]."][]\" value=\"".$o[0]."\"></td><td><span data-action=\"printList\" data-userid=\"".$rmuser->getId()."\" data-task=\"".$o[1]."s_".$o[2]."\" data-type=\"".$o[1]."_".$o[0]."\"><i class=\"fa fa-list\"></i></span></td></tr>";
}
echo "</table>";