You can subscribe to this list here.
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(121) |
Dec
(58) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2011 |
Jan
(38) |
Feb
(36) |
Mar
(7) |
Apr
(2) |
May
(32) |
Jun
(24) |
Jul
(16) |
Aug
(21) |
Sep
(17) |
Oct
(62) |
Nov
(60) |
Dec
(70) |
| 2012 |
Jan
(54) |
Feb
(41) |
Mar
(21) |
Apr
(38) |
May
(76) |
Jun
(47) |
Jul
(25) |
Aug
(72) |
Sep
(29) |
Oct
(64) |
Nov
(93) |
Dec
(97) |
| 2013 |
Jan
(100) |
Feb
(168) |
Mar
(115) |
Apr
(59) |
May
(37) |
Jun
(32) |
Jul
(45) |
Aug
(42) |
Sep
(24) |
Oct
(73) |
Nov
(64) |
Dec
(4) |
| 2014 |
Jan
(14) |
Feb
(57) |
Mar
(58) |
Apr
(10) |
May
(18) |
Jun
(12) |
Jul
(7) |
Aug
(12) |
Sep
(15) |
Oct
(6) |
Nov
(32) |
Dec
(17) |
| 2015 |
Jan
(50) |
Feb
(5) |
Mar
(1) |
Apr
(26) |
May
(10) |
Jun
(3) |
Jul
(3) |
Aug
(2) |
Sep
(3) |
Oct
(18) |
Nov
(18) |
Dec
(8) |
| 2016 |
Jan
(33) |
Feb
(35) |
Mar
(50) |
Apr
(20) |
May
(25) |
Jun
(17) |
Jul
(8) |
Aug
(73) |
Sep
(64) |
Oct
(51) |
Nov
(20) |
Dec
(14) |
| 2017 |
Jan
(41) |
Feb
(57) |
Mar
(44) |
Apr
(136) |
May
(32) |
Jun
(39) |
Jul
(2) |
Aug
(12) |
Sep
(32) |
Oct
(103) |
Nov
(12) |
Dec
(4) |
| 2018 |
Jan
(9) |
Feb
(1) |
Mar
(60) |
Apr
(24) |
May
(15) |
Jun
(1) |
Jul
(2) |
Aug
(23) |
Sep
(15) |
Oct
(57) |
Nov
(21) |
Dec
(77) |
| 2019 |
Jan
(62) |
Feb
(99) |
Mar
(98) |
Apr
(49) |
May
(6) |
Jun
(3) |
Jul
(6) |
Aug
(18) |
Sep
(9) |
Oct
(15) |
Nov
(30) |
Dec
(6) |
| 2020 |
Jan
(14) |
Feb
(2) |
Mar
(22) |
Apr
(33) |
May
(47) |
Jun
(12) |
Jul
|
Aug
|
Sep
(4) |
Oct
(2) |
Nov
(5) |
Dec
(5) |
| 2021 |
Jan
(4) |
Feb
(101) |
Mar
(13) |
Apr
(32) |
May
(40) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
(25) |
Nov
(12) |
Dec
|
| 2022 |
Jan
(154) |
Feb
(82) |
Mar
(63) |
Apr
(27) |
May
(26) |
Jun
(5) |
Jul
(12) |
Aug
(23) |
Sep
(17) |
Oct
(37) |
Nov
(13) |
Dec
(21) |
| 2023 |
Jan
(43) |
Feb
(43) |
Mar
(15) |
Apr
(8) |
May
(3) |
Jun
(25) |
Jul
(6) |
Aug
(38) |
Sep
(5) |
Oct
(20) |
Nov
(9) |
Dec
(28) |
| 2024 |
Jan
(15) |
Feb
(2) |
Mar
(12) |
Apr
(2) |
May
(8) |
Jun
(10) |
Jul
(10) |
Aug
(2) |
Sep
(3) |
Oct
(15) |
Nov
(6) |
Dec
(20) |
| 2025 |
Jan
|
Feb
(2) |
Mar
(6) |
Apr
(2) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(11) |
Nov
(2) |
Dec
|
|
From: <ma...@us...> - 2012-02-13 22:13:50
|
Revision: 705
http://openautomation.svn.sourceforge.net/openautomation/?rev=705&view=rev
Author: makki1
Date: 2012-02-13 22:13:43 +0000 (Mon, 13 Feb 2012)
Log Message:
-----------
change text-align in pure-design (switch/un/unpressed) to center; add/change designglobals(was textglobals.css) to include basic colors for stylings; add examples with such stylings; add custom.css to each design to allow override specific settings locally
Modified Paths:
--------------
CometVisu/trunk/visu/designs/design_preview.html
CometVisu/trunk/visu/designs/pure/basic.css
CometVisu/trunk/visu/lib/templateengine.js
CometVisu/trunk/visu/visu_config_demo.xml
Added Paths:
-----------
CometVisu/trunk/visu/designs/alaska/custom.css
CometVisu/trunk/visu/designs/alaska_slim/custom.css
CometVisu/trunk/visu/designs/designglobals.css
CometVisu/trunk/visu/designs/discreet/custom.css
CometVisu/trunk/visu/designs/discreet_sand/custom.css
CometVisu/trunk/visu/designs/discreet_slim/custom.css
CometVisu/trunk/visu/designs/pitchblack/custom.css
CometVisu/trunk/visu/designs/pure/custom.css
Removed Paths:
-------------
CometVisu/trunk/visu/designs/textglobal.css
Added: CometVisu/trunk/visu/designs/alaska/custom.css
===================================================================
--- CometVisu/trunk/visu/designs/alaska/custom.css (rev 0)
+++ CometVisu/trunk/visu/designs/alaska/custom.css 2012-02-13 22:13:43 UTC (rev 705)
@@ -0,0 +1,3 @@
+/*
+ * custom local css to overload declarations in each design (basic.css)
+ */
Added: CometVisu/trunk/visu/designs/alaska_slim/custom.css
===================================================================
--- CometVisu/trunk/visu/designs/alaska_slim/custom.css (rev 0)
+++ CometVisu/trunk/visu/designs/alaska_slim/custom.css 2012-02-13 22:13:43 UTC (rev 705)
@@ -0,0 +1,3 @@
+/*
+ * custom local css to overload declarations in each design (basic.css)
+ */
Modified: CometVisu/trunk/visu/designs/design_preview.html
===================================================================
--- CometVisu/trunk/visu/designs/design_preview.html 2012-02-13 12:31:17 UTC (rev 704)
+++ CometVisu/trunk/visu/designs/design_preview.html 2012-02-13 22:13:43 UTC (rev 705)
@@ -20,8 +20,10 @@
<script type="text/javascript">
var design = $.getUrlVar("design");
+ $( 'head' ).append( '<link rel="stylesheet" type="text/css" href="designs/designglobals.css" />' );
$( 'head' ).append( '<link rel="stylesheet" type="text/css" href="' + design + '/basic.css" />' );
$( 'head' ).append( '<link rel="stylesheet" type="text/css" href="' + design + '/mobile.css" media="only screen and (max-device-width: 480px)" />' );
+ $( 'head' ).append( '<link rel="stylesheet" type="text/css" href="' + design + '/custom.css" />' );
</script>
</body>
</html>
Copied: CometVisu/trunk/visu/designs/designglobals.css (from rev 704, CometVisu/trunk/visu/designs/textglobal.css)
===================================================================
--- CometVisu/trunk/visu/designs/designglobals.css (rev 0)
+++ CometVisu/trunk/visu/designs/designglobals.css 2012-02-13 22:13:43 UTC (rev 705)
@@ -0,0 +1,135 @@
+/*
+ * global CSS declarations for all designs
+ */
+
+/*
+ * colspans, each design needs to define a colspan0
+ * class, this class is the default widget size
+ */
+
+.colspan1 {
+ width: 8.33333%;
+}
+
+.colspan2 {
+ width: 16.66666%;
+}
+
+.colspan3 {
+ width: 24.99999%;
+}
+
+.colspan4 {
+ width: 33.33332%;
+}
+
+.colspan5 {
+ width: 41.66665%;
+}
+
+.colspan6 {
+ width: 49.99998%;
+}
+
+.colspan7 {
+ width: 58.33331%;
+}
+
+.colspan8 {
+ width: 66.66664%;
+}
+
+.colspan9 {
+ width: 74.99997%;
+}
+
+.colspan10 {
+ width: 83.33330%;
+}
+
+.colspan11 {
+ width: 91.66663%;
+}
+
+.colspan12 {
+ width: 99.99996%;
+}
+
+/*
+ * global color declarations for stylings in all designs
+ * may be overloaded by designs
+ */
+
+.red
+{
+ color:#FF0000;
+}
+.white
+{
+ color:#FFFFFF;
+}
+.cyan
+{
+ color:#00FFFF;
+}
+.silver
+{
+ color:#C0C0C0;
+}
+.blue
+{
+ color:#0000FF;
+}
+.grey
+{
+ color:#808080;
+}
+.darkblue
+{
+ color:#0000A0;
+}
+.black
+{
+ color:#000000;
+}
+.lightblue
+{
+ color:#ADD8E6;
+}
+.orange
+{
+ color:#FFA500;
+}
+.purple
+{
+ color:#800080;
+}
+.brown
+{
+ color:#A52A2A;
+}
+.yellow
+{
+ color:#FFFF00;
+}
+.maroon
+{
+ color:#800000;
+}
+.lime
+{
+ color:#00FF00;
+}
+.green
+{
+ color:#008000;
+}
+.fuchsia
+{
+ color:#FF00FF;
+}
+.olive
+{
+ color:#808000;
+}
+
Added: CometVisu/trunk/visu/designs/discreet/custom.css
===================================================================
--- CometVisu/trunk/visu/designs/discreet/custom.css (rev 0)
+++ CometVisu/trunk/visu/designs/discreet/custom.css 2012-02-13 22:13:43 UTC (rev 705)
@@ -0,0 +1,3 @@
+/*
+ * custom local css to overload declarations in each design (basic.css)
+ */
Added: CometVisu/trunk/visu/designs/discreet_sand/custom.css
===================================================================
--- CometVisu/trunk/visu/designs/discreet_sand/custom.css (rev 0)
+++ CometVisu/trunk/visu/designs/discreet_sand/custom.css 2012-02-13 22:13:43 UTC (rev 705)
@@ -0,0 +1,3 @@
+/*
+ * custom local css to overload declarations in each design (basic.css)
+ */
Added: CometVisu/trunk/visu/designs/discreet_slim/custom.css
===================================================================
--- CometVisu/trunk/visu/designs/discreet_slim/custom.css (rev 0)
+++ CometVisu/trunk/visu/designs/discreet_slim/custom.css 2012-02-13 22:13:43 UTC (rev 705)
@@ -0,0 +1,3 @@
+/*
+ * custom local css to overload declarations in each design (basic.css)
+ */
Added: CometVisu/trunk/visu/designs/pitchblack/custom.css
===================================================================
--- CometVisu/trunk/visu/designs/pitchblack/custom.css (rev 0)
+++ CometVisu/trunk/visu/designs/pitchblack/custom.css 2012-02-13 22:13:43 UTC (rev 705)
@@ -0,0 +1,3 @@
+/*
+ * custom local css to overload declarations in each design (basic.css)
+ */
Modified: CometVisu/trunk/visu/designs/pure/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/pure/basic.css 2012-02-13 12:31:17 UTC (rev 704)
+++ CometVisu/trunk/visu/designs/pure/basic.css 2012-02-13 22:13:43 UTC (rev 705)
@@ -189,6 +189,7 @@
padding: 3px;
width: 5em;
float: left;
+ text-align: center;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
@@ -212,6 +213,7 @@
padding: 3px;
width: 5em;
float: left;
+ text-align: center;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
Added: CometVisu/trunk/visu/designs/pure/custom.css
===================================================================
--- CometVisu/trunk/visu/designs/pure/custom.css (rev 0)
+++ CometVisu/trunk/visu/designs/pure/custom.css 2012-02-13 22:13:43 UTC (rev 705)
@@ -0,0 +1,5 @@
+/*
+ * custom local css to overload declarations in each design (basic.css)
+ */
+
+
Deleted: CometVisu/trunk/visu/designs/textglobal.css
===================================================================
--- CometVisu/trunk/visu/designs/textglobal.css 2012-02-13 12:31:17 UTC (rev 704)
+++ CometVisu/trunk/visu/designs/textglobal.css 2012-02-13 22:13:43 UTC (rev 705)
@@ -1,60 +0,0 @@
-/*
- * global CSS declarations for all designs
- */
-
-/*
- * colspans, each design needs to define a colspan0
- * class, this class is the default widget size
- */
-
-.colspan1 {
- width: 8.33333%;
-}
-
-.colspan2 {
- width: 16.66666%;
-}
-
-.colspan3 {
- width: 24.99999%;
-}
-
-.colspan4 {
- width: 33.33332%;
-}
-
-.colspan5 {
- width: 41.66665%;
-}
-
-.colspan6 {
- width: 49.99998%;
-}
-
-.colspan7 {
- width: 58.33331%;
-}
-
-.colspan8 {
- width: 66.66664%;
-}
-
-.colspan9 {
- width: 74.99997%;
-}
-
-.colspan10 {
- width: 83.33330%;
-}
-
-.colspan11 {
- width: 91.66663%;
-}
-
-.colspan12 {
- width: 99.99996%;
-}
-
-
-
-
Modified: CometVisu/trunk/visu/lib/templateengine.js
===================================================================
--- CometVisu/trunk/visu/lib/templateengine.js 2012-02-13 12:31:17 UTC (rev 704)
+++ CometVisu/trunk/visu/lib/templateengine.js 2012-02-13 22:13:43 UTC (rev 705)
@@ -208,9 +208,10 @@
selectDesign();
}
- $( 'head' ).append( '<link rel="stylesheet" type="text/css" href="designs/textglobal.css" />' );
+ $( 'head' ).append( '<link rel="stylesheet" type="text/css" href="designs/designglobals.css" />' );
$( 'head' ).append( '<link rel="stylesheet" type="text/css" href="designs/' + clientDesign + '/basic.css" />' );
$( 'head' ).append( '<link rel="stylesheet" type="text/css" href="designs/' + clientDesign + '/mobile.css" media="only screen and (max-device-width: 480px)" />' );
+ $( 'head' ).append( '<link rel="stylesheet" type="text/css" href="designs/' + clientDesign + '/custom.css" />' );
// start with the plugins
var pluginsToLoad = 0;
Modified: CometVisu/trunk/visu/visu_config_demo.xml
===================================================================
--- CometVisu/trunk/visu/visu_config_demo.xml 2012-02-13 12:31:17 UTC (rev 704)
+++ CometVisu/trunk/visu/visu_config_demo.xml 2012-02-13 22:13:43 UTC (rev 705)
@@ -57,11 +57,34 @@
<entry value="0">green</entry>
<entry value="1">red</entry>
</styling>
+ <styling name="Grey_Green">
+ <entry value="0">grey</entry>
+ <entry value="1">green</entry>
+ </styling>
+ <styling name="Grey_Red">
+ <entry value="0">grey</entry>
+ <entry value="1">red</entry>
+ </styling>
+ <styling name="Grey_Blue">
+ <entry value="0">grey</entry>
+ <entry value="1">blue</entry>
+ </styling>
+ <styling name="Brown_Purple">
+ <entry value="0">brown</entry>
+ <entry value="1">purple</entry>
+ </styling>
<styling name="Blue_Purple_Red">
<entry range_min="-100" range_max="0">blue</entry>
<entry value="0">purple</entry>
<entry range_min="0" range_max="100">red</entry>
</styling>
+ <styling name="Blue_Lightblue_Green_Purple_Red">
+ <entry range_min="-10" range_max="-1">blue</entry>
+ <entry range_min="-1" range_max="10">lightblue</entry>
+ <entry range_min="10" range_max="18">green</entry>
+ <entry range_min="18" range_max="24">purple</entry>
+ <entry range_min="24" range_max="32">red</entry>
+ </styling>
</stylings>
<statusbar>
<status type="html"><![CDATA[
@@ -326,6 +349,37 @@
<address transform="DPT:9">12/7/9</address>
</info>
</page>
+ <page name="Stylings Test" align="center">
+ <switch mapping="On_Off" styling="Green_Red">
+ <label>Switch green/red</label>
+ <address transform="DPT:1.001" readonly="false" type="">12/7/1</address>
+ </switch>
+ <switch mapping="On_Off" styling="Grey_Green">
+ <label>Switch grey/green</label>
+ <address transform="DPT:1.001" readonly="false" type="">12/7/1</address>
+ </switch>
+ <switch mapping="On_Off" styling="Grey_Red">
+ <label>Switch grey/red</label>
+ <address transform="DPT:1.001" readonly="false" type="">12/7/1</address>
+ </switch>
+ <switch mapping="On_Off" styling="Grey_Blue">
+ <label>Switch grey/blue</label>
+ <address transform="DPT:1.001" readonly="false" type="">12/7/1</address>
+ </switch>
+ <switch mapping="On_Off" styling="Brown_Purple">
+ <label>Switch brown/purple</label>
+ <address transform="DPT:1.001" readonly="false" type="">12/7/1</address>
+ </switch>
+ <line/>
+ <info styling="Blue_Lightblue_Green_Purple_Red" format="%.1f °C">
+ <label>Info: with Styling/Ranges</label>
+ <address transform="DPT:9" type="">12/7/10</address>
+ </info>
+ <slide min="-10" max="32">
+ <label>Slider to show ranges in styling</label>
+ <address transform="DPT:9" type="">12/7/10</address>
+ </slide>
+ </page>
<line/>
<text align="center"><b>Plugins</b></text>
<text>Diese Widgets sind Plugins und stehen dann zur Verfügung, wenn sie in
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2012-02-13 12:31:23
|
Revision: 704
http://openautomation.svn.sourceforge.net/openautomation/?rev=704&view=rev
Author: j-n-k
Date: 2012-02-13 12:31:17 +0000 (Mon, 13 Feb 2012)
Log Message:
-----------
changed path to db
Modified Paths:
--------------
tools/rsslog/rsslog_correct.pl
Modified: tools/rsslog/rsslog_correct.pl
===================================================================
--- tools/rsslog/rsslog_correct.pl 2012-02-13 11:37:23 UTC (rev 703)
+++ tools/rsslog/rsslog_correct.pl 2012-02-13 12:31:17 UTC (rev 704)
@@ -10,7 +10,7 @@
# change path to database !
# config
-my $logdb = '/var/www/rsslog.db';
+my $logdb = '/etc/wiregate/rss/rsslog.db';
# ab hier nichts aendern
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2012-02-13 11:37:32
|
Revision: 703
http://openautomation.svn.sourceforge.net/openautomation/?rev=703&view=rev
Author: j-n-k
Date: 2012-02-13 11:37:23 +0000 (Mon, 13 Feb 2012)
Log Message:
-----------
Additional files for rsslog-Plugin to CometVisu. Needed since Rev 702!
Revision Links:
--------------
http://openautomation.svn.sourceforge.net/openautomation/?rev=702&view=rev
Modified Paths:
--------------
tools/rsslog/rsslog.php
Added Paths:
-----------
tools/rsslog/rsslog_correct.pl
Modified: tools/rsslog/rsslog.php
===================================================================
--- tools/rsslog/rsslog.php 2012-02-13 07:13:14 UTC (rev 702)
+++ tools/rsslog/rsslog.php 2012-02-13 11:37:23 UTC (rev 703)
@@ -1,214 +1,248 @@
-<?php
-/*****************************************************************************/
-/* rsslog.php - A simple log message reciever and sender via RSS */
-/* */
-/* (c) 2011 by Christian Mayer */
-/* Licenced under the GPLv3 */
-/*****************************************************************************/
-
-// There are diffentent modes of operation
-// 1. Creating a new log line:
-// URL parameter "c": the content of the log
-// URL parameter "t[]": a tag for later filtering. Multiple might be given
-// URL parameter "h": a header(title) for the entry; maybe empty
-// 2. Recieve the log as RSS:
-// URL parameter "f": The (optional) filter, only log lines with a tag
-// that fit this string are sent
-// 3. Dump all the content in a HTML page:
-// URL parameter "dump" - no value needed
-// 4. Remove old content:
-// URL parameter "r": the timestamp (seconds since 1970) of the oldest log
-// line to keep
-// 5. Get content as JSON:
-// URL parameter "j"
-
-// look where to store DB
-if (is_dir('/etc/wiregate/rss'))
- $dbfile = '/etc/wiregate/rss/rsslog.db';
-else
- $dbfile = 'rsslog.db';
-
-//check if the DIRECTORY is writeable by the webserver
-$dbfile_dir = dirname($dbfile);
-if (! is_writable($dbfile_dir))
- die ("Database $dbfile not writeable! make sure the file AND " .
- "the directory are writeable by the webserver!");
-
-// create database connection
-$db = sqlite_open($dbfile, 0666, $error);
-if (!$db) die ($error);
-
-// create table if it doesn't exists
-create( $db );
-
-if( isset($_GET['c']) )
-{
- // store a new log
- $store = true;
- $log_content = $_GET['c'] ? $_GET['c'] : '<no content>';
- $log_title = $_GET['h'] ? $_GET['h'] : '';
- if( mb_detect_encoding($log_content, 'UTF-8', true) != 'UTF-8' )
- $log_content = utf8_encode($log_content);
- if( mb_detect_encoding($log_title, 'UTF-8', true) != 'UTF-8' )
- $log_title = utf8_encode($log_title);
- $log_tags = $_GET['t'] ? $_GET['t'] : array();
- if(! is_array($log_tags))
- die("wrong format - use one or more t[]= for tags");
- insert( $db, $log_content, $log_title, $log_tags );
-} else if( isset($_GET['dump']) )
-{
- $result = retrieve( $db, $log_filter );
- ?>
-<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /></head><body>
-<table border="1">
- <?php
- while( sqlite_has_more($result) )
- {
- $row = sqlite_fetch_array($result, SQLITE_ASSOC );
- echo '<tr>';
- echo '<td>' . date( DATE_ATOM, $row['t'] ) . '</td>';
- echo '<td>' . $row['t'] . '</td>';
- echo '<td>' . $row['title'] . '</td>';
- echo '<td>' . $row['content'] . '</td>';
- echo '<td>' . $row['tags'] . '</td>';
- echo "</tr>\n";
- }
- ?>
-</table>
-</body></html>
- <?php
-} else if( isset($_GET['r']) )
-{
- $timestamp = $_GET['r'] ? $_GET['r'] : '';
- delete( $db, $timestamp );
-} else if( isset($_GET['j']) )
-{
- ?>
-{
- "responseData" : {
- "feed" : {
- "feedUrl": "<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; ?>",
- "title": "RSS supplied logs",
- "link": "<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; ?>",
- "author": "",
- "description": "RSS supplied logs",
- "type": "rss20",
- "entries": [
-<?php
- $result = retrieve( $db, $log_filter );
- $first = true;
- while( sqlite_has_more($result) )
- {
- $row = sqlite_fetch_array($result, SQLITE_ASSOC );
- if( !$first ) echo ",\n";
- echo '{';
- echo '"title": "' . $row['title'] . '",';
- echo '"content": "' . $row['content'] . '",';
- echo '"publishedDate": "' . date( DATE_ATOM, $row['t'] ) . '"';
- echo '}';
- $first = false;
- }
-?>
- ]
- }
- },
- "responseDetails" : null,
- "responseStatus" : 200
-}
- <?php
-} else {
- // send logs
- $log_filter = $_GET['f'] ? $_GET['f'] : '';
-
- // retrieve data
- $result = retrieve( $db, $log_filter );
- echo '<?xml version="1.0"?>';
- ?>
-<rss version="2.0">
- <channel>
- <title>RSS supplied logs</title>
- <link><?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; ?></link>
- <description>RSS supplied logs</description>
- <?php
- // echo '<description>foo</description>';
- while( sqlite_has_more($result) )
- {
- $row = sqlite_fetch_array($result, SQLITE_ASSOC );
- if ($row['tags'])
- $tags = ' [' . $row['tags'] . ']';
- echo '<item>';
- echo '<title>' . $row['title'] . $tags . '</title>';
- echo '<description>' . $row['content'] . '</description>';
- echo '<pubDate>' . date( DATE_ATOM, $row['t'] ) . '</pubDate>';
- echo '</item>' . "\n";
- }
- ?>
- </channel>
-</rss>
- <?php
-}
-
-sqlite_close($db);
-
-///////////////////////////////////////////////////////////////////////////////
-// create tables if they don't exist
-function create( $db )
-{
- $q = "SELECT name FROM sqlite_master WHERE type='table' AND name='Logs';";
- $result = sqlite_query( $db, $q, SQLITE_NUM );
- if (!$result) die("Cannot execute query. $q");
- if( !sqlite_has_more($result) )
- {
- // no table found - create it
- $q = 'CREATE TABLE Logs(' .
- ' id INTEGER PRIMARY KEY,' .
- ' title TEXT,' .
- ' content TEXT NOT NULL,' .
- ' tags TEXT,' .
- ' t TIMESTAMP' .
- ');';
- $ok = sqlite_exec($db, $q, $error);
-
- if (!$ok)
- die("Cannot execute query $q. $error");
- }
-}
-
-// insert a new log line
-function insert( $db, $content, $title, $tags )
-{
- // store a new log line
- $q = 'INSERT INTO Logs(content, title, tags, t) VALUES( ' .
- " '" . sqlite_escape_string( $content ) . "'," .
- " '" . sqlite_escape_string( $title ) . "'," .
- " '" . sqlite_escape_string( implode(",",$tags) ) . "'," .
- " datetime('now')" .
- ')';
-
- $ok = sqlite_exec($db, $q, $error);
-
- if (!$ok)
- die("Cannot execute query. $error (Content: $content Tags: $tags");
-}
-
-// return a handle to all the data
-function retrieve( $db, $filter )
-{
-// $q = "SELECT content, strftime('%s', t, 'localtime') AS t FROM Logs";
- $q = "SELECT title, content, tags, strftime('%s', t) AS t FROM Logs " .
- "WHERE tags LIKE '%" . sqlite_escape_string($filter) . "%' " .
- "ORDER by t DESC";
- return sqlite_query( $db, $q, SQLITE_ASSOC );
-}
-
-// delete all log lines older than the timestamp
-function delete( $db, $timestamp )
-{
- //$q = "DELETE from Logs WHERE t < datetime($timestamp, 'unixepoch', 'localtime')";
- $q = "DELETE from Logs WHERE t < datetime($timestamp, 'unixepoch')";
- $ok = sqlite_exec($db, $q, $error);
-
- if (!$ok)
- die("Cannot execute query. $error");
-}
-?>
+<?php
+/*****************************************************************************/
+/* rsslog.php - A simple log message reciever and sender via RSS */
+/* */
+/* (c) 2011 by Christian Mayer */
+/* Licenced under the GPLv3 */
+/*****************************************************************************/
+
+// There are diffentent modes of operation
+// 1. Creating a new log line:
+// URL parameter "c": the content of the log
+// URL parameter "t[]": a tag for later filtering. Multiple might be given
+// URL parameter "h": a header(title) for the entry; maybe empty
+// 2. Receive the log as RSS:
+// URL parameter "f": The (optional) filter, only log lines with a tag
+// that fit this string are sent
+// URL parameter "state": get only rows with state=value
+// 3. Dump all the content in a HTML page:
+// URL parameter "dump" - no value needed
+// 4. Remove old content:
+// URL parameter "r": the timestamp (seconds since 1970) of the oldest log
+// line to keep
+// 5. Get content as JSON:
+// URL parameter "j"
+// 6. Update state:
+// URL parameter "u" id of row
+// URL parameter "state": new state
+
+
+// look where to store DB
+if (is_dir('/etc/wiregate/rss'))
+ $dbfile = '/etc/wiregate/rss/rsslog.db';
+else
+ $dbfile = 'rsslog.db';
+
+//check if the DIRECTORY is writeable by the webserver
+$dbfile_dir = dirname($dbfile);
+if (! is_writable($dbfile_dir))
+ die ("Database $dbfile not writeable! make sure the file AND " .
+ "the directory are writeable by the webserver!");
+
+// create database connection
+$db = sqlite_open($dbfile, 0666, $error);
+if (!$db) die ($error);
+
+// create table if it doesn't exists
+create( $db );
+
+if( isset($_GET['c']) )
+{
+ // store a new log
+ $store = true;
+ $log_content = $_GET['c'] ? $_GET['c'] : '<no content>';
+ $log_title = $_GET['h'] ? $_GET['h'] : '';
+ if( mb_detect_encoding($log_content, 'UTF-8', true) != 'UTF-8' )
+ $log_content = utf8_encode($log_content);
+ if( mb_detect_encoding($log_title, 'UTF-8', true) != 'UTF-8' )
+ $log_title = utf8_encode($log_title);
+ $log_tags = $_GET['t'] ? $_GET['t'] : array();
+ if(! is_array($log_tags))
+ die("wrong format - use one or more t[]= for tags");
+ insert( $db, $log_content, $log_title, $log_tags );
+} else if( isset($_GET['dump']) )
+{
+ $result = retrieve( $db, $log_filter, '' );
+ ?>
+<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /></head><body>
+<table border="1">
+ <?php
+ while( sqlite_has_more($result) )
+ {
+ $row = sqlite_fetch_array($result, SQLITE_ASSOC );
+ echo '<tr>';
+ echo '<td>' . $row['id'] . '</td>';
+ echo '<td>' . date( DATE_ATOM, $row['t'] ) . '</td>';
+ echo '<td>' . $row['t'] . '</td>';
+ echo '<td>' . $row['title'] . '</td>';
+ echo '<td>' . $row['content'] . '</td>';
+ echo '<td>' . $row['tags'] . '</td>';
+ echo '<td>' . $row['state'] . '</td>';
+ echo "</tr>\n";
+ }
+ ?>
+</table>
+</body></html>
+ <?php
+} else if( isset($_GET['r']) )
+{
+ $timestamp = $_GET['r'] ? $_GET['r'] : '';
+ delete( $db, $timestamp );
+} else if( isset($_GET['j']) )
+{
+ ?>
+{
+ "responseData" : {
+ "feed" : {
+ "feedUrl": "<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; ?>",
+ "title": "RSS supplied logs",
+ "link": "<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; ?>",
+ "author": "",
+ "description": "RSS supplied logs",
+ "type": "rss20",
+ "entries": [
+<?php
+ $result = retrieve( $db, $log_filter, '' );
+ $first = true;
+ while( sqlite_has_more($result) )
+ {
+ $row = sqlite_fetch_array($result, SQLITE_ASSOC );
+ if( !$first ) echo ",\n";
+ echo '{';
+ echo '"title": "' . $row['title'] . '",';
+ echo '"content": "' . $row['content'] . '",';
+ echo '"publishedDate": "' . date( DATE_ATOM, $row['t'] ) . '"';
+ echo '}';
+ $first = false;
+ }
+?>
+ ]
+ }
+ },
+ "responseDetails" : null,
+ "responseStatus" : 200
+}
+<?php
+} else if ( isset($_GET['u']) ) {
+ $id = $_GET['u'];
+ if (!is_numeric($id))
+ die("wrong format - id has to be numeric");
+ $newstate = $_GET['state'];
+ if (!is_numeric($newstate))
+ die("wrong format - state is required and has to be numeric");
+ updatestate( $db, $id, $newstate );
+?>
+Successfully updated ID=<?php echo $id; ?>.
+<?php
+} else {
+ // send logs
+ $log_filter = $_GET['f'] ? $_GET['f'] : '';
+ $state = $_GET['state']; // ? $_GET['state'] : '';
+
+ // retrieve data
+ $result = retrieve( $db, $log_filter, $state );
+ echo '<?xml version="1.0"?>';
+ ?>
+<rss version="2.0">
+ <channel>
+ <title>RSS supplied logs <?php echo $state; echo $log_filter; ?></title>
+ <link><?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; ?></link>
+ <description>RSS supplied logs</description>
+ <?php
+ // echo '<description>foo</description>';
+ while( sqlite_has_more($result) )
+ {
+ $row = sqlite_fetch_array($result, SQLITE_ASSOC );
+ $tags = ' [ id=' . $row['id']. ',state=' . $row['state'];
+ if ($row['tags'])
+ $tags .= ',' . $row['tags'];
+ $tags .= ' ]';
+ echo '<item>';
+ echo '<title>' . $row['title'] . $tags . '</title>';
+ echo '<description>' . $row['content'] . '</description>';
+ echo '<pubDate>' . date( DATE_ATOM, $row['t'] ) . '</pubDate>';
+ echo '</item>' . "\n";
+ }
+ ?>
+ </channel>
+</rss>
+ <?php
+}
+
+sqlite_close($db);
+
+///////////////////////////////////////////////////////////////////////////////
+// create tables if they don't exist
+function create( $db )
+{
+ $q = "SELECT name FROM sqlite_master WHERE type='table' AND name='Logs';";
+ $result = sqlite_query( $db, $q, SQLITE_NUM );
+ if (!$result) die("Cannot execute query. $q");
+ if( !sqlite_has_more($result) )
+ {
+ // no table found - create it
+ $q = 'CREATE TABLE Logs(' .
+ ' id INTEGER PRIMARY KEY,' .
+ ' title TEXT,' .
+ ' content TEXT NOT NULL,' .
+ ' tags TEXT,' .
+ ' t TIMESTAMP' .
+ ' state INT' .
+ ');';
+ $ok = sqlite_exec($db, $q, $error);
+
+ if (!$ok)
+ die("Cannot execute query $q. $error");
+ }
+}
+
+// insert a new log line
+function insert( $db, $content, $title, $tags )
+{
+ // store a new log line
+ $q = 'INSERT INTO Logs(content, title, tags, t) VALUES( ' .
+ " '" . sqlite_escape_string( $content ) . "'," .
+ " '" . sqlite_escape_string( $title ) . "'," .
+ " '" . sqlite_escape_string( implode(",",$tags) ) . "'," .
+ " datetime('now')" .
+ ')';
+
+ $ok = sqlite_exec($db, $q, $error);
+
+ if (!$ok)
+ die("Cannot execute query. $error (Content: $content Tags: $tags");
+}
+
+// return a handle to all the data
+function retrieve( $db, $filter, $state )
+{
+// $q = "SELECT content, strftime('%s', t, 'localtime') AS t FROM Logs";
+ $q = "SELECT id, title, content, tags, state, strftime('%s', t) AS t FROM Logs " .
+ "WHERE tags LIKE '%" . sqlite_escape_string($filter) . "%' ";
+ if (isset($state))
+ $q .= " AND state=" . $state . " ";
+
+ $q .= "ORDER by t DESC";
+ return sqlite_query( $db, $q, SQLITE_ASSOC );
+}
+
+// delete all log lines older than the timestamp
+function delete( $db, $timestamp )
+{
+ //$q = "DELETE from Logs WHERE t < datetime($timestamp, 'unixepoch', 'localtime')";
+ $q = "DELETE from Logs WHERE t < datetime($timestamp, 'unixepoch')";
+ $ok = sqlite_exec($db, $q, $error);
+
+ if (!$ok)
+ die("Cannot execute query. $error");
+}
+
+function updatestate( $db, $id, $newstate)
+{
+ $q = 'UPDATE Logs SET state=' . $newstate . ' WHERE id=' . $id . ';';
+ $ok = sqlite_exec($db, $q, $error);
+
+ if (!$ok)
+ die("Cannot execute query. $error");
+}
+?>
Added: tools/rsslog/rsslog_correct.pl
===================================================================
--- tools/rsslog/rsslog_correct.pl (rev 0)
+++ tools/rsslog/rsslog_correct.pl 2012-02-13 11:37:23 UTC (rev 703)
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+#
+# (c) 2011 by Jan N. Klug
+# Licenced under the GPLv3
+#
+# add state-column to rsslog-database
+# use ONLY if your databse is created with rsslog.php before Rev. 703!
+#
+# usage: ./rsslog_correct.pl
+# change path to database !
+
+# config
+my $logdb = '/var/www/rsslog.db';
+
+# ab hier nichts aendern
+
+#allgemeine Deklarationen
+use strict;
+use DBI;
+
+# Datenbank \xF6fnnen
+if (! -e $logdb) {
+ die "$logdb existiert nicht! Bitte mit rsslog.php anlegen"; # FIXME: create sqlite-db
+}
+
+my $dbargs = {AutoCommit => 0, PrintError => 1};
+my $dbh = DBI->connect("dbi:SQLite2:dbname=$logdb", "", "", $dbargs)
+ or die "Couldn't open database: " . DBI->errstr;
+
+# temp db erzeugen
+my $sqlquery = 'CREATE TEMPORARY TABLE LTemp(title TEXT, content TEXT NOT NULL, tags TEXT, t TIMESTAMP);';
+$dbh->do($sqlquery)
+ or die "Couldn't execute command: " . $dbh->errstr;
+
+# copy to temp database
+$sqlquery = 'INSERT INTO LTemp SELECT title, content, tags, t FROM Logs;';
+$dbh->do($sqlquery)
+ or die "Couldn't execute command: " . $dbh->errstr;
+
+# alte db loeschen
+$sqlquery = 'DROP TABLE Logs;';
+$dbh->do($sqlquery)
+ or die "Couldn't execute command: " . $dbh->errstr;
+
+# neue db erzeugen
+my $sqlquery = 'CREATE TABLE Logs(id INTEGER PRIMARY KEY, title TEXT, content TEXT NOT NULL, tags TEXT, t TIMESTAMP, state INTEGER DEFAULT 0);';
+$dbh->do($sqlquery)
+ or die "Couldn't execute command: " . $dbh->errstr;
+
+# zurueckkopieren
+$sqlquery = 'INSERT INTO Logs (title, content, tags, t) SELECT title, content, tags, t FROM LTemp;';
+$dbh->do($sqlquery)
+ or die "Couldn't execute command: " . $dbh->errstr;
+
+# temp database loeschen
+$sqlquery = 'DROP TABLE LTemp;';
+$dbh->do($sqlquery)
+ or die "Couldn't execute command: " . $dbh->errstr;
+
+# erst schreiben, wenn alles funktioniert hat
+$dbh->commit()
+ or die "Couldn't execute command: " . $dbh->errstr;
+
+$dbh->disconnect();
Property changes on: tools/rsslog/rsslog_correct.pl
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2012-02-13 07:13:21
|
Revision: 702
http://openautomation.svn.sourceforge.net/openautomation/?rev=702&view=rev
Author: j-n-k
Date: 2012-02-13 07:13:14 +0000 (Mon, 13 Feb 2012)
Log Message:
-----------
Added popup to rsslog, added "ack" for log-items
"ack" is done by setting "state" in db to 1
use src="rsslog?f=whatever&state=0" in config.xml
update database with update-script (provided separately)
update your rsslog.php
no need to update insert-scripts, state is set to 0 (nak)
automaticaly on row-creation
Modified Paths:
--------------
CometVisu/trunk/visu/plugins/rsslog/rsslog.css
CometVisu/trunk/visu/plugins/rsslog/structure_plugin.js
Modified: CometVisu/trunk/visu/plugins/rsslog/rsslog.css
===================================================================
--- CometVisu/trunk/visu/plugins/rsslog/rsslog.css 2012-02-12 21:23:02 UTC (rev 701)
+++ CometVisu/trunk/visu/plugins/rsslog/rsslog.css 2012-02-13 07:13:14 UTC (rev 702)
@@ -1,10 +1,41 @@
-.rssBody, .rsslog_inline {
+.rsslog_inline {
padding-left:0.15em;
}
-.rssBody>ul, .rsslog_inline>ul {
+.rsslog_inline>ul {
margin: 0;
padding: 0;
list-style: none;
}
+
+.rsslog_popup>ul {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+
+.rsslog_popup > ul > li {
+ line-height: 2em;
+}
+
+.rsslogBody {
+ clear: left;
+ width:100%;
+}
+
+.rsslogeven {
+ color: #E6E6E6;
+}
+
+.rsslogodd {
+ color: #6E6E6E;
+}
+
+.rsslog_popup > ul > .rsslogRow {
+ font-size: 100%;
+}
+
+.rsslog_ack {
+ text-decoration: line-through;
+}
\ No newline at end of file
Modified: CometVisu/trunk/visu/plugins/rsslog/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/rsslog/structure_plugin.js 2012-02-12 21:23:02 UTC (rev 701)
+++ CometVisu/trunk/visu/plugins/rsslog/structure_plugin.js 2012-02-13 07:13:14 UTC (rev 702)
@@ -16,61 +16,76 @@
*/
$.get("plugins/rsslog/rsslog.css", function(css) {
- $("head").append("<style>"+css+"</style>");
+ $("head").append("<style>"+css+"</style>");
});
VisuDesign_Custom.prototype.addCreator("rsslog", {
- create: function( page, path ) {
- var $p = $(page);
+ create: function( page, path ) {
+ var $p = $(page);
+ function uniqid() {
+ var newDate = new Date;
+ return newDate.getTime();
+ }
- function uniqid() {
- var newDate = new Date;
- return newDate.getTime();
- }
+ var id = "rss_" + uniqid();
- var id = "rss_" + uniqid();
-
- var ret_val = $('<div class="widget clearfix rsslog" />');
- ret_val.setWidgetLayout($p).makeWidgetLabel($p);
+ var ret_val = $('<div class="widget clearfix rsslog" />');
+ ret_val.setWidgetLayout($p).makeWidgetLabel($p);
- var actor = $('<div class="actor rsslogBody"><div class="rsslog_inline" id="' + id + '"></div></div>');
- var rss = $("#" + id, actor);
+ var actor = $('<div class="actor rsslogBody"><div class="rsslog_inline" id="' + id + '"></div></div>');
+ var rss = $("#" + id, actor);
- if ($p.attr("width")) {
- rss.css("width", $p.attr("width"));
- }
- if ($p.attr("height")) {
- rss.css("height", $p.attr("height"));
- }
+ if ($p.attr("width")) {
+ rss.css("width", $p.attr("width"));
+ }
+ if ($p.attr("height")) {
+ rss.css("height", $p.attr("height"));
+ }
- ret_val.append(actor);
+ ret_val.append(actor);
- rss.data("id", id);
- rss.data("src", $p.attr("src"));
- rss.data("refresh", $p.attr("refresh"));
- rss.data("content", $p.attr("content")) || true;
- rss.data("datetime", $p.attr("datetime")) || true;
- rss.data("mode", $p.attr("mode") || "last");
- rss.data("timeformat", $p.attr("timeformat"));
+ rss.data("id", id);
+ rss.data("src", $p.attr("src"));
+ rss.data("refresh", $p.attr("refresh"));
+ rss.data("content", $p.attr("content")) || true;
+ rss.data("datetime", $p.attr("datetime")) || true;
+ rss.data("mode", $p.attr("mode") || "last");
+ rss.data("timeformat", $p.attr("timeformat"));
+ rss.data("itemoffset", 0);
+ rss.data("itemack", 0);
+
+ var brss = $('<div class="rsslog_popup" id="' + id + '_big"/>');
+ var data = jQuery.extend({}, rss.data());
+
+ ret_val.bind("click", function() {
+ showPopup("rsslog", {title: $('.label', ret_val).text() || '', content: brss});
+ brss.parent("div").css({height: "90%", width: "90%", margin: "auto"}); // define parent as 100%!
+ brss.data(data);
+ brss.data("refresh", "");
+ brss.data("itemack", 1);
+ $(brss).bind("click", function(event) {
+ // don't let the popup know about the click, or it will close on touch-displays
+ event.stopPropagation();
+ });
+ $(brss).parent().css("overflow", "auto");
+ refreshRSSlog(brss, {});
+ });
+ refreshRSSlog(rss, {});
- rss.data("itemoffset", 0);
-
- refreshRSSlog(rss, {});
-
- return ret_val;
- },
- attributes: {
- src: {type: "string", required: true},
- width: {type: "string", required: false},
- height: {type: "string", required: false},
- refresh: {type: "numeric", required: false},
- content: {type: "list", required: false, list: {'true': "yes", 'false': "no"}},
- datetime: {type: "list", required: false, list: {'true': "yes", 'false': "no"}},
- mode: {type: "list", required: false, list: {'first': 'first', 'last': 'last', 'rollover':'rollover' }},
- timeformat: {type: "string", required: false},
- },
- content: false
+ return ret_val;
+ },
+ attributes: {
+ src: {type: "string", required: true},
+ width: {type: "string", required: false},
+ height: {type: "string", required: false},
+ refresh: {type: "numeric", required: false},
+ content: {type: "list", required: false, list: {'true': "yes", 'false': "no"}},
+ datetime: {type: "list", required: false, list: {'true': "yes", 'false': "no"}},
+ mode: {type: "list", required: false, list: {'first': 'first', 'last': 'last', 'rollover':'rollover' }},
+ timeformat: {type: "string", required: false},
+ },
+ content: false
});
function refreshRSSlog(rss, data) {
@@ -88,6 +103,7 @@
datetime: eval(rss.data("datetime")),
mode: rss.data("mode"),
timeformat: rss.data("timeformat"),
+ itemack: rss.data("itemack"),
});
});
@@ -102,112 +118,126 @@
}
(function($){
- jQuery.fn.extend({
- rssfeedlocal: function(options) {
+ jQuery.fn.extend({
+ rssfeedlocal: function(options) {
- var defaults = {
- src: '',
- html: '{text}',
- wrapper: 'li',
- dataType: 'xml',
- title: true,
- datetime: true
- }
- var options = jQuery.extend(defaults, options);
+ var defaults = {
+ src: '',
+ html: '{text}',
+ wrapper: 'li',
+ dataType: 'xml',
+ datetime: true
+ }
+ var options = jQuery.extend(defaults, options);
- if (options.datetime) {
- options.html = '{date}: ' + options.html;
- }
+ if (options.datetime) {
+ options.html = '{date}: ' + options.html;
+ }
- return this.each(function() {
- var o = options;
- var c = jQuery(this);
+ return this.each(function() {
+ var o = options;
+ var c = jQuery(this);
- if (o.src == '') {
- console.log('rssfeedlocal: no src URL');
- return; // avoid the request
- }
+ if (o.src == '') {
+ console.log('rssfeedlocal: no src URL');
+ return; // avoid the request
+ }
- jQuery.ajax({
- url: o.src,
- type: 'GET',
- dataType: o.dataType,
- error: function (xhr, status, e) {
- console.log('C: #%s, Error: %s, Feed: %s', $(c).attr('id'), e, o.src);
- },
- success: function(feed){
- jQuery(c).html('');
-
- // get height of one entry, calc max num of display items in widget
- var dummyDiv = $('<' + o.wrapper + ' class="rsslogRow odd" id="dummydiv">').append('<li />').appendTo($(c));
- var itemheight = dummyDiv.height();
- dummyDiv.remove();
- var widget=$(c).parent().parent(); // get the parent widget
- var displayheight = widget.height()-$('.label', widget).height(); // max. height of actor is widget-label(if exists)
- var displayrows = Math.floor(displayheight/itemheight);
+ jQuery.ajax({
+ url: o.src,
+ type: 'GET',
+ dataType: o.dataType,
+ error: function (xhr, status, e) {
+ console.log('C: #%s, Error: %s, Feed: %s', $(c).attr('id'), e, o.src);
+ },
+ success: function(feed){
+ jQuery(c).html('');
+
+ // get height of one entry, calc max num of display items in widget
+ var dummyDiv = $('<' + o.wrapper + ' class="rsslogRow odd" id="dummydiv">').append('<li />').appendTo($(c));
+ var itemheight = dummyDiv.height();
+ dummyDiv.remove();
+ var widget=$(c).parent().parent(); // get the parent widget
+ var displayheight = widget.height()-$('.label', widget).height(); // max. height of actor is widget-label(if exists)
+ var displayrows = Math.floor(displayheight/itemheight);
- var items = $(feed).find('item');
- var itemnum = items.length;
- var itemoffset = 0; // correct if mode='last' or itemnum<=displayrows
+ var items = $(feed).find('item');
+ var itemnum = items.length;
- if (itemnum>displayrows) { // no need to check mode if items are less than rows
- if (o.mode=='first') {
- itemoffset=itemnum-displayrows;
- }
- if (o.mode=='rollover') {
- itemoffset = $(c).data("itemoffset") || 0;
- if (itemoffset==itemnum) {
- itemoffset = 0;
- }
- $(c).data("itemoffset", itemoffset+1);
- }
- }
+ var itemoffset = 0; // correct if mode='last' or itemnum<=displayrows
- var row = 'rsslogodd';
- var last = itemoffset+displayrows;
- if (last>itemnum) {
- last=itemnum;
- }
- for (var i=itemoffset; i<last; i++) {
- var idx = i;
- idx = (i>=itemnum) ? (idx = idx - itemnum) : idx;
+ if (itemnum>displayrows) { // no need to check mode if items are less than rows
+ if (o.mode=='first') {
+ itemoffset=itemnum-displayrows;
+ }
+ if (o.mode=='rollover') {
+ itemoffset = $(c).data("itemoffset") || 0;
+ if (itemoffset==itemnum) {
+ itemoffset = 0;
+ }
+ $(c).data("itemoffset", itemoffset+1);
+ }
+ }
+
+ var row = 'rsslogodd';
+ var last = itemoffset+displayrows;
+ last = (last>itemnum) ? itemnum : last;
+
+ for (var i=itemoffset; i<last; i++) {
+ var idx = i;
+ idx = (i>=itemnum) ? (idx = idx - itemnum) : idx;
- var item = $(items[idx]);
+ var item = $(items[idx]);
+ var itemHtml=o.html;
- var itemHtml=o.html;
+ itemHtml = itemHtml.replace(/{text}/, item.find('description').text());
+ var entryDate = new Date(item.find('pubDate').text());
+ if (entryDate) {
+ itemHtml = (o.timeformat) ?
+ (itemHtml.replace(/{date}/, entryDate.strftime(o.timeformat) + ' ')) :
+ (itemHtml.replace(/{date}/, entryDate.toLocaleDateString() + ' ' + entryDate.toLocaleTimeString() + ' '));
+ } else {
+ itemHtml = itemHtml.replace(/{date}/, '');
+ }
- itemHtml = itemHtml.replace(/{text}/, item.find('description').text());
- var entryDate = new Date(item.find('pubDate').text());
- if (entryDate) {
- itemHtml = (o.timeformat) ?
- (itemHtml.replace(/{date}/, entryDate.strftime(o.timeformat) + ' ')) :
- (itemHtml.replace(/{date}/, entryDate.toLocaleDateString() + ' ' + entryDate.toLocaleTimeString() + ' '));
- } else {
- itemHtml = itemHtml.replace(/{date}/, '');
- }
+ var $row = $('<' + o.wrapper + ' class="rsslogRow ' + row + '">').append(itemHtml);
- var $row = $('<' + o.wrapper + ' class="rsslogRow ' + row + '">').append(itemHtml);
-
- var title = item.find('title').text();
- var itemClasses = title.substring(title.search(/\[/)+1,title.search(/\]/)).replace(/\,/g, ' ');
-
- if (itemClasses) {
-
- $row.addClass(itemClasses);
- }
-
- jQuery(c).append($row)
+ var title = item.find('title').text();
+ var itemClasses = title.substring(title.search(/\[/)+1,title.search(/\]/)).replace(/\,/g, ' ');
+ if (itemClasses) {
+ $row.addClass(itemClasses);
+ var id = itemClasses.match(/id=[0-9]*/)[0].split('=')[1];
+ $row.data('id', id);
+ }
+ if (o.itemack) {
+ $row.bind("click", function() {
+ var item = $(this);
+ var id = item.data('id');
+ item.toggleClass("rsslog_ack");
+ var state = item.hasClass("rsslog_ack"); // the new state is the same as hasClass
+ var url = o.src.split('?')[0] + '?u=' + id + '&state=' + Number(state);
+ jQuery.ajax({
+ url: url,
+ type: 'GET',
+ error: function (xhr, status, e) {
+ console.log('ID: #%s, Error: %s, URL: %s', id, e, url);
+ },
+ });
+ });
+ }
+
+ jQuery(c).append($row);
- // Alternate row classes
- row = (row == 'rsslogodd') ? 'rsslogeven' : 'rsslogodd';
- };
+ // Alternate row classes
+ row = (row == 'rsslogodd') ? 'rsslogeven' : 'rsslogodd';
+ };
- $('li', c).wrapAll("<ul>");
- }
- });
- });
- return this;
- }
- });
+ $('li', c).wrapAll("<ul>");
+ }
+ });
+ });
+ return this;
+ }
+ });
})(jQuery);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2012-02-12 21:23:08
|
Revision: 701
http://openautomation.svn.sourceforge.net/openautomation/?rev=701&view=rev
Author: mayerch
Date: 2012-02-12 21:23:02 +0000 (Sun, 12 Feb 2012)
Log Message:
-----------
Change local entry to universal one...
Modified Paths:
--------------
CometVisu/trunk/visu/visu_config_demo.xml
Modified: CometVisu/trunk/visu/visu_config_demo.xml
===================================================================
--- CometVisu/trunk/visu/visu_config_demo.xml 2012-02-12 14:36:55 UTC (rev 700)
+++ CometVisu/trunk/visu/visu_config_demo.xml 2012-02-12 21:23:02 UTC (rev 701)
@@ -370,9 +370,9 @@
<label>KNX traffic</label>
</diagram_popup>
<diagram_inline rrd="eib_traffic" width="600" height="400"/>
- <diagram_info rrd="200_DALI_Linie_1_Strom" unit="mA" series="day" refresh="300">
- <label>DALI Strom L1</label>
- <address transform="DPT:9.021">14/2/7</address>
+ <diagram_info rrd="eib_traffic" unit="tps" series="day" refresh="300">
+ <label>KNX traffic</label>
+ <address transform="DPT:9.021">12/7/9</address>
</diagram_info>
<line/>
<page name="Erweiterte Widgets">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2012-02-12 14:37:01
|
Revision: 700
http://openautomation.svn.sourceforge.net/openautomation/?rev=700&view=rev
Author: mayerch
Date: 2012-02-12 14:36:55 +0000 (Sun, 12 Feb 2012)
Log Message:
-----------
Added encoding for Time at the transform for KNX.
Also added a little helper function that preprends zeros to a string till a given length.
Modified Paths:
--------------
CometVisu/trunk/visu/plugins/clock/structure_plugin.js
CometVisu/trunk/visu/transforms/transform_default.js
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/plugins/clock/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/clock/structure_plugin.js 2012-02-12 14:07:04 UTC (rev 699)
+++ CometVisu/trunk/visu/plugins/clock/structure_plugin.js 2012-02-12 14:36:55 UTC (rev 700)
@@ -44,6 +44,7 @@
var datatype = $(page).attr('datatype');
var $actor = $(actor)
.data({
+ 'value' : new Date(),
'address' : address,
'type' : 'clock'
});
@@ -82,7 +83,6 @@
var y = 50 - (event.originalEvent.pageY - $svg.offset().top);
var angle = (Math.atan2( x, y ) * 180 / Math.PI + 360) % 360;
var time = $container.data('value');
- var told = time.toString();
if( event.data.type == 'hour' )
{
var oldHours = time.getHours();
Modified: CometVisu/trunk/visu/transforms/transform_default.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_default.js 2012-02-12 14:07:04 UTC (rev 699)
+++ CometVisu/trunk/visu/transforms/transform_default.js 2012-02-12 14:36:55 UTC (rev 700)
@@ -66,4 +66,14 @@
Transform[ prefix + ':' + trans ] = transforms[ trans ];
}
}
+}
+
+/**
+ * Prepend zeros to the string s till the result has the length l.
+ */
+function zeroFillString( s, l )
+{
+ if( s.length >= l ) return s;
+
+ return new Array(1 + l - s.length).join('0') + s;
}
\ No newline at end of file
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2012-02-12 14:07:04 UTC (rev 699)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2012-02-12 14:36:55 UTC (rev 700)
@@ -216,7 +216,10 @@
'10.001' : {
name : 'DPT_TimeOfDay',
encode: function( phy ){
- // FIXME
+ var val = zeroFillString( ((phy.getDay() << 5) + phy.getHours()).toString(16), 2);
+ val += zeroFillString( phy.getMinutes().toString(16), 2 );
+ val += zeroFillString( phy.getSeconds().toString(16), 2 );
+ return '80' + val;
},
decode: function( hex ){
var date = new Date(); // assume today
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2012-02-12 14:07:11
|
Revision: 699
http://openautomation.svn.sourceforge.net/openautomation/?rev=699&view=rev
Author: mayerch
Date: 2012-02-12 14:07:04 +0000 (Sun, 12 Feb 2012)
Log Message:
-----------
New Plugin: clock
This is an analog clock that can be used to show and change a time.
As it is implemented with SVG this plugin is also an example of how to include SVGs, change them through JavaScript (including bus updates) and make parts of the SVG react to user interaction.
TODO:
- make scalable and use colspan + rowspan
- implement the knx_encode for the DPT
- better design of the SVG
- change UI and SVG to show a little clock ("preview") and on click pop up a bigger one for changing the setting
- change SVG design based on visu design (e.g. dynamically recolor parts)
- visually hide the handles
- add digital time to clock (to distinguish AM/PM, but also for those that prefer that and to show the exact time)
Modified Paths:
--------------
CometVisu/trunk/visu/index.html
Added Paths:
-----------
CometVisu/trunk/visu/lib/jquery.svg.min.js
CometVisu/trunk/visu/plugins/clock/
CometVisu/trunk/visu/plugins/clock/clock_pure.svg
CometVisu/trunk/visu/plugins/clock/structure_plugin.js
Modified: CometVisu/trunk/visu/index.html
===================================================================
--- CometVisu/trunk/visu/index.html 2012-02-11 20:53:50 UTC (rev 698)
+++ CometVisu/trunk/visu/index.html 2012-02-12 14:07:04 UTC (rev 699)
@@ -14,6 +14,7 @@
<script src="lib/strftime.js" type="text/javascript"></script>
<script src="lib/scrollable.js" type="text/javascript"></script>
<script src="lib/jquery.ui.touch-punch.js" type="text/javascript"></script>
+ <script src="lib/jquery.svg.min.js" type="text/javascript"></script>
<script src="lib/cometvisu-client.js" type="text/javascript"></script>
<script src="lib/knx_decode.js" type="text/javascript"></script>
<script src="designs/structure_pure.js" type="text/javascript"></script>
Added: CometVisu/trunk/visu/lib/jquery.svg.min.js
===================================================================
--- CometVisu/trunk/visu/lib/jquery.svg.min.js (rev 0)
+++ CometVisu/trunk/visu/lib/jquery.svg.min.js 2012-02-12 14:07:04 UTC (rev 699)
@@ -0,0 +1,7 @@
+/* http://keith-wood.name/svg.html
+ SVG for jQuery v1.4.4.
+ Written by Keith Wood (kbwood{at}iinet.com.au) August 2007.
+ Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
+ MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
+ Please attribute the author if you use it. */
+(function($){function SVGManager(){this._settings=[];this._extensions=[];this.regional=[];this.regional['']={errorLoadingText:'Error loading',notSupportedText:'This browser does not support SVG'};this.local=this.regional[''];this._uuid=new Date().getTime();this._renesis=detectActiveX('RenesisX.RenesisCtrl')}function detectActiveX(a){try{return!!(window.ActiveXObject&&new ActiveXObject(a))}catch(e){return false}}var q='svgwrapper';$.extend(SVGManager.prototype,{markerClassName:'hasSVG',svgNS:'http://www.w3.org/2000/svg',xlinkNS:'http://www.w3.org/1999/xlink',_wrapperClass:SVGWrapper,_attrNames:{class_:'class',in_:'in',alignmentBaseline:'alignment-baseline',baselineShift:'baseline-shift',clipPath:'clip-path',clipRule:'clip-rule',colorInterpolation:'color-interpolation',colorInterpolationFilters:'color-interpolation-filters',colorRendering:'color-rendering',dominantBaseline:'dominant-baseline',enableBackground:'enable-background',fillOpacity:'fill-opacity',fillRule:'fill-rule',floodColor:'flood-color',floodOpacity:'flood-opacity',fontFamily:'font-family',fontSize:'font-size',fontSizeAdjust:'font-size-adjust',fontStretch:'font-stretch',fontStyle:'font-style',fontVariant:'font-variant',fontWeight:'font-weight',glyphOrientationHorizontal:'glyph-orientation-horizontal',glyphOrientationVertical:'glyph-orientation-vertical',horizAdvX:'horiz-adv-x',horizOriginX:'horiz-origin-x',imageRendering:'image-rendering',letterSpacing:'letter-spacing',lightingColor:'lighting-color',markerEnd:'marker-end',markerMid:'marker-mid',markerStart:'marker-start',stopColor:'stop-color',stopOpacity:'stop-opacity',strikethroughPosition:'strikethrough-position',strikethroughThickness:'strikethrough-thickness',strokeDashArray:'stroke-dasharray',strokeDashOffset:'stroke-dashoffset',strokeLineCap:'stroke-linecap',strokeLineJoin:'stroke-linejoin',strokeMiterLimit:'stroke-miterlimit',strokeOpacity:'stroke-opacity',strokeWidth:'stroke-width',textAnchor:'text-anchor',textDecoration:'text-decoration',textRendering:'text-rendering',underlinePosition:'underline-position',underlineThickness:'underline-thickness',vertAdvY:'vert-adv-y',vertOriginY:'vert-origin-y',wordSpacing:'word-spacing',writingMode:'writing-mode'},_attachSVG:function(a,b){var c=(a.namespaceURI==this.svgNS?a:null);var a=(c?null:a);if($(a||c).hasClass(this.markerClassName)){return}if(typeof b=='string'){b={loadURL:b}}else if(typeof b=='function'){b={onLoad:b}}$(a||c).addClass(this.markerClassName);try{if(!c){c=document.createElementNS(this.svgNS,'svg');c.setAttribute('version','1.1');if(a.clientWidth>0){c.setAttribute('width',a.clientWidth)}if(a.clientHeight>0){c.setAttribute('height',a.clientHeight)}a.appendChild(c)}this._afterLoad(a,c,b||{})}catch(e){if($.browser.msie){if(!a.id){a.id='svg'+(this._uuid++)}this._settings[a.id]=b;a.innerHTML='<embed type="image/svg+xml" width="100%" '+'height="100%" src="'+(b.initPath||'')+'blank.svg" '+'pluginspage="http://www.adobe.com/svg/viewer/install/main.html"/>'}else{a.innerHTML='<p class="svg_error">'+this.local.notSupportedText+'</p>'}}},_registerSVG:function(){for(var i=0;i<document.embeds.length;i++){var a=document.embeds[i].parentNode;if(!$(a).hasClass($.svg.markerClassName)||$.data(a,q)){continue}var b=null;try{b=document.embeds[i].getSVGDocument()}catch(e){setTimeout($.svg._registerSVG,250);return}b=(b?b.documentElement:null);if(b){$.svg._afterLoad(a,b)}}},_afterLoad:function(a,b,c){var c=c||this._settings[a.id];this._settings[a?a.id:'']=null;var d=new this._wrapperClass(b,a);$.data(a||b,q,d);try{if(c.loadURL){d.load(c.loadURL,c)}if(c.settings){d.configure(c.settings)}if(c.onLoad&&!c.loadURL){c.onLoad.apply(a||b,[d])}}catch(e){alert(e)}},_getSVG:function(a){a=(typeof a=='string'?$(a)[0]:(a.jquery?a[0]:a));return $.data(a,q)},_destroySVG:function(a){var b=$(a);if(!b.hasClass(this.markerClassName)){return}b.removeClass(this.markerClassName);if(a.namespaceURI!=this.svgNS){b.empty()}$.removeData(a,q)},addExtension:function(a,b){this._extensions.push([a,b])},isSVGElem:function(a){return(a.nodeType==1&&a.namespaceURI==$.svg.svgNS)}});function SVGWrapper(a,b){this._svg=a;this._container=b;for(var i=0;i<$.svg._extensions.length;i++){var c=$.svg._extensions[i];this[c[0]]=new c[1](this)}}$.extend(SVGWrapper.prototype,{_width:function(){return(this._container?this._container.clientWidth:this._svg.width)},_height:function(){return(this._container?this._container.clientHeight:this._svg.height)},root:function(){return this._svg},configure:function(a,b,c){if(!a.nodeName){c=b;b=a;a=this._svg}if(c){for(var i=a.attributes.length-1;i>=0;i--){var d=a.attributes.item(i);if(!(d.nodeName=='onload'||d.nodeName=='version'||d.nodeName.substring(0,5)=='xmlns')){a.attributes.removeNamedItem(d.nodeName)}}}for(var e in b){a.setAttribute($.svg._attrNames[e]||e,b[e])}return this},getElementById:function(a){return this._svg.ownerDocument.getElementById(a)},change:function(a,b){if(a){for(var c in b){if(b[c]==null){a.removeAttribute($.svg._attrNames[c]||c)}else{a.setAttribute($.svg._attrNames[c]||c,b[c])}}}return this},_args:function(b,c,d){c.splice(0,0,'parent');c.splice(c.length,0,'settings');var e={};var f=0;if(b[0]!=null&&b[0].jquery){b[0]=b[0][0]}if(b[0]!=null&&!(typeof b[0]=='object'&&b[0].nodeName)){e['parent']=null;f=1}for(var i=0;i<b.length;i++){e[c[i+f]]=b[i]}if(d){$.each(d,function(i,a){if(typeof e[a]=='object'){e.settings=e[a];e[a]=null}})}return e},title:function(a,b,c){var d=this._args(arguments,['text']);var e=this._makeNode(d.parent,'title',d.settings||{});e.appendChild(this._svg.ownerDocument.createTextNode(d.text));return e},describe:function(a,b,c){var d=this._args(arguments,['text']);var e=this._makeNode(d.parent,'desc',d.settings||{});e.appendChild(this._svg.ownerDocument.createTextNode(d.text));return e},defs:function(a,b,c){var d=this._args(arguments,['id'],['id']);return this._makeNode(d.parent,'defs',$.extend((d.id?{id:d.id}:{}),d.settings||{}))},symbol:function(a,b,c,d,e,f,g){var h=this._args(arguments,['id','x1','y1','width','height']);return this._makeNode(h.parent,'symbol',$.extend({id:h.id,viewBox:h.x1+' '+h.y1+' '+h.width+' '+h.height},h.settings||{}))},marker:function(a,b,c,d,e,f,g,h){var i=this._args(arguments,['id','refX','refY','mWidth','mHeight','orient'],['orient']);return this._makeNode(i.parent,'marker',$.extend({id:i.id,refX:i.refX,refY:i.refY,markerWidth:i.mWidth,markerHeight:i.mHeight,orient:i.orient||'auto'},i.settings||{}))},style:function(a,b,c){var d=this._args(arguments,['styles']);var e=this._makeNode(d.parent,'style',$.extend({type:'text/css'},d.settings||{}));e.appendChild(this._svg.ownerDocument.createTextNode(d.styles));if($.browser.opera){$('head').append('<style type="text/css">'+d.styles+'</style>')}return e},script:function(a,b,c,d){var e=this._args(arguments,['script','type'],['type']);var f=this._makeNode(e.parent,'script',$.extend({type:e.type||'text/javascript'},e.settings||{}));f.appendChild(this._svg.ownerDocument.createTextNode(e.script));if(!$.browser.mozilla){$.globalEval(e.script)}return f},linearGradient:function(a,b,c,d,e,f,g,h){var i=this._args(arguments,['id','stops','x1','y1','x2','y2'],['x1']);var j=$.extend({id:i.id},(i.x1!=null?{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2}:{}));return this._gradient(i.parent,'linearGradient',$.extend(j,i.settings||{}),i.stops)},radialGradient:function(a,b,c,d,e,r,f,g,h){var i=this._args(arguments,['id','stops','cx','cy','r','fx','fy'],['cx']);var j=$.extend({id:i.id},(i.cx!=null?{cx:i.cx,cy:i.cy,r:i.r,fx:i.fx,fy:i.fy}:{}));return this._gradient(i.parent,'radialGradient',$.extend(j,i.settings||{}),i.stops)},_gradient:function(a,b,c,d){var e=this._makeNode(a,b,c);for(var i=0;i<d.length;i++){var f=d[i];this._makeNode(e,'stop',$.extend({offset:f[0],stopColor:f[1]},(f[2]!=null?{stopOpacity:f[2]}:{})))}return e},pattern:function(a,b,x,y,c,d,e,f,g,h,i){var j=this._args(arguments,['id','x','y','width','height','vx','vy','vwidth','vheight'],['vx']);var k=$.extend({id:j.id,x:j.x,y:j.y,width:j.width,height:j.height},(j.vx!=null?{viewBox:j.vx+' '+j.vy+' '+j.vwidth+' '+j.vheight}:{}));return this._makeNode(j.parent,'pattern',$.extend(k,j.settings||{}))},clipPath:function(a,b,c,d){var e=this._args(arguments,['id','units']);e.units=e.units||'userSpaceOnUse';return this._makeNode(e.parent,'clipPath',$.extend({id:e.id,clipPathUnits:e.units},e.settings||{}))},mask:function(a,b,x,y,c,d,e){var f=this._args(arguments,['id','x','y','width','height']);return this._makeNode(f.parent,'mask',$.extend({id:f.id,x:f.x,y:f.y,width:f.width,height:f.height},f.settings||{}))},createPath:function(){return new SVGPath()},createText:function(){return new SVGText()},svg:function(a,x,y,b,c,d,e,f,g,h){var i=this._args(arguments,['x','y','width','height','vx','vy','vwidth','vheight'],['vx']);var j=$.extend({x:i.x,y:i.y,width:i.width,height:i.height},(i.vx!=null?{viewBox:i.vx+' '+i.vy+' '+i.vwidth+' '+i.vheight}:{}));return this._makeNode(i.parent,'svg',$.extend(j,i.settings||{}))},group:function(a,b,c){var d=this._args(arguments,['id'],['id']);return this._makeNode(d.parent,'g',$.extend({id:d.id},d.settings||{}))},use:function(a,x,y,b,c,d,e){var f=this._args(arguments,['x','y','width','height','ref']);if(typeof f.x=='string'){f.ref=f.x;f.settings=f.y;f.x=f.y=f.width=f.height=null}var g=this._makeNode(f.parent,'use',$.extend({x:f.x,y:f.y,width:f.width,height:f.height},f.settings||{}));g.setAttributeNS($.svg.xlinkNS,'href',f.ref);return g},link:function(a,b,c){var d=this._args(arguments,['ref']);var e=this._makeNode(d.parent,'a',d.settings);e.setAttributeNS($.svg.xlinkNS,'href',d.ref);return e},image:function(a,x,y,b,c,d,e){var f=this._args(arguments,['x','y','width','height','ref']);var g=this._makeNode(f.parent,'image',$.extend({x:f.x,y:f.y,width:f.width,height:f.height},f.settings||{}));g.setAttributeNS($.svg.xlinkNS,'href',f.ref);return g},path:function(a,b,c){var d=this._args(arguments,['path']);return this._makeNode(d.parent,'path',$.extend({d:(d.path.path?d.path.path():d.path)},d.settings||{}))},rect:function(a,x,y,b,c,d,e,f){var g=this._args(arguments,['x','y','width','height','rx','ry'],['rx']);return this._makeNode(g.parent,'rect',$.extend({x:g.x,y:g.y,width:g.width,height:g.height},(g.rx?{rx:g.rx,ry:g.ry}:{}),g.settings||{}))},circle:function(a,b,c,r,d){var e=this._args(arguments,['cx','cy','r']);return this._makeNode(e.parent,'circle',$.extend({cx:e.cx,cy:e.cy,r:e.r},e.settings||{}))},ellipse:function(a,b,c,d,e,f){var g=this._args(arguments,['cx','cy','rx','ry']);return this._makeNode(g.parent,'ellipse',$.extend({cx:g.cx,cy:g.cy,rx:g.rx,ry:g.ry},g.settings||{}))},line:function(a,b,c,d,e,f){var g=this._args(arguments,['x1','y1','x2','y2']);return this._makeNode(g.parent,'line',$.extend({x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2},g.settings||{}))},polyline:function(a,b,c){var d=this._args(arguments,['points']);return this._poly(d.parent,'polyline',d.points,d.settings)},polygon:function(a,b,c){var d=this._args(arguments,['points']);return this._poly(d.parent,'polygon',d.points,d.settings)},_poly:function(a,b,c,d){var e='';for(var i=0;i<c.length;i++){e+=c[i].join()+' '}return this._makeNode(a,b,$.extend({points:$.trim(e)},d||{}))},text:function(a,x,y,b,c){var d=this._args(arguments,['x','y','value']);if(typeof d.x=='string'&&arguments.length<4){d.value=d.x;d.settings=d.y;d.x=d.y=null}return this._text(d.parent,'text',d.value,$.extend({x:(d.x&&isArray(d.x)?d.x.join(' '):d.x),y:(d.y&&isArray(d.y)?d.y.join(' '):d.y)},d.settings||{}))},textpath:function(a,b,c,d){var e=this._args(arguments,['path','value']);var f=this._text(e.parent,'textPath',e.value,e.settings||{});f.setAttributeNS($.svg.xlinkNS,'href',e.path);return f},_text:function(a,b,c,d){var e=this._makeNode(a,b,d);if(typeof c=='string'){e.appendChild(e.ownerDocument.createTextNode(c))}else{for(var i=0;i<c._parts.length;i++){var f=c._parts[i];if(f[0]=='tspan'){var g=this._makeNode(e,f[0],f[2]);g.appendChild(e.ownerDocument.createTextNode(f[1]));e.appendChild(g)}else if(f[0]=='tref'){var g=this._makeNode(e,f[0],f[2]);g.setAttributeNS($.svg.xlinkNS,'href',f[1]);e.appendChild(g)}else if(f[0]=='textpath'){var h=$.extend({},f[2]);h.href=null;var g=this._makeNode(e,f[0],h);g.setAttributeNS($.svg.xlinkNS,'href',f[2].href);g.appendChild(e.ownerDocument.createTextNode(f[1]));e.appendChild(g)}else{e.appendChild(e.ownerDocument.createTextNode(f[1]))}}}return e},other:function(a,b,c){var d=this._args(arguments,['name']);return this._makeNode(d.parent,d.name,d.settings||{})},_makeNode:function(a,b,c){a=a||this._svg;var d=this._svg.ownerDocument.createElementNS($.svg.svgNS,b);for(var b in c){var e=c[b];if(e!=null&&e!=null&&(typeof e!='string'||e!='')){d.setAttribute($.svg._attrNames[b]||b,e)}}a.appendChild(d);return d},add:function(b,c){var d=this._args((arguments.length==1?[null,b]:arguments),['node']);var f=this;d.parent=d.parent||this._svg;d.node=(d.node.jquery?d.node:$(d.node));try{if($.svg._renesis){throw'Force traversal';}d.parent.appendChild(d.node.cloneNode(true))}catch(e){d.node.each(function(){var a=f._cloneAsSVG(this);if(a){d.parent.appendChild(a)}})}return this},clone:function(b,c){var d=this;var e=this._args((arguments.length==1?[null,b]:arguments),['node']);e.parent=e.parent||this._svg;e.node=(e.node.jquery?e.node:$(e.node));var f=[];e.node.each(function(){var a=d._cloneAsSVG(this);if(a){a.id='';e.parent.appendChild(a);f.push(a)}});return f},_cloneAsSVG:function(a){var b=null;if(a.nodeType==1){b=this._svg.ownerDocument.createElementNS($.svg.svgNS,this._checkName(a.nodeName));for(var i=0;i<a.attributes.length;i++){var c=a.attributes.item(i);if(c.nodeName!='xmlns'&&c.nodeValue){if(c.prefix=='xlink'){b.setAttributeNS($.svg.xlinkNS,c.localName||c.baseName,c.nodeValue)}else{b.setAttribute(this._checkName(c.nodeName),c.nodeValue)}}}for(var i=0;i<a.childNodes.length;i++){var d=this._cloneAsSVG(a.childNodes[i]);if(d){b.appendChild(d)}}}else if(a.nodeType==3){if($.trim(a.nodeValue)){b=this._svg.ownerDocument.createTextNode(a.nodeValue)}}else if(a.nodeType==4){if($.trim(a.nodeValue)){try{b=this._svg.ownerDocument.createCDATASection(a.nodeValue)}catch(e){b=this._svg.ownerDocument.createTextNode(a.nodeValue.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'))}}}return b},_checkName:function(a){a=(a.substring(0,1)>='A'&&a.substring(0,1)<='Z'?a.toLowerCase():a);return(a.substring(0,4)=='svg:'?a.substring(4):a)},load:function(j,k){k=(typeof k=='boolean'?{addTo:k}:(typeof k=='function'?{onLoad:k}:(typeof k=='string'?{parent:k}:(typeof k=='object'&&k.nodeName?{parent:k}:(typeof k=='object'&&k.jquery?{parent:k}:k||{})))));if(!k.parent&&!k.addTo){this.clear(false)}var l=[this._svg.getAttribute('width'),this._svg.getAttribute('height')];var m=this;var n=function(a){a=$.svg.local.errorLoadingText+': '+a;if(k.onLoad){k.onLoad.apply(m._container||m._svg,[m,a])}else{m.text(null,10,20,a)}};var o=function(a){var b=new ActiveXObject('Microsoft.XMLDOM');b.validateOnParse=false;b.resolveExternals=false;b.async=false;b.loadXML(a);if(b.parseError.errorCode!=0){n(b.parseError.reason);return null}return b};var p=function(a){if(!a){return}if(a.documentElement.nodeName!='svg'){var b=a.getElementsByTagName('parsererror');var c=(b.length?b[0].getElementsByTagName('div'):[]);n(!b.length?'???':(c.length?c[0]:b[0]).firstChild.nodeValue);return}var d=(k.parent?$(k.parent)[0]:m._svg);var f={};for(var i=0;i<a.documentElement.attributes.length;i++){var g=a.documentElement.attributes.item(i);if(!(g.nodeName=='version'||g.nodeName.substring(0,5)=='xmlns')){f[g.nodeName]=g.nodeValue}}m.configure(d,f,!k.parent);var h=a.documentElement.childNodes;for(var i=0;i<h.length;i++){try{if($.svg._renesis){throw'Force traversal';}d.appendChild(m._svg.ownerDocument.importNode(h[i],true));if(h[i].nodeName=='script'){$.globalEval(h[i].textContent)}}catch(e){m.add(d,h[i])}}if(!k.changeSize){m.configure(d,{width:l[0],height:l[1]})}if(k.onLoad){k.onLoad.apply(m._container||m._svg,[m])}};if(j.match('<svg')){p($.browser.msie?o(j):new DOMParser().parseFromString(j,'text/xml'))}else{$.ajax({url:j,dataType:($.browser.msie?'text':'xml'),success:function(a){p($.browser.msie?o(a):a)},error:function(a,b,c){n(b+(c?' '+c.message:''))}})}return this},remove:function(a){a=(a.jquery?a[0]:a);a.parentNode.removeChild(a);return this},clear:function(a){if(a){this.configure({},true)}while(this._svg.firstChild){this._svg.removeChild(this._svg.firstChild)}return this},toSVG:function(a){a=a||this._svg;return(typeof XMLSerializer=='undefined'?this._toSVG(a):new XMLSerializer().serializeToString(a))},_toSVG:function(a){var b='';if(!a){return b}if(a.nodeType==3){b=a.nodeValue}else if(a.nodeType==4){b='<![CDATA['+a.nodeValue+']]>'}else{b='<'+a.nodeName;if(a.attributes){for(var i=0;i<a.attributes.length;i++){var c=a.attributes.item(i);if(!($.trim(c.nodeValue)==''||c.nodeValue.match(/^\[object/)||c.nodeValue.match(/^function/))){b+=' '+(c.namespaceURI==$.svg.xlinkNS?'xlink:':'')+c.nodeName+'="'+c.nodeValue+'"'}}}if(a.firstChild){b+='>';var d=a.firstChild;while(d){b+=this._toSVG(d);d=d.nextSibling}b+='</'+a.nodeName+'>'}else{b+='/>'}}return b}});function SVGPath(){this._path=''}$.extend(SVGPath.prototype,{reset:function(){this._path='';return this},move:function(x,y,a){a=(isArray(x)?y:a);return this._coords((a?'m':'M'),x,y)},line:function(x,y,a){a=(isArray(x)?y:a);return this._coords((a?'l':'L'),x,y)},horiz:function(x,a){this._path+=(a?'h':'H')+(isArray(x)?x.join(' '):x);return this},vert:function(y,a){this._path+=(a?'v':'V')+(isArray(y)?y.join(' '):y);return this},curveC:function(a,b,c,d,x,y,e){e=(isArray(a)?b:e);return this._coords((e?'c':'C'),a,b,c,d,x,y)},smoothC:function(a,b,x,y,c){c=(isArray(a)?b:c);return this._coords((c?'s':'S'),a,b,x,y)},curveQ:function(a,b,x,y,c){c=(isArray(a)?b:c);return this._coords((c?'q':'Q'),a,b,x,y)},smoothQ:function(x,y,a){a=(isArray(x)?y:a);return this._coords((a?'t':'T'),x,y)},_coords:function(a,b,c,d,e,f,g){if(isArray(b)){for(var i=0;i<b.length;i++){var h=b[i];this._path+=(i==0?a:' ')+h[0]+','+h[1]+(h.length<4?'':' '+h[2]+','+h[3]+(h.length<6?'':' '+h[4]+','+h[5]))}}else{this._path+=a+b+','+c+(d==null?'':' '+d+','+e+(f==null?'':' '+f+','+g))}return this},arc:function(a,b,c,d,e,x,y,f){f=(isArray(a)?b:f);this._path+=(f?'a':'A');if(isArray(a)){for(var i=0;i<a.length;i++){var g=a[i];this._path+=(i==0?'':' ')+g[0]+','+g[1]+' '+g[2]+' '+(g[3]?'1':'0')+','+(g[4]?'1':'0')+' '+g[5]+','+g[6]}}else{this._path+=a+','+b+' '+c+' '+(d?'1':'0')+','+(e?'1':'0')+' '+x+','+y}return this},close:function(){this._path+='z';return this},path:function(){return this._path}});SVGPath.prototype.moveTo=SVGPath.prototype.move;SVGPath.prototype.lineTo=SVGPath.prototype.line;SVGPath.prototype.horizTo=SVGPath.prototype.horiz;SVGPath.prototype.vertTo=SVGPath.prototype.vert;SVGPath.prototype.curveCTo=SVGPath.prototype.curveC;SVGPath.prototype.smoothCTo=SVGPath.prototype.smoothC;SVGPath.prototype.curveQTo=SVGPath.prototype.curveQ;SVGPath.prototype.smoothQTo=SVGPath.prototype.smoothQ;SVGPath.prototype.arcTo=SVGPath.prototype.arc;function SVGText(){this._parts=[]}$.extend(SVGText.prototype,{reset:function(){this._parts=[];return this},string:function(a){this._parts[this._parts.length]=['text',a];return this},span:function(a,b){this._parts[this._parts.length]=['tspan',a,b];return this},ref:function(a,b){this._parts[this._parts.length]=['tref',a,b];return this},path:function(a,b,c){this._parts[this._parts.length]=['textpath',b,$.extend({href:a},c||{})];return this}});$.fn.svg=function(a){var b=Array.prototype.slice.call(arguments,1);if(typeof a=='string'&&a=='get'){return $.svg['_'+a+'SVG'].apply($.svg,[this[0]].concat(b))}return this.each(function(){if(typeof a=='string'){$.svg['_'+a+'SVG'].apply($.svg,[this].concat(b))}else{$.svg._attachSVG(this,a||{})}})};function isArray(a){return(a&&a.constructor==Array)}$.svg=new SVGManager()})(jQuery);
\ No newline at end of file
Added: CometVisu/trunk/visu/plugins/clock/clock_pure.svg
===================================================================
--- CometVisu/trunk/visu/plugins/clock/clock_pure.svg (rev 0)
+++ CometVisu/trunk/visu/plugins/clock/clock_pure.svg 2012-02-12 14:07:04 UTC (rev 699)
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="100"
+ height="100"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.2 r9819"
+ sodipodi:docname="clock_pure.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2.8"
+ inkscape:cx="44.568338"
+ inkscape:cy="48.518422"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer3"
+ showgrid="false"
+ inkscape:window-width="1920"
+ inkscape:window-height="1143"
+ inkscape:window-x="-2"
+ inkscape:window-y="-3"
+ inkscape:window-maximized="1"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:groupmode="layer"
+ id="layer3"
+ inkscape:label="Background">
+ <path
+ transform="translate(0.03125,-952.40625)"
+ id="Hintergrund"
+ style="fill:none;stroke:#808080;stroke-width:0.98233086000000003px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 74.321962,959.2342 -4.509945,7.81145 m -62.438896,10.12744 7.811454,4.50995 m 84.325395,20.17806 -9.01989,0 m -83.616959,24.822 7.811454,-4.51 m 60.503413,22.8148 -4.509945,-7.8114 M 49.5,1051.8711 l 0,-9.0199 m -23.821962,2.6367 4.509945,-7.8114 m 62.438896,-10.1275 -7.811454,-4.5099 m -84.325375,-20.178 9.01989,0 m 83.616939,-24.82198 -7.811454,4.50994 m -60.503413,-22.81486 4.509945,7.81145 M 50.5,952.85113 l 0,9.01989 m 0,-9.01989 0,9.01989 m 49.055278,40.49118 c 0,27.3686 -22.186656,49.5553 -49.555277,49.5553 -27.368622,0 -49.5552734,-22.1867 -49.5552734,-49.5553 0,-27.36865 22.1866514,-49.55529 49.5552734,-49.55529 27.368621,0 49.555277,22.18664 49.555277,49.55529 z"
+ inkscape:connector-curvature="0" />
+ <g
+ id="Hour"
+ inkscape:label="#g9002">
+ <path
+ transform="matrix(1.1005583,0,0,1.1005583,-5.8332726,-1051.5177)"
+ d="m 59.346463,978.11597 a 8.586297,8.586297 0 1 1 -17.172594,0 8.586297,8.586297 0 1 1 17.172594,0 z"
+ sodipodi:ry="8.586297"
+ sodipodi:rx="8.586297"
+ sodipodi:cy="978.11597"
+ sodipodi:cx="50.760166"
+ id="HotSpotHour"
+ style="color:#000000;fill:#0000ff;stroke:#0000ff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ sodipodi:type="arc" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path2991"
+ d="M 50,50 50,25"
+ style="fill:none;stroke:#ff0000;stroke-width:1.45699584px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ </g>
+ <g
+ id="Minute"
+ inkscape:label="#g9008">
+ <path
+ transform="matrix(1.0789434,0,0,0.79610074,-4.1911507,-758.75808)"
+ d="m 59.093924,962.45862 a 8.8388348,8.8388348 0 1 1 -17.67767,0 8.8388348,8.8388348 0 1 1 17.67767,0 z"
+ sodipodi:ry="8.8388348"
+ sodipodi:rx="8.8388348"
+ sodipodi:cy="962.45862"
+ sodipodi:cx="50.255089"
+ id="HotSpotMinute"
+ style="color:#000000;fill:#0000ff;stroke:#0000ff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ sodipodi:type="arc" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path2989"
+ d="M 50,50 50,5"
+ style="fill:none;stroke:#ff0000;stroke-width:0.92645031px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ </g>
+ </g>
+</svg>
Added: CometVisu/trunk/visu/plugins/clock/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/clock/structure_plugin.js (rev 0)
+++ CometVisu/trunk/visu/plugins/clock/structure_plugin.js 2012-02-12 14:07:04 UTC (rev 699)
@@ -0,0 +1,136 @@
+/* structure_plugin.js (c) 2010 by Christian Mayer [CometVisu at ChristianMayer dot de]
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+*/
+
+/**
+ * This is a custom function that extends the available widgets.
+ * It's purpose is to change the design of the visu during runtime
+ * to demonstrate all available
+ */
+VisuDesign_Custom.prototype.addCreator("clock", {
+ that: this,
+ create: function( page, path ) {
+ var that = this;
+ var $p = $(page);
+ var ret_val = $('<div class="widget clearfix clock" />');
+ ret_val.setWidgetLayout($p);
+ var labelElement = $p.find('label')[0];
+ var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
+ var address = {};
+ $p.find('address').each( function(){
+ var src = this.textContent;
+ var transform = this.getAttribute('transform');
+ var color = this.getAttribute('variant' );
+ var readonly = this.getAttribute('readonly' );
+ ga_list.push( src );
+ address[ '_' + src ] = [ transform, color, readonly=='true' ];
+ });
+
+ var actor = '<div class="actor" style="width:200px;">';
+ actor += '</div>';
+ var datatype = $(page).attr('datatype');
+ var $actor = $(actor)
+ .data({
+ 'address' : address,
+ 'type' : 'clock'
+ });
+ $actor.svg({loadURL:'plugins/clock/clock_pure.svg',onLoad:function(svg){
+ $( svg.getElementById('HotSpotHour' ) )
+ .draggable()
+ .bind('drag', {type: 'hour' ,actor:$actor}, that.dragHelper )
+ .bind('dragstop', {actor:$actor}, that.action );
+ $( svg.getElementById('HotSpotMinute') )
+ .draggable()
+ .bind('drag', {type: 'minute',actor:$actor}, that.dragHelper )
+ .bind('dragstop', {actor:$actor}, that.action );
+ }});
+
+ for( var addr in address )
+ {
+ if( !address[addr][2] ) $actor.bind( addr, this.update ); // no writeonly
+ $actor.bind( addr, this.update ); // no writeonly
+ }
+
+ ret_val.append(label).append( $actor );
+ return ret_val;
+ },
+ update: function(e,d) {
+ var element = $(this);
+ var value = defaultUpdate( e, d, element );
+ var $svg = element.find('svg');
+ var time = value.split(':');
+ $svg.children().find('#Hour' ).attr('transform','rotate('+((time[0]%12)*360/12+time[1]*30/60)+',50,50)');
+ $svg.children().find('#Minute').attr('transform','rotate('+(time[1]*6)+',50,50)');
+ },
+ dragHelper:function(event,ui) {
+ var $container = event.data.actor;
+ var $svg = $container.find('svg');
+ var x = event.originalEvent.pageX - $svg.offset().left - 50;
+ var y = 50 - (event.originalEvent.pageY - $svg.offset().top);
+ var angle = (Math.atan2( x, y ) * 180 / Math.PI + 360) % 360;
+ var time = $container.data('value');
+ var told = time.toString();
+ if( event.data.type == 'hour' )
+ {
+ var oldHours = time.getHours();
+ var pm = oldHours >= 12;
+ var hours = Math.floor( angle/30 );
+ var minutes = (angle%30) * 2;
+
+ if( oldHours%12 > 9 && hours < 3 )
+ {
+ if( pm ) { pm = false; time.setDate( time.getDate() + 1 ); }
+ else { pm = true ; }
+ } else if ( hours > 9 && oldHours%12 < 3 )
+ {
+ if( pm ) { pm = false; }
+ else { pm = true ; time.setDate( time.getDate() - 1 ); }
+ }
+
+ time.setHours( hours + pm * 12 );
+ time.setMinutes( minutes );
+ } else { // minute
+ var minutes = Math.round( angle/6 );
+ var oldMinutes = time.getMinutes();
+
+ if( oldMinutes > 45 && minutes < 15 )
+ time.setHours( time.getHours() + 1 );
+ else if( minutes > 45 && oldMinutes < 15 )
+ time.setHours( time.getHours() - 1 );
+
+ time.setMinutes( minutes );
+ }
+ $container.find('#Hour' ).attr('transform','rotate('+((time.getHours()%12)*360/12+time.getMinutes()*30/60)+',50,50)');
+ $container.find('#Minute').attr('transform','rotate('+(time.getMinutes()*6)+',50,50)');
+ },
+ action: function( event, ui ) {
+ var data = event.data.actor.data(); //$(this).data();
+ for( var addr in data.address )
+ {
+ if( data.address[addr][1] == true ) continue; // skip read only
+ visu.write( addr.substr(1), transformEncode( data.address[addr][0], data.value ) );
+ }
+ },
+ attributes: {
+ rowspan: { type: 'numeric', required: false },
+ colspan: { type: 'numeric', required: false }
+ },
+ elements: {
+ label: { type: 'string', required: true, multi: false },
+ address: { type: 'address', required: true, multi: true }
+ },
+ content: false
+});
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2012-02-11 20:53:56
|
Revision: 698
http://openautomation.svn.sourceforge.net/openautomation/?rev=698&view=rev
Author: j-n-k
Date: 2012-02-11 20:53:50 +0000 (Sat, 11 Feb 2012)
Log Message:
-----------
Added changes by JNK to Changelog
Modified Paths:
--------------
CometVisu/trunk/ChangeLog
Modified: CometVisu/trunk/ChangeLog
===================================================================
--- CometVisu/trunk/ChangeLog 2012-02-11 20:40:34 UTC (rev 697)
+++ CometVisu/trunk/ChangeLog 2012-02-11 20:53:50 UTC (rev 698)
@@ -1,8 +1,13 @@
HEAD
====
--
+- New feature: colspan (column-width is 8.33333%, i.e. 1/12)
+- New feature: rowspan (row-height is height of <text>-widget)
+- Added rsslog-plugin
+- New design: pitchblack (needs config-rewrite)
+- diagram-Plugin: yaxismin, yaxismax, added diagram_info
+
0.6.1
=====
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tho...@us...> - 2012-02-11 20:40:40
|
Revision: 697
http://openautomation.svn.sourceforge.net/openautomation/?rev=697&view=rev
Author: thomas_s
Date: 2012-02-11 20:40:34 +0000 (Sat, 11 Feb 2012)
Log Message:
-----------
refactored code: used lock_guard in xplmessagequeue
deleted unused iterface class
Modified Paths:
--------------
xPLHAL/branches/thomas_s_dev/src/xplmessagequeue.cpp
xPLHAL/branches/thomas_s_dev/src/xplmessagequeue.h
Removed Paths:
-------------
xPLHAL/branches/thomas_s_dev/src/i_properties.h
Deleted: xPLHAL/branches/thomas_s_dev/src/i_properties.h
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/i_properties.h 2012-02-11 20:39:47 UTC (rev 696)
+++ xPLHAL/branches/thomas_s_dev/src/i_properties.h 2012-02-11 20:40:34 UTC (rev 697)
@@ -1,20 +0,0 @@
-#pragma once
-
-//! \brief Properties Interface
-class IProperties
-{
- public:
- virtual ~IProperties() {};
-
- /** \returns true if the element name exists. */
- virtual bool hasValue(const std::string& name) const = 0;
-
- /** \returns the value of element name if it exists - or an empty std::string otherwise. */
- virtual std::string getValue(const std::string& name) const = 0;
-
- /** \brief sets value of property */
- virtual void setValue(const std::string& name, const std::string& value) = 0;
-
- /** \brief deletes property */
- virtual void deleteProperty(const std::string& name) = 0;
-};
Modified: xPLHAL/branches/thomas_s_dev/src/xplmessagequeue.cpp
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/xplmessagequeue.cpp 2012-02-11 20:39:47 UTC (rev 696)
+++ xPLHAL/branches/thomas_s_dev/src/xplmessagequeue.cpp 2012-02-11 20:40:34 UTC (rev 697)
@@ -17,13 +17,15 @@
*/
#include "log.h"
-
#include "xplmessagequeue.h"
+using std::mutex;
+using std::lock_guard;
+
void xPLMessageQueueClass::add( const xPLMessagePtr& message )
{
writeLog("xPLMessageQueueClass::add", logLevel::debug);
- lock_guard locker( queueLock ); // get exclusive access to the queue
+ lock_guard<mutex> locker( queueLock ); // get exclusive access to the queue
xPLMessages.push( message );
}
@@ -31,7 +33,7 @@
{
xPLMessagePtr message;
{
- lock_guard locker( queueLock ); // get exclusive access to the queue
+ lock_guard<mutex> locker( queueLock ); // get exclusive access to the queue
if( xPLMessages.empty() )
return 0;
message = xPLMessages.front(); // and release is as soon as possible
Modified: xPLHAL/branches/thomas_s_dev/src/xplmessagequeue.h
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/xplmessagequeue.h 2012-02-11 20:39:47 UTC (rev 696)
+++ xPLHAL/branches/thomas_s_dev/src/xplmessagequeue.h 2012-02-11 20:40:34 UTC (rev 697)
@@ -20,11 +20,8 @@
#include <vector>
#include <queue>
#include <string>
+#include <thread>
-#include <boost/shared_ptr.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/locks.hpp>
-
#include "xplmessage.h"
/**
@@ -33,8 +30,7 @@
class xPLMessageQueueClass
{
/** \brief variable to ensure that the queue is thread save... */
- mutable boost::mutex queueLock;
- typedef boost::lock_guard<boost::mutex> lock_guard;
+ mutable std::mutex queueLock;
std::queue<xPLMessagePtr> xPLMessages;
public:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tho...@us...> - 2012-02-11 20:39:56
|
Revision: 696
http://openautomation.svn.sourceforge.net/openautomation/?rev=696&view=rev
Author: thomas_s
Date: 2012-02-11 20:39:47 +0000 (Sat, 11 Feb 2012)
Log Message:
-----------
added determinator object with basic parsing of xml determinators
Modified Paths:
--------------
xPLHAL/branches/thomas_s_dev/src/CMakeLists.txt
xPLHAL/branches/thomas_s_dev/test/CMakeLists.txt
xPLHAL/branches/thomas_s_dev/test/test_devicemanager.cpp
Added Paths:
-----------
xPLHAL/branches/thomas_s_dev/src/determinator.cpp
xPLHAL/branches/thomas_s_dev/src/determinator.h
xPLHAL/branches/thomas_s_dev/src/determinatoritems.cpp
xPLHAL/branches/thomas_s_dev/src/determinatoritems.h
xPLHAL/branches/thomas_s_dev/src/pugiconfig.hpp
xPLHAL/branches/thomas_s_dev/src/pugixml.cpp
xPLHAL/branches/thomas_s_dev/src/pugixml.hpp
xPLHAL/branches/thomas_s_dev/test/determinator1.xml
xPLHAL/branches/thomas_s_dev/test/determinator2.xml
xPLHAL/branches/thomas_s_dev/test/determinatorDesc.xml
xPLHAL/branches/thomas_s_dev/test/test_determinator.cpp
Modified: xPLHAL/branches/thomas_s_dev/src/CMakeLists.txt
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/CMakeLists.txt 2012-02-11 19:40:21 UTC (rev 695)
+++ xPLHAL/branches/thomas_s_dev/src/CMakeLists.txt 2012-02-11 20:39:47 UTC (rev 696)
@@ -17,11 +17,12 @@
project(xPLHAL)
cmake_minimum_required(VERSION 2.6)
-#set(CMAKE_CXX_FLAGS "-g -O2 -std=c++0x")
-set(CMAKE_CXX_FLAGS "-g -Os -std=c++0x")
+set(CMAKE_CXX_FLAGS "-g -std=c++0x")
+#set(CMAKE_CXX_FLAGS "-g -Os -std=c++0x")
set(xPLHAL_SRCS xplmessagequeue.cpp devicemanager.cpp
xplhandler.cpp xplcache.cpp xhcpthread.cpp log.cpp
- xhcp.cpp xplmessage.cpp recurring_timer.cpp main.cpp)
+ xhcp.cpp xplmessage.cpp recurring_timer.cpp main.cpp pugixml.cpp
+ determinatoritems.cpp determinator.cpp)
add_executable(xPLHAL ${xPLHAL_SRCS})
#message(STATUS "Boost_LIBRARIES=${Boost_LIBRARIES}")
Added: xPLHAL/branches/thomas_s_dev/src/determinator.cpp
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/determinator.cpp (rev 0)
+++ xPLHAL/branches/thomas_s_dev/src/determinator.cpp 2012-02-11 20:39:47 UTC (rev 696)
@@ -0,0 +1,111 @@
+#include "determinator.h"
+#include <iostream>
+#include <cxxabi.h>
+#include <typeinfo>
+#include <memory>
+
+using std::string;
+using std::vector;
+using std::cerr;
+using std::endl;
+
+void Determinator::printDeterminator() const
+{
+ cerr << "Determinator '" << name << "'";
+ cerr << "\n guid: " << guid;
+ cerr << "\n name: " << name;
+ cerr << "\n description: " << description;
+ cerr << "\n enabled: " << enabled;
+
+ cerr << "\n Inputs:\n";
+ for (auto input : inputs) {
+ cerr << " " << input.second->toString() << endl;
+ }
+
+ cerr << "\n Outputs:\n";
+ for (auto output : outputs) {
+ cerr << " " << output.second->toString() << endl;
+ }
+
+ cerr << endl;
+}
+
+DeterminatorXmlParser::DeterminatorXmlParser(const string& filename)
+{
+ registerCondition(BaseDeterminatorItemConstPtr(new XplCondition));
+ registerCondition(BaseDeterminatorItemConstPtr(new GlobalCondition));
+ registerCondition(BaseDeterminatorItemConstPtr(new GlobalChanged));
+ registerCondition(BaseDeterminatorItemConstPtr(new DayCondition));
+ registerCondition(BaseDeterminatorItemConstPtr(new TimeCondition));
+
+ registerAction(BaseDeterminatorItemConstPtr(new LogAction));
+
+ pugi::xml_parse_result result = m_doc.load_file(filename.c_str());
+ cerr << "Load result: " << result.description() << "\n";
+}
+
+void DeterminatorXmlParser::registerCondition(BaseDeterminatorItemConstPtr condition)
+{
+ m_conditionmap[condition->item_name] = condition;
+}
+
+void DeterminatorXmlParser::registerAction(BaseDeterminatorItemConstPtr action)
+{
+ m_actionmap[action->item_name] = action;
+}
+
+Determinator DeterminatorXmlParser::parse()
+{
+ try {
+ pugi::xml_node base = getNode(m_doc, "xplDeterminator");
+ pugi::xml_node base_d = getNode(base, "determinator");
+
+ bool isGroup = base_d.attribute("isGroup").value() == "Y";
+
+ if (isGroup == false) {
+ Determinator d;
+ d.guid = base_d.attribute("guid").value();
+ d.name = base_d.attribute("name").value();
+ d.description = base_d.attribute("description").value();
+ d.enabled = base_d.attribute("guid").value() == "Y";
+
+ pugi::xml_node input = base_d.child("input");
+ pugi::xml_node output = base_d.child("output");
+
+ for(auto condition : m_conditionmap) {
+ pugi::xml_node action_node = input.child(condition.first.c_str());
+ if (action_node) {
+ d.inputs.insert({condition.first, BaseDeterminatorItemPtr(condition.second->createNew(action_node))} );
+ }
+ }
+ for(auto action : m_actionmap) {
+ pugi::xml_node action_node = output.child(action.first.c_str());
+ if (action_node) {
+ d.outputs.insert({action.first, BaseDeterminatorItemPtr(action.second->createNew(action_node))} );
+ }
+ }
+
+ d.printDeterminator();
+ return d;
+ }
+
+ }
+ catch(const std::exception& e) {
+ int status;
+ char* realname = abi::__cxa_demangle(typeid(e).name(), 0, 0, &status);
+ cerr << "Exception: " << realname << " => " << e.what() << endl;
+ throw;
+ }
+
+}
+
+
+pugi::xml_node DeterminatorXmlParser::getNode(const pugi::xml_node& base, const string& childname)
+{
+ pugi::xml_node node = base.child(childname.c_str());
+ if (!node) {
+ throw DeterminatorParseException("node '" + childname +"' not found");
+ }
+ return node;
+}
+
Added: xPLHAL/branches/thomas_s_dev/src/determinator.h
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/determinator.h (rev 0)
+++ xPLHAL/branches/thomas_s_dev/src/determinator.h 2012-02-11 20:39:47 UTC (rev 696)
@@ -0,0 +1,41 @@
+#pragma once
+#include "pugixml.hpp"
+#include "determinatoritems.h"
+#include <string>
+#include <vector>
+#include <map>
+
+class Determinator
+{
+ public:
+ enum class match_type { ALL, ANY };
+
+ void printDeterminator() const;
+
+ std::string guid;
+ std::string name;
+ std::string description;
+ bool enabled;
+ match_type input_match_type;
+
+ std::multimap<std::string, BaseDeterminatorItemPtr> inputs;
+ std::multimap<std::string, BaseDeterminatorItemPtr> outputs;
+};
+
+class DeterminatorXmlParser
+{
+ public:
+ DeterminatorXmlParser(const std::string& filename);
+
+ void registerCondition(BaseDeterminatorItemConstPtr condition);
+ void registerAction(BaseDeterminatorItemConstPtr action);
+ Determinator parse();
+
+ private:
+ pugi::xml_node getNode(const pugi::xml_node& base, const std::string& childname);
+
+ pugi::xml_document m_doc;
+ std::map<std::string, std::shared_ptr<const BaseDeterminatorItem>> m_conditionmap;
+ std::map<std::string, std::shared_ptr<const BaseDeterminatorItem>> m_actionmap;
+};
+
Added: xPLHAL/branches/thomas_s_dev/src/determinatoritems.cpp
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/determinatoritems.cpp (rev 0)
+++ xPLHAL/branches/thomas_s_dev/src/determinatoritems.cpp 2012-02-11 20:39:47 UTC (rev 696)
@@ -0,0 +1,277 @@
+#include "determinatoritems.h"
+#include <cxxabi.h>
+#include <iostream>
+#include <typeinfo>
+#include <iostream>
+
+using std::string;
+using std::vector;
+
+ConditionParseException::ConditionParseException(const string& text)
+:m_text(text)
+{
+}
+
+const char* ConditionParseException::what() const throw()
+{
+ return m_text.c_str();
+
+}
+
+DeterminatorParseException::DeterminatorParseException(const string& text)
+:m_text(text)
+{
+}
+
+const char* DeterminatorParseException::what() const throw()
+{
+ return m_text.c_str();
+}
+
+
+class ScopedXmlAttributeGetter
+{
+ public:
+ ScopedXmlAttributeGetter(const pugi::xml_node& basenode) :m_basenode(basenode) {}
+ string get(const string& attribute_name) const {
+ pugi::xml_attribute xml_attribute = m_basenode.attribute(attribute_name.c_str());
+ if (!xml_attribute) {
+ string error_text = string("In node '") + m_basenode.name() + "'";
+ error_text += " attribute '" + attribute_name + "' was not found";
+ throw ConditionParseException(error_text);
+ }
+ return xml_attribute.value();
+ }
+ private:
+ const pugi::xml_node& m_basenode;
+};
+
+BaseDeterminatorItem::BaseDeterminatorItem(const string& name)
+:item_name(name)
+{
+}
+
+BaseDeterminatorItem::BaseDeterminatorItem(const pugi::xml_node& basenode, const string& name)
+:item_name(name)
+{
+ ScopedXmlAttributeGetter a(basenode);
+ display_name = a.get("display_name");
+}
+
+/*
+ * Determinator Conditions
+ */
+
+XplCondition::XplCondition()
+:BaseDeterminatorItem("xplCondition")
+{
+}
+
+XplCondition::XplCondition(const pugi::xml_node& basenode)
+:BaseDeterminatorItem(basenode, "xplCondition")
+{
+ parseFromXml(basenode);
+}
+
+BaseDeterminatorItemPtr XplCondition::createNew(const pugi::xml_node& basenode) const
+{
+ return BaseDeterminatorItemPtr(new XplCondition(basenode));
+}
+
+void XplCondition::parseFromXml(const pugi::xml_node& basenode)
+{
+ ScopedXmlAttributeGetter helper(basenode);
+ msg_type = helper.get("msg_type");
+ source_vendor = helper.get("source_vendor");
+ source_device = helper.get("source_device");
+ source_instance = helper.get("source_instance");
+ target_vendor = helper.get("target_vendor");
+ target_device = helper.get("target_device");
+ target_instance = helper.get("target_instance");
+ schema_class = helper.get("schema_class");
+ schema_type = helper.get("schema_type");
+
+ for(const auto node : basenode) {
+ if (node.name() == string("param")) {
+ struct parameter p;
+ ScopedXmlAttributeGetter pa(node);
+ p.name = pa.get("name");
+ p.op = pa.get("operator");
+ p.value = pa.get("value");
+ parameter.push_back(p);
+ }
+ }
+}
+
+string XplCondition::toString() const
+{
+ string ret = "xplCondition:";
+ ret += "\nmsg_type: " + msg_type;
+ ret += "\nsource_vendor: " + source_vendor;
+ ret += "\nsource_device: " + source_device;
+ ret += "\nsource_instance: " + source_instance;
+ ret += "\ntarget_vendor: " + target_vendor;
+ ret += "\ntarget_device: " + target_device;
+ ret += "\ntarget_instance: " + target_instance;
+ ret += "\nschema_class: " + schema_class;
+ ret += "\nschema_type: " + schema_type;
+ for (auto p : parameter) {
+ ret +="\nparameter: " + p.name + p.op + p.value;
+ }
+ return ret;
+}
+
+
+GlobalCondition::GlobalCondition()
+:BaseDeterminatorItem("globalCondition")
+{
+}
+
+GlobalCondition::GlobalCondition(const pugi::xml_node& basenode)
+:BaseDeterminatorItem(basenode, "globalCondition")
+{
+ parseFromXml(basenode);
+}
+
+BaseDeterminatorItemPtr GlobalCondition::createNew(const pugi::xml_node& basenode) const
+{
+ return BaseDeterminatorItemPtr(new GlobalCondition(basenode));
+}
+
+void GlobalCondition::parseFromXml(const pugi::xml_node& basenode)
+{
+ name = basenode.attribute("name").value();
+ op = basenode.attribute("operator").value();
+ value = basenode.attribute("value").value();
+}
+
+string GlobalCondition::toString() const
+{
+ string ret = item_name + ":";
+ ret += "\nname: " + name;
+ ret += "\noperator: " + op;
+ ret += "\nvalue: " + value;
+ return ret;
+}
+
+GlobalChanged::GlobalChanged()
+:BaseDeterminatorItem("globalChanged")
+{
+}
+
+GlobalChanged::GlobalChanged(const pugi::xml_node& basenode)
+:BaseDeterminatorItem(basenode, "globalChanged")
+{
+ parseFromXml(basenode);
+}
+
+BaseDeterminatorItemPtr GlobalChanged::createNew(const pugi::xml_node& basenode) const
+{
+ return BaseDeterminatorItemPtr(new GlobalChanged(basenode));
+}
+
+void GlobalChanged::parseFromXml(const pugi::xml_node& basenode)
+{
+ name = basenode.attribute("name").value();
+}
+
+string GlobalChanged::toString() const
+{
+ string ret = item_name + ":";
+ ret += "\nname: " + name;
+ return ret;
+}
+
+
+DayCondition::DayCondition()
+:BaseDeterminatorItem("dayCondition")
+{
+}
+
+DayCondition::DayCondition(const pugi::xml_node& basenode)
+:BaseDeterminatorItem(basenode, "dayCondition")
+{
+ parseFromXml(basenode);
+}
+
+BaseDeterminatorItemPtr DayCondition::createNew(const pugi::xml_node& basenode) const
+{
+ return BaseDeterminatorItemPtr(new DayCondition(basenode));
+}
+
+void DayCondition::parseFromXml(const pugi::xml_node& basenode)
+{
+ dow = basenode.attribute("dow").value();
+}
+
+string DayCondition::toString() const
+{
+ string ret = item_name + ":";
+ ret += "\ndow: " + dow;
+ return ret;
+}
+
+TimeCondition::TimeCondition()
+:BaseDeterminatorItem("timeCondition")
+{
+}
+
+TimeCondition::TimeCondition(const pugi::xml_node& basenode)
+ :BaseDeterminatorItem(basenode, "timeCondition")
+{
+ parseFromXml(basenode);
+}
+
+BaseDeterminatorItemPtr TimeCondition::createNew(const pugi::xml_node& basenode) const
+{
+ return BaseDeterminatorItemPtr(new TimeCondition(basenode));
+}
+
+void TimeCondition::parseFromXml(const pugi::xml_node& basenode)
+{
+ op = basenode.attribute("operator").value();
+ value = basenode.attribute("value").value();
+}
+
+string TimeCondition::toString() const
+{
+ string ret = item_name + ":";
+ ret += "\noperator: " + op;
+ ret += "\nvalue...: " + value;
+ return ret;
+}
+
+/*
+ * Determinator Actions
+ */
+
+LogAction::LogAction()
+:BaseDeterminatorItem("logAction")
+{
+}
+
+LogAction::LogAction(const pugi::xml_node& basenode)
+:BaseDeterminatorItem(basenode, "logAction")
+{
+ parseFromXml(basenode);
+}
+
+BaseDeterminatorItemPtr LogAction::createNew(const pugi::xml_node& basenode) const
+{
+ return BaseDeterminatorItemPtr(new LogAction(basenode));
+}
+
+void LogAction::parseFromXml(const pugi::xml_node& basenode)
+{
+ logText = basenode.attribute("logText").value();
+ executeOrder = basenode.attribute("executeOrder").value();
+}
+
+std::string LogAction::toString() const
+{
+ string ret = item_name + ":";
+ ret += "\nlogText.....: " + logText;
+ ret += "\nexecuteOrder: " + executeOrder;
+ return ret;
+}
+
Added: xPLHAL/branches/thomas_s_dev/src/determinatoritems.h
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/determinatoritems.h (rev 0)
+++ xPLHAL/branches/thomas_s_dev/src/determinatoritems.h 2012-02-11 20:39:47 UTC (rev 696)
@@ -0,0 +1,149 @@
+#pragma once
+#include "pugixml.hpp"
+#include <string>
+#include <vector>
+#include <memory>
+
+class ConditionParseException: public std::exception
+{
+ public:
+ ConditionParseException(const std::string& text);
+ virtual ~ConditionParseException() throw() {}
+ const char* what() const throw();
+ private:
+ std::string m_text;
+};
+
+class DeterminatorParseException: public std::exception
+{
+ public:
+ DeterminatorParseException(const std::string& text);
+ virtual ~DeterminatorParseException() throw() {}
+ const char* what() const throw();
+ private:
+ std::string m_text;
+};
+
+class BaseDeterminatorItem;
+typedef std::shared_ptr<BaseDeterminatorItem> BaseDeterminatorItemPtr;
+typedef std::shared_ptr<const BaseDeterminatorItem> BaseDeterminatorItemConstPtr;
+
+class BaseDeterminatorItem
+{
+ public:
+ BaseDeterminatorItem(const std::string& name);
+ BaseDeterminatorItem(const pugi::xml_node& basenode, const std::string& name);
+
+ virtual void parseFromXml(const pugi::xml_node& basenode) = 0;
+ virtual BaseDeterminatorItemPtr createNew(const pugi::xml_node& basenode) const = 0;
+ virtual std::string toString() const = 0;
+
+ std::string item_name;
+ std::string display_name;
+
+ //boost::signal2::signal<void ()> sigChanged;
+};
+
+class XplCondition: public BaseDeterminatorItem
+{
+ public:
+ XplCondition();
+ XplCondition(const pugi::xml_node& basenode);
+
+ virtual BaseDeterminatorItemPtr createNew(const pugi::xml_node& basenode) const;
+
+ void parseFromXml(const pugi::xml_node& basenode);
+
+ std::string toString() const;
+
+ /* connect to signal of new xpl-message */
+ std::string msg_type;
+ std::string source_vendor;
+ std::string source_device;
+ std::string source_instance;
+ std::string target_vendor;
+ std::string target_device;
+ std::string target_instance;
+ std::string schema_class;
+ std::string schema_type;
+
+ struct parameter {
+ std::string name;
+ std::string op;
+ std::string value;
+ };
+
+ std::vector<struct parameter> parameter;
+};
+
+class GlobalCondition: public BaseDeterminatorItem
+{
+ public:
+ GlobalCondition();
+ GlobalCondition(const pugi::xml_node& basenode);
+
+ virtual BaseDeterminatorItemPtr createNew(const pugi::xml_node& basenode) const;
+
+ void parseFromXml(const pugi::xml_node& basenode);
+
+ std::string toString() const;
+
+ std::string name;
+ std::string op;
+ std::string value;
+};
+
+class GlobalChanged: public BaseDeterminatorItem
+{
+ public:
+ /* connect to signal of changed global variable */
+ GlobalChanged();
+ GlobalChanged(const pugi::xml_node& basenode);
+
+ virtual BaseDeterminatorItemPtr createNew(const pugi::xml_node& basenode) const;
+ void parseFromXml(const pugi::xml_node& basenode);
+ std::string toString() const;
+
+ std::string name;
+};
+
+class DayCondition: public BaseDeterminatorItem
+{
+ public:
+ DayCondition();
+ DayCondition(const pugi::xml_node& basenode);
+
+ virtual BaseDeterminatorItemPtr createNew(const pugi::xml_node& basenode) const;
+ void parseFromXml(const pugi::xml_node& basenode);
+ std::string toString() const;
+
+ std::string dow;
+};
+
+class TimeCondition: public BaseDeterminatorItem
+{
+ public:
+ TimeCondition();
+ TimeCondition(const pugi::xml_node& basenode);
+
+ virtual BaseDeterminatorItemPtr createNew(const pugi::xml_node& basenode) const;
+ void parseFromXml(const pugi::xml_node& basenode);
+ std::string toString() const;
+
+ std::string op;
+ std::string value;
+};
+
+class LogAction: public BaseDeterminatorItem
+{
+ public:
+ LogAction();
+ LogAction(const pugi::xml_node& basenode);
+
+ virtual BaseDeterminatorItemPtr createNew(const pugi::xml_node& basenode) const;
+ void parseFromXml(const pugi::xml_node& basenode);
+ std::string toString() const;
+
+ std::string logText;
+ std::string executeOrder;
+};
Added: xPLHAL/branches/thomas_s_dev/src/pugiconfig.hpp
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/pugiconfig.hpp (rev 0)
+++ xPLHAL/branches/thomas_s_dev/src/pugiconfig.hpp 2012-02-11 20:39:47 UTC (rev 696)
@@ -0,0 +1,62 @@
+/**
+ * pugixml parser - version 1.0
+ * --------------------------------------------------------
+ * Copyright (C) 2006-2010, by Arseny Kapoulkine (ars...@gm...)
+ * Report bugs and download new versions at http://pugixml.org/
+ *
+ * This library is distributed under the MIT License. See notice at the end
+ * of this file.
+ *
+ * This work is based on the pugxml parser, which is:
+ * Copyright (C) 2003, by Kristen Wegner (kr...@ti...)
+ */
+
+#ifndef HEADER_PUGICONFIG_HPP
+#define HEADER_PUGICONFIG_HPP
+
+// Uncomment this to enable wchar_t mode
+// #define PUGIXML_WCHAR_MODE
+
+// Uncomment this to disable XPath
+#define PUGIXML_NO_XPATH
+
+// Uncomment this to disable STL
+// Note: you can't use XPath with PUGIXML_NO_STL
+// #define PUGIXML_NO_STL
+
+// Uncomment this to disable exceptions
+// Note: you can't use XPath with PUGIXML_NO_EXCEPTIONS
+// #define PUGIXML_NO_EXCEPTIONS
+
+// Set this to control attributes for public classes/functions, i.e.:
+// #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL
+// #define PUGIXML_CLASS __declspec(dllimport) // to import all classes from DLL
+// #define PUGIXML_FUNCTION __fastcall // to set calling conventions to all public functions to fastcall
+// In absence of PUGIXML_CLASS/PUGIXML_FUNCTION definitions PUGIXML_API is used instead
+
+#endif
+
+/**
+ * Copyright (c) 2006-2010 Arseny Kapoulkine
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
Added: xPLHAL/branches/thomas_s_dev/src/pugixml.cpp
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/pugixml.cpp (rev 0)
+++ xPLHAL/branches/thomas_s_dev/src/pugixml.cpp 2012-02-11 20:39:47 UTC (rev 696)
@@ -0,0 +1,9576 @@
+/**
+ * pugixml parser - version 1.0
+ * --------------------------------------------------------
+ * Copyright (C) 2006-2010, by Arseny Kapoulkine (ars...@gm...)
+ * Report bugs and download new versions at http://pugixml.org/
+ *
+ * This library is distributed under the MIT License. See notice at the end
+ * of this file.
+ *
+ * This work is based on the pugxml parser, which is:
+ * Copyright (C) 2003, by Kristen Wegner (kr...@ti...)
+ */
+
+#include "pugixml.hpp"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <setjmp.h>
+#include <wchar.h>
+
+#ifndef PUGIXML_NO_XPATH
+# include <math.h>
+# include <float.h>
+#endif
+
+#ifndef PUGIXML_NO_STL
+# include <istream>
+# include <ostream>
+# include <string>
+#endif
+
+// For placement new
+#include <new>
+
+#ifdef _MSC_VER
+# pragma warning(disable: 4127) // conditional expression is constant
+# pragma warning(disable: 4324) // structure was padded due to __declspec(align())
+# pragma warning(disable: 4611) // interaction between '_setjmp' and C++ object destruction is non-portable
+# pragma warning(disable: 4702) // unreachable code
+# pragma warning(disable: 4996) // this function or variable may be unsafe
+#endif
+
+#ifdef __INTEL_COMPILER
+# pragma warning(disable: 177) // function was declared but never referenced
+# pragma warning(disable: 1478 1786) // function was declared "deprecated"
+#endif
+
+#ifdef __BORLANDC__
+# pragma warn -8008 // condition is always false
+# pragma warn -8066 // unreachable code
+#endif
+
+#ifdef __SNC__
+# pragma diag_suppress=178 // function was declared but never referenced
+# pragma diag_suppress=237 // controlling expression is constant
+#endif
+
+// uintptr_t
+#if !defined(_MSC_VER) || _MSC_VER >= 1600
+# include <stdint.h>
+#else
+# if _MSC_VER < 1300
+// No native uintptr_t in MSVC6
+typedef size_t uintptr_t;
+# endif
+typedef unsigned __int8 uint8_t;
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int32 uint32_t;
+typedef __int32 int32_t;
+#endif
+
+// Inlining controls
+#if defined(_MSC_VER) && _MSC_VER >= 1300
+# define PUGIXML_NO_INLINE __declspec(noinline)
+#elif defined(__GNUC__)
+# define PUGIXML_NO_INLINE __attribute__((noinline))
+#else
+# define PUGIXML_NO_INLINE
+#endif
+
+// Simple static assertion
+#define STATIC_ASSERT(cond) { static const char condition_failed[(cond) ? 1 : -1] = {0}; (void)condition_failed[0]; }
+
+// Digital Mars C++ bug workaround for passing char loaded from memory via stack
+#ifdef __DMC__
+# define DMC_VOLATILE volatile
+#else
+# define DMC_VOLATILE
+#endif
+
+using namespace pugi;
+
+// Memory allocation
+namespace
+{
+ void* default_allocate(size_t size)
+ {
+ return malloc(size);
+ }
+
+ void default_deallocate(void* ptr)
+ {
+ free(ptr);
+ }
+
+ allocation_function global_allocate = default_allocate;
+ deallocation_function global_deallocate = default_deallocate;
+}
+
+// String utilities
+namespace
+{
+ // Get string length
+ size_t strlength(const char_t* s)
+ {
+ assert(s);
+
+ #ifdef PUGIXML_WCHAR_MODE
+ return wcslen(s);
+ #else
+ return strlen(s);
+ #endif
+ }
+
+ // Compare two strings
+ bool strequal(const char_t* src, const char_t* dst)
+ {
+ assert(src && dst);
+
+ #ifdef PUGIXML_WCHAR_MODE
+ return wcscmp(src, dst) == 0;
+ #else
+ return strcmp(src, dst) == 0;
+ #endif
+ }
+
+ // Compare lhs with [rhs_begin, rhs_end)
+ bool strequalrange(const char_t* lhs, const char_t* rhs, size_t count)
+ {
+ for (size_t i = 0; i < count; ++i)
+ if (lhs[i] != rhs[i])
+ return false;
+
+ return lhs[count] == 0;
+ }
+
+#ifdef PUGIXML_WCHAR_MODE
+ // Convert string to wide string, assuming all symbols are ASCII
+ void widen_ascii(wchar_t* dest, const char* source)
+ {
+ for (const char* i = source; *i; ++i) *dest++ = *i;
+ *dest = 0;
+ }
+#endif
+}
+
+#if !defined(PUGIXML_NO_STL) || !defined(PUGIXML_NO_XPATH)
+// auto_ptr-like buffer holder for exception recovery
+namespace
+{
+ struct buffer_holder
+ {
+ void* data;
+ void (*deleter)(void*);
+
+ buffer_holder(void* data, void (*deleter)(void*)): data(data), deleter(deleter)
+ {
+ }
+
+ ~buffer_holder()
+ {
+ if (data) deleter(data);
+ }
+
+ void* release()
+ {
+ void* result = data;
+ data = 0;
+ return result;
+ }
+ };
+}
+#endif
+
+namespace
+{
+ static const size_t xml_memory_page_size = 32768;
+
+ static const uintptr_t xml_memory_page_alignment = 32;
+ static const uintptr_t xml_memory_page_pointer_mask = ~(xml_memory_page_alignment - 1);
+ static const uintptr_t xml_memory_page_name_allocated_mask = 16;
+ static const uintptr_t xml_memory_page_value_allocated_mask = 8;
+ static const uintptr_t xml_memory_page_type_mask = 7;
+
+ struct xml_allocator;
+
+ struct xml_memory_page
+ {
+ static xml_memory_page* construct(void* memory)
+ {
+ if (!memory) return 0; //$ redundant, left for performance
+
+ xml_memory_page* result = static_cast<xml_memory_page*>(memory);
+
+ result->allocator = 0;
+ result->memory = 0;
+ result->prev = 0;
+ result->next = 0;
+ result->busy_size = 0;
+ result->freed_size = 0;
+
+ return result;
+ }
+
+ xml_allocator* allocator;
+
+ void* memory;
+
+ xml_memory_page* prev;
+ xml_memory_page* next;
+
+ size_t busy_size;
+ size_t freed_size;
+
+ char data[1];
+ };
+
+ struct xml_memory_string_header
+ {
+ uint16_t page_offset; // offset from page->data
+ uint16_t full_size; // 0 if string occupies whole page
+ };
+
+ struct xml_allocator
+ {
+ xml_allocator(xml_memory_page* root): _root(root), _busy_size(root->busy_size)
+ {
+ }
+
+ xml_memory_page* allocate_page(size_t data_size)
+ {
+ size_t size = offsetof(xml_memory_page, data) + data_size;
+
+ // allocate block with some alignment, leaving memory for worst-case padding
+ void* memory = global_allocate(size + xml_memory_page_alignment);
+ if (!memory) return 0;
+
+ // align upwards to page boundary
+ void* page_memory = reinterpret_cast<void*>((reinterpret_cast<uintptr_t>(memory) + (xml_memory_page_alignment - 1)) & ~(xml_memory_page_alignment - 1));
+
+ // prepare page structure
+ xml_memory_page* page = xml_memory_page::construct(page_memory);
+
+ page->memory = memory;
+ page->allocator = _root->allocator;
+
+ return page;
+ }
+
+ static void deallocate_page(xml_memory_page* page)
+ {
+ global_deallocate(page->memory);
+ }
+
+ void* allocate_memory_oob(size_t size, xml_memory_page*& out_page);
+
+ void* allocate_memory(size_t size, xml_memory_page*& out_page)
+ {
+ if (_busy_size + size > xml_memory_page_size) return allocate_memory_oob(size, out_page);
+
+ void* buf = _root->data + _busy_size;
+
+ _busy_size += size;
+
+ out_page = _root;
+
+ return buf;
+ }
+
+ void deallocate_memory(void* ptr, size_t size, xml_memory_page* page)
+ {
+ if (page == _root) page->busy_size = _busy_size;
+
+ assert(ptr >= page->data && ptr < page->data + page->busy_size);
+ (void)!ptr;
+
+ page->freed_size += size;
+ assert(page->freed_size <= page->busy_size);
+
+ if (page->freed_size == page->busy_size)
+ {
+ if (page->next == 0)
+ {
+ assert(_root == page);
+
+ // top page freed, just reset sizes
+ page->busy_size = page->freed_size = 0;
+ _busy_size = 0;
+ }
+ else
+ {
+ assert(_root != page);
+ assert(page->prev);
+
+ // remove from the list
+ page->prev->next = page->next;
+ page->next->prev = page->prev;
+
+ // deallocate
+ deallocate_page(page);
+ }
+ }
+ }
+
+ char_t* allocate_string(size_t length)
+ {
+ // allocate memory for string and header block
+ size_t size = sizeof(xml_memory_string_header) + length * sizeof(char_t);
+
+ // round size up to pointer alignment boundary
+ size_t full_size = (size + (sizeof(void*) - 1)) & ~(sizeof(void*) - 1);
+
+ xml_memory_page* page;
+ xml_memory_string_header* header = static_cast<xml_memory_string_header*>(allocate_memory(full_size, page));
+
+ if (!header) return 0;
+
+ // setup header
+ ptrdiff_t page_offset = reinterpret_cast<char*>(header) - page->data;
+
+ assert(page_offset >= 0 && page_offset < (1 << 16));
+ header->page_offset = static_cast<uint16_t>(page_offset);
+
+ // full_size == 0 for large strings that occupy the whole page
+ assert(full_size < (1 << 16) || (page->busy_size == full_size && page_offset == 0));
+ header->full_size = static_cast<uint16_t>(full_size < (1 << 16) ? full_size : 0);
+
+ return reinterpret_cast<char_t*>(header + 1);
+ }
+
+ void deallocate_string(char_t* string)
+ {
+ // get header
+ xml_memory_string_header* header = reinterpret_cast<xml_memory_string_header*>(string) - 1;
+
+ // deallocate
+ size_t page_offset = offsetof(xml_memory_page, data) + header->page_offset;
+ xml_memory_page* page = reinterpret_cast<xml_memory_page*>(reinterpret_cast<char*>(header) - page_offset);
+
+ // if full_size == 0 then this string occupies the whole page
+ size_t full_size = header->full_size == 0 ? page->busy_size : header->full_size;
+
+ deallocate_memory(header, full_size, page);
+ }
+
+ xml_memory_page* _root;
+ size_t _busy_size;
+ };
+
+ PUGIXML_NO_INLINE void* xml_allocator::allocate_memory_oob(size_t size, xml_memory_page*& out_page)
+ {
+ const size_t large_allocation_threshold = xml_memory_page_size / 4;
+
+ xml_memory_page* page = allocate_page(size <= large_allocation_threshold ? xml_memory_page_size : size);
+ if (!page) return 0;
+
+ if (size <= large_allocation_threshold)
+ {
+ _root->busy_size = _busy_size;
+
+ // insert page at the end of linked list
+ page->prev = _root;
+ _root->next = page;
+ _root = page;
+
+ _busy_size = size;
+ }
+ else
+ {
+ // insert page before the end of linked list, so that it is deleted as soon as possible
+ // the last page is not deleted even if it's empty (see deallocate_memory)
+ assert(_root->prev);
+
+ page->prev = _root->prev;
+ page->next = _root;
+
+ _root->prev->next = page;
+ _root->prev = page;
+ }
+
+ // allocate inside page
+ page->busy_size = size;
+
+ out_page = page;
+ return page->data;
+ }
+}
+
+namespace pugi
+{
+ /// A 'name=value' XML attribute structure.
+ struct xml_attribute_struct
+ {
+ /// Default ctor
+ xml_attribute_struct(xml_memory_page* page): header(reinterpret_cast<uintptr_t>(page)), name(0), value(0), prev_attribute_c(0), next_attribute(0)
+ {
+ }
+
+ uintptr_t header;
+
+ char_t* name; ///< Pointer to attribute name.
+ char_t* value; ///< Pointer to attribute value.
+
+ xml_attribute_struct* prev_attribute_c; ///< Previous attribute (cyclic list)
+ xml_attribute_struct* next_attribute; ///< Next attribute
+ };
+
+ /// An XML document tree node.
+ struct xml_node_struct
+ {
+ /// Default ctor
+ /// \param type - node type
+ xml_node_struct(xml_memory_page* page, xml_node_type type): header(reinterpret_cast<uintptr_t>(page) | (type - 1)), parent(0), name(0), value(0), first_child(0), prev_sibling_c(0), next_sibling(0), first_attribute(0)
+ {
+ }
+
+ uintptr_t header;
+
+ xml_node_struct* parent; ///< Pointer to parent
+
+ char_t* name; ///< Pointer to element name.
+ char_t* value; ///< Pointer to any associated string data.
+
+ xml_node_struct* first_child; ///< First child
+
+ xml_node_struct* prev_sibling_c; ///< Left brother (cyclic list)
+ xml_node_struct* next_sibling; ///< Right brother
+
+ xml_attribute_struct* first_attribute; ///< First attribute
+ };
+}
+
+namespace
+{
+ struct xml_document_struct: public xml_node_struct, public xml_allocator
+ {
+ xml_document_struct(xml_memory_page* page): xml_node_struct(page, node_document), xml_allocator(page), buffer(0)
+ {
+ }
+
+ const char_t* buffer;
+ };
+
+ static inline xml_allocator& get_allocator(const xml_node_struct* node)
+ {
+ assert(node);
+
+ return *reinterpret_cast<xml_memory_page*>(node->header & xml_memory_page_pointer_mask)->allocator;
+ }
+}
+
+// Low-level DOM operations
+namespace
+{
+ inline xml_attribute_struct* allocate_attribute(xml_allocator& alloc)
+ {
+ xml_memory_page* page;
+ void* memory = alloc.allocate_memory(sizeof(xml_attribute_struct), page);
+
+ return new (memory) xml_attribute_struct(page);
+ }
+
+ inline xml_node_struct* allocate_node(xml_allocator& alloc, xml_node_type type)
+ {
+ xml_memory_page* page;
+ void* memory = alloc.allocate_memory(sizeof(xml_node_struct), page);
+
+ return new (memory) xml_node_struct(page, type);
+ }
+
+ inline void destroy_attribute(xml_attribute_struct* a, xml_allocator& alloc)
+ {
+ uintptr_t header = a->header;
+
+ if (header & xml_memory_page_name_allocated_mask) alloc.deallocate_string(a->name);
+ if (header & xml_memory_page_value_allocated_mask) alloc.deallocate_string(a->value);
+
+ alloc.deallocate_memory(a, sizeof(xml_attribute_struct), reinterpret_cast<xml_memory_page*>(header & xml_memory_page_pointer_mask));
+ }
+
+ inline void destroy_node(xml_node_struct* n, xml_allocator& alloc)
+ {
+ uintptr_t header = n->header;
+
+ if (header & xml_memory_page_name_allocated_mask) alloc.deallocate_string(n->name);
+ if (header & xml_memory_page_value_allocated_mask) alloc.deallocate_string(n->value);
+
+ for (xml_attribute_struct* attr = n->first_attribute; attr; )
+ {
+ xml_attribute_struct* next = attr->next_attribute;
+
+ destroy_attribute(attr, alloc);
+
+ attr = next;
+ }
+
+ for (xml_node_struct* child = n->first_child; child; )
+ {
+ xml_node_struct* next = child->next_sibling;
+
+ destroy_node(child, alloc);
+
+ child = next;
+ }
+
+ alloc.deallocate_memory(n, sizeof(xml_node_struct), reinterpret_cast<xml_memory_page*>(header & xml_memory_page_pointer_mask));
+ }
+
+ PUGIXML_NO_INLINE xml_node_struct* append_node(xml_node_struct* node, xml_allocator& alloc, xml_node_type type = node_element)
+ {
+ xml_node_struct* child = allocate_node(alloc, type);
+ if (!child) return 0;
+
+ child->parent = node;
+
+ xml_node_struct* first_child = node->first_child;
+
+ if (first_child)
+ {
+ xml_node_struct* last_child = first_child->prev_sibling_c;
+
+ last_child->next_sibling = child;
+ child->prev_sibling_c = last_child;
+ first_child->prev_sibling_c = child;
+ }
+ else
+ {
+ node->first_child = child;
+ child->prev_sibling_c = child;
+ }
+
+ return child;
+ }
+
+ PUGIXML_NO_INLINE xml_attribute_struct* append_attribute_ll(xml_node_struct* node, xml_allocator& alloc)
+ {
+ xml_attribute_struct* a = allocate_attribute(alloc);
+ if (!a) return 0;
+
+ xml_attribute_struct* first_attribute = node->first_attribute;
+
+ if (first_attribute)
+ {
+ xml_attribute_struct* last_attribute = first_attribute->prev_attribute_c;
+
+ last_attribute->next_attribute = a;
+ a->prev_attribute_c = last_attribute;
+ first_attribute->prev_attribute_c = a;
+ }
+ else
+ {
+ node->first_attribute = a;
+ a->prev_attribute_c = a;
+ }
+
+ return a;
+ }
+}
+
+// Helper classes for code generation
+namespace
+{
+ struct opt_false
+ {
+ enum { value = 0 };
+ };
+
+ struct opt_true
+ {
+ enum { value = 1 };
+ };
+}
+
+// Unicode utilities
+namespace
+{
+ inline uint16_t endian_swap(uint16_t value)
+ {
+ return static_cast<uint16_t>(((value & 0xff) << 8) | (value >> 8));
+ }
+
+ inline uint32_t endian_swap(uint32_t value)
+ {
+ return ((value & 0xff) << 24) | ((value & 0xff00) << 8) | ((value & 0xff0000) >> 8) | (value >> 24);
+ }
+
+ struct utf8_counter
+ {
+ typedef size_t value_type;
+
+ static value_type low(value_type result, uint32_t ch)
+ {
+ // U+0000..U+007F
+ if (ch < 0x80) return result + 1;
+ // U+0080..U+07FF
+ else if (ch < 0x800) return result + 2;
+ // U+0800..U+FFFF
+ else return result + 3;
+ }
+
+ static value_type high(value_type result, uint32_t)
+ {
+ // U+10000..U+10FFFF
+ return result + 4;
+ }
+ };
+
+ struct utf8_writer
+ {
+ typedef uint8_t* value_type;
+
+ static value_type low(value_type result, uint32_t ch)
+ {
+ // U+0000..U+007F
+ if (ch < 0x80)
+ {
+ *result = static_cast<uint8_t>(ch);
+ return result + 1;
+ }
+ // U+0080..U+07FF
+ else if (ch < 0x800)
+ {
+ result[0] = static_cast<uint8_t>(0xC0 | (ch >> 6));
+ result[1] = static_cast<uint8_t>(0x80 | (ch & 0x3F));
+ return result + 2;
+ }
+ // U+0800..U+FFFF
+ else
+ {
+ result[0] = static_cast<uint8_t>(0xE0 | (ch >> 12));
+ result[1] = static_cast<uint8_t>(0x80 | ((ch >> 6) & 0x3F));
+ result[2] = static_cast<uint8_t>(0x80 | (ch & 0x3F));
+ return result + 3;
+ }
+ }
+
+ static value_type high(value_type result, uint32_t ch)
+ {
+ // U+10000..U+10FFFF
+ result[0] = static_cast<uint8_t>(0xF0 | (ch >> 18));
+ result[1] = static_cast<uint8_t>(0x80 | ((ch >> 12) & 0x3F));
+ result[2] = static_cast<uint8_t>(0x80 | ((ch >> 6) & 0x3F));
+ result[3] = static_cast<uint8_t>(0x80 | (ch & 0x3F));
+ return result + 4;
+ }
+
+ static value_type any(value_type result, uint32_t ch)
+ {
+ return (ch < 0x10000) ? low(result, ch) : high(result, ch);
+ }
+ };
+
+ struct utf16_counter
+ {
+ typedef size_t value_type;
+
+ static value_type low(value_type result, uint32_t)
+ {
+ return result + 1;
+ }
+
+ static value_type high(value_type result, uint32_t)
+ {
+ return result + 2;
+ }
+ };
+
+ struct utf16_writer
+ {
+ typedef uint16_t* value_type;
+
+ static value_type low(value_type result, uint32_t ch)
+ {
+ *result = static_cast<uint16_t>(ch);
+
+ return result + 1;
+ }
+
+ static value_type high(value_type result, uint32_t ch)
+ {
+ uint32_t msh = (uint32_t)(ch - 0x10000) >> 10;
+ uint32_t lsh = (uint32_t)(ch - 0x10000) & 0x3ff;
+
+ result[0] = static_cast<uint16_t>(0xD800 + msh);
+ result[1] = static_cast<uint16_t>(0xDC00 + lsh);
+
+ return result + 2;
+ }
+
+ static value_type any(value_type result, uint32_t ch)
+ {
+ return (ch < 0x10000) ? low(result, ch) : high(result, ch);
+ }
+ };
+
+ struct utf32_counter
+ {
+ typedef size_t value_type;
+
+ static value_type low(value_type result, uint32_t)
+ {
+ return result + 1;
+ }
+
+ static value_type high(value_type result, uint32_t)
+ {
+ return result + 1;
+ }
+ };
+
+ struct utf32_writer
+ {
+ typedef uint32_t* value_type;
+
+ static value_type low(value_type result, uint32_t ch)
+ {
+ *result = ch;
+
+ return result + 1;
+ }
+
+ static value_type high(value_type result, uint32_t ch)
+ {
+ *result = ch;
+
+ return result + 1;
+ }
+
+ static value_type any(value_type result, uint32_t ch)
+ {
+ *result = ch;
+
+ return result + 1;
+ }
+ };
+
+ template <size_t size> struct wchar_selector;
+
+ template <> struct wchar_selector<2>
+ {
+ typedef uint16_t type;
+ typedef utf16_counter counter;
+ typedef utf16_writer writer;
+ };
+
+ template <> struct wchar_selector<4>
+ {
+ typedef uint32_t type;
+ typedef utf32_counter counter;
+ typedef utf32_writer writer;
+ };
+
+ typedef wchar_selector<sizeof(wchar_t)>::counter wchar_counter;
+ typedef wchar_selector<sizeof(wchar_t)>::writer wchar_writer;
+
+ template <typename Traits, typename opt_swap = opt_false> struct utf_decoder
+ {
+ static inline typename Traits::value_type decode_utf8_block(const uint8_t* data, size_t size, typename Traits::value_type result)
+ {
+ const uint8_t utf8_byte_mask = 0x3f;
+
+ while (size)
+ {
+ uint8_t lead = *data;
+
+ // 0xxxxxxx -> U+0000..U+007F
+ if (lead < 0x80)
+ {
+ result = Traits::low(result, lead);
+ data += 1;
+ size -= 1;
+
+ // process aligned single-byte (ascii) blocks
+ if ((reinterpret_cast<uintptr_t>(data) & 3) == 0)
+ {
+ while (size >= 4 && (*reinterpret_cast<const uint32_t*>(data) & 0x80808080) == 0)
+ {
+ result = Traits::low(result, data[0]);
+ result = Traits::low(result, data[1]);
+ result = Traits::low(result, data[2]);
+ result = Traits::low(result, data[3]);
+ data += 4;
+ size -= 4;
+ }
+ }
+ }
+ // 110xxxxx -> U+0080..U+07FF
+ else if ((unsigned)(lead - 0xC0) < 0x20 && size >= 2 && (data[1] & 0xc0) == 0x80)
+ {
+ result = Traits::low(result, ((lead & ~0xC0) << 6) | (data[1] & utf8_byte_mask));
+ data += 2;
+ size -= 2;
+ }
+ // 1110xxxx -> U+0800-U+FFFF
+ else if ((unsigned)(lead - 0xE0) < 0x10 && size >= 3 && (data[1] & 0xc0) == 0x80 && (data[2] & 0xc0) == 0x80)
+ {
+ result = Traits::low(result, ((lead & ~0xE0) << 12) | ((data[1] & utf8_byte_mask) << 6) | (data[2] & utf8_byte_mask));
+ data += 3;
+ size -= 3;
+ }
+ // 11110xxx -> U+10000..U+10FFFF
+ else if ((unsigned)(lead - 0xF0) < 0x08 && size >= 4 && (data[1] & 0xc0) == 0x80 && (data[2] & 0xc0) == 0x80 && (data[3] & 0xc0) == 0x80)
+ {
+ result = Traits::high(result, ((lead & ~0xF0) << 18) | ((data[1] & utf8_byte_mask) << 12) | ((data[2] & utf8_byte_mask) << 6) | (data[3] & utf8_byte_mask));
+ data += 4;
+ size -= 4;
+ }
+ // 10xxxxxx or 11111xxx -> invalid
+ else
+ {
+ data += 1;
+ size -= 1;
+ }
+ }
+
+ return result;
+ }
+
+ static inline typename Traits::value_type decode_utf16_block(const uint16_t* data, size_t size, typename Traits::value_type result)
+ {
+ const uint16_t* end = data + size;
+
+ while (data < end)
+ {
+ uint16_t lead = opt_swap::value ? endian_swap(*data) : *data;
+
+ // U+0000..U+D7FF
+ if (lead < 0xD800)
+ {
+ result = Traits::low(result, lead);
+ data += 1;
+ }
+ // U+E000..U+FFFF
+ else if ((unsigned)(lead - 0xE000) < 0x2000)
+ {
+ result = Traits::low(result, lead);
+ data += 1;
+ }
+ // surrogate pair lead
+ else if ((unsigned)(lead - 0xD800) < 0x400 && data + 1 < end)
+ {
+ uint16_t next = opt_swap::value ? endian_swap(data[1]) : data[1];
+
+ if ((unsigned)(next - 0xDC00) < 0x400)
+ {
+ result = Traits::high(result, 0x10000 + ((lead & 0x3ff) << 10) + (next & 0x3ff));
+ data += 2;
+ }
+ else
+ {
+ data += 1;
+ }
+ }
+ else
+ {
+ data += 1;
+ }
+ }
+
+ return result;
+ }
+
+ static inline typename Traits::value_type decode_utf32_block(const uint32_t* data, size_t size, typename Traits::value_type result)
+ {
+ const uint32_t* end = data + size;
+
+ while (data < end)
+ {
+ uint32_t lead = opt_swap::value ? endian_swap(*data) : *data;
+
+ // U+0000..U+FFFF
+ if (lead < 0x10000)
+ {
+ result = Traits::low(result, lead);
+ data += 1;
+ }
+ // U+10000..U+10FFFF
+ else
+ {
+ result = Traits::high(result, lead);
+ data += 1;
+ }
+ }
+
+ return result;
+ }
+ };
+
+ template <typename T> inline void convert_utf_endian_swap(T* result, const T* data, size_t length)
+ {
+ for (size_t i = 0; i < length; ++i) result[i] = endian_swap(data[i]);
+ }
+
+ inline void convert_wchar_endian_swap(wchar_t* result, const wchar_t* data, size_t length)
+ {
+ for (size_t i = 0; i < length; ++i) result[i] = static_cast<wchar_t>(endian_swap(static_cast<wchar_selector<sizeof(wchar_t)>::type>(data[i])));
+ }
+}
+
+namespace
+{
+ enum chartype_t
+ {
+ ct_parse_pcdata = 1, // \0, &, \r, <
+ ct_parse_attr = 2, // \0, &, \r, ', "
+ ct_parse_attr_ws = 4, // \0, &, \r, ', ", \n, tab
+ ct_space = 8, // \r, \n, space, tab
+ ct_parse_cdata = 16, // \0, ], >, \r
+ ct_parse_comment = 32, // \0, -, >, \r
+ ct_symbol = 64, // Any symbol > 127, a-z, A-Z, 0-9, _, :, -, .
+ ct_start_symbol = 128 // Any symbol > 127, a-z, A-Z, _, :
+ };
+
+ const unsigned char chartype_table[256] =
+ {
+ 55, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 0, 0, 63, 0, 0, // 0-15
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16-31
+ 8, 0, 6, 0, 0, 0, 7, 6, 0, 0, 0, 0, 0, 96, 64, 0, // 32-47
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 192, 0, 1, 0, 48, 0, // 48-63
+ 0, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, // 64-79
+ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 0, 0, 16, 0, 192, // 80-95
+ 0, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, // 96-111
+ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 0, 0, 0, 0, 0, // 112-127
+
+ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, // 128+
+ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
+ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
+ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
+ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
+ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
+ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
+ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192
+ };
+
+ enum chartypex_t
+ {
+ ctx_special_pcdata = 1, // Any symbol >= 0 and < 32 (except \t, \r, \n), &, <, >
+ ctx_special_attr = 2, // Any symbol >= 0 and < 32 (except \t), &, <, >, "
+ ctx_start_symbol = 4, // Any symbol > 127, a-z, A-Z, _
+ ctx_digit = 8, // 0-9
+ ctx_symbol = 16 // Any symbol > 127, a-z, A-Z, 0-9, _, -, .
+ };
+
+ const unsigned char chartypex_table[256] =
+ {
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 2, 3, 3, 2, 3, 3, // 0-15
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 16-31
+ 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 16, 16, 0, // 32-47
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0, 0, 3, 0, 3, 0, // 48-63
+
+ 0, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, // 64-79
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 20, // 80-95
+ 0, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, // 96-111
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, // 112-127
+
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, // 128+
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
+ };
+
+#ifdef PUGIXML_WCHAR_MODE
+ #define IS_CHARTYPE_IMPL(c, ct, table) ((static_cast<unsigned int>(c) < 128 ? table[static_cast<unsigned int>(c)] : table[128]) & (ct))
+#else
+ #define IS_CHARTYPE_IMPL(c, ct, table) (table[static_cast<unsigned char>(c)] & (ct))
+#endif
+
+ #define IS_CHARTYPE(c, ct) IS_CHARTYPE_IMPL(c, ct, chartype_table)
+ #define IS_CHARTYPEX(c, ct) IS_CHARTYPE_IMPL(c, ct, chartypex_table)
+
+ bool is_little_endian()
+ {
+ unsigned int ui = 1;
+
+ return *reinterpret_cast<unsigned char*>(&ui) == 1;
+ }
+
+ xml_encoding get_wchar_encoding()
+ {
+ STATIC_ASSERT(sizeof(wchar_t) == 2 || sizeof(wchar_t) == 4);
+
+ if (sizeof(wchar_t) == 2)
+ return is_little_endian() ? encoding_utf16_le : encoding_utf16_be;
+ else
+ return is_little_endian() ? encoding_utf32_le : encoding_utf32_be;
+ }
+
+ xml_encoding guess_buffer_encoding(uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3)
+ {
+ // look for BOM in first few bytes
+ if (d0 == 0 && d1 == 0 && d2 == 0xfe && d3 == 0xff) return encoding_utf32_be;
+ if (d0 == 0xff && d1 == 0xfe && d2 == 0 && d3 == 0) return encoding_utf32_le;
+ if (d0 == 0xfe && d1 == 0xff) return encoding_utf16_be;
+ if (d0 == 0xff && d1 == 0xfe) return encoding_utf16_le;
+ if (d0 == 0xef && d1 == 0xbb && d2 == 0xbf) return encoding_utf8;
+
+ // look for <, <? or <?xm in various encodings
+ if (d0 == 0 && d1 == 0 && d2 == 0 && d3 == 0x3c) return encoding_utf32_be;
+ if (d0 == 0x3c && d1 == 0 && d2 == 0 && d3 == 0) return encoding_utf32_le;
+ if (d0 == 0 && d1 == 0x3c && d2 == 0 && d3 == 0x3f) return encoding_utf16_be;
+ if (d0 == 0x3c && d1 == 0 && d2 == 0x3f && d3 == 0) return encoding_utf16_le;
+ if (d0 == 0x3c && d1 == 0x3f && d2 == 0x78 && d3 == 0x6d) return encoding_utf8;
+
+ // look for utf16 < followed by node name (this may fail, but is better than utf8 since it's zero terminated so early)
+ if (d0 == 0 && d1 == 0x3c) return encoding_utf16_be;
+ if (d0 == 0x3c && d1 == 0) return encoding_utf16_le;
+
+ // no known BOM detected, assume utf8
+ return encoding_utf8;
+ }
+
+ xml_encoding get_buffer_encoding(xml_encoding encoding, const void* contents, size_t size)
+ {
+ // replace wchar encoding with utf implementation
+ if (encoding == encoding_wchar) return get_wchar_encoding();
+
+ // replace utf16 encoding with utf16 with specific endianness
+ if (encoding == encoding_utf16) return is_little_endian() ? encoding_utf16_le : encoding_utf16_be;
+
+ // replace utf32 encoding with utf32 with specific endianness
+ if (encoding == encoding_utf32) return is_little_endian() ? encoding_utf32_le : encoding_utf32_be;
+
+ // only do autodetection if no explicit encoding is requested
+ if (encoding != encoding_auto) return encoding;
+
+ // skip encoding autodetection if input buffer is too small
+ if (size < 4) return encoding_utf8;
+
+ // try to guess encoding (based on XML specification, Appendix F.1)
+ const uint8_t* data = static_cast<const uint8_t*>(contents);
+
+ DMC_VOLATILE uint8_t d0 = data[0], d1 = data[1], d2 = data[2], d3 = data[3];
+
+ return guess_buffer_encoding(d0, d1, d2, d3);
+ }
+
+ bool get_mutable_buffer(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size, bool is_mutable)
+ {
+ if (is_mutable)
+ {
+ out_buffer = static_cast<char_t*>(const_cast<void*>(contents));
+ }
+ else
+ {
+ void* buffer = global_allocate(size > 0 ? size : 1);
+ if (!buffer) return false;
+
+ memcpy(buffer, contents, size);
+
+ out_buffer = static_cast<char_t*>(buffer);
+ }
+
+ out_length = size / sizeof(char_t);
+
+ return true;
+ }
+
+#ifdef PUGIXML_WCHAR_MODE
+ inline bool need_endian_swap_utf(xml_encoding le, xml_encoding re)
+ {
+ return (le == encoding_utf16_be && re == encoding_utf16_le) || (le == encoding_utf16_le && re == encoding_utf16_be) ||
+ (le == encoding_utf32_be && re == encoding_utf32_le) || (le == encoding_utf32_le && re == encoding_utf32_be);
+ }
+
+ bool convert_buffer_endian_swap(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size, bool is_mutable)
+ {
+ const char_t* data = static_cast<const char_t*>(contents);
+
+ if (is_mutable)
+ {
+ out_buffer = const_cast<char_t*>(data);
+ }
+ else
+ {
+ out_buffer = static_cast<char_t*>(global_allocate(size > 0 ? size : 1));
+ if (!out_buffer) return false;
+ }
+
+ out_length = size / sizeof(char_t);
+
+ convert_wchar_endian_swap(out_buffer, data, out_length);
+
+ return true;
+ }
+
+ bool convert_buffer_utf8(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size)
+ {
+ const uint8_t* data = static_cast<const uint8_t*>(contents);
+
+ // first pass: get length in wchar_t units
+ out_length = utf_decoder<wchar_counter>::decode_utf8_block(data, size, 0);
+
+ // allocate buffer of suitable length
+ out_buffer = static_cast<char_t*>(global_allocate((out_length > 0 ? out_length : 1) * sizeof(char_t)));
+ if (!out_buffer) return false;
+
+ // second pass: convert utf8 input to wchar_t
+ wchar_writer::value_type out_begin = reinterpret_cast<wchar_writer::value_type>(out_buffer);
+ wchar_writer::value_type out_end = utf_decoder<wchar_writer>::decode_utf8_block(data, size, out_begin);
+
+ assert(out_end == out_begin + out_length);
+ (void)!out_end;
+
+ return true;
+ }
+
+ template <typename opt_swap> bool convert_buffer_utf16(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size, opt_swap)
+ {
+ const uint16_t* data = static_cast<const uint16_t*>(contents);
+ size_t length = size / sizeof(uint16_t);
+
+ // first pass: get length in wchar_t units
+ out_length = utf_decoder<wchar_counter, opt_swap>::decode_utf16_block(data, length, 0);
+
+ // allocate buffer of suitable length
+ out_buffer = static_cast<char_t*>(global_allocate((out_length > 0 ? out_length : 1) * sizeof(char_t)));
+ if (!out_buffer) return false;
+
+ // second pass: convert utf16 input to wchar_t
+ wchar_writer::value_type out_begin = reinterpret_cast<wchar_writer::value_type>(out_buffer);
+ wchar_writer::value_type out_end = utf_decoder<wchar_writer, opt_swap>::decode_utf16_block(data, length, out_begin);
+
+ assert(out_end == out_begin + out_length);
+ (void)!out_end;
+
+ return true;
+ }
+
+ template <typename opt_swap> bool convert_buffer_utf32(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size, opt_swap)
+ {
+ const uint32_t* data = static_cast<const uint32_t*>(contents);
+ size_t length = size / sizeof(uint32_t);
+
+ // first pass: get length in wchar_t units
+ out_length = utf_decoder<wchar_counter, opt_swap>::decode_utf32_block(data, length, 0);
+
+ // allocate buffer of suitable length
+ out_buffer = static_cast<char_t*>(global_allocate((out_length > 0 ? out_length : 1) * sizeof(char_t)));
+ if (!out_buffer) return false;
+
+ // second pass: convert utf32 input to wchar_t
+ wchar_writer::value_type out_begin = reinterpret_cast<wchar_writer::value_type>(out_buffer);
+ wchar_writer::value_type out_end = utf_decoder<wchar_writer, opt_swap>::decode_utf32_block(data, length, out_begin);
+
+ assert(out_end == out_begin + out_length);
+ (void)!out_end;
+
+ return true;
+ }
+
+ bool convert_buffer(char_t*& out_buffer, size_t& out_length, xml_encoding encoding, const void* contents, size_t size, bool is_mutable)
+ {
+ // get native encoding
+ xml_encoding wchar_encoding = get_wchar_encoding();
+
+ // fast path: no conversion required
+ if (encoding == wchar_encoding) return get_mutable_buffer(out_buffer, out_length, contents, size, is_mutable);
+
+ // only endian-swapping is required
+ if (need_endian_swap_utf(encoding, wchar_encoding)) return convert_buffer_endian_swap(out_buffer, out_length, contents, size, is_mutable);
+
+ // source encoding is utf8
+ if (encoding == encoding_utf8) return convert_buffer_utf8(out_buffer, out_length, contents, size);
+
+ // source encoding is utf16
+ if (encoding == encoding_utf16_be || encoding == encoding_utf16_le)
+ {
+ xml_encoding native_encoding = is_little_endian() ? encoding_utf16_le : encoding_utf16_be;
+
+ return (native_encoding == encoding) ?
+ convert_buffer_utf16(out_buffer, out_length, contents, size, opt_false()) :
+ convert_buffer_utf16(out_buffer, out_length, contents, size, opt_true());
+ }
+
+ // source encoding is utf32
+ if (encoding == encoding_utf32_be || encoding == encoding_utf32_le)
+ {
+ xml_encoding native_encoding = is_little_endian() ? encoding_utf32_le : encoding_utf32_be;
+
+ return (native_encoding == encoding) ?
+ convert_buffer_utf32(out_buffer, out_length, contents, size, opt_false()) :
+ convert_buffer_utf32(out_buffer, out_length, contents, size, opt_true());
+ }
+
+ assert(!"Invalid encoding");
+ return false;
+ }
+#else
+ template <typename opt_swap> bool convert_buffer_utf16(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size, opt_swap)
+ {
+ const uint16_t* data = static_cast<const uint16_t*>(contents);
+ size_t length = size / sizeof(uint16_t);
+
+ // first pass: get length in utf8 units
+ out_length = utf_decoder<utf8_counter, opt_swap>::decode_utf16_block(data, length, 0);
+
+ // allocate buffer of suitable length
+ out_buffer = static_cast<char_t*>(global_allocate((out_length > 0 ? out_length : 1) * sizeof(char_t)));
+ if (!out_buffer) return false;
+
+ // second pass: convert utf16 input to utf8
+ uint8_t* out_begin = reinterpret_cast<uint8_t*>(out_buffer);
+ uint8_t* out_end = utf_decoder<utf8_writer, opt_swap>::decode_utf16_block(data, length, out_begin);
+
+ assert(out_end == out_begin + out_length);
+ (void)!out_end;
+
+ return true;
+ }
+
+ template <typename opt_swap> bool convert_buffer_utf32(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size, opt_swap)
+ {
+ const uint32_t* data = static_cast<const uint32_t*>(contents);
+ size_t length = size / sizeof(uint32_t);
+
+ // first pass: get length in utf8 units
+ out_length = utf_decoder<utf8_counter, opt_swap>::decode_utf32_block(data, length, 0);
+
+ // allocate buffer of suitable length
+ out_buffer = static_cast<char_t*>(global_allocate((out_length > 0 ? out_length : 1) * sizeof(char_t)));
+ if (!out_buffer) return false;
+
+ // second pass: convert utf32 input to utf8
+ uint8_t* out_begin = reinterpret_cast<uint8_t*>(out_buffer);
+ uint8_t* out_end = utf_decoder<utf8_writer, opt_swap>::decode_utf32_block(data, length, out_begin);
+
+ assert(out_end == out_begin + out_length);
+ (void)!out_end;
+
+ return true;
+ }
+
+ bool convert_buffer(char_t*& out_buffer, size_t& out_length, xml_encoding encoding, const void* contents, size_t size, bool is_mutable)
+ {
+ // fast path: no conversion required
+ if (encoding == encoding_utf8) return get_mutable_buffer(out_buffer, out_length, contents, size, is_mutable);
+
+ // source encoding is utf16
+ if (encoding == encoding_utf16_be || encoding == encoding_utf16_le)
+ {
+ xml_encoding native_encoding = is_little_endian() ? encoding_utf16_le : encoding_utf16_be;
+
+ return (native_encoding == encoding) ?
+ convert_buffer_utf16(out_buffer, out_length, contents, size, opt_false()) :
+ convert_buffer_utf16(out_buffer, out_length, contents, size, opt_true());
+ }
+
+ // source encodin...
[truncated message content] |
|
From: <j-...@us...> - 2012-02-11 19:40:28
|
Revision: 695
http://openautomation.svn.sourceforge.net/openautomation/?rev=695&view=rev
Author: j-n-k
Date: 2012-02-11 19:40:21 +0000 (Sat, 11 Feb 2012)
Log Message:
-----------
Modified colspan (see discussion in KNX-UF):
- a column has a width of 8.33333%
- all widgetcontainer have a colspanX-class, where X is the number of columns
- if no colspan-attribute is set for the widget, colspan0 is uses
- colspan-classes are defined in design/textglobal.css
- each design defines a default widget width colspan0
- pure, discreet, sicreet_sand, alaska: width: 49.99998%
- alaska_slim, discreet_slim: 33.33332%
- pitchblack: 8.33333%
Modified Paths:
--------------
CometVisu/trunk/visu/designs/alaska/basic.css
CometVisu/trunk/visu/designs/alaska_slim/basic.css
CometVisu/trunk/visu/designs/discreet/basic.css
CometVisu/trunk/visu/designs/discreet_sand/basic.css
CometVisu/trunk/visu/designs/discreet_slim/basic.css
CometVisu/trunk/visu/designs/pitchblack/basic.css
CometVisu/trunk/visu/designs/pure/basic.css
CometVisu/trunk/visu/designs/structure_custom.js
CometVisu/trunk/visu/designs/structure_pure.js
CometVisu/trunk/visu/lib/templateengine.js
Added Paths:
-----------
CometVisu/trunk/visu/designs/textglobal.css
Modified: CometVisu/trunk/visu/designs/alaska/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/alaska/basic.css 2012-02-11 13:18:38 UTC (rev 694)
+++ CometVisu/trunk/visu/designs/alaska/basic.css 2012-02-11 19:40:21 UTC (rev 695)
@@ -87,8 +87,11 @@
text-decoration: none;
}
+.colspan0 { /* multiple of 8.33333% ! */
+ width: 49.9998%;
+}
+
.widget_container {
- width: 50%;
float: left;
}
Modified: CometVisu/trunk/visu/designs/alaska_slim/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/alaska_slim/basic.css 2012-02-11 13:18:38 UTC (rev 694)
+++ CometVisu/trunk/visu/designs/alaska_slim/basic.css 2012-02-11 19:40:21 UTC (rev 695)
@@ -82,8 +82,11 @@
text-decoration: none;
}
+.colspan0 { /* multiple of 8.33333% ! */
+ width: 33.33332%;
+}
+
.widget_container {
- width: 33%;
float: left;
}
Modified: CometVisu/trunk/visu/designs/discreet/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/discreet/basic.css 2012-02-11 13:18:38 UTC (rev 694)
+++ CometVisu/trunk/visu/designs/discreet/basic.css 2012-02-11 19:40:21 UTC (rev 695)
@@ -81,9 +81,12 @@
vertical-align: middle;
}
+.colspan0 { /* multiple of 8.33333% ! */
+ width: 49.9998%;
+}
+
.widget_container {
- width: 50%;
- float: left;
+ float: left;
}
.widget_container .widget_container {
Modified: CometVisu/trunk/visu/designs/discreet_sand/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/discreet_sand/basic.css 2012-02-11 13:18:38 UTC (rev 694)
+++ CometVisu/trunk/visu/designs/discreet_sand/basic.css 2012-02-11 19:40:21 UTC (rev 695)
@@ -74,8 +74,11 @@
vertical-align: middle;
}
+.colspan0 { /* multiple of 8.33333% ! */
+ width: 49.9998%;
+}
+
.widget_container {
- width: 50%;
float: left;
}
Modified: CometVisu/trunk/visu/designs/discreet_slim/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/discreet_slim/basic.css 2012-02-11 13:18:38 UTC (rev 694)
+++ CometVisu/trunk/visu/designs/discreet_slim/basic.css 2012-02-11 19:40:21 UTC (rev 695)
@@ -74,8 +74,11 @@
vertical-align: middle;
}
+.colspan0 { /* multiple of 8.33333% ! */
+ width: 33.33332%;
+}
+
.widget_container {
- width: 33%;
float: left;
}
Modified: CometVisu/trunk/visu/designs/pitchblack/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/pitchblack/basic.css 2012-02-11 13:18:38 UTC (rev 694)
+++ CometVisu/trunk/visu/designs/pitchblack/basic.css 2012-02-11 19:40:21 UTC (rev 695)
@@ -241,10 +241,13 @@
vertical-align: middle;
}
-.widget_container {
+.colspan0 { /* multiple of 8.33333% ! */
width: 8.33333%;
}
+.widget_container {
+}
+
.widget_container .widget_container, .link > div, .link a , .switchPressed,
.switchUnpressed, * html>body .clearfix, .info > div, .actor .value , .text>div{
width: 100%;
Modified: CometVisu/trunk/visu/designs/pure/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/pure/basic.css 2012-02-11 13:18:38 UTC (rev 694)
+++ CometVisu/trunk/visu/designs/pure/basic.css 2012-02-11 19:40:21 UTC (rev 695)
@@ -62,9 +62,12 @@
vertical-align: middle;
}
+.colspan0 { /* multiple of 8.33333% ! */
+ width: 49.9998%;
+}
+
.widget_container {
- width: 50%;
- float: left;
+ float: left;
}
.widget_container .widget_container {
Modified: CometVisu/trunk/visu/designs/structure_custom.js
===================================================================
--- CometVisu/trunk/visu/designs/structure_custom.js 2012-02-11 13:18:38 UTC (rev 694)
+++ CometVisu/trunk/visu/designs/structure_custom.js 2012-02-11 19:40:21 UTC (rev 695)
@@ -42,18 +42,17 @@
*/
VisuDesign_Custom.prototype.addCreator("designtoggle", {
create: function( page, path ) {
-
- var ret_val = $('<div class="widget clearfix" />');
- ret_val.addClass( 'switch' );
- var label = '<div class="label">' + page.textContent + '</div>';
+ var $p = $(page);
+ var ret_val = $('<div class="widget clearfix switch" />');
+ ret_val.setWidgetLayout($p).makeWidgetLabel($p);
var actor = '<div class="actor switchUnpressed">';
- var value = $('link[href*="designs"]').attr('href').split('/')[1];
+ var value = $('link[href*="basic.css"]').attr('href').split('/')[1];
actor += '<div class="value">' + value + '</div>';
actor += '</div>';
- ret_val.append(label).append($(actor)
+ ret_val.append($(actor)
.data({
- 'mapping' : $(page).attr('mapping'),
- 'styling' : $(page).attr('styling'),
+ 'mapping' : $p.attr('mapping'),
+ 'styling' : $p.attr('styling'),
'value' : value,
'type' : 'toggle'
})
Modified: CometVisu/trunk/visu/designs/structure_pure.js
===================================================================
--- CometVisu/trunk/visu/designs/structure_pure.js 2012-02-11 13:18:38 UTC (rev 694)
+++ CometVisu/trunk/visu/designs/structure_pure.js 2012-02-11 19:40:21 UTC (rev 695)
@@ -55,7 +55,7 @@
*/
$.fn.setWidgetLayout = function(page) {
- this.data('colspanClass', colspanClass(page.attr('colspan') || 1));
+ this.data('colspanClass', 'colspan'+(page.attr('colspan') || '0'));
if (page.attr('rowspan')) {
this.data('rowspanClass', rowspanClass(page.attr('rowspan') || 1));
this.addClass(innerRowspanClass(page.attr('rowspan') || 1));
@@ -796,133 +796,6 @@
content: false
});
- this.addCreator("imagetrigger", {
- create: function( page, path ) {
- var $p = $(page);
- var ret_val = $('<div class="widget clearfix image" />');
- ret_val.setWidgetLayout($p);
- ret_val.addClass ('imagetrigger');
- var value = $p.attr('value') ? $p.attr('value') : 0;
- var labelElement = $p.find('label')[0];
- ret_val.append( labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '' );
- var address = {};
- $p.find('address').each( function(){
- var src = this.textContent;
- ga_list.push( src )
- address[ '_' + src ] = [
- this.getAttribute('transform'), {
- 'readonly' : this.getAttribute('readonly'),
- 'writeonly' : this.getAttribute('writeonly')
- }
- ];
- //[ transform, readonly=='true', writeonly=='true' ];
- });
- var style = ' style=" ';
- style += $p.attr('width' ) ? 'width:' + $p.attr('width' ) + ';' : 'width: 100%;';
- style += $p.attr('height' ) ? 'height:' + $p.attr('height' ) + ';"' : '"';
-
- var actor = '<div class="actor">';
- /*
- if ( $p.attr('type')=='bitmask' )
- for (var i = 0; i <= 7; i++)
- actor += '<img src="" ' + style + ' class="image" />';
- else
- */
- if ( $p.attr('type')=='show' )
- actor += '<img src="' + $p.attr('src') + '.' + $p.attr('suffix') + '" ' + style + ' />';
- else
- actor += '<img src="" ' + style + ' />';
- actor += '</div>';
- /*
- var map = $p.attr('mapping');
- if( mappings[map] && mappings[map][value] )
- actor += '<div class="value">' + mappings[map][value] + '</div>';
- else
- actor += '<div class="value">' + value + '</div>'; //no value if no mapping
- */
- actor += '</div>';
- var refresh = $p.attr('refresh') ? $p.attr('refresh')*1000 : 0;
- var $actor = $(actor).data( {
- 'address': address,
- 'refresh': refresh,
- 'src': $p.attr('src'),
- 'suffix': $p.attr('suffix'),
- 'type': $p.attr('type'),
- 'mapping': map,
- 'sendValue': $p.attr('sendValue') || ""
- } )
- .each(setupRefreshAction) // abuse "each" to call in context... refresh is broken with select right now
- .bind( 'click', this.action );
- for( var addr in address ) {
- $actor.bind( addr, this.update );
- }
- ret_val.append( $actor );
- return ret_val;
- },
- update: function(e,d) {
- var data = $(this).data();
- if ( data.address[e.type][1].writeonly == "true")
- return; // skip writeonly FIXME: writeonly shouldnt bind to update at all
- var val = transformDecode(data.address[e.type][0], d);
- if (data.type == "show")
- if (val == 0)
- $(this).children().hide();
- else
- $(this).children().attr("src", data.src + '.' + data.suffix ).show();
- else if (data.type == "select")
- if (val == 0)
- $(this).children().hide();
- else
- $(this).children().attr("src", data.src + val + '.' + data.suffix ).show();
- /*
- else if (data.type == "bitmask")
- if (val == 0) { //hide all
- $(this).children().remove(); //.hide()
- } else {
- for (var i = 0; i <= 7; i++) {
- var mask = Math.pow(2,i);
- if ((mask & val) == mask) { //show
- $(this).children().append('<img src="' + data.src + mask + '.' + data.suffix + '" />');
- }
- }
- }
- */
-
- //FIXME: add value if mapping exists
- //FIXME: get image name from mapping
- //FIXME: add bitmask for multiple images
- //FIXME: add SVG-magics
- },
- action: function() {
- var data = $(this).data();
- sendValue = data.sendValue;
- for( var addr in data.address ) {
- if( data.address[addr][1].readonly == "true" )
- continue; // skip read only
- if( data.sendValue == "" )
- continue; // skip empty
- visu.write( addr.substr(1), transformEncode( data.address[addr][0], sendValue ) );
- }
- },
- attributes: {
- src: { type: 'uri' , required: true },
- width: { type: 'string' , required: false },
- height: { type: 'string' , required: false },
- refresh: { type: 'numeric', required: false },
- colspan: { type: 'numeric', required: false },
- rowspan: { type: 'numeric', required: false },
- sendValue: { type: 'numeric', required: false },
- type: { type: 'list' , required: true, list: {'show': 'show', 'select': 'select' /* , 'bitmask': 'bitmask' */ } },
- mapping: { type: 'mapping', required: false },
- suffix: { type: 'list' , required: false, list: {'png': '.png', 'jpg': '.jpg', 'gif': '.gif', 'svg': '.svg', 'bmp': '.bmp'} }
- },
- elements: {
- label: { type: 'string', required: false, multi: false },
- address: { type: 'address', required: true, multi: true }
- },
- content: false
- });
-
this.addCreator('video', {
create: function( page, path ) {
var $p = $(page);
Added: CometVisu/trunk/visu/designs/textglobal.css
===================================================================
--- CometVisu/trunk/visu/designs/textglobal.css (rev 0)
+++ CometVisu/trunk/visu/designs/textglobal.css 2012-02-11 19:40:21 UTC (rev 695)
@@ -0,0 +1,60 @@
+/*
+ * global CSS declarations for all designs
+ */
+
+/*
+ * colspans, each design needs to define a colspan0
+ * class, this class is the default widget size
+ */
+
+.colspan1 {
+ width: 8.33333%;
+}
+
+.colspan2 {
+ width: 16.66666%;
+}
+
+.colspan3 {
+ width: 24.99999%;
+}
+
+.colspan4 {
+ width: 33.33332%;
+}
+
+.colspan5 {
+ width: 41.66665%;
+}
+
+.colspan6 {
+ width: 49.99998%;
+}
+
+.colspan7 {
+ width: 58.33331%;
+}
+
+.colspan8 {
+ width: 66.66664%;
+}
+
+.colspan9 {
+ width: 74.99997%;
+}
+
+.colspan10 {
+ width: 83.33330%;
+}
+
+.colspan11 {
+ width: 91.66663%;
+}
+
+.colspan12 {
+ width: 99.99996%;
+}
+
+
+
+
Property changes on: CometVisu/trunk/visu/designs/textglobal.css
___________________________________________________________________
Added: svn:executable
+ *
Modified: CometVisu/trunk/visu/lib/templateengine.js
===================================================================
--- CometVisu/trunk/visu/lib/templateengine.js 2012-02-11 13:18:38 UTC (rev 694)
+++ CometVisu/trunk/visu/lib/templateengine.js 2012-02-11 19:40:21 UTC (rev 695)
@@ -153,7 +153,7 @@
// append css style
$('head').append('<style>.rowspan' + rowspan + ' { height: ' + rowspan*Math.round(singleHeight) + 'px; overflow:hidden;} </style>').data(className, 1);
- }
+ }
return className;
}
@@ -175,48 +175,13 @@
$('#calcinnerrowspan').remove();
// append css style
- $('head').append('<style>.innerrowspan' + rowspan + ' { height: ' + innerHeight + 'px;} </style>').data(className, 1);
+ $('head').append('<style>.innerrowspan' + rowspan + ' { height: ' + innerHeight + 'px;} </style>').data(className, 1);
}
return className;
}
-function colspanClass(colspan) {
- var className = 'colspan'+ colspan;
-
- if ( !$('head').data(className) ) {
- var singleWidth=0;
-
- // loop over all stylesheets and classes and find .widget_container
- $.each(document.styleSheets, function(idx, sheet) {
- if (sheet.href ? (sheet.href.search(/basic.css/) > 0) : false) {
- $.each(sheet.cssRules, function(idx, cssclass) {
- if (cssclass.selectorText=='.widget_container') {
- singleWidth = parseFloat((cssclass.style.width).match(/[0-9.]*/)[0]);
- return;
- }
- });
- }
- if (singleWidth > 0) { // match already found
- return;
- }
- });
-
- var totalWidth = singleWidth * colspan;
-
- if (totalWidth>100) { // check if totalWidth is <=100
- alert('colspan="'+colspan+'" leads to width:' + totalWidth +
- '% which is >100% and not allowed. Corrected to 100%');
- totalWidth=100;
- }
-
- $('head').append('<style>.colspan' + colspan + ' { width: ' +
- totalWidth + '%; overflow:hidden;} </style>').data(className, 1);
- }
-
- return className;
-}
function parseXML(xml) {
// erst mal den Cache für AJAX-Requests wieder aktivieren
$.ajaxSetup({cache: true});
@@ -243,7 +208,7 @@
selectDesign();
}
-
+ $( 'head' ).append( '<link rel="stylesheet" type="text/css" href="designs/textglobal.css" />' );
$( 'head' ).append( '<link rel="stylesheet" type="text/css" href="designs/' + clientDesign + '/basic.css" />' );
$( 'head' ).append( '<link rel="stylesheet" type="text/css" href="designs/' + clientDesign + '/mobile.css" media="only screen and (max-device-width: 480px)" />' );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2012-02-11 13:18:45
|
Revision: 694
http://openautomation.svn.sourceforge.net/openautomation/?rev=694&view=rev
Author: j-n-k
Date: 2012-02-11 13:18:38 +0000 (Sat, 11 Feb 2012)
Log Message:
-----------
Added class-support for rsslog, all tags are added as css-classes
Modified Paths:
--------------
CometVisu/trunk/visu/plugins/rsslog/structure_plugin.js
Modified: CometVisu/trunk/visu/plugins/rsslog/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/rsslog/structure_plugin.js 2012-02-10 17:34:28 UTC (rev 693)
+++ CometVisu/trunk/visu/plugins/rsslog/structure_plugin.js 2012-02-11 13:18:38 UTC (rev 694)
@@ -1,5 +1,5 @@
/* structure_plugin.js (c) 2011 by Michael Markstaller [de...@wi...]
- *
+ * rsslog (c) 2012 by Jan N. Klug [jan...@ru...]
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
@@ -15,17 +15,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-/**
- * This plugins integrates zrssfeed to display RSS-Feeds via Google-API
- * *and* a parser for local feeds using jQuery 1.5+ into CometVisu.
- * rssfeedlocal is derived from simplerss and zrssfeed
- * rssfeedlocal is mainly meant to be used with rsslog.php and plugins
- * Examples
- * <rss src="/visu/plugins/rss/rsslog.php" refresh="300" link="false" title="false"></rss>
- * <rss src="http://www.tagesschau.de/xml/rss2" refresh="300">Test API</rss>
- * <rss src="/visu/plugins/rss/tagesschau-rss2.xml" refresh="300" header="true" date="true"></rss>
- */
-
$.get("plugins/rsslog/rsslog.css", function(css) {
$("head").append("<style>"+css+"</style>");
});
@@ -42,10 +31,7 @@
var id = "rss_" + uniqid();
var ret_val = $('<div class="widget clearfix rsslog" />');
- ret_val.setWidgetLayout($p);
-
- var labelElement = $p.find('label')[0];
- var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
+ ret_val.setWidgetLayout($p).makeWidgetLabel($p);
var actor = $('<div class="actor rsslogBody"><div class="rsslog_inline" id="' + id + '"></div></div>');
var rss = $("#" + id, actor);
@@ -57,11 +43,10 @@
rss.css("height", $p.attr("height"));
}
- ret_val.append(label).append(actor);
+ ret_val.append(actor);
rss.data("id", id);
rss.data("src", $p.attr("src"));
- rss.data("label", labelElement ? labelElement.textContent : '' );
rss.data("refresh", $p.attr("refresh"));
rss.data("content", $p.attr("content")) || true;
rss.data("datetime", $p.attr("datetime")) || true;
@@ -92,7 +77,6 @@
var rss = $(rss);
var src = rss.data("src");
- var label = rss.data("label");
var refresh = rss.data("refresh");
var limit = rss.data("limit");
@@ -155,7 +139,7 @@
jQuery(c).html('');
// get height of one entry, calc max num of display items in widget
- var dummyDiv = $('<' + o.wrapper + ' class="rssRow odd" id="dummydiv">').append('<li />').appendTo($(c));
+ var dummyDiv = $('<' + o.wrapper + ' class="rsslogRow odd" id="dummydiv">').append('<li />').appendTo($(c));
var itemheight = dummyDiv.height();
dummyDiv.remove();
var widget=$(c).parent().parent(); // get the parent widget
@@ -164,10 +148,10 @@
var items = $(feed).find('item');
var itemnum = items.length;
- var itemoffset = 0; // correct if mode='first' or itemnum<=displayrows
+ var itemoffset = 0; // correct if mode='last' or itemnum<=displayrows
if (itemnum>displayrows) { // no need to check mode if items are less than rows
- if (o.mode=='last') {
+ if (o.mode=='first') {
itemoffset=itemnum-displayrows;
}
if (o.mode=='rollover') {
@@ -188,12 +172,12 @@
var idx = i;
idx = (i>=itemnum) ? (idx = idx - itemnum) : idx;
- var item = items[idx];
+ var item = $(items[idx]);
var itemHtml=o.html;
- itemHtml = itemHtml.replace(/{text}/, jQuery(item).find('description').text());
- var entryDate = new Date($(item).find('pubDate').text());
+ itemHtml = itemHtml.replace(/{text}/, item.find('description').text());
+ var entryDate = new Date(item.find('pubDate').text());
if (entryDate) {
itemHtml = (o.timeformat) ?
(itemHtml.replace(/{date}/, entryDate.strftime(o.timeformat) + ' ')) :
@@ -201,9 +185,19 @@
} else {
itemHtml = itemHtml.replace(/{date}/, '');
}
+
+ var $row = $('<' + o.wrapper + ' class="rsslogRow ' + row + '">').append(itemHtml);
+
+ var title = item.find('title').text();
+ var itemClasses = title.substring(title.search(/\[/)+1,title.search(/\]/)).replace(/\,/g, ' ');
+
+ if (itemClasses) {
+
+ $row.addClass(itemClasses);
+ }
+
+ jQuery(c).append($row)
- jQuery(c).append(jQuery('<' + o.wrapper + ' class="rsslogRow ' + row + '">').append(itemHtml));
-
// Alternate row classes
row = (row == 'rsslogodd') ? 'rsslogeven' : 'rsslogodd';
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2012-02-10 17:34:39
|
Revision: 693
http://openautomation.svn.sourceforge.net/openautomation/?rev=693&view=rev
Author: j-n-k
Date: 2012-02-10 17:34:28 +0000 (Fri, 10 Feb 2012)
Log Message:
-----------
Added missing strftime-library
Modified Paths:
--------------
CometVisu/trunk/visu/index.html
Added Paths:
-----------
CometVisu/trunk/visu/lib/strftime-min.js
CometVisu/trunk/visu/lib/strftime.js
Modified: CometVisu/trunk/visu/index.html
===================================================================
--- CometVisu/trunk/visu/index.html 2012-02-09 19:27:42 UTC (rev 692)
+++ CometVisu/trunk/visu/index.html 2012-02-10 17:34:28 UTC (rev 693)
@@ -11,6 +11,7 @@
<script src="lib/jquery.js" type="text/javascript"></script>
<script src="lib/compatibility.js" type="text/javascript"></script>
<script src="lib/jquery-ui.js" type="text/javascript"></script>
+ <script src="lib/strftime.js" type="text/javascript"></script>
<script src="lib/scrollable.js" type="text/javascript"></script>
<script src="lib/jquery.ui.touch-punch.js" type="text/javascript"></script>
<script src="lib/cometvisu-client.js" type="text/javascript"></script>
Added: CometVisu/trunk/visu/lib/strftime-min.js
===================================================================
--- CometVisu/trunk/visu/lib/strftime-min.js (rev 0)
+++ CometVisu/trunk/visu/lib/strftime-min.js 2012-02-10 17:34:28 UTC (rev 693)
@@ -0,0 +1 @@
+Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(x,pad,r){if(typeof (r)=="undefined"){r=10}for(;parseInt(x,10)<r&&r>1;r/=10){x=pad.toString()+x}return x.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};Date.ext.locales["en-US"]=Date.ext.locales.en;Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(d){return Date.ext.locales[d.locale].a[d.getDay()]},A:function(d){return Date.ext.locales[d.locale].A[d.getDay()]},b:function(d){return Date.ext.locales[d.locale].b[d.getMonth()]},B:function(d){return Date.ext.locales[d.locale].B[d.getMonth()]},c:"toLocaleString",C:function(d){return Date.ext.util.xPad(parseInt(d.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(d){return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100,10),0)},G:function(d){var y=d.getFullYear();var V=parseInt(Date.ext.formats.V(d),10);var W=parseInt(Date.ext.formats.W(d),10);if(W>V){y++}else{if(W===0&&V>=52){y--}}return y},H:["getHours","0"],I:function(d){var I=d.getHours()%12;return Date.ext.util.xPad(I===0?12:I,0)},j:function(d){var ms=d-new Date(""+d.getFullYear()+"/1/1 GMT");ms+=d.getTimezoneOffset()*60000;var doy=parseInt(ms/60000/60/24,10)+1;return Date.ext.util.xPad(doy,0,100)},m:function(d){return Date.ext.util.xPad(d.getMonth()+1,0)},M:["getMinutes","0"],p:function(d){return Date.ext.locales[d.locale].p[d.getHours()>=12?1:0]},P:function(d){return Date.ext.locales[d.locale].P[d.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(d){var dow=d.getDay();return dow===0?7:dow},U:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=6-d.getDay();var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0)},V:function(d){var woy=parseInt(Date.ext.formats.W(d),10);var dow1_1=(new Date(""+d.getFullYear()+"/1/1")).getDay();var idow=woy+(dow1_1>4||dow1_1<=1?0:1);if(idow==53&&(new Date(""+d.getFullYear()+"/12/31")).getDay()<4){idow=1}else{if(idow===0){idow=Date.ext.formats.V(new Date(""+(d.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(idow,0)},w:"getDay",W:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=7-Date.ext.formats.u(d);var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0,10)},y:function(d){return Date.ext.util.xPad(d.getFullYear()%100,0)},Y:"getFullYear",z:function(d){var o=d.getTimezoneOffset();var H=Date.ext.util.xPad(parseInt(Math.abs(o/60),10),0);var M=Date.ext.util.xPad(o%60,0);return(o>0?"-":"+")+H+M},Z:function(d){return d.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(d){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(fmt){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var d=this;while(fmt.match(/%[cDhnrRtTxXzZ]/)){fmt=fmt.replace(/%([cDhnrRtTxXzZ])/g,function(m0,m1){var f=Date.ext.aggregates[m1];return(f=="locale"?Date.ext.locales[d.locale][m1]:f)})}var str=fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(m0,m1){var f=Date.ext.formats[m1];if(typeof (f)=="string"){return d[f]()}else{if(typeof (f)=="function"){return f.call(d,d)}else{if(typeof (f)=="object"&&typeof (f[0])=="string"){return Date.ext.util.xPad(d[f[0]](),f[1])}else{return m1}}}});d=null;return str};
Added: CometVisu/trunk/visu/lib/strftime.js
===================================================================
--- CometVisu/trunk/visu/lib/strftime.js (rev 0)
+++ CometVisu/trunk/visu/lib/strftime.js 2012-02-10 17:34:28 UTC (rev 693)
@@ -0,0 +1,732 @@
+/*
+ strftime for Javascript
+ Copyright (c) 2008, Philip S Tellis <ph...@bl...>
+ All rights reserved.
+
+ This code is distributed under the terms of the BSD licence
+
+ Redistribution and use of this software in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of
+ conditions and the following disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * The names of the contributors to this file may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file strftime.js
+ * \author Philip S Tellis \<ph...@bl...\>
+ * \version 1.3
+ * \date 2008/06
+ * \brief Javascript implementation of strftime
+ *
+ * Implements strftime for the Date object in javascript based on the PHP implementation described at
+ * http://www.php.net/strftime This is in turn based on the Open Group specification defined
+ * at http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html This implementation does not
+ * include modified conversion specifiers (i.e., Ex and Ox)
+ *
+ * The following format specifiers are supported:
+ *
+ * \copydoc formats
+ *
+ * \%a, \%A, \%b and \%B should be localised for non-English locales.
+ *
+ * \par Usage:
+ * This library may be used as follows:
+ * \code
+ * var d = new Date();
+ *
+ * var ymd = d.strftime('%Y/%m/%d');
+ * var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z');
+ *
+ * \endcode
+ *
+ * \sa \link Date.prototype.strftime Date.strftime \endlink for a description of each of the supported format specifiers
+ * \sa Date.ext.locales for localisation information
+ * \sa http://www.php.net/strftime for the PHP implementation which is the basis for this
+ * \sa http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html for feedback
+ */
+
+//! Date extension object - all supporting objects go in here.
+Date.ext = {};
+
+//! Utility methods
+Date.ext.util = {};
+
+/**
+\brief Left pad a number with something
+\details Takes a number and pads it to the left with the passed in pad character
+\param x The number to pad
+\param pad The string to pad with
+\param r [optional] Upper limit for pad. A value of 10 pads to 2 digits, a value of 100 pads to 3 digits.
+ Default is 10.
+
+\return The number left padded with the pad character. This function returns a string and not a number.
+*/
+Date.ext.util.xPad=function(x, pad, r)
+{
+ if(typeof(r) == 'undefined')
+ {
+ r=10;
+ }
+ for( ; parseInt(x, 10)<r && r>1; r/=10)
+ x = pad.toString() + x;
+ return x.toString();
+};
+
+/**
+\brief Currently selected locale.
+\details
+The locale for a specific date object may be changed using \code Date.locale = "new-locale"; \endcode
+The default will be based on the lang attribute of the HTML tag of your document
+*/
+Date.prototype.locale = 'en-GB';
+//! \cond FALSE
+if(document.getElementsByTagName('html') && document.getElementsByTagName('html')[0].lang)
+{
+ Date.prototype.locale = document.getElementsByTagName('html')[0].lang;
+}
+//! \endcond
+
+/**
+\brief Localised strings for days of the week and months of the year.
+\details
+To create your own local strings, add a locale object to the locales object.
+The key of your object should be the same as your locale name. For example:
+ en-US,
+ fr,
+ fr-CH,
+ de-DE
+Names are case sensitive and are described at http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
+Your locale object must contain the following keys:
+\param a Short names of days of week starting with Sunday
+\param A Long names days of week starting with Sunday
+\param b Short names of months of the year starting with January
+\param B Long names of months of the year starting with February
+\param c The preferred date and time representation in your locale
+\param p AM or PM in your locale
+\param P am or pm in your locale
+\param x The preferred date representation for the current locale without the time.
+\param X The preferred time representation for the current locale without the date.
+
+\sa Date.ext.locales.en for a sample implementation
+\sa \ref localisation for detailed documentation on localising strftime for your own locale
+*/
+Date.ext.locales = { };
+
+/**
+ * \brief Localised strings for English (British).
+ * \details
+ * This will be used for any of the English dialects unless overridden by a country specific one.
+ * This is the default locale if none specified
+ */
+Date.ext.locales.en = {
+ a: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
+ A: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
+ b: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+ B: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+ c: '%a %d %b %Y %T %Z',
+ p: ['AM', 'PM'],
+ P: ['am', 'pm'],
+ x: '%d/%m/%y',
+ X: '%T'
+};
+
+//! \cond FALSE
+// Localised strings for US English
+Date.ext.locales['en-US'] = Date.ext.locales.en;
+Date.ext.locales['en-US'].c = '%a %d %b %Y %r %Z';
+Date.ext.locales['en-US'].x = '%D';
+Date.ext.locales['en-US'].X = '%r';
+
+// Localised strings for British English
+Date.ext.locales['en-GB'] = Date.ext.locales.en;
+
+// Localised strings for Australian English
+Date.ext.locales['en-AU'] = Date.ext.locales['en-GB'];
+//! \endcond
+
+//! \brief List of supported format specifiers.
+/**
+ * \details
+ * \arg \%a - abbreviated weekday name according to the current locale
+ * \arg \%A - full weekday name according to the current locale
+ * \arg \%b - abbreviated month name according to the current locale
+ * \arg \%B - full month name according to the current locale
+ * \arg \%c - preferred date and time representation for the current locale
+ * \arg \%C - century number (the year divided by 100 and truncated to an integer, range 00 to 99)
+ * \arg \%d - day of the month as a decimal number (range 01 to 31)
+ * \arg \%D - same as %m/%d/%y
+ * \arg \%e - day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31')
+ * \arg \%g - like %G, but without the century
+ * \arg \%G - The 4-digit year corresponding to the ISO week number
+ * \arg \%h - same as %b
+ * \arg \%H - hour as a decimal number using a 24-hour clock (range 00 to 23)
+ * \arg \%I - hour as a decimal number using a 12-hour clock (range 01 to 12)
+ * \arg \%j - day of the year as a decimal number (range 001 to 366)
+ * \arg \%m - month as a decimal number (range 01 to 12)
+ * \arg \%M - minute as a decimal number
+ * \arg \%n - newline character
+ * \arg \%p - either `AM' or `PM' according to the given time value, or the corresponding strings for the current locale
+ * \arg \%P - like %p, but lower case
+ * \arg \%r - time in a.m. and p.m. notation equal to %I:%M:%S %p
+ * \arg \%R - time in 24 hour notation equal to %H:%M
+ * \arg \%S - second as a decimal number
+ * \arg \%t - tab character
+ * \arg \%T - current time, equal to %H:%M:%S
+ * \arg \%u - weekday as a decimal number [1,7], with 1 representing Monday
+ * \arg \%U - week number of the current year as a decimal number, starting with
+ * the first Sunday as the first day of the first week
+ * \arg \%V - The ISO 8601:1988 week number of the current year as a decimal number,
+ * range 01 to 53, where week 1 is the first week that has at least 4 days
+ * in the current year, and with Monday as the first day of the week.
+ * \arg \%w - day of the week as a decimal, Sunday being 0
+ * \arg \%W - week number of the current year as a decimal number, starting with the
+ * first Monday as the first day of the first week
+ * \arg \%x - preferred date representation for the current locale without the time
+ * \arg \%X - preferred time representation for the current locale without the date
+ * \arg \%y - year as a decimal number without a century (range 00 to 99)
+ * \arg \%Y - year as a decimal number including the century
+ * \arg \%z - numerical time zone representation
+ * \arg \%Z - time zone name or abbreviation
+ * \arg \%% - a literal `\%' character
+ */
+Date.ext.formats = {
+ a: function(d) { return Date.ext.locales[d.locale].a[d.getDay()]; },
+ A: function(d) { return Date.ext.locales[d.locale].A[d.getDay()]; },
+ b: function(d) { return Date.ext.locales[d.locale].b[d.getMonth()]; },
+ B: function(d) { return Date.ext.locales[d.locale].B[d.getMonth()]; },
+ c: 'toLocaleString',
+ C: function(d) { return Date.ext.util.xPad(parseInt(d.getFullYear()/100, 10), 0); },
+ d: ['getDate', '0'],
+ e: ['getDate', ' '],
+ g: function(d) { return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100, 10), 0); },
+ G: function(d) {
+ var y = d.getFullYear();
+ var V = parseInt(Date.ext.formats.V(d), 10);
+ var W = parseInt(Date.ext.formats.W(d), 10);
+
+ if(W > V) {
+ y++;
+ } else if(W===0 && V>=52) {
+ y--;
+ }
+
+ return y;
+ },
+ H: ['getHours', '0'],
+ I: function(d) { var I=d.getHours()%12; return Date.ext.util.xPad(I===0?12:I, 0); },
+ j: function(d) {
+ var ms = d - new Date('' + d.getFullYear() + '/1/1 GMT');
+ ms += d.getTimezoneOffset()*60000;
+ var doy = parseInt(ms/60000/60/24, 10)+1;
+ return Date.ext.util.xPad(doy, 0, 100);
+ },
+ m: function(d) { return Date.ext.util.xPad(d.getMonth()+1, 0); },
+ M: ['getMinutes', '0'],
+ p: function(d) { return Date.ext.locales[d.locale].p[d.getHours() >= 12 ? 1 : 0 ]; },
+ P: function(d) { return Date.ext.locales[d.locale].P[d.getHours() >= 12 ? 1 : 0 ]; },
+ S: ['getSeconds', '0'],
+ u: function(d) { var dow = d.getDay(); return dow===0?7:dow; },
+ U: function(d) {
+ var doy = parseInt(Date.ext.formats.j(d), 10);
+ var rdow = 6-d.getDay();
+ var woy = parseInt((doy+rdow)/7, 10);
+ return Date.ext.util.xPad(woy, 0);
+ },
+ V: function(d) {
+ var woy = parseInt(Date.ext.formats.W(d), 10);
+ var dow1_1 = (new Date('' + d.getFullYear() + '/1/1')).getDay();
+ // First week is 01 and not 00 as in the case of %U and %W,
+ // so we add 1 to the final result except if day 1 of the year
+ // is a Monday (then %W returns 01).
+ // We also need to subtract 1 if the day 1 of the year is
+ // Friday-Sunday, so the resulting equation becomes:
+ var idow = woy + (dow1_1 > 4 || dow1_1 <= 1 ? 0 : 1);
+ if(idow == 53 && (new Date('' + d.getFullYear() + '/12/31')).getDay() < 4)
+ {
+ idow = 1;
+ }
+ else if(idow === 0)
+ {
+ idow = Date.ext.formats.V(new Date('' + (d.getFullYear()-1) + '/12/31'));
+ }
+
+ return Date.ext.util.xPad(idow, 0);
+ },
+ w: 'getDay',
+ W: function(d) {
+ var doy = parseInt(Date.ext.formats.j(d), 10);
+ var rdow = 7-Date.ext.formats.u(d);
+ var woy = parseInt((doy+rdow)/7, 10);
+ return Date.ext.util.xPad(woy, 0, 10);
+ },
+ y: function(d) { return Date.ext.util.xPad(d.getFullYear()%100, 0); },
+ Y: 'getFullYear',
+ z: function(d) {
+ var o = d.getTimezoneOffset();
+ var H = Date.ext.util.xPad(parseInt(Math.abs(o/60), 10), 0);
+ var M = Date.ext.util.xPad(o%60, 0);
+ return (o>0?'-':'+') + H + M;
+ },
+ Z: function(d) { return d.toString().replace(/^.*\(([^)]+)\)$/, '$1'); },
+ '%': function(d) { return '%'; }
+};
+
+/**
+\brief List of aggregate format specifiers.
+\details
+Aggregate format specifiers map to a combination of basic format specifiers.
+These are implemented in terms of Date.ext.formats.
+
+A format specifier that maps to 'locale' is read from Date.ext.locales[current-locale].
+
+\sa Date.ext.formats
+*/
+Date.ext.aggregates = {
+ c: 'locale',
+ D: '%m/%d/%y',
+ h: '%b',
+ n: '\n',
+ r: '%I:%M:%S %p',
+ R: '%H:%M',
+ t: '\t',
+ T: '%H:%M:%S',
+ x: 'locale',
+ X: 'locale'
+};
+
+//! \cond FALSE
+// Cache timezone values because they will never change for a given JS instance
+Date.ext.aggregates.z = Date.ext.formats.z(new Date());
+Date.ext.aggregates.Z = Date.ext.formats.Z(new Date());
+//! \endcond
+
+//! List of unsupported format specifiers.
+/**
+ * \details
+ * All format specifiers supported by the PHP implementation are supported by
+ * this javascript implementation.
+ */
+Date.ext.unsupported = { };
+
+
+/**
+ * \brief Formats the date according to the specified format.
+ * \param fmt The format to format the date in. This may be a combination of the following:
+ * \copydoc formats
+ *
+ * \return A string representation of the date formatted based on the passed in parameter
+ * \sa http://www.php.net/strftime for documentation on format specifiers
+*/
+Date.prototype.strftime=function(fmt)
+{
+ // Fix locale if declared locale hasn't been defined
+ // After the first call this condition should never be entered unless someone changes the locale
+ if(!(this.locale in Date.ext.locales))
+ {
+ if(this.locale.replace(/-[a-zA-Z]+$/, '') in Date.ext.locales)
+ {
+ this.locale = this.locale.replace(/-[a-zA-Z]+$/, '');
+ }
+ else
+ {
+ this.locale = 'en-GB';
+ }
+ }
+
+ var d = this;
+ // First replace aggregates
+ while(fmt.match(/%[cDhnrRtTxXzZ]/))
+ {
+ fmt = fmt.replace(/%([cDhnrRtTxXzZ])/g, function(m0, m1)
+ {
+ var f = Date.ext.aggregates[m1];
+ return (f == 'locale' ? Date.ext.locales[d.locale][m1] : f);
+ });
+ }
+
+
+ // Now replace formats - we need a closure so that the date object gets passed through
+ var str = fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g, function(m0, m1)
+ {
+ var f = Date.ext.formats[m1];
+ if(typeof(f) == 'string') {
+ return d[f]();
+ } else if(typeof(f) == 'function') {
+ return f.call(d, d);
+ } else if(typeof(f) == 'object' && typeof(f[0]) == 'string') {
+ return Date.ext.util.xPad(d[f[0]](), f[1]);
+ } else {
+ return m1;
+ }
+ });
+ d=null;
+ return str;
+};
+
+/**
+ * \mainpage strftime for Javascript
+ *
+ * \section toc Table of Contents
+ * - \ref intro_sec
+ * - <a class="el" href="strftime.js">Download full source</a> / <a class="el" href="strftime-min.js">minified</a>
+ * - \subpage usage
+ * - \subpage format_specifiers
+ * - \subpage localisation
+ * - \link strftime.js API Documentation \endlink
+ * - \subpage demo
+ * - \subpage changelog
+ * - \subpage faq
+ * - <a class="el" href="http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html">Feedback</a>
+ * - \subpage copyright_licence
+ *
+ * \section intro_sec Introduction
+ *
+ * C and PHP developers have had access to a built in strftime function for a long time.
+ * This function is an easy way to format dates and times for various display needs.
+ *
+ * This library brings the flexibility of strftime to the javascript Date object
+ *
+ * Use this library if you frequently need to format dates in javascript in a variety of ways. For example,
+ * if you have PHP code that writes out formatted dates, and want to mimic the functionality using
+ * progressively enhanced javascript, then this library can do exactly what you want.
+ *
+ *
+ *
+ *
+ * \page usage Example usage
+ *
+ * \section usage_sec Usage
+ * This library may be used as follows:
+ * \code
+ * var d = new Date();
+ *
+ * var ymd = d.strftime('%Y/%m/%d');
+ * var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z');
+ *
+ * \endcode
+ *
+ * \subsection examples Examples
+ *
+ * To get the current time in hours and minutes:
+ * \code
+ * var d = new Date();
+ * d.strftime("%H:%M");
+ * \endcode
+ *
+ * To get the current time with seconds in AM/PM notation:
+ * \code
+ * var d = new Date();
+ * d.strftime("%r");
+ * \endcode
+ *
+ * To get the year and day of the year for August 23, 2009:
+ * \code
+ * var d = new Date('2009/8/23');
+ * d.strftime("%Y-%j");
+ * \endcode
+ *
+ * \section demo_sec Demo
+ *
+ * Try your own examples on the \subpage demo page. You can use any of the supported
+ * \subpage format_specifiers.
+ *
+ *
+ *
+ *
+ * \page localisation Localisation
+ * You can localise strftime by implementing the short and long forms for days of the
+ * week and months of the year, and the localised aggregates for the preferred date
+ * and time representation for your locale. You need to add your locale to the
+ * Date.ext.locales object.
+ *
+ * \section localising_fr Localising for french
+ *
+ * For example, this is how we'd add French language strings to the locales object:
+ * \dontinclude index.html
+ * \skip Generic french
+ * \until };
+ * The % format specifiers are all defined in \ref formats. You can use any of those.
+ *
+ * This locale definition may be included in your own source file, or in the HTML file
+ * including \c strftime.js, however it must be defined \em after including \c strftime.js
+ *
+ * The above definition includes generic french strings and formats that are used in France.
+ * Other french speaking countries may have other representations for dates and times, so we
+ * need to override this for them. For example, Canadian french uses a Y-m-d date format,
+ * while French french uses d.m.Y. We fix this by defining Canadian french to be the same
+ * as generic french, and then override the format specifiers for \c x for the \c fr-CA locale:
+ * \until End french
+ *
+ * You can now use any of the French locales at any time by setting \link Date.prototype.locale Date.locale \endlink
+ * to \c "fr", \c "fr-FR", \c "fr-CA", or any other french dialect:
+ * \code
+ * var d = new Date("2008/04/22");
+ * d.locale = "fr";
+ *
+ * d.strftime("%A, %d %B == %x");
+ * \endcode
+ * will return:
+ * \code
+ * mardi, 22 avril == 22.04.2008
+ * \endcode
+ * While changing the locale to "fr-CA":
+ * \code
+ * d.locale = "fr-CA";
+ *
+ * d.strftime("%A, %d %B == %x");
+ * \endcode
+ * will return:
+ * \code
+ * mardi, 22 avril == 2008-04-22
+ * \endcode
+ *
+ * You can use any of the format specifiers defined at \ref formats
+ *
+ * The locale for all dates defaults to the value of the \c lang attribute of your HTML document if
+ * it is set, or to \c "en" otherwise.
+ * \note
+ * Your locale definitions \b MUST be added to the locale object before calling
+ * \link Date.prototype.strftime Date.strftime \endlink.
+ *
+ * \sa \ref formats for a list of format specifiers that can be used in your definitions
+ * for c, x and X.
+ *
+ * \section locale_names Locale names
+ *
+ * Locale names are defined in RFC 1766. Typically, a locale would be a two letter ISO639
+ * defined language code and an optional ISO3166 defined country code separated by a -
+ *
+ * eg: fr-FR, de-DE, hi-IN
+ *
+ * \sa http://www.ietf.org/rfc/rfc1766.txt
+ * \sa http://www.loc.gov/standards/iso639-2/php/code_list.php
+ * \sa http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
+ *
+ * \section locale_fallback Locale fallbacks
+ *
+ * If a locale object corresponding to the fully specified locale isn't found, an attempt will be made
+ * to fall back to the two letter language code. If a locale object corresponding to that isn't found
+ * either, then the locale will fall back to \c "en". No warning will be issued.
+ *
+ * For example, if we define a locale for de:
+ * \until };
+ * Then set the locale to \c "de-DE":
+ * \code
+ * d.locale = "de-DE";
+ *
+ * d.strftime("%a, %d %b");
+ * \endcode
+ * In this case, the \c "de" locale will be used since \c "de-DE" has not been defined:
+ * \code
+ * Di, 22 Apr
+ * \endcode
+ *
+ * Swiss german will return the same since it will also fall back to \c "de":
+ * \code
+ * d.locale = "de-CH";
+ *
+ * d.strftime("%a, %d %b");
+ * \endcode
+ * \code
+ * Di, 22 Apr
+ * \endcode
+ *
+ * We need to override the \c a specifier for Swiss german, since it's different from German german:
+ * \until End german
+ * We now get the correct results:
+ * \code
+ * d.locale = "de-CH";
+ *
+ * d.strftime("%a, %d %b");
+ * \endcode
+ * \code
+ * Die, 22 Apr
+ * \endcode
+ *
+ * \section builtin_locales Built in locales
+ *
+ * This library comes with pre-defined locales for en, en-GB, en-US and en-AU.
+ *
+ *
+ *
+ *
+ * \page format_specifiers Format specifiers
+ *
+ * \section specifiers Format specifiers
+ * strftime has several format specifiers defined by the Open group at
+ * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
+ *
+ * PHP added a few of its own, defined at http://www.php.net/strftime
+ *
+ * This javascript implementation supports all the PHP specifiers
+ *
+ * \subsection supp Supported format specifiers:
+ * \copydoc formats
+ *
+ * \subsection unsupportedformats Unsupported format specifiers:
+ * \copydoc unsupported
+ *
+ *
+ *
+ *
+ * \page demo strftime demo
+ * <div style="float:right;width:45%;">
+ * \copydoc formats
+ * </div>
+ * \htmlinclude index.html
+ *
+ *
+ *
+ *
+ * \page faq FAQ
+ *
+ * \section how_tos Usage
+ *
+ * \subsection howtouse Is there a manual on how to use this library?
+ *
+ * Yes, see \ref usage
+ *
+ * \subsection wheretoget Where can I get a minified version of this library?
+ *
+ * The minified version is available <a href="strftime-min.js" title="Minified strftime.js">here</a>.
+ *
+ * \subsection which_specifiers Which format specifiers are supported?
+ *
+ * See \ref format_specifiers
+ *
+ * \section whys Why?
+ *
+ * \subsection why_lib Why this library?
+ *
+ * I've used the strftime function in C, PHP and the Unix shell, and found it very useful
+ * to do date formatting. When I needed to do date formatting in javascript, I decided
+ * that it made the most sense to just reuse what I'm already familiar with.
+ *
+ * \subsection why_another Why another strftime implementation for Javascript?
+ *
+ * Yes, there are other strftime implementations for Javascript, but I saw problems with
+ * all of them that meant I couldn't use them directly. Some implementations had bad
+ * designs. For example, iterating through all possible specifiers and scanning the string
+ * for them. Others were tied to specific libraries like prototype.
+ *
+ * Trying to extend any of the existing implementations would have required only slightly
+ * less effort than writing this from scratch. In the end it took me just about 3 hours
+ * to write the code and about 6 hours battling with doxygen to write these docs.
+ *
+ * I also had an idea of how I wanted to implement this, so decided to try it.
+ *
+ * \subsection why_extend_date Why extend the Date class rather than subclass it?
+ *
+ * I tried subclassing Date and failed. I didn't want to waste time on figuring
+ * out if there was a problem in my code or if it just wasn't possible. Adding to the
+ * Date.prototype worked well, so I stuck with it.
+ *
+ * I did have some worries because of the way for..in loops got messed up after json.js added
+ * to the Object.prototype, but that isn't an issue here since {} is not a subclass of Date.
+ *
+ * My last doubt was about the Date.ext namespace that I created. I still don't like this,
+ * but I felt that \c ext at least makes clear that this is external or an extension.
+ *
+ * It's quite possible that some future version of javascript will add an \c ext or a \c locale
+ * or a \c strftime property/method to the Date class, but this library should probably
+ * check for capabilities before doing what it does.
+ *
+ * \section curiosity Curiosity
+ *
+ * \subsection how_big How big is the code?
+ *
+ * \arg 26K bytes with documentation
+ * \arg 4242 bytes minified using <a href="http://developer.yahoo.com/yui/compressor/">YUI Compressor</a>
+ * \arg 1477 bytes minified and gzipped
+ *
+ * \subsection how_long How long did it take to write this?
+ *
+ * 15 minutes for the idea while I was composing this blog post:
+ * http://tech.bluesmoon.info/2008/04/javascript-date-functions.html
+ *
+ * 3 hours in one evening to write v1.0 of the code and 6 hours the same
+ * night to write the docs and this manual. As you can tell, I'm fairly
+ * sleepy.
+ *
+ * Versions 1.1 and 1.2 were done in a couple of hours each, and version 1.3
+ * in under one hour.
+ *
+ * \section contributing Contributing
+ *
+ * \subsection how_to_rfe How can I request features or make suggestions?
+ *
+ * You can leave a comment on my blog post about this library here:
+ * http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html
+ *
+ * \subsection how_to_contribute Can I/How can I contribute code to this library?
+ *
+ * Yes, that would be very nice, thank you. You can do various things. You can make changes
+ * to the library, and make a diff against the current file and mail me that diff at
+ * ph...@bl..., or you could just host the new file on your own servers and add
+ * your name to the copyright list at the top stating which parts you've added.
+ *
+ * If you do mail me a diff, let me know how you'd like to be listed in the copyright section.
+ *
+ * \subsection copyright_signover Who owns the copyright on contributed code?
+ *
+ * The contributor retains copyright on contributed code.
+ *
+ * In some cases I may use contributed code as a template and write the code myself. In this
+ * case I'll give the contributor credit for the idea, but will not add their name to the
+ * copyright holders list.
+ *
+ *
+ *
+ *
+ * \page copyright_licence Copyright & Licence
+ *
+ * \section copyright Copyright
+ * \dontinclude strftime.js
+ * \skip Copyright
+ * \until rights
+ *
+ * \section licence Licence
+ * \skip This code
+ * \until SUCH DAMAGE.
+ *
+ *
+ *
+ * \page changelog ChangeLog
+ *
+ * \par 1.3 - 2008/06/17:
+ * - Fixed padding issue with negative timezone offsets in %r
+ * reported and fixed by Mikko:
+ * http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html
+ * - Added support for %P
+ * - Internationalised %r, %p and %P
+ *
+ * \par 1.2 - 2008/04/27:
+ * - Fixed support for c (previously it just returned toLocaleString())
+ * - Add support for c, x and X
+ * - Add locales for en-GB, en-US and en-AU
+ * - Make en-GB the default locale (previous was en)
+ * - Added more localisation docs
+ *
+ * \par 1.1 - 2008/04/27:
+ * - Fix bug in xPad which wasn't padding more than a single digit
+ * - Fix bug in j which had an off by one error for days after March 10th because of daylight savings
+ * - Add support for g, G, U, V and W
+ *
+ * \par 1.0 - 2008/04/22:
+ * - Initial release with support for a, A, b, B, c, C, d, D, e, H, I, j, m, M, p, r, R, S, t, T, u, w, y, Y, z, Z, and %
+ */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2012-02-09 19:27:52
|
Revision: 692
http://openautomation.svn.sourceforge.net/openautomation/?rev=692&view=rev
Author: makki1
Date: 2012-02-09 19:27:42 +0000 (Thu, 09 Feb 2012)
Log Message:
-----------
Plugin Prowl and some enhancement on DaemonStartStop
Modified Paths:
--------------
wiregate/plugin/generic/DaemonStartStop
wiregate/plugin/generic/Prowl.pl
Modified: wiregate/plugin/generic/DaemonStartStop
===================================================================
--- wiregate/plugin/generic/DaemonStartStop 2012-02-08 19:13:45 UTC (rev 691)
+++ wiregate/plugin/generic/DaemonStartStop 2012-02-09 19:27:42 UTC (rev 692)
@@ -1,6 +1,8 @@
# Plugin um daemons (Dienste) per KNX Gruppenadresse zu starten/beenden
# pptpd in diesem Beispiel, geht natuerlich auch fuer alle anderen
# Eigenen Aufruf-Zyklus auf taeglich setzen
+# v0.2 - auch nach reboot deaktivieren
+
$plugin_info{$plugname.'_cycle'} = 86400;
##############################################################################
@@ -17,10 +19,12 @@
if (%msg) {
if ($msg{'apci'} eq "A_GroupValue_Write" and $ga eq $msg{'dst'}) {
if($msg{'data'}+0) {
+ $dummy = `update-rc.de $daemon defaults`;
$dummy = `/etc/init.d/$daemon restart`;
return; # "started $daemon
} else {
$dummy = `/etc/init.d/$daemon stop`;
+ $dummy = `update-rc.de $daemon remove`;
return; # "stopped $daemon
}
}
@@ -29,4 +33,4 @@
# subscribe GA's
$plugin_subscribe{$ga}{$plugname} = 1;
}
-return;
\ No newline at end of file
+return;
Modified: wiregate/plugin/generic/Prowl.pl
===================================================================
--- wiregate/plugin/generic/Prowl.pl 2012-02-08 19:13:45 UTC (rev 691)
+++ wiregate/plugin/generic/Prowl.pl 2012-02-09 19:27:42 UTC (rev 692)
@@ -1,6 +1,7 @@
# Plugin um Nachrichten an Prowl zu senden
-# Version: 0.1 2010-10-14
-# Ben\xF6tigt einen Prowl-Account sowie API-Key
+# Version: 0.2 2012-01-09
+# Mit Wertabhaengigkeit, low/high-Filter
+# Benötigt einen Prowl-Account sowie API-Key
##################
### DEFINITION ###
@@ -8,19 +9,29 @@
my $socknum = 8; # Eindeutige Nummer des Sockets
-# Eigenen Aufruf-Zyklus setzen (Initialisierung/zyklisches pr\xFCfen)
+# Eigenen Aufruf-Zyklus setzen (Initialisierung/zyklisches prüfen)
$plugin_info{$plugname.'_cycle'} = 300;
my %options = ();
$options{'apikey'} = "xyzxyz";
-# Zwei M\xF6glichkeiten zur Nutzung:
+# Zwei Möglichkeiten zur Nutzung:
# VARIANTE 1: Bitwert auf GA sendet fixes Nachricht:
my %prowl_ga; # Eintrag darf nicht auskommentiert werden, solange nachfolgend keine GA definiert erfolgt kein Versand!
$prowl_ga{'14/5/208'} = '0;Event;Description Hallo;Application'; # Priority,Event,Description,Application - ggfs. NUR DIESE Zeile auskommentieren!
-# VARIANTE 2: Plugin horcht auf UDP-Port und empf\xE4ngt Format PRIO;Event;Description;Application\n
+# VARIANTE 1a: Wert im Text mit ausgeben, printf-Syntax - DPT der GA muss konfiuriert sein!
+$prowl_ga{'14/5/208'} = '0;Event;Wert %.2f;Application'; # Priority,Event,Description,Application - ggfs. NUR DIESE Zeile auskommentieren!
+$prowl_ga{'5/0/1'}[0] = '0;ausgeschaltet;Description Hallo;Buero Beleuchtung'; # Priority,Event,Description,Application - ggfs. NUR DIESE Zeile auskommentieren!
+$prowl_ga{'5/0/1'}[1] = '0;eingeschaltet;Description Hallo;Buero Beleuchtung'; # Priority,Event,Description,Application - ggfs. NUR DIESE Zeile auskommentieren!
+$prowl_ga{'4/0/0'} = '0;eingeschaltet;Description Hallo;Temperatur %.2f'; # Priority,Event,Description,Application - ggfs. NUR DIESE Zeile auskommentieren!
+my %prowl_ga_limit_high;
+my %prowl_ga_limit_low;
+$prowl_ga_limit_high{'4/0/0'} = 28;
+$prowl_ga_limit_low{'4/0/0'} = 25;
+
+# VARIANTE 2: Plugin horcht auf UDP-Port und empf�ngt Format PRIO;Event;Description;Application\n
my $recv_ip = "0.0.0.0"; # Empfangs-IP
my $recv_port = "50018"; # Empfangsport
@@ -40,20 +51,34 @@
LocalAddr => $recv_ip,
ReuseAddr => 1
)
- or return ("open of $recv_ip : $recv_port failed: $!");
+ or return ("open of $recv_ip : $recv_port failed: $!");
$socksel->add($socket[$socknum]); # add socket to select
$plugin_socket_subscribe{$socket[$socknum]} = $plugname; # subscribe plugin
# subscribe GA's
- while( my ($k, $v) = each(%prowl_ga) ) {
+ while( my ($k, $v) = each(%prowl_ga) ) {
# Plugin an Gruppenadresse "anmelden"
$plugin_subscribe{$k}{$plugname} = 1;
- }
+ }
return "opened UDP-Socket $socknum";
}
if (%msg) { # telegramm vom KNX
if ($msg{'apci'} eq "A_GroupValue_Write" and $prowl_ga{$msg{'dst'}}) {
- return sendProwl($prowl_ga{$msg{'dst'}});
+ if ($msg{'data'} eq "00") {
+ return sendProwl($prowl_ga{$msg{'dst'}}[0]);
+ }
+ elsif ($msg{'data'} eq "01") {
+ return sendProwl($prowl_ga{$msg{'dst'}}[1]);
+ }
+ elsif (defined $prowl_ga_limit_high{$msg{'dst'}} && $msg{'value'} > $prowl_ga_limit_high{$msg{'dst'}}) {
+ return sendProwl(sprintf($prowl_ga{$msg{'dst'}},$msg{'value'}));
+ }
+ elsif (defined $prowl_ga_limit_high{$msg{'dst'}} && $msg{'value'} < $prowl_ga_limit_low{$msg{'dst'}}) {
+ return sendProwl(sprintf($prowl_ga{$msg{'dst'}},$msg{'value'}));
+ }
+ else {
+ return sendProwl(sprintf($prowl_ga{$msg{'dst'}},$msg{'value'}));
+ }
}
} elsif ($fh) { # UDP-Packet
my $buf = <$fh>;
@@ -62,10 +87,10 @@
} else {
# cyclic/init/change
# subscribe GA's
- while( my ($k, $v) = each(%prowl_ga) ) {
+ while( my ($k, $v) = each(%prowl_ga) ) {
# Plugin an Gruppenadresse "anmelden"
$plugin_subscribe{$k}{$plugname} = 1;
- }
+ }
return; # ("return dunno");
}
@@ -84,11 +109,11 @@
$userAgent->agent("WireGatePlugin/1.0");
$requestURL = sprintf("https://prowl.weks.net/publicapi/add?apikey=%s&application=%s&event=%s&description=%s&priority=%d",
- $options{'apikey'},
- $options{'application'},
- $options{'event'},
- $options{'notification'},
- $options{'priority'});
+ $options{'apikey'},
+ $options{'application'},
+ $options{'event'},
+ $options{'notification'},
+ $options{'priority'});
$request = HTTP::Request->new(GET => $requestURL);
#$request->timeout(5);
@@ -96,13 +121,12 @@
$response = $userAgent->request($request);
if ($response->is_success) {
- return "Notification successfully posted: $options{'priority'},$options{'event'},$options{'description'},$options{'application'}";
+ return "Notification successfully posted: $options{'priority'},$options{'event'},$options{'description'},$options{'application'}";
} elsif ($response->code == 401) {
- return "Notification not posted: incorrect API key.";
+ return "Notification not posted: incorrect API key.";
} else {
- return "Notification not posted: " . $response->content;
+ return "Notification not posted: " . $response->content;
}
}
-return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2012-02-08 19:13:54
|
Revision: 691
http://openautomation.svn.sourceforge.net/openautomation/?rev=691&view=rev
Author: j-n-k
Date: 2012-02-08 19:13:45 +0000 (Wed, 08 Feb 2012)
Log Message:
-----------
Fix missing ,
Modified Paths:
--------------
CometVisu/trunk/visu/designs/structure_pure.js
Modified: CometVisu/trunk/visu/designs/structure_pure.js
===================================================================
--- CometVisu/trunk/visu/designs/structure_pure.js 2012-02-08 18:38:45 UTC (rev 690)
+++ CometVisu/trunk/visu/designs/structure_pure.js 2012-02-08 19:13:45 UTC (rev 691)
@@ -187,7 +187,7 @@
visible: { type: 'string', required: false },
type: { type: 'string', required: false },
colspan: { type: 'numeric', required: false },
- rowspan: { type: 'numeric', required: false }
+ rowspan: { type: 'numeric', required: false },
backdrop: { type: 'string', required: false }
},
elements: {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2012-02-08 18:38:51
|
Revision: 690
http://openautomation.svn.sourceforge.net/openautomation/?rev=690&view=rev
Author: j-n-k
Date: 2012-02-08 18:38:45 +0000 (Wed, 08 Feb 2012)
Log Message:
-----------
1) Fix for missing colspan/rowspan-attributes in <page>
2) performance improvement in colspan/rowspan calculation
Modified Paths:
--------------
CometVisu/trunk/visu/designs/structure_pure.js
CometVisu/trunk/visu/lib/templateengine.js
Modified: CometVisu/trunk/visu/designs/structure_pure.js
===================================================================
--- CometVisu/trunk/visu/designs/structure_pure.js 2012-02-05 19:49:35 UTC (rev 689)
+++ CometVisu/trunk/visu/designs/structure_pure.js 2012-02-08 18:38:45 UTC (rev 690)
@@ -186,6 +186,8 @@
ga: { type: 'addr', required: false },
visible: { type: 'string', required: false },
type: { type: 'string', required: false },
+ colspan: { type: 'numeric', required: false },
+ rowspan: { type: 'numeric', required: false }
backdrop: { type: 'string', required: false }
},
elements: {
Modified: CometVisu/trunk/visu/lib/templateengine.js
===================================================================
--- CometVisu/trunk/visu/lib/templateengine.js 2012-02-05 19:49:35 UTC (rev 689)
+++ CometVisu/trunk/visu/lib/templateengine.js 2012-02-08 18:38:45 UTC (rev 690)
@@ -142,7 +142,7 @@
function rowspanClass(rowspan) {
var className = 'rowspan'+ rowspan;
- if ( $('<div class="' + className + '" />').height() == 0 ) {
+ if ( !$('head').data(className) ) {
var dummyDiv = $('<div class="clearfix" id="calcrowspan"><div id="containerDiv" class="widget_container"><div class="widget clearfix text" id="innerDiv" /></div></div>')
.appendTo(document.body).show();
@@ -152,7 +152,7 @@
// append css style
- $('head').append('<style>.rowspan' + rowspan + ' { height: ' + rowspan*Math.round(singleHeight) + 'px; overflow:hidden;} </style>');
+ $('head').append('<style>.rowspan' + rowspan + ' { height: ' + rowspan*Math.round(singleHeight) + 'px; overflow:hidden;} </style>').data(className, 1);
}
return className;
@@ -161,7 +161,7 @@
function innerRowspanClass(rowspan) {
var className = 'innerrowspan'+ rowspan;
- if ( $('<div class="' + className + '" />').height() == 0 ) {
+ if ( !$('head').data(className)) {
var dummyDiv = $('<div class="clearfix" id="calcinnerrowspan"><div id="containerDiv" class="widget_container"><div class="widget clearfix text" id="innerDiv" /></div></div>')
.appendTo(document.body).show();
$('#containerDiv').addClass(rowspanClass(rowspan));
@@ -175,7 +175,8 @@
$('#calcinnerrowspan').remove();
// append css style
- $('head').append('<style>.innerrowspan' + rowspan + ' { height: ' + innerHeight + 'px;} </style>');
+ $('head').append('<style>.innerrowspan' + rowspan + ' { height: ' + innerHeight + 'px;} </style>').data(className, 1);
+
}
return className;
@@ -184,7 +185,7 @@
function colspanClass(colspan) {
var className = 'colspan'+ colspan;
- if ( $('<div class="' + className + '" />').width() == 0 ) {
+ if ( !$('head').data(className) ) {
var singleWidth=0;
// loop over all stylesheets and classes and find .widget_container
@@ -211,7 +212,7 @@
}
$('head').append('<style>.colspan' + colspan + ' { width: ' +
- totalWidth + '%; overflow:hidden;} </style>');
+ totalWidth + '%; overflow:hidden;} </style>').data(className, 1);
}
return className;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2012-02-05 19:49:41
|
Revision: 689
http://openautomation.svn.sourceforge.net/openautomation/?rev=689&view=rev
Author: makki1
Date: 2012-02-05 19:49:35 +0000 (Sun, 05 Feb 2012)
Log Message:
-----------
imagetrigger-widget: WiP but basics work, plenty things pending
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-02-05 18:41:40 UTC (rev 688)
+++ CometVisu/trunk/visu/designs/structure_pure.js 2012-02-05 19:49:35 UTC (rev 689)
@@ -794,6 +794,133 @@
content: false
});
+ this.addCreator("imagetrigger", {
+ create: function( page, path ) {
+ var $p = $(page);
+ var ret_val = $('<div class="widget clearfix image" />');
+ ret_val.setWidgetLayout($p);
+ ret_val.addClass ('imagetrigger');
+ var value = $p.attr('value') ? $p.attr('value') : 0;
+ var labelElement = $p.find('label')[0];
+ ret_val.append( labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '' );
+ var address = {};
+ $p.find('address').each( function(){
+ var src = this.textContent;
+ ga_list.push( src )
+ address[ '_' + src ] = [
+ this.getAttribute('transform'), {
+ 'readonly' : this.getAttribute('readonly'),
+ 'writeonly' : this.getAttribute('writeonly')
+ }
+ ];
+ //[ transform, readonly=='true', writeonly=='true' ];
+ });
+ var style = ' style=" ';
+ style += $p.attr('width' ) ? 'width:' + $p.attr('width' ) + ';' : 'width: 100%;';
+ style += $p.attr('height' ) ? 'height:' + $p.attr('height' ) + ';"' : '"';
+
+ var actor = '<div class="actor">';
+ /*
+ if ( $p.attr('type')=='bitmask' )
+ for (var i = 0; i <= 7; i++)
+ actor += '<img src="" ' + style + ' class="image" />';
+ else
+ */
+ if ( $p.attr('type')=='show' )
+ actor += '<img src="' + $p.attr('src') + '.' + $p.attr('suffix') + '" ' + style + ' />';
+ else
+ actor += '<img src="" ' + style + ' />';
+ actor += '</div>';
+ /*
+ var map = $p.attr('mapping');
+ if( mappings[map] && mappings[map][value] )
+ actor += '<div class="value">' + mappings[map][value] + '</div>';
+ else
+ actor += '<div class="value">' + value + '</div>'; //no value if no mapping
+ */
+ actor += '</div>';
+ var refresh = $p.attr('refresh') ? $p.attr('refresh')*1000 : 0;
+ var $actor = $(actor).data( {
+ 'address': address,
+ 'refresh': refresh,
+ 'src': $p.attr('src'),
+ 'suffix': $p.attr('suffix'),
+ 'type': $p.attr('type'),
+ 'mapping': map,
+ 'sendValue': $p.attr('sendValue') || ""
+ } )
+ .each(setupRefreshAction) // abuse "each" to call in context... refresh is broken with select right now
+ .bind( 'click', this.action );
+ for( var addr in address ) {
+ $actor.bind( addr, this.update );
+ }
+ ret_val.append( $actor );
+ return ret_val;
+ },
+ update: function(e,d) {
+ var data = $(this).data();
+ if ( data.address[e.type][1].writeonly == "true")
+ return; // skip writeonly FIXME: writeonly shouldnt bind to update at all
+ var val = transformDecode(data.address[e.type][0], d);
+ if (data.type == "show")
+ if (val == 0)
+ $(this).children().hide();
+ else
+ $(this).children().attr("src", data.src + '.' + data.suffix ).show();
+ else if (data.type == "select")
+ if (val == 0)
+ $(this).children().hide();
+ else
+ $(this).children().attr("src", data.src + val + '.' + data.suffix ).show();
+ /*
+ else if (data.type == "bitmask")
+ if (val == 0) { //hide all
+ $(this).children().remove(); //.hide()
+ } else {
+ for (var i = 0; i <= 7; i++) {
+ var mask = Math.pow(2,i);
+ if ((mask & val) == mask) { //show
+ $(this).children().append('<img src="' + data.src + mask + '.' + data.suffix + '" />');
+ }
+ }
+ }
+ */
+
+ //FIXME: add value if mapping exists
+ //FIXME: get image name from mapping
+ //FIXME: add bitmask for multiple images
+ //FIXME: add SVG-magics
+ },
+ action: function() {
+ var data = $(this).data();
+ sendValue = data.sendValue;
+ for( var addr in data.address ) {
+ if( data.address[addr][1].readonly == "true" )
+ continue; // skip read only
+ if( data.sendValue == "" )
+ continue; // skip empty
+ visu.write( addr.substr(1), transformEncode( data.address[addr][0], sendValue ) );
+ }
+ },
+ attributes: {
+ src: { type: 'uri' , required: true },
+ width: { type: 'string' , required: false },
+ height: { type: 'string' , required: false },
+ refresh: { type: 'numeric', required: false },
+ colspan: { type: 'numeric', required: false },
+ rowspan: { type: 'numeric', required: false },
+ sendValue: { type: 'numeric', required: false },
+ type: { type: 'list' , required: true, list: {'show': 'show', 'select': 'select' /* , 'bitmask': 'bitmask' */ } },
+ mapping: { type: 'mapping', required: false },
+ suffix: { type: 'list' , required: false, list: {'png': '.png', 'jpg': '.jpg', 'gif': '.gif', 'svg': '.svg', 'bmp': '.bmp'} }
+ },
+ elements: {
+ label: { type: 'string', required: false, multi: false },
+ address: { type: 'address', required: true, multi: true }
+ },
+ content: false
+ });
+
this.addCreator('video', {
create: function( page, path ) {
var $p = $(page);
Modified: CometVisu/trunk/visu/visu_config.xsd
===================================================================
--- CometVisu/trunk/visu/visu_config.xsd 2012-02-05 18:41:40 UTC (rev 688)
+++ CometVisu/trunk/visu/visu_config.xsd 2012-02-05 19:49:35 UTC (rev 689)
@@ -27,6 +27,7 @@
<xsd:extension base="addr">
<xsd:attribute ref="transform" use="required" />
<xsd:attribute ref="readonly" use="optional" />
+ <xsd:attribute ref="writeonly" use="optional" />
<xsd:attribute name="type" type="xsd:string" use="optional" />
<xsd:attribute name="variant" type="xsd:string" use="optional" />
</xsd:extension>
@@ -62,6 +63,7 @@
<xsd:attribute name="value" type="xsd:string" />
<xsd:attribute name="readonly" type="xsd:boolean" />
+<xsd:attribute name="writeonly" type="xsd:boolean" />
<xsd:attribute name="align" type="xsd:string" />
<xsd:attribute name="variant" type="xsd:string" />
@@ -173,6 +175,7 @@
<xsd:element name="info" type="info" />
<xsd:element name="shade" type="info" />
<xsd:element name="image" type="image" />
+ <xsd:element name="imagetrigger" type="imagetrigger" />
<xsd:element name="video" type="video" />
<xsd:element name="iframe" type="iframe" />
<!-- available plugins - include not checked -->
@@ -220,6 +223,7 @@
<xsd:element name="info" type="info" />
<xsd:element name="shade" type="info" />
<xsd:element name="image" type="image" />
+ <xsd:element name="imagetrigger" type="imagetrigger" />
<xsd:element name="video" type="video" />
<xsd:element name="iframe" type="iframe" />
<!-- available plugins - include not checked -->
@@ -357,6 +361,21 @@
<xsd:attribute name="refresh" type="xsd:decimal" />
</xsd:complexType>
+<xsd:complexType name="imagetrigger">
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="label" type="xsd:string" />
+ <xsd:element name="address" type="address" minOccurs="1"/>
+ </xsd:choice>
+ <xsd:attribute name="src" type="xsd:string"/>
+ <xsd:attribute name="suffix" type="xsd:string" use="required" />
+ <xsd:attribute name="type" type="xsd:string" use="optional" />
+ <xsd:attribute name="width" type="dimension" />
+ <xsd:attribute name="height" type="dimension" />
+ <xsd:attribute name="refresh" type="xsd:decimal" />
+ <xsd:attribute ref="mapping" use="optional" />
+ <xsd:attribute name="sendValue" type="xsd:string" use="optional" />
+</xsd:complexType>
+
<xsd:complexType name="video">
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element name="label" type="xsd:string" maxOccurs="1" />
@@ -387,7 +406,7 @@
</xsd:complexType>
<xsd:complexType name="diagram_inline">
- <xsd:choice maxOccurs="unbounded" minOccurs="1">
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element name="label" type="xsd:string" maxOccurs="1" />
</xsd:choice>
<xsd:attribute name="rrd" type="xsd:string" use="required" />
@@ -405,7 +424,7 @@
</xsd:complexType>
<xsd:complexType name="diagram_popup" >
- <xsd:choice maxOccurs="unbounded" minOccurs="1">
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element name="label" type="xsd:string" maxOccurs="1" />
</xsd:choice>
<xsd:attribute name="rrd" type="xsd:string" use="required" />
@@ -422,7 +441,7 @@
</xsd:complexType>
<xsd:complexType name="diagram_info" >
- <xsd:choice maxOccurs="unbounded" minOccurs="1">
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element name="label" type="xsd:string" maxOccurs="1" />
<xsd:element name="address" type="address" minOccurs="1"/>
</xsd:choice>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2012-02-05 18:41:46
|
Revision: 688
http://openautomation.svn.sourceforge.net/openautomation/?rev=688&view=rev
Author: j-n-k
Date: 2012-02-05 18:41:40 +0000 (Sun, 05 Feb 2012)
Log Message:
-----------
Initial commit of pitchblack-design, still work in progress (pre-beta)
Added Paths:
-----------
CometVisu/trunk/visu/designs/pitchblack/
CometVisu/trunk/visu/designs/pitchblack/README
CometVisu/trunk/visu/designs/pitchblack/basic.css
CometVisu/trunk/visu/designs/pitchblack/images/
CometVisu/trunk/visu/designs/pitchblack/images/fenster_einfach_auf.png
CometVisu/trunk/visu/designs/pitchblack/images/fenster_einfach_zu.png
CometVisu/trunk/visu/designs/pitchblack/images/fenster_zweifach_auf.png
CometVisu/trunk/visu/designs/pitchblack/images/fenster_zweifach_linksauf.png
CometVisu/trunk/visu/designs/pitchblack/images/fenster_zweifach_rechtsauf.png
CometVisu/trunk/visu/designs/pitchblack/images/fenster_zweifach_zu.png
CometVisu/trunk/visu/designs/pitchblack/images/jal_down.png
CometVisu/trunk/visu/designs/pitchblack/images/jal_stop.png
CometVisu/trunk/visu/designs/pitchblack/images/jal_up.png
CometVisu/trunk/visu/designs/pitchblack/images/licht-an.png
CometVisu/trunk/visu/designs/pitchblack/images/licht-aus.png
Added: CometVisu/trunk/visu/designs/pitchblack/README
===================================================================
--- CometVisu/trunk/visu/designs/pitchblack/README (rev 0)
+++ CometVisu/trunk/visu/designs/pitchblack/README 2012-02-05 18:41:40 UTC (rev 688)
@@ -0,0 +1,5 @@
+Design-Guidelines:
+------------------
+
+ - <label>-elements, use <text>-Widgets instead (exception: in <diagram_*> and <rsslog> the labels are used as caption)
+ - define proper stylings for switch/trigger widget (example will be added)
Property changes on: CometVisu/trunk/visu/designs/pitchblack/README
___________________________________________________________________
Added: svn:executable
+ *
Added: CometVisu/trunk/visu/designs/pitchblack/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/pitchblack/basic.css (rev 0)
+++ CometVisu/trunk/visu/designs/pitchblack/basic.css 2012-02-05 18:41:40 UTC (rev 688)
@@ -0,0 +1,407 @@
+@font-face { font-family: Verdana,Helvetica,sans-serif; }
+
+/* all text-color definitions */
+
+body, .nav_path a, .link > div, .link a {
+ color: /* normaltext */ #D0D0D0;
+}
+
+.footer, .footer *, #diagramTooltip {
+ color: /* black */ #000000;
+}
+
+/* all background definitions */
+
+body, body hr, #pages hr {
+ background: /* background */ #121212;
+}
+
+.popup_background {
+ opacity: 0.98;
+}
+
+.popup_background .error {
+ background: #800000;
+}
+
+#diagramTooltip {
+ background: #fee;
+ opacity: 0.80;
+}
+
+div#top, .widget, .popup_background {
+ background: -moz-linear-gradient(top, #606060, #0D0D0D .3em ) transparent;
+ background: -webkit-linear-gradient(top, #606060, #0D0D0D .3em);
+}
+
+/* border definitions */
+
+div#top , .widget, .popup_background {
+ border-color: /* border */ #202020;
+ border-style: solid;
+ border-width: 0 0.05em 0.05em 0.05em;
+}
+
+#pages hr, body hr {
+ border: none;
+}
+
+.popup > div.head {
+ border-bottom: 1px solid;
+}
+
+.popup_background.error {
+ border: #f00;
+}
+
+#diagramTooltip {
+ border: 1px solid #fdd;
+}
+
+/* margins */
+
+body , body hr, #pages hr{
+ margin: 0;
+}
+
+div#top, .widget {
+ margin: .2em .1em 0 .1em;
+}
+
+.nav_path , .widget .actor, .diagram_inline {
+ margin-left: .2em;
+}
+
+.popup > div.head {
+ margin: 0.3em .2em 0 0.2em;
+}
+
+.popup > div.main {
+ margin: 1em auto 4px auto !important;
+}
+
+h2 {
+ margin: 5px 15px 5px 0;
+}
+
+.image .actor {
+ margin-top: 0.3em;
+}
+
+.lighton, .lightoff, .jalup, .jaldown, .jalstop , /* for all image buttons, top-margin=gradient-height */
+ .singlewindowopen, .singlewindowclosed, .doublewindowbothopen, .doublewindowbothclosed,
+ .doublewindowleftopen, .doublewindowrightopen {
+ margin: 0.3em 0 0 0 !important;
+ width: 100%;
+ height: 100%;
+}
+
+/* paddings */
+
+.lighton, .lightoff { /* image-buttons */
+ padding: 0 !important;
+ background-size: 2.6em 2.6em !important;
+}
+
+.widget, div#top {
+ padding: 0.3em;
+}
+
+.text >div, .rsslog .label, .popup >div.head {
+ padding-left: 0.3em;
+}
+
+#diagramTooltip {
+ padding: 2px;
+}
+
+/*
+ * fonts
+*/
+
+body {
+ font-family: Verdana;
+ font-size: 5.5mm;
+ overflow: hidden;
+}
+
+h2 {
+ font-size: 1.25em;
+}
+
+.rsslogRow, div#jqclock_head, .footer, .footer * {
+ font-size:80%;
+}
+
+.lighton > div, .lightoff > div, .jalup > div, .jaldown > div, /* image-buttons */
+ .jalstop > div, .singlewindowopen > div, .singlewindowclosed > div, .doublewindowleftopen > div,
+ .doublewindowrightopen >div, .doublewindowbothclosed >div, .doublewindowbothopen >div {
+ font-size:0%;
+}
+
+/*
+ * images
+*/
+
+.lighton {
+ background: url(images/licht-an.png) no-repeat center center;
+}
+
+.lightoff {
+ background: url(images/licht-aus.png) no-repeat center center;
+}
+
+.jalup {
+ background: url(images/jal_up.png) no-repeat center center;
+}
+
+.jaldown {
+ background: url(images/jal_down.png) no-repeat center center;
+}
+
+.jalstop {
+ background: url(images/jal_stop.png) no-repeat center center;
+}
+
+.singlewindowopen {
+ background: url(images/fenster_einfach_auf.png) no-repeat center center;
+}
+
+.singlewindowclosed {
+ background: url(images/fenster_einfach_zu.png) no-repeat center center;
+}
+
+.doublewindowleftopen {
+ background: url(images/fenster_zweifach_linksauf.png) no-repeat center center;
+}
+
+.doublewindowrightopen {
+ background: url(images/fenster_zweifach_rechtsauf.png) no-repeat center center;
+}
+
+.doublewindowbothopen {
+ background: url(images/fenster_zweifach_auf.png) no-repeat center center;
+}
+
+.doublewindowbothclosed {
+ background: url(images/fenster_zweifach_zu.png) no-repeat center center;
+}
+
+/*
+ * layout definitions
+*/
+
+body {
+ overflow: hidden;
+}
+
+
+body hr, body br, #pages hr {
+ clear: both;
+}
+
+body hr {
+ height: 1px;
+}
+
+#pages hr {
+ height: .3em;
+}
+
+.page h1, div#loading {
+ display: none !important;
+}
+
+.label {
+ display: none;
+}
+
+.rsslog .label {
+ display: inline-block;
+}
+
+.rsslogRow {
+ line-height: 1.3em;
+}
+
+.center {
+ text-align: center !important;
+}
+
+.nav_path, .widget_container, .text > div, .widget .label, .widget .actor,
+ .widget .actor div, .page {
+ float:left;
+}
+
+.nav_path a, .link a {
+ text-decoration:none;
+}
+
+.footer, .footer * {
+ vertical-align: middle;
+}
+
+.widget_container {
+ width: 8.33333%;
+}
+
+.widget_container .widget_container, .link > div, .link a , .switchPressed,
+ .switchUnpressed, * html>body .clearfix, .info > div, .actor .value , .text>div{
+ width: 100%;
+}
+
+.widget, div#top {
+ min-height: 2.4em;
+}
+
+.widget .label, .widget .info .actor, .text > div, .link > div, .link a,
+ div#top, .value, .popup >div.head {
+ line-height: 2.4em;
+}
+
+.text > div, .widget .label, .widget .actor {
+ text-align:left;
+}
+
+.widget .info .actor, .link > div, .link a, .value {
+ text-align: center;
+}
+
+.link > div, .link a, .clearfix {
+ display: inline-block;
+}
+
+.widget .label {
+ width: 49%;
+}
+
+.widget .actor {
+ line-height: 2.0em;
+}
+.widget .actor div {
+ white-space: pre-wrap;
+}
+
+.page {
+ width: 900px;
+ overflow: auto;
+ position: relative;
+}
+
+ .ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: .4em; height: 1.2em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
+
+ .ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.40em; margin-left: -0.4em;}
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+ .ui-widget-content { border: 1px solid #707070; background: #000000 ; color: #000000; }
+ .ui-widget-content a { color: #333333; }
+ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #000 ; font-weight: bold; color: #1c94c4; }
+ .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
+
+
+.widget .ui-slider
+{
+ width: 90%;
+ margin: 0.9em 5% 0 5%;
+ border-color: #D0D0D0;
+ background: #121212;
+ vertical-align:middle;
+}
+
+.widget .ui-slider-handle
+{
+ border-style: solid;
+ padding: 1px;
+ background: #121212;
+ border-width: 3px;
+ border-color: #D0D0D0;
+}
+
+/* Clearfix */
+.clearfix:after {
+ content: ".";
+ clear: both;
+ visibility: hidden;
+ line-height: 0;
+ height: 0;
+}
+
+html[xmlns] .clearfix, .clearfix:after {
+ display: block;
+}
+
+*:first-child+html .clearfix {
+ min-height: 0;
+}
+
+* html .clearfix {
+ height: 1%;
+}
+
+* html>body .clearfix {
+ display: inline-block;
+}
+
+.loading {
+ display: block !important;
+}
+
+.popup, .popup_background {
+ position: absolute;
+ width: 90%;
+ height: 90%;
+ top: 5%;
+ left: 5%;
+}
+
+.popup {
+ z-index: 101;
+ background: transparent;
+}
+
+.popup_background {
+ z-index: 100;
+}
+
+.clickable {
+ cursor: pointer;
+}
+
+.diagram_inline {
+ width: 320px;
+ height: 180px;
+}
+
+.diagram_preview {
+ width: 240px;
+ height: 2em;
+}
+
+#diagramTooltip {
+ z-index: 1000;
+}
+
+/* styles for the preview */
+div#demo_1, div#demo_2 {
+ width: 100%;
+ height: 44px;
+}
+
+div#demo_1 {
+ background-color: black;
+}
+
+div#demo_2 {
+ height: 2px;
+ background-color: white;
+}
+
+div#demo_3 {
+ background-color: #1d1d1d;
+}
+
Property changes on: CometVisu/trunk/visu/designs/pitchblack/basic.css
___________________________________________________________________
Added: svn:executable
+ *
Added: CometVisu/trunk/visu/designs/pitchblack/images/fenster_einfach_auf.png
===================================================================
(Binary files differ)
Property changes on: CometVisu/trunk/visu/designs/pitchblack/images/fenster_einfach_auf.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: CometVisu/trunk/visu/designs/pitchblack/images/fenster_einfach_zu.png
===================================================================
(Binary files differ)
Property changes on: CometVisu/trunk/visu/designs/pitchblack/images/fenster_einfach_zu.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: CometVisu/trunk/visu/designs/pitchblack/images/fenster_zweifach_auf.png
===================================================================
(Binary files differ)
Property changes on: CometVisu/trunk/visu/designs/pitchblack/images/fenster_zweifach_auf.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: CometVisu/trunk/visu/designs/pitchblack/images/fenster_zweifach_linksauf.png
===================================================================
(Binary files differ)
Property changes on: CometVisu/trunk/visu/designs/pitchblack/images/fenster_zweifach_linksauf.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: CometVisu/trunk/visu/designs/pitchblack/images/fenster_zweifach_rechtsauf.png
===================================================================
(Binary files differ)
Property changes on: CometVisu/trunk/visu/designs/pitchblack/images/fenster_zweifach_rechtsauf.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: CometVisu/trunk/visu/designs/pitchblack/images/fenster_zweifach_zu.png
===================================================================
(Binary files differ)
Property changes on: CometVisu/trunk/visu/designs/pitchblack/images/fenster_zweifach_zu.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: CometVisu/trunk/visu/designs/pitchblack/images/jal_down.png
===================================================================
(Binary files differ)
Property changes on: CometVisu/trunk/visu/designs/pitchblack/images/jal_down.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: CometVisu/trunk/visu/designs/pitchblack/images/jal_stop.png
===================================================================
(Binary files differ)
Property changes on: CometVisu/trunk/visu/designs/pitchblack/images/jal_stop.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: CometVisu/trunk/visu/designs/pitchblack/images/jal_up.png
===================================================================
(Binary files differ)
Property changes on: CometVisu/trunk/visu/designs/pitchblack/images/jal_up.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: CometVisu/trunk/visu/designs/pitchblack/images/licht-an.png
===================================================================
(Binary files differ)
Property changes on: CometVisu/trunk/visu/designs/pitchblack/images/licht-an.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: CometVisu/trunk/visu/designs/pitchblack/images/licht-aus.png
===================================================================
(Binary files differ)
Property changes on: CometVisu/trunk/visu/designs/pitchblack/images/licht-aus.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2012-02-05 18:40:20
|
Revision: 687
http://openautomation.svn.sourceforge.net/openautomation/?rev=687&view=rev
Author: j-n-k
Date: 2012-02-05 18:40:14 +0000 (Sun, 05 Feb 2012)
Log Message:
-----------
Fix broken diagram-Widget (forgot 2 renames in svn-copy)
Modified Paths:
--------------
CometVisu/trunk/visu/plugins/diagram/structure_plugin.js
Modified: CometVisu/trunk/visu/plugins/diagram/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/diagram/structure_plugin.js 2012-02-05 18:04:08 UTC (rev 686)
+++ CometVisu/trunk/visu/plugins/diagram/structure_plugin.js 2012-02-05 18:40:14 UTC (rev 687)
@@ -98,7 +98,7 @@
var id = "diagram_" + uniqid();
var ret_val = $('<div class="widget clearfix diagram" />');
- ret_val.setWidgetStyle($p).makeWidgetLabel($p);
+ ret_val.setWidgetLayout($p).makeWidgetLabel($p);
var actor = $("<div class=\"actor\"><div class=\"diagram_preview\" id=\"" + id + "\">loading...</div></div>");
var diagram = $("#" + id, actor);
@@ -220,7 +220,7 @@
var id = "diagram_" + uniqid();
var ret_val = $('<div class="widget clearfix diagram" />');
- ret_val.setWidgetStyle($p).makeWidgetLabel($p);
+ ret_val.setWidgetLayout($p).makeWidgetLabel($p);
var actor = '<div class="actor switchUnpressed ';
if ( $p.attr( 'align' ) )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2012-02-05 18:04:15
|
Revision: 686
http://openautomation.svn.sourceforge.net/openautomation/?rev=686&view=rev
Author: j-n-k
Date: 2012-02-05 18:04:08 +0000 (Sun, 05 Feb 2012)
Log Message:
-----------
Rename .setWidgetStyle to .setWidgetLayout to avoid
problems with .setWidgetStyling
Modified Paths:
--------------
CometVisu/trunk/visu/designs/structure_pure.js
CometVisu/trunk/visu/plugins/colorchooser/structure_plugin.js
CometVisu/trunk/visu/plugins/diagram/structure_plugin.js
CometVisu/trunk/visu/plugins/gweather/structure_plugin.js
CometVisu/trunk/visu/plugins/jqclock/structure_plugin.js
CometVisu/trunk/visu/plugins/rss/structure_plugin.js
CometVisu/trunk/visu/plugins/rsslog/structure_plugin.js
CometVisu/trunk/visu/plugins/upnpcontroller/structure_plugin.js
Modified: CometVisu/trunk/visu/designs/structure_pure.js
===================================================================
--- CometVisu/trunk/visu/designs/structure_pure.js 2012-02-05 17:53:36 UTC (rev 685)
+++ CometVisu/trunk/visu/designs/structure_pure.js 2012-02-05 18:04:08 UTC (rev 686)
@@ -54,7 +54,7 @@
* implemented: rowspan, colspan
*/
-$.fn.setWidgetStyle = function(page) {
+$.fn.setWidgetLayout = function(page) {
this.data('colspanClass', colspanClass(page.attr('colspan') || 1));
if (page.attr('rowspan')) {
this.data('rowspanClass', rowspanClass(page.attr('rowspan') || 1));
@@ -154,7 +154,7 @@
ret_val=$('');
} else { // default is visible
ret_val = $('<div class="widget clearfix link pagelink"/>');
- ret_val.setWidgetStyle($p);
+ ret_val.setWidgetLayout($p);
ret_val.append( '<div ' + wstyle + '><a href="javascript:scrollToPage(\''+path+'\')">' + name + '</a></div>' );
}
@@ -272,7 +272,7 @@
create: function( page, path ) {
var $p = $(page);
var ret_val = $('<div class="widget clearfix text" />');
- ret_val.setWidgetStyle($p);
+ ret_val.setWidgetLayout($p);
var style = '';
if( $p.attr('align') ) style += 'text-align:' + $p.attr('align') + ';';
if( style != '' ) style = 'style="' + style + '"';
@@ -295,7 +295,7 @@
var layout = $p.find('layout')[0];
var style = layout ? 'style="' + extractLayout( layout ) + '"' : '';
var ret_val = $('<div class="widget clearfix info" ' + style + ' />');
- ret_val.setWidgetStyle($p).makeWidgetLabel($p);
+ ret_val.setWidgetLayout($p).makeWidgetLabel($p);
var address = makeAddressList($p);
var actor = '<div class="actor"><div class="value">-</div></div>';
@@ -331,7 +331,7 @@
var layout = $p.find('layout')[0];
var style = layout ? 'style="' + extractLayout( layout ) + '"' : '';
var ret_val = $('<div class="widget clearfix slide" ' + style + ' />');
- ret_val.setWidgetStyle($p).makeWidgetLabel($p);
+ ret_val.setWidgetLayout($p).makeWidgetLabel($p);
var address = {};
var datatype_min = undefined;
var datatype_max = undefined;
@@ -445,7 +445,7 @@
create: function( page, path ) {
var $p = $(page);
var ret_val = $('<div class="widget clearfix switch" />');
- ret_val.setWidgetStyle($p)
+ ret_val.setWidgetLayout($p)
var labelElement = $p.find('label')[0];
var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
var address = makeAddressList($p);
@@ -502,7 +502,7 @@
create: function( page, path ) {
var $p = $(page);
var ret_val = $('<div class="widget clearfix toggle" />');
- ret_val.setWidgetStyle($p);
+ ret_val.setWidgetLayout($p);
var labelElement = $p.find('label')[0];
var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
var address = makeAddressList($p);
@@ -562,7 +562,7 @@
create: function( page, path ) {
var $p = $(page);
var ret_val = $('<div class="widget clearfix switch" />');
- ret_val.setWidgetStyle($p)
+ ret_val.setWidgetLayout($p)
var labelElement = $p.find('label')[0];
var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
var address = makeAddressList($p);
@@ -706,7 +706,7 @@
var $p = $(page);
var value = $p.attr('value') ? $p.attr('value') : 0;
var ret_val = $('<div class="widget clearfix switch" />');
- ret_val.setWidgetStyle($p);
+ ret_val.setWidgetLayout($p);
var labelElement = $p.find('label')[0];
var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
var address = makeAddressList($p);
@@ -762,7 +762,7 @@
create: function( page, path ) {
var $p = $(page);
var ret_val = $('<div class="widget clearfix image" />');
- ret_val.setWidgetStyle($p);
+ ret_val.setWidgetLayout($p);
var labelElement = $p.find('label')[0];
ret_val.append( labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '' );
var style = '';
@@ -798,7 +798,7 @@
create: function( page, path ) {
var $p = $(page);
var ret_val = $('<div class="widget clearfix video" />');
- ret_val.setWidgetStyle($p);
+ ret_val.setWidgetLayout($p);
var labelElement = $p.find('label')[0];
ret_val.append( labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '' );
var autoplay = ($p.attr('autoplay') && $p.attr('autoplay')=='true') ? ' autoplay="autoplay"' : '';
@@ -828,7 +828,7 @@
create: function( page, path ) {
var $p = $(page);
var ret_val = $('<div class="widget iframe" />');
- ret_val.setWidgetStyle($p);
+ ret_val.setWidgetLayout($p);
ret_val.append( '<div class="label">' + page.textContent + '</div>' );
var style = '';
if( $p.attr('width' ) ) {
@@ -868,7 +868,7 @@
create: function( page, path ) {
var $p = $(page);
var ret_val = $('<div class="widget clearfix switch" />');
- ret_val.setWidgetStyle($p);
+ ret_val.setWidgetLayout($p);
// handle label
var labelElement = $p.find('label')[0];
var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
@@ -1196,7 +1196,6 @@
return { x: 0, y: 0 }; // sanity return
}
-
function defaultUpdate( e, data, passedElement )
{
var element = passedElement || $(this);
Modified: CometVisu/trunk/visu/plugins/colorchooser/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/colorchooser/structure_plugin.js 2012-02-05 17:53:36 UTC (rev 685)
+++ CometVisu/trunk/visu/plugins/colorchooser/structure_plugin.js 2012-02-05 18:04:08 UTC (rev 686)
@@ -24,7 +24,7 @@
create: function( page, path ) {
var $p = $(page);
var ret_val = $('<div class="widget clearfix colorChooser" />');
- ret_val.setWidgetStyle($p);
+ ret_val.setWidgetLayout($p);
var labelElement = $p.find('label')[0];
var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
var address = {};
Modified: CometVisu/trunk/visu/plugins/diagram/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/diagram/structure_plugin.js 2012-02-05 17:53:36 UTC (rev 685)
+++ CometVisu/trunk/visu/plugins/diagram/structure_plugin.js 2012-02-05 18:04:08 UTC (rev 686)
@@ -33,7 +33,7 @@
var id = "diagram_" + uniqid();
var ret_val = $('<div class="widget clearfix diagram" />');
- ret_val.setWidgetStyle($p).makeWidgetLabel($p);
+ ret_val.setWidgetLayout($p).makeWidgetLabel($p);
var actor = $("<div class=\"actor\"><div class=\"diagram_inline\" id=\"" + id + "\">loading...</div></div>");
var diagram = $("#" + id, actor);
Modified: CometVisu/trunk/visu/plugins/gweather/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/gweather/structure_plugin.js 2012-02-05 17:53:36 UTC (rev 685)
+++ CometVisu/trunk/visu/plugins/gweather/structure_plugin.js 2012-02-05 18:04:08 UTC (rev 686)
@@ -32,8 +32,8 @@
var id = "gweather_" + uniqid();
- var ret_val = $('<div class="widget clearfix" />');
- ret_val.addClass( 'gweather' );
+ var ret_val = $('<div class="widget clearfix gweather" />');
+ ret_val.setWidgetLayout($p);
var label = '<div class="label">' + page.textContent + '</div>';
var actor = $("<div class=\"actor\"><div class=\"gweather\" id=\"" + id + "\">loading</div></div>");
var gweather = $("#" + id, actor);
Modified: CometVisu/trunk/visu/plugins/jqclock/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/jqclock/structure_plugin.js 2012-02-05 17:53:36 UTC (rev 685)
+++ CometVisu/trunk/visu/plugins/jqclock/structure_plugin.js 2012-02-05 18:04:08 UTC (rev 686)
@@ -32,13 +32,8 @@
var id = "jqclock_" + uniqid();
var ret_val = $('<div class="widget clearfix jqclock" />');
- if ($p.attr("rowspan")) { // add rowspan only if not default
- ret_val.addClass(rowspanClass($p.attr("rowspan")));
- }
- if ($p.attr("colspan")) { // add colspan only if not default
- ret_val.data("colspanClass", colspanClass($p.attr("colspan")));
- }
-
+ ret_val.setWidgetLayout($p);
+
var label = '<div class="label">' + page.textContent + '</div>';
var actor = $("<div class=\"actor\"><div class=\"jqclock_inline\" id=\"" + id + "\"></div></div>");
var jqclock = $("#"+id,actor);
Modified: CometVisu/trunk/visu/plugins/rss/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/rss/structure_plugin.js 2012-02-05 17:53:36 UTC (rev 685)
+++ CometVisu/trunk/visu/plugins/rss/structure_plugin.js 2012-02-05 18:04:08 UTC (rev 686)
@@ -39,8 +39,8 @@
var id = "rss_" + uniqid();
- var ret_val = $('<div class="widget clearfix" />');
- ret_val.addClass( 'rss' );
+ var ret_val = $('<div class="widget clearfix rss" />');
+ ret_val.setWidgetLayout($p);
var label = '<div class="label">' + page.textContent + '</div>';
var actor = $("<div class=\"actor\"><div class=\"rss_inline\" id=\"" + id + "\"></div>");
var rss = $("#" + id, actor);
Modified: CometVisu/trunk/visu/plugins/rsslog/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/rsslog/structure_plugin.js 2012-02-05 17:53:36 UTC (rev 685)
+++ CometVisu/trunk/visu/plugins/rsslog/structure_plugin.js 2012-02-05 18:04:08 UTC (rev 686)
@@ -42,7 +42,7 @@
var id = "rss_" + uniqid();
var ret_val = $('<div class="widget clearfix rsslog" />');
- ret_val.setWidgetStyle($p);
+ ret_val.setWidgetLayout($p);
var labelElement = $p.find('label')[0];
var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
Modified: CometVisu/trunk/visu/plugins/upnpcontroller/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/upnpcontroller/structure_plugin.js 2012-02-05 17:53:36 UTC (rev 685)
+++ CometVisu/trunk/visu/plugins/upnpcontroller/structure_plugin.js 2012-02-05 18:04:08 UTC (rev 686)
@@ -35,8 +35,8 @@
var id = "upnpcontroller_" + uniqid();
upnpcontroller_uid = id;
- var ret_val = $('<div class="widget" />');
- ret_val.addClass( 'upnpcontroller' );
+ var ret_val = $('<div class="widget upnpcontroller" />');
+ ret_val.setWidgetLayout($p);
var label = '<div class="label">' + $p.attr("label") + '</div>';
var actor = $("<div class=\"actor\"><div class=\"upnpcontroller\" id=\"" + id + "\">loading</div></div>");
var upnpcontroller = $("#" + id, actor);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2012-02-05 17:53:43
|
Revision: 685
http://openautomation.svn.sourceforge.net/openautomation/?rev=685&view=rev
Author: j-n-k
Date: 2012-02-05 17:53:36 +0000 (Sun, 05 Feb 2012)
Log Message:
-----------
Fix broken diagram-refresh
Modified Paths:
--------------
CometVisu/trunk/visu/plugins/diagram/structure_plugin.js
Modified: CometVisu/trunk/visu/plugins/diagram/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/diagram/structure_plugin.js 2012-02-05 17:11:48 UTC (rev 684)
+++ CometVisu/trunk/visu/plugins/diagram/structure_plugin.js 2012-02-05 17:53:36 UTC (rev 685)
@@ -429,7 +429,7 @@
if (typeof (refresh) != "undefined" && refresh) {
// reload regularly
window.setTimeout(function(diagram, flotoptions, data) {
- refreshDiagram(diagram, flotoptions, data)
+ refreshDiagram(diagram, flotoptions, data);
}, refresh * 1000, diagram, flotoptions, data);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2012-02-05 17:11:54
|
Revision: 684
http://openautomation.svn.sourceforge.net/openautomation/?rev=684&view=rev
Author: j-n-k
Date: 2012-02-05 17:11:48 +0000 (Sun, 05 Feb 2012)
Log Message:
-----------
Fix CSS for gweather plugin
Modified Paths:
--------------
CometVisu/trunk/visu/plugins/gweather/gweather.css
Modified: CometVisu/trunk/visu/plugins/gweather/gweather.css
===================================================================
--- CometVisu/trunk/visu/plugins/gweather/gweather.css 2012-02-05 17:10:03 UTC (rev 683)
+++ CometVisu/trunk/visu/plugins/gweather/gweather.css 2012-02-05 17:11:48 UTC (rev 684)
@@ -1,44 +1,43 @@
.gweather {
- overflow: auto;
- padding: 10px;
- margin: 10px;
-/* background: #ccc; */
+ overflow: hidden;
+ /*padding: 10px;
+ margin: 10px; */
}
.gweather div.day {
- font-family: Verdana;
- float: left;
- border: 1px dashed #777;
-/* background: #bbf; */
- width: 150px;
- margin: 5px;
- padding: 5px;
+ font-family: Verdana;
+ float: left;
+ border: 1px dashed #777;
+ width: 150px;
+ margin: 5px;
+ padding: 5px;
}
.gweather img {
- float: left;
-/* height: 32px; */
+ float: left;
}
.gweather div.name {
- font-weight: bold;
- height: 24px;
- padding: 4px 4px 4px 4px;
+ font-weight: bold;
+ height: 24px;
+ padding: 4px 4px 4px 4px;
}
.gweather .condition {
- font-size: 12px;
- padding: 0;
- margin: 5px 0;
- text-align: left;
- height: 58px;
- overflow: hidden;
+ font-size: .4em;
+ padding: 0;
+ margin: 5px 0;
+ text-align: left;
+ height: auto;
+ overflow: hidden;
}
.gweather .temp {
- padding: 0;
- margin: 0;
- text-align: center;
-}
+ padding: 0;
+ margin: 0;
+ text-align: center;
+ clear:left;
+}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2012-02-05 17:10:09
|
Revision: 683
http://openautomation.svn.sourceforge.net/openautomation/?rev=683&view=rev
Author: j-n-k
Date: 2012-02-05 17:10:03 +0000 (Sun, 05 Feb 2012)
Log Message:
-----------
Remove jsonfeedviwe widget
Removed Paths:
-------------
CometVisu/trunk/visu/plugins/jsonfeedview/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2012-02-05 16:00:13
|
Revision: 682
http://openautomation.svn.sourceforge.net/openautomation/?rev=682&view=rev
Author: makki1
Date: 2012-02-05 16:00:07 +0000 (Sun, 05 Feb 2012)
Log Message:
-----------
CV-Editor: Dropdown-list for RRD in diagram-widgets
Modified Paths:
--------------
CometVisu/trunk/visu/edit/cometeditor.js
CometVisu/trunk/visu/edit/get_widget_diagram.php
Modified: CometVisu/trunk/visu/edit/cometeditor.js
===================================================================
--- CometVisu/trunk/visu/edit/cometeditor.js 2012-02-05 10:53:34 UTC (rev 681)
+++ CometVisu/trunk/visu/edit/cometeditor.js 2012-02-05 16:00:07 UTC (rev 682)
@@ -214,6 +214,17 @@
}
break;
+ case "string": //FIXME: for filling in RRD-name, better would be change attribute e.type=rrd?
+ if (index == "rrd") {
+ $input.append($("<select id=\"add_rrd\" />"));
+ $input.find("select:first").append(Editor.getRRDObject());
+ if (typeof values._attributes != "undefined"
+ && typeof values._attributes[index] != "undefined") {
+ $input.find("option[value='" + values._attributes[index] + "']").attr("selected", "selected");
+ }
+ //FIXME: provide text-input if RRDs failed to get fetched
+ break;
+ } //else fall through
default:
$input.append($("<input type=\"text\" id=\"add_" + index + "\" />"));
@@ -627,6 +638,20 @@
return Editor.cache.cachedDPTObject;
}
+ Editor.getRRDObject = function() {
+ if (typeof Editor.cache.cachedRRDObject == "object") {
+ return Editor.cache.cachedRRDObject.clone();
+ }
+ var element = $("<select />");
+ $.each(Editor.cache.rrdCache, function(file, rrdEntry) {
+ file = file.substring(0,file.lastIndexOf("."));
+ element.append($("<option />").attr("value", file)
+ .html("" + rrdEntry.name + ": " + file + ".rrd (" + rrdEntry.address + ")")
+ );
+ });
+ Editor.cache.cachedRRDObject = element.children();
+ return Editor.cache.cachedRRDObject;
+ }
};
var CometEditorHTMLLayer = function() {
Modified: CometVisu/trunk/visu/edit/get_widget_diagram.php
===================================================================
--- CometVisu/trunk/visu/edit/get_widget_diagram.php 2012-02-05 10:53:34 UTC (rev 681)
+++ CometVisu/trunk/visu/edit/get_widget_diagram.php 2012-02-05 16:00:07 UTC (rev 682)
@@ -21,7 +21,7 @@
$arrRRDParts = explode("_", $filebase, 2);
$arrRRDtype = explode(".", $arrRRDParts[1], 2);
$arrAdresses[$filebase] = array(
- "adddress" => $arrOW[$arrRRDParts[0]]['eib_ga_'.$arrRRDtype[0]],
+ "address" => $arrOW[$arrRRDParts[0]]['eib_ga_'.$arrRRDtype[0]],
"name" => utf8_encode($arrOW[$arrRRDParts[0]]['name']),
"dpt" => $arrGA[$arrOW[$arrRRDParts[0]]['eib_ga_'.$arrRRDtype[0]]]['DPTSubId']
);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2012-02-05 10:53:40
|
Revision: 681
http://openautomation.svn.sourceforge.net/openautomation/?rev=681&view=rev
Author: makki1
Date: 2012-02-05 10:53:34 +0000 (Sun, 05 Feb 2012)
Log Message:
-----------
writeonly for addresses in editor
Modified Paths:
--------------
CometVisu/trunk/visu/edit/cometeditor.js
CometVisu/trunk/visu/edit/style_edit.css
CometVisu/trunk/visu/edit/visuconfig_edit.js
Modified: CometVisu/trunk/visu/edit/cometeditor.js
===================================================================
--- CometVisu/trunk/visu/edit/cometeditor.js 2012-02-02 18:59:06 UTC (rev 680)
+++ CometVisu/trunk/visu/edit/cometeditor.js 2012-02-05 10:53:34 UTC (rev 681)
@@ -117,6 +117,7 @@
objData._attributes.transform = "";
objData._attributes.variant = "";
objData._attributes.readonly = false;
+ objData._attributes.writeonly = false;
var elementDiv = HTMLLayer.createAddressEditorElement(objData, e.options);
$input.find("div.multi_element").append(elementDiv);
@@ -313,6 +314,7 @@
.attr("transform", $(e).data("transform"))
.attr("variant", $(e).data("variant") || "")
.attr("readonly", $(e).data("readonly") == true ? "true" : "false")
+ .attr("writeonly", $(e).data("writeonly") == true ? "true" : "false")
.append($(e).data("address"));
dataObject.append($address);
});
@@ -494,6 +496,7 @@
myElement._attributes.transform = jQuery(element).attr("transform");
myElement._attributes.readonly = jQuery(element).attr("readonly");
+ myElement._attributes.writeonly = jQuery(element).attr("writeonly");
myElement._attributes.variant = jQuery(element).attr("variant") || "";
break;
default:
@@ -640,7 +643,8 @@
.append("<div class=\"value editable\" />")
.append("<div class=\"transform editable\" />")
.append("<div class=\"variant editable\" />")
- .append("<div class=\"readonly editable\" />");
+ .append("<div class=\"readonly editable\" />")
+ .append("<div class=\"writeonly editable\" />");
//myDiv.find(".title").append();
var t = Editor.getAddressesObject();
elementDiv.find(".title").append(t.find("option[value='" + elementData.textContent + "']").text());
@@ -653,9 +657,11 @@
elementDiv.find(".variant").hide();
}
elementDiv.find(".readonly").append(elementData._attributes.readonly == "true" ? "readonly" : "")
+ elementDiv.find(".writeonly").append(elementData._attributes.writeonly == "true" ? "writeonly" : "")
elementDiv.data("transform", elementData._attributes.transform)
.data("readonly", elementData._attributes.readonly == "true" ? true : false)
+ .data("writeonly", elementData._attributes.writeonly == "true" ? true : false)
.data("address", elementData.textContent);
if (typeof options == "undefined" || typeof options.variant == "undefined" || options.variant == false) {
Modified: CometVisu/trunk/visu/edit/style_edit.css
===================================================================
--- CometVisu/trunk/visu/edit/style_edit.css 2012-02-02 18:59:06 UTC (rev 680)
+++ CometVisu/trunk/visu/edit/style_edit.css 2012-02-05 10:53:34 UTC (rev 681)
@@ -122,13 +122,13 @@
height: 1em;
}
-.element .value, .element .transform, .element .readonly, .element .variant {
+.element .value, .element .transform, .element .readonly, .element .writeonly, .element .variant {
font-weight: normal;
height: 1em;
font-size: small;
}
-.element .value, .element .readonly {
+.element .value, .element .readonly, .element .writeonly {
float: left;
}
@@ -141,6 +141,11 @@
font-style: italic;
}
+.element .writeonly {
+ margin-left: .4em;
+ font-style: italic;
+}
+
.element .variant {
float: left;
margin-left: .4em;
Modified: CometVisu/trunk/visu/edit/visuconfig_edit.js
===================================================================
--- CometVisu/trunk/visu/edit/visuconfig_edit.js 2012-02-02 18:59:06 UTC (rev 680)
+++ CometVisu/trunk/visu/edit/visuconfig_edit.js 2012-02-05 10:53:34 UTC (rev 681)
@@ -267,6 +267,13 @@
myElement.find("input").attr("checked", "checked");
}
}
+ if ($e.hasClass("writeonly")) {
+ element.find("label").html("writeonly");
+ myElement.append($("<input type=\"checkbox\" name=\"add_writeonly\" class=\"add_writeonly\" value=\"true\" />"));
+ if (typeof $e.text() != "undefined" && $e.text() != "") {
+ myElement.find("input").attr("checked", "checked");
+ }
+ }
if ($e.hasClass("variant") && typeof options.variant != "undefined") {
// variants can be selected from a pre-defined list ONLY.
@@ -318,6 +325,7 @@
objData._attributes.transform = $e.find(".add_transform").val();
objData._attributes.variant = $e.find(".add_variant").val();
objData._attributes.readonly = $e.find(".add_readonly:checked").val();
+ objData._attributes.writeonly = $e.find(".add_writeonly:checked").val();
var options = $e.data("options");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|