add button to reorder docs in a folder if sequence numbers are not unique

This commit is contained in:
Uwe Steinmann 2022-11-14 16:25:22 +01:00
parent b6a0b45867
commit 3b473edd25
2 changed files with 26 additions and 4 deletions

View File

@ -229,6 +229,11 @@ if(!isset($_GET['action']) || $_GET['action'] == 'listRepair')
else
$repairobjects = null;
if(isset($_GET['repairfolderid']) && is_numeric($_GET['repairfolderid']))
$repairfolder = $dms->getFolder($_GET['repairfolderid']);
else
$repairfolder = null;
if($view) {
$view->setParam('folder', $folder);
$view->setParam('showtree', showtree());
@ -250,6 +255,7 @@ if($view) {
$view->setParam('setchecksum', $setchecksum);
$view->setParam('setfiletype', $setfiletype);
$view->setParam('repair', $repair);
$view->setParam('repairfolder', $repairfolder);
$view->setParam('showtree', showtree());
$view->setParam('rootfolder', $rootfolder);
$view->setParam('repairobjects', $repairobjects);

View File

@ -186,8 +186,8 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Theme_Style {
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("id")."</th>\n";
print "<th>".getMLText("parent_folder")."</th>\n";
print "<th></th>\n";
print "<th>".getMLText("error")."</th>\n";
// print "<th></th>\n";
print "</tr>\n</thead>\n<tbody>\n";
foreach($unlinkedfolders as $error) {
echo "<tr>";
@ -195,7 +195,7 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Theme_Style {
echo "<td>".$error['id']."</td>";
echo "<td>".$error['parent']."</td>";
echo "<td>".$error['msg']."</td>";
echo "<td><a class=\"btn btn-primary btn-mini btn-sm movefolder\" source=\"".$error['id']."\" dest=\"".$rootfolder->getID()."\" formtoken=\"".createFormKey('movefolder')."\" title=\"".getMLText("move_into_rootfolder")."\">".getMLText('move')."</a> </td>";
// echo "<td><a class=\"btn btn-primary btn-mini btn-sm movefolder\" source=\"".$error['id']."\" dest=\"".$rootfolder->getID()."\" formtoken=\"".createFormKey('movefolder')."\" title=\"".getMLText("move_into_rootfolder")."\">".getMLText('move')."</a> </td>";
echo "</tr>";
}
print "</tbody></table>\n";
@ -217,7 +217,7 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Theme_Style {
print "<th>".getMLText("id")."</th>\n";
print "<th>".getMLText("parent_folder")."</th>\n";
print "<th>".getMLText("error")."</th>\n";
print "<th></th>\n";
// print "<th></th>\n";
print "</tr>\n</thead>\n<tbody>\n";
foreach($unlinkeddocuments as $error) {
echo "<tr>";
@ -225,7 +225,7 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Theme_Style {
echo "<td>".$error['id']."</td>";
echo "<td>".$error['parent']."</td>";
echo "<td>".$error['msg']."</td>";
echo "<td><a class=\"btn btn-primary btn-mini btn-sm movedocument\" source=\"".$error['id']."\" dest=\"".$rootfolder->getID()."\" formtoken=\"".createFormKey('movedocument')."\" title=\"".getMLText("move_into_rootfolder")."\">".getMLText('move')."</a> </td>";
// echo "<td><a class=\"btn btn-primary btn-mini btn-sm movedocument\" source=\"".$error['id']."\" dest=\"".$rootfolder->getID()."\" formtoken=\"".createFormKey('movedocument')."\" title=\"".getMLText("move_into_rootfolder")."\">".getMLText('move')."</a> </td>";
echo "</tr>";
}
print "</tbody></table>\n";
@ -438,6 +438,7 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Theme_Style {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$repairfolder = $this->params['repairfolder'];
$duplicatesequences = $this->params['duplicatesequences'];
$this->contentHeading(getMLText("duplicate_sequences"));
@ -449,6 +450,7 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Theme_Style {
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("owner")."</th>\n";
print "<th>".getMLText("actions")."</th>\n";
print "<th></th>\n";
print "</tr></thead>\n<tbody>\n";
foreach($duplicatesequences as $fld) {
echo $this->folderListRowStart($fld);
@ -458,6 +460,15 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Theme_Style {
else {
echo $this->folderListRow($fld, true);
}
echo "<td>";
if($repairfolder && ($fld->getId() == $repairfolder->getId())) {
if($fld->reorderDocuments())
echo "Ok";
else
echo "Error";
} else
echo "<a class=\"btn btn-primary btn-mini btn-sm reorder\" data-action=\"listDuplicateSequence\" data-repairfolderid=\"".$fld->getId()."\" title=\"".getMLText("reorder_documents_in_folder")."\">".getMLText('reorder')."</a>";
echo "</td>";
echo $this->folderListRowEnd($fld);
}
print "</tbody></table>";
@ -642,6 +653,11 @@ $(document).ready( function() {
$('#kkkk.ajax').data('action', $(this).data('action'));
$('#kkkk.ajax').trigger('update', {repair: 1, required: $(this).data('required')});
});
$('body').on('click', 'a.reorder', function(ev){
ev.preventDefault();
$('#kkkk.ajax').data('action', $(this).data('action'));
$('#kkkk.ajax').trigger('update', {repair: 1, repairfolderid: $(this).data('repairfolderid')});
});
$('body').on('click', 'table th a', function(ev){
ev.preventDefault();
$('#kkkk.ajax').data('action', $(this).data('action'));