|
From: <ma...@us...> - 2010-12-03 23:44:26
|
Revision: 183
http://openautomation.svn.sourceforge.net/openautomation/?rev=183&view=rev
Author: mayerch
Date: 2010-12-03 23:44:20 +0000 (Fri, 03 Dec 2010)
Log Message:
-----------
initial (= experimental) support for popups
Modified Paths:
--------------
CometVisu/trunk/visu/designs/pure/basic.css
CometVisu/trunk/visu/designs/structure_pure.js
CometVisu/trunk/visu/lib/templateengine.js
Modified: CometVisu/trunk/visu/designs/pure/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/pure/basic.css 2010-12-03 16:03:14 UTC (rev 182)
+++ CometVisu/trunk/visu/designs/pure/basic.css 2010-12-03 23:44:20 UTC (rev 183)
@@ -258,4 +258,30 @@
div#loading {
display: none !important;
+}
+
+.popup {
+ position: absolute;
+ width: 90%;
+ height: 90%;
+ top: 5%;
+ left: 5%;
+ z-index: 100;
+ -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;
+ background: #000;
+ border: 1px solid #fff;
+ opacity: 0.75;
+}
+
+.popup div {
+ margin: 4px;
+}
+
+.popup div.head {
+ border-bottom: 1px solid;
+}
+
+.popup.error {
+ background: #800000;
+ border: #f00;
}
\ No newline at end of file
Modified: CometVisu/trunk/visu/designs/structure_pure.js
===================================================================
--- CometVisu/trunk/visu/designs/structure_pure.js 2010-12-03 16:03:14 UTC (rev 182)
+++ CometVisu/trunk/visu/designs/structure_pure.js 2010-12-03 23:44:20 UTC (rev 183)
@@ -32,6 +32,22 @@
return this.creators[name];
}
+ this.popups = {};
+
+ this.addPopup = function (name, object) {
+ this.popups[name] = object;
+ this.popups[name].type = name;
+console.log( name );
+console.log( this.popups[name] );
+ }
+
+ this.getPopup = function(name) {
+ if (typeof this.popups[name] == undefined) {
+ return this.popups.unknown;
+ }
+ return this.popups[name];
+ }
+
/**
* The creators object contians all widgets creators and their mappin to the
* XML config file tags
@@ -326,6 +342,28 @@
content: {type: "string", required: true}
});
+ this.addPopup('unknown', {
+ create: function( attributes ) {
+ var ret_val = $('<div class="popup" />');
+ ret_val.addClass( this.type );
+ if( attributes['title'] ) ret_val.append( $('<div class="head">' + attributes['title'] + '</div>') );
+ var content = '';
+ if( attributes['content'] ) content = attributes['content'];
+ ret_val.append( '<div class="main">' + content + '</div>' );
+ return ret_val;
+ },
+ attributes: {
+ title: {type: 'string', required: false},
+ content: {type: 'string', required: false},
+ width: {type: 'string', required: false},
+ height: {type: 'string', required: false}
+ }
+ });
+
+ this.addPopup('info' , this.getPopup('unknown') );
+ this.addPopup('warning', this.getPopup('unknown') );
+ this.addPopup('error' , this.getPopup('unknown') ) ;
+
this.switchAction = function() {
var data = $(this).data();
// alert( data.GA + ' = ' + data.value );
Modified: CometVisu/trunk/visu/lib/templateengine.js
===================================================================
--- CometVisu/trunk/visu/lib/templateengine.js 2010-12-03 16:03:14 UTC (rev 182)
+++ CometVisu/trunk/visu/lib/templateengine.js 2010-12-03 23:44:20 UTC (rev 183)
@@ -296,6 +296,28 @@
}
}
+/**
+ * Show a popup of type "type".
+ * The attributes is an type dependend object
+ * This function returnes a jQuery object that points to the whole popup,
+ * so it's content can be easily extended
+ */
+function showPopup( type, attributes )
+{
+ //var retval = design.popups[ type ].create( attributes ); //page, path );
+ //return retval;
+ return design.popups[ type ].create( attributes ).appendTo('body');
+}
+
+/**
+ * Remove the popup.
+ * The parameter is the jQuery object returned by the showPopup function
+ */
+function removePopup( jQuery_object )
+{
+ jQuery_object.remove();
+}
+
/****************************************************************************/
/* FIXME - Question: should this belong to the VisuDesign object so that it */
/* is possible to overload?!? */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|