Commit 57d44e48 authored by Peter Achten's avatar Peter Achten
Browse files

minor, stylistic modifications

parent 3fc65291
......@@ -8,7 +8,7 @@ import StdListExtensions
// global account database editor
AccountsDB :: !Init !ConfAccounts *HSt -> (ConfAccounts,!*HSt) // conf management database
AccountsDB :: !Init !ConfAccounts *HSt -> (ConfAccounts,!*HSt) // conf management database
AccountsDB init accounts hst
# accounts = setInvariantAccounts accounts // ensure that all links are correct
= universalDB init (\s a -> invariantLogAccounts s a + invariantConfAccounts s a)
......@@ -60,69 +60,65 @@ where
editorRefPerson :: !(InIDataId RefPerson) !*HSt -> (Form Person,!*HSt)
editorRefPerson (init,formid) hst
# (RefPerson refperson) = formid.ival
# (Ref2 name) = refperson
# (dereff,hst) = universalRefEditor (init,reuseFormId formid refperson) (invariantPerson name) hst
= ({dereff & value = dereff.value},hst) // PA: huh? {dereff & value = dereff.value} = dereff
# (RefPerson refperson) = formid.ival
# (Ref2 name) = refperson
= universalRefEditor (init,reuseFormId formid refperson) (invariantPerson name) hst
editorRefPaper :: !(InIDataId RefPaper) !*HSt -> (Form Paper,!*HSt)
editorRefPaper (init,formid) hst
# (RefPaper refpaper) = formid.ival
# (Ref2 name) = refpaper
# (dereff,hst) = universalRefEditor (init,reuseFormId formid refpaper) (invariantPaper name) hst
= ({dereff & value = dereff.value},hst)
# (RefPaper refpaper) = formid.ival
# (Ref2 name) = refpaper
= universalRefEditor (init,reuseFormId formid refpaper) (invariantPaper name) hst
editorRefReport :: !(InIDataId RefReport) !*HSt -> (Form (Maybe Report),!*HSt)
editorRefReport (init,formid) hst
# (RefReport refreport) = formid.ival
# (Ref2 name) = refreport
# (dereff,hst) = universalRefEditor (init,reuseFormId formid refreport) (invariant name) hst
= ({dereff & value = dereff.value},hst)
# (RefReport refreport) = formid.ival
# (Ref2 name) = refreport
= universalRefEditor (init,reuseFormId formid refreport) (invariant name) hst
where
invariant name Nothing = Ok
invariant name (Just report) = invariantReport name report
invariant name Nothing = Ok
invariant name (Just report) = invariantReport name report
editorRefDiscussion :: !(InIDataId RefDiscussion) !*HSt -> (Form Discussion,!*HSt)
editorRefDiscussion (init,formid) hst
# (RefDiscussion refdiscus) = formid.ival
# (Ref2 name) = refdiscus
# (dereff,hst) = universalRefEditor (init,reuseFormId formid refdiscus) (\_ -> Ok) hst
= ({dereff & value = dereff.value},hst)
# (RefDiscussion refdiscus) = formid.ival
# (Ref2 name) = refdiscus
= universalRefEditor (init,reuseFormId formid refdiscus) (const Ok) hst
// specialized idata forms
gForm {|RefPerson|} iniformid hst = specialize (invokeRefEditor editorRefPerson) iniformid hst
gForm {|RefPaper|} iniformid hst = specialize (invokeRefEditor editorRefPaper) iniformid hst
gForm {|RefReport|} iniformid hst = specialize (invokeRefEditor editorRefReport) iniformid hst
gForm {|RefPerson|} iniformid hst = specialize (invokeRefEditor editorRefPerson) iniformid hst
gForm {|RefPaper|} iniformid hst = specialize (invokeRefEditor editorRefPaper) iniformid hst
gForm {|RefReport|} iniformid hst = specialize (invokeRefEditor editorRefReport) iniformid hst
gForm {|RefDiscussion|} iniformid hst = specialize (invokeRefEditor editorRefDiscussion) iniformid hst
gForm {|Reports|} informid hst = specialize myeditor informid hst
gForm {|Reports|} informid hst = specialize myeditor informid hst
where
myeditor (init,formid) hst
# (Reports reports) = formid.ival
# (reportsf,hst) = vertlistFormButs 10 True (init,subsFormId formid "report" reports) hst
# (Reports reports) = formid.ival
# (reportsf,hst) = vertlistFormButs 10 True (init,subsFormId formid "report" reports) hst
= ({reportsf & value = Reports reportsf.value},hst)
gForm {|Conflicts|} informid hst = specialize myeditor informid hst
gForm {|Conflicts|} informid hst = specialize myeditor informid hst
where
myeditor (init,formid) hst
# (Conflicts papernrs) = formid.ival
# (papersf,hst) = vertlistFormButs 10 True (init,subsFormId formid "conflict" papernrs) hst
# (Conflicts papernrs) = formid.ival
# (papersf,hst) = vertlistFormButs 10 True (init,subsFormId formid "conflict" papernrs) hst
= ({papersf & value = Conflicts papersf.value},hst)
gForm {|Co_authors|} informid hst = specialize myeditor informid hst
gForm {|Co_authors|} informid hst = specialize myeditor informid hst
where
myeditor (init,formid) hst
# (Co_authors authors) = formid.ival
# (authorsf,hst) = vertlistFormButs 10 True (init,subsFormId formid "authors" authors) hst
# (Co_authors authors) = formid.ival
# (authorsf,hst) = vertlistFormButs 10 True (init,subsFormId formid "authors" authors) hst
= ({authorsf & value = Co_authors authorsf.value},hst)
gForm {|Discussion|} informid hst = specialize myeditor informid hst
gForm {|Discussion|} informid hst = specialize myeditor informid hst
where
myeditor (init,formid) hst
# (Discussion messages) = formid.ival
= ({changed = False, form = showDiscussion messages, value = formid.ival},hst)
# (Discussion messages) = formid.ival
= ({changed = False, form = showDiscussion messages, value = formid.ival},hst)
where
showDiscussion [] = []
showDiscussion [{messageFrom,date,time,message}:more]
......
......@@ -52,7 +52,7 @@ import StdMaybe, StdBool
}
:: InIDataId d // Often used combination
:== !(Init,FormId d)
:== (Init,FormId d)
// **** easy creation of FormId's ****
......
......@@ -5,10 +5,10 @@ import StdMaybe, StdBool, StdString, StdInt
// utility for creating FormId's
pFormId :: !String !d -> (FormId d) // persitent formid
pFormId :: !String !d -> (FormId d) // persistent formid
pFormId s d = {id = s, lifespan = Persistent, mode = Edit, storage = PlainString, ival = d}
rFormId :: !String !d -> (FormId d) // persitent formid
rFormId :: !String !d -> (FormId d) // persistent formid
rFormId s d = {id = s, lifespan = PersistentRO, mode = Edit, storage = PlainString, ival = d}
sFormId :: !String !d -> (FormId d) // session formid
......@@ -17,19 +17,19 @@ sFormId s d = {id = s, lifespan = Session, mode = Edit, storage = PlainString, i
nFormId :: !String !d -> (FormId d) // page formid
nFormId s d = {id = s, lifespan = Page, mode = Edit, storage = PlainString, ival = d}
xtFormId :: !String !d -> (FormId d) // persitent formid
xtFormId :: !String !d -> (FormId d) // persistent formid
xtFormId s d = {id = s, lifespan = Temp, mode = NoForm, storage = PlainString, ival = d}
tFormId :: !String !d -> (FormId d) // persitent formid
tFormId :: !String !d -> (FormId d) // persistent formid
tFormId s d = {id = s, lifespan = Temp, mode = Edit, storage = PlainString, ival = d}
tdFormId :: !String !d -> (FormId d) // persitent formid
tdFormId :: !String !d -> (FormId d) // persistent formid
tdFormId s d = {id = s, lifespan = Temp, mode = Display, storage = PlainString, ival = d}
xpFormId :: !String !d -> (FormId d) // persitent formid
xpFormId :: !String !d -> (FormId d) // persistent formid
xpFormId s d = {id = s, lifespan = Persistent, mode = NoForm, storage = PlainString, ival = d}
xrFormId :: !String !d -> (FormId d) // persitent formid
xrFormId :: !String !d -> (FormId d) // persistent formid
xrFormId s d = {id = s, lifespan = PersistentRO, mode = NoForm, storage = PlainString, ival = d}
xsFormId :: !String !d -> (FormId d) // session formid
......@@ -38,10 +38,10 @@ xsFormId s d = {id = s, lifespan = Session, mode = NoForm, storage = PlainString
xnFormId :: !String !d -> (FormId d) // page formid
xnFormId s d = {id = s, lifespan = Page, mode = NoForm, storage = PlainString, ival = d}
pdFormId :: !String !d -> (FormId d) // persitent formid
pdFormId :: !String !d -> (FormId d) // persistent formid
pdFormId s d = {id = s, lifespan = Persistent, mode = Display, storage = PlainString, ival = d}
rdFormId :: !String !d -> (FormId d) // persitent formid
rdFormId :: !String !d -> (FormId d) // persistent formid
rdFormId s d = {id = s, lifespan = PersistentRO, mode = Display, storage = PlainString, ival = d}
sdFormId :: !String !d -> (FormId d) // session formid
......@@ -52,10 +52,10 @@ ndFormId s d = {id = s, lifespan = Page, mode = Display, storage = PlainString,
// store info as a dynamic
pDFormId :: !String !d -> (FormId d) // persitent formid
pDFormId :: !String !d -> (FormId d) // persistent formid
pDFormId s d = {id = s, lifespan = Persistent, mode = Edit, storage = StaticDynamic, ival = d}
rDFormId :: !String !d -> (FormId d) // persitent formid
rDFormId :: !String !d -> (FormId d) // persistent formid
rDFormId s d = {id = s, lifespan = PersistentRO, mode = Edit, storage = StaticDynamic, ival = d}
sDFormId :: !String !d -> (FormId d) // session formid
......@@ -64,10 +64,10 @@ sDFormId s d = {id = s, lifespan = Session, mode = Edit, storage = StaticDynamic
nDFormId :: !String !d -> (FormId d) // page formid
nDFormId s d = {id = s, lifespan = Page, mode = Edit, storage = StaticDynamic, ival = d}
pdDFormId :: !String !d -> (FormId d) // persitent formid
pdDFormId :: !String !d -> (FormId d) // persistent formid
pdDFormId s d = {id = s, lifespan = Persistent, mode = Display, storage = StaticDynamic, ival = d}
rdDFormId :: !String !d -> (FormId d) // persitent formid
rdDFormId :: !String !d -> (FormId d) // persistent formid
rdDFormId s d = {id = s, lifespan = PersistentRO, mode = Display, storage = StaticDynamic, ival = d}
sdDFormId :: !String !d -> (FormId d) // session formid
......@@ -84,19 +84,19 @@ ndDFormId s d = {id = s, lifespan = Page, mode = Display, storage = StaticDynami
extidFormId :: !(FormId d) !String -> (FormId d)
extidFormId formid s = {formid & id = formid.id ++/ s}
subFormId :: !(FormId a) !String !d -> (FormId d) // make new formid of new type coping other old settinf
subFormId :: !(FormId a) !String !d -> (FormId d) // make new formid of new type copying other old settinf
subFormId formid s d = {formid & id = formid.id ++/ s, ival = d}
subnFormId :: !(FormId a) !String !d -> (FormId d) // make new formid of new type coping other old settinf
subnFormId :: !(FormId a) !String !d -> (FormId d) // make new formid of new type copying other old settinf
subnFormId formid s d = {formid & id = formid.id ++/ s, ival = d, lifespan = Page}
subsFormId :: !(FormId a) !String !d -> (FormId d) // make new formid of new type coping other old settinf
subsFormId :: !(FormId a) !String !d -> (FormId d) // make new formid of new type copying other old settinf
subsFormId formid s d = {formid & id = formid.id ++/ s, ival = d, lifespan = Session}
subpFormId :: !(FormId a) !String !d -> (FormId d) // make new formid of new type coping other old settinf
subpFormId :: !(FormId a) !String !d -> (FormId d) // make new formid of new type copying other old settinf
subpFormId formid s d = {formid & id = formid.id ++/ s, ival = d, lifespan = Persistent}
subtFormId :: !(FormId a) !String !d -> (FormId d) // make new formid of new type coping other old settinf
subtFormId :: !(FormId a) !String !d -> (FormId d) // make new formid of new type copying other old settinf
subtFormId formid s d = {formid & id = formid.id ++/ s, ival = d, lifespan = Temp}
setFormId :: !(FormId d) !d -> (FormId d) // set new initial value in formid
......@@ -163,5 +163,3 @@ where
toInt Session = 2
toInt PersistentRO = 3
toInt Persistent = 4
......@@ -105,11 +105,10 @@ where
Ok :: Judgement
Ok = Nothing
noException :: Judgement -> Bool
noException Nothing = True
noException _ = False
noException :: Judgement -> Bool
noException judgement = isNothing judgement
yesException :: Judgement -> Bool
yesException :: Judgement -> Bool
yesException judgement = not (noException judgement)
instance + Judgement
......@@ -117,8 +116,8 @@ where
(+) j1 j2 = addJudgement j1 j2
where
// addJudgement (Just (r1,j1)) (Just (r2,j2)) = (Just ((r1 +++ " " +++ r2),(j1 +++ " " +++ j2))) //for debugging
addJudgement (Just j1) _ = (Just j1)
addJudgement _ (Just j2) = (Just j2)
addJudgement (Just j1) _ = Just j1
addJudgement _ (Just j2) = Just j2
addJudgement _ _ = Nothing
ExceptionStore :: (Judgement -> Judgement) !*HSt -> (Judgement,!*HSt)
......
Supports Markdown
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