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,92 @@
|
|
1
|
+
# Manages grades of a course
|
2
|
+
# - Add or change grades
|
3
|
+
# - Print out grades
|
4
|
+
|
5
|
+
class CourseStudents < View
|
6
|
+
def layout
|
7
|
+
set_data_class :Courses
|
8
|
+
|
9
|
+
@update = true
|
10
|
+
@order = 30
|
11
|
+
|
12
|
+
gui_hboxg do
|
13
|
+
gui_vboxg :nogroup do
|
14
|
+
show_list_single :students, :width => 300, :callback => true, :flexheight => 1
|
15
|
+
end
|
16
|
+
gui_vbox :nogroup do
|
17
|
+
gui_vbox :nogroup do
|
18
|
+
show_str :first_name, :width => 150
|
19
|
+
show_str :family_name
|
20
|
+
show_list_drop :gender, '%w( male female n/a )'
|
21
|
+
show_button :save
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def rpc_update(session)
|
28
|
+
super(session) +
|
29
|
+
reply(:empty_nonlists, [:students])
|
30
|
+
end
|
31
|
+
|
32
|
+
def update_student(data)
|
33
|
+
c_id, p_name = data._courses[0], data._students[0]
|
34
|
+
if p_name and c_id
|
35
|
+
person = Persons.match_by_login_name(p_name)
|
36
|
+
update_form_data(person)
|
37
|
+
else
|
38
|
+
[]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def rpc_list_choice(session, name, data, select = nil)
|
43
|
+
dputs(3) { "rpc_list_choice with #{name} - #{data.inspect}" }
|
44
|
+
ret = []
|
45
|
+
course_id = data._courses[0]
|
46
|
+
course = Courses.match_by_course_id(course_id)
|
47
|
+
case name
|
48
|
+
when 'courses'
|
49
|
+
if course
|
50
|
+
dputs(3) { 'replying' }
|
51
|
+
ret = rpc_update(session) +
|
52
|
+
reply(:empty_nonlists, :students) +
|
53
|
+
update_form_data(course) +
|
54
|
+
reply(:update, {:courses => [course_id]})
|
55
|
+
ls = course.list_students
|
56
|
+
if course.students.size > 0 && ls.size > 0
|
57
|
+
first = if select
|
58
|
+
# Fetch the next element, first one if it was the last one
|
59
|
+
ls[((0...ls.length).find{ |i|
|
60
|
+
ls[i][0] == select
|
61
|
+
}.to_i + 1) % ls.length][0]
|
62
|
+
else
|
63
|
+
course.list_students[0][0]
|
64
|
+
end
|
65
|
+
ret += reply(:update, {:students => [first]})
|
66
|
+
end
|
67
|
+
|
68
|
+
dputs(4) { "Course is #{course} - ret is #{ret.inspect}" }
|
69
|
+
end
|
70
|
+
when 'students'
|
71
|
+
ret += update_student(data)
|
72
|
+
end
|
73
|
+
|
74
|
+
ret
|
75
|
+
end
|
76
|
+
|
77
|
+
def rpc_button_save(session, data)
|
78
|
+
dputs(3) { "Data is #{data.inspect}" }
|
79
|
+
c_id, p_name = data._courses.first, data._students.first
|
80
|
+
course = Courses.match_by_course_id(c_id)
|
81
|
+
student = Entities.Persons.match_by_login_name(p_name)
|
82
|
+
if course and student
|
83
|
+
if data._first_name
|
84
|
+
Entities.Persons.save_data({:person_id => student.person_id,
|
85
|
+
:first_name => data._first_name,
|
86
|
+
:family_name => data._family_name,
|
87
|
+
:gender => data._gender})
|
88
|
+
end
|
89
|
+
rpc_list_choice(session, 'courses', data, p_name)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,220 @@
|
|
1
|
+
class CourseTabs < View
|
2
|
+
def layout
|
3
|
+
@order = 20
|
4
|
+
@update = true
|
5
|
+
@functions_need = [:courses]
|
6
|
+
|
7
|
+
gui_vbox :nogroup do
|
8
|
+
show_str :search_txt
|
9
|
+
show_list_single :courses, :flexheight => 1, :callback => true,
|
10
|
+
:width => 100
|
11
|
+
show_button :search, :delete, :add, :import
|
12
|
+
end
|
13
|
+
|
14
|
+
gui_window :error do
|
15
|
+
show_html "<h1>You're not allowed to do that</h1>"
|
16
|
+
show_button :close
|
17
|
+
end
|
18
|
+
|
19
|
+
gui_window :not_all_elements do
|
20
|
+
gui_vbox do
|
21
|
+
gui_vbox :nogroup do
|
22
|
+
show_str :ct_name
|
23
|
+
show_int :ct_duration
|
24
|
+
show_str :ct_desc
|
25
|
+
show_text :ct_contents
|
26
|
+
show_list_drop :ct_filename, 'CourseTypes.files'
|
27
|
+
end
|
28
|
+
gui_vbox :nogroup do
|
29
|
+
show_str :new_room
|
30
|
+
show_str :new_teacher
|
31
|
+
show_str :new_center
|
32
|
+
end
|
33
|
+
show_button :add_missing, :close
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
gui_window :add_course do
|
38
|
+
gui_hbox :nogroup do
|
39
|
+
gui_vbox :nogroup do
|
40
|
+
show_entity_courseType_all :new_ctype, :drop, :name
|
41
|
+
show_str :name_date
|
42
|
+
show_entity_person :new_center_course, :drop, :full_name
|
43
|
+
show_button :new_course, :close
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
gui_window :win_confirm do
|
48
|
+
show_html :confirm_delete_txt
|
49
|
+
show_button :confirm_delete, :close
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def rpc_update(session)
|
55
|
+
hide = []
|
56
|
+
if CourseTypes.data.size > 0
|
57
|
+
hide.push :ct_name, :ct_duration, :ct_desc, :ct_contents, :ct_filename
|
58
|
+
end
|
59
|
+
if Rooms.data.size > 0
|
60
|
+
hide.push :new_room
|
61
|
+
end
|
62
|
+
if (teachers = Persons.list_teachers).size > 0
|
63
|
+
session.owner.permissions
|
64
|
+
if (!session.owner.permissions.index('center')) ||
|
65
|
+
teachers.select { |t| t =~ /^#{session.owner.login_name}_/ }.length > 0
|
66
|
+
hide.push :new_teacher
|
67
|
+
end
|
68
|
+
end
|
69
|
+
if Persons.find_by_permissions(:center)
|
70
|
+
hide.push :new_center
|
71
|
+
end
|
72
|
+
if hide.size < 8
|
73
|
+
(reply(:window_show, :not_all_elements) +
|
74
|
+
hide.collect { |h| reply(:hide, h) }).flatten
|
75
|
+
else
|
76
|
+
rep = reply(:empty_nonlists, [:courses]) +
|
77
|
+
reply(:update, :courses => Courses.list_courses(session))
|
78
|
+
if not session.can_view('FlagAdminCourse')
|
79
|
+
rep += reply(:hide, :delete) + reply(:hide, :add)
|
80
|
+
end
|
81
|
+
rep + reply(:hide, :import) + reply(:focus, :search_txt)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def rpc_button_add_missing(session, args)
|
86
|
+
args.to_sym!
|
87
|
+
dputs(5) { args.inspect }
|
88
|
+
if args._ct_name and args._ct_name.size > 0
|
89
|
+
dputs(3) { 'Creating CourseType' }
|
90
|
+
ct = CourseTypes.create(:name => args._ct_name, :duration => args._ct_duration,
|
91
|
+
:tests_str => 'Mean', :description => args._ct_desc,
|
92
|
+
:contents => args._ct_contents,
|
93
|
+
:diploma_type => ['simple'], :output => ['certificate'],
|
94
|
+
:page_format => [1], :file_diploma => args._ct_filename)
|
95
|
+
dputs(1) { "New CourseType is #{ct.inspect}" }
|
96
|
+
end
|
97
|
+
if args._new_room and args._new_room.size > 0
|
98
|
+
dputs(3) { 'Creating Room' }
|
99
|
+
room = Rooms.create(:name => args._new_room)
|
100
|
+
dputs(1) { "New room is #{room.inspect}" }
|
101
|
+
end
|
102
|
+
if args._new_teacher and args._new_teacher.size > 0
|
103
|
+
dputs(3) { 'Creating Teacher' }
|
104
|
+
teacher = Persons.create_person(args._new_teacher, session.owner)
|
105
|
+
teacher.permissions = ['teacher']
|
106
|
+
dputs(1) { "New teacher #{teacher.inspect}" }
|
107
|
+
end
|
108
|
+
if args._new_center and args._new_center.size > 0
|
109
|
+
dputs(3) { 'Creating Center' }
|
110
|
+
center = Persons.create(:complete_name => args._new_center)
|
111
|
+
center.permissions = ['center']
|
112
|
+
dputs(1) { "New center #{center.inspect}" }
|
113
|
+
end
|
114
|
+
reply(:window_hide) +
|
115
|
+
rpc_update(session) +
|
116
|
+
rpc_update_view(session) +
|
117
|
+
reply(:pass_tabs, [:update_hook])
|
118
|
+
end
|
119
|
+
|
120
|
+
def rpc_button_delete(session, args)
|
121
|
+
if not session.can_view('FlagAdminCourse')
|
122
|
+
return reply(:window_show, :error)
|
123
|
+
end
|
124
|
+
dputs(3) { "session, data: #{[session, args.inspect].join(':')}" }
|
125
|
+
course = Courses.match_by_course_id(args['courses'][0])
|
126
|
+
dputs(3) { "Got #{course.name} - #{course.inspect}" }
|
127
|
+
if course
|
128
|
+
return reply(:window_show, :win_confirm) +
|
129
|
+
reply(:update, :confirm_delete_txt => 'Do you really want to delete<br>' +
|
130
|
+
"course #{course.name}?")
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def rpc_button_confirm_delete(session, args)
|
135
|
+
if not session.can_view('FlagAdminCourse')
|
136
|
+
return reply(:window_show, :error)
|
137
|
+
end
|
138
|
+
dputs(3) { "session, data: #{[session, args.inspect].join(':')}" }
|
139
|
+
course = Courses.match_by_course_id(args['courses'][0])
|
140
|
+
dputs(3) { "Got #{course.name} - #{course.inspect}" }
|
141
|
+
if course
|
142
|
+
dputs(2) { "Deleting entry #{course}" }
|
143
|
+
log_msg :Course, "User #{session.owner.login_name} deletes course #{course.name}"
|
144
|
+
course.delete
|
145
|
+
course.changed = true
|
146
|
+
end
|
147
|
+
|
148
|
+
reply(:empty_nonlists, [:courses]) +
|
149
|
+
reply(:update, {:courses => Courses.list_courses(session)}) +
|
150
|
+
reply(:child, reply(:empty_nonlists, [:students])) +
|
151
|
+
reply(:window_hide)
|
152
|
+
end
|
153
|
+
|
154
|
+
def rpc_button_new_course(session, data)
|
155
|
+
dputs(3) { "session: #{session} - data: #{data.inspect}" }
|
156
|
+
|
157
|
+
course = Courses.create_ctype(data._new_ctype, data._name_date,
|
158
|
+
session.owner)
|
159
|
+
|
160
|
+
if session.owner.permissions.index('center')
|
161
|
+
course.teacher = course.responsible = Persons.responsibles_raw.select { |p|
|
162
|
+
p.login_name =~ /^#{session.owner.login_name}_/ }.first
|
163
|
+
else
|
164
|
+
course.teacher = Persons.find_by_permissions('teacher')
|
165
|
+
course.responsible = Persons.find_by_permissions('director') ||
|
166
|
+
course.teacher
|
167
|
+
end
|
168
|
+
|
169
|
+
log_msg :coursetabs, "Adding new course #{course.inspect}"
|
170
|
+
|
171
|
+
reply(:window_hide) +
|
172
|
+
rpc_update(session) +
|
173
|
+
reply(:update, :courses => [course.course_id])
|
174
|
+
end
|
175
|
+
|
176
|
+
def rpc_button_add(session, data)
|
177
|
+
reply(:window_show, :add_course) +
|
178
|
+
reply(:update, :name_date => "#{Date.today.strftime('%y%m')}") +
|
179
|
+
if ConfigBase.has_function?(:course_server) &&
|
180
|
+
session._owner.has_role(:admin)
|
181
|
+
reply(:show, :new_center_course) +
|
182
|
+
reply(:empty_update, :new_center_course => Persons.centers.
|
183
|
+
collect{|c| c.to_list_id})
|
184
|
+
else
|
185
|
+
reply(:hide, :new_center_course)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
def rpc_button_close(session, data)
|
190
|
+
reply(:window_hide)
|
191
|
+
end
|
192
|
+
|
193
|
+
def rpc_button_search(session, data)
|
194
|
+
txt = data._search_txt
|
195
|
+
return unless txt.to_s.length >= 2
|
196
|
+
courses = Courses.search_all_.select{|c|
|
197
|
+
c.name + (c.ctype ? c.ctype.name : '') + c.students.to_s +
|
198
|
+
[c.teacher, c.responsible].collect{|p| p && p.full_login}.join =~ /#{txt}/i
|
199
|
+
}
|
200
|
+
reply(:empty_nonlists, [:courses]) +
|
201
|
+
reply(:update, :courses => Courses.sort_courses(courses))
|
202
|
+
end
|
203
|
+
|
204
|
+
def rpc_list_choice(session, name, args)
|
205
|
+
dputs(3) { "New choice #{name} - #{args.inspect}" }
|
206
|
+
|
207
|
+
reply(:pass_tabs, ['list_choice', name, args]) +
|
208
|
+
reply(:fade_in, :parent_child)
|
209
|
+
end
|
210
|
+
|
211
|
+
def rpc_list_choice_sub(session, name, args)
|
212
|
+
dputs(3) { "Sub-tab called with #{name}" }
|
213
|
+
end
|
214
|
+
|
215
|
+
def rpc_update_view(session, args = nil)
|
216
|
+
super(session, args) +
|
217
|
+
reply(:fade_in, 'parent,windows') +
|
218
|
+
reply(:focus, :search_txt)
|
219
|
+
end
|
220
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
class InternetAccess < View
|
2
|
+
include VTListPane
|
3
|
+
|
4
|
+
def layout
|
5
|
+
@order = 500
|
6
|
+
@functions_need = [:internet, :network_pro]
|
7
|
+
|
8
|
+
set_data_class :AccessGroups
|
9
|
+
|
10
|
+
gui_hbox do
|
11
|
+
gui_vbox :nogroup do
|
12
|
+
vtlp_list :groups, :name
|
13
|
+
show_button :new, :delete
|
14
|
+
end
|
15
|
+
gui_vbox :nogroup do
|
16
|
+
show_field :name
|
17
|
+
show_field :action
|
18
|
+
show_field :priority
|
19
|
+
show_field :limit_day_mo
|
20
|
+
show_list_single :access_times_view
|
21
|
+
show_fromto :time
|
22
|
+
show_button :save, :add_time, :delete_time
|
23
|
+
end
|
24
|
+
gui_vbox :nogroup do
|
25
|
+
show_list_single :members_view
|
26
|
+
show_str :login_name
|
27
|
+
show_button :add_member, :delete_member
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def update_access_times(group)
|
33
|
+
ats = if group.access_times and (group.access_times.size > 0)
|
34
|
+
group.access_times
|
35
|
+
else
|
36
|
+
['Always']
|
37
|
+
end
|
38
|
+
reply(:empty, [:access_times_view]) +
|
39
|
+
reply(:update, :access_times_view => ats)
|
40
|
+
end
|
41
|
+
|
42
|
+
def update_members(group)
|
43
|
+
if group and group.members
|
44
|
+
members = group.members.collect { |m|
|
45
|
+
if member = Persons.match_by_login_name(m)
|
46
|
+
name = member.full_name
|
47
|
+
name.to_s == 0 and name = member.login_name
|
48
|
+
[member.login_name, name]
|
49
|
+
else
|
50
|
+
[]
|
51
|
+
end
|
52
|
+
}
|
53
|
+
else
|
54
|
+
members = []
|
55
|
+
end
|
56
|
+
members.size == 0 and members = [[0, 'All users']]
|
57
|
+
return reply(:empty_update, :members_view => members)
|
58
|
+
end
|
59
|
+
|
60
|
+
def rpc_button_new(session, data)
|
61
|
+
reply(:empty_nonlists, [:access_times_view]) +
|
62
|
+
update_members(nil) +
|
63
|
+
vtlp_update_list(session)
|
64
|
+
end
|
65
|
+
|
66
|
+
def rpc_button_add_time(session, data)
|
67
|
+
rep = rpc_button_save(session, data)
|
68
|
+
if group = AccessGroups.match_by_name(data._name)
|
69
|
+
if not group.access_times
|
70
|
+
group.access_times = []
|
71
|
+
end
|
72
|
+
time = data['time'].join(';')
|
73
|
+
if not group.access_times.index(time)
|
74
|
+
group.access_times += [time]
|
75
|
+
end
|
76
|
+
rep += update_access_times(group)
|
77
|
+
end
|
78
|
+
return rep
|
79
|
+
end
|
80
|
+
|
81
|
+
def rpc_button_delete_time(session, data)
|
82
|
+
if (group = AccessGroups.match_by_accessgroup_id(data._groups[0])) and
|
83
|
+
(time = data['access_times_view'][0]) and
|
84
|
+
group.access_times
|
85
|
+
group.access_times.delete(time)
|
86
|
+
update_access_times(group)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def rpc_button_add_member(session, data)
|
91
|
+
if (person = Persons.match_by_login_name(data._login_name)) and
|
92
|
+
(group = AccessGroups.match_by_accessgroup_id(data._groups[0]))
|
93
|
+
dputs(3) { "Found person #{person.inspect} and group #{group.inspect}" }
|
94
|
+
if not group.members
|
95
|
+
group.members = []
|
96
|
+
end
|
97
|
+
if not group.members.index person.login_name
|
98
|
+
group.members.push person.login_name
|
99
|
+
end
|
100
|
+
update_members(group) +
|
101
|
+
reply(:empty, :login_name)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def rpc_button_delete_member(session, data)
|
106
|
+
if (person = Persons.match_by_login_name(data._members_view[0])) and
|
107
|
+
(group = AccessGroups.match_by_accessgroup_id(data._groups[0]))
|
108
|
+
group.members.delete person.login_name
|
109
|
+
update_members(group)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
alias_method :rpc_button_save_old, :rpc_button_save
|
114
|
+
|
115
|
+
def rpc_button_save(session, data)
|
116
|
+
rpc_button_save_old(session, data) +
|
117
|
+
reply(:empty, [:access_times_view, :members_view])
|
118
|
+
end
|
119
|
+
|
120
|
+
alias_method :rpc_list_choice_old, :rpc_list_choice
|
121
|
+
|
122
|
+
def rpc_list_choice(session, name, data)
|
123
|
+
case name
|
124
|
+
when /groups/
|
125
|
+
ret = rpc_list_choice_old(session, name, data)
|
126
|
+
if group = AccessGroups.match_by_accessgroup_id(data._groups[0])
|
127
|
+
ret += update_access_times(group) + update_members(group)
|
128
|
+
else
|
129
|
+
ret += reply(:empty, :access_times_view)
|
130
|
+
end
|
131
|
+
return ret
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class InternetClassEdit < View
|
2
|
+
include VTListPane
|
3
|
+
|
4
|
+
def layout
|
5
|
+
set_data_class :InternetClasses
|
6
|
+
@order = 400
|
7
|
+
|
8
|
+
gui_hbox do
|
9
|
+
gui_vbox :nogroup do
|
10
|
+
vtlp_list :classes, :name
|
11
|
+
show_button :new, :delete
|
12
|
+
end
|
13
|
+
gui_vbox :nogroup do
|
14
|
+
show_block :default
|
15
|
+
show_arg :type, callback: true
|
16
|
+
show_button :save
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def rpc_list_choice_type(session, data)
|
22
|
+
reply_visible(data._type.first == 'limit_daily', :limit_mo)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
=begin rdoc
|
2
|
+
Allows to edit and add users with regard to InternetClass, so they only can
|
3
|
+
use a certain amount of bytes per day.
|
4
|
+
|
5
|
+
TODO: make a working add-button
|
6
|
+
=end
|
7
|
+
|
8
|
+
class InternetClassUsers < View
|
9
|
+
def layout
|
10
|
+
@order = 300
|
11
|
+
@update = true
|
12
|
+
|
13
|
+
gui_hbox do
|
14
|
+
gui_vbox :nogroup do
|
15
|
+
show_str :search_str
|
16
|
+
show_entity_person :persons, :single, :login_name, callback: true
|
17
|
+
show_button :search #, :add
|
18
|
+
end
|
19
|
+
gui_vbox :nogroup do
|
20
|
+
show_entity_internetClass_empty_all :iclass, :drop, :name
|
21
|
+
show_date :start
|
22
|
+
show_int :duration
|
23
|
+
show_button :save
|
24
|
+
end
|
25
|
+
|
26
|
+
gui_window :add_win do
|
27
|
+
show_str :add_full_name
|
28
|
+
show_str :add_login_name
|
29
|
+
show_entity_internetClass_empty_all :add_iclass, :drop, :name
|
30
|
+
show_date :add_date
|
31
|
+
show_int :add_duration
|
32
|
+
show_button :add_user
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def rpc_button_add(session, data)
|
38
|
+
reply(:window_show)
|
39
|
+
end
|
40
|
+
|
41
|
+
def rpc_update(session)
|
42
|
+
return unless t = Network::Captive.traffic
|
43
|
+
list = t.traffic.collect { |h, _k|
|
44
|
+
[h, t.get_day(h, 1).inject(:+)]
|
45
|
+
}.sort_by { |t| t[1] }.reverse[0..10].
|
46
|
+
select{|t| Persons.match_by_login_name(t[0])}.collect { |t|
|
47
|
+
p = Persons.match_by_login_name t[0]
|
48
|
+
p.to_list_id(session.owner)
|
49
|
+
}
|
50
|
+
reply(:empty_update, persons: list)
|
51
|
+
end
|
52
|
+
|
53
|
+
def rpc_button_search(session, data)
|
54
|
+
return unless (str = data._search_str).length > 2
|
55
|
+
list = Persons.data.select { |k, v|
|
56
|
+
"#{v._login_name} #{v._first_name} #{v._family_name}" =~ /#{str}/ }
|
57
|
+
return reply(:empty, :persons) unless list.length > 0
|
58
|
+
list = list.sort_by { |k, v| (v._login_name <=> str).to_i.abs }[0..19].
|
59
|
+
collect { |k, v| Persons.get_data_instance(k) }.
|
60
|
+
collect { |p| [p.person_id, "#{p.full_name} - #{p.login_name}"] }
|
61
|
+
reply(:empty_update, persons: list + [list.first[0]])
|
62
|
+
end
|
63
|
+
|
64
|
+
def rpc_list_choice_persons(session, data)
|
65
|
+
ret = reply(:empty, %w(start duration)) +
|
66
|
+
reply(:update, iclass: [0])
|
67
|
+
ip = InternetPersons.match_by_person(data._persons)
|
68
|
+
return ret unless ip
|
69
|
+
ret + reply(:update, ip.to_hash)
|
70
|
+
end
|
71
|
+
|
72
|
+
def rpc_button_save(session, data)
|
73
|
+
ip = InternetPersons.match_by_person(data._persons.person_id) ||
|
74
|
+
InternetPersons.create(person: data._persons)
|
75
|
+
ip.data_set_hash(data)
|
76
|
+
if data._start.to_s == ''
|
77
|
+
ip.start = nil
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class InternetConfig < View
|
2
|
+
def layout
|
3
|
+
set_data_class :ConfigBases
|
4
|
+
#@visible = false
|
5
|
+
@order = 200
|
6
|
+
@update = true
|
7
|
+
@functions_need = [:network, :internet]
|
8
|
+
|
9
|
+
gui_vbox do
|
10
|
+
gui_hbox :nogroup do
|
11
|
+
gui_vbox :nogroup do
|
12
|
+
show_block :operator
|
13
|
+
show_block :internet
|
14
|
+
show_block :captive_conn
|
15
|
+
end
|
16
|
+
gui_vbox :nogroup do
|
17
|
+
show_block :mobilecontrol
|
18
|
+
end
|
19
|
+
end
|
20
|
+
show_button :save_costs
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def rpc_button_save_costs(session, data)
|
25
|
+
ConfigBase.data_set_hash(data)
|
26
|
+
ConfigBase.send_config
|
27
|
+
end
|
28
|
+
|
29
|
+
def update(session)
|
30
|
+
ConfigBase.to_hash
|
31
|
+
end
|
32
|
+
end
|