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>"
|
||||
|
||||
if ($_.SubOptions) {
|
||||
$subHtml = (
|
||||
$_.SubOptions |
|
||||
ForEach-Object {
|
||||
$subLabel = Escape-HtmlText ([string]$_.Label)
|
||||
|
||||
$subTaskIdClass = Escape-HtmlAttr ([string]$taskId)
|
||||
$subValueAttr = Escape-HtmlAttr ([string]$_.Value)
|
||||
$subHtml = (
|
||||
$_.SubOptions | ForEach-Object {
|
||||
|
||||
"<label style=""margin-left:20px; display:block;"">
|
||||
<input type=""checkbox"" class=""sub-option-$subTaskIdClass"" name=""$subValueAttr"" value=""$subValueAttr""> $subLabel
|
||||
</label>"
|
||||
$type = if ($_.PSObject.Properties.Name -contains 'Type' -and $_.Type) {
|
||||
[string]$_.Type
|
||||
} else {
|
||||
'checkbox'
|
||||
}
|
||||
|
||||
}
|
||||
) -join "`n"
|
||||
if ($type -eq 'text') {
|
||||
$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;">
|
||||
$subHtml
|
||||
</div>
|
||||
@"
|
||||
<div style="margin-left:20px; margin-top:6px;">
|
||||
<label for="$subId">$subLabel</label>
|
||||
<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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user