gestion 1.9.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +48 -0
  3. data/.project +14 -0
  4. data/Binaries/adduser_to_buzz +15 -0
  5. data/Binaries/backup +7 -0
  6. data/Binaries/check_gestion +8 -0
  7. data/Binaries/gestion.gnumail +22 -0
  8. data/Binaries/gestion.logrotate +34 -0
  9. data/Binaries/gestion.service +12 -0
  10. data/Binaries/gestion_update.rb +183 -0
  11. data/Binaries/gestion_update.service +10 -0
  12. data/Binaries/get_compta +11 -0
  13. data/Binaries/kill_gestion +16 -0
  14. data/Binaries/ldap/add_indexes +51 -0
  15. data/Binaries/ldap/backup +2 -0
  16. data/Binaries/ldap/install_ldap +92 -0
  17. data/Binaries/ldap/restore +7 -0
  18. data/Binaries/lib_backup +5 -0
  19. data/Binaries/log_scan_errors +8 -0
  20. data/Binaries/loop_gestion +64 -0
  21. data/Binaries/onetimers/sync_courses_from_compta.rb +74 -0
  22. data/Binaries/onetimers/transfer_cash_from_ldap_to_csv +26 -0
  23. data/Binaries/reboot +5 -0
  24. data/Binaries/restore +3 -0
  25. data/Binaries/restore_do +22 -0
  26. data/Binaries/sort_events +31 -0
  27. data/Binaries/start_gestion +18 -0
  28. data/Binaries/swipe_gestion +18 -0
  29. data/Binaries/update_africompta +21 -0
  30. data/Binaries/update_users +3 -0
  31. data/Diplomas.src/accredited.odg +0 -0
  32. data/Diplomas.src/diploma.odg +0 -0
  33. data/Diplomas.src/label.odg +0 -0
  34. data/Diplomas.src/presence_sheet.ods +0 -0
  35. data/Diplomas.src/presence_sheet_small.ods +0 -0
  36. data/Diplomas.src/student_card.odg +0 -0
  37. data/Doc/130514-it-ideas.odt +0 -0
  38. data/Doc/Compta-cash.mm +179 -0
  39. data/Doc/General.odt +0 -0
  40. data/Entities/AccessGroups.rb +117 -0
  41. data/Entities/Activity.rb +178 -0
  42. data/Entities/ChatMsg.rb +142 -0
  43. data/Entities/Classroom.rb +11 -0
  44. data/Entities/Client.rb +19 -0
  45. data/Entities/Computer.rb +21 -0
  46. data/Entities/ConfigBase.rb +280 -0
  47. data/Entities/Course.rb +1588 -0
  48. data/Entities/CourseType.rb +171 -0
  49. data/Entities/DFiles.rb +466 -0
  50. data/Entities/FilesManage.rb +226 -0
  51. data/Entities/Grade.rb +186 -0
  52. data/Entities/Internet.rb +300 -0
  53. data/Entities/Netdev.rb +10 -0
  54. data/Entities/Person.rb +1175 -0
  55. data/Entities/Plug.rb +98 -0
  56. data/Entities/Quiz.rb +33 -0
  57. data/Entities/Recharges.rb +37 -0
  58. data/Entities/Report.rb +136 -0
  59. data/Entities/Room.rb +12 -0
  60. data/Entities/SMS.rb +30 -0
  61. data/Entities/ScheduleType.rb +33 -0
  62. data/Entities/Share.rb +120 -0
  63. data/Entities/Task.rb +51 -0
  64. data/Entities/Ticket.rb +72 -0
  65. data/Entities/Usage.rb +143 -0
  66. data/Entities/Worker.rb +29 -0
  67. data/Files/apache-profeda.conf +36 -0
  68. data/Files/label.erb +121 -0
  69. data/Files/label_notfound.erb +64 -0
  70. data/Files/label_notpassed.erb +84 -0
  71. data/Files/mobileinfo.erb +115 -0
  72. data/Files/smb.conf +333 -0
  73. data/Files/timetable.html +36 -0
  74. data/Files/timetable.js +239 -0
  75. data/Gemfile +12 -0
  76. data/Gemfile.dev +12 -0
  77. data/Gemfile.dev.lock +127 -0
  78. data/Gemfile.lock +127 -0
  79. data/Gemfile.prod +8 -0
  80. data/Gestion +35 -0
  81. data/Gestion.rb +220 -0
  82. data/INSTALL +40 -0
  83. data/Images/connection.xcf +0 -0
  84. data/Images/connection_no.png +0 -0
  85. data/Images/connection_wait.png +0 -0
  86. data/Images/connection_yes.png +0 -0
  87. data/Paths/Exas.rb +13 -0
  88. data/Paths/Files.rb +19 -0
  89. data/Paths/GetDiplomas.rb +20 -0
  90. data/Paths/Info.rb +114 -0
  91. data/Paths/Label.rb +187 -0
  92. data/Paths/MobileInfo.rb +19 -0
  93. data/Paths/internetCash.rb +34 -0
  94. data/Paths/internetWifi.rb +54 -0
  95. data/README.md +60 -0
  96. data/Rakefile +13 -0
  97. data/TODO +1391 -0
  98. data/Test/.gitignore +3 -0
  99. data/Test/Diplomas/base_gestion.odt +0 -0
  100. data/Test/Diplomas/base_report.odt +0 -0
  101. data/Test/Diplomas/carte_etudiant.odg +0 -0
  102. data/Test/Diplomas/exam_language.odt +0 -0
  103. data/Test/Diplomas/label.odg +0 -0
  104. data/Test/Diplomas/presence_sheet.ods +0 -0
  105. data/Test/Diplomas/presence_sheet_small.ods +0 -0
  106. data/Test/Diplomas/student_card.odg +0 -0
  107. data/Test/Manual/testMerge +18 -0
  108. data/Test/config_test.yaml +26 -0
  109. data/Test/db.testGestion +0 -0
  110. data/Test/dfiles/descs/avg-rescue.desc +10 -0
  111. data/Test/dfiles/descs/avg.desc +8 -0
  112. data/Test/dfiles/descs/driver.desc +8 -0
  113. data/Test/dfiles/descs/linuxmint.desc +7 -0
  114. data/Test/dfiles/files/avg-160203.exe +1 -0
  115. data/Test/dfiles/files/avg.iso +1 -0
  116. data/Test/dfiles/files/driver.exe +1 -0
  117. data/Test/dfiles/index_post.html +3 -0
  118. data/Test/dfiles/index_pre.html +8 -0
  119. data/Test/dfiles/priorities +5 -0
  120. data/Test/ge_activity.rb +124 -0
  121. data/Test/ge_chat.rb +106 -0
  122. data/Test/ge_compta.rb +67 -0
  123. data/Test/ge_configbase.rb +54 -0
  124. data/Test/ge_course.rb +1114 -0
  125. data/Test/ge_dfiles.rb +121 -0
  126. data/Test/ge_filesmanage.rb +180 -0
  127. data/Test/ge_info.rb +27 -0
  128. data/Test/ge_internet.rb +246 -0
  129. data/Test/ge_login.rb +55 -0
  130. data/Test/ge_person.rb +373 -0
  131. data/Test/ge_qvinfo.rb +28 -0
  132. data/Test/ge_report.rb +97 -0
  133. data/Test/ge_share.rb +27 -0
  134. data/Test/ge_sms.rb +34 -0
  135. data/Test/ge_tasks.rb +19 -0
  136. data/Test/ge_usage.rb +168 -0
  137. data/Test/ge_view.rb +46 -0
  138. data/Test/multiconf-captive +29 -0
  139. data/Test/test.conf +7 -0
  140. data/Test/test.rb +49 -0
  141. data/Test/test_bytes.png +0 -0
  142. data/VERSION +140 -0
  143. data/Views/Admin/Backup.rb +91 -0
  144. data/Views/Admin/Configuration.rb +44 -0
  145. data/Views/Admin/Credit.rb +32 -0
  146. data/Views/Admin/FilesManage.rb +219 -0
  147. data/Views/Admin/Function.rb +39 -0
  148. data/Views/Admin/Power.rb +49 -0
  149. data/Views/Admin/Printer.rb +37 -0
  150. data/Views/Admin/Server.rb +252 -0
  151. data/Views/Admin/Tabs.rb +5 -0
  152. data/Views/Admin/Update.rb +73 -0
  153. data/Views/Admin/UpdateSystem.rb +26 -0
  154. data/Views/Cashbox/Activity.rb +191 -0
  155. data/Views/Cashbox/Course.rb +141 -0
  156. data/Views/Cashbox/Credit.rb +79 -0
  157. data/Views/Cashbox/Report.rb +115 -0
  158. data/Views/Cashbox/Service.rb +105 -0
  159. data/Views/Cashbox/Tabs.rb +10 -0
  160. data/Views/Compta/Accounts.rb +36 -0
  161. data/Views/Compta/Course.rb +96 -0
  162. data/Views/Compta/Show.rb +6 -0
  163. data/Views/Compta/Transfer.rb +66 -0
  164. data/Views/Course/Diploma.rb +203 -0
  165. data/Views/Course/Grade.rb +401 -0
  166. data/Views/Course/Modify.rb +447 -0
  167. data/Views/Course/Print.rb +94 -0
  168. data/Views/Course/Responsible.rb +44 -0
  169. data/Views/Course/Stats.rb +76 -0
  170. data/Views/Course/Students.rb +92 -0
  171. data/Views/Course/Tabs.rb +220 -0
  172. data/Views/Internet/Access.rb +134 -0
  173. data/Views/Internet/ClassEdit.rb +24 -0
  174. data/Views/Internet/ClassUsers.rb +81 -0
  175. data/Views/Internet/Config.rb +32 -0
  176. data/Views/Internet/Mobile.rb +213 -0
  177. data/Views/Internet/Recharges.rb +49 -0
  178. data/Views/Internet/Tabs.rb +6 -0
  179. data/Views/Inventory/Computer.rb +24 -0
  180. data/Views/Inventory/Room.rb +18 -0
  181. data/Views/Inventory/Tabs.rb +9 -0
  182. data/Views/Inventory/TicketClosed.rb +7 -0
  183. data/Views/Inventory/TicketOpen.rb +23 -0
  184. data/Views/Library/Person.rb +36 -0
  185. data/Views/Library/Tabs.rb +7 -0
  186. data/Views/Network/Block.rb +87 -0
  187. data/Views/Network/Netdevs.rb +21 -0
  188. data/Views/Network/Restriction.rb +37 -0
  189. data/Views/Network/Share.rb +167 -0
  190. data/Views/Network/Tables.rb +28 -0
  191. data/Views/Network/Tabs.rb +6 -0
  192. data/Views/Person/Admin.rb +99 -0
  193. data/Views/Person/Center.rb +48 -0
  194. data/Views/Person/Course.rb +72 -0
  195. data/Views/Person/Modify.rb +153 -0
  196. data/Views/Person/Tabs.rb +162 -0
  197. data/Views/Report/ComptaExecutive.rb +221 -0
  198. data/Views/Report/ComptaFlat.rb +79 -0
  199. data/Views/Report/ReportCourse.rb +47 -0
  200. data/Views/Report/Tabs.rb +8 -0
  201. data/Views/Report/Usage.rb +52 -0
  202. data/Views/Report/UsageCases.rb +59 -0
  203. data/Views/Self/Cash.rb +67 -0
  204. data/Views/Self/Chat.rb +55 -0
  205. data/Views/Self/Concours.rb +109 -0
  206. data/Views/Self/Email.rb +34 -0
  207. data/Views/Self/Internet.rb +255 -0
  208. data/Views/Self/Results.rb +17 -0
  209. data/Views/Self/Services.rb +85 -0
  210. data/Views/Self/Show.rb +47 -0
  211. data/Views/Self/Tabs.rb +5 -0
  212. data/Views/Special/DFileEdit.rb +13 -0
  213. data/Views/Special/PlugEdit.rb +56 -0
  214. data/Views/Special/Tabs.rb +6 -0
  215. data/Views/Special/Vnc.rb +39 -0
  216. data/Views/Task/Client.rb +21 -0
  217. data/Views/Task/Edit.rb +33 -0
  218. data/Views/Task/List.rb +55 -0
  219. data/Views/Task/Tabs.rb +9 -0
  220. data/Views/Task/Worker.rb +30 -0
  221. data/Views/Template/Activity.rb +33 -0
  222. data/Views/Template/CourseType.rb +63 -0
  223. data/Views/Template/ScheduleType.rb +29 -0
  224. data/Views/Template/Tabs.rb +5 -0
  225. data/Views/Welcome.rb +121 -0
  226. data/config.yaml.default +36 -0
  227. data/po/Gestion-ar.po +2356 -0
  228. data/po/Gestion-en.mo +0 -0
  229. data/po/Gestion-en.po +4363 -0
  230. data/po/Gestion-fr.mo +0 -0
  231. data/po/Gestion-fr.po +4345 -0
  232. data/po/traduction-ar.rtf +76 -0
  233. metadata +381 -0
