Class: CPEE::Worklist::ShowUserTasks
- Inherits:
-
Riddl:: Implementation
- Object
- Riddl:: Implementation
- CPEE::Worklist::ShowUserTasks
- Defined in:
- lib/cpee-worklist/implementation.rb
Overview
}}}
Instance Method Summary collapse
-
#response ⇒ Object
{{{.
Instance Method Details
#response ⇒ Object
{{{
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/cpee-worklist/implementation.rb', line 213 def response out = XML::Smart.string('<tasks/>') tasks = {} @a[0].orgmodels.each do |e| XML::Smart.open(File.join(@a[0].opts[:top],'orgmodels',e)) do |doc| doc.register_namespace 'o', 'http://cpee.org/ns/organisation/1.0' doc.find("/o:organisation/o:subjects/o:subject[@uid='#{@r[-2]}']/o:relation").each do |rel| @a[0].activities.each do |activity| restrict = false activity['restrictions'].each do |restriction| restrict = true if restriction['restriction']['mode'] == 'prohibit' && restriction['restriction']['id'] == @r[-2] end if ( activity['role']=='*' || activity['role'].casecmp(rel.attributes['role']) == 0 ) && ( activity['unit'] == '*' || activity['unit'].casecmp(rel.attributes['unit']) == 0 ) && ( activity['collect'] || activity['user'].empty? || activity['user'].include?(@r[-2]) ) && !restrict tasks["#{activity['id']}"] = { :all => activity.has_key?('collect') && !activity['collect'].nil?, :uid => @r[-2], :priority => activity['priority'], :label => activity['process'] + ': ' + activity['label'] } tasks["#{activity['id']}"][:own] = activity['user'].include?(@r[-2]) tasks["#{activity['id']}"][:deadline] = activity['deadline'] if activity['deadline'] end end end end end tasks.sort_by{ |k,e| e[:priority] }.each{|k,v| out.root.add("task", v.merge(:id => k))} x = Riddl::Parameter::Complex.new("return","text/xml") do out.to_s end x end |