gestion 1.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,96 @@
1
+ # Allow for courses to be paid
2
+ # This module attributes the courses to the accounts. Normally this
3
+ # should happen automatically, but for old installations, this editor
4
+ # is necessary.
5
+
6
+ class ComptaCourse < View
7
+ def layout
8
+ @order = 50
9
+ @update = true
10
+ @functions_need = [:accounting_courses]
11
+ @visible = false
12
+
13
+ gui_hboxg do
14
+ gui_vbox :nogroup do
15
+ show_entity_course :courses, :single, :name,
16
+ :flexheight => 1, :callback => true, :width => 100
17
+ end
18
+ gui_vbox do
19
+ show_str :account_path, :width => 300
20
+ show_button :new_account_path, :save
21
+ end
22
+ gui_window :win_new_account do
23
+ gui_vbox :nogroup do
24
+ show_list_single :new_account, :width => 500, :height => 300
25
+ show_button :assign_new_account, :add_archives, :close
26
+ end
27
+ end
28
+ end
29
+
30
+ end
31
+
32
+ def rpc_button_new_account_path( session, data )
33
+ acc = []
34
+ AccountRoot.actual.get_tree{|a|
35
+ acc.push [ a.global_id, a.path ]
36
+ }
37
+ reply( :empty, :new_account ) +
38
+ reply( :update, { :new_account => acc.sort{|a,b| a[1] <=> b[1] } }) +
39
+ reply( :window_show, :win_new_account )
40
+ end
41
+
42
+ def rpc_button_save( session, data )
43
+ dputs(4){"save with #{data.inspect} - #{data._courses} - #{data._account_path}"}
44
+ reply( :empty_nonlists, :new_account_path ) +
45
+ if course = data._courses
46
+ if ap = data._account_path and
47
+ acc = Accounts.find_by_path(ap)
48
+ dputs(3){"New account at #{ap} is #{acc.inspect} - #{acc.path}"}
49
+ course.entries = acc
50
+ reply( :update, :account_path => acc.path )
51
+ elsif course.entries
52
+ reply( :update, :account_path => course.entries.path )
53
+ else
54
+ []
55
+ end
56
+ else
57
+ []
58
+ end
59
+ end
60
+
61
+ def rpc_button_add_archives( session, data )
62
+
63
+ end
64
+
65
+ def rpc_button_assign_new_account( session, data )
66
+ if gid = data._new_account[0] and
67
+ acc = Accounts.find_by_global_id( gid )
68
+ rpc_button_save( session, data.merge( "account_path" => acc.path ) )
69
+ else
70
+ []
71
+ end +
72
+ reply( :window_hide )
73
+ end
74
+
75
+ def rpc_button_close( session, data )
76
+ reply( :window_hide )
77
+ end
78
+
79
+ def rpc_list_choice( session, name, data )
80
+ dputs(4){"name is #{name} - data is #{data.inspect}"}
81
+ if course = data._courses
82
+ dputs(3){"Course is #{course.inspect}"}
83
+ reply( :empty_nonlists, [:account_path] ) +
84
+ if course.entries and course.entries != []
85
+ reply( :update, :account_path => course.entries.path )
86
+ else
87
+ []
88
+ end
89
+ end
90
+ end
91
+
92
+ def rpc_update( session )
93
+ reply( :empty_nonlists, :courses ) +
94
+ reply( :update, :courses => Courses.list_courses(session))
95
+ end
96
+ end
@@ -0,0 +1,6 @@
1
+ class ComptaShow < View
2
+ include VTListPane
3
+ def layout
4
+ @visible = false
5
+ end
6
+ end
@@ -0,0 +1,66 @@
1
+ # To change this template, choose Tools | Templates
2
+ # and open the template in the editor.
3
+
4
+ class ComptaTransfer < View
5
+ include PrintButton
6
+
7
+ def layout
8
+ @update = true
9
+ @order = 10
10
+
11
+ set_data_class :Persons
12
+
13
+ gui_hbox do
14
+ gui_vbox :nogroup do
15
+ show_entity_person :persons, :single, :callback => true
16
+ show_date :upto
17
+ show_button :do_transfer, :update
18
+ end
19
+ gui_vbox :nogroup do
20
+ show_table :report, :headings => [:Date, :Desc, :Amount, :Sum],
21
+ :widths => [100, 300, 75, 75], :height => 400, :width => 570,
22
+ :columns => [0, 0, :align_right, :align_right]
23
+ show_print :print
24
+ end
25
+
26
+ window_print_status
27
+ end
28
+ end
29
+
30
+ def rpc_button_do_transfer(session, data)
31
+ dputs(3) { "data is #{data.inspect} with owner #{session.owner.full_name}" }
32
+ if (other = data._persons).class == Person
33
+ dputs(3) { "Other is #{other.inspect}, id is #{data._person_list.to_s.inspect}" }
34
+ amount = (other.account_due.total.to_f * 1000).to_i
35
+ log_msg :comptatransfer, "#{session.owner.login_name} gets #{amount} from " +
36
+ "#{other.login_name}"
37
+ session.owner.get_all_due(other, data._upto.date_from_web)
38
+ end
39
+ rpc_update(session)
40
+ end
41
+
42
+ def rpc_update(session)
43
+ dputs(3) { "rpc_update with #{session.inspect}" }
44
+ reply(:empty_nonlists, :persons) +
45
+ reply(:update, :persons => Persons.listp_account_due) +
46
+ reply(:update, :upto => Date.today.to_web) +
47
+ reply_print(session)
48
+ end
49
+
50
+ def rpc_list_choice_persons(session, data)
51
+ reply(:empty_nonlists, :report) +
52
+ reply(:update, :upto => data._upto) +
53
+ reply(:update, :report => data._persons.report_list(:all,
54
+ data._upto.date_from_web))
55
+ end
56
+
57
+ def rpc_button_update(session, data)
58
+ rpc_list_choice_persons(session, data)
59
+ end
60
+
61
+ def rpc_button_print(session, data)
62
+ send_printer_reply(session, :print, data,
63
+ data._persons.report_pdf(:all,
64
+ data._upto.date_from_web))
65
+ end
66
+ end
@@ -0,0 +1,203 @@
1
+ =begin
2
+ Shows the existing courses and the courses on the server, so that the
3
+ two can be synchronized.
4
+ =end
5
+
6
+
7
+ class CourseDiploma < View
8
+ include PrintButton
9
+
10
+ def layout
11
+ set_data_class :Courses
12
+ @order = 30
13
+ @update = true
14
+
15
+ gui_hbox do
16
+ gui_vbox :nogroup do
17
+ show_table :diplomas_t, :headings => [:Name, :Grade, :State, :PDF],
18
+ :widths => [200, 50, 100], :height => 500,
19
+ :columns => [0, 0, 0, :html]
20
+ end
21
+ gui_vbox :nogroup do
22
+ gui_fields do
23
+ show_info :status
24
+ show_button :do_diplomas, :abort
25
+ end
26
+ show_print :print
27
+ end
28
+ gui_window :missing_data do
29
+ show_html :missing
30
+ show_button :close
31
+ end
32
+ gui_window :printing do
33
+ show_html :msg_print
34
+ show_button :close
35
+ end
36
+ end
37
+ end
38
+
39
+ def rpc_show(session)
40
+ super(session) +
41
+ reply(:hide, [:abort, :status])
42
+ end
43
+
44
+ def rpc_update(session)
45
+ super(session) +
46
+ reply_print(session)
47
+ end
48
+
49
+ def rpc_list_choice_courses(session, args)
50
+ args.to_sym!
51
+ ret = reply(:empty_nonlists, :diplomas_t)
52
+ if args._courses.length > 0
53
+ if course = Courses.match_by_course_id(args._courses.to_a[0])
54
+ course.update_state(true)
55
+ ret += rpc_update_with_values(session, args)
56
+ end
57
+ end
58
+ return ret
59
+ end
60
+
61
+ def rpc_button_do_diplomas(session, args)
62
+ course_id = args._courses[0]
63
+ course = Courses.match_by_course_id(course_id)
64
+ if not course or course.export_check
65
+ if course
66
+ return reply(:window_show, :missing_data) +
67
+ reply(:update, :missing => 'The following fields are not filled in:<br>' +
68
+ course.export_check.join('<br>'))
69
+ end
70
+ else
71
+ course.prepare_diplomas
72
+
73
+ rpc_list_choice(session, :courses, :courses => [course_id.to_s])
74
+ end
75
+ end
76
+
77
+ def pdf_link(path)
78
+ "<a target='other' href=\"/getdiplomas/#{path}\">#{File.basename(path)}</a>"
79
+ end
80
+
81
+ def rpc_update_with_values(session, args)
82
+ #dputs_func
83
+
84
+ args.to_sym!
85
+ if true
86
+ (course_id = args._courses[0]) or return []
87
+ #ret = rpc_list_choice( session, "courses", "courses" => course_id.to_s )
88
+ (course = Entities.Courses.match_by_course_id(course_id)) or return []
89
+ else
90
+ return unless course = args._courses
91
+ end
92
+
93
+ ret = []
94
+
95
+ overall_state = course.make_pdfs_state['0']
96
+ if overall_state == 'done'
97
+ ret += reply(:auto_update, 0) +
98
+ reply(:hide, [:abort, :status]) +
99
+ reply(:unhide, :do_diplomas)
100
+ else
101
+ ret += reply(:auto_update, -5) +
102
+ reply(:unhide, [:abort, :status]) +
103
+ reply(:hide, :do_diplomas) +
104
+ reply(:update, :status => overall_state)
105
+ end
106
+ dputs(3) { "Overall_state is #{overall_state}" }
107
+
108
+ states = case course.get_files.select { |f| f =~ /(000-4pp.pdf|zip)$/ }.first
109
+ when /zip$/
110
+ [['all.zip', ['All files', '', '', pdf_link("#{course.name}/all.zip")]]]
111
+ when /pdf$/
112
+ [['000-4pp.pdf', ['4 on 1 page', '', '',
113
+ pdf_link("#{course.name}/000-4pp.pdf")]],
114
+ ['000-all.pdf', ['All diplomas', '', '',
115
+ pdf_link("#{course.name}/000-all.pdf")]]]
116
+ else
117
+ dputs(3) { course.get_files.inspect }
118
+ []
119
+ end
120
+ dputs(3) { "States is #{states}" }
121
+
122
+ states += course.make_pdfs_state.keys.reject { |k| k == '0' }.
123
+ collect { |s|
124
+ st = course.make_pdfs_state[s]
125
+ p = Persons.match_by_login_name(s)
126
+ link = st[1] == 'done' ? pdf_link(st[2]) : '---'
127
+ [s, [p.full_name, st[0], st[1], link]]
128
+ }.sort { |a, b|
129
+ a[1][0] <=> b[1][0]
130
+ }
131
+
132
+ return ret +
133
+ reply_print(session) +
134
+ reply(:update, :diplomas_t => states)
135
+ end
136
+
137
+ def rpc_button_close(session, args)
138
+ reply(:window_hide) +
139
+ reply(:empty_selections)
140
+ end
141
+
142
+ def rpc_button_print(session, args)
143
+ ret = rpc_print(session, :print, args) +
144
+ reply(:window_hide)
145
+ lp_cmd = cmd_printer(session, :print)
146
+ if (names = args['diplomas_t']).length > 0
147
+ course_id = args['courses'][0]
148
+ course = Courses.match_by_course_id(course_id)
149
+ log_msg :diploma, "Printing #{names.inspect} of #{course.name}"
150
+
151
+ files = names.collect { |f|
152
+ file = "#{course.dir_diplomas}/#{f}"
153
+ exts = %w( pdf png )
154
+ while (!File.exists? file) and (exts.length > 0)
155
+ file = "#{course.get_diploma_filename(f, exts.pop)}"
156
+ end
157
+ if !File.exists? file
158
+ file = 'Not found'
159
+ end
160
+ dputs(3) { "Filename is #{file}" }
161
+ name = ((p = Persons.match_by_login_name(f)) and p.full_name) ||
162
+ {'all.zip' => 'All files', '000-4pp.pdf' => '4 on 1 page',
163
+ '000-all.pdf' => 'All diplomas'}[f] || 'Unknown'
164
+ [name, file]
165
+ }
166
+ dputs(2) { "Printing #{files.inspect}" }
167
+ if lp_cmd
168
+ names = []
169
+ files.each { |name, file|
170
+ if File.exists? file
171
+ System.run_bool("#{lp_cmd} #{file}")
172
+ names.push name
173
+ end
174
+ }
175
+ ret += reply(:window_show, :printing) +
176
+ reply(:update, :msg_print => 'Impression de<ul><li>' +
177
+ "#{names.join('</li><li>')}</li></ul>en cours")
178
+ else
179
+ ret += reply(:window_show, :printing) +
180
+ reply(:update, :msg_print => 'Choisir le pdf:<ul>' +
181
+ files.collect { |name, file|
182
+ if File.exists? file
183
+ FileUtils.cp file, '/tmp'
184
+ "<li><a target='other' href=\"/tmp/#{File.basename(file)}\">#{name}</a></li>"
185
+ else
186
+ "<li>#{name} - not found</li>"
187
+ end
188
+ }.join('') + '</ul>')
189
+ end
190
+ end
191
+ ret
192
+ end
193
+
194
+ def rpc_button_abort(session, args)
195
+ course_id = args._courses[0]
196
+ course = Entities.Courses.match_by_course_id(course_id)
197
+ course.abort_pdfs
198
+ reply(:unhide, :do_diplomas) +
199
+ reply(:hide, :abort) +
200
+ reply(:auto_update, 0) +
201
+ rpc_list_choice(session, 'courses', args)
202
+ end
203
+ end