|
From: <net...@us...> - 2011-12-18 16:24:09
|
Revision: 594
http://openautomation.svn.sourceforge.net/openautomation/?rev=594&view=rev
Author: netzkind
Date: 2011-12-18 16:24:02 +0000 (Sun, 18 Dec 2011)
Log Message:
-----------
force the user to select a design on startup; includes a "preview" of the available designs;
changed order of JS-files as compatibility.js needs jquery now.
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/pure/basic.css
CometVisu/trunk/visu/edit_config.html
CometVisu/trunk/visu/index.html
CometVisu/trunk/visu/lib/compatibility.js
CometVisu/trunk/visu/lib/templateengine.js
Added Paths:
-----------
CometVisu/trunk/visu/designs/design_preview.html
CometVisu/trunk/visu/edit/get_designs.php
CometVisu/trunk/visu/media/arrow.png
Modified: CometVisu/trunk/visu/designs/alaska/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/alaska/basic.css 2011-12-18 15:59:22 UTC (rev 593)
+++ CometVisu/trunk/visu/designs/alaska/basic.css 2011-12-18 16:24:02 UTC (rev 594)
@@ -384,3 +384,34 @@
width: 100%;
text-decoration: none;
}
+
+
+/* styles for the preview */
+div#demo_1, div#demo_2, div#demo_3 {
+ width: 100%;
+}
+
+div#demo_container {
+ position: relative;
+}
+
+div#demo_1 {
+ height: 90px;
+ background: #fff;
+ background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed));
+ background: -moz-linear-gradient(top, #fff, #ededed);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed');
+ z-index: 1;
+}
+
+div#demo_2 {
+ height: 2px;
+ position: absolute;
+ top: 44px;
+ z-index: 2;
+ background-color: #686868;
+}
+
+div#demo_3 {
+ display: none;
+}
\ No newline at end of file
Modified: CometVisu/trunk/visu/designs/alaska_slim/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/alaska_slim/basic.css 2011-12-18 15:59:22 UTC (rev 593)
+++ CometVisu/trunk/visu/designs/alaska_slim/basic.css 2011-12-18 16:24:02 UTC (rev 594)
@@ -364,3 +364,33 @@
width: 100%;
text-decoration: none;
}
+
+/* styles for the preview */
+div#demo_1, div#demo_2, div#demo_3 {
+ width: 100%;
+}
+
+div#demo_container {
+ position: relative;
+}
+
+div#demo_1 {
+ height: 90px;
+ background: #fff;
+ background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed));
+ background: -moz-linear-gradient(top, #fff, #ededed);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed');
+ z-index: 1;
+}
+
+div#demo_2 {
+ height: 2px;
+ position: absolute;
+ top: 44px;
+ z-index: 2;
+ background-color: #686868;
+}
+
+div#demo_3 {
+ display: none;
+}
Added: CometVisu/trunk/visu/designs/design_preview.html
===================================================================
--- CometVisu/trunk/visu/designs/design_preview.html (rev 0)
+++ CometVisu/trunk/visu/designs/design_preview.html 2011-12-18 16:24:02 UTC (rev 594)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>CometVisu Design-Preview</title>
+ <link rel="icon" href="../icon/comet_16x16_000000.png" type="image/png" />
+ <meta name="viewport" content="width=260, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, webkit-user-select: none" />
+ <meta name="apple-mobile-web-app-capable" content="yes" />
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
+ <script src="../lib/jquery.js" type="text/javascript"></script>
+ <script src="../lib/compatibility.js" type="text/javascript"></script>
+ </head>
+ <body>
+ <div id="demo_container" style="width: 100%; height: 90px;">
+ <div id="demo_1"></div>
+ <div id="demo_2"></div>
+ <div id="demo_3"></div>
+ </div>
+
+ <script type="text/javascript">
+ var design = $.getUrlVar("design");
+ $( '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)" />' );
+ </script>
+ </body>
+</html>
Modified: CometVisu/trunk/visu/designs/discreet/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/discreet/basic.css 2011-12-18 15:59:22 UTC (rev 593)
+++ CometVisu/trunk/visu/designs/discreet/basic.css 2011-12-18 16:24:02 UTC (rev 594)
@@ -387,4 +387,23 @@
padding: 2px;
background-color: #fee;
opacity: 0.80;
-}
\ No newline at end of file
+}
+
+/* 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;
+}
Modified: CometVisu/trunk/visu/designs/discreet_sand/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/discreet_sand/basic.css 2011-12-18 15:59:22 UTC (rev 593)
+++ CometVisu/trunk/visu/designs/discreet_sand/basic.css 2011-12-18 16:24:02 UTC (rev 594)
@@ -380,4 +380,22 @@
padding: 2px;
background-color: #fee;
opacity: 0.80;
-}
\ No newline at end of file
+}
+
+/* styles for the preview */
+div#demo_1, div#demo_2, div#demo_3 {
+ width: 100%;
+ height: 30px;
+}
+
+div#demo_1 {
+ background-color: #165d7e;
+}
+
+div#demo_2 {
+ background-color: #cfc8b5;
+}
+
+div#demo_3 {
+ background-color: #baaf98;
+}
Modified: CometVisu/trunk/visu/designs/discreet_slim/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/discreet_slim/basic.css 2011-12-18 15:59:22 UTC (rev 593)
+++ CometVisu/trunk/visu/designs/discreet_slim/basic.css 2011-12-18 16:24:02 UTC (rev 594)
@@ -380,4 +380,24 @@
padding: 2px;
background-color: #fee;
opacity: 0.80;
-}
\ No newline at end of file
+}
+
+/* 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;
+}
+
Modified: CometVisu/trunk/visu/designs/pure/basic.css
===================================================================
--- CometVisu/trunk/visu/designs/pure/basic.css 2011-12-18 15:59:22 UTC (rev 593)
+++ CometVisu/trunk/visu/designs/pure/basic.css 2011-12-18 16:24:02 UTC (rev 594)
@@ -466,3 +466,23 @@
border: #ff8000 1px solid;
}
+/* styles for the preview */
+div#demo_1, div#demo_2, div#demo_3 {
+ width: 100%;
+}
+
+div#demo_1 {
+ height: 30px;
+ background-color: black;
+}
+
+div#demo_2 {
+ height: 2px;
+ background-color: #ff8000;
+}
+
+div#demo_3 {
+ height: 58px;
+ background-color: black;
+}
+
Added: CometVisu/trunk/visu/edit/get_designs.php
===================================================================
--- CometVisu/trunk/visu/edit/get_designs.php (rev 0)
+++ CometVisu/trunk/visu/edit/get_designs.php 2011-12-18 16:24:02 UTC (rev 594)
@@ -0,0 +1,24 @@
+<?php
+define('FOLDER_DESIGNS', "../designs/");
+
+$arrDesigns = array();
+
+if (false !== ($handle = opendir(FOLDER_DESIGNS))) {
+ while (false !== ($strFile = readdir($handle))) {
+ if ($strFile == "." || $strFile == "..") {
+ continue;
+ }
+
+ if (true === is_dir(FOLDER_DESIGNS . $strFile) && true === file_exists(FOLDER_DESIGNS . $strFile . "/basic.css")) {
+ $arrDesigns[] = $strFile;
+ }
+ }
+}
+
+sort($arrDesigns);
+
+Header("Content-type: application/json");
+print json_encode($arrDesigns);
+exit;
+
+?>
Modified: CometVisu/trunk/visu/edit_config.html
===================================================================
--- CometVisu/trunk/visu/edit_config.html 2011-12-18 15:59:22 UTC (rev 593)
+++ CometVisu/trunk/visu/edit_config.html 2011-12-18 16:24:02 UTC (rev 594)
@@ -8,8 +8,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" type="text/css" href="edit/style_edit.css" />
<link rel="stylesheet" type="text/css" href="edit/jquery-ui.css" />
- <script src="lib/compatibility.js" type="text/javascript"></script>
<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/scrollable.js" type="text/javascript"></script>
<script src="lib/cometvisu-client.js" type="text/javascript"></script>
@@ -43,7 +43,6 @@
<div id="bottom" class="loading">
<hr />
<div class="footer"></div>
- </div>
</div>
<div id="addMaster">
Modified: CometVisu/trunk/visu/index.html
===================================================================
--- CometVisu/trunk/visu/index.html 2011-12-18 15:59:22 UTC (rev 593)
+++ CometVisu/trunk/visu/index.html 2011-12-18 16:24:02 UTC (rev 594)
@@ -8,8 +8,8 @@
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0; webkit-user-select: none;" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
- <script src="lib/compatibility.js" type="text/javascript"></script>
<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/scrollable.js" type="text/javascript"></script>
<script src="lib/cometvisu-client.js" type="text/javascript"></script>
@@ -34,7 +34,6 @@
<div id="bottom" class="loading">
<hr />
<div class="footer"></div>
- </div>
</div>
<div id="loading" style="text-align: center; width: 200px; height: 30px; margin: auto;">
Loading ...
Modified: CometVisu/trunk/visu/lib/compatibility.js
===================================================================
--- CometVisu/trunk/visu/lib/compatibility.js 2011-12-18 15:59:22 UTC (rev 593)
+++ CometVisu/trunk/visu/lib/compatibility.js 2011-12-18 16:24:02 UTC (rev 594)
@@ -134,4 +134,24 @@
}
}
-sprintf = sprintfWrapper.init;
\ No newline at end of file
+sprintf = sprintfWrapper.init;
+
+/**
+ * be able to access GET-Params
+ */
+$.extend({
+ getUrlVars: function(){
+ var vars = [], hash;
+ var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
+ for(var i = 0; i < hashes.length; i++)
+ {
+ hash = hashes[i].split('=');
+ vars.push(hash[0]);
+ vars[hash[0]] = hash[1];
+ }
+ return vars;
+ },
+ getUrlVar: function(name){
+ return $.getUrlVars()[name];
+ }
+});
\ No newline at end of file
Modified: CometVisu/trunk/visu/lib/templateengine.js
===================================================================
--- CometVisu/trunk/visu/lib/templateengine.js 2011-12-18 15:59:22 UTC (rev 593)
+++ CometVisu/trunk/visu/lib/templateengine.js 2011-12-18 16:24:02 UTC (rev 594)
@@ -35,28 +35,16 @@
}
visu.user = 'demo_user'; // example for setting a user
-$.extend({
- getUrlVars: function(){
- var vars = [], hash;
- var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
- for(var i = 0; i < hashes.length; i++)
- {
- hash = hashes[i].split('=');
- vars.push(hash[0]);
- vars[hash[0]] = hash[1];
- }
- return vars;
- },
- getUrlVar: function(name){
- return $.getUrlVars()[name];
- }
-});
-
var configSuffix = "";
if ($.getUrlVar("config")) {
configSuffix = "_" + $.getUrlVar("config");
}
+var clientDesign = "";
+if ($.getUrlVar("design")) {
+ clientDesign = $.getUrlVar("design");
+}
+
if (typeof forceReload == "undefined") {
var forceReload = false;
}
@@ -88,22 +76,16 @@
}
$(document).ready(function() {
- // get the data once the page was loaded
- $.ajaxSetup({cache: !forceReload});
- window.setTimeout("$.get( 'visu_config" + configSuffix + ".xml', parseXML );", 200);
+
+ // only load the config and stuff if a design was specified
+ if (clientDesign != "") {
+ // get the data once the page was loaded
+ $.ajaxSetup({cache: !forceReload});
+ window.setTimeout("$.get( 'visu_config" + configSuffix + ".xml', parseXML );", 200);
+ } else {
+ selectDesign();
+ }
- // disable text selection - it's annoying on a touch screen!
- /*
- * Now in the CSS!
- if($.browser.mozilla)
- {//Firefox
- $('body').css('MozUserSelect','none');
- } else if($.browser.msie) {//IE
- $(document).bind('selectstart',function(){return false;});
- } else {//Opera, etc.
- $(document).mousedown(function(){return false;});
- }
- */
} );
$(window).unload(function() {
@@ -173,9 +155,8 @@
// erst mal den Cache für AJAX-Requests wieder aktivieren
$.ajaxSetup({cache: true});
- var design = $( 'pages', xml ).attr('design');
- $( 'head' ).append( '<link rel="stylesheet" type="text/css" href="designs/' + design + '/basic.css" />' );
- $( 'head' ).append( '<link rel="stylesheet" type="text/css" href="designs/' + design + '/mobile.css" media="only screen and (max-device-width: 480px)" />' );
+ $( '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)" />' );
// start with the plugins
var pluginsToLoad = 0;
@@ -427,3 +408,61 @@
$(this).data('interval', setInterval( function(){refreshAction(target, src);}, refresh ) );
}
}
+
+
+function selectDesign() {
+
+ $body = $("body");
+
+ $("body > *").hide();
+ $body.css({backgroundColor: "black"});
+
+ $div = $("<div id=\"designSelector\" />");
+ $div.css({background: "#808080", width: "400px", color: "white", margin: "auto", padding: "0.5em"});
+ $div.html("Loading ...");
+
+ $body.append($div);
+
+ $.getJSON("edit/get_designs.php", function(data) {
+ $div.empty();
+
+ $div.append("<h1>Please select design</h1>");
+ $div.append("<p>The Location/URL will change after you have chosen your design. Please bookmark the new URL if you do not want to select the design every time.</p>");
+
+ $.each(data, function(i, element) {
+ var $myDiv = $("<div />");
+
+ $myDiv.css({cursor: "pointer", padding: "0.5em 1em", borderBottom: "1px solid black", margin: "auto", width: "262px", position: "relative"});
+
+ $myDiv.append("<div style=\"font-weight: bold; margin: 1em 0 .5em;\">Design: " + element + "</div>");
+ $myDiv.append("<iframe src=\"designs/design_preview.html?design=" + element + "\" width=\"160\" height=\"90\" border=\"0\" scrolling=\"auto\" frameborder=\"0\" style=\"z-index: 1;\"></iframe>");
+ $myDiv.append("<img width=\"60\" height=\"30\" src=\"media/arrow.png\" alt=\"select\" border=\"0\" style=\"margin: 60px 10px 10px 30px;\"/>");
+
+ $div.append($myDiv);
+
+ var $tDiv = $("<div />");
+ $tDiv.css({background: "transparent", position: "absolute", height: "90px", width: "160px", zIndex: 2})
+ var pos = $myDiv.find("iframe").position();
+ $tDiv.css({left: pos.left + "px", top: pos.top + "px"});
+ $myDiv.append($tDiv);
+
+ $myDiv.hover(function() {
+ // over
+ $myDiv.css({background: "#bbbbbb"});
+ },
+ function() {
+ // out
+ $myDiv.css({background: "transparent"});
+ });
+
+ $myDiv.click(function() {
+ if (document.location.search == "") {
+ document.location.href = document.location.href + "?design=" + element;
+ } else {
+ document.location.href = document.location.href + "&design=" + element;
+ }
+ })
+
+ })
+ })
+}
\ No newline at end of file
Added: CometVisu/trunk/visu/media/arrow.png
===================================================================
(Binary files differ)
Property changes on: CometVisu/trunk/visu/media/arrow.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.
|