data/Gemfile.dev.lock ADDED
@@ -0,0 +1,127 @@
1
+ PATH
2
+ remote: ../AfriCompta
3
+ specs:
4
+ africompta (1.9.11)
5
+ prawn (= 1.0.0)
6
+ qooxview (= 1.9.11)
7
+
8
+ PATH
9
+ remote: ../HelperClasses
10
+ specs:
11
+ helper_classes (0.3.5)
12
+
13
+ PATH
14
+ remote: ../HilinkModem
15
+ specs:
16
+ hilink_modem (0.3.5)
17
+ activesupport (~> 5.1)
18
+ serialport (~> 1.3)
19
+
20
+ PATH
21
+ remote: ../Network
22
+ specs:
23
+ network (0.3.5)
24
+ chunky_png (= 1.3.4)
25
+ helper_classes (= 0.3.5)
26
+ hilink_modem (= 0.3.5)
27
+ i18n (= 0.7.0)
28
+ multi_json (= 1.0.3)
29
+ serial_modem (= 0.3.5)
30
+
31
+ PATH
32
+ remote: ../QooxView
33
+ specs:
34
+ qooxview (1.9.11)
35
+ activemodel (= 5.1.0)
36
+ activerecord (= 5.1.0)
37
+ activesupport (= 5.1.0)
38
+ arel (= 8.0)
39
+ chunky_png (= 1.3.4)
40
+ docsplit (= 0.7.6)
41
+ gettext (= 3.0.0)
42
+ helper_classes (= 0.3.5)
43
+ i18n (= 0.7.0)
44
+ iconv (= 1.0.3)
45
+ iniparse (= 1.4.0)
46
+ json (= 2.1.0)
47
+ locale (= 2.0.8)
48
+ multi_json (= 1.0.3)
49
+ net-ldap (= 0.16)
50
+ rqrcode (= 0.4.2)
51
+ rqrcode-with-patches (= 0.5.4)
52
+ rubyzip (= 1.1.7)
53
+ serialport (= 1.3.1)
54
+ sqlite3 (= 1.3.10)
55
+ test-unit (= 3.2.3)
56
+ text (= 1.2.3)
57
+
58
+ PATH
59
+ remote: ../SerialModem
60
+ specs:
61
+ serial_modem (0.3.5)
62
+ serialport (= 1.3.1)
63
+
64
+ GEM
65
+ remote: https://rubygems.org/
66
+ specs:
67
+ activemodel (5.1.0)
68
+ activesupport (= 5.1.0)
69
+ activerecord (5.1.0)
70
+ activemodel (= 5.1.0)
71
+ activesupport (= 5.1.0)
72
+ arel (~> 8.0)
73
+ activesupport (5.1.0)
74
+ concurrent-ruby (~> 1.0, >= 1.0.2)
75
+ i18n (~> 0.7)
76
+ minitest (~> 5.1)
77
+ tzinfo (~> 1.1)
78
+ arel (8.0.0)
79
+ chunky_png (1.3.4)
80
+ concurrent-ruby (1.0.5)
81
+ docsplit (0.7.6)
82
+ gettext (3.0.0)
83
+ locale (>= 2.0.5)
84
+ text
85
+ i18n (0.7.0)
86
+ iconv (1.0.3)
87
+ iniparse (1.4.0)
88
+ json (2.1.0)
89
+ locale (2.0.8)
90
+ minitest (5.10.2)
91
+ multi_json (1.0.3)
92
+ net-ldap (0.16.0)
93
+ pdf-core (0.2.2)
94
+ power_assert (1.0.2)
95
+ prawn (1.0.0)
96
+ pdf-core (~> 0.2.2)
97
+ ttfunk (~> 1.1.1)
98
+ rqrcode (0.4.2)
99
+ rqrcode-with-patches (0.5.4)
100
+ chunky_png
101
+ rubyzip (1.1.7)
102
+ serialport (1.3.1)
103
+ sqlite3 (1.3.10)
104
+ test-unit (3.2.3)
105
+ power_assert
106
+ text (1.2.3)
107
+ thread_safe (0.3.6)
108
+ ttfunk (1.1.1)
109
+ tzinfo (1.2.3)
110
+ thread_safe (~> 0.1)
111
+
112
+ PLATFORMS
113
+ ruby
114
+
115
+ DEPENDENCIES
116
+ africompta!
117
+ helper_classes!
118
+ hilink_modem!
119
+ network!
120
+ pdf-core (= 0.2.2)
121
+ prawn (= 1.0.0)
122
+ qooxview!
123
+ serial_modem!
124
+ ttfunk (= 1.1.1)
125
+
126
+ BUNDLED WITH
127
+ 1.15.0
data/Gemfile.lock ADDED
@@ -0,0 +1,127 @@
1
+ PATH
2
+ remote: ../AfriCompta
3
+ specs:
4
+ africompta (1.9.11)
5
+ prawn (= 1.0.0)
6
+ qooxview (= 1.9.11)
7
+
8
+ PATH
9
+ remote: ../HelperClasses
10
+ specs:
11
+ helper_classes (0.3.5)
12
+
13
+ PATH
14
+ remote: ../HilinkModem
15
+ specs:
16
+ hilink_modem (0.3.5)
17
+ activesupport (~> 5.1)
18
+ serialport (~> 1.3)
19
+
20
+ PATH
21
+ remote: ../Network
22
+ specs:
23
+ network (0.3.5)
24
+ chunky_png (= 1.3.4)
25
+ helper_classes (= 0.3.5)
26
+ hilink_modem (= 0.3.5)
27
+ i18n (= 0.7.0)
28
+ multi_json (= 1.0.3)
29
+ serial_modem (= 0.3.5)
30
+
31
+ PATH
32
+ remote: ../QooxView
33
+ specs:
34
+ qooxview (1.9.11)
35
+ activemodel (= 5.1.0)
36
+ activerecord (= 5.1.0)
37
+ activesupport (= 5.1.0)
38
+ arel (= 8.0)
39
+ chunky_png (= 1.3.4)
40
+ docsplit (= 0.7.6)
41
+ gettext (= 3.0.0)
42
+ helper_classes (= 0.3.5)
43
+ i18n (= 0.7.0)
44
+ iconv (= 1.0.3)
45
+ iniparse (= 1.4.0)
46
+ json (= 2.1.0)
47
+ locale (= 2.0.8)
48
+ multi_json (= 1.0.3)
49
+ net-ldap (= 0.16)
50
+ rqrcode (= 0.4.2)
51
+ rqrcode-with-patches (= 0.5.4)
52
+ rubyzip (= 1.1.7)
53
+ serialport (= 1.3.1)
54
+ sqlite3 (= 1.3.10)
55
+ test-unit (= 3.2.3)
56
+ text (= 1.2.3)
57
+
58
+ PATH
59
+ remote: ../SerialModem
60
+ specs:
61
+ serial_modem (0.3.5)
62
+ serialport (= 1.3.1)
63
+
64
+ GEM
65
+ remote: https://rubygems.org/
66
+ specs:
67
+ activemodel (5.1.0)
68
+ activesupport (= 5.1.0)
69
+ activerecord (5.1.0)
70
+ activemodel (= 5.1.0)
71
+ activesupport (= 5.1.0)
72
+ arel (~> 8.0)
73
+ activesupport (5.1.0)
74
+ concurrent-ruby (~> 1.0, >= 1.0.2)
75
+ i18n (~> 0.7)
76
+ minitest (~> 5.1)
77
+ tzinfo (~> 1.1)
78
+ arel (8.0.0)
79
+ chunky_png (1.3.4)
80
+ concurrent-ruby (1.0.5)
81
+ docsplit (0.7.6)
82
+ gettext (3.0.0)
83
+ locale (>= 2.0.5)
84
+ text
85
+ i18n (0.7.0)
86
+ iconv (1.0.3)
87
+ iniparse (1.4.0)
88
+ json (2.1.0)
89
+ locale (2.0.8)
90
+ minitest (5.10.2)
91
+ multi_json (1.0.3)
92
+ net-ldap (0.16.0)
93
+ pdf-core (0.2.2)
94
+ power_assert (1.0.2)
95
+ prawn (1.0.0)
96
+ pdf-core (~> 0.2.2)
97
+ ttfunk (~> 1.1.1)
98
+ rqrcode (0.4.2)
99
+ rqrcode-with-patches (0.5.4)
100
+ chunky_png
101
+ rubyzip (1.1.7)
102
+ serialport (1.3.1)
103
+ sqlite3 (1.3.10)
104
+ test-unit (3.2.3)
105
+ power_assert
106
+ text (1.2.3)
107
+ thread_safe (0.3.6)
108
+ ttfunk (1.1.1)
109
+ tzinfo (1.2.3)
110
+ thread_safe (~> 0.1)
111
+
112
+ PLATFORMS
113
+ ruby
114
+
115
+ DEPENDENCIES
116
+ africompta!
117
+ helper_classes!
118
+ hilink_modem!
119
+ network!
120
+ pdf-core (= 0.2.2)
121
+ prawn (= 1.0.0)
122
+ qooxview!
123
+ serial_modem!
124
+ ttfunk (= 1.1.1)
125
+
126
+ BUNDLED WITH
127
+ 1.15.0
data/Gemfile.prod ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'qooxview', git: 'https://github.com/ineiti/QooxView'
4
+ gem 'africompta', git: 'https://github.com/ineiti/AfriCompta'
5
+ gem 'network', git: 'https://github.com/ineiti/Network'
6
+ gem 'helper_classes', git: 'https://github.com/ineiti/HelperClasses'
7
+ gem 'hilink_modem', git: 'https://github.com/ineiti/HilinkModem'
8
+ gem 'serial_modem', git: 'https://github.com/ineiti/SerialModem'
data/Gestion ADDED
@@ -0,0 +1,35 @@
1
+ #!/bin/bash
2
+
3
+ WDIR=$( dirname ${BASH_SOURCE[0]} )
4
+ cd $WDIR
5
+ if [ "$1" = "update" ]; then
6
+ Binaries/gestion_update.rb
7
+ exit
8
+ fi
9
+
10
+ echo ""
11
+ mkdir -p Backups
12
+ if [ "$( which ruby )" ]; then
13
+ if [ ! -f /etc/gestion.conf ]; then
14
+ if [ "$( whoami )" = "root" ]; then
15
+ echo "Copying gestion.conf to /etc - please edit to your needs"
16
+ BASE=$( pwd | sed -e "s/.Gestion$//" )
17
+ sed -e "s:.opt.profeda:$BASE:" gestion.conf > /etc/gestion.conf
18
+ else
19
+ echo "Not started as root, doing nothing"
20
+ fi
21
+ fi
22
+ if [ ! -e Diplomas ]; then
23
+ cp -a Diplomas.src Diplomas
24
+ fi
25
+ if [ -f dorestore ]; then
26
+ RESTORE=restore_$( date +%Y-%m-%d_%H.%M.%S )
27
+ for d in data config.yaml Exas Diplomas*; do
28
+ mv $d $RESTORE
29
+ done
30
+ tar xf Backups/$( cat dorestore )
31
+ rm dorestore
32
+ fi
33
+ ./Gestion.rb $@
34
+ fi
35
+ echo
data/Gestion.rb ADDED
@@ -0,0 +1,220 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ if ARGV == %w(-p)
5
+ DEBUG_LVL = 0
6
+ else
7
+ DEBUG_LVL = 2
8
+ end
9
+
10
+ require 'bundler/setup'
11
+ require 'helper_classes'
12
+ include HelperClasses
13
+ include System
14
+ $LOAD_PATH.push __dir__
15
+
16
+ Encoding.default_external = Encoding::UTF_8
17
+
18
+ # Gestion - a frontend for different modules developed in Markas-al-Nour
19
+ # N'Djaména, Tchad.
20
+
21
+ VERSION_GESTION='1.9.13' +
22
+ (File.exists?('Gestion.pkgrel') ? '-' + IO.read('Gestion.pkgrel') : '')
23
+ require 'fileutils'
24
+
25
+ GESTION_DIR=File.dirname(__FILE__)
26
+ $config_file='config.yaml'
27
+ if not FileTest.exists? $config_file
28
+ puts "Config-file doesn't exist, copying a standard one"
29
+ FileUtils.cp 'config.yaml.default', 'config.yaml'
30
+ end
31
+
32
+ begin
33
+ require 'qooxview'
34
+ require 'africompta'
35
+ #ACQooxView.load_entities(false)
36
+ %w( Modules Paths ).each { |dir|
37
+ Dir.glob("#{dir}/*").each { |d| require d }
38
+ }
39
+ rescue Exception => e
40
+ puts "#{e.inspect}"
41
+ puts "#{e.to_s}"
42
+ puts e.backtrace
43
+ exit
44
+ end
45
+
46
+ begin
47
+ # Our default-permission is to only login!
48
+ Permission.add('default', ',Welcome,SelfShow')
49
+ Permission.add('quiz', 'SelfChat,SelfConcours,SelfResults', '')
50
+ Permission.add('internet', 'SelfInternet,SelfChat', 'default')
51
+ Permission.add('student', '', 'internet')
52
+ Permission.add('librarian', 'LibraryPerson,FlagInternetFree', 'student')
53
+ Permission.add('assistant', 'TaskEdit,FlagInternetFree', 'student')
54
+ Permission.add('teacher', 'CourseGrade,PersonModify,NetworkRestriction,CoursePrint,' +
55
+ 'FlagResponsible', 'assistant')
56
+ Permission.add('center_director', '', 'center')
57
+ Permission.add('secretary', 'CourseModify,FlagPersonAdd,FlagPersonDelete,' +
58
+ 'PersonModify,CourseDiploma,FlagCourseGradeAll,Cashbox.*,' +
59
+ 'FlagAddInternet,CourseStats,CoursePrint,' +
60
+ 'CourseStudents,PersonCourse', 'assistant,cybermanager')
61
+ Permission.add('accounting', 'ComptaTransfer,FlagAccounting,' +
62
+ 'ComptaReport,ComptaShow,ComptaEdit.*,Cashbox.*,Report.*,' +
63
+ 'ComptaCheck', 'secretary')
64
+ Permission.add('maintenance', 'Inventory.*,AdminBackup,AdminPower,AdminFiles.*', 'default')
65
+ Permission.add('cybermanager', 'CashboxCredit,FlagAddInternet,' +
66
+ 'FlagPersonAdd,CashboxService,InternetMobile,' +
67
+ 'CashboxActivity', '')
68
+ Permission.add('manager', 'Template.*,Internet.*',
69
+ 'director')
70
+ Permission.add('director', 'FlagAdminCourse,FlagAdminPerson,' +
71
+ 'PersonAdmin,PersonCourse,InternetConnection,CourseStats,Report.*,' +
72
+ 'secretary,cybermanager,teacher')
73
+ Permission.add('center', 'CourseModify,FlagAdminCourse,CourseGrade,' +
74
+ 'FlagPersonAdd,FlagPersonDelete,PersonModify,CourseDiploma,' +
75
+ 'FlagRemoteCourse,SelfShow,SelfChat,FlagAdminPerson,' +
76
+ 'PersonCenter,FlagDeletePerson', '')
77
+ Permission.add('admin', '.*', '.*')
78
+ Permission.add('email', 'SelfEmail', '')
79
+
80
+ QooxView::init('Entities', 'Views')
81
+
82
+ # Look for admin, create if it doesn't exist
83
+ admin = Entities.Persons.match_by_login_name('admin')
84
+ if not admin
85
+ dputs(1) { 'OK, creating admin' }
86
+ admin = Entities.Persons.create(:login_name => 'admin', :password => 'super123', :permissions => ["admin"],
87
+ :internet_credit => '100')
88
+ else
89
+ admin.permissions = ['admin'];
90
+ end
91
+
92
+ rescue Exception => e
93
+ case e.to_s
94
+ when /UpdatePot|MakeMo|PrintHelp|value_entity_uncomplete/
95
+ else
96
+ puts e.inspect
97
+ puts e.backtrace
98
+ dputs(0) { "Error: Couldn't load things!" }
99
+ dputs(0) { "#{e.inspect}" }
100
+ dputs(0) { "#{e.to_s}" }
101
+ puts e.backtrace
102
+ end
103
+ exit
104
+ end
105
+
106
+ webrick_port = get_config(3302, :Webrick, :port)
107
+ dputs(2) { "Starting at port #{webrick_port}" }
108
+
109
+ $profiling = get_config(nil, :profiling)
110
+ if $profiling
111
+ dputs(1) { 'Starting Profiling' }
112
+ require 'rubygems'
113
+ require 'perftools'
114
+ PerfTools::CpuProfiler.start("/tmp/#{$profiling}") do
115
+ QooxView::startWeb webrick_port, get_config(30, :profiling, :duration)
116
+ dputs(1) { 'Finished profiling' }
117
+ end
118
+
119
+ if $profiling
120
+ puts "Now run the following:
121
+ pprof.rb --pdf /tmp/#{$profiling} > /tmp/#{$profiling}.pdf
122
+ open /tmp/#{$profiling}.pdf
123
+ CPUPROFILE_FREQUENCY=500
124
+ "
125
+ end
126
+ else
127
+ # Autosave every 2 minutes
128
+ if ConfigBase.autosave == %w(true)
129
+ dputs(1) { 'Starting autosave' }
130
+ $autosave = Thread.new {
131
+ loop {
132
+ sleep ConfigBase.autosave_timer.to_i
133
+ rescue_all "Error: couldn't save all" do
134
+ Entities.save_all
135
+ end
136
+ }
137
+ }
138
+ end
139
+
140
+ # Initialize network and listen for new devices
141
+ if ConfigBase.has_function? :network
142
+ if !get_config(false, :Simulation)
143
+ Network::Device.start
144
+ end
145
+ end
146
+
147
+ # Start up internet-handling (traffic and credit)
148
+ if ConfigBase.has_function? :internet
149
+ dputs(1) { 'Starting internet' }
150
+ Internet.setup
151
+ $internet = Thread.new {
152
+ loop {
153
+ rescue_all "Couldn't take internet-money" do
154
+ # Simple debug-routine to make it faster to test
155
+ if false
156
+ dputs(0) { 'Internet-sleep is on 5!' }
157
+ sleep 5
158
+ Internet.update_traffic
159
+ else
160
+ (1..6).each {
161
+ sleep 10
162
+ Internet.update_traffic
163
+ }
164
+ end
165
+ Internet.take_money
166
+ end
167
+ }
168
+ }
169
+ end
170
+
171
+ # Shows time every minute in the logs
172
+ if get_config(false, :showTime)
173
+ dputs(1) { 'Showing time' }
174
+ $show_time = Thread.new {
175
+ loop {
176
+ sleep 60
177
+ dputs(1) { 'It is now: ' + Time.now.strftime('%Y-%m-%d %H:%M') }
178
+ }
179
+ }
180
+ end
181
+
182
+ # Trying to debug mysterious slowdown
183
+ if false
184
+ $test_hash = {a: 1, b: 2, c: 3}
185
+ $test_hash_big = (1..100).collect { |i| ["value#{i}", i] }.to_h
186
+ $show_time = Thread.new {
187
+ loop {
188
+ Timing.measure('Small hash') { $test_hash._a }
189
+ Timing.measure('Big hash') { $test_hash_big['value50'] }
190
+ Timing.measure('Big method_missing') { $test_hash_big._value50 }
191
+ sleep 10
192
+ }
193
+ }
194
+ end
195
+
196
+ # Catch SIGINT signal so we can save everything before quitting
197
+ trap('SIGINT') {
198
+ throw :ctrl_c
199
+ }
200
+
201
+ # Finally start QooxView
202
+ catch :ctrl_c do
203
+ rescue_all 'Error: QooxView aborted' do
204
+ log_msg :main, "Started Gestion on port #{webrick_port}"
205
+ images_path = File.join(File.expand_path(File.dirname(__FILE__)), 'Images')
206
+ RPCQooxdooHandler.add_file_path(:Images, images_path)
207
+ QooxView::startWeb webrick_port
208
+ end
209
+ end
210
+
211
+ # Clean up all threads
212
+ if get_config(true, :autosave)
213
+ $autosave.kill
214
+ end
215
+ $internet and $internet.kill
216
+ $show_time and $show_time.kill
217
+
218
+ # And finally save all before quitting
219
+ Entities.save_all
220
+ end
data/INSTALL ADDED
@@ -0,0 +1,40 @@
1
+ This package depends on QooxView, AfriCompta and LibNet. There should be a
2
+ directory holding all directories:
3
+
4
+ # ls
5
+ QooxView Gestion AfriCompta LibNet
6
+
7
+
8
+ # Gestion/Gestion
9
+
10
+ This will try to download all missing packets (down to ruby).
11
+
12
+ Short, it will do about:
13
+
14
+ # sudo apt-get install ruby rubygems libreoffice pdftk psutils sqlite \
15
+ # libsqlite3-dev default-jdk gettext
16
+
17
+ And then it will compile sqlite3-support, so a gcc-compiler should be present.
18
+ A standard Lubuntu, LinuxMint or Debian-Squeezy installation seem to run
19
+ it well.
20
+
21
+ Once it's running, you can point your browser to
22
+
23
+ http://localhost:3302
24
+
25
+ and log in using admin/super123
26
+
27
+ ======== Further installation
28
+
29
+ If you want to use it more thoroughly, I propose you go into
30
+
31
+ LibNet/tools
32
+
33
+ and run ./install there. This will copy some links around the system.
34
+
35
+
36
+ ======== Slowness on connection
37
+
38
+ if the system reacts very slowly whenever there is a connection, check that the
39
+ DNS-server doesn't send out private reverse-requests (--bogus-priv on dnsmasq) and
40
+ also some other requests (--filterwin2k on dnsmasq)
Binary file
Binary file
Binary file
Binary file
data/Paths/Exas.rb ADDED
@@ -0,0 +1,13 @@
1
+ class Exas < RPCQooxdooPath
2
+ def self.parse_req_res(req, res)
3
+ dputs(4) { "Exas: #{req.inspect}" }
4
+ path, query, addr = req.path, req.query.to_sym, RPCQooxdooHandler.get_ip(req)
5
+ if req.request_method == 'GET'
6
+ filename = RPCQooxdooPath.sanitize(path.sub(/^.[^\/]*./, ''))
7
+ res['content-type'] = 'data/binary'
8
+ dputs(4) { "Request is #{req.inspect}" }
9
+ dputs(3) { "filename is #{filename} - content-type is #{res['content-type']}" }
10
+ return IO.read("#{Courses.dir_exams}/#{filename}")
11
+ end
12
+ end
13
+ end
data/Paths/Files.rb ADDED
@@ -0,0 +1,19 @@
1
+
2
+ class Files < RPCQooxdooPath
3
+ def self.parse_req_res( req, res )
4
+ dputs( 4 ){ "Files: #{req.inspect}" }
5
+ path, query, addr = req.path, req.query.to_sym, RPCQooxdooHandler.get_ip( req )
6
+ if req.request_method == 'GET'
7
+ filename = RPCQooxdooPath.sanitize(path.sub( /^.[^\/]*./, '' ))
8
+ res['content-type'] = case filename
9
+ when /js$/i
10
+ 'text/javascript'
11
+ when /html$/i
12
+ 'text/html'
13
+ end
14
+ dputs(4){"Request is #{req.inspect}" }
15
+ dputs(3){"filename is #{filename} - content-type is #{res['content-type']}" }
16
+ return IO.read( 'Files/' + filename )
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,20 @@
1
+
2
+ class GetDiplomas < RPCQooxdooPath
3
+ def self.parse_req_res( req, res )
4
+ dputs( 4 ){ "GetDiplomas: #{req.inspect}" }
5
+ path, query, addr = req.path, req.query.to_sym, RPCQooxdooHandler.get_ip( req )
6
+ if req.request_method == 'GET'
7
+ filename = RPCQooxdooPath.sanitize(path.sub( /^.[^\/]*./, '' ))
8
+ res['content-type'] = case filename
9
+ when /pdf$/i
10
+ 'application/pdf'
11
+ when /png$/i
12
+ 'image/png'
13
+ end
14
+ dputs(4){"Request is #{req.inspect}" }
15
+ dputs(3){"filename is #{filename} - content-type is #{res['content-type']}" }
16
+ return IO.read( Courses.dir_diplomas + '/' + filename ).
17
+ force_encoding('ASCII-8BIT')
18
+ end
19
+ end
20
+ end