fastui 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +53 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/images/fastui/application/application.png +0 -0
  6. data/app/assets/images/fastui/application/application_add.png +0 -0
  7. data/app/assets/images/fastui/application/application_cascade.png +0 -0
  8. data/app/assets/images/fastui/application/application_delete.png +0 -0
  9. data/app/assets/images/fastui/application/application_double.png +0 -0
  10. data/app/assets/images/fastui/application/application_edit.png +0 -0
  11. data/app/assets/images/fastui/application/application_error.png +0 -0
  12. data/app/assets/images/fastui/application/application_form.png +0 -0
  13. data/app/assets/images/fastui/application/application_form_add.png +0 -0
  14. data/app/assets/images/fastui/application/application_form_delete.png +0 -0
  15. data/app/assets/images/fastui/application/application_form_edit.png +0 -0
  16. data/app/assets/images/fastui/application/application_form_magnify.png +0 -0
  17. data/app/assets/images/fastui/application/application_get.png +0 -0
  18. data/app/assets/images/fastui/application/application_go.png +0 -0
  19. data/app/assets/images/fastui/application/application_home.png +0 -0
  20. data/app/assets/images/fastui/application/application_key.png +0 -0
  21. data/app/assets/images/fastui/application/application_lightning.png +0 -0
  22. data/app/assets/images/fastui/application/application_link.png +0 -0
  23. data/app/assets/images/fastui/application/application_osx.png +0 -0
  24. data/app/assets/images/fastui/application/application_osx_terminal.png +0 -0
  25. data/app/assets/images/fastui/application/application_put.png +0 -0
  26. data/app/assets/images/fastui/application/application_side_boxes.png +0 -0
  27. data/app/assets/images/fastui/application/application_side_contract.png +0 -0
  28. data/app/assets/images/fastui/application/application_side_expand.png +0 -0
  29. data/app/assets/images/fastui/application/application_side_list.png +0 -0
  30. data/app/assets/images/fastui/application/application_side_tree.png +0 -0
  31. data/app/assets/images/fastui/application/application_split.png +0 -0
  32. data/app/assets/images/fastui/application/application_tile_horizontal.png +0 -0
  33. data/app/assets/images/fastui/application/application_tile_vertical.png +0 -0
  34. data/app/assets/images/fastui/application/application_view_columns.png +0 -0
  35. data/app/assets/images/fastui/application/application_view_detail.png +0 -0
  36. data/app/assets/images/fastui/application/application_view_gallery.png +0 -0
  37. data/app/assets/images/fastui/application/application_view_icons.png +0 -0
  38. data/app/assets/images/fastui/application/application_view_list.png +0 -0
  39. data/app/assets/images/fastui/application/application_view_tile.png +0 -0
  40. data/app/assets/images/fastui/application/application_xp.png +0 -0
  41. data/app/assets/images/fastui/application/application_xp_terminal.png +0 -0
  42. data/app/assets/images/fastui/arrow/accept.png +0 -0
  43. data/app/assets/images/fastui/arrow/add.png +0 -0
  44. data/app/assets/images/fastui/arrow/arrow_branch.png +0 -0
  45. data/app/assets/images/fastui/arrow/arrow_divide.png +0 -0
  46. data/app/assets/images/fastui/arrow/arrow_down.png +0 -0
  47. data/app/assets/images/fastui/arrow/arrow_in.png +0 -0
  48. data/app/assets/images/fastui/arrow/arrow_inout.png +0 -0
  49. data/app/assets/images/fastui/arrow/arrow_join.png +0 -0
  50. data/app/assets/images/fastui/arrow/arrow_left.png +0 -0
  51. data/app/assets/images/fastui/arrow/arrow_merge.png +0 -0
  52. data/app/assets/images/fastui/arrow/arrow_out.png +0 -0
  53. data/app/assets/images/fastui/arrow/arrow_redo.png +0 -0
  54. data/app/assets/images/fastui/arrow/arrow_refresh.png +0 -0
  55. data/app/assets/images/fastui/arrow/arrow_refresh_small.png +0 -0
  56. data/app/assets/images/fastui/arrow/arrow_rotate_anticlockwise.png +0 -0
  57. data/app/assets/images/fastui/arrow/arrow_rotate_clockwise.png +0 -0
  58. data/app/assets/images/fastui/arrow/arrow_switch.png +0 -0
  59. data/app/assets/images/fastui/arrow/arrow_turn_left.png +0 -0
  60. data/app/assets/images/fastui/arrow/arrow_turn_right.png +0 -0
  61. data/app/assets/images/fastui/arrow/arrow_undo.png +0 -0
  62. data/app/assets/images/fastui/arrow/arrow_up.png +0 -0
  63. data/app/assets/images/fastui/arrow/cross.png +0 -0
  64. data/app/assets/images/fastui/cross.png +0 -0
  65. data/app/assets/images/fastui/key_go.png +0 -0
  66. data/app/assets/images/fastui/list1211.png +0 -0
  67. data/app/assets/images/fastui/loading.gif +0 -0
  68. data/app/assets/images/fastui/lock.png +0 -0
  69. data/app/assets/images/fastui/locked.png +0 -0
  70. data/app/assets/images/fastui/table/help.png +0 -0
  71. data/app/assets/images/fastui/table/table.png +0 -0
  72. data/app/assets/images/fastui/table/table_add.png +0 -0
  73. data/app/assets/images/fastui/table/table_delete.png +0 -0
  74. data/app/assets/images/fastui/table/table_edit.png +0 -0
  75. data/app/assets/images/fastui/table/table_save.png +0 -0
  76. data/app/assets/images/fastui/upload.png +0 -0
  77. data/app/assets/javascripts/fastui/app/Ctx.js +33 -0
  78. data/app/assets/javascripts/fastui/app/Env.js +38 -0
  79. data/app/assets/javascripts/fastui/app/Evaluator.js +6 -0
  80. data/app/assets/javascripts/fastui/app/inflection.js +656 -0
  81. data/app/assets/javascripts/fastui/app/store/MListMgr.js +34 -0
  82. data/app/assets/javascripts/fastui/app/store/MWindowMgr.js +27 -0
  83. data/app/assets/javascripts/fastui/app/view/FormFactory.js +11 -0
  84. data/app/assets/javascripts/fastui/app/view/Rest.js +40 -0
  85. data/app/assets/javascripts/fastui/app/view/VCommentForm.js +53 -0
  86. data/app/assets/javascripts/fastui/app/view/VCriteria.js +25 -0
  87. data/app/assets/javascripts/fastui/app/view/VCustomForm.js +34 -0
  88. data/app/assets/javascripts/fastui/app/view/VCustomTab.js +266 -0
  89. data/app/assets/javascripts/fastui/app/view/VForm.js +117 -0
  90. data/app/assets/javascripts/fastui/app/view/VGrid.js +172 -0
  91. data/app/assets/javascripts/fastui/app/view/VHelpWindow.js +21 -0
  92. data/app/assets/javascripts/fastui/app/view/VLoginForm.js +101 -0
  93. data/app/assets/javascripts/fastui/app/view/VLoginWindow.js +73 -0
  94. data/app/assets/javascripts/fastui/app/view/VMenu.js +75 -0
  95. data/app/assets/javascripts/fastui/app/view/VSearchWindow.js +102 -0
  96. data/app/assets/javascripts/fastui/app/view/VTab.js +293 -0
  97. data/app/assets/javascripts/fastui/app/view/VToolbar.js +23 -0
  98. data/app/assets/javascripts/fastui/app/view/VTreeGrid.js +158 -0
  99. data/app/assets/javascripts/fastui/app/view/VVWindow.js +72 -0
  100. data/app/assets/javascripts/fastui/app/view/VWindow.js +52 -0
  101. data/app/assets/javascripts/fastui/app/view/Viewport.js +54 -0
  102. data/app/assets/javascripts/fastui/app/view/vfield/VCheckBox.js +19 -0
  103. data/app/assets/javascripts/fastui/app/view/vfield/VCheckboxGroup.js +19 -0
  104. data/app/assets/javascripts/fastui/app/view/vfield/VDate.js +19 -0
  105. data/app/assets/javascripts/fastui/app/view/vfield/VFieldFactory.js +77 -0
  106. data/app/assets/javascripts/fastui/app/view/vfield/VFile.js +22 -0
  107. data/app/assets/javascripts/fastui/app/view/vfield/VHtmlEditor.js +19 -0
  108. data/app/assets/javascripts/fastui/app/view/vfield/VLongComboBox.js +19 -0
  109. data/app/assets/javascripts/fastui/app/view/vfield/VLookup.js +45 -0
  110. data/app/assets/javascripts/fastui/app/view/vfield/VMultipleChoice.js +46 -0
  111. data/app/assets/javascripts/fastui/app/view/vfield/VNumber.js +18 -0
  112. data/app/assets/javascripts/fastui/app/view/vfield/VSexSelect.js +30 -0
  113. data/app/assets/javascripts/fastui/app/view/vfield/VSingleChoice.js +35 -0
  114. data/app/assets/javascripts/fastui/app/view/vfield/VText.js +17 -0
  115. data/app/assets/javascripts/fastui/app/view/vfield/VTextArea.js +19 -0
  116. data/app/assets/javascripts/fastui/app/view/vfield/VTree.js +17 -0
  117. data/app/assets/javascripts/fastui/app/view/vfield/VYesOrNo.js +30 -0
  118. data/app/assets/javascripts/fastui/application.js +18 -0
  119. data/app/assets/javascripts/fastui/data/mwindows.json +7 -0
  120. data/app/assets/javascripts/fastui/data/updateMWindows.json +4 -0
  121. data/app/assets/javascripts/fastui/extjs4/locale/ext-lang-zh_CN.js +304 -0
  122. data/app/assets/javascripts/fastui/fastui.js +23 -0
  123. data/app/assets/stylesheets/fastui/admin.css +95 -0
  124. data/app/assets/stylesheets/fastui/application.css +14 -0
  125. data/app/controllers/fastui/admin_controller.rb +9 -0
  126. data/app/controllers/fastui/application_controller.rb +19 -0
  127. data/app/controllers/fastui/m_list_items_controller.rb +64 -0
  128. data/app/controllers/fastui/m_lists_controller.rb +58 -0
  129. data/app/controllers/fastui/m_menu_items_controller.rb +69 -0
  130. data/app/controllers/fastui/m_menus_controller.rb +58 -0
  131. data/app/controllers/fastui/m_orgs_controller.rb +62 -0
  132. data/app/controllers/fastui/m_people_controller.rb +89 -0
  133. data/app/controllers/fastui/m_roles_controller.rb +61 -0
  134. data/app/controllers/fastui/m_views_controller.rb +18 -0
  135. data/app/controllers/fastui/sessions_controller.rb +42 -0
  136. data/app/helpers/fastui/admin_helper.rb +4 -0
  137. data/app/helpers/fastui/application_helper.rb +4 -0
  138. data/app/models/fastui/acl.rb +21 -0
  139. data/app/models/fastui/ctx.rb +15 -0
  140. data/app/models/fastui/env.rb +16 -0
  141. data/app/models/fastui/m_acl_entry.rb +5 -0
  142. data/app/models/fastui/m_list.rb +6 -0
  143. data/app/models/fastui/m_list_item.rb +8 -0
  144. data/app/models/fastui/m_menu.rb +10 -0
  145. data/app/models/fastui/m_menu_item.rb +11 -0
  146. data/app/models/fastui/m_object.rb +41 -0
  147. data/app/models/fastui/m_org.rb +16 -0
  148. data/app/models/fastui/m_person.rb +21 -0
  149. data/app/models/fastui/m_relationship.rb +9 -0
  150. data/app/models/fastui/m_role.rb +11 -0
  151. data/app/models/fastui/user_authenticator.rb +18 -0
  152. data/app/views/fastui/admin/index.html.erb +2 -0
  153. data/app/views/layouts/fastui/application.html.erb +22 -0
  154. data/config/routes.rb +19 -0
  155. data/db/migrate/20121017013727_create_fastui_m_menu_items.rb +28 -0
  156. data/db/migrate/20121017014112_create_fastui_m_menus.rb +20 -0
  157. data/db/migrate/20121017024943_create_fastui_m_orgs.rb +26 -0
  158. data/db/migrate/20121017025014_create_fastui_m_people.rb +24 -0
  159. data/db/migrate/20121204021053_create_fastui_m_roles.rb +22 -0
  160. data/db/migrate/20121204061207_create_fastui_m_relationships.rb +25 -0
  161. data/db/migrate/20121211062955_create_fastui_m_lists.rb +23 -0
  162. data/db/migrate/20121211074436_create_fastui_m_list_items.rb +21 -0
  163. data/db/migrate/20121217020606_create_fastui_m_acl_entries.rb +22 -0
  164. data/lib/fastui/engine.rb +8 -0
  165. data/lib/fastui/m_model.rb +26 -0
  166. data/lib/fastui/tab.rb +26 -0
  167. data/lib/fastui/version.rb +3 -0
  168. data/lib/fastui/view.rb +32 -0
  169. data/lib/fastui/window.rb +43 -0
  170. data/lib/fastui.rb +8 -0
  171. data/lib/generators/fastui/USAGE +21 -0
  172. data/lib/generators/fastui/install_generator.rb +31 -0
  173. data/lib/generators/fastui/templates/fastui_config.erb +77 -0
  174. data/lib/tasks/create_sys_data.rake +11 -0
  175. data/lib/tasks/fastui_tasks.rake +707 -0
  176. data/lib/tasks/loading_data.rake +28 -0
  177. metadata +276 -0
