rebootcode / svg-edit

Automatically exported from code.google.com/p/svg-edit
MIT License
0 stars 0 forks source link

Configured paths, such as curConfig.imgPath, are ignored #809

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Unzip "svg-edit-2.5.1.zip" to a subfolder on a webserver (eg 
"/htdocs/svg-edit/")

2. Load page /svg-edit/svg-editor.html

3. With the following configuration

   svgEditor.setConfig({
      imgPath: '/svg-edit/images/',
      langPath: '/svg-edit/locale/',
      extPath: '/svg-edit/extensions/'
   });

For example by loading the URL: 
http://domain/svg-edit/svg-editor.html?imgPath=/svg-edit/images/&langPath=/svg-e
dit/locale/&extPath=/svg-edit/extensions/

ERROR: Icons are not shown

Things get even worse if I try to move svg-edit.html to /htdocs/ and change all 
the href's and src's paths in the html to include the subfolder "/svg-edit/":

.
.
<link rel="stylesheet" href="/svg-edit/svg-editor.css" type="text/css"/>
.
.
<script type="text/javascript" 
src="/svg-edit/svgicons/jquery.svgicons.js"></script>
.
.

This is similar to what I would have to do to integrate svg-edit on an 
exisiting page which is really what I want to do.

Relative paths are now relative from "/htdocs/" and svg-edit get's really lost

ERROR: I get the following in Chromes console:
------------------
svg-editor.html:-1Resource interpreted as Image but transferred with MIME type 
text/html.
markers-icons.xmlGET http://domain/extensions/markers-icons.xml 404 (Not Found)
eyedropper-icon.xmlGET http://domain/extensions/eyedropper-icon.xml 404 (Not 
Found)
Error: Problem parsing d=""
------------------

ERROR: When clicking on the colorpicker I get:
------------------
GET http://domain/jgraduate/images/rangearrows2.gif 404 (Not Found)
svg-editor.html:-1Resource interpreted as Image but transferred with MIME type 
text/html.
rangearrows.gifGET http://domain/jgraduate/images/rangearrows.gif 404 (Not 
Found)
Maps.pngGET http://domain/jgraduate/images/Maps.png 404 (Not Found)
mappoint.gifGET http://domain/jgraduate/images/mappoint.gif 404 (Not Found)
map-opacity.pngGET http://domain/jgraduate/images/map-opacity.png 404 (Not 
Found)
Bars.pngGET http://domain/jgraduate/images/Bars.png 404 (Not Found)
mappoint_c.pngGET http://domain/jgraduate/images/mappoint_c.png 404 (Not Found)
mappoint_f.pngGET http://domain/jgraduate/images/mappoint_f.png 404 (Not Found)
bar-opacity.pngGET http://domain/jgraduate/images/bar-opacity.png 404 (Not 
Found)
preview-opacity.pngGET http://domain/jgraduate/images/preview-opacity.png 404 
(Not Found)
NoColor.pngGET http://domain/jgraduate/images/NoColor.png 404 (Not Found)
AlphaBar.pngGET http://domain/jgraduate/images/AlphaBar.png 404 (Not Found)
------------------

Solution suggestions:
1.) Implement the use of the existing curConfig.imgPath, curConfig.langPath and 
curConfig.extPath everywhere in the code where paths are used.

2.) Include similar configurations for all the other folders such as jgraduate

BUT EVEN BETTER:
3.) How about providing one alternative curConfig.svg-editPath setting which 
points at the the folder where svg-edit resides.

http://domain/svg-editor.html?svg-editPath=/svg-edit/

SVG-edit 2.5.1
Google Chrome 10.0.648.204
Windows XP
Apache

Thanks for an otherwise excellent and very impressive application.

Notes on why we don't just iFrame from http://svg-edit.googlecode.com
1. We need to host the code on our own server because it is a secure site.
2. We can't accept "modules" to reside in the very root of our site

Best regards
Brian Turner Ottosen
Managing director at HoBSoft
brian@hobsoft.net
www.hobsoft.net
+41 793 319 569

Original issue reported on code.google.com by britursen@gmail.com on 29 Mar 2011 at 1:32

GoogleCodeExporter commented 9 years ago
I have now worked around the issue by using the 2.6 alpha version where there 
is a configuration for "jGraduatePath" and made one change in each of the 
extension scripts:

extension/ext-eyedropper.js
extension/ext-grid.js
extension/ext-imagelib.js
extension/ext-markers.js
extension/ext-shapes.js

example:

svgicons: "extensions/markers-icons.xml",

changed to:

svgicons: svgEditor.curConfig.extPath + "/markers-icons.xml",

Original comment by britursen@gmail.com on 30 Mar 2011 at 9:39

GoogleCodeExporter commented 9 years ago
This path issue is all around the code.
Dynamic js file inclusion or form action attributes are all set as relative 
paths, which makes it impossible to include the svg-editor from another 
directory.

For example;
The editor files are located at: http://localhost/libraries/svgedit2/editor/...
I want to display the editor at: http://localhost/custom-svgedit-page.php

Original comment by ufuk...@gmail.com on 3 Dec 2011 at 4:22

GoogleCodeExporter commented 9 years ago
Sorry, I am busy to confirm for myself (or perhaps even work on it), but are 
you still seeing this issue in trunk? FYI, setConfig for paths can no longer be 
triggered by URL for security reasons, but extensions have at least become more 
dependent on the config paths.

Original comment by bret...@gmail.com on 22 May 2014 at 11:47