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,58 @@
1
+ require_dependency "fastui/application_controller"
2
+
3
+ module Fastui
4
+ class MMenusController < ApplicationController
5
+ respond_to :html, :xml, :json
6
+ def index
7
+ @m_menus = MMenu.scoped
8
+ data = paginate(@m_menus)
9
+ respond_with(data.to_json(:include => [:m_menu_items,:createdbyorg, :createdby, :updatedby]))
10
+ end
11
+
12
+ def show
13
+ @m_menu = MMenu.find(params[:id])
14
+ respond_with(@m_menu)
15
+ end
16
+
17
+ def edit
18
+ @m_menu = MMenu.find(params[:id])
19
+ respond_with(@m_menu.to_json(:include => [:createdbyorg, :createdby, :updatedby]))
20
+ end
21
+
22
+ def new
23
+ @m_menu = MMenu.new
24
+ respond_with(@m_menu)
25
+ end
26
+
27
+ def create
28
+ @m_menu = MMenu.new(params[:m_menu])
29
+ respond_with(@m_menu) do |format|
30
+ if @m_menu.save
31
+ format.json { render :json => {:success => true, :msg => 'ok'} }
32
+ else
33
+ format.json { render :json => {:success => false, :msg => 'failure'} }
34
+ end
35
+ end
36
+
37
+ end
38
+
39
+ def update
40
+ @m_menu = MMenu.find(params[:id])
41
+
42
+ respond_with(@m_menu) do |format|
43
+ if @m_menu.update_attributes(params[:m_menu])
44
+ format.json { render :json => {:success => true, :msg => 'ok'} }
45
+ else
46
+ format.json { render :json => {:success => false, :msg => 'false'} }
47
+ end
48
+ end
49
+ end
50
+
51
+ def destroy
52
+ @m_menu = MMenu.find(params[:id])
53
+ @m_menu.destroy
54
+ respond_with(@m_menu)
55
+ end
56
+
57
+ end
58
+ end
@@ -0,0 +1,62 @@
1
+ require_dependency "fastui/application_controller"
2
+
3
+ module Fastui
4
+ class MOrgsController < ApplicationController
5
+ respond_to :html, :xml, :json
6
+
7
+ def index
8
+ #@m_orgs = MOrg.scoped
9
+ @m_orgs = params[:node] == 'root' ? MOrg.roots : MOrg.where({
10
+ :parent_id => params[:node]
11
+ }.delete_if { |k, v| v.blank? })
12
+
13
+ respond_with(@m_orgs.to_json(:include => [:parent], :methods => [:leaf?, :child?]))
14
+ end
15
+
16
+ def show
17
+ @m_org = MOrg.find(params[:id])
18
+ respond_with(@m_org)
19
+ end
20
+
21
+ def edit
22
+ @m_org = MOrg.find(params[:id])
23
+ respond_with(@m_org.to_json(:include => [:parent]))
24
+ end
25
+
26
+ def new
27
+ @m_org = MOrg.new
28
+ respond_with(@m_org)
29
+ end
30
+
31
+ def create
32
+ @m_org = MOrg.new(params[:m_org])
33
+ respond_with(@m_org) do |format|
34
+ if @m_org.save
35
+ format.json { render :json => {:success => true, :msg => 'ok'} }
36
+ else
37
+ format.json { render :json => {:success => false, :msg => 'failure'} }
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ def update
44
+ @m_org = MOrg.find(params[:id])
45
+
46
+ respond_with(@m_org) do |format|
47
+ if @m_org.update_attributes(params[:m_org])
48
+ format.json { render :json => {:success => true, :msg => 'ok'} }
49
+ else
50
+ format.json { render :json => {:success => false, :msg => 'false'} }
51
+ end
52
+ end
53
+ end
54
+
55
+ def destroy
56
+ @m_org = MOrg.find(params[:id])
57
+ @m_org.destroy
58
+ respond_with(@m_org)
59
+ end
60
+
61
+ end
62
+ end
@@ -0,0 +1,89 @@
1
+ require_dependency "fastui/application_controller"
2
+
3
+ module Fastui
4
+ class MPeopleController < ApplicationController
5
+ respond_to :html, :xml, :json
6
+
7
+ def index
8
+ #limit = params[:limit].to_i
9
+ #start = params[:start].to_i
10
+ #search = params[:search]
11
+ #if search.blank?
12
+ # @m_people = MPerson.all
13
+ # @records = MPerson.limit(limit).offset(start)
14
+ #else
15
+ # @m_people = MPerson.where("title LIKE :input", {:input => "%#{search}%"})
16
+ # @records = @m_people.limit(limit).offset(start)
17
+ #end
18
+ #data ={
19
+ # :totalCount => @m_people.length,
20
+ # :rows => @records
21
+ #}
22
+ @m_people = MPerson.scoped
23
+ data = paginate(@m_people)
24
+ respond_with(data.to_json)
25
+ end
26
+
27
+ def show
28
+ @m_person = MPerson.find(params[:id])
29
+ respond_with(@m_person)
30
+ end
31
+
32
+ def edit
33
+ @m_person = MPerson.find(params[:id])
34
+ respond_with(@m_person)
35
+ end
36
+
37
+ def new
38
+ @m_person = MPerson.new
39
+ respond_with(@m_person)
40
+ end
41
+
42
+ def create
43
+ @m_person = MPerson.new(params[:m_person])
44
+ respond_with(@m_person) do |format|
45
+ if @m_person.save
46
+ format.json { render :json => {:success => true, :msg => 'ok'} }
47
+ else
48
+ format.json { render :json => {:success => false, :msg => 'failure'} }
49
+ end
50
+ end
51
+
52
+ end
53
+
54
+ def update
55
+ @m_person = MPerson.find(params[:id])
56
+
57
+ respond_with(@m_person) do |format|
58
+ if @m_person.update_attributes(params[:m_person])
59
+ format.json { render :json => {:success => true, :msg => 'ok'} }
60
+ else
61
+ format.json { render :json => {:success => false, :msg => 'false'} }
62
+ end
63
+ end
64
+ end
65
+
66
+ def destroy
67
+ @m_person = MPerson.find(params[:id])
68
+ @m_person.destroy
69
+ respond_with(@m_person)
70
+ end
71
+
72
+ def login
73
+ @m_person = MPerson.where(:name => params[:UserName]).first_or_initialize
74
+ respond_with(@m_person) do |format|
75
+ if @m_person
76
+ format.json { render :json => {:success => true, :msg => 'ok'} }
77
+ else
78
+ format.json { render :json => {:success => false, :msg => 'false'} }
79
+ end
80
+ end
81
+
82
+ end
83
+
84
+ def logout
85
+
86
+ end
87
+
88
+ end
89
+ end
@@ -0,0 +1,61 @@
1
+ require_dependency "fastui/application_controller"
2
+
3
+ module Fastui
4
+ class MRolesController < ApplicationController
5
+ respond_to :html, :xml, :json
6
+
7
+ def index
8
+ @m_roles = MRole.scoped
9
+ data = paginate(@m_roles)
10
+ respond_with(data.to_json({:include => :people,:methods => :person_ids}))
11
+ end
12
+
13
+ def show
14
+ @m_role = MRole.find(params[:id])
15
+ respond_with(@m_role)
16
+ end
17
+
18
+ def edit
19
+ @m_role = MRole.find(params[:id])
20
+ respond_with(@m_role.to_json({:include => :people,:methods => :person_ids}))
21
+ end
22
+
23
+ def new
24
+ @m_role = MRole.new
25
+ respond_with(@m_role)
26
+ end
27
+
28
+ def create
29
+ @m_role = MRole.new(params[:m_role])
30
+ respond_with(@m_role) do |format|
31
+ if @m_role.save
32
+ format.json { render :json => {:success => true, :msg => 'ok'} }
33
+ else
34
+ format.json { render :json => {:success => false, :msg => 'failure'} }
35
+ end
36
+ end
37
+
38
+ end
39
+
40
+ def update
41
+ @m_role = MRole.find(params[:id])
42
+
43
+ respond_with(@m_role) do |format|
44
+ if @m_role.update_attributes(params[:m_role])
45
+ format.json { render :json => {:success => true, :msg => 'ok'} }
46
+ else
47
+ format.json { render :json => {:success => false, :msg => 'false'} }
48
+ end
49
+ end
50
+ end
51
+
52
+ def destroy
53
+ @m_role = MRole.find(params[:id])
54
+ @m_role.destroy
55
+ respond_with(@m_role)
56
+ end
57
+
58
+
59
+
60
+ end
61
+ end
@@ -0,0 +1,18 @@
1
+ require_dependency "fastui/application_controller"
2
+
3
+ module Fastui
4
+ class MViewsController < ApplicationController
5
+ respond_to :html, :xml, :json
6
+ def index
7
+
8
+ @window = Fastui::Window.find(params[:name])
9
+ #respond_with(@window.to_json(root: false,:include => { :tabs => {root:false}}))
10
+ respond_with(@window.to_json())
11
+ end
12
+
13
+ def show
14
+ @window = Fastui::Window.find(params[:id])
15
+ respond_with(@window.to_json())
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,42 @@
1
+ require_dependency "fastui/application_controller"
2
+
3
+ module Fastui
4
+ class SessionsController < ApplicationController
5
+ respond_to :html, :xml, :json
6
+ def login
7
+ klass = params[:type] || 'Fastui::MPerson'
8
+ user = klass.constantize.where(username: params[:username]).first
9
+
10
+ respond_with(user) do |format|
11
+ if UserAuthenticator.new(user).authenticate(params[:password])
12
+ format.json { render :json => {:success => true, :msg => 'ok'} }
13
+ else
14
+ format.json { render :json => {:success => false, :msg => 'false'} }
15
+ end
16
+ end
17
+
18
+ #if UserAuthenticator.new(user).authenticate(params[:password])
19
+ # #self.current_user = user
20
+ # redirect_to '/fastui'
21
+ ##else
22
+ # flash[:alert] = "Login failed."
23
+ # render "new"
24
+ #end
25
+
26
+ end
27
+
28
+ def logout
29
+
30
+ end
31
+
32
+ # assign them a random one and mail it to them, asking them to change it
33
+ def forgot_password
34
+ klass = params[:type] || 'Fastui::MPerson'
35
+ @user = klass.constantize.where(username:params[:username])
36
+ random_password = Array.new(10).map { (65 + rand(58)).chr }.join
37
+ @user.password = random_password
38
+ @user.save!
39
+ #Mailer.create_and_deliver_password_change(@user, random_password)
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,4 @@
1
+ module Fastui
2
+ module AdminHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Fastui
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,21 @@
1
+ module Fastui
2
+ class Acl
3
+ include Singleton
4
+
5
+ def initialize
6
+ @entries = MAclEntry.all
7
+ end
8
+
9
+ def allow(aros = "*", acos = "*", permit = "*")
10
+ aros = [aros] unless aros.is_a?(Array)
11
+ acos = [acos] unless acos.is_a?(Array)
12
+ aros.each do |aro|
13
+ acos.each do |aco|
14
+ entry = MAclEntry.first_or_initialize(:aro_type =>aro.class.to_s, :aro_id => aro.id, :aco_type =>aco.class.to_s, :aco_id => aco.id)
15
+ entry.permit = permit
16
+ entry.save
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,15 @@
1
+ module Fastui
2
+ class Ctx
3
+ def initialize
4
+ @data = {}
5
+ end
6
+
7
+ def set(key,value)
8
+ @data[key.to_s] = value
9
+ end
10
+
11
+ def get(key)
12
+ @data[key.to_s]
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ module Fastui
2
+ class Env
3
+ @ctx = Ctx.new
4
+ class << self
5
+ attr_reader :ctx
6
+ def set(key,value)
7
+ @ctx.set(key,value)
8
+ end
9
+
10
+ def get(key)
11
+ @ctx.get(key)
12
+ end
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Fastui
2
+ class MAclEntry < MObject
3
+ # attr_accessible :title, :body
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ module Fastui
2
+ class MList < MObject
3
+
4
+ has_many :m_list_items, :class_name => 'Fastui::MListItem'
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ module Fastui
2
+ class MListItem < MObject
3
+ attr_accessible :m_list,:m_list_id
4
+
5
+ belongs_to :m_list, :class_name => 'Fastui::MList'
6
+
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+ module Fastui
3
+ class MMenu < MObject
4
+
5
+ has_many :m_menu_items, :class_name => 'Fastui::MMenuItem'
6
+
7
+
8
+
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+ require_dependency "awesome_nested_set"
3
+ module Fastui
4
+ class MMenuItem < MObject
5
+ acts_as_nested_set
6
+ attr_accessible :m_menu_id, :m_menu, :window, :parent_id
7
+
8
+ belongs_to :m_menu, :class_name => 'Fastui::MMenu'
9
+
10
+ end
11
+ end
@@ -0,0 +1,41 @@
1
+ # encoding: utf-8
2
+ module Fastui
3
+ class MObject < ActiveRecord::Base
4
+ self.abstract_class = true
5
+
6
+ attr_accessible :id, :name, :title, :print_text, :note, :entity_kind, :is_active, :seq, :help
7
+ attr_accessible :createdbyorg_id,:createdbyorg, :createdby_id,:createdby,:updatedby_id,:updatedby
8
+
9
+ belongs_to :createdbyorg, :class_name => 'Fastui::MOrg'
10
+ belongs_to :createdby, :class_name => 'Fastui::MPerson'
11
+ belongs_to :updatedby, :class_name => 'Fastui::MPerson'
12
+
13
+ #before_create do |mo|
14
+ # mo.org_id = Env.ctx.get(:g_org_id) || mo.org_id
15
+ # mo.createdby_id = Env.ctx.get(:g_person_id) || mo.createdby_id
16
+ # mo.updatedby_id = Env.ctx.get(:g_person_id) || mo.updatedby_id
17
+ #end
18
+ #
19
+ #before_update do |mo|
20
+ # mo.updatedby_id = Env.ctx.get(:g_person_id) || mo.updatedby_id
21
+ #end
22
+
23
+ #opts={name:'',members:'',extends:''}
24
+
25
+
26
+ class << self
27
+ #def window(opts)
28
+ # Fastui::View.instance.window(opts)
29
+ #end
30
+ #
31
+ #def tab(opts)
32
+ # Fastui::View.instance.tab(opts)
33
+ #end
34
+
35
+ def ui(&block)
36
+ Fastui::View.instance.config(&block) if block_given?
37
+ end
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require_dependency "awesome_nested_set"
3
+ module Fastui
4
+ class MOrg < MObject
5
+ attr_accessible :parent_id, :parent
6
+ acts_as_nested_set
7
+
8
+ has_many :m_relationships, :foreign_key => 'm_org_id', :class_name => 'Fastui::MRelationship'
9
+ has_many :act_roles, :through => :m_relationships, :source => :m_role
10
+ has_many :actors, :through => :m_relationships, :source => :m_person
11
+
12
+ belongs_to :parent, :class_name => 'Fastui::MOrg'
13
+
14
+
15
+ end
16
+ end
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+ require 'bcrypt'
3
+ module Fastui
4
+ class MPerson < MObject
5
+ attr_accessible :username, :password, :access_level
6
+ has_many :m_relationships, :foreign_key => 'm_person_id', :class_name => 'Fastui::MRelationship'
7
+ has_many :act_roles, :through => :m_relationships, :source => :m_role
8
+ has_many :join_orgs, :through => :m_relationships, :source => :m_org
9
+
10
+ # users.password_digest in the database is a :string
11
+ include BCrypt
12
+
13
+ def password
14
+ @password ||= Password.new(self.password_digest)
15
+ end
16
+
17
+ def password=(new_password)
18
+ self.password_digest = Password.create(new_password)
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ module Fastui
2
+ class MRelationship < MObject
3
+ attr_accessible :m_person_id,:m_org_id,:m_role_id
4
+
5
+ belongs_to :m_person, :class_name => 'Fastui::MPerson'
6
+ belongs_to :m_org, :class_name => 'Fastui::MOrg'
7
+ belongs_to :m_role, :class_name => 'Fastui::MRole'
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module Fastui
2
+ class MRole < MObject
3
+ # attr_accessible :title, :body
4
+ attr_accessible :person_ids
5
+ has_many :m_relationships, :foreign_key => 'm_role_id', :class_name => 'Fastui::MRelationship'
6
+ has_many :people, :through => :m_relationships, :source => :m_person
7
+
8
+
9
+
10
+ end
11
+ end
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+ module Fastui
3
+ class UserAuthenticator
4
+ def initialize(user)
5
+ @user = user
6
+ end
7
+
8
+ def authenticate(unencrypted_password)
9
+ return false unless @user
10
+ if @user.password == unencrypted_password
11
+ @user
12
+ else
13
+ false
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,2 @@
1
+ <!-- "Loading" Splash Screen -->
2
+ <div id="fastui-loading"><span class="title">Loading Application</span><span class="logo"></span></div>
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <title><%= Fastui::View.instance.project %></title>
6
+ <link href="http://cdn.sencha.com/ext/gpl/4.2.0/resources/css/ext-all.css" rel="stylesheet" />
7
+ <script type="text/javascript" charset="utf-8" src="http://cdn.sencha.io/ext-4.2.0-gpl/ext-all.js"></script>
8
+ <%= stylesheet_link_tag "fastui/application", :media => "all" %>
9
+ <%= javascript_include_tag "fastui/application" %>
10
+ <script type='text/javascript'>
11
+ var app_project = '<%= Fastui::View.instance.project %>';
12
+ var app_version = '<%= Fastui::View.instance.version %>';
13
+ var app_copyright = '<%= Fastui::View.instance.copyright %>';
14
+ </script>
15
+ <%= csrf_meta_tags %>
16
+ </head>
17
+ <body>
18
+
19
+ <%= yield %>
20
+
21
+ </body>
22
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,19 @@
1
+ Fastui::Engine.routes.draw do
2
+ resources :m_views
3
+ resources :m_lists do
4
+ resources :m_list_items
5
+ end
6
+ resources :m_lists
7
+ resources :m_list_items
8
+ resources :m_orgs
9
+ resources :m_people
10
+ resources :m_roles
11
+ resources :m_menus
12
+ resources :m_menu_items
13
+ resources :sessions do
14
+ collection do
15
+ post 'login'
16
+ end
17
+ end
18
+ root :to => "admin#index"
19
+ end
@@ -0,0 +1,28 @@
1
+ class CreateFastuiMMenuItems < ActiveRecord::Migration
2
+ def change
3
+ create_table :fastui_m_menu_items do |t|
4
+ t.references :m_menu
5
+ t.string :title, :limit => 60, :null => false
6
+ t.string :print_text,:default => '',:limit => 60
7
+ t.string :name,:default => '', :limit => 60
8
+ t.string :window,:default => '', :limit => 60
9
+
10
+ t.integer :parent_id
11
+ t.integer :lft
12
+ t.integer :rgt
13
+ t.integer :depth # this is optional.
14
+
15
+ t.string :entity_kind, :default => '' #:sys,:app
16
+ t.integer :seq, :default => 0
17
+ t.boolean :is_active, :default => true
18
+ t.string :note, :default => ''
19
+ t.string :help, :default => ''
20
+ t.integer :createdbyorg_id, :default => 0
21
+ t.integer :createdby_id, :default => 0
22
+ t.integer :updatedby_id, :default => 0
23
+
24
+ t.timestamps
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,20 @@
1
+ class CreateFastuiMMenus < ActiveRecord::Migration
2
+ def change
3
+ create_table :fastui_m_menus do |t|
4
+ t.string :title, :limit => 60, :null => false
5
+ t.string :print_text,:default => '',:limit => 60
6
+ t.string :name,:default => '', :limit => 60
7
+
8
+ t.string :entity_kind, :default => 'app' #:sys,:app
9
+ t.integer :seq, :default => 0
10
+ t.boolean :is_active, :default => true
11
+ t.string :note, :default => ''
12
+ t.string :help, :default => ''
13
+ t.integer :createdbyorg_id, :default => 0
14
+ t.integer :createdby_id, :default => 0
15
+ t.integer :updatedby_id, :default => 0
16
+
17
+ t.timestamps
18
+ end
19
+ end
20
+ end