Difference between revisions of "Input Plugin"
(→Usage) |
(→Usage) |
||
Line 17: | Line 17: | ||
* <code>content:request:interaction:http<span>://</span>link.to.input.handler?input={INPUT}|search|en|Headline|http<span>://</span>link.to.image|Extension|Hint text@http://msx.benzac.de/interaction/input.html</code> | * <code>content:request:interaction:http<span>://</span>link.to.input.handler?input={INPUT}|search|en|Headline|http<span>://</span>link.to.image|Extension|Hint text@http://msx.benzac.de/interaction/input.html</code> | ||
− | The content service should return either an <code>action</code> to be executed or a <code>template</code> and <code>items</code> object to display the results (e.g. for search queries). Please see | + | The content service should return either an <code>action</code> to be executed or a <code>template</code> and <code>items</code> object to display the results (e.g. for search queries). Please see this example code how a user login response can look like. |
− | |||
− | |||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
{ | { | ||
Line 25: | Line 23: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
The next example code shows how a search query response can look like. | The next example code shows how a search query response can look like. | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> |
Revision as of 15:29, 22 February 2024
This is a special interaction plugin that allows you to handle complex and multilingual inputs for special use cases (e.g. entering user names/passwords, performing search queries, etc.). In order to use this plugin, a corresponding content service must be implemented that processes the entered input (e.g. by evaluating an input
parameter). The plugin can be used with version 0.1.123 or higher.
Usage[edit]
The plugin must be loaded with a content service URL that is able to handle the input (which can be set as URL parameter). Optionally, a type, a default language, a headline, a background, an extension, and/or a hint can be set. Please see following action syntax examples.
content:request:interaction:{URL}@http://msx.benzac.de/interaction/input.html
content:request:interaction:{URL}|{TYPE}@http://msx.benzac.de/interaction/input.html
content:request:interaction:{URL}|{TYPE}|{DEFAULT_LANG}@http://msx.benzac.de/interaction/input.html
content:request:interaction:{URL}|{TYPE}|{DEFAULT_LANG}|{HEADLINE}@http://msx.benzac.de/interaction/input.html
content:request:interaction:{URL}|{TYPE}|{DEFAULT_LANG}|{HEADLINE}|{BACKGROUND}@http://msx.benzac.de/interaction/input.html
content:request:interaction:{URL}|{TYPE}|{DEFAULT_LANG}|{HEADLINE}|{BACKGROUND}|{EXTENSION}@http://msx.benzac.de/interaction/input.html
content:request:interaction:{URL}|{TYPE}|{DEFAULT_LANG}|{HEADLINE}|{BACKGROUND}|{EXTENSION}|{HINT}@http://msx.benzac.de/interaction/input.html
The content service URL should contain the keyword {INPUT}
, which is replaced with the corresponding value. Please see following action syntax examples.
content:request:interaction:http://link.to.input.handler?input={INPUT}@http://msx.benzac.de/interaction/input.html
content:request:interaction:http://link.to.input.handler?input={INPUT}|search|en|Headline|http://link.to.image|Extension|Hint text@http://msx.benzac.de/interaction/input.html
The content service should return either an action
to be executed or a template
and items
object to display the results (e.g. for search queries). Please see this example code how a user login response can look like.
{
"action": "reload"
}
The next example code shows how a search query response can look like.
{
"headline": "Search results for \"Video\"",
"template": {
"type": "separate",
"layout": "0,0,2,4",
"icon": "msx-white-soft:movie",
"color": "msx-glass"
},
"items": [{
"title": "Video 1",
"playerLabel": "Video 1",
"action": "video:http://msx.benzac.de/media/video1.mp4"
}, {
"title": "Video 2",
"playerLabel": "Video 2",
"action": "video:http://msx.benzac.de/media/video2.mp4"
}, {
"title": "Video 3",
"playerLabel": "Video 3",
"action": "video:http://msx.benzac.de/media/video3.mp4"
}]
}
If you would like to use the plugin as reference to implement your own plugin, please have a look at this implementation script: http://msx.benzac.de/interaction/js/input.js.
Note: Currently, the input plugin cannot be used with panels. Please also note that all requests to the content service are HTTP GET requests.
Syntax[edit]
Parameter | Type | Default Value | Mandatory | Description |
---|---|---|---|---|
input |
string |
"" |
Yes |
The input that should be handled. Note: For search inputs, the input is automatically submitted. |
Example[edit]
Screenshot[edit]
Code[edit]
//TODO
Demo[edit]
- Launch via App: https://msx.benzac.de/?start=menu:https://msx.benzac.de/info/xp/data/plugin_test_13.json
- Launch via Demo Page: https://msx.benzac.de/info/?start=content:https://msx.benzac.de/info/xp/data/plugin_test_13.json