Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of git://github.com/mapbender/mapbender

  • Loading branch information...
commit 1269a6297330559bc90605a60df69e2d1212c252 2 parents 06b4b29 + 3a6ec15
@arsgeografica arsgeografica authored
View
30 src/Mapbender/CoreBundle/Component/Application.php
@@ -49,12 +49,27 @@ public function getLayersets() {
public function getElement($id) {
$template_metadata = $this->getTemplate()->getMetadata();
$counter = 0;
+ $user = $this->container->get('security.context')->getToken()->getUser();
foreach($template_metadata['regions'] as $region) {
// Only iterate over regions defined in the app
if(!array_key_exists($region, $this->configuration['elements'])) {
continue;
}
foreach($this->configuration['elements'][$region] as $name => $element) {
+ // check if the roles set
+ if(isset($element['roles'])){
+ $allow = false;
+ foreach ($user->getRoles() as $role) {
+ // check if the user authorized
+ if(in_array($role, $element['roles'])){
+ $allow = true;
+ break;
+ }
+ }
+ if(!$allow){
+ continue;
+ }
+ }
$element_id = sprintf($this->element_id_template, $counter++);
if($element_id == $id) {
$class = $element['class'];
@@ -242,6 +257,7 @@ private function loadTemplate() {
* Using the configuration, load (instantiate) all elements defined for the application
*/
private function loadElements() {
+ $user = $this->container->get('security.context')->getToken()->getUser();
$template_metadata = $this->getTemplate()->getMetadata();
$this->elements = array();
$counter = 0;
@@ -252,6 +268,20 @@ private function loadElements() {
continue;
}
foreach($this->configuration['elements'][$region] as $name => $element) {
+ // check if the roles set
+ if(isset($element['roles'])){
+ $allow = false;
+ foreach ($user->getRoles() as $role) {
+ // check if the user authorized
+ if(in_array($role, $element['roles'])){
+ $allow = true;
+ break;
+ }
+ }
+ if(!$allow){
+ continue;
+ }
+ }
// Extract and unset class, so we can use the remains as configuration
$class = $element['class'];
unset($element['class']);
View
36 src/Mapbender/CoreBundle/Resources/public/mapbender.trans.js
@@ -1,5 +1,25 @@
var Mapbender = Mapbender || {};
-Mapbender.transCallBack = function(objToCallBack, termsToTranslate) {
+Mapbender.alltranslations = {};
+Mapbender.transCallBack = function(objToCallBack, termsToTranslate, saveAtAll) {
+ if(typeof(saveAtAll) === 'undefined'){
+ saveAtAll = false;
+ }
+ if(typeof(Mapbender.alltranslations) !== 'undefined'){
+ var result = {};
+ var ok = true;
+ for(var key in termsToTranslate){
+ if(typeof(Mapbender.alltranslations[key]) === 'undefined') {
+ ok = false;
+ break;
+ } else {
+ result[key] = Mapbender.alltranslations[key];
+ }
+ }
+ if(ok) {
+ objToCallBack.transCallBack(result);
+ return;
+ }
+ }
var mb = this;
$.ajax({
url: mb.configuration.transPath,
@@ -9,6 +29,11 @@ Mapbender.transCallBack = function(objToCallBack, termsToTranslate) {
complete: function(jqXHR, textStatus) {
if(textStatus == "success") {
termsToTranslate = $.parseJSON(jqXHR.responseText);
+ if(saveAtAll) {
+ for(var key in termsToTranslate){
+ Mapbender.alltranslations[key] = termsToTranslate[key];
+ }
+ }
}
objToCallBack.transCallBack(termsToTranslate);
}
@@ -44,3 +69,12 @@ Mapbender.getTrans = function(translatedterms, term) {
return result;
};
+Mapbender.getTransFromAll = function(term) {
+ var result = term;
+ try {
+ result = Mapbender.alltranslations[this.strToHex(term)];
+ }catch(e){
+ var e = e;
+ }
+ return result;
+};
View
139 src/Mapbender/CoreBundle/Resources/translations/messages.de.xliff
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
+ <file source-language="en" datatype="plaintext" original="file.ext">
+ <body>
+ <trans-unit id="1">
+ <source>FeatureInfo</source>
+ <target>Sachinformation</target>
+ </trans-unit>
+ <trans-unit id="2">
+ <source>Services</source>
+ <target>Dienste</target>
+ </trans-unit>
+ <trans-unit id="3">
+ <source>X coordinate</source>
+ <target>X-Koordinate</target>
+ </trans-unit>
+ <trans-unit id="4">
+ <source>Y coordinate</source>
+ <target>Y-Koordinate</target>
+ </trans-unit>
+ <trans-unit id="5">
+ <source>Pan up</source>
+ <target>Nach oben verschieben</target>
+ </trans-unit>
+ <trans-unit id="6">
+ <source>Pan right</source>
+ <target>Nach rechts verschieben</target>
+ </trans-unit>
+ <trans-unit id="7">
+ <source>Pan down</source>
+ <target>Nach unten verschieben</target>
+ </trans-unit>
+ <trans-unit id="8">
+ <source>Pan left</source>
+ <target>Nach links verschieben</target>
+ </trans-unit>
+ <trans-unit id="9">
+ <source>Go back</source>
+ <target>Zurück</target>
+ </trans-unit>
+ <trans-unit id="10">
+ <source>Go forward</source>
+ <target>Vor</target>
+ </trans-unit>
+ <trans-unit id="11">
+ <source>Zoom by box</source>
+ <target>Ausschnitt aufziehen</target>
+ </trans-unit>
+ <trans-unit id="12">
+ <source>Zoom in</source>
+ <target>Hineinzoomen</target>
+ </trans-unit>
+ <trans-unit id="13">
+ <source>Click to zoom</source>
+ <target>Zoom per Klick</target>
+ </trans-unit>
+ <trans-unit id="14">
+ <source>Zoom out</source>
+ <target>Herauszoomen</target>
+ </trans-unit>
+ <trans-unit id="15">
+ <source>About</source>
+ <target>Über</target>
+ </trans-unit>
+ <trans-unit id="16">
+ <source>Save</source>
+ <target>Speichern</target>
+ </trans-unit>
+ <trans-unit id="17">
+ <source>Cancel</source>
+ <target>Abbrechen</target>
+ </trans-unit>
+ <trans-unit id="18">
+ <source>Add Group</source>
+ <target>Gruppe hinzufügen</target>
+ </trans-unit>
+ <trans-unit id="19">
+ <source>Delete</source>
+ <target>Löschen</target>
+ </trans-unit>
+ <trans-unit id="20">
+ <source>Really Delete</source>
+ <target>Wirklich löschen</target>
+ </trans-unit>
+ <trans-unit id="21">
+ <source>Group Index</source>
+ <target>Gruppen Index</target>
+ </trans-unit>
+ <trans-unit id="22">
+ <source>Available Groups</source>
+ <target>Verfügbare Gruppen</target>
+ </trans-unit>
+ <trans-unit id="23">
+ <source>Name</source>
+ <target>Name</target>
+ </trans-unit>
+ <trans-unit id="24">
+ <source>Edit</source>
+ <target>Bearbeiten</target>
+ </trans-unit>
+ <trans-unit id="25">
+ <source>No Groups</source>
+ <target>Keine Gruppen</target>
+ </trans-unit>
+ <trans-unit id="26">
+ <source>Add User</source>
+ <target>Benutzer hinzufügen</target>
+ </trans-unit>
+ <trans-unit id="27">
+ <source>Realy delete?</source>
+ <target>Wirklich löschen?</target>
+ </trans-unit>
+ <trans-unit id="28">
+ <source>Yes</source>
+ <target>Ja</target>
+ </trans-unit>
+ <trans-unit id="29">
+ <source>No</source>
+ <target>Nein</target>
+ </trans-unit>
+ <trans-unit id="30">
+ <source>save</source>
+ <target>Speichern</target>
+ </trans-unit>
+ <trans-unit id="31">
+ <source>User Index</source>
+ <target>Benutzer Index</target>
+ </trans-unit>
+ <trans-unit id="32">
+ <source>Available Users</source>
+ <target>Verfügbare Benutzer</target>
+ </trans-unit>
+ <trans-unit id="33">
+ <source>No Users</source>
+ <target>Keine Benutzer</target>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
View
11 src/Mapbender/WmsBundle/Resources/public/mapbender.layer.wms.js
@@ -186,6 +186,17 @@ $.extend(true, Mapbender, { layer: {
this.olLayer.events.on({
scope: this,
loadstart: function() {
+ var scale = this.olLayer.map.getScale();
+ var layers = [];
+ $.each(this.options.allLayers, function(idx, layer) {
+ var show = true;
+ if(!((typeof layer.minScale !== 'undefined' && layer.minScale < scale) ||
+ (typeof layer.minScale !== 'undefined' && layer.maxScale > scale))) {
+ layers.push(layer.name);
+ }
+ });
+ this.olLayer.layers = layers;
+
// Prevent loading without layers
if(this.olLayer.layers.length === 0) {
this.olLayer.setVisibility(false);
Please sign in to comment.
Something went wrong with that request. Please try again.