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.
- 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,447 @@
|
|
|
1
|
+
# Let's you add, modify and delete a course, as well as manage students.
|
|
2
|
+
# It is written to work together with a Moodle-installation. Moodle-configuration
|
|
3
|
+
# over LDAP is:
|
|
4
|
+
# - First name: sn
|
|
5
|
+
# - Name: givenName
|
|
6
|
+
# - E-mail: mail
|
|
7
|
+
# - Town: l
|
|
8
|
+
# - Country: st
|
|
9
|
+
# - Telephone1: mobile
|
|
10
|
+
#
|
|
11
|
+
# Configuration
|
|
12
|
+
# town - the default town
|
|
13
|
+
# country - the default country
|
|
14
|
+
|
|
15
|
+
class CourseModify < View
|
|
16
|
+
include PrintButton
|
|
17
|
+
|
|
18
|
+
def layout
|
|
19
|
+
set_data_class :Courses
|
|
20
|
+
@update = true
|
|
21
|
+
@order = 10
|
|
22
|
+
|
|
23
|
+
gui_hboxg do
|
|
24
|
+
gui_vboxg :nogroup do
|
|
25
|
+
gui_hboxg :nogroup do
|
|
26
|
+
gui_vbox :nogroup do
|
|
27
|
+
show_block :name
|
|
28
|
+
show_arg :name, :ro => true
|
|
29
|
+
#show_arg :ctype, :all => true
|
|
30
|
+
show_block :calendar
|
|
31
|
+
show_block :teacher
|
|
32
|
+
#show_block :center
|
|
33
|
+
show_button :edit_name
|
|
34
|
+
end
|
|
35
|
+
gui_vboxg :nogroup do
|
|
36
|
+
show_block :content
|
|
37
|
+
|
|
38
|
+
show_print :print_presence
|
|
39
|
+
gui_vboxg do
|
|
40
|
+
gui_fields do
|
|
41
|
+
show_list :students, :width => 300, :flexheight => 1
|
|
42
|
+
show_button :bulk_add, :del_student, :edit_student,
|
|
43
|
+
:transfer_student
|
|
44
|
+
end
|
|
45
|
+
show_print :print_student
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
gui_window :students_bulk do
|
|
49
|
+
show_text :names
|
|
50
|
+
show_button :bulk_students, :close
|
|
51
|
+
end
|
|
52
|
+
gui_window :ask_double do
|
|
53
|
+
show_str :double_name
|
|
54
|
+
show_entity_person :double_proposition, :single, :full_name,
|
|
55
|
+
:width => 350, :maxheight => 250
|
|
56
|
+
show_button :accept, :create_new, :cancel
|
|
57
|
+
end
|
|
58
|
+
gui_window :missing_data do
|
|
59
|
+
show_html :missing
|
|
60
|
+
show_button :close
|
|
61
|
+
end
|
|
62
|
+
gui_window :printing do
|
|
63
|
+
show_html :msg_print
|
|
64
|
+
show_int_hidden :step
|
|
65
|
+
show_button :print_next, :close
|
|
66
|
+
end
|
|
67
|
+
gui_window :transfer do
|
|
68
|
+
show_entity_course :transfer_course, :drop, :name
|
|
69
|
+
show_button :do_transfer, :close
|
|
70
|
+
end
|
|
71
|
+
gui_window :win_edit_name do
|
|
72
|
+
show_entity_courseType :wen_ctype, :drop, :name
|
|
73
|
+
show_str :wen_name, :width => 200
|
|
74
|
+
show_list_drop :wen_overwrite, '%w( no yes )'
|
|
75
|
+
show_button :wen_save, :close
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
show_button :save
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def rpc_button_save(session, data)
|
|
84
|
+
if course = Courses.match_by_name(data['name'])
|
|
85
|
+
# BUG: they're already saved, don't save it again
|
|
86
|
+
dputs(4) { "Found course #{course.inspect}" }
|
|
87
|
+
data.delete('students')
|
|
88
|
+
dputs(4) { "Setting data #{data}" }
|
|
89
|
+
course.data_set_hash(data)
|
|
90
|
+
else
|
|
91
|
+
dputs(5) { "Didn't find course #{data['name']}" }
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def rpc_button_bulk_add(session, data)
|
|
96
|
+
if data['name']
|
|
97
|
+
reply(:window_show, 'students_bulk')
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def update_students(course)
|
|
102
|
+
reply(:empty, :students) +
|
|
103
|
+
reply(:update, :students => course.list_students)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def rpc_button_del_student(session, data)
|
|
107
|
+
if course = Courses.match_by_name(data['name'])
|
|
108
|
+
data['students'].each { |s|
|
|
109
|
+
course.students.delete(s)
|
|
110
|
+
}
|
|
111
|
+
update_students(course)
|
|
112
|
+
else
|
|
113
|
+
dputs(0) { "Error: #{session.owner.inspect} managed to press button" }
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def rpc_button_edit_student(session, data)
|
|
118
|
+
dputs(3) { "data is: #{data.inspect}" }
|
|
119
|
+
login = data['students'][0]
|
|
120
|
+
reply('parent',
|
|
121
|
+
reply(:init_values, [:PersonTabs, {:search => login, :persons => []}]) +
|
|
122
|
+
reply(:switch_tab, :PersonTabs)) +
|
|
123
|
+
reply(:switch_tab, :PersonModify)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def rpc_button_transfer_student(session, data)
|
|
127
|
+
return if data._students.length == 0
|
|
128
|
+
|
|
129
|
+
reply(:window_show, :transfer) +
|
|
130
|
+
reply(:empty, :transfer_course) +
|
|
131
|
+
reply(:update, :transfer_course => Courses.list_courses(session))
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def rpc_button_do_transfer(session, data)
|
|
135
|
+
reply(:window_hide) +
|
|
136
|
+
if course = Courses.match_by_name(data._name)
|
|
137
|
+
data._students.each { |s|
|
|
138
|
+
course.transfer_student(s, data._transfer_course)
|
|
139
|
+
}
|
|
140
|
+
update_students(course)
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def rpc_button_print_next(session, data)
|
|
145
|
+
rpc_button_print_student_steps(session, data)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def rpc_button_print_student_steps(session, data)
|
|
149
|
+
#dputs_func
|
|
150
|
+
ret = reply(:callback_button, :print_student_steps)
|
|
151
|
+
var = session.s_data[:print_student]
|
|
152
|
+
dputs(3) { "Doing with data #{var.inspect} step is #{var._step.inspect}" }
|
|
153
|
+
case var._step
|
|
154
|
+
when 1
|
|
155
|
+
dputs(3) { 'Showing prepare-window' }
|
|
156
|
+
ret += reply(:window_show, :printing) +
|
|
157
|
+
reply(:update, :msg_print => 'Preparing students: <br><br>' +
|
|
158
|
+
var._students.each_slice(5).collect { |s| s.join(', ') }.join(',<br>')) +
|
|
159
|
+
reply(:hide, :print_next)
|
|
160
|
+
when 2
|
|
161
|
+
dputs(3) { "Printing pdfs for #{var._students.inspect}" }
|
|
162
|
+
files = var._students.collect { |s|
|
|
163
|
+
dputs(2) { "Printing for #{s}" }
|
|
164
|
+
Persons.match_by_login_name(s).print(:student)
|
|
165
|
+
}
|
|
166
|
+
var._pages = OpenPrint.pdf_nup_duplex(files, 'student_cards')
|
|
167
|
+
cmd = cmd_printer(session, :print_student)
|
|
168
|
+
dputs(3) { "Command is #{cmd} with pages #{var._pages.inspect}" }
|
|
169
|
+
if not cmd
|
|
170
|
+
ret = reply(:window_show, :printing) +
|
|
171
|
+
reply(:update, :msg_print => 'Click on one of the links:<ul>' +
|
|
172
|
+
var._pages.collect { |r| "<li><a target='other' href=\"#{r}\">#{r}</a></li>" }.join('') +
|
|
173
|
+
'</ul>')
|
|
174
|
+
var._step = 9
|
|
175
|
+
elsif var._pages.length > 0
|
|
176
|
+
ret = reply(:window_show, :printing) +
|
|
177
|
+
reply(:update, :msg_print => 'Impression de la page face en cours pour<ul>' +
|
|
178
|
+
"<li>#{var._students.join('</li><li>')}</li></ul>" +
|
|
179
|
+
"<br>Cliquez sur 'suivant' pour imprimer les pages arrières") +
|
|
180
|
+
reply(:unhide, :print_next)
|
|
181
|
+
cmd += " #{var._pages[0]}"
|
|
182
|
+
dputs(3) { "Printing-cmd is #{cmd.inspect}" }
|
|
183
|
+
System.run_str(cmd)
|
|
184
|
+
else
|
|
185
|
+
var._step = 9
|
|
186
|
+
end
|
|
187
|
+
when 3
|
|
188
|
+
cmd = cmd_printer(session, :print_student)
|
|
189
|
+
dputs(3) { "Command is #{cmd} with pages #{var._pages.inspect}" }
|
|
190
|
+
ret = reply(:window_show, :printing) +
|
|
191
|
+
reply(:update, :msg_print => 'Impression de la page face arrière en cours<ul>' +
|
|
192
|
+
"<li>#{var._students.join('</li><li>')}</li></ul>") +
|
|
193
|
+
reply(:hide, :print_next)
|
|
194
|
+
cmd += " -o outputorder=reverse #{var._pages[1]}"
|
|
195
|
+
dputs(3) { "Printing-cmd is #{cmd.inspect}" }
|
|
196
|
+
System.run_bool(cmd)
|
|
197
|
+
when 4..10
|
|
198
|
+
dputs(3) { 'Hiding' }
|
|
199
|
+
ret = reply(:window_hide)
|
|
200
|
+
else
|
|
201
|
+
dputs(3) { "Oups - step is #{var._step.inspect}" }
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
var._step += 1
|
|
205
|
+
session.s_data[:print_student] = var
|
|
206
|
+
dputs(3) { "Ret is #{ret.inspect}" }
|
|
207
|
+
return ret
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def rpc_button_print_student(session, data)
|
|
211
|
+
#dputs_func
|
|
212
|
+
rep = []
|
|
213
|
+
ret = rpc_print(session, :print_student, data)
|
|
214
|
+
dputs(3) { "#{data['students'].inspect}" }
|
|
215
|
+
students = if data['students'] and data['students'].length > 0
|
|
216
|
+
data['students']
|
|
217
|
+
else
|
|
218
|
+
Courses.match_by_name(data['name']).students
|
|
219
|
+
end
|
|
220
|
+
dputs(3) { "Students to print: #{students.inspect}" }
|
|
221
|
+
if students
|
|
222
|
+
students.each { |s|
|
|
223
|
+
student = Persons.match_by_login_name(s)
|
|
224
|
+
dputs(2) { "Printing student #{student.full_name}" }
|
|
225
|
+
student.lp_cmd = nil
|
|
226
|
+
rep.push student.login_name
|
|
227
|
+
}
|
|
228
|
+
session.s_data[:print_student] = {:step => 1, :students => rep}
|
|
229
|
+
return ret + rpc_button_print_student_steps(session, data)
|
|
230
|
+
end
|
|
231
|
+
ret
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def rpc_button_print_presence(session, data)
|
|
235
|
+
ret = rpc_print(session, :print_presence, data)
|
|
236
|
+
lp_cmd = cmd_printer(session, :print_presence)
|
|
237
|
+
if data['name'] and data['name'].length > 0
|
|
238
|
+
course = Courses.match_by_name(data['name'])
|
|
239
|
+
case rep = course.print_presence(lp_cmd)
|
|
240
|
+
when true
|
|
241
|
+
ret + reply(:window_show, :printing) +
|
|
242
|
+
reply(:update, :msg_print => "Impression de la fiche de présence pour<br>#{data['name']} en cours") +
|
|
243
|
+
reply(:hide, :print_next)
|
|
244
|
+
when false
|
|
245
|
+
str = [[course.start, 'start-date'],
|
|
246
|
+
[course.end, 'end-date'],
|
|
247
|
+
[course.students.count > 0, 'students']].select { |t, s| !t }.
|
|
248
|
+
collect { |t, s| "<li>#{s}</li>" }.join('')
|
|
249
|
+
|
|
250
|
+
ret + reply(:window_show, :missing_data) +
|
|
251
|
+
reply(:update, :missing => 'One of the following is missing:<ul>' +
|
|
252
|
+
"#{str}</ul>")
|
|
253
|
+
else
|
|
254
|
+
ret + reply(:window_show, :missing_data) +
|
|
255
|
+
reply(:update, :missing => "Click on the link: <a target='other' href=\"#{rep}\">PDF</a>")
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# This will add a whole lot of students to the list, creating them and setting
|
|
261
|
+
# the permissions to "student" and setting a simple, 4-digit password
|
|
262
|
+
# As the creation of a student can take quite some time (10s of seconds),
|
|
263
|
+
# only one student is created, then the list updated, and a new request is
|
|
264
|
+
# automatically generated.
|
|
265
|
+
def rpc_button_bulk_students(session, data)
|
|
266
|
+
dputs(3) { data.inspect }
|
|
267
|
+
course = Courses.match_by_name(data['name'])
|
|
268
|
+
users = []
|
|
269
|
+
session.s_data[:perhaps_double] ||= []
|
|
270
|
+
if data['names'] and users = data['names'].split("\n")
|
|
271
|
+
prefix = ConfigBase.has_function?(:course_server) ?
|
|
272
|
+
"#{session.owner.login_name}_" : ''
|
|
273
|
+
name = users.shift
|
|
274
|
+
login_name = Persons.create_login_name(name)
|
|
275
|
+
if not (person = Persons.match_by_login_name(prefix + name))
|
|
276
|
+
if Persons.search_by_login_name("^#{prefix}#{login_name}[0-9]*$").length > 0
|
|
277
|
+
session.s_data[:perhaps_double].push name
|
|
278
|
+
else
|
|
279
|
+
person = Persons.create({:first_name => name,
|
|
280
|
+
:login_name_prefix => prefix,
|
|
281
|
+
:permissions => %w( student ), :town => @town, :country => @country})
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
#person.email = "#{person.login_name}@ndjair.net"
|
|
285
|
+
person and course.students_add person
|
|
286
|
+
end
|
|
287
|
+
if users.length > 0
|
|
288
|
+
reply(:update, {:names => users.join("\n")}) +
|
|
289
|
+
update_students(course) +
|
|
290
|
+
reply(:callback_button, :bulk_students)
|
|
291
|
+
else
|
|
292
|
+
update_students(course) +
|
|
293
|
+
reply(:update, {:names => ''}) +
|
|
294
|
+
reply(:window_hide) +
|
|
295
|
+
present_doubles(session, course)
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
def present_doubles(session, course)
|
|
300
|
+
doubles = session.s_data[:perhaps_double]
|
|
301
|
+
dputs(4) { "Doubles are #{doubles.inspect}" }
|
|
302
|
+
if doubles and doubles.length > 0
|
|
303
|
+
prefix = ConfigBase.has_function?(:course_server) ?
|
|
304
|
+
"#{session.owner.login_name}_" : ""
|
|
305
|
+
name = doubles.pop
|
|
306
|
+
login_name = Persons.create_login_name(name)
|
|
307
|
+
prop = Persons.search_by_login_name("^#{prefix}#{login_name}[0-9]*$").
|
|
308
|
+
collect { |p|
|
|
309
|
+
courses = Courses.matches_by_students(p.login_name).collect { |c| c.name }.
|
|
310
|
+
join('-')
|
|
311
|
+
[p.person_id, "#{p.full_name}:#{p.login_name}:#{courses}"]
|
|
312
|
+
}
|
|
313
|
+
dputs(4) { "Proposition is #{prop.inspect}" }
|
|
314
|
+
reply(:window_show, :ask_double) +
|
|
315
|
+
reply(:update, :double_name => name) +
|
|
316
|
+
reply(:empty, [:double_proposition]) +
|
|
317
|
+
reply(:update, :double_proposition => prop.concat([prop.first[0]]))
|
|
318
|
+
else
|
|
319
|
+
reply(:window_hide)
|
|
320
|
+
end +
|
|
321
|
+
update_students(course)
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
def rpc_button_accept(session, data)
|
|
325
|
+
course = Courses.match_by_name(data['name'])
|
|
326
|
+
student = data._double_proposition
|
|
327
|
+
dputs(5) { "Data is #{data.inspect} - #{course.students.inspect} " +
|
|
328
|
+
"- #{student.inspect}" }
|
|
329
|
+
if not course.students.index(student.login_name)
|
|
330
|
+
course.students_add student
|
|
331
|
+
end
|
|
332
|
+
present_doubles(session, course)
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
def rpc_button_create_new(session, data)
|
|
336
|
+
course = Courses.match_by_name(data['name'])
|
|
337
|
+
prefix = ConfigBase.has_function?(:course_server) ?
|
|
338
|
+
"#{session.owner.login_name}_" : ''
|
|
339
|
+
name = data['double_name']
|
|
340
|
+
course.students_add Persons.create({:first_name => name,
|
|
341
|
+
:login_name_prefix => prefix,
|
|
342
|
+
:permissions => %w( student ), :town => @town, :country => @country})
|
|
343
|
+
present_doubles(session, course)
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
def rpc_button_close(session, data)
|
|
347
|
+
reply(:window_hide)
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
def rpc_button_cancel(session, data)
|
|
351
|
+
reply(:window_hide)
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
def rpc_list_choice(session, name, args)
|
|
355
|
+
dputs(3) { "rpc_list_choice with #{name} - #{args.inspect}" }
|
|
356
|
+
if name == 'courses' and args['courses'].length > 0
|
|
357
|
+
course_id = args['courses'][0]
|
|
358
|
+
dputs(3) { "replying for course_id #{course_id}" }
|
|
359
|
+
course = Courses.match_by_course_id(course_id)
|
|
360
|
+
reply(:empty_nonlists, [:students]) +
|
|
361
|
+
update_form_data(course) +
|
|
362
|
+
reply(:update, {:courses => [course_id]})
|
|
363
|
+
end
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
def hide_if_center(session)
|
|
367
|
+
if session.owner.permissions.index('center')
|
|
368
|
+
%w( print_student duration dow hours
|
|
369
|
+
classroom ).collect { |e|
|
|
370
|
+
reply(:hide, e)
|
|
371
|
+
}.flatten
|
|
372
|
+
else
|
|
373
|
+
[]
|
|
374
|
+
end
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
def rpc_update(session)
|
|
378
|
+
reply(:empty_nonlists, :students) +
|
|
379
|
+
super(session) +
|
|
380
|
+
reply_print(session) +
|
|
381
|
+
hide_if_center(session) +
|
|
382
|
+
reply_visible(session.owner.has_role('director'), :edit_name)
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
def update_layout(session)
|
|
386
|
+
resps = Persons.responsibles
|
|
387
|
+
if session.owner.permissions.index('center')
|
|
388
|
+
resps = Persons.responsibles_sort(
|
|
389
|
+
Persons.responsibles_raw.select { |p|
|
|
390
|
+
p.login_name =~ /^#{session.owner.login_name}_/
|
|
391
|
+
})
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
fields = %w( teacher assistant responsible )
|
|
395
|
+
|
|
396
|
+
super(session) +
|
|
397
|
+
reply(:empty_nonlists, fields) +
|
|
398
|
+
reply(:update, :assistant => [[0, '---']]) +
|
|
399
|
+
fields.collect { |p|
|
|
400
|
+
reply(:update, p => resps)
|
|
401
|
+
}.flatten
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
def rpc_update_hook(session, one, two)
|
|
405
|
+
update_layout(session)
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
def rpc_button_edit_name(session, data)
|
|
409
|
+
course = Courses.match_by_course_id(data._courses.first)
|
|
410
|
+
if course
|
|
411
|
+
log_msg :CourseModify, course
|
|
412
|
+
reply(:window_show, :win_edit_name) +
|
|
413
|
+
reply(:empty, :wen_ctype) +
|
|
414
|
+
reply(:update, :wen_ctype => CourseTypes.listp_name +
|
|
415
|
+
[course.ctype.coursetype_id],
|
|
416
|
+
:wen_name => course.name)
|
|
417
|
+
end
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
def rpc_button_wen_save(session, data)
|
|
421
|
+
#dputs_func
|
|
422
|
+
course = Courses.match_by_course_id(data._courses.first)
|
|
423
|
+
if (c = Courses.match_by_name(data._wen_name)) &&
|
|
424
|
+
c != course
|
|
425
|
+
dputs(2) { "Trying to give same name (#{data._wen_name}) to two different courses" }
|
|
426
|
+
base = data._wen_name.sub(/-[0-9]{1,3}$/, '')
|
|
427
|
+
nbr = 2
|
|
428
|
+
while (c = Courses.match_by_name("#{base}-#{nbr}")) &&
|
|
429
|
+
c != course
|
|
430
|
+
nbr += 1
|
|
431
|
+
end
|
|
432
|
+
dputs(3) { "Found #{nbr} for #{base}" }
|
|
433
|
+
data._wen_name = "#{base}-#{nbr}"
|
|
434
|
+
end
|
|
435
|
+
data._wen_name.sub!(/#{course.ctype.name}_/, "#{data._wen_ctype.name}_")
|
|
436
|
+
dputs(3) { "data._wen_name is now #{data._wen_name}" }
|
|
437
|
+
course.ctype = data._wen_ctype
|
|
438
|
+
course.rename(data._wen_name)
|
|
439
|
+
if data._wen_overwrite.first == 'yes'
|
|
440
|
+
course.data_set_hash(data._wen_ctype.to_hash.except(:name), true)
|
|
441
|
+
end
|
|
442
|
+
reply(:window_hide) +
|
|
443
|
+
reply(:parent, reply(:empty_nonlists, [:courses]) +
|
|
444
|
+
reply(:update, :courses => Entities.Courses.list_courses(session) +
|
|
445
|
+
data._courses))
|
|
446
|
+
end
|
|
447
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Prints the students of a course
|
|
2
|
+
|
|
3
|
+
class CoursePrint < View
|
|
4
|
+
include PrintButton
|
|
5
|
+
|
|
6
|
+
def layout
|
|
7
|
+
@visible = true
|
|
8
|
+
@order = 100
|
|
9
|
+
@update = true
|
|
10
|
+
|
|
11
|
+
gui_vbox do
|
|
12
|
+
gui_vbox do
|
|
13
|
+
show_print :print_presence
|
|
14
|
+
show_print :print_exam_file
|
|
15
|
+
end
|
|
16
|
+
gui_window :missing_data do
|
|
17
|
+
show_html :missing
|
|
18
|
+
show_button :close
|
|
19
|
+
end
|
|
20
|
+
gui_window :printing do
|
|
21
|
+
show_html :msg_print
|
|
22
|
+
show_button :close
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def rpc_update(session)
|
|
28
|
+
super(session) +
|
|
29
|
+
reply_print(session)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def rpc_list_choice_courses(session, args)
|
|
33
|
+
dputs(3) { "rpc_list_choice with #{name} - #{args.inspect}" }
|
|
34
|
+
if args._courses.length > 0
|
|
35
|
+
course_id = args._courses[0]
|
|
36
|
+
dputs(3) { "replying for course_id #{course_id}" }
|
|
37
|
+
course = Courses.match_by_course_id(course_id)
|
|
38
|
+
reply_visible(course.ctype.file_exam.to_s.length > 0, :print_exam_file)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def rpc_button_print_presence(session, data)
|
|
43
|
+
dputs(3) { 'printing' }
|
|
44
|
+
ret = rpc_print(session, :print_presence, data)
|
|
45
|
+
lp_cmd = cmd_printer(session, :print_presence)
|
|
46
|
+
course = Courses.match_by_course_id(data._courses[0])
|
|
47
|
+
if data._courses and data._courses.length > 0
|
|
48
|
+
case rep = course.print_presence(lp_cmd)
|
|
49
|
+
when true
|
|
50
|
+
ret + reply(:window_show, :printing) +
|
|
51
|
+
reply(:update, :msg_print => 'Impression - de la fiche de présence pour<br>' +
|
|
52
|
+
"#{course.name} en cours")
|
|
53
|
+
when false
|
|
54
|
+
ret + reply(:window_show, :missing_data) +
|
|
55
|
+
reply(:update, :missing => 'One of the following is missing:<ul><li>date</li>' +
|
|
56
|
+
'<li>students</li><li>teacher</li></ul>')
|
|
57
|
+
else
|
|
58
|
+
ret + reply(:window_show, :missing_data) +
|
|
59
|
+
reply(:update, :missing => "Click on the link: <a target='other' href=\"#{rep}\">" +
|
|
60
|
+
'PDF</a>')
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def rpc_button_print_exam_file(session, data)
|
|
66
|
+
dputs(3) { "printing with #{data._courses.inspect}" }
|
|
67
|
+
exa = 'print_exam_file'
|
|
68
|
+
ret = rpc_print(session, exa, data)
|
|
69
|
+
lp_cmd = cmd_printer(session, exa)
|
|
70
|
+
course = Courses.match_by_course_id(data._courses[0])
|
|
71
|
+
dputs(3){"lp_cmd is #{lp_cmd}"}
|
|
72
|
+
if data._courses && data._courses.length > 0
|
|
73
|
+
case rep = course.print_exam_file(lp_cmd)
|
|
74
|
+
when true
|
|
75
|
+
ret += reply(:window_show, :printing) +
|
|
76
|
+
reply(:update, :msg_print => "Impression de la fiche d'évaluation pour<br>"+
|
|
77
|
+
"#{course.name} en cours")
|
|
78
|
+
when false
|
|
79
|
+
ret += reply(:window_show, :missing_data) +
|
|
80
|
+
reply(:update, :missing => 'One of the following is missing:<ul><li>date</li>'+
|
|
81
|
+
'<li>students</li><li>teacher</li></ul>')
|
|
82
|
+
else
|
|
83
|
+
ret += reply(:window_show, :missing_data) +
|
|
84
|
+
reply(:update, :missing => "Click on the link: <a target='other' href=\"#{rep}\">"+
|
|
85
|
+
'PDF</a>')
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
return ret
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def rpc_button_close(session, data)
|
|
92
|
+
reply(:window_hide)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
class CourseResponsible < View
|
|
2
|
+
include VTListPane
|
|
3
|
+
|
|
4
|
+
def layout
|
|
5
|
+
set_data_class :Persons
|
|
6
|
+
@update = true
|
|
7
|
+
@visible = false
|
|
8
|
+
@order = 100
|
|
9
|
+
|
|
10
|
+
gui_hbox do
|
|
11
|
+
gui_vbox :nogroup do
|
|
12
|
+
vtlp_list :persons, 'login_name', 'listp_responsible'
|
|
13
|
+
show_button :new, :delete, :save
|
|
14
|
+
end
|
|
15
|
+
gui_vbox :nogroup do
|
|
16
|
+
show_block :address
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def rpc_button_save( session, data )
|
|
22
|
+
field = vtlp_get_entity( data )
|
|
23
|
+
dputs( 2 ){ "Field is #{field.inspect}, setting data #{data.inspect}" }
|
|
24
|
+
selection = data[@vtlp_field][0]
|
|
25
|
+
if field
|
|
26
|
+
field.data_set_hash( data.to_sym )
|
|
27
|
+
else
|
|
28
|
+
if data["family_name"] or data["first_name"]
|
|
29
|
+
resp = Persons.create( data.to_sym.merge(
|
|
30
|
+
{:login_name_prefix => "#{session.owner.login_name}_"} ) )
|
|
31
|
+
resp.permissions = %w( internet teacher )
|
|
32
|
+
selection = resp.id
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
dputs(3){"vtlp_method is #{@vtlp_method} - selection is #{selection.inspect}"}
|
|
36
|
+
vtlp_update_list( session, selection )
|
|
37
|
+
# [data[@vtlp_field][0], field.data_get(@vtlp_method)] )
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def rpc_update( session )
|
|
41
|
+
reply( :empty_nonlists, [:persons] ) +
|
|
42
|
+
reply( :update, :persons => Persons.listp_responsible( session ) )
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
class CourseStats < View
|
|
2
|
+
def layout
|
|
3
|
+
set_data_class :Courses
|
|
4
|
+
@update = true
|
|
5
|
+
@order = 100
|
|
6
|
+
@functions_need = [:accounting]
|
|
7
|
+
|
|
8
|
+
#@visible = false
|
|
9
|
+
|
|
10
|
+
gui_vboxg do
|
|
11
|
+
gui_hboxg :nogroup do
|
|
12
|
+
gui_vbox :nogroup do
|
|
13
|
+
show_block :accounting
|
|
14
|
+
end
|
|
15
|
+
gui_vboxg :nogroup do
|
|
16
|
+
show_text :contacts, :flexheight => 1
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
show_block :account
|
|
20
|
+
show_arg :entries, :width => 500
|
|
21
|
+
show_button :save, :create_account
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def rpc_button_save(session, data)
|
|
26
|
+
if course = Courses.match_by_course_id(data._courses.first)
|
|
27
|
+
dputs(3) { "Found course #{course.name} with data #{data.inspect}" }
|
|
28
|
+
data.delete('students')
|
|
29
|
+
course.data_set_hash(data)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def rpc_button_create_account(session, data)
|
|
34
|
+
if course = Courses.match_by_course_id(data._courses.first)
|
|
35
|
+
course.create_account
|
|
36
|
+
rpc_update_view(session) +
|
|
37
|
+
rpc_list_choice(session, 'courses', data)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def rpc_list_choice(session, name, args)
|
|
42
|
+
dputs(3) { "rpc_list_choice with #{name} - #{args.inspect}" }
|
|
43
|
+
if name == 'courses' and args['courses'].length > 0
|
|
44
|
+
course_id = args['courses'][0]
|
|
45
|
+
dputs(3) { "replying for course_id #{course_id}" }
|
|
46
|
+
course = Courses.match_by_course_id(course_id)
|
|
47
|
+
list = course.students.collect { |s| Persons.match_by_login_name(s) }.compact.
|
|
48
|
+
collect { |s| [s.phone.to_s, s.email.to_s] }.transpose
|
|
49
|
+
if list.length > 0
|
|
50
|
+
phones = list[0].select { |l| l.to_s.length > 0 }.
|
|
51
|
+
collect { |l| l.split('/').join("\n") }.join("\n")
|
|
52
|
+
emails = list[1].select { |l| l.to_s.length > 0 && !(l[1] =~ /@ndjair.net/) }.
|
|
53
|
+
join("\n")
|
|
54
|
+
else
|
|
55
|
+
phones = emails = ''
|
|
56
|
+
end
|
|
57
|
+
reply(:empty_nonlists) +
|
|
58
|
+
reply(:update, :entries => [0]) +
|
|
59
|
+
update_form_data(course) +
|
|
60
|
+
reply_visible(course.entries.class != Account, :create_account) +
|
|
61
|
+
reply(:update, :contacts => "Phones:\n#{phones}\n" +
|
|
62
|
+
"Emails:\n#{emails}")
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def rpc_update_view(session)
|
|
67
|
+
super(session) +
|
|
68
|
+
reply(:empty_nonlists, :entries) +
|
|
69
|
+
reply(:update, :entries =>
|
|
70
|
+
[[0, 'None']].concat(AccountRoot.actual.listp_path))
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def rpc_update(session)
|
|
74
|
+
reply(:update, :entries => [0])
|
|
75
|
+
end
|
|
76
|
+
end
|