sws 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. data/doc/DOC.otl +34 -0
  2. data/doc/Makefile +13 -0
  3. data/doc/architecture.dia +0 -0
  4. data/doc/docbook/architecture.png +0 -0
  5. data/doc/docbook/concepts.docbook +474 -0
  6. data/doc/docbook/installation.docbook +57 -0
  7. data/doc/docbook/introduction.docbook +130 -0
  8. data/doc/docbook/sws_manual.docbook +35 -0
  9. data/doc/docbook/todo.docbook +38 -0
  10. data/doc/docbook/tutorial.docbook +594 -0
  11. data/examples/README +1 -0
  12. data/examples/addressbook/CardBrowse/CardBrowse.html +43 -0
  13. data/examples/addressbook/CardBrowse/CardBrowse.rb +65 -0
  14. data/examples/addressbook/CardBrowse/CardBrowse.sws +92 -0
  15. data/examples/addressbook/Login/LoginPage.html +12 -0
  16. data/examples/addressbook/Login/LoginPage.rb +19 -0
  17. data/examples/addressbook/Login/LoginPage.sws +15 -0
  18. data/examples/addressbook/README +1 -0
  19. data/examples/addressbook/addressbook.rb +70 -0
  20. data/examples/addressbook/application.yaml +8 -0
  21. data/examples/addressbook/db.yaml +7 -0
  22. data/examples/component_demo/CheckBoxDemo/CheckBoxDemo.html +11 -0
  23. data/examples/component_demo/CheckBoxDemo/CheckBoxDemo.rb +21 -0
  24. data/examples/component_demo/CheckBoxDemo/CheckBoxDemo.sws +25 -0
  25. data/examples/component_demo/ComponentDemo.rb +21 -0
  26. data/examples/component_demo/ConditionalDemo/ConditionalDemo.html +18 -0
  27. data/examples/component_demo/ConditionalDemo/ConditionalDemo.rb +2 -0
  28. data/examples/component_demo/ConditionalDemo/ConditionalDemo.sws +22 -0
  29. data/examples/component_demo/FileUploadDemo/FileUploadDemo.html +10 -0
  30. data/examples/component_demo/FileUploadDemo/FileUploadDemo.rb +9 -0
  31. data/examples/component_demo/FileUploadDemo/FileUploadDemo.sws +33 -0
  32. data/examples/component_demo/FormFieldsDemo/FormFieldsDemo.html +12 -0
  33. data/examples/component_demo/FormFieldsDemo/FormFieldsDemo.rb +21 -0
  34. data/examples/component_demo/FormFieldsDemo/FormFieldsDemo.sws +40 -0
  35. data/examples/component_demo/FormListsDemo/FormListsDemo.html +11 -0
  36. data/examples/component_demo/FormListsDemo/FormListsDemo.rb +37 -0
  37. data/examples/component_demo/FormListsDemo/FormListsDemo.sws +47 -0
  38. data/examples/component_demo/GenericDemo/GenericDemo.html +4 -0
  39. data/examples/component_demo/GenericDemo/GenericDemo.rb +2 -0
  40. data/examples/component_demo/GenericDemo/GenericDemo.sws +10 -0
  41. data/examples/component_demo/HyperlinkDemo/HyperlinkDemo.html +8 -0
  42. data/examples/component_demo/HyperlinkDemo/HyperlinkDemo.rb +20 -0
  43. data/examples/component_demo/HyperlinkDemo/HyperlinkDemo.sws +19 -0
  44. data/examples/component_demo/ImageLinkDemo/ImageLinkDemo.html +11 -0
  45. data/examples/component_demo/ImageLinkDemo/ImageLinkDemo.rb +2 -0
  46. data/examples/component_demo/ImageLinkDemo/ImageLinkDemo.sws +14 -0
  47. data/examples/component_demo/PageWrapper/PageWrapper.html +23 -0
  48. data/examples/component_demo/PageWrapper/PageWrapper.rb +2 -0
  49. data/examples/component_demo/PageWrapper/PageWrapper.sws +42 -0
  50. data/examples/component_demo/README +1 -0
  51. data/examples/component_demo/RepetitionDemo/RepetitionDemo.html +13 -0
  52. data/examples/component_demo/RepetitionDemo/RepetitionDemo.rb +19 -0
  53. data/examples/component_demo/RepetitionDemo/RepetitionDemo.sws +20 -0
  54. data/examples/component_demo/StringDemo/StringDemo.html +5 -0
  55. data/examples/component_demo/StringDemo/StringDemo.rb +16 -0
  56. data/examples/component_demo/StringDemo/StringDemo.sws +14 -0
  57. data/examples/component_demo/application.yaml +28 -0
  58. data/examples/component_demo/poweredby.jpg +0 -0
  59. data/examples/component_demo/style.css +1 -0
  60. data/examples/movies/Menu/Menu.html +3 -0
  61. data/examples/movies/Menu/Menu.rb +7 -0
  62. data/examples/movies/Menu/Menu.sws +7 -0
  63. data/examples/movies/MovieBrowse/MovieBrowse.html +68 -0
  64. data/examples/movies/MovieBrowse/MovieBrowse.rb +178 -0
  65. data/examples/movies/MovieBrowse/MovieBrowse.sws +127 -0
  66. data/examples/movies/README +1 -0
  67. data/examples/movies/UserBrowse/UserBrowse.html +50 -0
  68. data/examples/movies/UserBrowse/UserBrowse.rb +69 -0
  69. data/examples/movies/UserBrowse/UserBrowse.sws +49 -0
  70. data/examples/movies/application.yaml +11 -0
  71. data/examples/movies/da.rb +36 -0
  72. data/examples/movies/dbmovies.rb +44 -0
  73. data/examples/movies/frameworks/TestFramework/framework.yaml +4 -0
  74. data/examples/movies/frameworks/TestFramework/resources/im1.jpg +0 -0
  75. data/examples/movies/images/pbr1b.jpg +0 -0
  76. data/examples/movies/movies.rb +28 -0
  77. data/examples/movies/movies.sds +119 -0
  78. data/examples/movies/movies.sqlite +0 -0
  79. data/examples/movies/movies_mysql.sql +28 -0
  80. data/examples/movies/movies_postgres.sql +27 -0
  81. data/examples/movies/movies_sqlite.sql +28 -0
  82. data/lib/sws.rb +89 -0
  83. data/lib/sws/Core/components/CheckBox/CheckBox.api +5 -0
  84. data/lib/sws/Core/components/CheckBox/CheckBox.rb +45 -0
  85. data/lib/sws/Core/components/CheckBoxList/CheckBoxList.api +13 -0
  86. data/lib/sws/Core/components/CheckBoxList/CheckBoxList.rb +54 -0
  87. data/lib/sws/Core/components/Conditional/Conditional.api +3 -0
  88. data/lib/sws/Core/components/Conditional/Conditional.html +1 -0
  89. data/lib/sws/Core/components/Conditional/Conditional.rb +39 -0
  90. data/lib/sws/Core/components/Conditional/Conditional.sws +2 -0
  91. data/lib/sws/Core/components/Content/Content.rb +18 -0
  92. data/lib/sws/Core/components/ExceptionPage/ExceptionPage.html +13 -0
  93. data/lib/sws/Core/components/ExceptionPage/ExceptionPage.rb +18 -0
  94. data/lib/sws/Core/components/ExceptionPage/ExceptionPage.sws +16 -0
  95. data/lib/sws/Core/components/FileUpload/FileUpload.api +16 -0
  96. data/lib/sws/Core/components/FileUpload/FileUpload.rb +62 -0
  97. data/lib/sws/Core/components/Form/Form.api +9 -0
  98. data/lib/sws/Core/components/Form/Form.html +3 -0
  99. data/lib/sws/Core/components/Form/Form.rb +55 -0
  100. data/lib/sws/Core/components/Form/Form.sws +12 -0
  101. data/lib/sws/Core/components/GenericContainer/GenericContainer.api +10 -0
  102. data/lib/sws/Core/components/GenericContainer/GenericContainer.html +1 -0
  103. data/lib/sws/Core/components/GenericContainer/GenericContainer.rb +39 -0
  104. data/lib/sws/Core/components/GenericContainer/GenericContainer.sws +12 -0
  105. data/lib/sws/Core/components/GenericElement/GenericElement.api +10 -0
  106. data/lib/sws/Core/components/GenericElement/GenericElement.rb +34 -0
  107. data/lib/sws/Core/components/HiddenField/HiddenField.api +7 -0
  108. data/lib/sws/Core/components/HiddenField/HiddenField.rb +37 -0
  109. data/lib/sws/Core/components/Hyperlink/Hyperlink.api +13 -0
  110. data/lib/sws/Core/components/Hyperlink/Hyperlink.html +1 -0
  111. data/lib/sws/Core/components/Hyperlink/Hyperlink.rb +102 -0
  112. data/lib/sws/Core/components/Hyperlink/Hyperlink.sws +12 -0
  113. data/lib/sws/Core/components/Image/Image.api +11 -0
  114. data/lib/sws/Core/components/Image/Image.rb +49 -0
  115. data/lib/sws/Core/components/ImageButton/ImageButton.api +16 -0
  116. data/lib/sws/Core/components/ImageButton/ImageButton.rb +76 -0
  117. data/lib/sws/Core/components/Link/Link.api +11 -0
  118. data/lib/sws/Core/components/Link/Link.rb +39 -0
  119. data/lib/sws/Core/components/PasswordField/PasswordField.api +7 -0
  120. data/lib/sws/Core/components/PasswordField/PasswordField.rb +41 -0
  121. data/lib/sws/Core/components/RadioButton/RadioButton.api +7 -0
  122. data/lib/sws/Core/components/RadioButton/RadioButton.rb +44 -0
  123. data/lib/sws/Core/components/RadioButtonList/RadioButtonList.api +20 -0
  124. data/lib/sws/Core/components/RadioButtonList/RadioButtonList.rb +76 -0
  125. data/lib/sws/Core/components/Repetition/Repetition.api +10 -0
  126. data/lib/sws/Core/components/Repetition/Repetition.html +1 -0
  127. data/lib/sws/Core/components/Repetition/Repetition.rb +137 -0
  128. data/lib/sws/Core/components/Repetition/Repetition.sws +2 -0
  129. data/lib/sws/Core/components/ResetButton/ResetButton.api +5 -0
  130. data/lib/sws/Core/components/ResetButton/ResetButton.rb +28 -0
  131. data/lib/sws/Core/components/Select/Select.api +24 -0
  132. data/lib/sws/Core/components/Select/Select.rb +57 -0
  133. data/lib/sws/Core/components/String/String.api +5 -0
  134. data/lib/sws/Core/components/String/String.rb +28 -0
  135. data/lib/sws/Core/components/SubmitButton/SubmitButton.api +6 -0
  136. data/lib/sws/Core/components/SubmitButton/SubmitButton.rb +53 -0
  137. data/lib/sws/Core/components/TextArea/TextArea.api +9 -0
  138. data/lib/sws/Core/components/TextArea/TextArea.rb +28 -0
  139. data/lib/sws/Core/components/TextField/TextField.api +9 -0
  140. data/lib/sws/Core/components/TextField/TextField.rb +46 -0
  141. data/lib/sws/Core/framework.yaml +25 -0
  142. data/lib/sws/JSComponents/components/JSMenu/JSMenu.api +5 -0
  143. data/lib/sws/JSComponents/components/JSMenu/JSMenu.html +58 -0
  144. data/lib/sws/JSComponents/components/JSMenu/JSMenu.rb +34 -0
  145. data/lib/sws/JSComponents/components/JSMenu/JSMenu.sws +37 -0
  146. data/lib/sws/JSComponents/framework.yaml +3 -0
  147. data/lib/sws/adaptor.rb +334 -0
  148. data/lib/sws/application.rb +604 -0
  149. data/lib/sws/component.rb +656 -0
  150. data/lib/sws/cookie.rb +27 -0
  151. data/lib/sws/direct_action.rb +38 -0
  152. data/lib/sws/extensions.rb +49 -0
  153. data/lib/sws/parsers.rb +374 -0
  154. data/lib/sws/request.rb +308 -0
  155. data/lib/sws/response.rb +70 -0
  156. data/lib/sws/session.rb +195 -0
  157. data/lib/sws/slot.rb +198 -0
  158. metadata +263 -0
