ClarityPS.psm1
Write-Verbose 'Importing from [C:\projects\clarityps\ClarityPS\private]' # .\ClarityPS\private\Add-Null.ps1 function Add-Null { <# .DESCRIPTION Adds Null Element .EXAMPLE Add-Null .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param() if ($pscmdlet.ShouldProcess("Starting Add-Null function.")) { # This function does Nothing. It's a place holder for now. } else { # -WhatIf was used. return $null } } Write-Verbose 'Importing from [C:\projects\clarityps\ClarityPS\public]' # .\ClarityPS\public\Add-Branding.ps1 function Add-Branding { <# .DESCRIPTION Adds Branding Element .PARAMETER Title Title, used for comment .EXAMPLE Add-Branding -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Add-Branding function.")) { # Determine if a title was specified if ($Title) { $BrandingHtml = "<div class='branding'><!-- Start $Title -->" } else { $BrandingHtml = "<div class='branding'>" } $BrandingHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-BrandingTitle.ps1 function Add-BrandingTitle { <# .DESCRIPTION Adds Page title with link. .PARAMETER Title Title, used for comment .PARAMETER URL URL, to provide a link. Defaults to 'index.html' .EXAMPLE Add-BrandingTitle -Title MyCard -URL "index.html" .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter(Mandatory = $true)][String]$Title, [Parameter()][String]$URL = "index.html" ) if ($pscmdlet.ShouldProcess("Starting Add-BrandingTitle function.")) { $BrandingTitleHtml = "<a href='$URL' class='nav-link'><span class='title'>$Title</span></a>" $BrandingTitleHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-Button.ps1 function Add-Button { <# .DESCRIPTION Adds Button Element .PARAMETER Title Title, used for comment .PARAMETER Class class to determine color .PARAMETER ButtonText Text of the Button .PARAMETER ButtonValue Value to identify the button .PARAMETER ID ID for Button Action .PARAMETER Name Reference name for button Action .PARAMETER OnClick Description of action to perform when pressed. .EXAMPLE Add-Button -Title MyCard -Class btn-success -OnClick '' -ButtonText MyButton -ButtonValue 'Button01' -ID 'thisButton' -Name 'Button001' .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title, [Parameter(Mandatory = $true)][String]$Class, [Parameter(Mandatory = $true)][String]$ButtonText, [Parameter(Mandatory = $true)][String]$ButtonValue, [Parameter(Mandatory = $true)][String]$ID, [Parameter(Mandatory = $true)][String]$Name, [Parameter()][String]$OnClick ) if ($pscmdlet.ShouldProcess("Starting Add-Button function.")) { # Determine if a title was specified $ButtonHtml = "<button class='$Class' type='button' name='$Name' value='$ButtonValue' id='$ID'" if ($OnClick) { $ButtonHtml += (" onclick='$OnClick'" + ">$ButtonText") } else { $ButtonHtml += ">$ButtonText" } if ($Title) { $ButtonHtml += "<!-- Start $Title -->" } else { # nothing to add here. } $ButtonHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-ButtonGroup.ps1 function Add-ButtonGroup { <# .DESCRIPTION Adds Button Group Element .PARAMETER Title Title, used for comment .EXAMPLE Add-ButtonGroup -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Add-ButtonGroup function.")) { # Determine if a title was specified if ($Title) { $ButtonGroupHtml = "<div class='btn-group'><!-- Start $Title -->" } else { $ButtonGroupHtml = "<div class='btn-group'>" } $ButtonGroupHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-Card.ps1 function Add-Card { <# .DESCRIPTION Adds Card Element .PARAMETER Title Title, used for comment .EXAMPLE Add-Card -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Add-Card function.")) { # Determine if a title was specified if ($Title) { $CardClassHtml = "<div class='card'><!-- Start $Title -->" } else { $CardClassHtml = "<div class='card'>" } $CardClassHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-CardBlock.ps1 function Add-CardBlock { <# .DESCRIPTION Adds Card-block Element .PARAMETER Title Title, used for comment .EXAMPLE Add-CardBlock -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Add-CardBlock function.")) { # Determine if a title was specified if ($Title) { $CardBlockHtml = "<div class='card-block'><!-- Start $Title -->" } else { $CardBlockHtml = "<div class='card-block'>" } $CardBlockHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-CardFooter.ps1 function Add-CardFooter { <# .DESCRIPTION Adds Flex Item Element .PARAMETER Title Title, used for comment .PARAMETER CardFooter Text String of Data to be placed on the card. .EXAMPLE Add-CardFooter -Title MyCardFooter -CardFooter "SomeHTML Text" .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title, [Parameter(Mandatory = $true)][String]$CardFooter ) if ($pscmdlet.ShouldProcess("Starting Add-CardFooter function.")) { # Determine if a title was specified if ($Title) { $CardFooterHtml = "<!-- Start $Title -->$CardFooter" } else { $CardFooterHtml = "$CardFooter" } $CardFooterHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-CardText.ps1 function Add-CardText { <# .DESCRIPTION Adds Flex Item Element .PARAMETER Title Title, used for comment .PARAMETER CardText Text String of Data to be placed on the card. .EXAMPLE Add-CardText -Title MyCardText -CardText "<someElement>SomeHTML Text</someElement>" .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title, [Parameter(Mandatory = $true)][String]$CardText ) if ($pscmdlet.ShouldProcess("Starting Add-CardText function.")) { # Determine if a title was specified if ($Title) { $CardTextHtml = "<!-- Start $Title --><p class='card-text'>$CardText</p>" } else { $CardTextHtml = "<p class='card-text'>$CardText</p>" } $CardTextHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-CardTitle.ps1 function Add-CardTitle { <# .DESCRIPTION Adds Card Title Element .PARAMETER Title Title, used for comment .EXAMPLE Add-CardTitle -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Add-CardTitle function.")) { # Determine if a title was specified if ($Title) { $CardTitleHtml = "<h3 class='card-title'><!-- Start $Title -->" } else { $CardTitleHtml = "<h3 class='card-title'>" } $CardTitleHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-ClarityCardBody.ps1 function Add-ClarityCardBody { <# .DESCRIPTION Returns the HTML needed to start Start a Clarity Card Body. .PARAMETER CardText Title of the card. .EXAMPLE Add-ClarityCardBody -CardText "SomeHTML" .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([boolean])] param( [Parameter(Mandatory = $true)][String]$CardText ) if ($pscmdlet.ShouldProcess("Starting Add-ClarityCardBody function.")) { # Open the Body of the card. $CardBodyHtml = "<center><p class='card-text'>$CardText</p>" $CardBodyHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-ClarityPSBody.ps1 function Add-ClarityPSBody { <# .DESCRIPTION Adds ClarityPS Body Element .PARAMETER Title Title, used for comment .EXAMPLE Add-ClarityPSBody -Title ClarityHtmlBody .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title = "ClarityPSHtmlBody" ) if ($pscmdlet.ShouldProcess("Starting Add-ClarityPSBody function.")) { $ClarityPSBodyHtml = Add-HtmlBody -Title $title -HtmlBodyOption "onload='set_style_from_cookie()'" $ClarityPSBodyHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-ClarityPSCookie.ps1 function Add-ClarityPSCookie { <# .DESCRIPTION Adds Clarity Cookie MGMT script. .PARAMETER Title Title, used for comment .EXAMPLE Add-ClarityPSCookie -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title = "ClarityCookieMgmtScript" ) if ($pscmdlet.ShouldProcess("Starting Add-ClarityPSCookie function.")) { # Determine the Module Path $SourceModulePath = (Split-Path -Path (Get-Module -ListAvailable ClarityPS | Sort-Object -Property Version -Descending | Select-Object -First 1).path) $ScriptPath = "$SourceModulePath\lib\cookie.js" $CookieScript = Get-Content -Path $ScriptPath $ClarityPSCookieHtml = Add-Script -Title $Title -ScriptText "$CookieScript" $ClarityPSCookieHtml += Close-Script $ClarityPSCookieHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-ClarityPSHeader.ps1 function Add-ClarityPSHeader { <# .DESCRIPTION Adds Flex Item Element .PARAMETER Title Title, used for comment .EXAMPLE Add-ClarityPSHeader -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title = "ClarityPSHeader" ) if ($pscmdlet.ShouldProcess("Starting Add-ClarityPSHeader function.")) { try { # Determine if a title was specified $ClarityPSHeaderHtml += Add-Header -Title HeaderElement $ClarityPSHeaderHtml += Add-Branding -Title BrandingElement $ClarityPSHeaderHtml += Add-BrandingTitle -Title ClarityPS $ClarityPSHeaderHtml += Close-Branding $ClarityPSHeaderHtml += Add-HeaderNav -Title HeaderNav $ClarityPSHeaderHtml += Add-HeaderNavLink -URL "#" -LinkTitle "FutureLink" -Active $ClarityPSHeaderHtml += Close-Link $ClarityPSHeaderHtml += Close-HeaderNav -Title HeaderNav $ClarityPSHeaderHtml += Add-HeaderAction -Title $Title $ClarityPSHeaderHtml += Add-ButtonGroup -Title $Title $ClarityPSHeaderHtml += Add-Button -Class "btn btn-inverse btn-sm" -OnClick 'switch_style("dark");return false;' -ButtonText "Dark Theme" -ButtonValue 'Dark Theme' -ID 'dark' -Name 'theme' $ClarityPSHeaderHtml += Close-Button $ClarityPSHeaderHtml += Add-Button -Class "btn btn-inverse btn-sm" -OnClick 'switch_style("light");return false;' -ButtonText "Light Theme" -ButtonValue 'Light Theme' -ID 'light' -Name 'theme' $ClarityPSHeaderHtml += Close-Button $ClarityPSHeaderHtml += Close-ButtonGroup -Title $Title $ClarityPSHeaderHtml += Add-Help -Title MyCard -URL "https://github.com/jpsider/reportcardps" $ClarityPSHeaderHtml += Close-Help $ClarityPSHeaderHtml += Close-HeaderAction -Title $Title $ClarityPSHeaderHtml += Close-Header -Title $Title $ClarityPSHeaderHtml } catch { $ErrorMessage = $_.Exception.Message $FailedItem = $_.Exception.ItemName Throw "Add-ClarityPSHeader: $ErrorMessage $FailedItem" } } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-ClarityPSHeadSet.ps1 function Add-ClarityPSHeadSet { <# .DESCRIPTION Adds Flex Item Element .PARAMETER Title Title, used for comment .EXAMPLE Add-ClarityPSHeadSet -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title = "ClarityPSHeadSet" ) if ($pscmdlet.ShouldProcess("Starting Add-ClarityPSHeadSet function.")) { try { # Determine if a title was specified $ClarityPSHeadSetHtml += Add-HtmlHead -Title $Title $ClarityPSHeadSetHtml += Add-ClarityPSLinkSet $ClarityPSHeadSetHtml += Add-ClarityPSScriptSet $ClarityPSHeadSetHtml += Add-ClarityPSCookie $ClarityPSHeadSetHtml += Add-ClarityPSStyleSet $ClarityPSHeadSetHtml += Add-ClarityPSIconSet $ClarityPSHeadSetHtml += Add-HtmlTitle -Title "ClarityPS" $ClarityPSHeadSetHtml += Close-HtmlTitle $ClarityPSHeadSetHtml += Close-HtmlHead -Title $Title $ClarityPSHeadSetHtml } catch { $ErrorMessage = $_.Exception.Message $FailedItem = $_.Exception.ItemName Throw "Add-ClarityPSHeadSet: $ErrorMessage $FailedItem" } } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-ClarityPSIconSet.ps1 function Add-ClarityPSIconSet { <# .DESCRIPTION Adds Flex Item Element .PARAMETER Title Title, used for comment .EXAMPLE Add-ClarityPSIconJs -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title = "ClarityIconSetJS" ) if ($pscmdlet.ShouldProcess("Starting Add-ClarityPSIconJs function.")) { try { $SourceModulePath = (Split-Path -Path (Get-Module -ListAvailable ClarityPS | Sort-Object -Property Version -Descending | Select-Object -First 1).path) $ScriptPath = "$SourceModulePath\lib\IconSet.js" $IconScriptSet = Get-Content -Path $ScriptPath $ClarityPSIconJsHtml += Add-Script -Title $Title -ScriptText "$IconScriptSet" $ClarityPSIconJsHtml += Close-Script $ClarityPSIconJsHtml } catch { $ErrorMessage = $_.Exception.Message $FailedItem = $_.Exception.ItemName Throw "Add-ClarityPSIconSet: $ErrorMessage $FailedItem" } } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-ClarityPSLinkSet.ps1 function Add-ClarityPSLinkSet { <# .DESCRIPTION Adds Flex Item Element .PARAMETER Title Title, used for comment .EXAMPLE Add-ClarityPSLinkSet -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title = "ClarityPSLinkSet" ) if ($pscmdlet.ShouldProcess("Starting Add-ClarityPSLinkSet function.")) { try { $SourceModulePath = (Split-Path -Path (Get-Module -ListAvailable ClarityPS | Sort-Object -Property Version -Descending | Select-Object -First 1).path) $ScriptPath = "$SourceModulePath\lib\CssLinkSet.json" $LinkSet = Get-Content -Path $ScriptPath | ConvertFrom-Json foreach ($CSSLink in $LinkSet) { $CssURL = $CSSLink.URL $CssTitle = $CSSLink.Title $RelType = $CSSLink.RelType $ClarityPSLinkSetHtml += Add-CssLink -URL "$CssURL" -LinkTitle "$CssTitle" -RelType $RelType } $ClarityPSLinkSetHtml } catch { $ErrorMessage = $_.Exception.Message $FailedItem = $_.Exception.ItemName Throw "Add-ClarityPSLinkSet: $ErrorMessage $FailedItem" } } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-ClarityPSScriptSet.ps1 function Add-ClarityPSScriptSet { <# .DESCRIPTION Adds Flex Item Element .PARAMETER Title Title, used for comment .EXAMPLE Add-ClarityPSScriptSet -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title = "ClarityPSScriptSet" ) if ($pscmdlet.ShouldProcess("Starting Add-ClarityPSScriptSet function.")) { try { $SourceModulePath = (Split-Path -Path (Get-Module -ListAvailable ClarityPS | Sort-Object -Property Version -Descending | Select-Object -First 1).path) $ScriptPath = "$SourceModulePath\lib\ScriptSet.json" $JSScriptList = Get-Content -Path $ScriptPath | ConvertFrom-Json foreach ($JSScript in $JSScriptList) { $JSScriptURL = $JSScript.URL $ClarityPSScriptSetHtml += Add-ScriptLink -SourceLink "$JSScriptURL" $ClarityPSScriptSetHtml += Close-Script } $ClarityPSScriptSetHtml } catch { $ErrorMessage = $_.Exception.Message $FailedItem = $_.Exception.ItemName Throw "Add-ClarityPSScriptSet: $ErrorMessage $FailedItem" } } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-ClarityPSStyleSet.ps1 function Add-ClarityPSStyleSet { <# .DESCRIPTION Adds Flex Item Element .PARAMETER Title Title, used for comment .EXAMPLE Add-ClarityPSStyleSet -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Add-ClarityPSStyleSet function.")) { try { # Get the specified Style data. $SourceModulePath = (Split-Path -Path (Get-Module -ListAvailable ClarityPS | Sort-Object -Property Version -Descending | Select-Object -First 1).path) $StylePath = "$SourceModulePath\lib\style.css" $StyleData = Get-Content -Path $StylePath $ClarityPSStyleSetHtml += Add-Style -StyleText "$StyleData" $ClarityPSStyleSetHtml += Close-Style $ClarityPSStyleSetHtml } catch { $ErrorMessage = $_.Exception.Message $FailedItem = $_.Exception.ItemName Throw "Add-ClarityPSStyleSet: $ErrorMessage $FailedItem" } } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-CssLink.ps1 function Add-CssLink { <# .DESCRIPTION Adds CSS Link Element .PARAMETER Title Title, used for comment .PARAMETER URL Provide a valid URL to remote or local CSS link. .PARAMETER LinkTitle Title for the link .PARAMETER RelType ex. stylesheet .EXAMPLE Add-CssLink -Title MyCard -URL "http://invoke-automation.blog" -LinkTitle "Invoke-Automation" .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title, [Parameter(Mandatory = $true)][String]$URL, [Parameter()][String]$LinkTitle, [Parameter()][String]$RelType = "stylesheet" ) if ($pscmdlet.ShouldProcess("Starting Add-CssLink function.")) { # Determine if a title was specified if ($Title) { $CssLinkHtml = "<link rel='$RelType' href='$URL' title='$LinkTitle' type='text/css' /><!-- Start $Title -->" } else { $CssLinkHtml = "<link rel='$RelType' href='$URL' title='$LinkTitle' type='text/css' />" } $CssLinkHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-DocumentTitle.ps1 function Add-DocumentTitle { <# .DESCRIPTION Adds Title to Card Html Document .PARAMETER Title Title, used for comment .EXAMPLE Add-DocumentTitle -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter(Mandatory = $true)][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Add-DocumentTitle function.")) { # Determine if a title was specified $DocumentTitleHtml = "<h3>$Title</h3></br></br>" $DocumentTitleHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-FlexContainer.ps1 function Add-FlexContainer { <# .DESCRIPTION Adds Flex Container Element .PARAMETER Title Title, used for comment .EXAMPLE Add-FlexContainer -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Add-FlexContainer function.")) { # Determine if a title was specified if ($Title) { $FlexContainerHtml = "<flex-container><!-- Start $Title -->" } else { $FlexContainerHtml = "<flex-container>" } $FlexContainerHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-FlexItem.ps1 function Add-FlexItem { <# .DESCRIPTION Adds Flex Item Element .PARAMETER Title Title, used for comment .EXAMPLE Add-FlexItem -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Add-FlexItem function.")) { # Determine if a title was specified if ($Title) { $FlexItemHtml = "<div class='flex-item'><!-- Start $Title -->" } else { $FlexItemHtml = "<div class='flex-item'>" } $FlexItemHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-Header.ps1 function Add-Header { <# .DESCRIPTION Adds Header Element .PARAMETER Title Title, used for comment .PARAMETER HeaderOption Used for CSS Style selection. .EXAMPLE Add-Header -Title MyCard -HeaderOption Header-6 .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title, [Parameter()][String]$HeaderOption = "header-3" ) if ($pscmdlet.ShouldProcess("Starting Add-Header function.")) { # Determine if a title was specified if ($Title) { $HeaderHtml = "<header class='header $HeaderOption'><!-- Start $Title -->" } else { $HeaderHtml = "<header class='header $HeaderOption'>" } $HeaderHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-HeaderAction.ps1 function Add-HeaderAction { <# .DESCRIPTION Adds Flex Item Element .PARAMETER Title Title, used for comment .EXAMPLE Add-HeaderActions -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Add-HeaderActions function.")) { # Determine if a title was specified if ($Title) { $HeaderActionsHtml = "<div class='header-actions'><!-- Start $Title -->" } else { $HeaderActionsHtml = "<div class='header-actions'>" } $HeaderActionsHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-HeaderNav.ps1 function Add-HeaderNav { <# .DESCRIPTION Adds Header Nav Element .PARAMETER Title Title, used for comment .EXAMPLE Add-HeaderNav -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Add-HeaderNav function.")) { # Determine if a title was specified if ($Title) { $HeaderNavHtml = "<div class='header-nav'><!-- Start $Title -->" } else { $HeaderNavHtml = "<div class='header-nav'>" } $HeaderNavHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-HeaderNavLink.ps1 function Add-HeaderNavLink { <# .DESCRIPTION Adds Link Element .PARAMETER Title Title, used for comment .PARAMETER URL Web URL for the link. .PARAMETER LinkTitle Title of the link in the HTML doc (user facing) .PARAMETER NewTab Adds a property to open the link in a new tab. .PARAMETER Active Adds a property to highlight the link as active. .EXAMPLE Add-HeaderNavLink -Title MyCard -URL "http://invoke-automation.blog" -LinkTitle "Invoke-Automation" -NewTab .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter(Mandatory = $true)][String]$URL, [Parameter(Mandatory = $true)][String]$LinkTitle, [Parameter()][switch]$Active ) if ($pscmdlet.ShouldProcess("Starting Add-HeaderNavLink function.")) { # Determine if a title was specified $LinkHtml = "<a href='$URL'" if ($Active) { $class = "class='active nav-link nav-text'" } else { $class = "class='nav-link nav-text'" } $LinkHtml += $class $LinkHtml += ">$LinkTitle" $LinkHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-Help.ps1 function Add-Help { <# .DESCRIPTION Adds Help Link with Cog Icon in the Header. .PARAMETER Title Title, used for comment .PARAMETER URL URL to help documents .EXAMPLE Add-Help -Title MyCard -URL "http://invoke-automation.blog" .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title, [Parameter(Mandatory = $true)][String]$URL ) if ($pscmdlet.ShouldProcess("Starting Add-Help function.")) { # Determine if a title was specified if ($Title) { $HelpHtml = "<a href='$URL' class='nav-link nav-icon' target='_blank'><!-- Start $Title -->" } else { $HelpHtml = "<a href='$URL' class='nav-link nav-icon' target='_blank'>" } $HelpHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-HtmlBody.ps1 function Add-HtmlBody { <# .DESCRIPTION Adds HTML Body Element .PARAMETER Title Title, used for comment .PARAMETER HtmlBodyOption Allows for Javascript options in the body element. .EXAMPLE Add-HtmlBody -Title MyCard -HtmlBodyOption "onload='set_style_from_cookie()'" .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title, [Parameter()][String]$HtmlBodyOption = "onload='set_style_from_cookie()'" ) if ($pscmdlet.ShouldProcess("Starting Add-HtmlBody function.")) { # Determine if a title was specified $HtmlBodyHtml = "<body " if ($HtmlBodyOption) { $HtmlBodyHtml += "$HtmlBodyOption" } else { # Nothing to add here. } if ($Title) { $HtmlBodyHtml += "><!-- Start $Title -->" } else { $HtmlBodyHtml += ">" } $HtmlBodyHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-HtmlHead.ps1 function Add-HtmlHead { <# .DESCRIPTION Adds HTML Head Element .PARAMETER Title Title, used for comment .EXAMPLE Add-HtmlHead -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Add-HtmlHead function.")) { # Determine if a title was specified if ($Title) { $HtmlHeadHtml = "<head><!-- Start $Title -->" } else { $HtmlHeadHtml = "<head>" } $HtmlHeadHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-HtmlTitle.ps1 function Add-HtmlTitle { <# .DESCRIPTION Adds HTML Title Element for the Browser Tab. .PARAMETER Title Title, used for comment .PARAMETER HtmlTitle Title, used for HTML document .EXAMPLE Add-HtmlTitle -Title MyCard -HtmlTitle "MyHtmlDocument" .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title, [Parameter()][String]$HtmlTitle = "ClarityPS" ) if ($pscmdlet.ShouldProcess("Starting Add-HtmlTitle function.")) { # Determine if a title was specified if ($Title) { $HtmlTitleHtml = "<!-- Start $Title --><title>$HtmlTitle" } else { $HtmlTitleHtml = "<title>$HtmlTitle" } $HtmlTitleHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-Icon.ps1 function Add-Icon { <# .DESCRIPTION Builds HTML Reports using VMware's ClarityUI library. .PARAMETER Icon Clarity Icon. .PARAMETER IconSize Size of the Icon. .EXAMPLE Add-Icon .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([boolean])] param( [Parameter(Mandatory = $true)][String]$Icon, [Parameter()][String]$IconSize = 24 ) if ($pscmdlet.ShouldProcess("Starting Add-Icon function.")) { $IconHTML = "<clr-icon shape='$Icon' size='$IconSize'></clr-icon>" $IconHTML } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-Link.ps1 function Add-Link { <# .DESCRIPTION Adds Link Element .PARAMETER Title Title, used for comment .PARAMETER URL Web URL for the link. .PARAMETER LinkTitle Title of the link in the HTML doc (user facing) .PARAMETER NewTab Adds a property to open the link in a new tab. .EXAMPLE Add-Link -Title MyCard -URL "http://invoke-automation.blog" -LinkTitle "Invoke-Automation" -NewTab .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title, [Parameter(Mandatory = $true)][String]$URL, [Parameter(Mandatory = $true)][String]$LinkTitle, [Parameter()][switch]$NewTab = $false ) if ($pscmdlet.ShouldProcess("Starting Add-Link function.")) { # Determine if a title was specified $LinkHtml = "<a href='$URL'" if ($NewTab) { $LinkHtml += " target='_blank'>$LinkTitle" } else { $LinkHtml += ">$LinkTitle" } if ($Title) { $LinkHtml += "<!-- Start $Title -->" } else { # adding nothing } $LinkHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-MainContainer.ps1 function Add-MainContainer { <# .DESCRIPTION Adds Main-Container Element .PARAMETER Title Title, used for comment .EXAMPLE Add-MainContainer -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Add-MainContainer function.")) { # Determine if a title was specified if ($Title) { $MainContainerHtml = "<div class='main-container'><!-- Start $Title -->" } else { $MainContainerHtml = "<div class='main-container'>" } $MainContainerHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-ProgressBlock.ps1 function Add-ProgressBlock { <# .DESCRIPTION Adds Progress Block Element .PARAMETER Title Title, used for comment .PARAMETER Class Class to be used for the color. .PARAMETER Value Percent of the Progress bar to fill in. .PARAMETER Max Maximum progress bar value. .EXAMPLE Add-ProgressBlock -Title MyCard -Class "progress success" -Value "29" -Max "100" .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title, [Parameter()][String]$Class, [Parameter()][String]$Value, [Parameter()][String]$Max ) if ($pscmdlet.ShouldProcess("Starting Add-ProgressBlock function.")) { # Determine if a title was specified if ($Title) { $ProgressBlockHtml = "<div class='progress-block'><div class='$Class'><progress value='$value' max='$Max' data-displayval='$Value%'></progress></div></div><!-- Start $Title -->" } else { $ProgressBlockHtml = "<div class='progress-block'><div class='$Class'><progress value='$value' max='$Max' data-displayval='$Value%'></progress></div></div>" } $ProgressBlockHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-Script.ps1 function Add-Script { <# .DESCRIPTION Adds Script Element .PARAMETER Title Title, used for comment .PARAMETER ScriptText Title, used for comment .EXAMPLE Add-Script -Title MyCard -ScriptText "Some JavaScript" .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title, [Parameter(Mandatory = $true)][String]$ScriptText ) if ($pscmdlet.ShouldProcess("Starting Add-Script function.")) { # Determine if a title was specified if ($Title) { $ScriptHtml = "<script>$ScriptText<!-- Start $Title -->" } else { $ScriptHtml = "<script>$ScriptText" } $ScriptHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-ScriptLink.ps1 function Add-ScriptLink { <# .DESCRIPTION Adds Flex Item Element .PARAMETER Title Title, used for comment .PARAMETER SourceLink Link to the CSS resource .EXAMPLE Add-ScriptLink -Title MyCard -SourceLink "https://unpkg.com/clarity-icons@0.10.28/clarity-icons.min.js" .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title, [Parameter()][String]$SourceLink ) if ($pscmdlet.ShouldProcess("Starting Add-ScriptLink function.")) { # Determine if a title was specified if ($Title) { $ScriptLinkHtml = "<script src='$SourceLink'><!-- Start $Title -->" } else { $ScriptLinkHtml = "<script src='$SourceLink'>" } $ScriptLinkHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Add-Style.ps1 function Add-Style { <# .DESCRIPTION Adds Style Element .PARAMETER Title Title, used for comment .PARAMETER StyleText Text for the CSS Style .EXAMPLE Add-Style -Title MyCard -StyleText "Some CSS" .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title, [Parameter(Mandatory = $true)][String]$StyleText ) if ($pscmdlet.ShouldProcess("Starting Add-Style function.")) { # Determine if a title was specified if ($Title) { $StyleHtml = "<style>$StyleText<!-- Start $Title -->" } else { $StyleHtml = "<style>$StyleText" } $StyleHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-Branding.ps1 function Close-Branding { <# .DESCRIPTION Closes Branding Element .PARAMETER Title Title, used for comment .EXAMPLE Close-Branding -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-Branding function.")) { # Determine if a title was specified if ($Title) { $BrandingHtml = "</div><!-- End $Title -->" } else { $BrandingHtml = "</div>" } $BrandingHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-Button.ps1 function Close-Button { <# .DESCRIPTION Closes Button Element .PARAMETER Title Title, used for comment .EXAMPLE Close-Button -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-Button function.")) { # Determine if a title was specified if ($Title) { $ButtonHtml = "</button><!-- End $Title -->" } else { $ButtonHtml = "</button>" } $ButtonHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-ButtonGroup.ps1 function Close-ButtonGroup { <# .DESCRIPTION Closes Flex Item Element .PARAMETER Title Title, used for comment .EXAMPLE Close-ButtonGroup -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-ButtonGroup function.")) { # Determine if a title was specified if ($Title) { $ButtonGroupHtml = "</div><!-- End $Title -->" } else { $ButtonGroupHtml = "</div>" } $ButtonGroupHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-Card.ps1 function Close-Card { <# .DESCRIPTION Closes Flex Item Element .PARAMETER Title Title, used for comment .EXAMPLE Close-Card -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-Card function.")) { # Determine if a title was specified if ($Title) { $CardHtml = "</div><!-- End $Title -->" } else { $CardHtml = "</div>" } $CardHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-CardBlock.ps1 function Close-CardBlock { <# .DESCRIPTION Closes Card-Block Element .PARAMETER Title Title, used for comment .EXAMPLE Close-CardBlock -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-CardBlock function.")) { # Determine if a title was specified if ($Title) { $CardBlockHtml = "</div><!-- End $Title -->" } else { $CardBlockHtml = "</div>" } $CardBlockHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-CardText.ps1 function Close-CardText { <# .DESCRIPTION Closes Card-Text Element .PARAMETER Title Title, used for comment .EXAMPLE Close-CardText -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-CardText function.")) { # Determine if a title was specified if ($Title) { $CardTextHtml = "</div><!-- End $Title -->" } else { $CardTextHtml = "</div>" } $CardTextHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-CardTitle.ps1 function Close-CardTitle { <# .DESCRIPTION Closes Card Title Element .PARAMETER Title Title, used for comment .EXAMPLE Close-CardTitle -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-CardTitle function.")) { # Determine if a title was specified if ($Title) { $CardTitleHtml = "</h3><!-- End $Title -->" } else { $CardTitleHtml = "</h3>" } $CardTitleHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-ClarityCard.ps1 function Close-ClarityCard { <# .DESCRIPTION Returns the HTML to close a standard ClarityPS Card. .PARAMETER Title Provide a Title so a proper comment can be added. .EXAMPLE Close-ClarityCard -Title Storage .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([boolean])] param( [Parameter(Mandatory = $true)][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-ClarityCard function.")) { # Return the closing HTML for a Standard ClarityPS Card. $ClosingBaseHTML = "</div></div></div>" + "<!-- End $Title Card -->" $ClosingBaseHTML } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-ClarityCardBody.ps1 function Close-ClarityCardBody { <# .DESCRIPTION Closes Card Body Element .PARAMETER Title Title, used for comment .EXAMPLE Close-ClarityCardBody -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-ClarityCardBody function.")) { # Determine if a title was specified if ($Title) { $BrandingHtml = "</center><!-- End $Title -->" } else { $BrandingHtml = "</center>" } $BrandingHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-ClarityDocument.ps1 function Close-ClarityDocument { <# .DESCRIPTION Closes Flex Item Element .PARAMETER Title Title, used for comment .EXAMPLE Close-ClarityDocument -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title = "ClarityDocument" ) if ($pscmdlet.ShouldProcess("Starting Close-ClarityDocument function.")) { # Determine if a title was specified try { $CloseClarityDocumentHtml += Close-FlexContainer -Title "FlexContainer" $CloseClarityDocumentHtml += Close-HtmlBody -Title "Body" $CloseClarityDocumentHtml += Close-HtmlDocument -Title "$Title" $CloseClarityDocumentHtml } catch { $ErrorMessage = $_.Exception.Message $FailedItem = $_.Exception.ItemName Throw "Close-ClarityDocument: $ErrorMessage $FailedItem" } } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-FlexContainer.ps1 function Close-FlexContainer { <# .DESCRIPTION Closes Flex Container Element .PARAMETER Title Title, used for comment .EXAMPLE Close-FlexContainer -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-FlexContainer function.")) { # Determine if a title was specified if ($Title) { $FlexContainerHtml = "</div><!-- End $Title -->" } else { $FlexContainerHtml = "</div>" } $FlexContainerHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-FlexItem.ps1 function Close-FlexItem { <# .DESCRIPTION Closes Flex Item Element .PARAMETER Title Title, used for comment .EXAMPLE Close-FlexItem -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-FlexItem function.")) { # Determine if a title was specified if ($Title) { $FlexItemHtml = "</div><!-- End $Title -->" } else { $FlexItemHtml = "</div>" } $FlexItemHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-Header.ps1 function Close-Header { <# .DESCRIPTION Closes header Element .PARAMETER Title Title, used for comment .EXAMPLE Close-Header -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-Header function.")) { # Determine if a title was specified if ($Title) { $HeaderHtml = "</header><!-- End $Title -->" } else { $HeaderHtml = "</header>" } $HeaderHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-HeaderAction.ps1 function Close-HeaderAction { <# .DESCRIPTION Closes Header-Nav Element .PARAMETER Title Title, used for comment .EXAMPLE Close-HeaderAction -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-HeaderAction function.")) { # Determine if a title was specified if ($Title) { $HeaderActionHtml = "</div><!-- End $Title -->" } else { $HeaderActionHtml = "</div>" } $HeaderActionHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-HeaderNav.ps1 function Close-HeaderNav { <# .DESCRIPTION Closes Header-Nav Element .PARAMETER Title Title, used for comment .EXAMPLE Close-HeaderNav -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-HeaderNav function.")) { # Determine if a title was specified if ($Title) { $HeaderNavHtml = "</div><!-- End $Title -->" } else { $HeaderNavHtml = "</div>" } $HeaderNavHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-Help.ps1 function Close-Help { <# .DESCRIPTION Closes Help Link with Cog Icon. .PARAMETER Title Title, used for comment .EXAMPLE Close-Help -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-Help function.")) { # Determine if a title was specified if ($Title) { $HelpHtml = "<clr-icon shape='cog'></clr-icon></a><!-- End $Title -->" } else { $HelpHtml = "<clr-icon shape='cog'></clr-icon></a>" } $HelpHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-HtmlBody.ps1 function Close-HtmlBody { <# .DESCRIPTION Closes HTML Body Element .PARAMETER Title Title, used for comment .EXAMPLE Close-HtmlBody -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-HtmlBody function.")) { # Determine if a title was specified if ($Title) { $HtmlBodyHtml = "</body><!-- End $Title -->" } else { $HtmlBodyHtml = "</body>" } $HtmlBodyHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-HtmlDocument.ps1 function Close-HtmlDocument { <# .DESCRIPTION Closes Flex Item Element .PARAMETER Title Title, used for comment .EXAMPLE Close-HtmlDocument -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-HtmlDocument function.")) { # Determine if a title was specified if ($Title) { $HtmlDocumentHtml = "</html><!-- End $Title -->" } else { $HtmlDocumentHtml = "</html>" } $HtmlDocumentHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-HtmlHead.ps1 function Close-HtmlHead { <# .DESCRIPTION Closes HTML Head Element .PARAMETER Title Title, used for comment .EXAMPLE Close-HtmlHead -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-HtmlHead function.")) { # Determine if a title was specified if ($Title) { $HtmlHeadHtml = "</head><!-- End $Title -->" } else { $HtmlHeadHtml = "</head>" } $HtmlHeadHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-HtmlTitle.ps1 function Close-HtmlTitle { <# .DESCRIPTION Closes Html Title Element .PARAMETER Title Title, used for comment .EXAMPLE Close-HtmlTitle -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-HtmlTitle function.")) { # Determine if a title was specified if ($Title) { $HtmlTitleHtml = "</title><!-- End $Title -->" } else { $HtmlTitleHtml = "</title>" } $HtmlTitleHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-Link.ps1 function Close-Link { <# .DESCRIPTION Closes Link Element .PARAMETER Title Title, used for comment .EXAMPLE Close-Link -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-Link function.")) { # Determine if a title was specified if ($Title) { $LinkHtml = "</a><!-- End $Title -->" } else { $LinkHtml = "</a>" } $LinkHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-MainContainer.ps1 function Close-MainContainer { <# .DESCRIPTION Closes Main container Element .PARAMETER Title Title, used for comment .EXAMPLE Close-MainContainer -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-MainContainer function.")) { # Determine if a title was specified if ($Title) { $MainContainerHtml = "</div><!-- End $Title -->" } else { $MainContainerHtml = "</div>" } $MainContainerHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-Script.ps1 function Close-Script { <# .DESCRIPTION Closes Script Element .PARAMETER Title Title, used for comment .EXAMPLE Close-Script -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-Script function.")) { # Determine if a title was specified if ($Title) { $ScriptHtml = "</script><!-- End $Title -->" } else { $ScriptHtml = "</script>" } $ScriptHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\Close-Style.ps1 function Close-Style { <# .DESCRIPTION Closes Style Element .PARAMETER Title Title, used for comment .EXAMPLE Close-Style -Title MyCard .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting Close-Style function.")) { # Determine if a title was specified if ($Title) { $StyleHtml = "</style><!-- End $Title -->" } else { $StyleHtml = "</style>" } $StyleHtml } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\New-ClarityCard.ps1 function New-ClarityCard { <# .DESCRIPTION Returns the HTML needed to start a new Clarity card. .PARAMETER Title Title of the card. .PARAMETER Icon Clarity Icon. .PARAMETER IconSize Size of the Icon. .EXAMPLE New-ClarityCard -Title Storage -Icon Storage -IconSize 24 .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([boolean])] param( [Parameter(Mandatory = $true)][String]$Title, [Parameter()][String]$Icon, [Parameter()][String]$IconSize = 24 ) if ($pscmdlet.ShouldProcess("Starting New-ClarityCard function.")) { Try { # Add the Title $CardBaseString = Add-FlexItem -Title $Title $CardBaseString += "<div class='card'>" $CardBaseString += "<div class='card-block'>" $CardBaseString += "<h3 class='card-title'>" # Add the Icon with size if ($Icon) { $CardBaseString += Add-Icon -Icon $Icon -IconSize $IconSize } else { # No Icon to Add } $FinalCardString = $CardBaseString + "  $Title</h3><center>" $FinalCardString } catch { $ErrorMessage = $_.Exception.Message $FailedItem = $_.Exception.ItemName Throw "New-ClarityCard: $ErrorMessage $FailedItem" } } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\New-ClarityDocument.ps1 function New-ClarityDocument { <# .DESCRIPTION Returns the HTML needed to start a new Clarity card. .PARAMETER Title Title of the card. .PARAMETER Icon Clarity Icon. .PARAMETER IconSize Size of the Icon. .EXAMPLE New-ClarityDocument -Title Storage .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([boolean])] param( [Parameter(Mandatory = $true)][String]$Title ) if ($pscmdlet.ShouldProcess("Starting New-ClarityDocument function.")) { Try { # Add the Title $HtmlBaseString += New-HtmlDocument $HtmlBaseString += Add-ClarityPSHeadSet $HtmlBaseString += Add-ClarityPSBody $HtmlBaseString += Add-MainContainer $HtmlBaseString += Add-ClarityPSHeader $HtmlBaseString += Add-DocumentTitle -Title $Title $HtmlBaseString += Add-FlexContainer $HtmlBaseString } catch { $ErrorMessage = $_.Exception.Message $FailedItem = $_.Exception.ItemName Throw "New-ClarityDocument: $ErrorMessage $FailedItem" } } else { # -WhatIf was used. return $false } } # .\ClarityPS\public\New-HtmlDocument.ps1 function New-HtmlDocument { <# .DESCRIPTION Adds HTML Element .PARAMETER Title Title, used for comment .EXAMPLE New-HtmlDocument -Title MyHTMLDocument .NOTES No notes at this time. #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] [OutputType([String])] [OutputType([Boolean])] param( [Parameter()][String]$Title ) if ($pscmdlet.ShouldProcess("Starting New-HtmlDocument function.")) { # Determine if a title was specified if ($Title) { $HtmlString = "<!DOCTYPE html><html lang='en'><!-- Start $Title -->" } else { $HtmlString = "<!DOCTYPE html><html lang='en'>" } $HtmlString } else { # -WhatIf was used. return $false } } Write-Verbose 'Importing from [C:\projects\clarityps\ClarityPS\classes]' |