Skip to content

Commit

Permalink
Plans updated
Browse files Browse the repository at this point in the history
* New component: iFrame
* New component: HTML
* New style: Opacity 0%
  • Loading branch information
sergejey committed Apr 11, 2019
1 parent 6837f4b commit 526e529
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 4 deletions.
1 change: 1 addition & 0 deletions languages/default.php
Expand Up @@ -1347,6 +1347,7 @@
'STYLE_FADEOUT50' => 'Opacity 50%', 'STYLE_FADEOUT50' => 'Opacity 50%',
'STYLE_FADEOUT30' => 'Opacity 30%', 'STYLE_FADEOUT30' => 'Opacity 30%',
'STYLE_FADEOUT10' => 'Opacity 10%', 'STYLE_FADEOUT10' => 'Opacity 10%',
'STYLE_FADEOUT0' => 'Opacity 0%',
'SEE_ALSO' => 'See also', 'SEE_ALSO' => 'See also',
'PLAN_COMPONENTS' => 'Components', 'PLAN_COMPONENTS' => 'Components',


Expand Down
1 change: 1 addition & 0 deletions languages/ru.php
Expand Up @@ -1349,6 +1349,7 @@
'STYLE_FADEOUT50' => 'Прозрачность 50%', 'STYLE_FADEOUT50' => 'Прозрачность 50%',
'STYLE_FADEOUT30' => 'Прозрачность 30%', 'STYLE_FADEOUT30' => 'Прозрачность 30%',
'STYLE_FADEOUT10' => 'Прозрачность 10%', 'STYLE_FADEOUT10' => 'Прозрачность 10%',
'STYLE_FADEOUT0' => 'Прозрачность 0%',
'SEE_ALSO' => 'Смотрите также', 'SEE_ALSO' => 'Смотрите также',
'PLAN_COMPONENTS' => 'Компоненты', 'PLAN_COMPONENTS' => 'Компоненты',