@@ -0,0 +1,19 @@
1
+ Component = Struct.new( :name, :attributes )
2
+ Attribute = Struct.new( :name )
3
+
4
+ class RepetitionDemo < SWS::Component
5
+
6
+ attr_reader :components
7
+ attr_accessor :component_cursor, :attribute_cursor
8
+
9
+ def initialize ( *args )
10
+
11
+ super( *args )
12
+ @components = Array.new
13
+ @components << Component.new( "Repetition", [ Attribute.new( "list" ), Attribute.new( "item" )])
14
+ @components << Component.new( "TextField", [ Attribute.new( "value" ), Attribute.new( "name" )])
15
+ @components << Component.new( "String", [ Attribute.new( "value" ) ] )
16
+
17
+ end
18
+
19
+ end
@@ -0,0 +1,20 @@
1
+ component_repetition:
2
+ _class: SWS::Repetition
3
+ list: components
4
+ item: component_cursor
5
+
6
+ component_name_string:
7
+ _class: SWS::String
8
+ value: component_cursor.name
9
+
10
+ attribute_repetition:
11
+ _class: SWS::Repetition
12
+ list: component_cursor.attributes
13
+ item: attribute_cursor
14
+
15
+ attribute_name_textfield:
16
+ _class: SWS::TextField
17
+ value: attribute_cursor.name
18
+
19
+ page_wrapper:
20
+ _class: PageWrapper
@@ -0,0 +1,5 @@
1
+ <span sws="page_wrapper">
2
+ <span sws="literal_string"></span><br>
3
+ <span sws="attribute_string"></span><br>
4
+ <span sws="method_string"></span><br>
5
+ </span>
@@ -0,0 +1,16 @@
1
+ class StringDemo < SWS::Component
2
+
3
+ attr_reader :some_attribute
4
+
5
+ def initialize (*args)
6
+
7
+ super( *args )
8
+ @some_attribute = "This is a SWS::String created using component attribute"
9
+
10
+ end
11
+
12
+ def some_method ()
13
+ return "This is a SWS::String created using return value of a method"
14
+ end
15
+
16
+ end
@@ -0,0 +1,14 @@
1
+ page_wrapper:
2
+ _class: PageWrapper
3
+
4
+ literal_string:
5
+ _class: SWS::String
6
+ value: "'This is a SWS::String using literal string'"
7
+
8
+ attribute_string:
9
+ _class: SWS::String
10
+ value: some_attribute
11
+
12
+ method_string:
13
+ _class: SWS::String
14
+ value: some_method
@@ -0,0 +1,28 @@
1
+ components:
2
+ PageWrapper: PageWrapper
3
+ RepetitionDemo: RepetitionDemo
4
+ StringDemo: StringDemo
5
+ ConditionalDemo: ConditionalDemo
6
+ CheckBoxDemo: CheckBoxDemo
7
+ FormListsDemo: FormListsDemo
8
+ FileUploadDemo: FileUploadDemo
9
+ GenericDemo: GenericDemo
10
+ FormFieldsDemo: FormFieldsDemo
11
+ HyperlinkDemo: HyperlinkDemo
12
+ ImageLinkDemo: ImageLinkDemo
13
+
14
+ resources:
15
+ poweredby.jpg:
16
+ filename: poweredby.jpg
17
+ mime-type: image/jpg
18
+ style.css:
19
+ filename: style.css
20
+ mime-type: text/css
21
+
22
+ frameworks:
23
+ Core: SYSTEM/sws/Core
24
+
25
+ adaptor_class: SWS::Adaptor::Standalone
26
+ session_class: Session
27
+ default_component_class: StringDemo
28
+ default_encoding: iso-8859-2
@@ -0,0 +1 @@
1
+ .bold { font-weight: bold }
@@ -0,0 +1,3 @@
1
+ <table align="center">
2
+ <tr><td><a sws="link_movies">Movies</a></td><td><a sws="link_users">Folks</a></td></tr>
3
+ </table>
@@ -0,0 +1,7 @@
1
+ # This is just a simple component designed to be embedded in another components.
2
+ # It creates very simplistic menu (menu? two hyperlinks :) with links to 2 pages
3
+ # (components) - MovieBrowse and UserBrowse
4
+
5
+ class Menu < SWS::Component
6
+
7
+ end
@@ -0,0 +1,7 @@
1
+ link_movies:
2
+ _class: SWS::Hyperlink
3
+ page_name: "'MovieBrowse'"
4
+
5
+ link_users:
6
+ _class: SWS::Hyperlink
7
+ page_name: "'UserBrowse'"
@@ -0,0 +1,68 @@
1
+ <html>
2
+ <head>
3
+ <title>Movie browsing</title>
4
+ </head>
5
+ <body>
6
+ <!-- Menu component -->
7
+ <span sws="menu">
8
+ <!-- Main table with movies displayed -->
9
+ <form sws="browse_form">
10
+ <table align="center" border="1">
11
+ <!-- header row with sorting links-->
12
+ <tr>
13
+ <th><a sws="link_sort_polish_title">Polish title</a></th>
14
+ <th><a sws="link_sort_english_title">English title</a></th>
15
+ <th><a sws="link_sort_cd_count">CD count</a></th>
16
+ <th><a sws="link_sort_description">Description</a></th>
17
+ <th>Rent movie</th>
18
+ <th>Actions</th>
19
+ </tr>
20
+ <!-- data row - wrapped in repetition, so it will be displayed multiple times -->
21
+ <span sws="movie_repetition">
22
+ <tr>
23
+ <td><span sws="cursor_polish_title"></span></td>
24
+ <td><span sws="cursor_english_title"></span></td>
25
+ <td><span sws="cursor_cd_count"></span></td>
26
+ <td><span sws="cursor_description"></span></td>
27
+ <td>
28
+ <span sws="conditional_rented">
29
+ <span sws="cursor_rental_state"></span>
30
+ </span>
31
+ <span sws="conditional_not_rented">
32
+ <select sws="select_rentee">
33
+ </span>
34
+ </td>
35
+ <td>
36
+ <span sws="conditional_rented2">
37
+ <input type="submit" sws="submit_return">
38
+ </span>
39
+ <span sws="conditional_not_rented2">
40
+ <input type="submit" sws="submit_rent">
41
+ </span>
42
+ <input type="submit" sws="submit_delete">
43
+ <input type="submit" sws="submit_edit">
44
+ </td>
45
+ </tr>
46
+ </span>
47
+ <tr><td colspan="6" align="center"><input type="submit" sws="submit_add"></td></tr>
48
+ </table>
49
+
50
+ </form>
51
+
52
+
53
+ <!-- edit table - displayed only if current_movie is set -->
54
+ <span sws="conditional_current">
55
+ <form sws="edit_form">
56
+ <table align="center" border="1">
57
+
58
+ <tr><th>Polish title</th><td><input type="text" sws="current_polish_title"></td></tr>
59
+ <tr><th>English title</th><td><input type="text" sws="current_english_title"></td></tr>
60
+ <tr><th>CD count</th><td><input type="text" sws="current_cd_count"></td></tr>
61
+ <tr><th>Description</th><td><span sws="current_description"></td></tr>
62
+ <tr><th></th><td><input type="submit" sws="submit_confirm"></td></tr>
63
+ </table>
64
+ </form>
65
+ </span>
66
+
67
+ </body>
68
+ </html>
@@ -0,0 +1,178 @@
1
+ # This component is a page displaying movies matching selected criteria.
2
+ # You can also perform some basic operations on the movies - edit, delete, new and rent.
3
+ class MovieBrowse < SWS::Component
4
+
5
+ attr_accessor :movies, :movie_cursor, :users, :user_cursor, :selected_users, :current_movie
6
+
7
+ # Constructor for component. SWS::Component constructor takes several arguments, so
8
+ # you should always call super with *args.
9
+ def initialize (*args)
10
+
11
+ super( *args )
12
+
13
+ # Create new context for store (defined in application class)
14
+ @context = SDS::Context.new( app().store )
15
+
16
+ # Fetch all users and movies into the context
17
+ qualifier = "id_movie > 100 or cd_count > 2 or polish_title LIKE 'film%'"
18
+ orders = [ ["cd_count", :asc], ["id_movie", :desc] ]
19
+ @movies = @context.fetch( "Movie", qualifier, orders )
20
+ @users = @context.fetch( "User" )
21
+
22
+ end
23
+
24
+
25
+ # append_to_response is the method that actually renders HTML page after
26
+ # receiving the request and calling the appropiate method. In this case
27
+ # we just nullify @selected_user (so that in the select_rentee combo box
28
+ # the selected user is always the first one). Note the super must be called -
29
+ # otherwise no HTML will be rendered!
30
+ def append_to_response (response)
31
+
32
+ @selected_users = nil
33
+ super
34
+
35
+ end
36
+
37
+
38
+ # Returns movie (completes the rental). Uses @movie_cursor - it is automatically
39
+ # set to the movie in the line where the user clicked the "Return" button. The method
40
+ # returns self, so the same component will serve the next request in this session.
41
+ def return_movie ()
42
+
43
+ puts "Returning movie #{@movie_cursor.english_title}"
44
+ rental = @movie_cursor.rentals.last
45
+ puts "Rental: #{rental.return_date}"
46
+ rental.return_date = Date.today()
47
+ puts "Rental: #{rental.return_date}"
48
+ @movie_cursor.rented = 0
49
+ @context.save()
50
+ return self
51
+
52
+ end
53
+
54
+
55
+ # Rents a movie. Takes @selected_movie (the movie in the line where the "Rent" button
56
+ # was clicked and @selected_user (the user selected in combo box). Returns self, so the
57
+ # same component will serve the next request in this session.
58
+ def rent_movie ()
59
+
60
+ puts "Renting movie #{@movie_cursor.english_title} to user #{@selected_users[0].name}"
61
+ rental = Rental.create( @context )
62
+ rental.add_object_to_relationship( "movie", @movie_cursor )
63
+ rental.add_object_to_relationship( "user", @selected_users[0] )
64
+ rental.rental_date = Date.today()
65
+ @movie_cursor.rented = 1
66
+ @context.save()
67
+ return self
68
+
69
+ end
70
+
71
+
72
+ # Deletes a movie. Returns self (for known reasons :)
73
+ def delete_movie ()
74
+
75
+ puts( "Deleting movie #{@movie_cursor}\n\n\n" )
76
+ @context.delete( @movie_cursor )
77
+ @movies.delete( @movie_cursor )
78
+ @context.save()
79
+ return self
80
+
81
+ end
82
+
83
+
84
+ # Schedules the movie for editing. Causes the HTML table with fields with attributes
85
+ # of this movie to appear near the bottom of the page.
86
+ def edit_movie ()
87
+
88
+ @current_movie = @movie_cursor
89
+ return self
90
+
91
+ end
92
+
93
+
94
+ # Creates new movie. Note that this movie is not immediately saved.
95
+ def add_movie ()
96
+
97
+ @current_movie = Movie.create( @context )
98
+ @current_movie.rented = 0
99
+ return self
100
+
101
+ end
102
+
103
+
104
+ # Sorts the movies according to polish_title
105
+ def sort_by_polish_title ()
106
+
107
+ @movies.sort! { |movie1,movie2| movie1.polish_title <=> movie2.polish_title }
108
+ return self
109
+
110
+ end
111
+
112
+
113
+ # Sorts the movies according to english_title
114
+ def sort_by_english_title ()
115
+
116
+ @movies.sort! { |movie1,movie2| movie1.english_title <=> movie2.english_title }
117
+ return self
118
+
119
+ end
120
+
121
+
122
+ # Sorts the movies according to cd_count
123
+ def sort_by_cd_count ()
124
+
125
+ @movies.sort! { |movie1,movie2| movie1.cd_count <=> movie2.cd_count }
126
+ return self
127
+
128
+ end
129
+
130
+
131
+ # Sort the movies according to description
132
+ def sort_by_description ()
133
+
134
+ @movies.sort! { |movie1,movie2|
135
+ unless ( movie1.description && movie2.description )
136
+ -1
137
+ else
138
+ movie1.description <=> movie2.description
139
+ end
140
+ }
141
+ return self
142
+
143
+ end
144
+
145
+
146
+ # Returns true if any movie was selected for editing or adding. If not,
147
+ # the edit table won't be rendered
148
+ def has_current? ()
149
+ return @current_movie != nil
150
+ end
151
+
152
+
153
+ # Return cd count of current movie or 0 if current movie not present
154
+ def current_cd_count ()
155
+ return has_current? ? @current_movie.cd_count : 0;
156
+ end
157
+
158
+
159
+ def current_cd_count= ( cd_count )
160
+ @current_movie.cd_count = cd_count.to_i
161
+ end
162
+
163
+
164
+ # Confirm the changes and saves the current movie
165
+ def confirm_changes ()
166
+
167
+ puts "pol: #{current_movie.polish_title}"
168
+ puts "eng: #{current_movie.english_title}"
169
+ puts "CD: #{current_movie.cd_count}"
170
+ puts "Desc: #{current_movie.description}"
171
+ @context.save()
172
+ @movies = @context.fetch( "Movie" )
173
+ @current_movie = nil
174
+ return self
175
+
176
+ end
177
+
178
+ end
@@ -0,0 +1,127 @@
1
+ menu:
2
+ _class: Menu
3
+
4
+ browse_form:
5
+ _class: SWS::Form
6
+ enctype: "'multipart/form-data'"
7
+
8
+ link_sort_polish_title:
9
+ _class: SWS::Hyperlink
10
+ action: sort_by_polish_title
11
+
12
+ link_sort_english_title:
13
+ _class: SWS::Hyperlink
14
+ action: sort_by_english_title
15
+
16
+ link_sort_cd_count:
17
+ _class: SWS::Hyperlink
18
+ action: sort_by_cd_count
19
+
20
+ link_sort_description:
21
+ _class: SWS::Hyperlink
22
+ action: sort_by_description
23
+
24
+ movie_repetition:
25
+ _class: SWS::Repetition
26
+ list: movies
27
+ item: movie_cursor
28
+
29
+ cursor_polish_title:
30
+ _class: SWS::String
31
+ value: movie_cursor.polish_title
32
+
33
+ cursor_english_title:
34
+ _class: SWS::String
35
+ value: movie_cursor.english_title
36
+
37
+ cursor_cd_count:
38
+ _class: SWS::String
39
+ value: movie_cursor.cd_count
40
+
41
+ cursor_description:
42
+ _class: SWS::String
43
+ value: movie_cursor.description
44
+
45
+ conditional_rented:
46
+ _class: SWS::Conditional
47
+ condition: movie_cursor.rented?
48
+
49
+ conditional_not_rented:
50
+ _class: SWS::Conditional
51
+ condition: movie_cursor.rented?
52
+ negate: true
53
+
54
+ conditional_rented2:
55
+ _class: SWS::Conditional
56
+ condition: movie_cursor.rented?
57
+
58
+ conditional_not_rented2:
59
+ _class: SWS::Conditional
60
+ condition: movie_cursor.rented?
61
+ negate: true
62
+
63
+ cursor_rental_state:
64
+ _class: SWS::String
65
+ value: movie_cursor.rental_state
66
+
67
+ select_rentee:
68
+ _class: SWS::Select
69
+ list: users
70
+ item: user_cursor
71
+ display_string: user_cursor.name
72
+ multiple: false
73
+ size: 1
74
+ selections: selected_users
75
+
76
+ submit_return:
77
+ _class: SWS::SubmitButton
78
+ value: "'Return'"
79
+ action: return_movie
80
+
81
+ submit_rent:
82
+ _class: SWS::SubmitButton
83
+ value: "'Rent'"
84
+ action: rent_movie
85
+
86
+ submit_delete:
87
+ _class: SWS::SubmitButton
88
+ value: "'Delete'"
89
+ action: delete_movie
90
+
91
+ submit_edit:
92
+ _class: SWS::SubmitButton
93
+ value: "'Edit'"
94
+ action: edit_movie
95
+
96
+ submit_add:
97
+ _class: SWS::SubmitButton
98
+ value: "'New movie'"
99
+ action: add_movie
100
+
101
+ conditional_current:
102
+ _class: SWS::Conditional
103
+ condition: has_current?
104
+
105
+ edit_form:
106
+ _class: SWS::Form
107
+
108
+ current_polish_title:
109
+ _class: SWS::TextField
110
+ value: current_movie.polish_title
111
+
112
+ current_english_title:
113
+ _class: SWS::TextField
114
+ value: current_movie.english_title
115
+
116
+ current_cd_count:
117
+ _class: SWS::TextField
118
+ value: current_cd_count
119
+
120
+ current_description:
121
+ _class: SWS::TextArea
122
+ value: current_movie.description
123
+
124
+ submit_confirm:
125
+ _class: SWS::SubmitButton
126
+ value: "'Save'"
127
+ action: confirm_changes