[Seaside] IALink for <link> element

Kamil Kukura kamk@volny.cz
Sat, 30 Mar 2002 10:39:15 +0100


This is a multi-part message in MIME format.
--------------060107070209030201090700
Content-Type: multipart/alternative;
 boundary="------------040200070106060702060603"


--------------040200070106060702060603
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit

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







--------------040200070106060702060603
Content-Type: text/html; charset=ISO-8859-2
Content-Transfer-Encoding: 7bit

<html>
<head>
</head>
<body>
<font face="Helvetica, foo, sans-serif">Here is IALink for &lt;link&gt; element
which is in fact same to IAImage but with 'href' atribute. Also IASession&gt;&gt;urlForResourceNamed:
is fixed little bit.<br>
<br>
Here I collected useful tags which can refer to external source:</font><br>
<blockquote><tt>&lt;link href=""&gt;</tt><br>
  <tt>&lt;img src=""&gt;</tt><br>
  <tt>&lt;object classid="" codebase="" data=""&gt;</tt><br>
  <tt>&lt;applet codebase=""&gt;</tt><br>
  <tt>&lt;frame src=""&gt;</tt><br>
  <tt>&lt;iframe src=""&gt;</tt><br>
  <tt>&lt;base href=""&gt;</tt><br>
  <tt>&lt;script src=""<br>
  </tt></blockquote>
  <font face="Helvetica, foo, sans-serif">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 &lt;object&gt; tag I just discovered Netscape
6.2 can handle this:<br>
  </font>
  <blockquote><tt>&lt;object data="inc.html"&gt;<br>
    </tt></blockquote>
    <font face="Helvetica, foo, sans-serif">which allows to embed one html
document into another. I like it.</font><br>
    <br>
-- <br>
Kamil<br>
    <br>
    <br>
    <br>
    <br>
    <blockquote><br>
      </blockquote>
      <br>
      </body>
      </html>

--------------040200070106060702060603--

--------------060107070209030201090700
Content-Type: text/plain;
 name="IALink.st"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="IALink.st"

'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! !

--------------060107070209030201090700
Content-Type: text/plain;
 name="IASession-urlForResourceNamed.st"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="IASession-urlForResourceNamed.st"

'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! !

--------------060107070209030201090700--