Update samy.ps1
This commit is contained in:
54
samy.ps1
54
samy.ps1
@@ -843,27 +843,51 @@ $Global:SamyTasks | ForEach-Object {
|
|||||||
$html = "<label$tooltipAttr><input type=""checkbox"" id=""$taskIdAttr"" name=""$nameAttr"" data-column=""$colAttr""$groupDataAttr> $labelText</label>"
|
$html = "<label$tooltipAttr><input type=""checkbox"" id=""$taskIdAttr"" name=""$nameAttr"" data-column=""$colAttr""$groupDataAttr> $labelText</label>"
|
||||||
|
|
||||||
if ($_.SubOptions) {
|
if ($_.SubOptions) {
|
||||||
$subHtml = (
|
|
||||||
$_.SubOptions |
|
|
||||||
ForEach-Object {
|
|
||||||
$subLabel = Escape-HtmlText ([string]$_.Label)
|
|
||||||
|
|
||||||
$subTaskIdClass = Escape-HtmlAttr ([string]$taskId)
|
$subHtml = (
|
||||||
$subValueAttr = Escape-HtmlAttr ([string]$_.Value)
|
$_.SubOptions | ForEach-Object {
|
||||||
|
|
||||||
"<label style=""margin-left:20px; display:block;"">
|
$type = if ($_.PSObject.Properties.Name -contains 'Type' -and $_.Type) {
|
||||||
<input type=""checkbox"" class=""sub-option-$subTaskIdClass"" name=""$subValueAttr"" value=""$subValueAttr""> $subLabel
|
[string]$_.Type
|
||||||
</label>"
|
} else {
|
||||||
|
'checkbox'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
if ($type -eq 'text') {
|
||||||
) -join "`n"
|
$subId = Escape-HtmlAttr ([string]$_.Id)
|
||||||
|
$subLabel = Escape-HtmlText ([string]$_.Label)
|
||||||
|
$ph = if ($_.PSObject.Properties.Name -contains 'Placeholder') { Escape-HtmlAttr ([string]$_.Placeholder) } else { '' }
|
||||||
|
$help = if ($_.PSObject.Properties.Name -contains 'Help') { Escape-HtmlText ([string]$_.Help) } else { '' }
|
||||||
|
|
||||||
$html += @"
|
@"
|
||||||
<div id="$(Escape-HtmlAttr ([string]$taskId))OptionsContainer" style="display:none; margin-top:4px;">
|
<div style="margin-left:20px; margin-top:6px;">
|
||||||
$subHtml
|
<label for="$subId">$subLabel</label>
|
||||||
</div>
|
<input type="text" id="$subId" placeholder="$ph" />
|
||||||
|
<small style="display:block; margin-top:4px;">$help</small>
|
||||||
|
</div>
|
||||||
"@
|
"@
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
# default checkbox behaviour (your current behaviour)
|
||||||
|
$subLabel = Escape-HtmlText ([string]$_.Label)
|
||||||
|
|
||||||
|
$subTaskIdClass = Escape-HtmlAttr ([string]$taskId)
|
||||||
|
$subValueAttr = Escape-HtmlAttr ([string]$_.Value)
|
||||||
|
|
||||||
|
"<label style=""margin-left:20px; display:block;"">
|
||||||
|
<input type=""checkbox"" class=""sub-option-$subTaskIdClass"" name=""$subValueAttr"" value=""$subValueAttr""> $subLabel
|
||||||
|
</label>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) -join "`n"
|
||||||
|
|
||||||
|
$html += @"
|
||||||
|
<div id="$(Escape-HtmlAttr ([string]$taskId))OptionsContainer" style="display:none; margin-top:4px;">
|
||||||
|
$subHtml
|
||||||
|
</div>
|
||||||
|
"@
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$html
|
$html
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user