gestion 1.9.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +48 -0
- data/.project +14 -0
- data/Binaries/adduser_to_buzz +15 -0
- data/Binaries/backup +7 -0
- data/Binaries/check_gestion +8 -0
- data/Binaries/gestion.gnumail +22 -0
- data/Binaries/gestion.logrotate +34 -0
- data/Binaries/gestion.service +12 -0
- data/Binaries/gestion_update.rb +183 -0
- data/Binaries/gestion_update.service +10 -0
- data/Binaries/get_compta +11 -0
- data/Binaries/kill_gestion +16 -0
- data/Binaries/ldap/add_indexes +51 -0
- data/Binaries/ldap/backup +2 -0
- data/Binaries/ldap/install_ldap +92 -0
- data/Binaries/ldap/restore +7 -0
- data/Binaries/lib_backup +5 -0
- data/Binaries/log_scan_errors +8 -0
- data/Binaries/loop_gestion +64 -0
- data/Binaries/onetimers/sync_courses_from_compta.rb +74 -0
- data/Binaries/onetimers/transfer_cash_from_ldap_to_csv +26 -0
- data/Binaries/reboot +5 -0
- data/Binaries/restore +3 -0
- data/Binaries/restore_do +22 -0
- data/Binaries/sort_events +31 -0
- data/Binaries/start_gestion +18 -0
- data/Binaries/swipe_gestion +18 -0
- data/Binaries/update_africompta +21 -0
- data/Binaries/update_users +3 -0
- data/Diplomas.src/accredited.odg +0 -0
- data/Diplomas.src/diploma.odg +0 -0
- data/Diplomas.src/label.odg +0 -0
- data/Diplomas.src/presence_sheet.ods +0 -0
- data/Diplomas.src/presence_sheet_small.ods +0 -0
- data/Diplomas.src/student_card.odg +0 -0
- data/Doc/130514-it-ideas.odt +0 -0
- data/Doc/Compta-cash.mm +179 -0
- data/Doc/General.odt +0 -0
- data/Entities/AccessGroups.rb +117 -0
- data/Entities/Activity.rb +178 -0
- data/Entities/ChatMsg.rb +142 -0
- data/Entities/Classroom.rb +11 -0
- data/Entities/Client.rb +19 -0
- data/Entities/Computer.rb +21 -0
- data/Entities/ConfigBase.rb +280 -0
- data/Entities/Course.rb +1588 -0
- data/Entities/CourseType.rb +171 -0
- data/Entities/DFiles.rb +466 -0
- data/Entities/FilesManage.rb +226 -0
- data/Entities/Grade.rb +186 -0
- data/Entities/Internet.rb +300 -0
- data/Entities/Netdev.rb +10 -0
- data/Entities/Person.rb +1175 -0
- data/Entities/Plug.rb +98 -0
- data/Entities/Quiz.rb +33 -0
- data/Entities/Recharges.rb +37 -0
- data/Entities/Report.rb +136 -0
- data/Entities/Room.rb +12 -0
- data/Entities/SMS.rb +30 -0
- data/Entities/ScheduleType.rb +33 -0
- data/Entities/Share.rb +120 -0
- data/Entities/Task.rb +51 -0
- data/Entities/Ticket.rb +72 -0
- data/Entities/Usage.rb +143 -0
- data/Entities/Worker.rb +29 -0
- data/Files/apache-profeda.conf +36 -0
- data/Files/label.erb +121 -0
- data/Files/label_notfound.erb +64 -0
- data/Files/label_notpassed.erb +84 -0
- data/Files/mobileinfo.erb +115 -0
- data/Files/smb.conf +333 -0
- data/Files/timetable.html +36 -0
- data/Files/timetable.js +239 -0
- data/Gemfile +12 -0
- data/Gemfile.dev +12 -0
- data/Gemfile.dev.lock +127 -0
- data/Gemfile.lock +127 -0
- data/Gemfile.prod +8 -0
- data/Gestion +35 -0
- data/Gestion.rb +220 -0
- data/INSTALL +40 -0
- data/Images/connection.xcf +0 -0
- data/Images/connection_no.png +0 -0
- data/Images/connection_wait.png +0 -0
- data/Images/connection_yes.png +0 -0
- data/Paths/Exas.rb +13 -0
- data/Paths/Files.rb +19 -0
- data/Paths/GetDiplomas.rb +20 -0
- data/Paths/Info.rb +114 -0
- data/Paths/Label.rb +187 -0
- data/Paths/MobileInfo.rb +19 -0
- data/Paths/internetCash.rb +34 -0
- data/Paths/internetWifi.rb +54 -0
- data/README.md +60 -0
- data/Rakefile +13 -0
- data/TODO +1391 -0
- data/Test/.gitignore +3 -0
- data/Test/Diplomas/base_gestion.odt +0 -0
- data/Test/Diplomas/base_report.odt +0 -0
- data/Test/Diplomas/carte_etudiant.odg +0 -0
- data/Test/Diplomas/exam_language.odt +0 -0
- data/Test/Diplomas/label.odg +0 -0
- data/Test/Diplomas/presence_sheet.ods +0 -0
- data/Test/Diplomas/presence_sheet_small.ods +0 -0
- data/Test/Diplomas/student_card.odg +0 -0
- data/Test/Manual/testMerge +18 -0
- data/Test/config_test.yaml +26 -0
- data/Test/db.testGestion +0 -0
- data/Test/dfiles/descs/avg-rescue.desc +10 -0
- data/Test/dfiles/descs/avg.desc +8 -0
- data/Test/dfiles/descs/driver.desc +8 -0
- data/Test/dfiles/descs/linuxmint.desc +7 -0
- data/Test/dfiles/files/avg-160203.exe +1 -0
- data/Test/dfiles/files/avg.iso +1 -0
- data/Test/dfiles/files/driver.exe +1 -0
- data/Test/dfiles/index_post.html +3 -0
- data/Test/dfiles/index_pre.html +8 -0
- data/Test/dfiles/priorities +5 -0
- data/Test/ge_activity.rb +124 -0
- data/Test/ge_chat.rb +106 -0
- data/Test/ge_compta.rb +67 -0
- data/Test/ge_configbase.rb +54 -0
- data/Test/ge_course.rb +1114 -0
- data/Test/ge_dfiles.rb +121 -0
- data/Test/ge_filesmanage.rb +180 -0
- data/Test/ge_info.rb +27 -0
- data/Test/ge_internet.rb +246 -0
- data/Test/ge_login.rb +55 -0
- data/Test/ge_person.rb +373 -0
- data/Test/ge_qvinfo.rb +28 -0
- data/Test/ge_report.rb +97 -0
- data/Test/ge_share.rb +27 -0
- data/Test/ge_sms.rb +34 -0
- data/Test/ge_tasks.rb +19 -0
- data/Test/ge_usage.rb +168 -0
- data/Test/ge_view.rb +46 -0
- data/Test/multiconf-captive +29 -0
- data/Test/test.conf +7 -0
- data/Test/test.rb +49 -0
- data/Test/test_bytes.png +0 -0
- data/VERSION +140 -0
- data/Views/Admin/Backup.rb +91 -0
- data/Views/Admin/Configuration.rb +44 -0
- data/Views/Admin/Credit.rb +32 -0
- data/Views/Admin/FilesManage.rb +219 -0
- data/Views/Admin/Function.rb +39 -0
- data/Views/Admin/Power.rb +49 -0
- data/Views/Admin/Printer.rb +37 -0
- data/Views/Admin/Server.rb +252 -0
- data/Views/Admin/Tabs.rb +5 -0
- data/Views/Admin/Update.rb +73 -0
- data/Views/Admin/UpdateSystem.rb +26 -0
- data/Views/Cashbox/Activity.rb +191 -0
- data/Views/Cashbox/Course.rb +141 -0
- data/Views/Cashbox/Credit.rb +79 -0
- data/Views/Cashbox/Report.rb +115 -0
- data/Views/Cashbox/Service.rb +105 -0
- data/Views/Cashbox/Tabs.rb +10 -0
- data/Views/Compta/Accounts.rb +36 -0
- data/Views/Compta/Course.rb +96 -0
- data/Views/Compta/Show.rb +6 -0
- data/Views/Compta/Transfer.rb +66 -0
- data/Views/Course/Diploma.rb +203 -0
- data/Views/Course/Grade.rb +401 -0
- data/Views/Course/Modify.rb +447 -0
- data/Views/Course/Print.rb +94 -0
- data/Views/Course/Responsible.rb +44 -0
- data/Views/Course/Stats.rb +76 -0
- data/Views/Course/Students.rb +92 -0
- data/Views/Course/Tabs.rb +220 -0
- data/Views/Internet/Access.rb +134 -0
- data/Views/Internet/ClassEdit.rb +24 -0
- data/Views/Internet/ClassUsers.rb +81 -0
- data/Views/Internet/Config.rb +32 -0
- data/Views/Internet/Mobile.rb +213 -0
- data/Views/Internet/Recharges.rb +49 -0
- data/Views/Internet/Tabs.rb +6 -0
- data/Views/Inventory/Computer.rb +24 -0
- data/Views/Inventory/Room.rb +18 -0
- data/Views/Inventory/Tabs.rb +9 -0
- data/Views/Inventory/TicketClosed.rb +7 -0
- data/Views/Inventory/TicketOpen.rb +23 -0
- data/Views/Library/Person.rb +36 -0
- data/Views/Library/Tabs.rb +7 -0
- data/Views/Network/Block.rb +87 -0
- data/Views/Network/Netdevs.rb +21 -0
- data/Views/Network/Restriction.rb +37 -0
- data/Views/Network/Share.rb +167 -0
- data/Views/Network/Tables.rb +28 -0
- data/Views/Network/Tabs.rb +6 -0
- data/Views/Person/Admin.rb +99 -0
- data/Views/Person/Center.rb +48 -0
- data/Views/Person/Course.rb +72 -0
- data/Views/Person/Modify.rb +153 -0
- data/Views/Person/Tabs.rb +162 -0
- data/Views/Report/ComptaExecutive.rb +221 -0
- data/Views/Report/ComptaFlat.rb +79 -0
- data/Views/Report/ReportCourse.rb +47 -0
- data/Views/Report/Tabs.rb +8 -0
- data/Views/Report/Usage.rb +52 -0
- data/Views/Report/UsageCases.rb +59 -0
- data/Views/Self/Cash.rb +67 -0
- data/Views/Self/Chat.rb +55 -0
- data/Views/Self/Concours.rb +109 -0
- data/Views/Self/Email.rb +34 -0
- data/Views/Self/Internet.rb +255 -0
- data/Views/Self/Results.rb +17 -0
- data/Views/Self/Services.rb +85 -0
- data/Views/Self/Show.rb +47 -0
- data/Views/Self/Tabs.rb +5 -0
- data/Views/Special/DFileEdit.rb +13 -0
- data/Views/Special/PlugEdit.rb +56 -0
- data/Views/Special/Tabs.rb +6 -0
- data/Views/Special/Vnc.rb +39 -0
- data/Views/Task/Client.rb +21 -0
- data/Views/Task/Edit.rb +33 -0
- data/Views/Task/List.rb +55 -0
- data/Views/Task/Tabs.rb +9 -0
- data/Views/Task/Worker.rb +30 -0
- data/Views/Template/Activity.rb +33 -0
- data/Views/Template/CourseType.rb +63 -0
- data/Views/Template/ScheduleType.rb +29 -0
- data/Views/Template/Tabs.rb +5 -0
- data/Views/Welcome.rb +121 -0
- data/config.yaml.default +36 -0
- data/po/Gestion-ar.po +2356 -0
- data/po/Gestion-en.mo +0 -0
- data/po/Gestion-en.po +4363 -0
- data/po/Gestion-fr.mo +0 -0
- data/po/Gestion-fr.po +4345 -0
- data/po/traduction-ar.rtf +76 -0
- 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,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
|