Update samy.ps1
This commit is contained in:
35
samy.ps1
35
samy.ps1
@@ -759,6 +759,7 @@ $Global:SamyTasks | ForEach-Object {
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$Page,
|
||||
[string]$Column
|
||||
[string]$Group
|
||||
)
|
||||
|
||||
function Escape-HtmlAttr {
|
||||
@@ -793,6 +794,25 @@ $Global:SamyTasks | ForEach-Object {
|
||||
$tasks = $tasks | Where-Object Column -EQ $Column
|
||||
}
|
||||
|
||||
# Optional filter by Group (used for onboard right-side split)
|
||||
if (-not [string]::IsNullOrEmpty($Group)) {
|
||||
if ($Group -eq 'tweaks') {
|
||||
# Tweaks is the "catch-all" for right-side tasks not tagged as apps
|
||||
$tasks = $tasks | Where-Object {
|
||||
-not ($_.PSObject.Properties.Name -contains 'Group') -or
|
||||
[string]$_.Group -eq '' -or
|
||||
[string]$_.Group -eq 'tweaks'
|
||||
}
|
||||
}
|
||||
else {
|
||||
$tasks = $tasks | Where-Object {
|
||||
($_.PSObject.Properties.Name -contains 'Group') -and
|
||||
([string]$_.Group -eq $Group)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
(
|
||||
$tasks |
|
||||
ForEach-Object {
|
||||
@@ -813,7 +833,14 @@ $Global:SamyTasks | ForEach-Object {
|
||||
$nameAttr = Escape-HtmlAttr ([string]$_.Name)
|
||||
$colAttr = Escape-HtmlAttr ([string]$Column)
|
||||
|
||||
$html = "<label$tooltipAttr><input type=""checkbox"" id=""$taskIdAttr"" name=""$nameAttr"" data-column=""$colAttr""> $labelText</label>"
|
||||
$groupValue = ''
|
||||
if ($_.PSObject.Properties.Name -contains 'Group' -and $_.Group) {
|
||||
$groupValue = [string]$_.Group
|
||||
}
|
||||
$groupAttr = Escape-HtmlAttr $groupValue
|
||||
$groupDataAttr = if ([string]::IsNullOrWhiteSpace($groupAttr)) { '' } else { " data-group=""$groupAttr""" }
|
||||
|
||||
$html = "<label$tooltipAttr><input type=""checkbox"" id=""$taskIdAttr"" name=""$nameAttr"" data-column=""$colAttr""$groupDataAttr> $labelText</label>"
|
||||
|
||||
if ($_.SubOptions) {
|
||||
$subHtml = (
|
||||
@@ -952,7 +979,8 @@ function Get-UIHtml {
|
||||
# 1) Build checkbox HTML per page/column
|
||||
#
|
||||
$onboardLeft = Publish-Checkboxes -Page 'onboard' -Column 'left'
|
||||
$onboardRight = Publish-Checkboxes -Page 'onboard' -Column 'right'
|
||||
$onboardRightApps = Publish-Checkboxes -Page 'onboard' -Column 'right' -Group 'apps'
|
||||
$onboardRightTweaks = Publish-Checkboxes -Page 'onboard' -Column 'right' -Group 'tweaks'
|
||||
$offboard = Publish-Checkboxes -Page 'offboard' -Column ''
|
||||
$devices = Publish-Checkboxes -Page 'devices' -Column ''
|
||||
|
||||
@@ -1023,7 +1051,8 @@ function Get-UIHtml {
|
||||
|
||||
$html = $html.Replace('{{moduleVersion}}', (Get-ModuleVersionHtml))
|
||||
$html = $html.Replace('{{onboardLeftColumn}}', $onboardLeft)
|
||||
$html = $html.Replace('{{onboardRightColumn}}', $onboardRight)
|
||||
$html = $html.Replace('{{onboardRightApps}}', $onboardRightApps)
|
||||
$html = $html.Replace('{{onboardRightTweaks}}', $onboardRightTweaks)
|
||||
$html = $html.Replace('{{offboardCheckboxes}}', $offboard)
|
||||
$html = $html.Replace('{{devicesCheckboxes}}', $devices)
|
||||
$html = $html.Replace('{{tasksJsAll}}', $tasksJsAll)
|
||||
|
||||
Reference in New Issue
Block a user