I suppose it depends on the browser..some browser's are stricter as to where
you can stick <script></script> tags...

VelocityOnly just provides a blank template where you have to physically add
your <html><head><body> tags...
and (correct me if i'm wrong) normally it's best to add your
<script></script> tags within the <head> tags but I know that
 msie can accept <script> tags almost anywhere (like just about anything
else... ;)

If you had added a <script> tag to the layout like so...

<script language="JavaScript"
src="$content.getURI(Admin/global.js)"></script>
that should return
src="http://www.xxx.com:8080/myprojectname/Admin/global.js";

(Note: if using VelocityECSLayout anything added to the layout is within
<body></body> tags unless explicity set with $page.xxx())

and you're layout script was in the layouts/Admin directory 
and you have either set this layout as the default layout in TR.props or
used data.setLayout("Admin/Default.vm") to set it...
then a template within screens/Admin should have no trouble accessing the
javascript..

Make sure you're setting the correct layout etc...


NOTE: I'm no turbine expert so I may be wrong but from my experience the
setup should be something like the above (if you're not worried about
netscape not locating the script-if so use VelocityOnlyLayout) ;)
NOTE2: I'm at work so I have no acces to my turbine stuff and this is off
the top of my head ;)

hope that helps...


Saimon
> -----Mensaje original-----
> De:   David Wynter [SMTP:[EMAIL PROTECTED]]
> Enviado el:   martes 16 de abril de 2002 10:21
> Para: Turbine Users List
> Asunto:       RE: Finding path to resource
> 
> Is it a correct assumption that to use JavaScript you must extend from
> VelocityOnlyLayout? If this is the case then I don't understand how my
> Turbine application screens that use JavaScript before I re-arranged the
> screen and layout templates into sub directories ever worked?
> 
> David
> 
> -----Original Message-----
> From: Simon Moore [mailto:[EMAIL PROTECTED]]
> Sent: 15 April 2002 17:41
> To: Turbine Users List
> Subject: RE: Finding path to resource
> 
> 
> Wether or not default html tags appear or not depends on the class your
> layout extends from.i.e
> 
> If it extends VelocityECSLayout, then the html tags are automatically
> defined for you..
> 
> If you want to have complete control..try extending from VelocityOnly....
> 
> according to this....
> public String getURI(String pathToContent)
>  { return (
>       getServerScheme() + //http
>       "://" +
>       getServerName() + //www.foo.com
>       ":" +
>       getServerPort() + //port webserver running on (8080 for TDK)
>       //the context for tomcat adds a / so no need to add another
>       contextpath + //the tomcat context
>       "/" +
>       pathToContent);
> }
> this is correct...
> 
> #set ( $fileName="style.css.${detector}")
> #set ( $styleSheet=$content.getURI("resources/${fileName}"))
> 
> but here you're using the
> 
> $page.setStyleSheet($styleSheet)
> 
> all you should need is something like...
> 
> $page.setStyleSheet("Admin/style.css");
> 
> which is relative to your app root...no need for getURI() unless your
> stylesheet is on another machine in which case you should use VelocityOnly
> layout and physically define the styleshhet tag using
> src="$content.getURI("resources/${fileName}")"
> 
> Hope that helps...
> 
> Saimon
> 
> > -----Mensaje original-----
> > De: David Wynter [SMTP:[EMAIL PROTECTED]]
> > Enviado el: lunes 15 de abril de 2002 18:12
> > Para:       Turbine Users List
> > Asunto:     RE: Finding path to resource
> >
> >
> > The screen ( in webapps/myapp/templates/app/screens/Admin/ManageUser.vm
> )
> > is
> > like this
> >
> > ------------------------
> > $page.setTitle("Manage User")
> >
> > ## Set up entries in the roleType drop-down
> > #set ( $userRoles = $entitylist.getAllRoles() )
> > #if (!$selectedRole && ($userRoles.size()>0) )
> >     #set ( $selectedRole=$userRoles.get(0) )
> > #end
> >
> > ## make the first entity selected, if no entity has already been
> selected
> >
> > #set ( $users = $entitylist.getAllUsers() )
> > #if (!$selectedUser && ($users.size()>0) )
> >     #set ( $selectedUser = $users.get(0) )
> > #end
> > #set ( $selectedUserName = $selectedUser.getUserName() )
> > #set ( $selectedPassword = $selectedUser.getPassword() )
> >
> > <form name="userForm" method="post"
> >
> action="$link.setPage("Admin,ManageUser.vm").setAction("Admin.CrudUser")">
> >     <input type="hidden" name="selectedUserName"
> > value="$!selectedUserName"/>
> > ...etc
> >
> > etc...
> > ## See onClick test for Update, it checks that the same string is
> entered
> > in
> > both 'password' and 'repassword' when Create is clicked
> > ## If an Update is clicked and they have not entered anything in the
> > password inputs then that is OK, we leave them as they are
> > ## If they have entered them the strings need to be the same and an
> update
> > occurs.
> >                     <td width="$ui.screenWidgetWidth">
> >                             <input type="button" name="reset"
> > value="Clear"
> > onClick="clearFormElements(this.form)"/>
> >                             <input type="submit"
> > name="eventSubmit_doCreate" value="Create"
> > onClick="comparePwds(this.form)"/>
> >                             <input type="submit"
> > name="eventSubmit_doUpdate" value="Update"
> > onClick="comparePwds(this.form)"/>
> >                             <input type="submit"
> > name="eventSubmit_doDelete" value="Delete"/>
> >                     </td>
> >             </tr>
> > ## Probably would need to add a search by login, first and last name
> here
> >     </table>
> > </form>
> >
> > Then the layout ( in
> webapps/myapp/templates/app/layouts/Admin/Default.vm
> > )
> > is like this
> >
> > ---------------------------------------
> >
> > #set ( $fileName="style.css.${detector}")
> > #set ( $styleSheet=$content.getURI("resources/${fileName}"))
> >
> >
> > $page.setStyleSheet($styleSheet)
> >
> > <table width="$ui.totalLayoutWidth" cellspacing="5">
> >   <tr>
> >     <td colspan="3">
> >       $navigation.setTemplate("/DefaultTop.vm")
> >     </td>
> >   </tr>
> >   <tr>
> >     <td width="$ui.menuWidth" align="left" valign="top">
> >       $navigation.setTemplate("/Admin/Default.vm")
> >     </td>
> >     <td BGCOLOR="#86BE40" width="1">
> >             <img src="$content.getURI("images/apixltgrn.gif")"
> > height="100%"
> > width="1">
> >     </td>
> >     <td align="left" valign="top" width="$ui.screenTableWidth">
> >       $screen_placeholder
> >     </td>
> >   </tr>
> >   <tr>
> >     <td colspan="3">
> >       $navigation.setTemplate("/DefaultBottom.vm")
> >     </td>
> >   </tr>
> > </table>
> >
> >
> > I did not do the template structures and names originally so changing
> them
> > has been a struggle. Maybe I need explicit <body> tags somewhere, I
> > thought
> > they must be implict in the template somewhere?
> >
> > David
> >
> > -----Original Message-----
> > From: Simon Moore [mailto:[EMAIL PROTECTED]]
> > Sent: 15 April 2002 17:07
> > To: Turbine Users List
> > Subject: RE: Finding path to resource
> >
> >
> > what does your layout screen look like...?
> >
> >
> >
> >
> > > -----Mensaje original-----
> > > De:       David Wynter [SMTP:[EMAIL PROTECTED]]
> > > Enviado el:       lunes 15 de abril de 2002 17:33
> > > Para:     Turbine Users List
> > > Asunto:   RE: Finding path to resource
> > >
> > > Saimon,
> > >
> > > I get the same result using the
> > > src="$content.getURI("resources,global.js")"/> , a blank screen. I
> think
> > > the
> > > screen template substituted for the $screenholder in the layout is
> > inside
> > > the <html> tag, not sure this works?
> > >
> > > What I find strange is that it found this URI without any directive
> > > before.
> > > Just moving the template referring to the resource should not change
> > this.
> > > It makes sense for tempalte, navigation and layouts, but I am not so
> > sure
> > > about resources.
> > >
> > > David
> > >
> > > -----Original Message-----
> > > From: Simon Moore [mailto:[EMAIL PROTECTED]]
> > > Sent: 15 April 2002 15:58
> > > To: Turbine Users List
> > > Subject: RE: Finding path to resource
> > >
> > >
> > > that's not what it was designed for but I thought you might be
> > interested
> > > ;)
> > >
> > > but try
> > >
> > > src="$content.getURI("resources,global.js")"/>
> > >
> > > hope that helps...
> > >
> > >
> > > (You'll have to wait as I have it at home somewhere....I have to dig
> it
> > > up)
> > >
> > > Personally, after implementing it..I then decided I wanted to try and
> > > avoid
> > > javascript in my apps as much as possible...ironic isn't it..;)
> > >
> > >
> > > Saimon,
> > >
> > > > -----Mensaje original-----
> > > > De:     David Wynter [SMTP:[EMAIL PROTECTED]]
> > > > Enviado el:     lunes 15 de abril de 2002 16:48
> > > > Para:   Turbine Users List
> > > > Asunto: RE: Finding path to resource
> > > >
> > > >
> > > >
> > > > Sure, if it shows me how to include the JavaScript from a template
> in
> > a
> > > > sub
> > > > directory off /screens. I have found the architecture hard to
> follow,
> > > > mainly
> > > > because of the documentation. I have found the Flux implementation
> has
> > > > answered most of my questions when someone reminded me it was there!
> > > >
> > > > David
> > > >
> > > > -----Original Message-----
> > > > From: Simon Moore [mailto:[EMAIL PROTECTED]]
> > > > Sent: 15 April 2002 15:37
> > > > To: Turbine Users List
> > > > Subject: RE: Finding path to resource
> > > >
> > > >
> > > > I submitted a javascript implementation for intake a while back now,
> > > that
> > > > you might be interested in...
> > > >
> > > > If so..I'll see if I can dig it up...
> > > >
> > > > Saimon
> > > >
> > > > > -----Mensaje original-----
> > > > > De:   David Wynter [SMTP:[EMAIL PROTECTED]]
> > > > > Enviado el:   lunes 15 de abril de 2002 16:31
> > > > > Para: Turbine-User
> > > > > Asunto:       Finding path to resource
> > > > >
> > > > > I have just moved my .vm templates to subdirectories of
> > > > > webapps/myapp/modules/app/screens that represent the roles that
> use
> > > > them.
> > > > > I
> > > > > have implemented a much simpler version of what Scott Weaver
> > presented
> > > > in
> > > > > his extended security model. The last hurdle to overcome is
> finding
> > my
> > > > > JavaScript resources. I have a file 'global.js' located in the
> > > > > webapps/myapp/resources directory. In this global.js file is a
> > > function
> > > > > called comparePwds. It is address from a tempalte as follows:
> > > > > <input type="submit" name="eventSubmit_doCreate" value="Create"
> > > > > onClick="comparePwds(this.form)"/>
> > > > >
> > > > > It cannot find it now that the template has moved to
> > > > > webapps/myapp/modules/app/screens/Admin.
> > > > >
> > > > > I tried adding this to the top of the template and separately to
> the
> > > top
> > > > > of
> > > > > the layout template.
> > > > > <script language="JavaScript"
> > > > > src="$content.getURI("resources/global.js")"/>
> > > > > I ended up with blank screens in both cases but no error about not
> > > > finding
> > > > > the script. I found a reference to this is in the  arhive, but
> this
> > > had
> > > > > <html> and <body> tags which my templates do not. I could not find
> > > > > anything
> > > > > on where these tags are implicitly in the Velocity templates. I
> > > > understand
> > > > > that I need to put the above <script ... in between the <html> and
> > > > <body>
> > > > > tags but where do these occur?
> > > > >
> > > > > thanks
> > > > >
> > > > > David Wynter
> > > > > roamware Ltd.
> > > > > (+44) (0) 208 922 7539 B.
> > > > > (+44) (0) 7879 605 706 M.
> > > > > [EMAIL PROTECTED]
> > > > >
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > > > <mailto:[EMAIL PROTECTED]>
> > > > > For additional commands, e-mail:
> > > > > <mailto:[EMAIL PROTECTED]>
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to