<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.mios.com/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.mios.com/index.php?action=history&amp;feed=atom&amp;title=Extra_Submenu_Items</id>
		<title>Extra Submenu Items - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.mios.com/index.php?action=history&amp;feed=atom&amp;title=Extra_Submenu_Items"/>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=Extra_Submenu_Items&amp;action=history"/>
		<updated>2026-04-08T01:05:35Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.8</generator>

	<entry>
		<id>http://wiki.mios.com/index.php?title=Extra_Submenu_Items&amp;diff=7897&amp;oldid=prev</id>
		<title>Andreimios at 10:22, 1 October 2014</title>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=Extra_Submenu_Items&amp;diff=7897&amp;oldid=prev"/>
				<updated>2014-10-01T10:22:33Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 10:22, 1 October 2014&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 43:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 43:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This construction defines two submenu items. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This construction defines two submenu items. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* id: integer, must be unique&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;id&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;: integer, must be unique&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Label: a JSON object containing two keys:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;Label&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;: a JSON object containing two keys:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;** lang_tag: string used by localized UIs&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;** &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;lang_tag&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;: string used by localized UIs&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;** text: string which represents the text that is going to be displayed if localization fails&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;** &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;text&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;: string which represents the text that is going to be displayed if localization fails&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Function: string specifying the function to be called when clicking on this submenu item&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;Function&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;: string specifying the function to be called when clicking on this submenu item&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Parameters: a JSON object containing the parameters which are to be called with the function&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;Parameters&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;: a JSON object containing the parameters which are to be called with the function&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* ScriptName: string specifying the .js file which must be loaded in order to find the function&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;ScriptName&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;: string specifying the .js file which must be loaded in order to find the function&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Invisible: (optional) - integer, if set to 1, the submenu item will be hidden and can be programmatically displayed&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;Invisible&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;: (optional) - integer, if set to 1, the submenu item will be hidden and can be programmatically displayed&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==== Create or edit your ‘my_plugin.js’ file and add the following lines: ====&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==== Create or edit your ‘my_plugin.js’ file and add the following lines: ====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key micasaverde_wiki:diff:version:1.11a:oldid:7896:newid:7897 --&gt;
&lt;/table&gt;</summary>
		<author><name>Andreimios</name></author>	</entry>

	<entry>
		<id>http://wiki.mios.com/index.php?title=Extra_Submenu_Items&amp;diff=7896&amp;oldid=prev</id>
		<title>Andreimios: Created page with &quot;== Inrodution == A number of extra submenu items can be created for each device type by using the definition supplied in plugin .json file.  These items will be created under ...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=Extra_Submenu_Items&amp;diff=7896&amp;oldid=prev"/>
				<updated>2014-10-01T10:19:28Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Inrodution == A number of extra submenu items can be created for each device type by using the definition supplied in plugin .json file.  These items will be created under ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Inrodution ==&lt;br /&gt;
