Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Updates
* Class Templates fix
* Minor simple devices interface updates
  • Loading branch information
sergejey committed Mar 9, 2019
1 parent eada32c commit dd41a67
Show file tree
Hide file tree
Showing 21 changed files with 2,331 additions and 2,325 deletions.
2,812 changes: 1,406 additions & 1,406 deletions lib/objects.class.php

Large diffs are not rendered by default.

211 changes: 106 additions & 105 deletions modules/commands/commands_widgets.js.php
@@ -1,105 +1,106 @@
<?php
chdir(dirname(__FILE__) . '/../../');
include_once("./config.php");
include_once("./lib/loader.php");
include_once("./load_settings.php");
?>

(function()
{

freeboard.loadWidgetPlugin({
// Same stuff here as with datasource plugin.
"type_name" : "commands_plugin",
"display_name": LANG_CONTROL_MENU,
"description" : "MajorDoMo "+LANG_CONTROL_MENU,
"fill_size" : true,
"settings" : [
{
"name" : "menu",
"display_name": LANG_CONTROL_MENU,
"required" : true,
"type" : "option",
<?php
$scripts=SQLSelect("SELECT ID,TITLE FROM commands ORDER BY PARENT_ID, PRIORITY DESC, TITLE");
?>
"options" : [
<?php
foreach($scripts as $k=>$v) {
echo '{';
echo '"name" : "'.addcslashes($v['TITLE'],'"').'",'."\n";
echo '"value" : "'.$v['ID'].'"';
echo '},';
}
?>
]
},
{
"name" : "size",
"display_name": LANG_SIZE,
"type" : "option",
"options" : [
{"name" : "1","value": "1"},
{"name" : "2","value": "2"},
{"name" : "3","value": "3"},
{"name" : "4","value": "4"},
{"name" : "5","value": "5"},
{"name" : "6","value": "6"},
{"name" : "7","value": "7"},
{"name" : "8","value": "8"}
]
}

],
// Same as with datasource plugin, but there is no updateCallback parameter in this case.
newInstance : function(settings, newInstanceCallback)
{
newInstanceCallback(new myMenuPlugin(settings));
}
});

var myMenuPlugin = function(settings)
{
var self = this;
var currentSettings = settings;
var widgetElement;
function updateMenuFrame()
{
if(widgetElement)
{
var newHeight=parseInt(currentSettings.size)*80-20;
var myTextElement = $("<iframe style='margin-top:20px;height:"+newHeight+"px' src='<?php echo ROOTHTML;?>menu.html?parent="+currentSettings.menu+"' width='100%' height='"+newHeight+"' frameborder=0></iframe>");
$(widgetElement).append(myTextElement);
}
}

self.render = function(element)
{
widgetElement = element;
updateMenuFrame();
}

self.getHeight = function()
{
return parseInt(currentSettings.size);
}

self.onSettingsChanged = function(newSettings)
{
currentSettings = newSettings;
updateMenuFrame();
}

self.onCalculatedValueChanged = function(settingName, newValue)
{
updateMenuFrame();
}

self.onDispose = function()
{
}

}


}());
<?php
header("Content-type:application/javascript");
chdir(dirname(__FILE__) . '/../../');
include_once("./config.php");
include_once("./lib/loader.php");
include_once("./load_settings.php");
?>

(function()
{

freeboard.loadWidgetPlugin({
// Same stuff here as with datasource plugin.
"type_name" : "commands_plugin",
"display_name": LANG_CONTROL_MENU,
"description" : "MajorDoMo "+LANG_CONTROL_MENU,
"fill_size" : true,
"settings" : [
{
"name" : "menu",
"display_name": LANG_CONTROL_MENU,
"required" : true,
"type" : "option",
<?php
$scripts=SQLSelect("SELECT ID,TITLE FROM commands ORDER BY PARENT_ID, PRIORITY DESC, TITLE");
?>
"options" : [
<?php
foreach($scripts as $k=>$v) {
echo '{';
echo '"name" : "'.addcslashes($v['TITLE'],'"').'",'."\n";
echo '"value" : "'.$v['ID'].'"';
echo '},';
}
?>
]
},
{
"name" : "size",
"display_name": LANG_SIZE,
"type" : "option",
"options" : [
{"name" : "1","value": "1"},
{"name" : "2","value": "2"},
{"name" : "3","value": "3"},
{"name" : "4","value": "4"},
{"name" : "5","value": "5"},
{"name" : "6","value": "6"},
{"name" : "7","value": "7"},
{"name" : "8","value": "8"}
]
}

],
// Same as with datasource plugin, but there is no updateCallback parameter in this case.
newInstance : function(settings, newInstanceCallback)
{
newInstanceCallback(new myMenuPlugin(settings));
}
});

var myMenuPlugin = function(settings)
{
var self = this;
var currentSettings = settings;
var widgetElement;
function updateMenuFrame()
{
if(widgetElement)
{
var newHeight=parseInt(currentSettings.size)*80-20;
var myTextElement = $("<iframe style='margin-top:20px;height:"+newHeight+"px' src='<?php echo ROOTHTML;?>menu.html?parent="+currentSettings.menu+"' width='100%' height='"+newHeight+"' frameborder=0></iframe>");
$(widgetElement).append(myTextElement);
}
}

self.render = function(element)
{
widgetElement = element;
updateMenuFrame();
}

self.getHeight = function()
{
return parseInt(currentSettings.size);
}

self.onSettingsChanged = function(newSettings)
{
currentSettings = newSettings;
updateMenuFrame();
}

self.onCalculatedValueChanged = function(settingName, newValue)
{
updateMenuFrame();
}

self.onDispose = function()
{
}

}


}());

0 comments on commit dd41a67

Please sign in to comment.