|
From: <csc...@us...> - 2012-01-21 16:41:58
|
Revision: 663
http://openautomation.svn.sourceforge.net/openautomation/?rev=663&view=rev
Author: cschleiffer
Date: 2012-01-21 16:41:52 +0000 (Sat, 21 Jan 2012)
Log Message:
-----------
Option to show current status in multitrigger widget
Modified Paths:
--------------
CometVisu/trunk/visu/designs/structure_pure.js
CometVisu/trunk/visu/visu_config.xsd
Modified: CometVisu/trunk/visu/designs/structure_pure.js
===================================================================
--- CometVisu/trunk/visu/designs/structure_pure.js 2012-01-19 19:35:25 UTC (rev 662)
+++ CometVisu/trunk/visu/designs/structure_pure.js 2012-01-21 16:41:52 UTC (rev 663)
@@ -430,6 +430,7 @@
content: false
});
+
this.addCreator('toggle', {
create: function( page, path ) {
var $p = $(page);
@@ -501,6 +502,7 @@
var labelElement = $p.find('label')[0];
var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
var address = {};
+ var showstatus = $p.attr("showstatus") || "false";
$p.find('address').each( function(){
var src = this.textContent;
var transform = this.getAttribute('transform');
@@ -529,6 +531,9 @@
'align' : $p.attr('align'),
'type' : 'switch'
} ).bind( 'click', this.action );
+ if( showstatus == "true" ) {
+ for( var addr in address ) $actor.bind( addr, this.update );
+ }
buttons.append( $actor );
if( 1 == (buttonCount++ % 2) ) buttons.append( $('<br/>') );
}
@@ -548,6 +553,9 @@
'type' : 'switch',
'align' : $p.attr('align')
} ).bind( 'click', this.action );
+ if( showstatus == "true" ) {
+ for( var addr in address ) $actor.bind( addr, this.update );
+ }
buttons.append( $actor );
if( 1 == (buttonCount++ % 2) ) buttons.append( $('<br/>') );
}
@@ -566,6 +574,9 @@
'value' : $p.attr('button3value'),
'type' : 'switch'
} ).bind( 'click', this.action );
+ if( showstatus == "true" ) {
+ for( var addr in address ) $actor.bind( addr, this.update );
+ }
buttons.append( $actor );
if( 1 == buttonCount++ % 2 ) buttons.append( $('<br/>') );
}
@@ -584,6 +595,9 @@
'value' : $p.attr('button4value'),
'type' : 'switch',
} ).bind( 'click', this.action );
+ if( showstatus == "true" ) {
+ for( var addr in address ) $actor.bind( addr, this.update );
+ }
buttons.append( $actor );
if( 1 == buttonCount++ % 2 ) buttons.append( $('<br/>') );
}
@@ -593,9 +607,11 @@
},
update: function(e,d) {
var element = $(this);
- var value = defaultUpdate( e, d, element );
- element.removeClass( value == 0 ? 'switchPressed' : 'switchUnpressed' );
- element.addClass( value == 0 ? 'switchUnpressed' : 'switchPressed' );
+ //var value = defaultUpdate( e, d, element );
+ var thisTransform = element.data().address[ e.type ][0];
+ var value = transformDecode( element.data().address[ e.type ][0], d );
+ element.removeClass( value == element.data().value ? 'switchUnpressed' : 'switchPressed' );
+ element.addClass( value == element.data().value ? 'switchPressed' : 'switchUnpressed' );
},
action: function() {
var data = $(this).data();
@@ -616,7 +632,8 @@
button4value: { type: 'string' , required: false },
mapping: { type: 'mapping' , required: false },
styling: { type: 'styling' , required: false },
- align: { type: 'string' , required: false }
+ align: { type: 'string' , required: false },
+ showstatus: { type: 'list' , required: true, list: {'true': "yes", 'false': "no"} }
},
elements: {
label: { type: 'string', required: false, multi: false },
@@ -861,9 +878,9 @@
} );
var actorinfo = '<div class="actor switchInvisible" ';
- if ( $p.attr( 'align' ) )
+ if ( $p.attr( 'align' ) )
actorinfo += 'style="text-align: '+$p.attr( 'align' )+'" ';
- actorinfo += '" ><div class="value">-</div></div>';
+ actorinfo += '" ><div class="value">-</div></div>';
var $actorinfo = $(actorinfo).data({
'address' : address,
'format' : $p.attr('format'),
Modified: CometVisu/trunk/visu/visu_config.xsd
===================================================================
--- CometVisu/trunk/visu/visu_config.xsd 2012-01-19 19:35:25 UTC (rev 662)
+++ CometVisu/trunk/visu/visu_config.xsd 2012-01-21 16:41:52 UTC (rev 663)
@@ -66,7 +66,6 @@
<xsd:attribute name="variant" type="xsd:string" />
<!-- complex elements -->
-
<xsd:element name="pages">
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
@@ -260,8 +259,8 @@
</xsd:choice>
<xsd:attribute ref="styling" use="optional" />
<xsd:attribute ref="mapping" use="optional" />
- <xsd:attribute name="on_value" type="xsd:string" use="optional" />
- <xsd:attribute name="off_value" type="xsd:string" use="optional" />
+ <xsd:attribute name="on_value" type="xsd:string" use="optional" />
+ <xsd:attribute name="off_value" type="xsd:string" use="optional" />
<xsd:attribute ref="align" use="optional" />
</xsd:complexType>
@@ -311,6 +310,7 @@
</xsd:choice>
<xsd:attribute ref="mapping" use="optional" />
<xsd:attribute ref="styling" use="optional" />
+ <xsd:attribute name="showstatus" type="xsd:string" use="optional" />
<xsd:attribute name="button1label" type="xsd:string" use="optional" />
<xsd:attribute name="button1value" type="xsd:string" use="optional" />
<xsd:attribute name="button2label" type="xsd:string" use="optional" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|