Expand Down
2 changes: 1 addition & 1 deletion lib/utils/postprocess_result.inc.php
Expand Up @@ -57,7 +57,7 @@
} }
$seen[$var]=1; $seen[$var]=1;
$id = 'var_' . preg_replace('/\W/', '_', $var); $id = 'var_' . preg_replace('/\W/', '_', $var);
$sub_js.="if (obj[i]['PROPERTY']=='$var') {\$('.$id').html(obj[i]['VALUE']);$.publish('$var.updated', obj[i]['VALUE']);}\n"; $sub_js.="if (obj[i]['PROPERTY'].toLowerCase()=='$var') {\$('.$id').html(obj[i]['VALUE']);$.publish('$var.updated', obj[i]['VALUE']);}\n";
$result = str_replace($m[0][$i], '<span class="'.$id.'">'.getGlobal($var).'</span>', $result); $result = str_replace($m[0][$i], '<span class="'.$id.'">'.getGlobal($var).'</span>', $result);
} }
$js="<script language='javascript'>\$.subscribe('wsConnected', function (_) { $js="<script language='javascript'>\$.subscribe('wsConnected', function (_) {
Expand Down
2 changes: 1 addition & 1 deletion modules/plans/components/gauge.class.php
Expand Up @@ -174,7 +174,7 @@ function getJavascript($attributes)
function componentUpdated{$this->component_id}(property_name,property_value) { function componentUpdated{$this->component_id}(property_name,property_value) {
if (property_name=='$prop_name') { if (property_name.toLowerCase()=='$prop_name') {
gauge{$this->component_id}.redraw(property_value); gauge{$this->component_id}.redraw(property_value);
} }
} }
Expand Down
83 changes: 83 additions & 0 deletions modules/plans/components/html.class.php
@@ -0,0 +1,83 @@
<?php

include_once DIR_MODULES . 'plans/plan_component.class.php';

class html extends plan_component
{

function __construct($id)
{
$this->name = str_replace('.class.php', '', basename(__FILE__));
parent::__construct($id);
}

function getProperties()
{
$properties = parent::getProperties();
$properties[] = array(
'NAME' => 'content',
'TITLE' => 'Content',
'TYPE' => 'text',
'DEFAULT' => ''
);

$properties[] = array(
'NAME' => 'scale',
'TITLE' => LANG_APPEAR_SCALE.' (%)',
'TYPE' => 'int',
'DEFAULT' => '100'
);

$properties[] = array(
'NAME' => 'bgcolor',
'TITLE' => LANG_COLOR.' (background)',
'TYPE' => 'rgb',
'DEFAULT' => 'white'
);

$this->processProperties($properties);
return $properties;
}

function getSVG($attributes)
{

$x = (int)$attributes['x'];
$y = (int)$attributes['y'];

$data = $this->getData();

$bgcolor = $data['bgcolor']['VALUE'];

//$content = processTitle($data['content']['VALUE']);
$content = ($data['content']['VALUE']);
$scaleProc=(int)$data['scale']['VALUE'];
if (!$scaleProc) {
$scaleProc=100;
}
$scale = round($scaleProc/100,2);
$scaleProc=(1/$scale)*100;

$width = (int)$attributes['width'];
if (!$width) $width = 200;
$height = (int)$attributes['height'];
if (!$height) $height = 200;

$svg = "<svg width='$width' height='$height' x='$x' y='$y'>";
$svg .= "<g transform=\"scale($scale)\">";
$svg .= "<foreignObject x=\"0\" y=\"0\" width=\"$scaleProc%\" height=\"$scaleProc%\">";
$svg .= "<div style=\"width: 100%; height: 100%;background-color:$bgcolor;\">";
$svg .= $content;
$svg .= "</div>";
$svg .= "</foreignObject>";
$svg .= "</g>";
$svg .= "</svg>";
return $svg;
}

function getJavascript($attributes)
{
$code = '';
return $code;
}
}
81 changes: 81 additions & 0 deletions modules/plans/components/iframe.class.php
@@ -0,0 +1,81 @@
<?php

include_once DIR_MODULES . 'plans/plan_component.class.php';

class iframe extends plan_component
{

function __construct($id)
{
$this->name = str_replace('.class.php', '', basename(__FILE__));
parent::__construct($id);
}

function getProperties()
{
$properties = parent::getProperties();
$properties[] = array(
'NAME' => 'url',
'TITLE' => 'URL',
'TYPE' => 'text',
'DEFAULT' => '/menu.html'
);

$properties[] = array(
'NAME' => 'scale',
'TITLE' => LANG_APPEAR_SCALE.' (%)',
'TYPE' => 'int',
'DEFAULT' => '100'
);

$properties[] = array(
'NAME' => 'bgcolor',
'TITLE' => LANG_COLOR.' (background)',
'TYPE' => 'rgb',
'DEFAULT' => 'white'
);

$this->processProperties($properties);
return $properties;
}

function getSVG($attributes)
{

$x = (int)$attributes['x'];
$y = (int)$attributes['y'];

$data = $this->getData();

$bgcolor = $data['bgcolor']['VALUE'];

$url = $data['url']['VALUE'];
$scaleProc=(int)$data['scale']['VALUE'];
if (!$scaleProc) {
$scaleProc=100;
}
$scale = round($scaleProc/100,2);
$scaleProc=(1/$scale)*100;

$width = (int)$attributes['width'];
if (!$width) $width = 200;
$height = (int)$attributes['height'];
if (!$height) $height = 200;

$svg = "<svg width='$width' height='$height' x='$x' y='$y'>";
$svg .= "<g transform=\"scale($scale)\">";
$svg .= "<foreignObject x=\"0\" y=\"0\" width=\"$scaleProc%\" height=\"$scaleProc%\">";
$svg .= "<iframe src=\"$url\" style=\"width: 100%; height: 100%;background-color:$bgcolor;\" frameborder='0'>";
$svg .= "</iframe>";
$svg .= "</foreignObject>";
$svg .= "</g>";
$svg .= "</svg>";
return $svg;
}

function getJavascript($attributes)
{
$code = '';
return $code;
}
}
2 changes: 1 addition & 1 deletion modules/plans/components/switch_sample.class.php
Expand Up @@ -89,7 +89,7 @@ function getJavascript($attributes)
$prop_name=strtolower($data['value']['LINKED_OBJECT'].'.'.$data['value']['LINKED_PROPERTY']); $prop_name=strtolower($data['value']['LINKED_OBJECT'].'.'.$data['value']['LINKED_PROPERTY']);
$code = <<<EOD $code = <<<EOD
function componentUpdated{$this->component_id}(property_name,property_value) { function componentUpdated{$this->component_id}(property_name,property_value) {
if (property_name=='$prop_name') { if (property_name.toLowerCase()=='$prop_name') {
var elem=$('#procElem{$this->component_id}'); var elem=$('#procElem{$this->component_id}');
if (property_value=='1') { if (property_value=='1') {
elem.attr('widthNum','5'); elem.attr('widthNum','5');
Expand Down
1 change: 1 addition & 0 deletions modules/plans/plans.class.php
Expand Up @@ -524,6 +524,7 @@ function getCSSClasses($plan_id) {
$classes[]=array('CLASS'=>'fadeout50','TITLE'=>LANG_STYLE_FADEOUT50); $classes[]=array('CLASS'=>'fadeout50','TITLE'=>LANG_STYLE_FADEOUT50);
$classes[]=array('CLASS'=>'fadeout30','TITLE'=>LANG_STYLE_FADEOUT30); $classes[]=array('CLASS'=>'fadeout30','TITLE'=>LANG_STYLE_FADEOUT30);
$classes[]=array('CLASS'=>'fadeout10','TITLE'=>LANG_STYLE_FADEOUT10); $classes[]=array('CLASS'=>'fadeout10','TITLE'=>LANG_STYLE_FADEOUT10);
$classes[]=array('CLASS'=>'fadeout0','TITLE'=>LANG_STYLE_FADEOUT0);


if ($plan_rec['CUSTOM_CSS']!='') { if ($plan_rec['CUSTOM_CSS']!='') {
if (preg_match_all('/\.([^\s{\n\.]+)\s+{/is',$plan_rec['CUSTOM_CSS'],$m)) { if (preg_match_all('/\.([^\s{\n\.]+)\s+{/is',$plan_rec['CUSTOM_CSS'],$m)) {
Expand Down
2 changes: 1 addition & 1 deletion templates/app_player/action_usual.html
Expand Up @@ -99,7 +99,7 @@
var objCnt = obj.length; var objCnt = obj.length;
if(objCnt) { if(objCnt) {
for(var i=0;i<objCnt;i++) { for(var i=0;i<objCnt;i++) {
switch(obj[i]['PROPERTY']) { switch(obj[i]['PROPERTY'].toLowerCase()) {
case 'thiscomputer.volumelevel': case 'thiscomputer.volumelevel':
[#APP_PLAYER_ID#]_volumeLevel = parseInt(obj[i]['VALUE']); [#APP_PLAYER_ID#]_volumeLevel = parseInt(obj[i]['VALUE']);
break; break;
Expand Down
13 changes: 13 additions & 0 deletions templates/plans/basic.css
Expand Up @@ -8,6 +8,11 @@
to { opacity:0; } to { opacity:0; }
} }


@keyframes fadeOut0 {
from { opacity:1; }
to { opacity:0; }
}

@keyframes fadeOut10 { @keyframes fadeOut10 {
from { opacity:1; } from { opacity:1; }
to { opacity:0.1; } to { opacity:0.1; }
Expand Down Expand Up @@ -58,6 +63,14 @@
animation-duration:0.6s; animation-duration:0.6s;
} }


.svg_content .fadeout0 {
display:block;
opacity:1;
animation:fadeOut0 ease-in 1;
animation-fill-mode:forwards;
animation-duration:0.6s;
}

.svg_content .fadeout10 { .svg_content .fadeout10 {
display:block; display:block;
opacity:1; opacity:1;
Expand Down

0 comments on commit 526e529

Please sign in to comment.