Neue Exportfunktion und UI-Verbesserungen
- `MouseWheelMode` im `DocumentViewer` auf vertikales Scrollen geändert. - Neue Parameter (`WM_SUFFIX`, `MAP_SHAREDRIVE`, `SavetoDrive`) für Dokumentenverarbeitung hinzugefügt. - `GridView1` durch `GridViewResult` ersetzt. - Schaltfläche `bbtnitemExportFiles` für Datei-Export hinzugefügt. - Logik für temporäre Kopien (`CopyWM2Temp`) in `frmDocumentResultList` implementiert. - Ressourcen und Layouts in mehreren Dateien aktualisiert. - Neue Schaltfläche `BarButtonItem6` in `frmSQLEditor` hinzugefügt.
This commit is contained in:
@@ -32,6 +32,8 @@ Public Class frmDocumentResultList
|
||||
Private ReadOnly Property _Logger As Logger Implements IBaseForm._Logger
|
||||
Public Property ShouldReturnToPreviousForm As Boolean = False Implements IResultForm.ShouldReturnToPreviousForm
|
||||
|
||||
Private Const CopyWM2Temp As Boolean = False
|
||||
|
||||
' Helper Classes
|
||||
Private EDMI_API_Client As Client
|
||||
Private Documentloader As Loader
|
||||
@@ -54,6 +56,7 @@ Public Class frmDocumentResultList
|
||||
Private WM_SUFFIX As String = "\\WINDREAM\OBJECTS"
|
||||
Private MAP_SHAREDRIVE As String = ""
|
||||
Private MAP_BLACKLIST As String = ""
|
||||
Private SavetoDrive As Boolean = False
|
||||
|
||||
' Runtime variables
|
||||
Private Property ResultLists As List(Of DocumentResult)
|
||||
@@ -119,6 +122,11 @@ Public Class frmDocumentResultList
|
||||
|
||||
LogConfig = pLogConfig
|
||||
_Logger = pLogConfig.GetLogger()
|
||||
|
||||
SavetoDrive = pParams.SavetoDrive
|
||||
_Logger.Debug("SavetoDrive setting is set to [{0}]", SavetoDrive)
|
||||
|
||||
|
||||
FormHelper = New FormHelper(pLogConfig, Me)
|
||||
_documentPathHandler = New DocumentPathHandler(pLogConfig)
|
||||
|
||||
@@ -129,10 +137,16 @@ Public Class frmDocumentResultList
|
||||
Config = New ConfigManager(Of Config)(pLogConfig, oConfigPath, oConfigPath)
|
||||
Helpers = New DocumentResultList.Helpers(pLogConfig)
|
||||
Filesystem = New FilesystemEx(pLogConfig)
|
||||
GridBuilder = New GridBuilder(New List(Of GridView) From {GridView1, GridView2, GridView3})
|
||||
GridBuilder = New GridBuilder(New List(Of GridView) From {GridViewResult, GridView2, GridView3})
|
||||
FileEx = New Modules.Windows.File(pLogConfig)
|
||||
LayoutManager = New Layout(pLogConfig, Config, New List(Of GridView) From {GridView1, GridView2, GridView3}, pEnvironment)
|
||||
LayoutManager = New Layout(pLogConfig, Config, New List(Of GridView) From {GridViewResult, GridView2, GridView3}, pEnvironment)
|
||||
Workspace = New Workspace(Of Config)(pLogConfig, Config, WorkspaceManager1, UserLanguage)
|
||||
|
||||
CopyWMFile2Temp = Environment.Settings.CopyWMFile2Temp
|
||||
WM_SUFFIX = Environment.Settings.WM_SUFFIX
|
||||
MAP_SHAREDRIVE = Environment.Settings.MAP_SHAREDRIVE
|
||||
MAP_BLACKLIST = Environment.Settings.MAP_BLACKLIST
|
||||
_Logger.Info($"Initialisierung frmDocumentResultList mit WM_SUFFIX=[{WM_SUFFIX}], MAP_SHAREDRIVE=[{MAP_SHAREDRIVE}], MAP_BLACKLIST=[{MAP_BLACKLIST}], CopyWMFile2Temp=[{CopyWMFile2Temp}], SavetoDrive = [{SavetoDrive}]")
|
||||
End Sub
|
||||
|
||||
Private Function GetOperationMode() As OperationMode
|
||||
@@ -221,7 +235,12 @@ Public Class frmDocumentResultList
|
||||
Else
|
||||
RibbonPageGroupFilesystem.Visible = False
|
||||
End If
|
||||
|
||||
'If SavetoDrive = True Then
|
||||
bbtnitemExportFiles.Visibility = BarItemVisibility.Always
|
||||
'Else
|
||||
' _Logger.Debug("SavetoDrive is set to False, hiding export button")
|
||||
' bbtnitemExportFiles.Visibility = BarItemVisibility.Never
|
||||
'End If
|
||||
chkGridShowQuickfilter.Checked = LayoutManager.GetFilterRowVisible()
|
||||
chkGridShowGrouping.Checked = LayoutManager.GetGroupPanelVisible()
|
||||
chkGridShowTitle.Checked = LayoutManager.GetBandTitleVisible()
|
||||
@@ -276,7 +295,7 @@ Public Class frmDocumentResultList
|
||||
' so we can set the row handle and start loading the (only) file
|
||||
If Params.ShowFileList = False Then
|
||||
DockPanelFileList.HideImmediately()
|
||||
GridView1.FocusedRowHandle = 0
|
||||
GridViewResult.FocusedRowHandle = 0
|
||||
Else
|
||||
DockPanelFileList.Show()
|
||||
End If
|
||||
@@ -306,10 +325,10 @@ Public Class frmDocumentResultList
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub SelectFirstRowInGrid1()
|
||||
If GridView1.RowCount > 0 Then
|
||||
GridView1.FocusedRowHandle = 0
|
||||
If GridViewResult.RowCount > 0 Then
|
||||
GridViewResult.FocusedRowHandle = 0
|
||||
Else
|
||||
GridView1.FocusedRowHandle = GridControl.InvalidRowHandle
|
||||
GridViewResult.FocusedRowHandle = GridControl.InvalidRowHandle
|
||||
End If
|
||||
End Sub
|
||||
Private Sub Workspace_WorkspaceLoaded(sender As Object, e As String)
|
||||
@@ -332,12 +351,20 @@ Public Class frmDocumentResultList
|
||||
If _documentPathHandler IsNot Nothing Then
|
||||
_documentPathHandler.Cleanup()
|
||||
End If
|
||||
Try
|
||||
If CopyWM2Temp = True Then
|
||||
_Logger.Debug("🗑️ Bereinige Temp-Ordner beim Schließen...")
|
||||
_documentPathHandler.CleanupTempFolder()
|
||||
End If
|
||||
Catch cleanupEx As Exception
|
||||
_Logger.Warn($"⚠️ Fehler beim Bereinigen des Temp-Ordners: {cleanupEx.Message}")
|
||||
End Try
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Async Sub GridView_FocusedRowChanged(sender As GridView, e As FocusedRowChangedEventArgs) Handles GridView1.FocusedRowChanged, GridView2.FocusedRowChanged, GridView3.FocusedRowChanged
|
||||
Private Async Sub GridView_FocusedRowChanged(sender As GridView, e As FocusedRowChangedEventArgs) Handles GridViewResult.FocusedRowChanged, GridView2.FocusedRowChanged, GridView3.FocusedRowChanged
|
||||
Helpers.SetRowHandle(e)
|
||||
|
||||
Try
|
||||
@@ -367,25 +394,34 @@ Public Class frmDocumentResultList
|
||||
|
||||
' Load Document in Document Viewer
|
||||
Dim oFileName = $"{oObjectId}.{oDocument.Extension}"
|
||||
'If CopyWMFile2Temp = True Then
|
||||
' _Logger.Debug("Loading document into viewer with path handler and copying WM file to temp. ObjectId: [{0}], Filename: [{1}], FullPath: [{2}]", oObjectId, oFileName, oFullPath)
|
||||
' ' Optionen konfigurieren
|
||||
' Dim options As New DocumentPathHandler.DocumentPathOptions With {
|
||||
' .EnableMapping = True,
|
||||
' .WMSuffix = WM_SUFFIX,
|
||||
' .SpecificDrive = If(Len(MAP_SHAREDRIVE) = 1, MAP_SHAREDRIVE, ""),
|
||||
' .DriveBlacklist = MAP_BLACKLIST,
|
||||
' .CopyToTemp = True,
|
||||
' .TempFolder = TEMP_DOCUMENT_FOLDER,
|
||||
' .UnmapAfterCopy = True
|
||||
' }
|
||||
'Else
|
||||
If Not IsNothing(oDocument.Contents) Then
|
||||
If Not IsNothing(oDocument.Contents) And CopyWM2Temp = False Then
|
||||
_Logger.Debug("Loading document into viewer with MemoryStream handler (LoadFile_FromStream). ObjectId: [{0}], Filename: [{1}], FullPath: [{2}]", oObjectId, oFileName, oFullPath)
|
||||
DocumentViewer1.LoadFile_FromStream(oFileName, New MemoryStream(oDocument.Contents))
|
||||
Else
|
||||
_Logger.Debug("Loading document into viewer from filepath (LoadFile_FromPath). ObjectId: [{0}], Filename: [{1}], FullPath: [{2}]", oObjectId, oFileName, oFullPath)
|
||||
DocumentViewer1.LoadFile_FromPath(oFullPath)
|
||||
Dim oResolvedFilename As String = oFullPath
|
||||
If CopyWM2Temp = True AndAlso Not String.IsNullOrWhiteSpace(oResolvedFilename) Then
|
||||
Dim options As New DocumentPathHandler.DocumentPathOptions With {
|
||||
.EnableMapping = True,
|
||||
.WMSuffix = WM_SUFFIX,
|
||||
.SpecificDrive = If(Len(MAP_SHAREDRIVE) = 1, MAP_SHAREDRIVE, ""),
|
||||
.DriveBlacklist = MAP_BLACKLIST,
|
||||
.CopyToTemp = True,
|
||||
.TempFolder = TEMP_DOCUMENT_FOLDER,
|
||||
.UnmapAfterCopy = True
|
||||
}
|
||||
Dim result = _documentPathHandler.ProcessDocumentPath(oResolvedFilename, options)
|
||||
If result.Success AndAlso Not String.IsNullOrWhiteSpace(result.FinalPath) AndAlso File.Exists(result.FinalPath) Then
|
||||
_Logger.Info($"✓ Zusatzdokument via Temp aufgelöst: [{result.FinalPath}]")
|
||||
oResolvedFilename = result.FinalPath
|
||||
Else
|
||||
_Logger.Warn($"⚠️ Temp-Auflösung fehlgeschlagen für [{oResolvedFilename}]: {result.ErrorMessage} - Fallback auf Originalpfad")
|
||||
oResolvedFilename = oFullPath
|
||||
End If
|
||||
Else
|
||||
_Logger.Debug("Keine Temp-Kopie für Dokument erforderlich oder möglich. Originalpfad wird verwendet. ObjectId: [{0}], Filename: [{1}], FullPath: [{2}]", oObjectId, oFileName, oFullPath)
|
||||
End If
|
||||
_Logger.Debug("Loading document into viewer from filepath (LoadFile_FromPath). ObjectId: [{0}], Filename: [{1}], FullPath: [{2}]", oObjectId, oFileName, oResolvedFilename)
|
||||
DocumentViewer1.LoadFile_FromPath(oResolvedFilename)
|
||||
End If
|
||||
'End If
|
||||
|
||||
@@ -432,16 +468,12 @@ Public Class frmDocumentResultList
|
||||
' Hide Export and filesystem options for view only right
|
||||
If pDocument.AccessRight = Rights.AccessRight.VIEW_ONLY Then
|
||||
DocumentViewer1.SetViewOnly(True)
|
||||
RibbonPageGroupExport.Visible = False
|
||||
|
||||
If OperationMode = OperationMode.NoAppServer Then
|
||||
RibbonPageGroupFilesystem.Visible = False
|
||||
MenuItemProperties.Visibility = BarItemVisibility.Never
|
||||
End If
|
||||
Else
|
||||
DocumentViewer1.SetViewOnly(False)
|
||||
RibbonPageGroupExport.Visible = True
|
||||
|
||||
If OperationMode = OperationMode.NoAppServer Then
|
||||
RibbonPageGroupFilesystem.Visible = True
|
||||
MenuItemProperties.Visibility = BarItemVisibility.Always
|
||||
@@ -583,8 +615,8 @@ Public Class frmDocumentResultList
|
||||
IsLoading = True
|
||||
Try
|
||||
' Save current row handle and unset it
|
||||
Dim oCurrentRowHandle As Integer = GridView1.FocusedRowHandle
|
||||
GridView1.FocusedRowHandle = GridControl.InvalidRowHandle
|
||||
Dim oCurrentRowHandle As Integer = GridViewResult.FocusedRowHandle
|
||||
GridViewResult.FocusedRowHandle = GridControl.InvalidRowHandle
|
||||
|
||||
' Save the new results
|
||||
ResultLists = pResults
|
||||
@@ -597,12 +629,12 @@ Public Class frmDocumentResultList
|
||||
LoadGridDataAndLayout()
|
||||
|
||||
' Restore old selection only if still valid; otherwise select first row
|
||||
If GridView1.IsValidRowHandle(oCurrentRowHandle) Then
|
||||
GridView1.FocusedRowHandle = oCurrentRowHandle
|
||||
ElseIf GridView1.RowCount > 0 Then
|
||||
GridView1.FocusedRowHandle = 0
|
||||
If GridViewResult.IsValidRowHandle(oCurrentRowHandle) Then
|
||||
GridViewResult.FocusedRowHandle = oCurrentRowHandle
|
||||
ElseIf GridViewResult.RowCount > 0 Then
|
||||
GridViewResult.FocusedRowHandle = 0
|
||||
Else
|
||||
GridView1.FocusedRowHandle = GridControl.InvalidRowHandle
|
||||
GridViewResult.FocusedRowHandle = GridControl.InvalidRowHandle
|
||||
End If
|
||||
|
||||
Return True
|
||||
@@ -653,9 +685,9 @@ Public Class frmDocumentResultList
|
||||
Case 0
|
||||
Dim oResult As DocumentResultList.DocumentResult = ResultLists.Item(0)
|
||||
|
||||
LoadGridData(GridView1, oResult)
|
||||
LoadGridData(GridViewResult, oResult)
|
||||
'LayoutManager.GridView_RestoreLayout(GridView1)
|
||||
CreateDocumentGrid(GridView1, oResult)
|
||||
CreateDocumentGrid(GridViewResult, oResult)
|
||||
UpdateGridHeader(ResultLists, oIndex, oResult.Datatable.Rows.Count)
|
||||
|
||||
Case 1
|
||||
@@ -878,7 +910,7 @@ Public Class frmDocumentResultList
|
||||
SetActiveGridBand()
|
||||
End Sub
|
||||
|
||||
Private Sub GridView1_FocusedRowChanged(sender As GridView, e As FocusedRowChangedEventArgs) Handles GridView1.FocusedRowChanged, GridView2.FocusedRowChanged, GridView3.FocusedRowChanged
|
||||
Private Sub GridView1_FocusedRowChanged(sender As GridView, e As FocusedRowChangedEventArgs) Handles GridViewResult.FocusedRowChanged, GridView2.FocusedRowChanged, GridView3.FocusedRowChanged
|
||||
Dim oGrid As GridControl = sender.GridControl
|
||||
_ActiveGrid = oGrid
|
||||
End Sub
|
||||
@@ -895,7 +927,7 @@ Public Class frmDocumentResultList
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub GridView1_ColumnFilterChanged(sender As GridView, e As EventArgs) Handles GridView1.ColumnFilterChanged
|
||||
Private Sub GridView1_ColumnFilterChanged(sender As GridView, e As EventArgs) Handles GridViewResult.ColumnFilterChanged
|
||||
Dim oRowCount = sender.RowCount
|
||||
UpdateGridHeader(ResultLists, 0, oRowCount)
|
||||
End Sub
|
||||
@@ -1047,7 +1079,7 @@ Public Class frmDocumentResultList
|
||||
#End Region
|
||||
#Region "Drag to Export"
|
||||
|
||||
Private Sub GridView1_MouseDown(sender As GridView, e As MouseEventArgs) Handles GridView1.MouseDown
|
||||
Private Sub GridView1_MouseDown(sender As GridView, e As MouseEventArgs) Handles GridViewResult.MouseDown
|
||||
If sender.FocusedRowHandle >= 0 Then
|
||||
Dim oDragSize As Size = SystemInformation.DragSize
|
||||
|
||||
@@ -1058,11 +1090,11 @@ Public Class frmDocumentResultList
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub GridView1_MouseUp(sender As GridView, e As MouseEventArgs) Handles GridView1.MouseUp
|
||||
Private Sub GridView1_MouseUp(sender As GridView, e As MouseEventArgs) Handles GridViewResult.MouseUp
|
||||
_DragBoxFromMouseDown = Rectangle.Empty
|
||||
End Sub
|
||||
|
||||
Private Sub GridView1_MouseMove(sender As GridView, e As MouseEventArgs) Handles GridView1.MouseMove
|
||||
Private Sub GridView1_MouseMove(sender As GridView, e As MouseEventArgs) Handles GridViewResult.MouseMove
|
||||
If e.Button AndAlso e.Button = MouseButtons.Left Then
|
||||
If _DragBoxFromMouseDown <> Rectangle.Empty And Not _DragBoxFromMouseDown.Contains(e.X, e.Y) Then
|
||||
|
||||
@@ -1137,7 +1169,7 @@ Public Class frmDocumentResultList
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem11_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItem11.ItemClick
|
||||
GridView1.ShowCustomization()
|
||||
GridViewResult.ShowCustomization()
|
||||
End Sub
|
||||
|
||||
Private Sub CtrlObjectPropertyDialog_Enter(sender As Object, e As EventArgs) Handles CtrlObjectPropertyDialog.Enter
|
||||
@@ -1148,7 +1180,7 @@ Public Class frmDocumentResultList
|
||||
RibbonPageGroupAttribute.Enabled = False
|
||||
End Sub
|
||||
|
||||
Private Sub GridView1_RowStyle(sender As Object, e As RowStyleEventArgs) Handles GridView1.RowStyle
|
||||
Private Sub GridView1_RowStyle(sender As Object, e As RowStyleEventArgs) Handles GridViewResult.RowStyle
|
||||
Dim oGridView As BandedGridView = sender
|
||||
Dim oRow As DataRowView = oGridView.GetRow(e.RowHandle)
|
||||
|
||||
@@ -1211,4 +1243,100 @@ Public Class frmDocumentResultList
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub bbtnitemExportFiles_ItemClick(sender As Object, e As ItemClickEventArgs) Handles bbtnitemExportFiles.ItemClick
|
||||
Try
|
||||
' Zielordner wählen
|
||||
Using oFolderDialog As New FolderBrowserDialog()
|
||||
oFolderDialog.Description = "Choose folder for filexport"
|
||||
oFolderDialog.ShowNewFolderButton = True
|
||||
|
||||
If oFolderDialog.ShowDialog() <> DialogResult.OK Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oTargetFolder As String = oFolderDialog.SelectedPath
|
||||
Dim oActiveView As BandedGridView = DirectCast(If(GetActiveGridControl()?.DefaultView, GridViewResult), BandedGridView)
|
||||
|
||||
Dim oCopied As Integer = 0
|
||||
Dim oSkipped As Integer = 0
|
||||
Dim oErrors As New List(Of String)
|
||||
|
||||
' Alle sichtbaren (nicht gefilterten) Zeilen durchlaufen
|
||||
For oRowHandle As Integer = 0 To oActiveView.RowCount - 1
|
||||
Try
|
||||
Dim oRow = oActiveView.GetDataRow(oRowHandle)
|
||||
If oRow Is Nothing Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
Dim oFilePath = oRow.ItemEx(ColumnFilepath, "")
|
||||
If String.IsNullOrWhiteSpace(oFilePath) Then
|
||||
oSkipped += 1
|
||||
Continue For
|
||||
End If
|
||||
|
||||
' Pfadauflösung via CopyWM2Temp – analog zu GridView_FocusedRowChanged
|
||||
Dim oResolvedPath As String = oFilePath
|
||||
If CopyWM2Temp = True AndAlso Not String.IsNullOrWhiteSpace(oResolvedPath) Then
|
||||
Dim oOptions As New DocumentPathHandler.DocumentPathOptions With {
|
||||
.EnableMapping = True,
|
||||
.WMSuffix = WM_SUFFIX,
|
||||
.SpecificDrive = If(Len(MAP_SHAREDRIVE) = 1, MAP_SHAREDRIVE, ""),
|
||||
.DriveBlacklist = MAP_BLACKLIST,
|
||||
.CopyToTemp = True,
|
||||
.TempFolder = TEMP_DOCUMENT_FOLDER,
|
||||
.UnmapAfterCopy = True
|
||||
}
|
||||
Dim oResult = _documentPathHandler.ProcessDocumentPath(oResolvedPath, oOptions)
|
||||
If oResult.Success AndAlso Not String.IsNullOrWhiteSpace(oResult.FinalPath) AndAlso File.Exists(oResult.FinalPath) Then
|
||||
_Logger.Info($"✓ Exportpfad via Temp aufgelöst: [{oResult.FinalPath}]")
|
||||
oResolvedPath = oResult.FinalPath
|
||||
Else
|
||||
_Logger.Warn($"⚠️ Temp-Auflösung fehlgeschlagen für [{oFilePath}]: {oResult.ErrorMessage} - Fallback auf Originalpfad")
|
||||
oResolvedPath = oFilePath
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not File.Exists(oResolvedPath) Then
|
||||
_Logger.Warn($"Datei nicht gefunden, wird übersprungen: [{oResolvedPath}]")
|
||||
oErrors.Add(oResolvedPath)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
Dim oDestFileName = Path.GetFileName(oResolvedPath)
|
||||
Dim oDestPath = Path.Combine(oTargetFolder, oDestFileName)
|
||||
|
||||
' Bei Namenskollision Suffix anhängen
|
||||
If File.Exists(oDestPath) Then
|
||||
Dim oBaseName = Path.GetFileNameWithoutExtension(oDestFileName)
|
||||
Dim oExt = Path.GetExtension(oDestFileName)
|
||||
oDestPath = Path.Combine(oTargetFolder, $"{oBaseName}_{oRowHandle}{oExt}")
|
||||
End If
|
||||
|
||||
File.Copy(oResolvedPath, oDestPath)
|
||||
oCopied += 1
|
||||
_Logger.Debug($"Datei exportiert: [{oResolvedPath}] → [{oDestPath}]")
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
oErrors.Add(ex.Message)
|
||||
End Try
|
||||
Next
|
||||
|
||||
' Ergebnismeldung
|
||||
Dim oMsg As String = $"{oCopied} Datei(en) erfolgreich exportiert."
|
||||
If oSkipped > 0 Then
|
||||
oMsg &= $"{vbNewLine}{oSkipped} Zeile(n) ohne Dateipfad übersprungen."
|
||||
End If
|
||||
If oErrors.Count > 0 Then
|
||||
oMsg &= $"{vbNewLine}{oErrors.Count} Fehler:{vbNewLine}{String.Join(vbNewLine, oErrors)}"
|
||||
FormHelper.ShowErrorMessage(New IOException(oMsg), "Dateiexport")
|
||||
Else
|
||||
FormHelper.ShowSuccessMessage(oMsg, "Dateiexport")
|
||||
End If
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
FormHelper.ShowErrorMessage(ex, "bbtnitemExportFiles_ItemClick")
|
||||
End Try
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user