Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cosmos-dev] How to refer to the dojoURI in the web.xml

The COSMOS UI makes use of dojo modules.  Modules help bundle javascript
clases and other file resources to a namespace.    As a result you can
reference files like images  based on the namespace.

You would reference a image under /dojox/grid/tests/images. as follows

dojo.moduleUrl("dojox.grid","tests/images/plus.gif");

As a result the javascript files are not based on the location of the dojo
path.

Modules are explained under
http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/modules-and-namespaces

Thanks,

Sheldon
______________________________________
Sheldon Lee-Loy



                                                                       
             "Simmonds,                                                
             Martin"                                                   
             <Martin.Simmonds@                                          To
             ca.com>                   "Cosmos Dev"                    
             Sent by:                  <cosmos-dev@xxxxxxxxxxx>        
             cosmos-dev-bounce                                          cc
             s@xxxxxxxxxxx                                             
                                                                   Subject
                                       [cosmos-dev] How to refer to the
             03/06/2008 04:11          dojoURI in the web.xml          
             AM                                                        
                                                                       
                                                                       
             Please respond to                                         
                Cosmos Dev                                             
             <cosmos-dev@eclip                                         
                  se.org>                                              
                                                                       
                                                                       




Hi,

In the graphResponseViewer.js, we have 2 grid widgets.  Grid widgets have
the ability to expand and unexpand rows.  When you implement this
mechanism, it uses an image for expaned as ?-?,  and when unexpanded you
see a ?+? image.  These images are in /dojox/grid/tests/images.

To refer to the images directory, you have to know the dojURI, so if we
know that the dojoURI is dojo-release-1.0.2, then the images are picked up
from dojo-release-1.0.2/dojox/grid/tests/images.

So how do we access the dojoURI that is specified in the web.xml?

If you look in index.jsp you will see things like :

@import ?<%= template.getDojoBaseUrl() %>

This template object gets the dojoURI.

Now, if I put at the very end of the index.jsp...

<div id=dojoURI>?<%= template.getDojoBaseUrl() %>?

Then in my GraphResponseViewer.js I can refer to the value by doing
this......

document.getElementById(?dojoURI?).textContent

So I can pick it up.

My question is, is this the way to do it, or is there a better way ?

You could always create your own images directory in the webapp, and copy
the gifs into that, and refer to the images by /images.

Any suggestions ?

Martin...
 _______________________________________________
cosmos-dev mailing list
cosmos-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cosmos-dev




Back to the top