[Seaside] IALink for <link> element

Julian Fitzell julian@beta4.com
Sat, 30 Mar 2002 06:57:09 -0800


Kamil Kukura wrote:
> Here is IALink for <link> element which is in fact same to IAImage but 
> with 'href' atribute. Also IASession>>urlForResourceNamed: is fixed 
> little bit.
> 
> Here I collected useful tags which can refer to external source:
> 
>     <link href="">
>     <img src="">
>     <object classid="" codebase="" data="">
>     <applet codebase="">
>     <frame src="">
>     <iframe src="">
>     <base href="">
>     <script src=""
> 
> I was thinking that for these elements there could be classes 
> IAExternalSRC (for elements with src="" attribute), IAExternalHREF (for 
> elements with href="" attribute) and then extra IAApplet and IAObject. 
> Btw, regarding <object> tag I just discovered Netscape 6.2 can handle this:
> 
>     <object data="inc.html">
> 
> which allows to embed one html document into another. I like it.
> 
> -- 
> Kamil
> 
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 'From Squeak3.0 of 4 February 2001 [latest update: #3552] on 30 March 2002 at 10:36:46 am'!
> IAElement subclass: #IALink
> 	instanceVariableNames: 'href '
> 	classVariableNames: ''
> 	poolDictionaries: ''
> 	category: 'Seaside-Tags'!
> 
> !IALink methodsFor: 'as yet unclassified' stamp: 'KamK 3/29/2002 17:13'!
> defaultBindings
> 	self set: #href toPath: id.! !
> 
> !IALink methodsFor: 'as yet unclassified' stamp: 'KamK 3/29/2002 17:14'!
> printHtmlTo: context
> 	| path |
> 
> 	path _ context currentPage session urlForResourceNamed: (context valueForBinding: href).
> 	
> 	self printOpenTagTo: context withAssociations: {'href' -> path}.! !
> 
> "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
> 
> IALink class
> 	instanceVariableNames: ''!
> 
> !IALink class methodsFor: 'as yet unclassified' stamp: 'KamK 3/29/2002 17:12'!
> acceptNode: aNode
> 	^ aNode name = #link! !
> 
> 
> ------------------------------------------------------------------------
> 
> 'From Squeak3.0 of 4 February 2001 [latest update: #3552] on 30 March 2002 at 10:35:50 am'!
> 
> !IASession methodsFor: 'request handling' stamp: 'KamK 3/30/2002 10:07'!
> urlForResourceNamed: aString
> | path |
> 	(aString indexOf: $:) > 0		"if naming scheme is provided"
> 		ifTrue: [^aString].
> 
> 	path _ self application documentRoot.
> 	path isEmptyOrNil ifTrue: [path _ '/'].
> 	path last = $/ ifFalse: [path _ path , '/'].
> 	path _ path , aString.
> 	
> ^path! !

Hi Kamil,

there actually already is a link element (though come to think about it, 
it's probably in SSVS and not in 0.92).  At the moment it's called 
IAHeadLink which is probably a bad name but then the name doesn't 
usually matter.

The other tags seems like reasonable uses as well.  I'm going away for 
the weekend so I'll leave Avi to comment further and do something about 
it.  You could also file a feature request at http://bugs.beta4.com

Oh, what is the reason for your naming scheme addition to 
urlForResourceNamed: ?  I can't quite figure it out.

Cheers,

Julian
-- 
julian@beta4.com
Beta4 Productions (http://www.beta4.com)