Commit 55b5934d authored by Jurriën Stutterheim's avatar Jurriën Stutterheim

Make examples work with latest API


git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@2883 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 1c837b65
This diff is collapsed.
implementation module BasicAPIExamples
import iTasks, iTasks.API.Extensions.Admin.UserAdmin, iTasks.API.Extensions.Admin.WorkflowAdmin
import iTasks.API.Extensions.GIS.GoogleMap
import Text
import Text, StdArray
import ligrettoTOP
/**
......@@ -208,7 +208,7 @@ where
noteE state
= updateSharedInformation ("Text","Edit text") [noteEditor] state
>>* [ OnAction (Action "Trim" []) (\txt -> Just (update trim state >>| noteE state))
>>* [ OnAction (Action "Trim" []) (\txt -> Just (upd trim state >>| noteE state))
]
lineE state
......@@ -281,12 +281,12 @@ where
append (i,_)
= enterInformation "Add new item" []
>>= \n -> update (\ps -> let (begin,end) = splitAt (i+1) ps in (begin ++ [n] ++ end)) store
>>= \n -> upd (\ps -> let (begin,end) = splitAt (i+1) ps in (begin ++ [n] ++ end)) store
delete (i,_)
= update (\ps -> removeAt i ps) store
= upd (\ps -> removeAt i ps) store
edit (i,p)
= updateInformation "Edit item" [] p
>>= \p -> update (\ps -> updateAt i p ps) store
>>= \p -> upd (\ps -> updateAt i p ps) store
//
......@@ -332,7 +332,7 @@ where
commit :: String -> Task Void
commit message
= update (\tweets -> [(tweeter,message)] ++ tweets) tweetsStore
= upd (\tweets -> [(tweeter,message)] ++ tweets) tweetsStore
>>| tweeting
......@@ -504,7 +504,7 @@ where
, OnAction (Action "Cancel" []) (always (noReplace cmnd))
]
substitute cmnd = update (replaceSubString cmnd.search cmnd.replaceBy) sharedFile
substitute cmnd = upd (replaceSubString cmnd.search cmnd.replaceBy) sharedFile
>>| showReplace cmnd
......
This diff is collapsed.
implementation module ligrettoTOP
import StdArray
import ligretto
import iTasks
......@@ -183,7 +184,7 @@ play_card nr_of_players player cardnr (Value (me,middle) _)
| cardnr > length me.row= Nothing
| isEmpty matching_piles= Nothing
| otherwise = let (pilenr,pile) = hd matching_piles in
Just (update (updateAt pilenr [card : pile]) middle_state
Just (upd (updateAt pilenr [card : pile]) middle_state
>>| set (move_ligretto_card_to_row cardnr me) (player_state player.color)
>>| play_cards nr_of_players player
)
......@@ -197,7 +198,7 @@ play_hand nr_of_players player (Value (me,middle) _)
| isNothing maybe_card = Nothing
| isEmpty matching_piles= Nothing
| otherwise = let (pilenr,pile) = hd matching_piles in
Just (update (updateAt pilenr [card : pile]) middle_state
Just (upd (updateAt pilenr [card : pile]) middle_state
>>| set (remove_top_of_discard me) (player_state player.color)
>>| play_cards nr_of_players player
)
......
......@@ -4,7 +4,6 @@ import iTasks
import iTasks.API.Core.Client.Editlet
import iTasks.API.Core.Client.Interface
import iTasks.API.Extensions.CodeMirror
import iTasks.API.Extensions.Tonic.Toniclet
import iTasks.API.Extensions.GIS.Leaflet
import StdDebug
......@@ -239,6 +238,22 @@ defcm = { configuration = [CMMode "javascript", CMLineNumbers True]
//test5 = updateInformation "CodeMirror" [] (codeMirrorEditlet "buu")
import iTasks.API.Extensions.Graphlet.Graphlet
import iTasks.API.Extensions.Graphlet.GraphvizRenderer
import Data.Graph
testGraphlet = viewInformation "Graphlet with Graphviz rendering" [] (graphlet mkTestGraph graphvizRenderer)
where
mkTestGraph
# g = emptyGraph
# (ni1, g) = addNode (GSBoxShape (Just "This is a box!")) g
# (ni2, g) = addNode (GSPlainText "Just words") g
# (ni3, g) = addNode (GSDiamond Nothing) g
# g = addEdge (Just "From box") (ni1, ni2) g
# g = addEdge (Just "To words") (ni2, ni3) g
# g = addEdge Nothing (ni3, ni1) g
= g
test5 :: Task CodeMirror
test5 = withShared defcm (\defcm -> updateSharedInformation "CodeMirror Settings" [] defcm
-||
......@@ -268,6 +283,6 @@ test = updateInformation "String" [] stringlet @ (\(Editlet value _ _) -> value)
//test7 = enterInformation "Test" []
Start :: *World -> *World
Start world = startEngine test5 world
Start world = startEngine testGraphlet world
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