Fixed issue with Not Configured for Custom Compliance script.
Added option to skip date when generating MD document.
This commit is contained in:
Mikael Karlsson
2025-08-03 20:42:46 +10:00
parent 8952e2894a
commit 1ab13bf2dd
3 changed files with 15 additions and 2 deletions

View File

@@ -4628,15 +4628,18 @@ function Invoke-CDDocumentTranslateSectionFile
if($null -eq $obj.deviceCompliancePolicyScript) if($null -eq $obj.deviceCompliancePolicyScript)
{ {
$propValue = Get-LanguageString "BooleanActions.notConfigured" $propValue = Get-LanguageString "BooleanActions.notConfigured"
$rawValue = "notConfigured"
} }
else else
{ {
$propValue = Get-LanguageString "BooleanActions.require" $propValue = Get-LanguageString "BooleanActions.require"
$rawValue = "require"
} }
Add-CustomSettingObject ([PSCustomObject]@{ Add-CustomSettingObject ([PSCustomObject]@{
Name = Get-LanguageString "SettingDetails.adminConfiguredComplianceSettingName" Name = Get-LanguageString "SettingDetails.adminConfiguredComplianceSettingName"
Value = $propValue Value = $propValue
EntityKey = "deviceCompliancePolicyScript" EntityKey = "deviceCompliancePolicyScript"
RawValue = $rawValue
Category = $category Category = $category
SubCategory = $null SubCategory = $null
}) })

View File

@@ -29,6 +29,7 @@ function Add-MDOptionsControl
Set-XamlProperty $script:mdForm "chkMDOpenDocument" "IsChecked" (Get-Setting "Documentation" "MDOpenFile" $true) Set-XamlProperty $script:mdForm "chkMDOpenDocument" "IsChecked" (Get-Setting "Documentation" "MDOpenFile" $true)
Set-XamlProperty $script:mdForm "cbMDDocumentOutputFile" "ItemsSource" ("[ { Name: `"Single file`",Value: `"Full`" }, { Name: `"One file per object`",Value: `"Object`" }]" | ConvertFrom-Json) Set-XamlProperty $script:mdForm "cbMDDocumentOutputFile" "ItemsSource" ("[ { Name: `"Single file`",Value: `"Full`" }, { Name: `"One file per object`",Value: `"Object`" }]" | ConvertFrom-Json)
Set-XamlProperty $script:mdForm "cbMDDocumentOutputFile" "SelectedValue" (Get-Setting "Documentation" "MDDocumentFileType" "Full") Set-XamlProperty $script:mdForm "cbMDDocumentOutputFile" "SelectedValue" (Get-Setting "Documentation" "MDDocumentFileType" "Full")
Set-XamlProperty $script:mdForm "cbMDDocumentSkipDate" "IsChecked" ((Get-Setting "Documentation" "MDDocumentSkipDate" "False") -eq "True")
Add-XamlEvent $script:mdForm "browseMDDocumentName" "add_click" { Add-XamlEvent $script:mdForm "browseMDDocumentName" "add_click" {
$sf = [System.Windows.Forms.SaveFileDialog]::new() $sf = [System.Windows.Forms.SaveFileDialog]::new()
@@ -72,6 +73,7 @@ function Invoke-MDPreProcessItems
Save-Setting "Documentation" "MDCSSFile" (Get-XamlProperty $script:mdForm "txtMDCSSFile" "Text" "") Save-Setting "Documentation" "MDCSSFile" (Get-XamlProperty $script:mdForm "txtMDCSSFile" "Text" "")
Save-Setting "Documentation" "MDOpenFile" (Get-XamlProperty $script:mdForm "chkMDOpenDocument" "IsChecked") Save-Setting "Documentation" "MDOpenFile" (Get-XamlProperty $script:mdForm "chkMDOpenDocument" "IsChecked")
Save-Setting "Documentation" "MDDocumentFileType" (Get-XamlProperty $script:mdForm "cbMDDocumentOutputFile" "SelectedValue" '') Save-Setting "Documentation" "MDDocumentFileType" (Get-XamlProperty $script:mdForm "cbMDDocumentOutputFile" "SelectedValue" '')
Save-Setting "Documentation" "MDDocumentSkipDate" (Get-XamlProperty $script:mdForm "cbMDDocumentSkipDate" "IsChecked")
$defaultCSSFile = $global:AppRootFolder + "\Documentation\DefaultMDStyle.css" $defaultCSSFile = $global:AppRootFolder + "\Documentation\DefaultMDStyle.css"
$MDCssFile = Get-XamlProperty $script:mdForm "txtMDCSSFile" "Text" $defaultCSSFile $MDCssFile = Get-XamlProperty $script:mdForm "txtMDCSSFile" "Text" $defaultCSSFile
@@ -142,7 +144,9 @@ function Invoke-MDPostProcessItems
$script:mdContent.AppendLine("*Organization:* $($global:Organization.displayName)`n") $script:mdContent.AppendLine("*Organization:* $($global:Organization.displayName)`n")
$script:mdContent.AppendLine("*Generated by:* $userName$mail`n") $script:mdContent.AppendLine("*Generated by:* $userName$mail`n")
$script:mdContent.AppendLine("*Generated:* $((Get-Date).ToShortDateString()) $((Get-Date).ToLongTimeString())`n") if((Get-XamlProperty $script:mdForm "cbMDDocumentSkipDate" "IsChecked") -ne $true) {
$script:mdContent.AppendLine("*Generated:* $((Get-Date).ToShortDateString()) $((Get-Date).ToLongTimeString())`n")
}
if($script:sectionAnchors.Count -gt 0) if($script:sectionAnchors.Count -gt 0)
{ {

View File

@@ -85,4 +85,10 @@
<ComboBox Name="cbMDDocumentOutputFile" Margin="0,5,0,0" MinWidth="250" Grid.Row='4' Grid.Column="1" HorizontalAlignment="Left" <ComboBox Name="cbMDDocumentOutputFile" Margin="0,5,0,0" MinWidth="250" Grid.Row='4' Grid.Column="1" HorizontalAlignment="Left"
DisplayMemberPath="Name" SelectedValuePath="Value" /> DisplayMemberPath="Name" SelectedValuePath="Value" />
<StackPanel Orientation="Horizontal" Grid.Row='5' Margin="0,5,5,0" >
<Label Content="Skip date in Generated Info" />
<Rectangle Style="{DynamicResource InfoIcon}" ToolTip="Skip the date when the documentation was generated." />
</StackPanel>
<CheckBox Grid.Column='1' Grid.Row='5' Name='cbMDDocumentSkipDate' VerticalAlignment="Center" IsChecked="true" />
</Grid> </Grid>