From 768ad0108db94c51e4f27f7aa2a0f706f66a5f30 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Mon, 5 Mar 2012 21:00:05 +0100 Subject: [PATCH 1/7] Move the declaration of OpenLayers.ImgPath from Util.js to OpenLayers.js. --- lib/OpenLayers.js | 10 +++++++++- lib/OpenLayers/Util.js | 8 -------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index b67381d4b5..4fdbb17c98 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -79,7 +79,15 @@ } } return (function() { return l; }); - })() + })(), + + /** + * APIProperty: ImgPath + * {String} Set this to the path where control images are stored. + * If set to '' OpenLayers will use script location + "img/" + * Default is ''. + */ + ImgPath : '' }; /** diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 880e3435ab..4abc74deec 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -559,14 +559,6 @@ OpenLayers.Util.urlAppend = function(url, paramStr) { return newUrl; }; -/** - * APIProperty: ImgPath - * {String} Set this to the path where control images are stored. - * If set to '' OpenLayers will use script location + "img/" - * Default is ''. - */ -OpenLayers.ImgPath = ''; - /** * Function: getImagesLocation * From 8f0280e8bdd599e3e00269697ad55660a914a6c4 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Mon, 5 Mar 2012 21:23:40 +0100 Subject: [PATCH 2/7] Add two trivial tests for the presence and default value of OpenLayers.ImgPath. --- tests/OpenLayers1.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/OpenLayers1.html b/tests/OpenLayers1.html index ea574efa61..4d3ae3bded 100644 --- a/tests/OpenLayers1.html +++ b/tests/OpenLayers1.html @@ -3,11 +3,15 @@ From 25bba1c9375880fe2e490848c6a4b5be3c1eddcb Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Mon, 5 Mar 2012 21:41:39 +0100 Subject: [PATCH 3/7] Remove not needed document.getElementById in test. --- tests/OpenLayers1.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/OpenLayers1.html b/tests/OpenLayers1.html index 4d3ae3bded..1d96be349f 100644 --- a/tests/OpenLayers1.html +++ b/tests/OpenLayers1.html @@ -5,8 +5,6 @@ function test_OpenLayers(t) { t.plan(3); - var script = document.getElementById("script"); - t.eq(OpenLayers._getScriptLocation(), "../", "Script location correctly detected."); t.ok(OpenLayers.ImgPath !== undefined, "An ImgPath property exists."); From 3cee4341992823309bddf811b3db2940b457aa77 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Tue, 6 Mar 2012 08:08:09 +0100 Subject: [PATCH 4/7] Also add the declaration of ImgPath to SingleFile.js. --- lib/OpenLayers/SingleFile.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/SingleFile.js b/lib/OpenLayers/SingleFile.js index 58ad019d37..709613e095 100644 --- a/lib/OpenLayers/SingleFile.js +++ b/lib/OpenLayers/SingleFile.js @@ -39,5 +39,13 @@ var OpenLayers = { } } return (function() { return l; }); - })() + })(), + + /** + * APIProperty: ImgPath + * {String} Set this to the path where control images are stored. + * If set to '' OpenLayers will use script location + "img/" + * Default is ''. + */ + ImgPath : '' }; From 36886a2bc5dc68c57e1e669131655489eebc90db Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Tue, 6 Mar 2012 08:33:39 +0100 Subject: [PATCH 5/7] Better documentation for the property ImgPath of OpenLayers. --- lib/OpenLayers.js | 35 ++++++++++++++++++++++++++++++++--- lib/OpenLayers/SingleFile.js | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 64 insertions(+), 6 deletions(-) diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index 4fdbb17c98..ed61f9cd58 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -83,9 +83,38 @@ /** * APIProperty: ImgPath - * {String} Set this to the path where control images are stored. - * If set to '' OpenLayers will use script location + "img/" - * Default is ''. + * {String} + * + * Set this to the path where control images are stored, a path given + * here must end with a slash. If set to '' (which is the default) + * OpenLayers will use its script location + "img/". + * + * You will need to set this property when you have a singlefile build of + * OpenLayers that either is not named "OpenLayers.js" or if you move + * the file in a way such that the image directory cannot be derived from + * the script location. + * + * If your custom OpenLayers build is named "my-custom-ol.js" and the images + * of OpenLayers are in a folder "/resources/external/images/ol" a correct + * way of including OpenLayers in your HTML would be: + * + * (code) + * + * + * (end code) + * + * Please remember that when your OpenLayers script is not named + * "OpenLayers.js" you will have to make sure that the default theme is + * loaded into the page by including an appropriate <link>-tag, + * e.g.: + * + * (code) + * + * (end code) */ ImgPath : '' }; diff --git a/lib/OpenLayers/SingleFile.js b/lib/OpenLayers/SingleFile.js index 709613e095..efd8f3b22c 100644 --- a/lib/OpenLayers/SingleFile.js +++ b/lib/OpenLayers/SingleFile.js @@ -43,9 +43,38 @@ var OpenLayers = { /** * APIProperty: ImgPath - * {String} Set this to the path where control images are stored. - * If set to '' OpenLayers will use script location + "img/" - * Default is ''. + * {String} + * + * Set this to the path where control images are stored, a path given + * here must end with a slash. If set to '' (which is the default) + * OpenLayers will use its script location + "img/". + * + * You will need to set this property when you have a singlefile build of + * OpenLayers that either is not named "OpenLayers.js" or if you move + * the file in a way such that the image directory cannot be derived from + * the script location. + * + * If your custom OpenLayers build is named "my-custom-ol.js" and the images + * of OpenLayers are in a folder "/resources/external/images/ol" a correct + * way of including OpenLayers in your HTML would be: + * + * (code) + * + * + * (end code) + * + * Please remember that when your OpenLayers script is not named + * "OpenLayers.js" you will have to make sure that the default theme is + * loaded into the page by including an appropriate <link>-tag, + * e.g.: + * + * (code) + * + * (end code) */ ImgPath : '' }; From e8744edd24f7d7bc376979660697db154c101fbb Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Tue, 6 Mar 2012 08:39:00 +0100 Subject: [PATCH 6/7] Minor formatting of API doc comments. --- lib/OpenLayers.js | 8 +++----- lib/OpenLayers/SingleFile.js | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index ed61f9cd58..cf41390a9f 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -83,10 +83,8 @@ /** * APIProperty: ImgPath - * {String} - * - * Set this to the path where control images are stored, a path given - * here must end with a slash. If set to '' (which is the default) + * {String} Set this to the path where control images are stored, a path + * given here must end with a slash. If set to '' (which is the default) * OpenLayers will use its script location + "img/". * * You will need to set this property when you have a singlefile build of @@ -109,7 +107,7 @@ * * Please remember that when your OpenLayers script is not named * "OpenLayers.js" you will have to make sure that the default theme is - * loaded into the page by including an appropriate <link>-tag, + * loaded into the page by including an appropriate -tag, * e.g.: * * (code) diff --git a/lib/OpenLayers/SingleFile.js b/lib/OpenLayers/SingleFile.js index efd8f3b22c..2bac3d5961 100644 --- a/lib/OpenLayers/SingleFile.js +++ b/lib/OpenLayers/SingleFile.js @@ -43,10 +43,8 @@ var OpenLayers = { /** * APIProperty: ImgPath - * {String} - * - * Set this to the path where control images are stored, a path given - * here must end with a slash. If set to '' (which is the default) + * {String} Set this to the path where control images are stored, a path + * given here must end with a slash. If set to '' (which is the default) * OpenLayers will use its script location + "img/". * * You will need to set this property when you have a singlefile build of @@ -69,7 +67,7 @@ var OpenLayers = { * * Please remember that when your OpenLayers script is not named * "OpenLayers.js" you will have to make sure that the default theme is - * loaded into the page by including an appropriate <link>-tag, + * loaded into the page by including an appropriate -tag, * e.g.: * * (code) From c9dbebf4aa52cf6b08fa4b95e67ca43ea0d02a53 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Tue, 6 Mar 2012 20:34:46 +0100 Subject: [PATCH 7/7] ImgPath should not be an an APIProperty in SingleFile.js. --- lib/OpenLayers/SingleFile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/SingleFile.js b/lib/OpenLayers/SingleFile.js index 2bac3d5961..a8b3177e52 100644 --- a/lib/OpenLayers/SingleFile.js +++ b/lib/OpenLayers/SingleFile.js @@ -42,7 +42,7 @@ var OpenLayers = { })(), /** - * APIProperty: ImgPath + * Property: ImgPath * {String} Set this to the path where control images are stored, a path * given here must end with a slash. If set to '' (which is the default) * OpenLayers will use its script location + "img/".