@@ -0,0 +1,656 @@
1
+ /*
2
+ Copyright (c) 2010 Ryan Schuft (ryan.schuft@gmail.com)
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
+ */
22
+
23
+ /*
24
+ This code is based in part on the work done in Ruby to support
25
+ infection as part of Ruby on Rails in the ActiveSupport's Inflector
26
+ and Inflections classes. It was initally ported to Javascript by
27
+ Ryan Schuft (ryan.schuft@gmail.com) in 2007.
28
+
29
+ The code is available at http://code.google.com/p/inflection-js/
30
+
31
+ The basic usage is:
32
+ 1. Include this script on your web page.
33
+ 2. Call functions on any String object in Javascript
34
+
35
+ Currently implemented functions:
36
+
37
+ String.pluralize(plural) == String
38
+ renders a singular English language noun into its plural form
39
+ normal results can be overridden by passing in an alternative
40
+
41
+ String.singularize(singular) == String
42
+ renders a plural English language noun into its singular form
43
+ normal results can be overridden by passing in an alterative
44
+
45
+ String.camelize(lowFirstLetter) == String
46
+ renders a lower case underscored word into camel case
47
+ the first letter of the result will be upper case unless you pass true
48
+ also translates "/" into "::" (underscore does the opposite)
49
+
50
+ String.underscore() == String
51
+ renders a camel cased word into words seperated by underscores
52
+ also translates "::" back into "/" (camelize does the opposite)
53
+
54
+ String.humanize(lowFirstLetter) == String
55
+ renders a lower case and underscored word into human readable form
56
+ defaults to making the first letter capitalized unless you pass true
57
+
58
+ String.capitalize() == String
59
+ renders all characters to lower case and then makes the first upper
60
+
61
+ String.dasherize() == String
62
+ renders all underbars and spaces as dashes
63
+
64
+ String.titleize() == String
65
+ renders words into title casing (as for book titles)
66
+
67
+ String.demodulize() == String
68
+ renders class names that are prepended by modules into just the class
69
+
70
+ String.tableize() == String
71
+ renders camel cased singular words into their underscored plural form
72
+
73
+ String.classify() == String
74
+ renders an underscored plural word into its camel cased singular form
75
+
76
+ String.foreign_key(dropIdUbar) == String
77
+ renders a class name (camel cased singular noun) into a foreign key
78
+ defaults to seperating the class from the id with an underbar unless
79
+ you pass true
80
+
81
+ String.ordinalize() == String
82
+ renders all numbers found in the string into their sequence like "22nd"
83
+ */
84
+
85
+ /*
86
+ This sets up a container for some constants in its own namespace
87
+ We use the window (if available) to enable dynamic loading of this script
88
+ Window won't necessarily exist for non-browsers.
89
+ */
90
+ if (window && !window.InflectionJS)
91
+ {
92
+ window.InflectionJS = null;
93
+ }
94
+
95
+ /*
96
+ This sets up some constants for later use
97
+ This should use the window namespace variable if available
98
+ */
99
+ InflectionJS =
100
+ {
101
+ /*
102
+ This is a list of nouns that use the same form for both singular and plural.
103
+ This list should remain entirely in lower case to correctly match Strings.
104
+ */
105
+ uncountable_words: [
106
+ 'equipment', 'information', 'rice', 'money', 'species', 'series',
107
+ 'fish', 'sheep', 'moose', 'deer', 'news'
108
+ ],
109
+
110
+ /*
111
+ These rules translate from the singular form of a noun to its plural form.
112
+ */
113
+ plural_rules: [
114
+ [new RegExp('(m)an$', 'gi'), '$1en'],
115
+ [new RegExp('(pe)rson$', 'gi'), '$1ople'],
116
+ [new RegExp('(child)$', 'gi'), '$1ren'],
117
+ [new RegExp('^(ox)$', 'gi'), '$1en'],
118
+ [new RegExp('(ax|test)is$', 'gi'), '$1es'],
119
+ [new RegExp('(octop|vir)us$', 'gi'), '$1i'],
120
+ [new RegExp('(alias|status)$', 'gi'), '$1es'],
121
+ [new RegExp('(bu)s$', 'gi'), '$1ses'],
122
+ [new RegExp('(buffal|tomat|potat)o$', 'gi'), '$1oes'],
123
+ [new RegExp('([ti])um$', 'gi'), '$1a'],
124
+ [new RegExp('sis$', 'gi'), 'ses'],
125
+ [new RegExp('(?:([^f])fe|([lr])f)$', 'gi'), '$1$2ves'],
126
+ [new RegExp('(hive)$', 'gi'), '$1s'],
127
+ [new RegExp('([^aeiouy]|qu)y$', 'gi'), '$1ies'],
128
+ [new RegExp('(x|ch|ss|sh)$', 'gi'), '$1es'],
129
+ [new RegExp('(matr|vert|ind)ix|ex$', 'gi'), '$1ices'],
130
+ [new RegExp('([m|l])ouse$', 'gi'), '$1ice'],
131
+ [new RegExp('(quiz)$', 'gi'), '$1zes'],
132
+ [new RegExp('s$', 'gi'), 's'],
133
+ [new RegExp('$', 'gi'), 's']
134
+ ],
135
+
136
+ /*
137
+ These rules translate from the plural form of a noun to its singular form.
138
+ */
139
+ singular_rules: [
140
+ [new RegExp('(m)en$', 'gi'), '$1an'],
141
+ [new RegExp('(pe)ople$', 'gi'), '$1rson'],
142
+ [new RegExp('(child)ren$', 'gi'), '$1'],
143
+ [new RegExp('([ti])a$', 'gi'), '$1um'],
144
+ [new RegExp('((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$','gi'), '$1$2sis'],
145
+ [new RegExp('(hive)s$', 'gi'), '$1'],
146
+ [new RegExp('(tive)s$', 'gi'), '$1'],
147
+ [new RegExp('(curve)s$', 'gi'), '$1'],
148
+ [new RegExp('([lr])ves$', 'gi'), '$1f'],
149
+ [new RegExp('([^fo])ves$', 'gi'), '$1fe'],
150
+ [new RegExp('([^aeiouy]|qu)ies$', 'gi'), '$1y'],
151
+ [new RegExp('(s)eries$', 'gi'), '$1eries'],
152
+ [new RegExp('(m)ovies$', 'gi'), '$1ovie'],
153
+ [new RegExp('(x|ch|ss|sh)es$', 'gi'), '$1'],
154
+ [new RegExp('([m|l])ice$', 'gi'), '$1ouse'],
155
+ [new RegExp('(bus)es$', 'gi'), '$1'],
156
+ [new RegExp('(o)es$', 'gi'), '$1'],
157
+ [new RegExp('(shoe)s$', 'gi'), '$1'],
158
+ [new RegExp('(cris|ax|test)es$', 'gi'), '$1is'],
159
+ [new RegExp('(octop|vir)i$', 'gi'), '$1us'],
160
+ [new RegExp('(alias|status)es$', 'gi'), '$1'],
161
+ [new RegExp('^(ox)en', 'gi'), '$1'],
162
+ [new RegExp('(vert|ind)ices$', 'gi'), '$1ex'],
163
+ [new RegExp('(matr)ices$', 'gi'), '$1ix'],
164
+ [new RegExp('(quiz)zes$', 'gi'), '$1'],
165
+ [new RegExp('s$', 'gi'), '']
166
+ ],
167
+
168
+ /*
169
+ This is a list of words that should not be capitalized for title case
170
+ */
171
+ non_titlecased_words: [
172
+ 'and', 'or', 'nor', 'a', 'an', 'the', 'so', 'but', 'to', 'of', 'at',
173
+ 'by', 'from', 'into', 'on', 'onto', 'off', 'out', 'in', 'over',
174
+ 'with', 'for'
175
+ ],
176
+
177
+ /*
178
+ These are regular expressions used for converting between String formats
179
+ */
180
+ id_suffix: new RegExp('(_ids|_id)$', 'g'),
181
+ underbar: new RegExp('_', 'g'),
182
+ space_or_underbar: new RegExp('[\ _]', 'g'),
183
+ uppercase: new RegExp('([A-Z])', 'g'),
184
+ underbar_prefix: new RegExp('^_'),
185
+
186
+ /*
187
+ This is a helper method that applies rules based replacement to a String
188
+ Signature:
189
+ InflectionJS.apply_rules(str, rules, skip, override) == String
190
+ Arguments:
191
+ str - String - String to modify and return based on the passed rules
192
+ rules - Array: [RegExp, String] - Regexp to match paired with String to use for replacement
193
+ skip - Array: [String] - Strings to skip if they match
194
+ override - String (optional) - String to return as though this method succeeded (used to conform to APIs)
195
+ Returns:
196
+ String - passed String modified by passed rules
197
+ Examples:
198
+ InflectionJS.apply_rules("cows", InflectionJs.singular_rules) === 'cow'
199
+ */
200
+ apply_rules: function(str, rules, skip, override)
201
+ {
202
+ if (override)
203
+ {
204
+ str = override;
205
+ }
206
+ else
207
+ {
208
+ var ignore = (skip.indexOf(str.toLowerCase()) > -1);
209
+ if (!ignore)
210
+ {
211
+ for (var x = 0; x < rules.length; x++)
212
+ {
213
+ if (str.match(rules[x][0]))
214
+ {
215
+ str = str.replace(rules[x][0], rules[x][1]);
216
+ break;
217
+ }
218
+ }
219
+ }
220
+ }
221
+ return str;
222
+ }
223
+ };
224
+
225
+ /*
226
+ This lets us detect if an Array contains a given element
227
+ Signature:
228
+ Array.indexOf(item, fromIndex, compareFunc) == Integer
229
+ Arguments:
230
+ item - Object - object to locate in the Array
231
+ fromIndex - Integer (optional) - starts checking from this position in the Array
232
+ compareFunc - Function (optional) - function used to compare Array item vs passed item
233
+ Returns:
234
+ Integer - index position in the Array of the passed item
235
+ Examples:
236
+ ['hi','there'].indexOf("guys") === -1
237
+ ['hi','there'].indexOf("hi") === 0
238
+ */
239
+ if (!Array.prototype.indexOf)
240
+ {
241
+ Array.prototype.indexOf = function(item, fromIndex, compareFunc)
242
+ {
243
+ if (!fromIndex)
244
+ {
245
+ fromIndex = -1;
246
+ }
247
+ var index = -1;
248
+ for (var i = fromIndex; i < this.length; i++)
249
+ {
250
+ if (this[i] === item || compareFunc && compareFunc(this[i], item))
251
+ {
252
+ index = i;
253
+ break;
254
+ }
255
+ }
256
+ return index;
257
+ };
258
+ }
259
+
260
+ /*
261
+ You can override this list for all Strings or just one depending on if you
262
+ set the new values on prototype or on a given String instance.
263
+ */
264
+ if (!String.prototype._uncountable_words)
265
+ {
266
+ String.prototype._uncountable_words = InflectionJS.uncountable_words;
267
+ }
268
+
269
+ /*
270
+ You can override this list for all Strings or just one depending on if you
271
+ set the new values on prototype or on a given String instance.
272
+ */
273
+ if (!String.prototype._plural_rules)
274
+ {
275
+ String.prototype._plural_rules = InflectionJS.plural_rules;
276
+ }
277
+
278
+ /*
279
+ You can override this list for all Strings or just one depending on if you
280
+ set the new values on prototype or on a given String instance.
281
+ */
282
+ if (!String.prototype._singular_rules)
283
+ {
284
+ String.prototype._singular_rules = InflectionJS.singular_rules;
285
+ }
286
+
287
+ /*
288
+ You can override this list for all Strings or just one depending on if you
289
+ set the new values on prototype or on a given String instance.
290
+ */
291
+ if (!String.prototype._non_titlecased_words)
292
+ {
293
+ String.prototype._non_titlecased_words = InflectionJS.non_titlecased_words;
294
+ }
295
+
296
+ /*
297
+ This function adds plurilization support to every String object
298
+ Signature:
299
+ String.pluralize(plural) == String
300
+ Arguments:
301
+ plural - String (optional) - overrides normal output with said String
302
+ Returns:
303
+ String - singular English language nouns are returned in plural form
304
+ Examples:
305
+ "person".pluralize() == "people"
306
+ "octopus".pluralize() == "octopi"
307
+ "Hat".pluralize() == "Hats"
308
+ "person".pluralize("guys") == "guys"
309
+ */
310
+ if (!String.prototype.pluralize)
311
+ {
312
+ String.prototype.pluralize = function(plural)
313
+ {
314
+ return InflectionJS.apply_rules(
315
+ this,
316
+ this._plural_rules,
317
+ this._uncountable_words,
318
+ plural
319
+ );
320
+ };
321
+ }
322
+
323
+ /*
324
+ This function adds singularization support to every String object
325
+ Signature:
326
+ String.singularize(singular) == String
327
+ Arguments:
328
+ singular - String (optional) - overrides normal output with said String
329
+ Returns:
330
+ String - plural English language nouns are returned in singular form
331
+ Examples:
332
+ "people".singularize() == "person"
333
+ "octopi".singularize() == "octopus"
334
+ "Hats".singularize() == "Hat"
335
+ "guys".singularize("person") == "person"
336
+ */
337
+ if (!String.prototype.singularize)
338
+ {
339
+ String.prototype.singularize = function(singular)
340
+ {
341
+ return InflectionJS.apply_rules(
342
+ this,
343
+ this._singular_rules,
344
+ this._uncountable_words,
345
+ singular
346
+ );
347
+ };
348
+ }
349
+
350
+ /*
351
+ This function adds camelization support to every String object
352
+ Signature:
353
+ String.camelize(lowFirstLetter) == String
354
+ Arguments:
355
+ lowFirstLetter - boolean (optional) - default is to capitalize the first
356
+ letter of the results... passing true will lowercase it
357
+ Returns:
358
+ String - lower case underscored words will be returned in camel case
359
+ additionally '/' is translated to '::'
360
+ Examples:
361
+ "message_properties".camelize() == "MessageProperties"
362
+ "message_properties".camelize(true) == "messageProperties"
363
+ */
364
+ if (!String.prototype.camelize)
365
+ {
366
+ String.prototype.camelize = function(lowFirstLetter)
367
+ {
368
+ var str = this.toLowerCase();
369
+ var str_path = str.split('/');
370
+ for (var i = 0; i < str_path.length; i++)
371
+ {
372
+ var str_arr = str_path[i].split('_');
373
+ var initX = ((lowFirstLetter && i + 1 === str_path.length) ? (1) : (0));
374
+ for (var x = initX; x < str_arr.length; x++)
375
+ {
376
+ str_arr[x] = str_arr[x].charAt(0).toUpperCase() + str_arr[x].substring(1);
377
+ }
378
+ str_path[i] = str_arr.join('');
379
+ }
380
+ str = str_path.join('::');
381
+ return str;
382
+ };
383
+ }
384
+
385
+ /*
386
+ This function adds underscore support to every String object
387
+ Signature:
388
+ String.underscore() == String
389
+ Arguments:
390
+ N/A
391
+ Returns:
392
+ String - camel cased words are returned as lower cased and underscored
393
+ additionally '::' is translated to '/'
394
+ Examples:
395
+ "MessageProperties".camelize() == "message_properties"
396
+ "messageProperties".underscore() == "message_properties"
397
+ */
398
+ if (!String.prototype.underscore)
399
+ {
400
+ String.prototype.underscore = function()
401
+ {
402
+ var str = this;
403
+ var str_path = str.split('::');
404
+ for (var i = 0; i < str_path.length; i++)
405
+ {
406
+ str_path[i] = str_path[i].replace(InflectionJS.uppercase, '_$1');
407
+ str_path[i] = str_path[i].replace(InflectionJS.underbar_prefix, '');
408
+ }
409
+ str = str_path.join('/').toLowerCase();
410
+ return str;
411
+ };
412
+ }
413
+
414
+ /*
415
+ This function adds humanize support to every String object
416
+ Signature:
417
+ String.humanize(lowFirstLetter) == String
418
+ Arguments:
419
+ lowFirstLetter - boolean (optional) - default is to capitalize the first
420
+ letter of the results... passing true will lowercase it
421
+ Returns:
422
+ String - lower case underscored words will be returned in humanized form
423
+ Examples:
424
+ "message_properties".humanize() == "Message properties"
425
+ "message_properties".humanize(true) == "message properties"
426
+ */
427
+ if (!String.prototype.humanize)
428
+ {
429
+ String.prototype.humanize = function(lowFirstLetter)
430
+ {
431
+ var str = this.toLowerCase();
432
+ str = str.replace(InflectionJS.id_suffix, '');
433
+ str = str.replace(InflectionJS.underbar, ' ');
434
+ if (!lowFirstLetter)
435
+ {
436
+ str = str.capitalize();
437
+ }
438
+ return str;
439
+ };
440
+ }
441
+
442
+ /*
443
+ This function adds capitalization support to every String object
444
+ Signature:
445
+ String.capitalize() == String
446
+ Arguments:
447
+ N/A
448
+ Returns:
449
+ String - all characters will be lower case and the first will be upper
450
+ Examples:
451
+ "message_properties".capitalize() == "Message_properties"
452
+ "message properties".capitalize() == "Message properties"
453
+ */
454
+ if (!String.prototype.capitalize)
455
+ {
456
+ String.prototype.capitalize = function()
457
+ {
458
+ var str = this.toLowerCase();
459
+ str = str.substring(0, 1).toUpperCase() + str.substring(1);
460
+ return str;
461
+ };
462
+ }
463
+
464
+ /*
465
+ This function adds dasherization support to every String object
466
+ Signature:
467
+ String.dasherize() == String
468
+ Arguments:
469
+ N/A
470
+ Returns:
471
+ String - replaces all spaces or underbars with dashes
472
+ Examples:
473
+ "message_properties".capitalize() == "message-properties"
474
+ "Message Properties".capitalize() == "Message-Properties"
475
+ */
476
+ if (!String.prototype.dasherize)
477
+ {
478
+ String.prototype.dasherize = function()
479
+ {
480
+ var str = this;
481
+ str = str.replace(InflectionJS.space_or_underbar, '-');
482
+ return str;
483
+ };
484
+ }
485
+
486
+ /*
487
+ This function adds titleize support to every String object
488
+ Signature:
489
+ String.titleize() == String
490
+ Arguments:
491
+ N/A
492
+ Returns:
493
+ String - capitalizes words as you would for a book title
494
+ Examples:
495
+ "message_properties".titleize() == "Message Properties"
496
+ "message properties to keep".titleize() == "Message Properties to Keep"
497
+ */
498
+ if (!String.prototype.titleize)
499
+ {
500
+ String.prototype.titleize = function()
501
+ {
502
+ var str = this.toLowerCase();
503
+ str = str.replace(InflectionJS.underbar, ' ');
504
+ var str_arr = str.split(' ');
505
+ for (var x = 0; x < str_arr.length; x++)
506
+ {
507
+ var d = str_arr[x].split('-');
508
+ for (var i = 0; i < d.length; i++)
509
+ {
510
+ if (this._non_titlecased_words.indexOf(d[i].toLowerCase()) < 0)
511
+ {
512
+ d[i] = d[i].capitalize();
513
+ }
514
+ }
515
+ str_arr[x] = d.join('-');
516
+ }
517
+ str = str_arr.join(' ');
518
+ str = str.substring(0, 1).toUpperCase() + str.substring(1);
519
+ return str;
520
+ };
521
+ }
522
+
523
+ /*
524
+ This function adds demodulize support to every String object
525
+ Signature:
526
+ String.demodulize() == String
527
+ Arguments:
528
+ N/A
529
+ Returns:
530
+ String - removes module names leaving only class names (Ruby style)
531
+ Examples:
532
+ "Message::Bus::Properties".demodulize() == "Properties"
533
+ */
534
+ if (!String.prototype.demodulize)
535
+ {
536
+ String.prototype.demodulize = function()
537
+ {
538
+ var str = this;
539
+ var str_arr = str.split('::');
540
+ str = str_arr[str_arr.length - 1];
541
+ return str;
542
+ };
543
+ }
544
+
545
+ /*
546
+ This function adds tableize support to every String object
547
+ Signature:
548
+ String.tableize() == String
549
+ Arguments:
550
+ N/A
551
+ Returns:
552
+ String - renders camel cased words into their underscored plural form
553
+ Examples:
554
+ "MessageBusProperty".tableize() == "message_bus_properties"
555
+ */
556
+ if (!String.prototype.tableize)
557
+ {
558
+ String.prototype.tableize = function()
559
+ {
560
+ var str = this;
561
+ str = str.underscore().pluralize();
562
+ return str;
563
+ };
564
+ }
565
+
566
+ /*
567
+ This function adds classification support to every String object
568
+ Signature:
569
+ String.classify() == String
570
+ Arguments:
571
+ N/A
572
+ Returns:
573
+ String - underscored plural nouns become the camel cased singular form
574
+ Examples:
575
+ "message_bus_properties".classify() == "MessageBusProperty"
576
+ */
577
+ if (!String.prototype.classify)
578
+ {
579
+ String.prototype.classify = function()
580
+ {
581
+ var str = this;
582
+ str = str.camelize().singularize();
583
+ return str;
584
+ };
585
+ }
586
+
587
+ /*
588
+ This function adds foreign key support to every String object
589
+ Signature:
590
+ String.foreign_key(dropIdUbar) == String
591
+ Arguments:
592
+ dropIdUbar - boolean (optional) - default is to seperate id with an
593
+ underbar at the end of the class name, you can pass true to skip it
594
+ Returns:
595
+ String - camel cased singular class names become underscored with id
596
+ Examples:
597
+ "MessageBusProperty".foreign_key() == "message_bus_property_id"
598
+ "MessageBusProperty".foreign_key(true) == "message_bus_propertyid"
599
+ */
600
+ if (!String.prototype.foreign_key)
601
+ {
602
+ String.prototype.foreign_key = function(dropIdUbar)
603
+ {
604
+ var str = this;
605
+ str = str.demodulize().underscore() + ((dropIdUbar) ? ('') : ('_')) + 'id';
606
+ return str;
607
+ };
608
+ }
609
+
610
+ /*
611
+ This function adds ordinalize support to every String object
612
+ Signature:
613
+ String.ordinalize() == String
614
+ Arguments:
615
+ N/A
616
+ Returns:
617
+ String - renders all found numbers their sequence like "22nd"
618
+ Examples:
619
+ "the 1 pitch".ordinalize() == "the 1st pitch"
620
+ */
621
+ if (!String.prototype.ordinalize)
622
+ {
623
+ String.prototype.ordinalize = function()
624
+ {
625
+ var str = this;
626
+ var str_arr = str.split(' ');
627
+ for (var x = 0; x < str_arr.length; x++)
628
+ {
629
+ var i = parseInt(str_arr[x]);
630
+ if (i === NaN)
631
+ {
632
+ var ltd = str_arr[x].substring(str_arr[x].length - 2);
633
+ var ld = str_arr[x].substring(str_arr[x].length - 1);
634
+ var suf = "th";
635
+ if (ltd != "11" && ltd != "12" && ltd != "13")
636
+ {
637
+ if (ld === "1")
638
+ {
639
+ suf = "st";
640
+ }
641
+ else if (ld === "2")
642
+ {
643
+ suf = "nd";
644
+ }
645
+ else if (ld === "3")
646
+ {
647
+ suf = "rd";
648
+ }
649
+ }
650
+ str_arr[x] += suf;
651
+ }
652
+ }
653
+ str = str_arr.join(' ');
654
+ return str;
655
+ };
656
+ }
@@ -0,0 +1,34 @@
1
+ Ext.define('FastUI.store.MListMgr', {
2
+ singleton:true,
3
+ _lists_:{},
4
+ getStore:function (list_id) {
5
+ var gs = this._lists_[list_id];
6
+ if(!gs){
7
+ gs = this.createStore(list_id);
8
+ this._lists_[list_id] = gs;
9
+ }
10
+ return gs;
11
+ },
12
+ createStore:function (list_id) {
13
+ var store = new Ext.data.JsonStore({
14
+ autoLoad:false,
15
+ fields:['id', 'name', 'title'],
16
+ proxy:{
17
+ type:'ajax',
18
+ url:'/fastui/m_list_items.json?list_name='+ list_id,
19
+ reader:{
20
+ type:'json',
21
+ root:''
22
+ }
23
+ }
24
+ });
25
+ Ext.apply(Ext.data.Connection.prototype, {
26
+ async:false
27
+ });
28
+ store.load();
29
+ Ext.apply(Ext.data.Connection.prototype, {
30
+ async:true
31
+ });
32
+ return store;
33
+ }
34
+ });