Commit 34eca0dc authored by Rinus Plasmeijer's avatar Rinus Plasmeijer
Browse files

*** empty log message ***

parent 1f3b5f17
......@@ -14,25 +14,25 @@ derive gForm
RefPerson, Person,
Reports, RefReport, Report, Recommendation, Familiarity,
RefPaper, Paper, PaperInfo, Co_authors, RefDiscussion,
PaperStatus, Discussion, DiscussionStatus
PaperStatus, Discussion, DiscussionStatus, Message
derive gUpd
Login, Account, Member, ManagerInfo, RefereeInfo, Conflicts,
RefPerson, Person,
Reports, RefReport, Report, Recommendation, Familiarity,
RefPaper, Paper, PaperInfo, Co_authors, RefDiscussion,
PaperStatus, Discussion, DiscussionStatus
PaperStatus, Discussion, DiscussionStatus, Message
derive gPrint
Login, Account, Member, ManagerInfo, RefereeInfo, Conflicts,
RefPerson, Person,
Reports, RefReport, Report, Recommendation, Familiarity,
RefPaper, Paper, PaperInfo, Co_authors, RefDiscussion,
PaperStatus, Discussion, DiscussionStatus
PaperStatus, Discussion, DiscussionStatus, Message
derive gParse
Login, Account, Member, ManagerInfo, RefereeInfo, Conflicts,
RefPerson, Person,
Reports, RefReport, Report, Recommendation, Familiarity,
RefPaper, Paper, PaperInfo, Co_authors, RefDiscussion,
PaperStatus, Discussion, DiscussionStatus
PaperStatus, Discussion, DiscussionStatus, Message
// Naming convention of shared persistent information
......
......@@ -22,19 +22,19 @@ editorRefPerson :: !(InIDataId RefPerson) !*HSt -> (Form Person,!*HSt)
editorRefPerson (init,formid) hst
# (RefPerson refperson) = formid.ival
# (Refto name) = refperson
= universalRefEditor formid.mode (invariantPerson name) refperson hst
= universalRefEditor formid.mode formid.lifespan (invariantPerson name) refperson hst
editorRefPaper :: !(InIDataId RefPaper) !*HSt -> (Form Paper,!*HSt)
editorRefPaper (init,formid) hst
# (RefPaper refpaper) = formid.ival
# (Refto name) = refpaper
= universalRefEditor formid.mode (invariantPaper name) refpaper hst
= universalRefEditor formid.mode formid.lifespan (invariantPaper name) refpaper hst
editorRefReport :: !(InIDataId RefReport) !*HSt -> (Form (Maybe Report),!*HSt)
editorRefReport (init,formid) hst
# (RefReport refreport) = formid.ival
# (Refto name) = refreport
= universalRefEditor formid.mode (invariant name) refreport hst
= universalRefEditor formid.mode formid.lifespan (invariant name) refreport hst
where
invariant name Nothing = Ok
invariant name (Just report) = invariantReport name report
......@@ -42,7 +42,7 @@ where
editorRefDiscussion :: !(InIDataId RefDiscussion) !*HSt -> (Form Discussion,!*HSt)
editorRefDiscussion (init,formid) hst
# (RefDiscussion refdiscus) = formid.ival
= universalRefEditor formid.mode (\_ -> Ok) refdiscus hst
= universalRefEditor formid.mode formid.lifespan (\_ -> Ok) refdiscus hst
// specialized forms
......@@ -78,12 +78,16 @@ where
gForm {|Discussion|} informid hst = specialize myeditor informid hst
where
myeditor (init,formid) hst
# (Discussion list) = formid.ival
= ({changed = False, form = showDiscussion list, value = (Discussion list)},hst)
# (Discussion messages) = formid.ival
= ({changed = False, form = showDiscussion messages, value = formid.ival},hst)
where
showDiscussion [] = []
showDiscussion [(name,content):more] = [B [] (name +++ ":"), Br, Txt content, Br, Hr []] ++ showDiscussion more
showDiscussion [] = []
showDiscussion [{messageFrom,date,time,message}:more]
= [ mkTable [ [ Txt "from: ", B [] messageFrom ]
, [ Txt "date: ", toHtml date]
, [ Txt "time: ", toHtml time]
, [ Txt "message: ", Txt message]
]] ++ [Br, Hr []] ++ showDiscussion more
gForm {|[]|} gHa (init,formid) hst
= case formid.ival of
......@@ -106,23 +110,23 @@ derive gForm
/*RefPerson, */Person,
/*Reports, *//*RefReport, */ Report, Recommendation, Familiarity,
/*RefPaper, */Paper, PaperInfo,/* RefDiscussion,*/
PaperStatus/*, Discussion */ , DiscussionStatus
PaperStatus/*, Discussion */ , DiscussionStatus, Message
derive gUpd
Login, Account, Member, ManagerInfo, RefereeInfo, Conflicts,
RefPerson, Person,
Reports, RefReport, Report, Recommendation, Familiarity,
RefPaper, Paper, PaperInfo, Co_authors, RefDiscussion,
PaperStatus, Discussion, DiscussionStatus
PaperStatus, Discussion, DiscussionStatus, Message
derive gPrint
Login, Account, Member, ManagerInfo, RefereeInfo, Conflicts,
RefPerson, Person,
Reports, RefReport, Report, Recommendation, Familiarity,
RefPaper, Paper, PaperInfo, Co_authors, RefDiscussion,
PaperStatus, Discussion, DiscussionStatus
PaperStatus, Discussion, DiscussionStatus, Message
derive gParse
Login, Account, Member, ManagerInfo, RefereeInfo, Conflicts,
RefPerson, Person,
Reports, RefReport, Report, Recommendation, Familiarity,
RefPaper, Paper, PaperInfo, Co_authors, RefDiscussion,
PaperStatus, Discussion, DiscussionStatus
PaperStatus, Discussion, DiscussionStatus, Message
......@@ -82,7 +82,12 @@ import loginAdmin, htmlFormlib
// Information maintained by the Conference Manager *or* a Referee *or* an Author
:: Discussion = Discussion [(String,String)]
:: Discussion = Discussion [Message]
:: Message = { messageFrom :: String
, date :: HtmlDate
, time :: HtmlTime
, message :: String
}
// Information submitted by an author
......
......@@ -96,15 +96,14 @@ addAuthorPage accounts hst
]
, hst)
// Conference manager editors for changing account information, may conflict with other members
tempAccountsId accounts = sFormId "cfm_temp_states" accounts // temp editor for accounts
tempAccountsId accounts = nFormId "cfm_temp_states" accounts // temp editor for accounts
modifyStatesPage :: !ConfAccounts !*HSt -> ([BodyTag],!*HSt)
modifyStatesPage accounts hst
# (naccounts,hst) = vertlistFormButs 15 True (Init,tempAccountsId accounts) hst // make a list editor to mofify all accounts
# (accounts,hst) = AccountsDB Set naccounts.value hst // store in global database
# (accounts,hst) = if naccounts.changed (AccountsDB Set naccounts.value hst) (naccounts.value,hst) // store in global database
# (naccounts,hst) = vertlistFormButs 15 True (Set,tempAccountsId accounts) hst // store in temp editor
= (naccounts.form, hst)
......@@ -214,37 +213,42 @@ discussPapersPage account accounts hst
# (allreports,hst) = getAllMyReports account accounts hst
# allpapernrs = map fst allreports
# pdmenu = (0, [("Show " +++ toString nr, \_ -> i) \\ i <- [0 .. ] & nr <- allpapernrs])
# (pdfun,hst) = FuncMenu (Init, sFormId "cfm_dpp_pdm" pdmenu) hst
# selected = (fst pdfun.value) 0
# mbpaperrefinfo = getPaperInfo (allpapernrs!!selected) accounts
# (pdfun,hst) = FuncMenu (Init, nFormId "cfm_dpp_pdm" pdmenu) hst
# selected = snd pdfun.value
# selectedpaper = allpapernrs!!selected
# mbpaperrefinfo = getPaperInfo selectedpaper accounts
# (RefDiscussion (Refto name)) = (fromJust mbpaperrefinfo).discussion
# (disclist,hst) = mkEditForm (Init, rFormId name (0,Discussion [])) hst
# (ok,newdisc,hst) = mkSubStateForm (if pdfun.changed Set Init, nFormId "cfm_dpp_adddisc" (TS 80 "")) disclist.value
(\s (Discussion l) -> Discussion [(account.login.loginName,toS s):l]) hst
# (disclist,hst) = if ok (mkEditForm (Set, pFormId name newdisc.value) hst) (disclist,hst)
= ( pdfun.form ++ [Br,Hr [], Br] <|.|>
mkdisplay allreports !! selected ++ [Br,Hr [], Br] <|.|>
newdisc.form <|.|> [Br,Hr [], Br]
++ disclist.form,hst)
# (disclist,hst) = universalDB Init (\_ _ -> Ok) name (Discussion []) hst
# (time,date,hst) = getTimeAndDate hst
# (newsubmit,newdiscf,hst)
= mkSubStateForm (if pdfun.changed Set Init, nFormId "cfm_dpp_adddisc" (TS 80 "")) disclist
(\s -> addItemTextInput (account.login.loginName) time date (toS s)) hst
# (_,hst) = if newsubmit (universalDB Set (\_ _ -> Ok) name newdiscf.value hst) (undef,hst)
# (disclistf,hst) = mkEditForm (Set,tdFormId "cfm_show_disc" newdiscf.value) hst
= ( pdfun.form ++ [Br,Hr []] <|.|>
hd (mkdisplay allreports selectedpaper) ++ [Br,Hr [], Br] <|.|>
newdiscf.form <|.|> [Br,Hr []]
++ disclistf.form,hst)
where
toS (TS _ s) = s
addItemTextInput name time date message (Discussion list)
= Discussion [{messageFrom = name, date = date, time = time, message = message}:list]
summarize Nothing = [EmptyBody]
summarize (Just report) = [ toHtml report.recommendation , toHtml report.familiarity]
toS (TS _ s) = s
mkdisplay allrep = [ [mkTable [ [B [] "Paper nr:" , B [] (toString nr)]
, [B [] "Status" , toHtml (paperInfo nr).status]
]
] ++
[mkTable[ [ B [] "Referee: ", Txt (ref.firstName +++ " " +++ ref.lastName)] ++ summarize report
\\ ref <- map fst refs_reports & report <- map snd refs_reports
]
mkdisplay allrep snr = [ [mkTable [ [B [] "Paper nr:" , B [] (toString nr)]
, [B [] "Status" , toHtml (paperInfo nr).status]
]
] ++
[mkTable [ [ B [] "Referee: ", Txt (ref.firstName +++ " " +++ ref.lastName)] ++ summarize report
\\ ref <- map fst refs_reports & report <- map snd refs_reports
]
]
\\ (nr,refs_reports) <- allrep | nr == snr
]
\\ (nr,refs_reports) <- allrep
]
where
paperInfo nr = fromJust (getPaperInfo nr accounts)
where
paperInfo nr = fromJust (getPaperInfo nr accounts)
summarize Nothing = [EmptyBody]
summarize (Just report) = [ toHtml report.recommendation , toHtml report.familiarity]
\ No newline at end of file
......@@ -4,10 +4,10 @@ definition module htmlButtons
import htmlHandler
derive gForm (,), (,,), (,,,), (<->), <|>, HtmlDate, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, HTML
derive gUpd (,), (,,), (,,,), (<->), <|>, HtmlDate, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, HTML
derive gPrint (,), (,,), (,,,), (<->), <|>, HtmlDate, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, HTML
derive gParse (,), (,,), (,,,), (<->), <|>, HtmlDate, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, HTML
derive gForm (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, HTML
derive gUpd (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, HTML
derive gPrint (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, HTML
derive gParse (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, HTML
instance toBool CheckBox, Button, RadioButton // True if checkbox checked, button pressed
instance toInt PullDownMenu // Current index in pull down list
......@@ -44,6 +44,9 @@ instance toString PullDownMenu // Corresponding element in pull down list
// special's
:: HtmlDate = Date Int Int Int // Day Month Year
:: HtmlTime = Time Int Int Int // Hours Minutes Seconds
getTimeAndDate :: !*HSt -> *(!HtmlTime,!HtmlDate,!*HSt)
......
......@@ -4,9 +4,11 @@ import StdEnv, ArgEnv
import htmlHandler, htmlStylelib, htmlTrivial
derive gUpd (,), (,,), (,,,), (<->), <|>, HtmlDate, DisplayMode, /*Button, */CheckBox, RadioButton /*, PullDownMenu, TextInput */, TextArea
derive gPrint (,), (,,), (,,,), (<->), <|>, HtmlDate, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea
derive gParse (,), (,,), (,,,), (<->), <|>, HtmlDate, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea
derive gForm HtmlTime
derive gUpd (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, /*Button, */CheckBox, RadioButton /*, PullDownMenu, TextInput */, TextArea
derive gPrint (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea
derive gParse (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea
:: TextInput = TI Int Int // Input box of size Size for Integers
| TR Int Real // Input box of size Size for Reals
......@@ -263,6 +265,17 @@ where
, fromForm = \_ v -> map_from v
, resetForm = Nothing
} hst
// time and date
import StdTime
getTimeAndDate :: !*HSt -> *(!HtmlTime,!HtmlDate,!*HSt)
getTimeAndDate hst
# (time,hst) = accWorldHSt getCurrentTime hst
# htmltime = Time time.hours time.minutes time.seconds
# (date,hst) = accWorldHSt getCurrentDate hst
# htmldate = Date date.day date.month date.year
= (htmltime,htmldate,hst)
gForm{|TextArea|} (init,formid) hst
# (cntr,hst) = CntrHSt hst
......@@ -312,6 +325,7 @@ gUpd{|TextInput|} (UpdSearch val cnt) i = (UpdSearch val (cnt - 3),i) //
gUpd{|TextInput|} (UpdCreate l) _ = (UpdCreate l,TI defsize 0) // create default value
gUpd{|TextInput|} mode i = (mode,i) // don't change
// small utility stuf
instance toBool RadioButton
......
......@@ -18,7 +18,7 @@ reftoVertListForm :: !Mode !Init !(InIDataId [(Refto a,a)]) !*HSt -> (Form [R
reftoListFormButs :: !Int !Mode !Init !(InIDataId [(Refto a,a)]) !*HSt -> (Form [Refto a],Form [a],!*HSt) | gForm{|*|}, gUpd{|*|}, gPrint{|*|}, gParse{|*|}, TC a
universalDB :: !Init !(String a -> Judgement) !String !a *HSt -> (a,!*HSt) | gForm{|*|}, gUpd{|*|}, gPrint{|*|}, gParse{|*|}, TC a
universalRefEditor :: !Mode !(a -> Judgement) !(Refto a) *HSt -> (Form a,!*HSt) | gForm{|*|}, gUpd{|*|}, gPrint{|*|}, gParse{|*|}, TC a
universalRefEditor :: !Mode !Lifespan !(a -> Judgement) !(Refto a) *HSt -> (Form a,!*HSt) | gForm{|*|}, gUpd{|*|}, gPrint{|*|}, gParse{|*|}, TC a
invokeRefEditor :: (!(InIDataId b) !*HSt -> (Form d,!*HSt)) (InIDataId b) !*HSt -> (Form b,!*HSt)
......@@ -26,6 +26,8 @@ invokeRefEditor :: (!(InIDataId b) !*HSt -> (Form d,!*HSt)) (InIDataId b) !*HSt
:: Judgement :== Maybe (String,String) // id + message
Ok :: Judgement
noException :: Judgement -> Bool
yesException :: Judgement -> Bool
instance + Judgement
......
......@@ -170,15 +170,15 @@ where
// editor for reference to a file
editRefto :: (!Mode,!Init,(!(!Refto a,!a),!!Mode,!Init)) *HSt ->
editRefto :: (!Mode,!Init,(!(!Refto a,!a),!!Mode,!Init,!Lifespan)) *HSt ->
(Form (Refto a),Form a,!*HSt) | gForm{|*|}, gUpd{|*|}, gPrint{|*|}, gParse{|*|}, TC a
editRefto (rmode,rinit,((Refto s,a),pmode,pinit)) hst
editRefto (rmode,rinit,((Refto s,a),pmode,pinit,plifespan)) hst
= reftoEditForm rmode rinit (pinit,
{nFormId ("Refto_" +++ s) (Refto s, a) & mode = pmode}) hst
{nFormId ("Refto_" +++ s) (Refto s, a) & mode = pmode, lifespan = plifespan}) hst
universalRefEditor :: !Mode !(a -> Judgement) !(Refto a) *HSt -> (Form a,!*HSt) | gForm{|*|}, gUpd{|*|}, gPrint{|*|}, gParse{|*|}, TC a
universalRefEditor mode invariant (Refto filename) hst
universalRefEditor :: !Mode !Lifespan !(a -> Judgement) !(Refto a) *HSt -> (Form a,!*HSt) | gForm{|*|}, gUpd{|*|}, gPrint{|*|}, gParse{|*|}, TC a
universalRefEditor mode lifespan invariant (Refto filename) hst
| filename == "" // just temporal
= myEditor Init mode createDefault hst
# (_,dbf,hst) = myDatabase Init 0 createDefault hst // create / read out database file
......@@ -186,7 +186,7 @@ universalRefEditor mode invariant (Refto filename) hst
# dbvalue = snd dbf.value // value stored in database
# (versionf,hst) = myVersion Init dbversion hst // create / read out version number expected by this application
# version = versionf.value // current version number assumed in this application
| mode == Display // we only want to read, no version conflict
| mode <> Edit // we only want to read, no version conflict
# (valuef,hst) = myEditor Set mode dbvalue hst // synchronize with latest value
# (_,hst) = myVersion Set version hst // synchronize version number and
= (valuef,hst) // return current value in editor
......@@ -205,13 +205,13 @@ universalRefEditor mode invariant (Refto filename) hst
# (_,_,hst) = myDatabase Set versionf.value valuef.value hst // update database file
= (valuef,hst)
where
myDatabase Init cnt value hst = editRefto (Display,Init,((Refto filename,(cnt,value)),Display,Init)) hst // read the database
myDatabase Set cnt value hst = editRefto (Edit ,Set, ((Refto filename,(cnt,value)),Display,Init)) hst // write the database
myDatabase Init cnt value hst = editRefto (Display,Init,((Refto filename,(cnt,value)),Display,Init,lifespan)) hst // read the database
myDatabase Set cnt value hst = editRefto (Edit ,Set, ((Refto filename,(cnt,value)),Display,Init,lifespan)) hst // write the database
myVersion init cnt hst = mkEditForm (init,sdFormId ("vrs_" +++ filename) cnt) hst // to remember version number
myEditor :: !Init !Mode !a *HSt -> (Form a,!*HSt) | gForm{|*|}, gUpd{|*|}, gPrint{|*|}, gParse{|*|}, TC a
myEditor init mode value hst = mkEditForm (init,{sFormId ("copy_" +++ filename) value & mode = mode}) hst // to remember version number
myEditor init mode value hst = mkEditForm (init,{nFormId ("copy_" +++ filename) value & mode = mode, lifespan = lifespan}) hst // to remember version number
invokeRefEditor :: (!(InIDataId b) !*HSt -> (Form d,!*HSt)) (InIDataId b) !*HSt -> (Form b,!*HSt)
......@@ -224,6 +224,13 @@ invokeRefEditor editor (init,formid) hst
Ok :: Judgement
Ok = Nothing
noException :: Judgement -> Bool
noException Nothing = True
noException _ = False
yesException :: Judgement -> Bool
yesException judgement = not (noException judgement)
instance + Judgement
where
(+) j1 j2 = addJudgement j1 j2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment