The main task is to work on documents which go through some specific workflow which is represented by a lucid graph (diagram). We need document versioning, different roles & permissions and most importantly we need to let the users create the workflow graphs (with all those guard conditions for transitions, mail notifications, calendar events and stuff).
I've seen some solutions none of which fulfill the last requirement. Any web-based open source solution is much appreciated.