public
Description: RESTful workflow / bpm engine based on Sinatra and OpenWFEru
Homepage: http://openwferu.rubyforge.org
Clone URL: git://github.com/jmettraux/ruote-rest.git
Search Repo:
dots in participants 'ids' are now ok
jmettraux (author)
Tue May 06 16:34:37 -0700 2008
commit  f9d1dab47b17613a679f9c654b46a939b86bc3ef
tree    8c6985a8517265ee5818dee5763ff689fe0e7219
parent  27c80d71877a0a3157e25228301dd09b570c1369
...
5
6
7
 
 
 
...
5
6
7
8
9
10
0
@@ -5,4 +5,7 @@
0
 - - bravo
0
   - OpenWFE::Extras::ActiveParticipant
0
   -
0
+- - .*
0
+ - OpenWFE::Extras::ActiveParticipant
0
+ -
...
37
38
39
 
40
41
42
43
44
45
46
47
48
49
50
51
52
 
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
55
56
57
58
59
 
 
 
 
 
 
 
 
 
 
 
60
61
62
63
64
65
66
67
68
...
37
38
39
40
41
 
 
 
 
 
 
 
 
42
 
 
 
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
 
 
 
 
 
80
81
82
83
84
85
86
87
88
89
90
91
 
 
 
 
 
 
 
92
0
@@ -37,33 +37,57 @@
0
 # John Mettraux at openwfe.org
0
 #
0
 
0
+require 'cgi'
0
 
0
-#
0
-# swap from dots to underscores
0
-#
0
-# swapdots "0_0_1" # => "0.0.1"
0
-#
0
-# swapdots "0.0.1" # => "0_0_1"
0
-#
0
-def swapdots (s)
0
 
0
- return s.gsub(/\./, '_') if s.index(".")
0
- s.gsub(/\_/, '.')
0
-end
0
+helpers do
0
 
0
+ #
0
+ # swap from dots to underscores
0
+ #
0
+ # swapdots "0_0_1" # => "0.0.1"
0
+ #
0
+ # swapdots "0.0.1" # => "0_0_1"
0
+ #
0
+ def swapdots (s)
0
+
0
+ return s.gsub(/\./, '_') if s.index(".")
0
+ s.gsub(/\_/, '.')
0
+ end
0
+
0
+
0
+ #
0
+ # render_time(workitem, :dispatch_time)
0
+ # # => Sat Mar 1 20:29:44 2008 (1d16h18m)
0
+ #
0
+ def display_time (object, accessor)
0
+
0
+ t = object.send accessor
0
+
0
+ return "" unless t
0
+
0
+ d = Time.now - t
0
+
0
+ "#{t.ctime} (#{Rufus::to_duration_string(d, :drop_seconds => true)})"
0
+ end
0
+
0
+ #
0
+ # Basically, it's CGI escape(), but it makes sure that dots '.' are escaped
0
+ # as well.
0
+ #
0
+ def uri_escape (s)
0
 
0
-#
0
-# render_time(workitem, :dispatch_time)
0
-# # => Sat Mar 1 20:29:44 2008 (1d16h18m)
0
-#
0
-def display_time (object, accessor)
0
+ CGI.escape(s).gsub(/\./, '%2E')
0
+ end
0
+
0
+ #--
0
+ # Basically, it's CGI escape(), but it makes sure that dots '.' are escaped
0
+ # as well.
0
+ #
0
+ #def uri_unescape (s)
0
+ # CGI.unescape s
0
+ #end
0
+ #++
0
 
0
- t = object.send accessor
0
-
0
- return "" unless t
0
-
0
- d = Time.now - t
0
-
0
- "#{t.ctime} (#{Rufus::to_duration_string(d, :drop_seconds => true)})"
0
 end
...
37
38
39
40
41
42
43
44
...
37
38
39
 
 
40
41
42
0
@@ -37,8 +37,6 @@
0
 # John Mettraux at openwfe.org
0
 #
0
 
0
-require 'cgi' # for CGI.escape()
0
-
0
 require 'openwfe/worklist/storeparticipant'
0
 require 'openwfe/extras/participants/activeparticipants'
0
 
...
101
102
103
104
 
105
106
107
...
101
102
103
 
104
105
106
107
0
@@ -101,7 +101,7 @@
0
 
0
         opts = {
0
             :link =>
0
- request.link(:participants, CGI.escape(regex.original_string)) }
0
+ request.link(:participants, uri_escape(regex.original_string)) }
0
 
0
         xml.participant opts do
0
             xml.regex regex.original_string
...
79
80
81
82
 
83
84
85
...
79
80
81
 
82
83
84
85
0
@@ -79,7 +79,7 @@
0
 
0
         if pid
0
 
0
- #pid = CGI.unescape(pid))
0
+ #pid = CGI.unescape(pid) # no need :)
0
 
0
             regex, part = $engine.list_participants.find do |pr, pa|
0
                 pr.original_string == pid
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 
0
 <%
0
     regex, part = @participant
0
- link = "/participants/#{CGI.escape regex.original_string}"
0
+ link = "/participants/#{uri_escape regex.original_string}"
0
 %>
0
 <div class="participant">
0
 

Comments

    No one has commented yet.