Web Snippets allow external web pages to integrate with Softadmin®.
The web developer imports a script and places <softadmin-snippet>
tags on the web page. The script will then replace the contents of the tags with HTML generated by procedures in Softadmin®.
Snippets are administered from the Site menu item in the Web snippets subgroup in the Admin menu group.
A site consists of one or more paths, and snippets are connected to paths. A web page can use snippets from its own path and all paths above it in the hierarchy, so e.g. a snippet connected to the root is available to all paths.
The WebSnippets folder must be converted to an application in IIS Manager.
Two URLs must be provided when setting up a site in Softadmin®:
In order for sessions to work, HTTPS must be used and the snippets URL must appear to the browser as having the same domain name as the web site URL.
If the domains are different, and e.g. the web site is located at https://example.com, you can create a subdomain such as https://snippets.example.com and use a DNS CNAME record to point it to the snippets URL.
Paths have two purposes: access control, and providing snippet parameters via path parameters.
Paths can have an access control procedure connected to them. See the Access Control call for details.
Paths can contain parameters enclosed in {}
, for example /mypages/{department}/{subdepartment}
. The parameters can be used by snippets belonging to the path.
Its also possible to match the rest of the path by using a parameter name ending in three dots, for example /mypages/intranet/{path...}
.
Path parameters also require configuring e.g. URL Rewrite on the web server for the paths.
If access to the path is granted, the applicable snippet procedures are called in no particular order.
After the snippets have been set up in Softadmin®, use the Site documentation HTML button (available from the Paths for site and the Sites menu items) to generate documentation containing the script to include and the available snippet tags.
To verify access rights to snippets for a path, access control procedures are called in order, starting at the root.
Implicitly denies access unless one of the following procedures is called:
The following can also be used independently of the above:
Called when a page containing this snippet is loaded. Also called if any snippet has requested reloading all snippets via SoftadminSnippet.Page_ReloadSnippets (in the Form Submit or Link/Button Postback call).
If access to the path is granted, the applicable snippet procedures are called in no particular order.
In addition to the columns available in the Snippet Output result set, the following procedures can be used:
The following functions can be used by the Html column:
The Html column supports the Web Snippets HTML Level. Any other HTML will be removed from the output.
Called when a form generated by the snippet (via SoftadminSnippet.Form) is submitted.
The snippet can use all the functions and procedures available to the Snippet Output call. In addition, SoftadminSnippet.Page_ReloadSnippets can be used.
Called when a link or button generated by the snippet (via SoftadminSnippet.PostbackLink or SoftadminSnippet.PostbackButton) is clicked.
The snippet can use all the functions and procedures available to the Snippet Output call. In addition, SoftadminSnippet.Page_ReloadSnippets can be used.
Called when a file link generated by SoftadminSnippet.DatabaseFileLink is accessed.
Called when an image link generated by SoftadminSnippet.DatabaseImage is accessed.
Called when a BankID operation started by the snippet (via SoftadminSnippet.BankId_Identify or SoftadminSnippet.BankId_Sign) is finished.
The snippet can use all the functions and procedures available to the Snippet Output call. In addition, SoftadminSnippet.Page_ReloadSnippets can be used.