|
From: <pe...@us...> - 2012-08-12 12:41:54
|
Revision: 939
http://openautomation.svn.sourceforge.net/openautomation/?rev=939&view=rev
Author: peuter
Date: 2012-08-12 12:41:47 +0000 (Sun, 12 Aug 2012)
Log Message:
-----------
- added possiblity to hide the top-navigation, footer and navbars page-wise by setting showtopnavigation,showfooter,shownavbar to false. These settings were inherited to subpages if not defined otherwise
Modified Paths:
--------------
CometVisu/trunk/visu/lib/templateengine.js
CometVisu/trunk/visu/structure/pure/page.js
CometVisu/trunk/visu/visu_config.xsd
CometVisu/trunk/visu/visu_config_metal.xml
Modified: CometVisu/trunk/visu/lib/templateengine.js
===================================================================
--- CometVisu/trunk/visu/lib/templateengine.js 2012-08-11 19:55:44 UTC (rev 938)
+++ CometVisu/trunk/visu/lib/templateengine.js 2012-08-12 12:41:47 UTC (rev 939)
@@ -343,8 +343,9 @@
{
// and now setup the pages
var page = $( 'pages > page', xml )[0]; // only one page element allowed...
-
+
create_pages(page, 'id_0');
+
// all containers
if (!/(android|blackberry|iphone|ipod|series60|symbian|windows ce|palm)/i.test(navigator.userAgent.toLowerCase())) {
@@ -554,18 +555,17 @@
// find Page-ID by name
page_id = $('.page h1:contains('+page_id+')').closest(".page").attr("id");
}
+ updatePageParts($('#'+page_id));
$('#'+page_id).addClass('pageActive activePage'); // show new page
$('#'+page_id+'_navbar').addClass('navbarActive');
-
+
// which is the parent of target page_id?
// => set this id as lastpage in url for window.onpopstate handling
var path = page_id.split( '_' );
- if (path.length > 1) {
- // above top level
- // everything besides the last number is the parent id
- path.pop();
- // store lastpage in body.data
- $('body').data("lastpage", path.join("_"));
+ if (path.length > 2) {
+ var parentPage=getParentPage($('#'+page_id));
+ if (parentPage!=null)
+ $('body').data("lastpage", parentPage.attr("id"));
}
else {
// top level
@@ -740,3 +740,110 @@
}
handleResize();
}
+
+/**
+ * update the visibility ob top-navigation, footer and navbar for this page
+ * @param page
+ */
+function updatePageParts(page) {
+ // default values
+ var showtopnavigation=true;
+ var showfooter=true;
+ var shownavbar=true;
+
+ if (page.data()!=null) {
+ if (page.data().showtopnavigation!=undefined) {
+ showtopnavigation = page.data().showtopnavigation!="false";
+ }
+ else {
+ // traverse up the page tree
+ var parentPage = getParentPage(page);
+ while (parentPage!=null) {
+ if (parentPage.data().showtopnavigation!=undefined) {
+ showtopnavigation = parentPage.data().showtopnavigation!="false";
+ break;
+ }
+ parentPage = getParentPage(parentPage);
+ }
+ }
+ if (page.data().showfooter!=undefined) {
+ showfooter = page.data().showfooter!="false";
+ }
+ else {
+ // traverse up the page tree
+ var parentPage = getParentPage(page);
+ while (parentPage!=null) {
+ if (parentPage.data().showfooter!=undefined) {
+ showfooter = parentPage.data().showfooter!="false";
+ break;
+ }
+ parentPage = getParentPage(parentPage);
+ }
+ }
+ if (page.data().shownavbar!=undefined) {
+ shownavbar = page.data().shownavbar!="false";
+ }
+ else {
+ // traverse up the page tree
+ var parentPage = getParentPage(page);
+ while (parentPage!=null) {
+ if (parentPage.data().shownavbar!=undefined) {
+ shownavbar = parentPage.data().shownavbar!="false";
+ break;
+ }
+ parentPage = getParentPage(parentPage);
+ }
+ }
+ }
+ if (showtopnavigation) {
+ $('#top, #top > *').css("display","block");
+ }
+ else {
+ $('#top, #top > *').css("display","none");
+ }
+ if (showfooter) {
+ $('#bottom, #bottom > *').css("display","block");
+ }
+ else {
+ $('#bottom, #bottom > *').css("display","none");
+ }
+ if (shownavbar) {
+ $.each(['Left','Top','Right','Bottom'], function (index, value) {
+ var size = $('#navbar'+value).data('size');
+ var cssSize = size + (isFinite( size ) ? 'px' : '');
+ $('#navbar'+value).css('width',cssSize);
+ });
+ // for some reason the handleResize() method has to be called here, without it the Navbar looks strange (has scrollbars even if they wouldn´t be neccessary)
+ handleResize();
+ $('.navbar').css("display","block");
+ }
+ else {
+ // store the navbar sizes
+ $.each(['Left','Top','Right','Bottom'], function (index, value) {
+ if ($('#navbar'+value).data('size')==undefined) {
+ $('#navbar'+value).data('size',$('#navbar'+value).css('width'));
+ }
+ $('#navbar'+value).css({
+ 'display': 'none',
+ 'width': 0
+ });
+ });
+ $('.navbar').css("display","none");
+ }
+ handleResize();
+}
+
+function getParentPage(page) {
+ var pathParts = page.attr('id').split('_');
+ if (pathParts.length==2) {
+ // top-level (id_x)-> no parent pages
+ return null;
+ }
+ while (pathParts.length>1) {
+ pathParts.pop();
+ var path = pathParts.join('_');
+ if ($('.page[id="'+path+'"]').size()==1) {
+ return $('.page[id="'+path+'"]');
+ }
+ }
+}
Modified: CometVisu/trunk/visu/structure/pure/page.js
===================================================================
--- CometVisu/trunk/visu/structure/pure/page.js 2012-08-11 19:55:44 UTC (rev 938)
+++ CometVisu/trunk/visu/structure/pure/page.js 2012-08-12 12:41:47 UTC (rev 939)
@@ -29,6 +29,9 @@
var name = $p.attr('name');
var type = $p.attr('type') || 'text'; //text, 2d or 3d
var backdrop = $p.attr('backdrop');
+ var showtopnavigation = $p.attr('showtopnavigation');
+ var showfooter = $p.attr('showfooter');
+ var shownavbar = $p.attr('shownavbar');
if( $p.attr('flavour') ) flavour = $p.attr('flavour');// sub design choice
var wstyle = ''; // widget style
if( $p.attr('align') ) wstyle += 'text-align:' + $p.attr('align') + ';';
@@ -52,6 +55,9 @@
//var container = $( '<div class="clearfix" />' );
var subpage = $( '<div class="page" id="' + path + '"/>' );
+ subpage.data('showtopnavigation',showtopnavigation);
+ subpage.data('showfooter',showfooter);
+ subpage.data('shownavbar',shownavbar);
var $container = $( '<div class="clearfix" path="'+path+'" style="height:100%;position:relative;" />');
for( var addr in address ) $container.bind( addr, this.update );
var container=$container;
@@ -123,7 +129,10 @@
backdrop: { type: 'string' , required: false },
azimut: { type: 'addr' , required: false },
elevation: { type: 'addr' , required: false },
- floor: { type: 'addr' , required: false }
+ floor: { type: 'addr' , required: false },
+ topnavigation: { type: 'string', required: false},
+ footer: { type: 'string', required: false},
+ navbar: { type: 'string', required: false},
},
elements: {
layout: { type: 'layout' , required: false, multi: false }
Modified: CometVisu/trunk/visu/visu_config.xsd
===================================================================
--- CometVisu/trunk/visu/visu_config.xsd 2012-08-11 19:55:44 UTC (rev 938)
+++ CometVisu/trunk/visu/visu_config.xsd 2012-08-12 12:41:47 UTC (rev 939)
@@ -233,6 +233,9 @@
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="backdrop" type="uri" use="optional" />
+ <xsd:attribute name="showtopnavigation" type="xsd:boolean" use="optional"/>
+ <xsd:attribute name="showfooter" type="xsd:boolean" use="optional"/>
+ <xsd:attribute name="shownavbar" type="xsd:boolean" use="optional"/>
</xsd:complexType>
</xsd:element>
Modified: CometVisu/trunk/visu/visu_config_metal.xml
===================================================================
--- CometVisu/trunk/visu/visu_config_metal.xml 2012-08-11 19:55:44 UTC (rev 938)
+++ CometVisu/trunk/visu/visu_config_metal.xml 2012-08-12 12:41:47 UTC (rev 939)
@@ -100,7 +100,7 @@
type="html" hrefextend="config"><![CDATA[ - <a href="check_config.php">Check
Config</a> ]]></status> </statusbar>
</meta>
- <page name="Übersicht">
+ <page name="Übersicht" showtopnavigation="false" showfooter="false">
<navbar position="left" dynamic="true" width="200px">
<group nowidget="true">
<pagejump target="Übersicht">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|