lib/openwfe/participants/atomparticipants.rb in openwferu-0.9.2 vs lib/openwfe/participants/atomparticipants.rb in openwferu-0.9.3

- old
+ new

@@ -50,30 +50,54 @@ require 'monitor' require 'rubygems' require 'atom/collection' -require 'openwfe/participants/participants' +require 'openwfe/participants/participant' module OpenWFE # # Stores the incoming workitem into an 'atom feed' # # An example : - # <tt> + # # feed0 = AtomParticipant.new( - # 20, + # 20, # no more than 20 entries are kept # """ # <p> # <h1>${f:colour}</h1> # </p> - # """) - # </tt> + # """) # the template for each entry # - class AtomParticipant < LocalParticipant - include MonitorMixin + # The template can be passed as the second parameter (after the max entry + # count) or as a block : + # + # feed1 = AtomParticipant.new(20) do |flow_expression, atom_participant, workitem| + # # + # # usually only the workitem parameter is used + # # but the other two allow for advanced tricks... + # + # atom_participant.content_type = "xml" + # # by default, it's "xhtml" + # + # s = "<task>" + # s << "<name>#{workitem.task_name}</name>" + # s << "<assignee>#{workitem.task_assignee}</assignee>" + # s << "<duedate>#{workitem.task_duedate}</duedate>" + # s << "</task>" + # + # # the block is supposed to 'return' a string which is the + # # effective template + # end + # + # This participant uses + # "atom-tools" from http://code.necronomicorp.com/trac/atom-tools + # + # + class AtomParticipant + include LocalParticipant, MonitorMixin attr_accessor \ :content_type # blocks may manipulate them def initialize (max_item_count, template=nil, &block)