#!/usr/local/bin/rexx form = "chEvents.html" /* --- initialise variables --- */ filename = "events" homedir = "/home/web/home/tof_forms/" /* -------------- CHANGE -------------------- */ txt_file = homedir || filename || ".txt" parse arg . "title=" new_title, "url=" new_url, "by=" new_by, "type=" new_type, "place=" new_place, "fday=" new_fday, "fmonth=" new_fmonth, "fyear=" new_fyear, "uday=" new_uday, "umonth=" new_umonth, "uyear=" new_uyear, "institute=" new_institute, "organisers=" new_organisers, "comments=" new_comments, "action=" action, "selection=" selection new_title = strip(new_title) new_url = strip(new_url) new_by = strip(new_by) new_type = strip(new_type) new_place = strip(new_place) new_fday = strip(new_fday) new_fmonth = strip(new_fmonth) new_fyear = strip(new_fyear) new_uday = strip(new_uday) new_umonth = strip(new_umonth) new_uyear = strip(new_uyear) new_institute = strip(new_institute) new_organisers = strip(new_organisers) new_comments = strip(new_comments) call load_events call BubbleSort if action = "DELETE" then call DeleteRecord else if action = "UPDATE" then do if new_title <> "" then do if selection >= 0 then call UpdateRecord else if selection < 0 then call AddRecord end end call create_html exit /* ---------------- Load events from file ------------- */ load_events: f = open(txt_file,"r") if f<0 then do title.0 = 0 return end n = 0 do until eof(f) n = n + 1 title.n = linein(f) url.n = linein(f) by.n = linein(f) type.n = linein(f) place.n = linein(f) fday.n = linein(f) fmonth.n = linein(f) fyear.n = linein(f) uday.n = linein(f) umonth.n = linein(f) uyear.n = linein(f) institute.n = linein(f) organisers.n = linein(f) comments.n = linein(f) end call close f title.0 = n-1 return /* ------------ UpdateRecord ------------------- */ UpdateRecord: if new_title = "" then return s=selection+1 title.s = new_title url.s = new_url by.s = new_by type.s = new_type place.s = new_place fday.s = new_fday fmonth.s = new_fmonth fyear.s = new_fyear uday.s = new_uday umonth.s = new_umonth uyear.s = new_uyear institute.s = new_institute organisers.s = new_organisers comments.s = new_comments call BubbleSort call WriteFile return /* -------------- AddRecord -------------------- */ AddRecord: if new_title = "" then return title.0 = title.0 + 1 i = title.0 title.i = new_title url.i = new_url by.i = new_by type.i = new_type place.i = new_place fday.i = new_fday fmonth.i = new_fmonth fyear.i = new_fyear uday.i = new_uday umonth.i = new_umonth uyear.i = new_uyear institute.i = new_institute organisers.i = new_organisers comments.i = new_comments call BubbleSort call WriteFile return /* ------------- DeleteRecord ----------------- */ DeleteRecord: if selection = -1 then return s = selection+1 do i=s to title.0-1 next = i+1 title.i = title.next url.i = url.next by.i = by.next type.i = type.next place.i = place.next fday.i = fday.next fmonth.i = fmonth.next fyear.i = fyear.next uday.i = uday.next umonth.i = umonth.next uyear.i = uyear.next institute.i = institute.next organisers.i = organisers.next comments.i = comments.next end title.0 = title.0 - 1 call WriteFile return /* --------------- WriteFile -------------------- */ WriteFile: f = open(txt_file,"w") do i=1 to title.0 call lineout f,title.i call lineout f,url.i call lineout f,by.i call lineout f,type.i call lineout f,place.i call lineout f,fday.i call lineout f,fmonth.i call lineout f,fyear.i call lineout f,uday.i call lineout f,umonth.i call lineout f,uyear.i call lineout f,institute.i call lineout f,organisers.i call lineout f,comments.i end call close f return /* ----------------- BubbleSort ------------------- */ BubbleSort: do i=2 to title.0 changed = 0 do j=title.0 to i by -1 jp = j-1 prev=title.jp; cur =title.j; UPPER cur prev if prev > cur then do str = title.j title.j = title.jp title.jp = str str = url.j url.j = url.jp url.jp = str str = by.j by.j = by.jp by.jp = str str = type.j type.j = type.jp type.jp = str str = place.j place.j = place.jp place.jp = str str = fday.j fday.j = fday.jp fday.jp = str str = fmonth.j fmonth.j = fmonth.jp fmonth.jp = str str = fyear.j fyear.j = fyear.jp fyear.jp = str str = uday.j uday.j = uday.jp uday.jp = str str = umonth.j umonth.j = umonth.jp umonth.jp = str str = uyear.j uyear.j = uyear.jp uyear.jp = str str = institute.j institute.j = institute.jp institute.jp = str str = organisers.j organisers.j = organisers.jp organisers.jp = str str = comments.j comments.j = comments.jp comments.jp = str changed = 1 end end if ^changed then leave end return /* ------------ Create the FORM ----------------- */ create_html: say '' say '' say 'n_TOF Events Form' say say '' say '' say '
' say '

n_TOF Events Form

' say '
' say '
' say '' say '' say '
List of Events
' say ' ' say '
' say '' say '' say '' say '' say '' say '' say '' say '' say '' say '' say '' say '
Title
URL
Organised by
Type    Workshop     Conference
Place
DateFROM Day:' say 'Month:' say 'Year:' say ' UNTIL Day:' say 'Month:' say 'Year:' say '
Institute
Organisers
Comments
' say ' ' say ' ' say ' ' say ' ' say '
' say '
' say '
' say '
' say 'Vivian Synteta' say '
' say '' return