From 36fd88b7c9509509dc20070dae48883abe01a3fa Mon Sep 17 00:00:00 2001 From: arno Date: Thu, 24 Mar 2011 15:10:44 +0100 Subject: [PATCH] better print support --- application/controllers/IdxController.php | 12 +++--- public/css/syj.css | 2 +- public/css/syjprint.css | 47 +++++++++++++++++++++++ public/js/syj.js | 11 ++++++ public/js/syjraw.js | 12 +++++- 5 files changed, 77 insertions(+), 7 deletions(-) create mode 100644 public/css/syjprint.css diff --git a/application/controllers/IdxController.php b/application/controllers/IdxController.php index 2c0e4d7..d24b71c 100644 --- a/application/controllers/IdxController.php +++ b/application/controllers/IdxController.php @@ -7,17 +7,19 @@ class IdxController extends Zend_Controller_Action public function init() { $this->_helper->SyjMedias->addScripts('idx'); - $this->view->headLink()->appendStylesheet('css/olstyle.css', "all"); - $this->view->headLink()->appendStylesheet('css/generic.css', "all"); - $this->view->headLink()->appendStylesheet('css/syj.css', "all"); + $this->view->headLink()->appendStylesheet('css/olstyle.css', "screen"); + $this->view->headLink()->appendStylesheet('css/generic.css', "screen"); + $this->view->headLink()->appendStylesheet('css/syj.css', "screen"); + $this->view->headLink()->appendStylesheet('css/syjprint.css', "print"); } public function rawmode(Syj_Model_Path $path) { $this->_helper->SyjReset->resetPlaceHolders(); $this->_helper->SyjMedias->addScripts('rawidx'); - $this->view->headLink()->appendStylesheet('css/generic.css', 'all'); - $this->view->headLink()->appendStylesheet('css/syjraw.css', 'all'); + $this->view->headLink()->appendStylesheet('css/generic.css', "screen"); + $this->view->headLink()->appendStylesheet('css/syjraw.css', "screen"); + $this->view->headLink()->appendStylesheet('css/syjprint.css', "print"); $this->view->headTitle($path->displayTitle); $this->_jsRawLocaleStrings(); diff --git a/public/css/syj.css b/public/css/syj.css index ffa450a..d6ce283 100644 --- a/public/css/syj.css +++ b/public/css/syj.css @@ -262,7 +262,7 @@ body, html { size: landscape; } - #message, #data_controls, #login_controls, #user_area, #login_area, #newpwd_area, .olControlPanZoom{ + #message, #menu, #user_area, #login_area, #newpwd_area, .olControlPanZoom{ display: none; } } diff --git a/public/css/syjprint.css b/public/css/syjprint.css new file mode 100644 index 0000000..5a1c664 --- /dev/null +++ b/public/css/syjprint.css @@ -0,0 +1,47 @@ +/* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier, + and is published under the AGPL license. */ + +.olControlPanZoom, .olControlAttribution { + display: none; +} +#message, #other-language, #menu, #user_area, #login_area, #newpwd_area, #termsofusearea, #footer, #map-overlay { + display: none; +} + +div.olMap { + z-index: 0; +} + +body, html { + width: 100%; + height: 100%; +} + +#map { + position: absolute; + top: 0; left: 0; right: 0; bottom: 0; + width: 100%; + height: 100%; + border: 1px solid; +} + +#path-length { + display: none; + text-align: center; + position: absolute; + top: 1em; + left: 5em; + opacity: 0.85; + margin-right: 12px; + filter:alpha(opacity=85); + background-color: white; + padding: 2px 15px 2px 15px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + background-color: white; +} + +@page { + size: landscape; +} diff --git a/public/js/syj.js b/public/js/syj.js index a297706..a72dbb7 100644 --- a/public/js/syj.js +++ b/public/js/syj.js @@ -441,6 +441,13 @@ var SYJView = { } else { this.map.setCenter(center, zoom); } + this.resizeMap(); + }, + + resizeMap: function() { + var map = $('map'); + map.style.width = map.offsetWidth.toString() + 'px'; + map.style.height = map.offsetHeight.toString() + 'px'; }, observer: function(evt) { @@ -1272,3 +1279,7 @@ window.onbeforeunload = function() { return undefined; } }; + +window.onresize = function() { + SYJView.resizeMap(); +}; diff --git a/public/js/syjraw.js b/public/js/syjraw.js index ec783f4..cf6be9c 100644 --- a/public/js/syjraw.js +++ b/public/js/syjraw.js @@ -11,6 +11,12 @@ var styleMap = { }) }; +function resizeMap() { + var map = document.getElementById('map'); + map.style.width = map.offsetWidth.toString() + 'px'; + map.style.height = map.offsetHeight.toString() + 'px'; +} + function init() { var map = new OpenLayers.Map('map', { controls: [ new OpenLayers.Control.Attribution() ], @@ -31,9 +37,13 @@ function init() { extent = viewLayer.getDataExtent(); map.updateSize(); map.zoomToExtent(extent); - + resizeMap(); } +window.onresize = function() { + resizeMap(); +}; + if (window.addEventListener) { window.addEventListener("load", init, false); } else { -- 2.39.2