A number of extra submenu items can be created for each device type by using the definition supplied in plugin .json file.&lt;br /&gt;
&lt;br /&gt;
These items will be created under ‘Apps’ menu item.&lt;br /&gt;
&lt;br /&gt;
They can be used to execute user defined functions which display content on the right part of the Web interface (the same way the other submenu items do).&lt;br /&gt;
&lt;br /&gt;
== How To ==&lt;br /&gt;
&lt;br /&gt;
==== In your plugin .json file, insert the following construction after ‘eventList2’: ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;submenuItems&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: &amp;quot;1&amp;quot;,&lt;br /&gt;
            &amp;quot;Label&amp;quot;: {&lt;br /&gt;
                &amp;quot;lang_tag&amp;quot;: &amp;quot;my_plugin_first_submenu&amp;quot;,&lt;br /&gt;
                &amp;quot;text&amp;quot;: &amp;quot;My first submenu&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;ScriptName&amp;quot;: &amp;quot;my_plugin.js&amp;quot;,&lt;br /&gt;
            &amp;quot;Function&amp;quot;: &amp;quot;MY_PLUGIN.first_submenu&amp;quot;,&lt;br /&gt;
            &amp;quot;Parameters&amp;quot;: {&lt;br /&gt;
                &amp;quot;name&amp;quot;: &amp;quot;John Doe&amp;quot;,&lt;br /&gt;
                &amp;quot;age&amp;quot;: &amp;quot;84&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: &amp;quot;2&amp;quot;,&lt;br /&gt;
            &amp;quot;Label&amp;quot;: {&lt;br /&gt;
                &amp;quot;lang_tag&amp;quot;: &amp;quot;my_plugin_second_submenu&amp;quot;,&lt;br /&gt;
                &amp;quot;text&amp;quot;: &amp;quot;My second submenu&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;Invisible&amp;quot;: &amp;quot;1&amp;quot;,&lt;br /&gt;
            &amp;quot;ScriptName&amp;quot;: &amp;quot;my_plugin.js&amp;quot;,&lt;br /&gt;
            &amp;quot;Function&amp;quot;: &amp;quot;MY_PLUGIN.second_submenu&amp;quot;,&lt;br /&gt;
            &amp;quot;Parameters&amp;quot;: {}&lt;br /&gt;
        }&lt;br /&gt;
]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This construction defines two submenu items. &lt;br /&gt;
&lt;br /&gt;
* id: integer, must be unique&lt;br /&gt;
* Label: a JSON object containing two keys:&lt;br /&gt;
** lang_tag: string used by localized UIs&lt;br /&gt;
** text: string which represents the text that is going to be displayed if localization fails&lt;br /&gt;
* Function: string specifying the function to be called when clicking on this submenu item&lt;br /&gt;
* Parameters: a JSON object containing the parameters which are to be called with the function&lt;br /&gt;
* ScriptName: string specifying the .js file which must be loaded in order to find the function&lt;br /&gt;
* Invisible: (optional) - integer, if set to 1, the submenu item will be hidden and can be programmatically displayed&lt;br /&gt;
&lt;br /&gt;
==== Create or edit your ‘my_plugin.js’ file and add the following lines: ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var MY_PLUGIN = (function() {&lt;br /&gt;
    return {&lt;br /&gt;
        first_submenu: function(obj) {&lt;br /&gt;
            try {&lt;br /&gt;
                // get the parent element...&lt;br /&gt;
                var $parent = $('#' + View.containerForExtraSubmenuItem());&lt;br /&gt;
                &lt;br /&gt;
                // create a new DOM element...&lt;br /&gt;
                var $c = $('&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;');&lt;br /&gt;
                $c.html('I am '+obj['name']+' ! Give me $' +obj['ammount']+ ' !');&lt;br /&gt;
                &lt;br /&gt;
                // and append it to the parent...&lt;br /&gt;
                $c.appendTo($parent);&lt;br /&gt;
            } catch (e) {&lt;br /&gt;
                Utils.logError('Error in first_submenu(): ' + e);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    };&lt;br /&gt;
})();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Code explained''': it is executed after clicking on the submenu item defined. It creates a DOM element which displays a message. That DOM element is appended to a container where all DOM manipulation from the plugin will reside.&lt;br /&gt;
&lt;br /&gt;
==== After the plugin is installed and a LU Reload is performed, click on ‘Apps’ -&amp;gt; ‘My first submenu’ and the page will look something like this: ====&lt;br /&gt;
&lt;br /&gt;
[[File:submenu.jpg|image|none|caption]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The function supplied was executed and the content is displayed on the right side of the page.&lt;br /&gt;
&lt;br /&gt;
Note the absence of ‘My second submenu’ from the list (because was marked with property ‘Invisible’).&lt;/div&gt;</summary>
		<author><name>Andreimios</name></author>	</entry>

	</feed>