Set top directory for relative HREFs.
authorStefan Vogel <sv@exept.de>
Tue, 24 Sep 1996 00:45:32 +0200
changeset 249 6698113011ea
parent 248 d29ba9ab5185
child 250 645390ad8e95
Set top directory for relative HREFs.
LicenceBox.st
--- a/LicenceBox.st	Tue Sep 24 00:44:55 1996 +0200
+++ b/LicenceBox.st	Tue Sep 24 00:45:32 1996 +0200
@@ -10,8 +10,10 @@
  hereby transferred.
 "
 
+'From Smalltalk/X, Version:2.10.9 on 23-sep-1996 at 18:24:31'                   !
+
 DialogBox subclass:#LicenceBox
-	instanceVariableNames:'accepted destroySemaphore'
+	instanceVariableNames:'accepted destroySemaphore fileName'
 	classVariableNames:'LicenceRejectSignal'
 	poolDictionaries:''
 	category:'Views-DialogBoxes'
@@ -136,12 +138,13 @@
 
     (self addTextLabel:(resources string:'Please read the licence terms:')) adjust:#left.
     textView := self addTextBoxOn:nil 
-			class:HTMLDocumentView
-			withNumberOfLines:40 
-			hScrollable:true 
-			vScrollable:true.
+                        class:HTMLDocumentView
+                        withNumberOfLines:40 
+                        hScrollable:true 
+                        vScrollable:true.
     self width:(textView preferredExtentForLines:40 cols:70) x.
     textView setText:(self licenceText).
+    textView setTopDirectoryName:(self topDirectory).
     self addAbortButtonLabelled:(resources string:'reject licence terms').
     self addOkButtonLabelled:(resources string:'accept licence terms').
     self abortAction:[self destroy. accepted := false. LicenceRejectSignal raise].
@@ -153,34 +156,70 @@
 
 !LicenceBox methodsFor:'private'!
 
+licenceFile
+    "get filename of licence file"
+
+    |fn|
+
+    fileName isNil ifTrue:[
+        fileName := fn := resources at:'LICENCEFILE' default:nil.
+        fileName isNil ifTrue:[
+             fileName := fn := 'doc/online/english/LICENCE.STX.html'.
+        ].
+        fileName asFilename exists ifFalse:[
+            fileName := Smalltalk getSystemFileName:fileName.
+            fileName isNil ifTrue:[
+                fileName := '../../' , fn.
+                fileName asFilename exists ifFalse:[
+                    fileName := Smalltalk getSystemFileName:'doc/online/german/LICENCE.STX.html'.
+                    fileName isNil ifTrue:[
+                        fileName := '../../doc/online/german/LICENCE.STX.html'.
+                    ]
+                ]
+            ].
+        ].
+        fileName asFilename exists ifFalse:[
+            fileName := nil
+        ].
+    ].
+    ^ fileName 
+
+    "
+     LicenceBox new licenceFile
+    "
+
+!
+
 licenceText
     "get licence text"
 
-    |fn file|
+    |file|
 
-    file := fn := resources at:'LICENCEFILE' default:nil.
+    file := self licenceFile.
     file isNil ifTrue:[
-         file := fn := 'doc/online/english/LICENCE.STX.html'.
-    ].
-    file asFilename exists ifFalse:[
-        file := Smalltalk getSystemFileName:file.
-        file isNil ifTrue:[
-            file := '../../' , fn.
-            file asFilename exists ifFalse:[
-                file := Smalltalk getSystemFileName:'doc/online/german/LICENCE.STX.html'.
-                file isNil ifTrue:[
-                    file := '../../doc/online/german/LICENCE.STX.html'.
-                ]
-            ]
-        ].
-    ].
-    file asFilename exists ifFalse:[
         ^ 'oops - you are not allowed to remove the LICENSE file !!'
     ].
-    ^ file asFilename readStream contents.
+    ^ file asFilename contents.
 
     "
-     self open
+     LicenceBox new licenceText
+    "
+
+!
+
+topDirectory
+    "get name of top directory"
+
+    |file|
+
+    file := self licenceFile.
+    file isNil ifTrue:[
+        ^ ''
+    ].
+    ^ file asFilename directoryName.
+
+    "
+     LicenceBox new topDirectory
     "
 
 ! !
@@ -188,6 +227,6 @@
 !LicenceBox  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/LicenceBox.st,v 1.5 1996-09-11 10:51:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/LicenceBox.st,v 1.6 1996-09-23 22:45:32 stefan Exp $'
 ! !
 LicenceBox initialize!