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
@@ -0,0 +1,39 @@
1
+ class SpecialVNC < View
2
+ def layout
3
+ @order = 100
4
+ @auto_update = 5
5
+ @update = true
6
+ @functions_need = [:special_vnc]
7
+
8
+ gui_vbox do
9
+ show_str :ip
10
+ show_str :password
11
+ show_str_ro :status
12
+ show_button :start_x
13
+ end
14
+ end
15
+
16
+ def rpc_update(session)
17
+ reply(:update, password: @static._password) +
18
+ reply(:update, ip: session.client_ip) +
19
+ rpc_update_with_values(nil, nil)
20
+ end
21
+
22
+ def rpc_update_with_values(session, data)
23
+ reply(:update, status: System.run_str('pgrep -af vnc'))
24
+ end
25
+
26
+ def rpc_button_start_x(session, data)
27
+ @static._password = data._password
28
+ if Platform.system == :ArchLinux
29
+ System.run_str("echo #{data._password} | vncpasswd -f > /root/.vnc/passwd")
30
+ IO.write('/root/.xinitrc',
31
+ "xset -dpms; xset s off
32
+ x0vncserver -passwordfile ~/.vnc/passwd &
33
+ vncviewer -fullscreen -shared -viewonly -passwd=/root/.vnc/passwd #{data._ip}")
34
+ System.run_bool('killall -9 xinit')
35
+ System.run_bool('killall -9 Xorg')
36
+ Platform.start 'startx@root'
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,21 @@
1
+ class TaskClient < View
2
+ include VTListPane
3
+
4
+ def layout
5
+ set_data_class :Clients
6
+
7
+ gui_hbox do
8
+ gui_vbox :nogroup do
9
+ vtlp_list :clients, 'name'
10
+ show_button :delete
11
+ end
12
+ gui_vbox :nogroup do
13
+ #show_find :name
14
+ show_block :prices
15
+ show_block :address
16
+ show_block :contact
17
+ show_button :new, :save
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,33 @@
1
+ class TaskEdit < View
2
+ include VTListPane
3
+
4
+ def layout
5
+ set_data_class :Tasks
6
+ @update = true
7
+
8
+ gui_hbox do
9
+ gui_vbox :nogroup do
10
+ vtlp_list :tasks, "tasks"
11
+ show_button :delete
12
+ end
13
+ gui_vbox :nogroup do
14
+ show_list_drop :client, "Entities.Clients.list_name"
15
+ show_list_drop :person, "Entities.Workers.list_full_name"
16
+ show_block :work
17
+ show_block :other
18
+
19
+ show_button :save, :new
20
+ end
21
+ end
22
+ end
23
+
24
+ def rpc_update( session )
25
+ vtlp_update_list( session )
26
+ end
27
+
28
+ def rpc_button_save( session, data )
29
+ if data['date']
30
+ super( session, data )
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,55 @@
1
+ class TaskList < View
2
+
3
+ def layout
4
+ set_data_class :Tasks
5
+ @update = true
6
+
7
+ gui_hbox do
8
+ gui_vbox :nogroup do
9
+ show_list_drop :year, "View.TaskList.list_years"
10
+ show_list_drop :month, "1.upto(12).to_a"
11
+ show_list_drop :person, "Entities.Workers.list_full_name"
12
+ show_list_drop :client, "Entities.Clients.list_name"
13
+ show_button :list
14
+ end
15
+ gui_vbox :nogroup do
16
+ show_text :tasks_done
17
+ show_text :summary
18
+ end
19
+ end
20
+ end
21
+
22
+ def list_years
23
+ to = from = Time.now.year
24
+ Entities.Tasks.list_date{|d|
25
+ year = d.sub( /.*\./, '' )
26
+ dputs( 5 ){ "date is #{d}, year is #{year}" }
27
+ from = [ from, year ].min
28
+ to = [ to, year ].max
29
+ }
30
+ dputs( 5 ){ "from #{from} to #{to}" }
31
+ from.upto( to ).to_a
32
+ end
33
+
34
+ def rpc_button_list( session, data )
35
+ dputs( 3 ){ data.inspect }
36
+ worker = Entities.Workers.find_full_name( data["person"][0] )
37
+ dputs( 3 ){ worker.inspect }
38
+ client = Entities.Clients.match_by_name( data["client"][0] )
39
+ dputs( 3 ){ client.inspect }
40
+ list = Tasks.list_task_month( worker, data["year"][0], data["month"][0], client)
41
+ dputs( 3 ){ list.inspect }
42
+ tasks = ""
43
+ hours = 0.0
44
+ list.sort{|a,b| a[:date] <=> b[:date] }.each{|l|
45
+ duration = l[:duration_hours]
46
+ tasks += "#{l[:date]} - #{duration} hour#{ duration.to_f < 2 ? '' : 's'}\n" +
47
+ "#{l[:work]}\n"
48
+ hours += l[:duration_hours].to_f
49
+ }
50
+ price = worker.function[0] == "assistant" ? client.price_assistant : client.price_expert
51
+ summary = "#{data['month']} #{hours} #{( hours * price.to_i ).to_i}"
52
+ reply( "update", { :tasks_done => tasks, :summary => summary } )
53
+ end
54
+
55
+ end
@@ -0,0 +1,9 @@
1
+ class TaskTabs < View
2
+ def layout
3
+ @visible = false
4
+
5
+ gui_vbox :nogroup do
6
+ show_button :new_task
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,30 @@
1
+ class TaskWorker < View
2
+ include VTListPane
3
+
4
+ def layout
5
+ set_data_class :Workers
6
+
7
+ gui_hbox do
8
+ gui_vbox :nogroup do
9
+ vtlp_list :workers, "login_name"
10
+ show_button :delete
11
+ end
12
+ gui_vbox :nogroup do
13
+ #show_find :login_name
14
+ #show_find :person_id
15
+ show_block :work
16
+
17
+ show_button :new, :save
18
+ end
19
+ end
20
+ end
21
+
22
+ # Standard search-field action to take
23
+ def rpc_find( session, field, data )
24
+ rep = Entities.Persons.find( field, data )
25
+ if not rep
26
+ rep = { "#{field}" => data }
27
+ end
28
+ reply( :update, rep ) + rpc_update( session )
29
+ end
30
+ end
@@ -0,0 +1,33 @@
1
+ # To change this template, choose Tools | Templates
2
+ # and open the template in the editor.
3
+
4
+ class TemplateActivity < View
5
+ include VTListPane
6
+
7
+ def layout
8
+ #set_data_class :Activities
9
+ @order = 200
10
+
11
+ @functions_need = [:activities]
12
+
13
+ gui_hboxg do
14
+ gui_vboxg :nogroup do
15
+ vtlp_list :activity, 'name', :flexheight => 1
16
+ show_button :new, :delete
17
+ end
18
+
19
+ gui_vboxg :nogroup do
20
+ show_block :default
21
+ show_block :show
22
+ show_list_drop :card_filename, 'Activities.files.sort'
23
+ show_field :tags
24
+ show_field :internet_limit
25
+ show_button :save
26
+ end
27
+ end
28
+ end
29
+
30
+ def rpc_list_choice_internetClass(session, name, args)
31
+ # dp name, args
32
+ end
33
+ end
@@ -0,0 +1,63 @@
1
+ # To change this template, choose Tools | Templates
2
+ # and open the template in the editor.
3
+
4
+ class TemplateCourseType < View
5
+ include VTListPane
6
+
7
+ def layout
8
+ set_data_class :CourseTypes
9
+ @update = :before
10
+ @order = 100
11
+
12
+ @functions_need = [:courses]
13
+
14
+ gui_hboxg do
15
+ gui_vbox :nogroup do
16
+ vtlp_list :ctype, 'name', :flexheight => 1
17
+ show_button :new, :delete
18
+ end
19
+
20
+ gui_vboxg do
21
+ gui_hboxg :nogroup do
22
+ gui_vboxg :nogroup do
23
+ show_block :strings
24
+ show_block :long
25
+ show_block :accounting
26
+ end
27
+ gui_vbox :nogroup do
28
+ show_block :central
29
+ show_list_drop :file_diploma, 'CourseTypes.files.sort', :width => 200
30
+ show_list_drop :file_exam, 'CourseTypes.files.sort', :width => 200
31
+ end
32
+ end
33
+ gui_hboxg :nogroup do
34
+ gui_vboxg :nogroup do
35
+ show_int_ro :tests_nbr
36
+ show_text :tests_str, :flexheight => 1, :width => 200
37
+ end
38
+ gui_vboxg :nogroup do
39
+ show_int_ro :files_nbr
40
+ show_text :files_str, :flexheight => 1, :width => 200
41
+ end
42
+ end
43
+ gui_vbox :nogroup do
44
+ show_field :account_base
45
+ show_arg :account_base, :width => 400
46
+ end
47
+ show_button :save
48
+ end
49
+ end
50
+ end
51
+
52
+ def rpc_update_view(session)
53
+ super(session) +
54
+ reply(:empty_nonlists) +
55
+ reply(:select, account_base: AccountRoot.actual.listp_path) +
56
+ reply_visible(ConfigBase.has_function?(:accounting_courses),
57
+ :account_base)
58
+ end
59
+
60
+ def rpc_update(session)
61
+ reply(:update, :account_base => [0])
62
+ end
63
+ end
@@ -0,0 +1,29 @@
1
+ class TemplateScheduleType < View
2
+ #include VTListPane
3
+
4
+ def layout
5
+ @order=400
6
+ @update = true
7
+ @visible = false
8
+
9
+ gui_hboxg do
10
+ #gui_vboxg :nogroup do
11
+ #vtlp_list :stype, :name, :flexheight => 1
12
+ #show_button :new, :delete
13
+ #end
14
+ gui_vboxg :nogroup do
15
+ show_html :choice, :flex => 1
16
+ show_button :save, :render
17
+ end
18
+ end
19
+ end
20
+
21
+ def rpc_update(session)
22
+ reply(:update, :choice => ScheduleTypes.get_html) +
23
+ reply(:eval, ScheduleTypes.get_script)
24
+ end
25
+
26
+ def rpc_button_render(session, data)
27
+ reply(:eval, 'add_days();add_hours();')
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ class TemplateTabs < View
2
+ def layout
3
+ @order = 50
4
+ end
5
+ end
data/Views/Welcome.rb ADDED
@@ -0,0 +1,121 @@
1
+ class Welcome < View
2
+ def dummy_for_translation
3
+ show_str :username
4
+ show_str :version
5
+ show_str :direct_connect
6
+ show_str :simple_connect
7
+ end
8
+
9
+ # Overwrite the standard rpc_show to speed up testing...
10
+ def rpc_show(session)
11
+ # GC.start
12
+ web_req = session.web_req
13
+ client_ip = RPCQooxdooHandler.get_ip(web_req)
14
+ person = if get_config(false, :autologin)
15
+ Entities.Persons.match_by_login_name(get_config(false, :autologin))
16
+ else
17
+ nil
18
+ end
19
+ if person
20
+ person and dputs(3) { "Found login #{person.data.inspect}" }
21
+ session = get_config(false, :multilogin) ? Sessions.find_by_owner(person.person_id) : nil
22
+ session ||= Sessions.create(person)
23
+ dputs(3) { "Session is #{session.inspect}" }
24
+ return reply(:session_id, person.session_id) +
25
+ View.rpc_list(session)
26
+ else
27
+ if session.web_req && ref = session.web_req.header._referer
28
+ user, pass = ref.first.match(/user=(.*)&pass=(.*)/).to_a[1..2]
29
+ if user && pass
30
+ return rpc_button_direct_connect(session, {username: user, password: pass})
31
+ end
32
+ end
33
+ Sessions.search_by_owner('[0-9]').each { |s|
34
+ if s.last_seen && Time.now.to_i - s.last_seen.to_i <= 15
35
+ log_msg :Welcome, "Found session #{s.inspect} from ip #{s.client_ip}"
36
+ if s.client_ip == client_ip
37
+ log_msg :Welcome, "Found session #{s.inspect} with correct ip"
38
+ #dp person = session.owner
39
+ #session = Sessions.create( person )
40
+ return direct_connect(s)
41
+ end
42
+ end
43
+ }
44
+ super +
45
+ reply(:update, :version => VERSION_GESTION) +
46
+ reply(:update, :links => ConfigBase.welcome_text) +
47
+ reply_visible(ConfigBase.has_function?(:internet_captive), :direct_connect)
48
+ end
49
+ end
50
+
51
+ # On pressing of the login-button, we search for the user and check the password
52
+ def rpc_button_simple_connect(session, args)
53
+ #dputs_func
54
+ dputs(3) { "args is #{args.inspect}" }
55
+ login_name, password = args._username.gsub(/ /, '').downcase, args._password
56
+ person = Persons.match_by_login_name(login_name)
57
+ if person
58
+ dputs(3) { "Person is #{person.inspect} and #{person.password}" }
59
+ end
60
+ if password.to_s.length == 0 then
61
+ return reply(:focus, :password)
62
+ elsif person and person.check_pass(password) then
63
+ web_req = session.web_req
64
+ session = Sessions.create(person)
65
+ session.web_req = web_req
66
+ session.client_ip = RPCQooxdooHandler.get_ip(web_req)
67
+ dputs(3) { "Found login #{person.data_get(:person_id)} for #{login_name}" }
68
+ dputs(3) { "Session is #{session.inspect}" }
69
+ log_msg :Welcome, "Authenticated person #{person.login_name} from " +
70
+ "#{session.client_ip}"
71
+ return reply(:session_id, person.session_id) +
72
+ View.rpc_list(session)
73
+ else
74
+ reply(:window_show, :login_failed) +
75
+ reply(:update, :reason => person ? 'Password wrong' : "User doesn't exist")
76
+ end
77
+ end
78
+
79
+ def direct_connect(session)
80
+ if !session or !session.owner
81
+ return reply(:window_show, :login_failed) +
82
+ reply(:update, :reason => 'Please enter a valid login')
83
+ end
84
+
85
+ if View.SelfInternet.can_connect(session) == 0
86
+ dputs(2) { "Auto-connecting #{session.owner.login_name}" }
87
+ View.SelfInternet.rpc_button_connect(session, nil)
88
+ end
89
+
90
+ tabs = View.list(session)._views
91
+
92
+ dputs(3) { "Tabs starts as #{tabs.inspect}" }
93
+ selftabs = tabs.find { |v| v.first == 'SelfTabs' }
94
+ tabs.delete_if { |v| v.first == 'SelfTabs' }
95
+ if selftabs
96
+ tabs.unshift selftabs
97
+ end
98
+
99
+ dputs(3) { "Tabs is now #{tabs.inspect}" }
100
+ return reply(:session_id, session.sid) +
101
+ reply(:list, views: tabs) +
102
+ (session.s_data._sub_tabs_only ? View.reply(:bar_position, 'top') : [])
103
+ end
104
+
105
+ def rpc_button_direct_connect(session, args)
106
+ ret = rpc_button_simple_connect(session, args)
107
+ if ret.first._cmd == :window_show
108
+ return ret
109
+ else
110
+ session = Sessions.find_by_sid(ret.first._data)
111
+ return direct_connect(session)
112
+ end
113
+ end
114
+
115
+ # On logout
116
+ def rpc_button_logout(session)
117
+ session.close
118
+ return super.rpc_show(session)
119
+ end
120
+
121
+ end
@@ -0,0 +1,36 @@
1
+ # Uncomment to automatically login admin
2
+ #autologin: admin
3
+ # Together with autologin, allows for more than one at the same time,
4
+ # for example for chat
5
+ #multilogin: true
6
+
7
+ StorageHandler:
8
+ Replace:
9
+ LDAP: CSV
10
+
11
+ StorageType:
12
+ CSV:
13
+ backup_count: 5
14
+
15
+ #profiling: profile.txt
16
+ # duration: 30
17
+
18
+ Webrick:
19
+ # port: 3302
20
+
21
+ Views:
22
+ # CourseTabs:
23
+ # order: 0
24
+
25
+ # These can come in handy for a backup-system where data of an online system
26
+ # are tested
27
+ Entities:
28
+ Share:
29
+ # simulation: true
30
+ Persons:
31
+ # user_simulation: true
32
+
33
+ LDAPConfig:
34
+ # array: host, base, root, group_users, password
35
+ # ldapscripts: /etc/ldapscripts/ldapscripts.conf
36
+ # ldapsecret: /etc/ldap.secret