Fisheye: Tag 51341f64f5e0defd47d3aa5506ddbc259590666a refers to a dead (removed) revision in file `doc/index.html'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 51341f64f5e0defd47d3aa5506ddbc259590666a refers to a dead (removed) revision in file `generic/predefined.h'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 51341f64f5e0defd47d3aa5506ddbc259590666a refers to a dead (removed) revision in file `library/lib/pkgIndex.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Index: library/xotcl/apps/actiweb/Counter.xotcl
===================================================================
diff -u
--- library/xotcl/apps/actiweb/Counter.xotcl (revision 0)
+++ library/xotcl/apps/actiweb/Counter.xotcl (revision 51341f64f5e0defd47d3aa5506ddbc259590666a)
@@ -0,0 +1,42 @@
+#!../../src/xotclsh
+# $Id: Counter.xotcl,v 1.4 2006/09/27 08:12:39 neumann Exp $
+#load /Users/neumann/src/xotcl-1.4.1/library/store/XOTclSdbm/libxotclsdbm1.2.dylib
+array set opts {-pkgdir .}; array set opts $argv
+lappend auto_path $opts(-pkgdir)
+
+package require XOTcl 1; namespace import -force xotcl::*
+package require xotcl::actiweb::htmlPlace
+package require xotcl::actiweb::webDocument
+
+### Instantiate an Html place with the name receive and port 8090
+HtmlPlace ::receiver -port 8090 -allowExit exit
+
+### Define a class Counter as a special Html Document
+Class Counter -superclass HtmlDocument -parameter {{count 0}}
+
+Counter instproc init args { ;### Constructor
+ next
+ my persistent count ;### make count variable persistent
+ ::receiver exportObjs [self] ;### export the counter object
+ my exportProcs increment ;### export counter's increment method
+}
+Counter instproc default {} { ;### Method for updating HTML page
+ set objName [string trimleft [self] :]
+ return "The value in $objName is now: [my set count].
Last Update: [clock format [clock seconds] -format %m/%d/%y-%H:%M]
+]
+ \n"
+}
+
+### Create two proxy instances wc1 und wc2
+HtmlProxyCounter wc1 -realSubject c1
+HtmlProxyCounter wc2 -realSubject c2
+
+### Start event loop and handle connections
+receiver startEventLoop
Index: library/xotcl/apps/actiweb/MC.xotcl
===================================================================
diff -u
--- library/xotcl/apps/actiweb/MC.xotcl (revision 0)
+++ library/xotcl/apps/actiweb/MC.xotcl (revision 51341f64f5e0defd47d3aa5506ddbc259590666a)
@@ -0,0 +1,212 @@
+#!../../src/xotclsh
+# $Id: MC.xotcl,v 1.1.1.1 2004/05/23 22:50:39 neumann Exp $
+#
+# A simple multiple choice test application
+#
+array set opts {-pkgdir .}; array set opts $argv
+lappend auto_path $opts(-pkgdir)
+
+package require XOTcl 1; namespace import -force xotcl::*
+#package require xotcl::package; package verbose 1
+package require xotcl::actiweb::htmlPlace
+package require xotcl::actiweb::pageTemplate
+
+HtmlPlace ::receiver -port 8092 -allowExit exit
+
+# Define a pool of questions: Question and their alternatives
+# are defined as classes and all questions are stored in the pool
+#
+Class Pool
+Class Pool::Question -parameter {text {altcounter 1}}
+Class Pool::Question::Alternative -parameter {text correct}
+
+Pool::Question instproc alternatives {pairs} {
+ my instvar altcounter
+ foreach {alt correct} $pairs {
+ incr altcounter
+ [self class]::Alternative [self]::$altcounter \
+ -text $alt -correct $correct
+ }
+}
+
+
+#
+# An Exam has a name and is a selection of questions from a pool.
+# "requiredCorrect" defines the minimal number of correct answers
+# to pass the test.
+
+Class Exam -parameter {name requiredCorrect pool questions}
+
+
+#
+# For every candidate we create an individual exam. We scramble
+# the questions and alternatives and use the studentID as a seed.
+#
+
+Class IndividualExam -superclass Agent -parameter {ID exam}
+
+IndividualExam instproc random modulo { ;### random number generator
+ my instvar seed
+ set seed [expr {($seed*12731+34197) % 21473}]
+ return [expr {$seed % $modulo}]
+}
+IndividualExam instproc permute {list} { ;### permute random permutation
+ set permuted {}
+ for {set nr [llength $list]} {$nr>0} {incr nr -1} {
+ set select [my random $nr]
+ lappend permuted [lindex $list $select]
+ set list [lreplace $list $select $select]
+ }
+ return $permuted
+}
+IndividualExam instproc init args {
+ my instvar seed ID exam individualTest alternatives
+ set questions [$exam set questions]
+ set seed $ID
+ ### compute order of individual tests and alternatives
+ foreach index [my permute [$exam set questions]] {
+ set questionObj [$exam set pool]::$index
+ lappend individualTest $index
+ set alts [my permute [lsort [$questionObj info children]]]
+ lappend alternatives $alts
+ }
+ #puts stderr "Individual test [self] has $individualTest"
+}
+
+#
+# Define a web facade using a page template
+# "testObject" is the individual test that is shielded by the web facade
+#
+Class WebExam -superclass WebObject \
+ -instmixin PageTemplateHtml -parameter {testObject}
+WebExam instproc default {} { ;### This method creates the HTML Test
+ my instvar testObject ;### import var that stores shielded test object
+ ### import vars from the test
+ $testObject instvar individualTest alternatives exam
+ set action [my selfAction result]
+ ### create Test page
+ set htmlText "\n"
+ ### create simple HTML Page
+ my simplePage [$exam name] \
+ "Exam [$exam name] for [string trimleft $testObject :] \
+ (Exam: $exam)" $htmlText
+}
+WebExam instproc result {} { ;# This method analyses the results of the test
+ my instvar testObject ;### import var that stores shielded test
+ set exam [$testObject exam]
+ $testObject instvar individualTest alternatives
+ foreach question $individualTest alts $alternatives {
+ foreach a $alts {set ca($a) 0}
+ }
+ foreach a [my getFormData] {set ca([$a set content]) 1}
+ set htmlText "You have answered:
[[$exam pool]::$q text]: \n"
+ foreach alternative [[$exam pool]::$q info children] {
+ set altCorrect [expr {$ca($alternative) == [$alternative correct]}]
+ append htmlText [$alternative text]\n \
+ $answerText($ca($alternative)) \
+ $correctText($altCorrect)
+ set correct [expr {$correct && $altCorrect}]
+ }
+ if {$correct} {incr correctAnswers}
+ }
+ append htmlText
\n
+ if {$correctAnswers < [$exam requiredCorrect]} {
+ my simplePage [self] "Sorry" "$htmlText\
+ Only $correctAnswers question were answered correctly. You have not succeeded :("
+ } else {
+ my simplePage [self] "Congratulations" "$htmlText\
+ $correctAnswers questions were answered correctly. You have succeeded :-)"
+ }
+}
+WebExam instproc init args {
+ next
+ [my place] exportObjs [self] ;# export object
+ my exportProcs result ;# export methods
+}
+
+
+
+
+
+# Create a Pool P with 6 example questions with 3 alternatives for each.
+
+Pool p
+Pool::Question p::1 \
+ -text "When was the first XOTcl Version released?" -alternatives {
+ "1998" 0
+ "1999" 1
+ "2000" 0
+ }
+Pool::Question p::2 -text "Who is author of XOTcl?" -alternatives {
+ "Gustaf Neumann" 1
+ "Mika Haekinnen" 0
+ "Uwe Zdun" 1
+}
+Pool::Question p::3 -text "Which of the systems are other OO extensions of Tcl?" \
+ -alternatives {
+ "XTCL" 0
+ "ITCL" 1
+ "OTCL" 1
+ }
+Pool::Question p::4 \
+ -text "Which methods are provided by the Object class?" -alternatives {
+ "set" 1
+ "instvar" 0
+ "filter" 1
+ }
+Pool::Question p::5 \
+ -text "Which methods are provided by the Object class?" -alternatives {
+ "unset" 1
+ "instproc" 0
+ "mixin" 1
+ }
+Pool::Question p::6 \
+ -text "Which methods are provided by the Class class?" -alternatives {
+ "proc" 0
+ "instproc" 1
+ "mixin" 0
+ }
+
+### Define an exam
+
+Exam xotclTest \
+ -pool p \
+ -name "XOTcl Test" \
+ -questions {1 2 3 4 5} \
+ -requiredCorrect 4
+
+
+### Define two Student tests with the XOTcl Test
+
+foreach {Student ID} {
+ Uwe 7850247
+ Gustaf 7850248
+} {
+ ## Define the individual exams
+ IndividualExam $Student -exam xotclTest -ID $ID
+ ### Define a web facade for each student
+ WebExam $Student.html -testObject $Student
+
+}
+receiver startEventLoop
Index: library/xotcl/apps/actiweb/univ/UNIVERSAL.xotcl
===================================================================
diff -u
--- library/xotcl/apps/actiweb/univ/UNIVERSAL.xotcl (revision 0)
+++ library/xotcl/apps/actiweb/univ/UNIVERSAL.xotcl (revision 51341f64f5e0defd47d3aa5506ddbc259590666a)
@@ -0,0 +1,267 @@
+#!/usr/bin/env tclsh
+#$Id: UNIVERSAL.xotcl,v 1.8 2007/08/14 16:38:26 neumann Exp $
+package require XOTcl 1; namespace import -force xotcl::*
+array set opts {
+ -ssl 0 -instanceFile UNIVERSAL.rdf -cssFile UNIVERSAL.css -root . -pkgdir .}
+array set opts $argv
+
+@ @File {
+ description {
+ This is a demo of a Webserver that presents the contents of
+ an RDF source file in a friendly and easy readable manner.
+
+ The RDF file is parsed first into triples which
+ are added to the resource database RDFdb. This RDFdb used in this
+ example replaces the standard triple database of xoRDF by an
+ application specific version, which is easier to process. The triple
+ database is the source of the Catalog, which displays a short, easy to read
+ summary of the entries. The database is used as well for the "detailed
+ view", which presents all the data of the triples through nested HTML tables.
+
+ The demo program uses either HTTP or HTTPS (in which case you will require
+ the SSL/TLS extension of Tcl).
+ }
+}
+
+lappend auto_path $opts(-pkgdir)
+if {$opts(-ssl)} {
+ package require xotcl::actiweb::secureHtmlPlace
+ SecureHtmlPlace ::receiver -port 443 -root $opts(-root)
+} else {
+ package require xotcl::actiweb::htmlPlace
+ HtmlPlace ::receiver -port 8095 -root $opts(-root) -allowExit exit
+}
+package require xotcl::actiweb::webDocument
+
+# load RDF processing components
+package require xotcl::rdf::parser
+package require xotcl::rdf::triple
+package require xotcl::xml::printVisitor
+
+proc loadFile filename {
+ set F [open $filename r]; set c [read $F]; close $F
+ return $c
+}
+#
+# instantiate parser and parser an example text into a node tree
+#
+
+#puts stderr "parsing [loadFile $opts(-instanceFile)]"
+RDFParser R
+R parse [loadFile $opts(-instanceFile)]
+puts stderr "parsing done"
+
+#
+# load the nodetree from the parser into the triple database
+#
+#section Triples
+TripleVisitor tv -parser R
+tv proc interprete {} {
+ my instvar topNode parser
+ if {![my exists topNode]} {set topNode ${parser}::topNode1}
+ my reset
+ my interpretNodeTree $topNode
+}
+
+#### Define a simple Resource Database
+Class RDFdb -superclass RDFTripleDB
+RDFdb instproc isContainer c {
+ regexp ^[self]::rdfdoc\# $c
+}
+RDFdb instproc add {predicate subject object} {
+ set s [self]::$subject
+ if {[my info children $s] eq ""} {
+ #puts stderr "create new resource $s"
+ Resource create $s
+ }
+ $s set $predicate $object
+ next ;# for passing to RDFTripleDB (which provides e.g. prettyTriples)
+}
+RDFdb instproc reset {} {
+ foreach c [my info children] { $c destroy }
+ next
+}
+RDFdb instproc resources {} {
+ set result ""
+ foreach c [my info children] {
+ if {![my isContainer $c] &&
+ [$c istype Resource]} {lappend result $c}
+ }
+ return $result
+}
+RDFdb instproc querySubject {subject} {
+ set s [self]::$subject
+ set result ""
+ if {[my info children $s] ne ""} {
+ foreach att [lsort [$s info vars]] {
+ lappend result $att [$s set $att]
+ }
+ }
+ return $result
+}
+
+# create an Instance of the Resource Database
+RDFdb tv::db
+
+
+
+# define Resources with its methods
+Class Resource
+Resource instproc dump {} {
+ foreach att [lsort [my info vars]] { puts stderr "\t$att = [my set $att]" }
+}
+Resource instproc substitute {lines} {
+ set result ""
+ foreach line [split $lines \n] {
+ if {[regexp {^ *http:} $line]} {
+ set value ""
+ set o [self]
+ set line [string trim $line]
+ foreach step $line {
+ set value [$o set $step]
+ set o tv::db::$value
+ }
+ append result $value
+ } else {
+ append result $line
+ }
+ }
+ return $result
+}
+
+Resource instproc pretty {} {
+ set q [univ selfAction "details [namespace tail [self]]"]
+ my substitute "
+ http://nm.wu-wien.ac.at/universal/rdf-lifecycle#Contribute \
+ http://nm.wu-wien.ac.at/universal/rdf-lifecycle#Entity
+:
+ http://nm.wu-wien.ac.at/universal/rdf-general#Title
+,
+ http://nm.wu-wien.ac.at/universal/rdf-education#LearningResourceType
+,
+ http://nm.wu-wien.ac.at/universal/rdf-education#TypicalLearningTime
+,
+ http://nm.wu-wien.ac.at/universal/rdf-lifecycle#Contribute \
+ http://nm.wu-wien.ac.at/universal/rdf-lifecycle#Date
+ ([my pretty-access])"
+}
+Resource instproc pretty-title {} {
+ my substitute "http://nm.wu-wien.ac.at/universal/rdf-general#Title"
+}
+Resource instproc pretty-access {} {
+ set tech http://nm.wu-wien.ac.at/universal/rdf-technical
+ set format [my substitute "$tech#Format"]
+ set location [my substitute "$tech#Location"]
+ if {$format eq "text/html"} {
+ set label "go" } else {
+ set label "Download [my substitute $tech#Size] bytes"
+ }
+ return "$label"
+}
+
+
+
+### Definition of the Learning Resource Manager:
+Class LrManager -superclass WebDocument -parameter {
+ {defaultUrl http://nm.wu-wien.ac.at/Lehre/oo2/}
+}
+LrManager instproc html-title {t} {
+ my contentType text/html
+ return "
\n"
+}
+
+LrManager instproc details {subject} {
+ set result [my html-title "Details about a Learning Resource"]
+ append result [my html-head "Details about the Learning Resource '[::tv::db::$subject pretty-title]'"]
+ #append result "The subject: '$subject' has the following properties:
\n"
+ append result [my attributeTable $subject outer] ""
+}
+
+LrManager instproc attributeTable {subject cls} {
+ set result ""
+ set lastns ""
+ foreach {attr value} [tv::db querySubject $subject] {
+ if {[tv::db isContainer $value]} {
+ #set q [univ selfAction "details $value"]; set value "$value"
+ set value [my attributeTable $value inner]
+ }
+ regexp {^(.*)\#(.*)$} $attr _ ns property
+ if {$ns != $lastns} {
+ if {$lastns ne ""} { append result
\n }
+ append result "Attributes from namespace $ns:\n
\n"
+ set lastns $ns
+ }
+ append result
\
+ "
$property
" \
+ "
$value
"
\n
+ }
+ append result "
\n"
+}
+
+
+LrManager instproc catalog {} {
+ set result [my html-title "Universal Resources"]
+ append result [my html-head "Local Learning Resources:"]
\n
+ foreach r [lsort [tv::db resources]] {
+ append result "