Update StackMonkey.ps1
This commit is contained in:
100
StackMonkey.ps1
100
StackMonkey.ps1
@@ -311,6 +311,57 @@
|
||||
}
|
||||
}
|
||||
|
||||
function Build-Checkboxes {
|
||||
param($Page, $Column)
|
||||
|
||||
(
|
||||
$Global:Tasks |
|
||||
Where-Object Page -EQ $Page |
|
||||
Where-Object Column -EQ $Column |
|
||||
ForEach-Object {
|
||||
$taskId = $_.Id
|
||||
$tooltip = if ($_.PSObject.Properties.Name -contains 'Tooltip' -and $_.Tooltip) {
|
||||
" title='$($_.Tooltip)'"
|
||||
} else { '' }
|
||||
|
||||
$html = "<label$tooltip><input type='checkbox' id='$taskId' name='$($_.Name)' data-column='$Column'> $($_.Label)</label>"
|
||||
|
||||
if ($_.SubOptions) {
|
||||
# join inside the code block is fine
|
||||
$subHtml = (
|
||||
$_.SubOptions |
|
||||
ForEach-Object {
|
||||
"<label style='margin-left:20px; display:block;'>
|
||||
<input type='checkbox' class='sub-option-$taskId' name='$($_.Value)' value='$($_.Value)'> $($_.Label)
|
||||
</label>"
|
||||
}
|
||||
) -join "`n"
|
||||
|
||||
$html += @"
|
||||
<div id='${taskId}OptionsContainer' style='display:none; margin-top:4px;'>
|
||||
$subHtml
|
||||
</div>
|
||||
"@
|
||||
}
|
||||
|
||||
$html
|
||||
}
|
||||
) -join "`n"
|
||||
}
|
||||
|
||||
|
||||
|
||||
### Get SVSMSP module version to display in the UI
|
||||
function Get-ModuleVersionHtml {
|
||||
$mod = Get-Module -ListAvailable -Name SVSMSP | Sort-Object Version -Descending | Select-Object -First 1
|
||||
if ($mod) {
|
||||
return "<div style='color:#bbb; font-size:0.9em; margin-top:1em;'>Module Version: $($mod.Version)</div>"
|
||||
}
|
||||
return "<div style='color:#f66;'>SVSMSP_Module not found</div>"
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Starts the HTTP listener loop
|
||||
function Start-Server {
|
||||
# make it accessible to Dispatch-Request
|
||||
@@ -1521,55 +1572,6 @@ $script
|
||||
|
||||
#region UI Generation
|
||||
|
||||
function Build-Checkboxes {
|
||||
param($Page, $Column)
|
||||
|
||||
(
|
||||
$Global:Tasks |
|
||||
Where-Object Page -EQ $Page |
|
||||
Where-Object Column -EQ $Column |
|
||||
ForEach-Object {
|
||||
$taskId = $_.Id
|
||||
$tooltip = if ($_.PSObject.Properties.Name -contains 'Tooltip' -and $_.Tooltip) {
|
||||
" title='$($_.Tooltip)'"
|
||||
} else { '' }
|
||||
|
||||
$html = "<label$tooltip><input type='checkbox' id='$taskId' name='$($_.Name)' data-column='$Column'> $($_.Label)</label>"
|
||||
|
||||
if ($_.SubOptions) {
|
||||
# join inside the code block is fine
|
||||
$subHtml = (
|
||||
$_.SubOptions |
|
||||
ForEach-Object {
|
||||
"<label style='margin-left:20px; display:block;'>
|
||||
<input type='checkbox' class='sub-option-$taskId' name='$($_.Value)' value='$($_.Value)'> $($_.Label)
|
||||
</label>"
|
||||
}
|
||||
) -join "`n"
|
||||
|
||||
$html += @"
|
||||
<div id='${taskId}OptionsContainer' style='display:none; margin-top:4px;'>
|
||||
$subHtml
|
||||
</div>
|
||||
"@
|
||||
}
|
||||
|
||||
$html
|
||||
}
|
||||
) -join "`n"
|
||||
}
|
||||
|
||||
|
||||
|
||||
### Get SVSMSP module version to display in the UI
|
||||
function Get-ModuleVersionHtml {
|
||||
$mod = Get-Module -ListAvailable -Name SVSMSP | Sort-Object Version -Descending | Select-Object -First 1
|
||||
if ($mod) {
|
||||
return "<div style='color:#bbb; font-size:0.9em; margin-top:1em;'>Module Version: $($mod.Version)</div>"
|
||||
}
|
||||
return "<div style='color:#f66;'>SVSMSP_Module not found</div>"
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user