[Mapbender-commits] r3901 - in branches/2.6: http/javascripts lib
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Apr 21 05:58:38 EDT 2009
Author: christoph
Date: 2009-04-21 05:58:38 -0400 (Tue, 21 Apr 2009)
New Revision: 3901
Modified:
branches/2.6/http/javascripts/geometry.js
branches/2.6/lib/basic.js
Log:
http://trac.osgeo.org/mapbender/ticket/418
Modified: branches/2.6/http/javascripts/geometry.js
===================================================================
--- branches/2.6/http/javascripts/geometry.js 2009-04-21 09:53:33 UTC (rev 3900)
+++ branches/2.6/http/javascripts/geometry.js 2009-04-21 09:58:38 UTC (rev 3901)
@@ -1359,7 +1359,7 @@
* @type Integer
*/
this.count = function(){
- return name.length;
+ return this.name.length;
};
/**
@@ -1370,7 +1370,7 @@
* @type String
*/
this.getName = function(i){
- if (isValidElementIndex(i)) {return name[i];}
+ if (this.isValidElementIndex(i)) {return this.name[i];}
return false;
};
@@ -1381,7 +1381,7 @@
* @return the value
*/
this.getValue = function(i){
- if (isValidElementIndex(i)) {return value[i];}
+ if (this.isValidElementIndex(i)) {return this.value[i];}
return false;
};
@@ -1394,8 +1394,8 @@
this.setElement = function(aName, aValue){
var i = this.getElementIndexByName(aName);
if (i === false) {i = this.count();}
- name[i] = aName;
- value[i] = aValue;
+ this.name[i] = aName;
+ this.value[i] = aValue;
};
/**
@@ -1406,8 +1406,8 @@
this.delElement = function(aName){
var i = this.getElementIndexByName(aName);
if (i !== false) {
- name.splice(i, 1);
- value.splice(i, 1);
+ this.name.splice(i, 1);
+ this.value.splice(i, 1);
}
}
@@ -1419,14 +1419,14 @@
* @return true if the index is valid; otherwise false
* @type Boolean
*/
- var isValidElementIndex = function(i){
- if (i>=0 && i<name.length) {return true;}
+ this.isValidElementIndex = function(i){
+ if (i>=0 && i<this.name.length) {return true;}
var e = new Mb_exception("class Wfs_element: function isValidElementIndex: illegal element index");
return false;
};
- var name = [];
- var value = [];
+ this.name = [];
+ this.value = [];
}
/**
Modified: branches/2.6/lib/basic.js
===================================================================
--- branches/2.6/lib/basic.js 2009-04-21 09:53:33 UTC (rev 3900)
+++ branches/2.6/lib/basic.js 2009-04-21 09:58:38 UTC (rev 3901)
@@ -47,31 +47,18 @@
window.frames[frameName].document.getElementById("highlight").style.visibility = 'hidden';
}
-function cloneObject(obj) {
- if (typeof obj !== 'object' || obj === null) {
- return obj;
- }
- var c = obj instanceof Array ? [] : {};
- for (var i in obj) {
- var prop = obj[i];
- if (typeof prop == 'object') {
- if (prop instanceof Array) {
- c[i] = [];
- for (var j = 0; j < prop.length; j++) {
- if (typeof prop[j] != 'object') {
- c[i].push(prop[j]);
- } else {
- c[i].push(cloneObject(prop[j]));
- }
- }
- } else {
- c[i] = cloneObject(prop);
- }
- } else {
- c[i] = prop;
- }
- }
- return c;
+function cloneObject (p, c) {
+ var c = c || {};
+ for (var i in p) {
+ if (typeof p[i] === 'object') {
+ c[i] = (p[i].constructor === Array) ? [] : {};
+ cloneObject(p[i], c[i]);
+ }
+ else {
+ c[i] = p[i];
+ }
+ }
+ return c;
}
function mb_timestamp(){
@@ -122,4 +109,4 @@
document.getElementById(elName).style.top = top;
document.getElementById(elName).style.left = left;
}
-}
\ No newline at end of file
+}
More information about the Mapbender_commits
mailing list