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,213 @@
|
|
1
|
+
require 'network'
|
2
|
+
require 'helper_classes'
|
3
|
+
|
4
|
+
class InternetMobile < View
|
5
|
+
include Network
|
6
|
+
|
7
|
+
def layout
|
8
|
+
@functions_need = [:internet_mobile]
|
9
|
+
@order = 100
|
10
|
+
@update = true
|
11
|
+
@auto_update_async = 10
|
12
|
+
@auto_update_send_values = false
|
13
|
+
@umts_netctl = '/etc/netctl/umts'
|
14
|
+
if !File.exists?(@umts_netctl)
|
15
|
+
# For testing purposes
|
16
|
+
@umts_netctl = '/tmp/umts'
|
17
|
+
end
|
18
|
+
i=0
|
19
|
+
@umts_modes = %w(None 3Gpref 3Gonly GPRSpref GPRSonly).map { |m| [i+=1, m] }
|
20
|
+
|
21
|
+
gui_hboxg do
|
22
|
+
gui_vbox :nogroup do
|
23
|
+
gui_vbox :nogroup do
|
24
|
+
show_str_ro :operator
|
25
|
+
show_int_ro :credit
|
26
|
+
show_int_ro :promotion
|
27
|
+
show_int_ro :promotion_left
|
28
|
+
show_str_ro :state_now
|
29
|
+
show_str_ro :state_goal
|
30
|
+
show_str_ro :emails
|
31
|
+
show_str_ro :vpn
|
32
|
+
show_list_drop :umts_connection, 'View.InternetMobile.umts_connection',
|
33
|
+
:callback => true
|
34
|
+
show_button :connect, :disconnect, :reload
|
35
|
+
show_split_button :recharge, []
|
36
|
+
end
|
37
|
+
gui_vbox :nogroup do
|
38
|
+
show_str :sms_number
|
39
|
+
show_str :sms_text
|
40
|
+
show_button :send_sms
|
41
|
+
end
|
42
|
+
gui_vbox :nogroup do
|
43
|
+
show_str :ussd
|
44
|
+
show_button :send_ussd, :add_credit
|
45
|
+
end
|
46
|
+
end
|
47
|
+
gui_vboxg :nogroup do
|
48
|
+
show_text :sms_received, :flexheight => 1
|
49
|
+
show_text :ussd_received, :flexheight => 1
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def umts_connection
|
55
|
+
ret = @umts_modes
|
56
|
+
if File.exists?(@umts_netctl)
|
57
|
+
mode = IO.readlines(@umts_netctl).
|
58
|
+
select { |l| l =~ /^\#{0,1}Mode/ }.first.
|
59
|
+
match(/.*=(.*)/)[1]
|
60
|
+
index = @umts_modes.select { |i, m| m == mode }.first[0]
|
61
|
+
index ? ret + [index] : ret
|
62
|
+
else
|
63
|
+
ret
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def rpc_list_choice_umts_connection(session, data)
|
68
|
+
if File.exists?(@umts_netctl)
|
69
|
+
file = IO.readlines(@umts_netctl).map { |l|
|
70
|
+
if l =~ /^(\#{0,1}Mode)/
|
71
|
+
"#{$1}=#{@umts_modes[data._umts_connection.first-1][1]}"
|
72
|
+
else
|
73
|
+
l.chomp
|
74
|
+
end
|
75
|
+
}
|
76
|
+
IO.write(@umts_netctl, file.join("\n"))
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def s_unknown(i)
|
81
|
+
i == -1 ? 'Unknown' : i
|
82
|
+
end
|
83
|
+
|
84
|
+
def s_status(i)
|
85
|
+
case i
|
86
|
+
when Device::CONNECTED
|
87
|
+
'Connected'
|
88
|
+
when Device::CONNECTING
|
89
|
+
'Connecting'
|
90
|
+
when Device::DISCONNECTING
|
91
|
+
'Disconnecting'
|
92
|
+
when Device::DISCONNECTED
|
93
|
+
'Disconnected'
|
94
|
+
when Device::ERROR_CONNECTION
|
95
|
+
'Error'
|
96
|
+
when -1
|
97
|
+
'Unknown'
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def recharges_list
|
102
|
+
return 'No recharge possible' if $MobileControl.operator_missing?
|
103
|
+
list = $MobileControl.operator.internet_cost_available.reverse.
|
104
|
+
collect { |c, v|
|
105
|
+
"#{c} CFAs for #{(v.to_i/1_000_000).separator} MB" }
|
106
|
+
list.size == 0 ? 'No recharge possible' : list
|
107
|
+
end
|
108
|
+
|
109
|
+
def rpc_update(session)
|
110
|
+
return unless $MobileControl
|
111
|
+
cl, il, recharge = if $MobileControl.operator_missing?
|
112
|
+
[-1, -1, 'No recharge possible']
|
113
|
+
else
|
114
|
+
[$MobileControl.operator.credit_left,
|
115
|
+
$MobileControl.operator.internet_left,
|
116
|
+
recharges_list]
|
117
|
+
end
|
118
|
+
#cl, il = s_unknown(cl), s_unknown(il)
|
119
|
+
emails = System.exists?('postqueue') ?
|
120
|
+
System.run_str('postqueue -p | tail -n 1') : 'n/a'
|
121
|
+
vpns = System.exists?('systemctl') ?
|
122
|
+
System.run_str('systemctl list-units --no-legend openvpn@* | '+
|
123
|
+
'sed -e "s/OpenVPN.*//"') :
|
124
|
+
System.run_str('pgrep openvpn')
|
125
|
+
vpns = vpns.scan(/.{20}/).join("\n")
|
126
|
+
ussds = $MobileControl.device ? $MobileControl.device.ussd_list : 'Down'
|
127
|
+
services = $MobileControl.operator_missing? ? [] : $MobileControl.operator.services
|
128
|
+
{connection: %i(connect disconnect),
|
129
|
+
sms: %i(sms_number sms_text send_sms sms_received),
|
130
|
+
ussd: %i(ussd send_ussd add_credit recharge ussd_received),
|
131
|
+
credit: %i(credit),
|
132
|
+
promotion: %i(promotion promotion_left recharge),
|
133
|
+
umts: %i(umts_connection)}.collect { |service, fields|
|
134
|
+
reply_visible(services.index(service), fields)
|
135
|
+
}.flatten +
|
136
|
+
reply(:update,
|
137
|
+
:state_now => s_status($MobileControl.state_now),
|
138
|
+
:state_goal => s_status($MobileControl.state_goal),
|
139
|
+
:credit => cl,
|
140
|
+
:promotion => il.separator,
|
141
|
+
:promotion_left => Recharge.left_today(il).separator,
|
142
|
+
:emails => emails, :vpn => vpns,
|
143
|
+
:sms_received => SMSs.last(5).reverse.collect { |sms|
|
144
|
+
"#{sms.date}::#{sms.phone}:: ::#{sms.text}"
|
145
|
+
}.join("\n"),
|
146
|
+
:ussd_received => ussds,
|
147
|
+
:recharge => recharge,
|
148
|
+
:operator => $MobileControl.operator_name) +
|
149
|
+
reply_visible(Recharges.enabled?, :promotion_left)
|
150
|
+
end
|
151
|
+
|
152
|
+
def rpc_update_async(session)
|
153
|
+
rpc_update(session)
|
154
|
+
end
|
155
|
+
|
156
|
+
|
157
|
+
def rpc_button_send_sms(session, data)
|
158
|
+
if data._sms_number.to_s.length == 0
|
159
|
+
$MobileControl.device.sms_inject(data._sms_text)
|
160
|
+
else
|
161
|
+
$MobileControl.device.sms_send(data._sms_number, data._sms_text)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def rpc_button_connect(session, data)
|
166
|
+
$MobileControl.connect(true)
|
167
|
+
rpc_update(session)
|
168
|
+
end
|
169
|
+
|
170
|
+
def rpc_button_disconnect(session, data)
|
171
|
+
$MobileControl.disconnect
|
172
|
+
rpc_update(session)
|
173
|
+
end
|
174
|
+
|
175
|
+
def rpc_button_send_ussd(session, data)
|
176
|
+
if data._ussd.to_s.delete(' ').length == 13
|
177
|
+
rpc_button_add_credit(session, data)
|
178
|
+
else
|
179
|
+
$MobileControl.device.ussd_send(data._ussd)
|
180
|
+
rpc_update(session)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
def rpc_button_add_credit(session, data)
|
185
|
+
$MobileControl.recharge_hold = true
|
186
|
+
$MobileControl.operator.credit_add(data._ussd)
|
187
|
+
rpc_update(session)
|
188
|
+
end
|
189
|
+
|
190
|
+
def rpc_button_recharge(session, data)
|
191
|
+
if data._menu.to_s.length == 0
|
192
|
+
if $MobileControl.operator_missing?
|
193
|
+
credit = 0
|
194
|
+
else
|
195
|
+
credit = $MobileControl.operator.internet_cost_available.reverse.first[0].to_i
|
196
|
+
end
|
197
|
+
else
|
198
|
+
credit = data._menu.match(/^[0-9]*/)[0].to_i
|
199
|
+
end
|
200
|
+
if credit > 0
|
201
|
+
log_msg :NetworkMobile, "Asking for recharge of #{credit}"
|
202
|
+
$MobileControl.recharge_hold = false
|
203
|
+
$MobileControl.recharge_all(credit)
|
204
|
+
end
|
205
|
+
rpc_update(session)
|
206
|
+
end
|
207
|
+
|
208
|
+
def rpc_button_reload(session, data)
|
209
|
+
$MobileControl.update_left
|
210
|
+
rpc_update(session)
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class InternetRecharges < View
|
2
|
+
def layout
|
3
|
+
@order = 600
|
4
|
+
@update = true
|
5
|
+
@functions_need = [:internet_mobile, :network_pro]
|
6
|
+
set_data_class :Recharges
|
7
|
+
|
8
|
+
gui_hbox do
|
9
|
+
gui_vbox :nogroup do
|
10
|
+
show_entity_recharge_all :recharges, :single, :time,
|
11
|
+
width: 200, callback: true
|
12
|
+
show_button :new, :delete
|
13
|
+
end
|
14
|
+
gui_vbox :nogroup do
|
15
|
+
show_block :default, width: 200
|
16
|
+
show_button :save
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def rpc_update(_session, select = nil)
|
22
|
+
recharges = Recharges.search_all_.collect { |r| [r.recharge_id, r.time] }.reverse
|
23
|
+
select and recharges.push(select)
|
24
|
+
reply(:empty_all) +
|
25
|
+
reply(:update, recharges: recharges)
|
26
|
+
end
|
27
|
+
|
28
|
+
def rpc_button_new(session, data)
|
29
|
+
rpc_update(session)
|
30
|
+
end
|
31
|
+
|
32
|
+
def rpc_button_save(session, data)
|
33
|
+
recharges = data._recharges
|
34
|
+
recharges.class == Array and recharges = Recharges.create(time: data._time)
|
35
|
+
recharges.data_set_hash(data)
|
36
|
+
rpc_update(session, recharges.recharge_id)
|
37
|
+
end
|
38
|
+
|
39
|
+
def rpc_button_delete(session, data)
|
40
|
+
return unless data._recharges.class == Recharge
|
41
|
+
data._recharges.delete
|
42
|
+
rpc_update(session)
|
43
|
+
end
|
44
|
+
|
45
|
+
def rpc_list_choice_recharges(session, data)
|
46
|
+
reply(:empty_nonlists) +
|
47
|
+
reply(:update, data._recharges.to_hash)
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class InventoryComputer < View
|
2
|
+
include VTListPane
|
3
|
+
def layout
|
4
|
+
set_data_class :Computers
|
5
|
+
|
6
|
+
gui_hbox do
|
7
|
+
gui_vbox :nogroup do
|
8
|
+
vtlp_list :computer_list, 'name_service', :width => 100
|
9
|
+
show_button :new, :delete
|
10
|
+
end
|
11
|
+
|
12
|
+
gui_hbox :nogroup do
|
13
|
+
gui_vbox :nogroup do
|
14
|
+
show_block :identity, :width => 150
|
15
|
+
show_block :performance
|
16
|
+
show_button :save
|
17
|
+
end
|
18
|
+
gui_vbox :nogroup do
|
19
|
+
show_block :ticket
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class InventoryRoom < View
|
2
|
+
include VTListPane
|
3
|
+
def layout
|
4
|
+
set_data_class :Rooms
|
5
|
+
|
6
|
+
gui_hbox do
|
7
|
+
gui_vbox :nogroup do
|
8
|
+
vtlp_list :rooms, 'name'
|
9
|
+
show_button :new, :delete
|
10
|
+
end
|
11
|
+
|
12
|
+
gui_vbox :nogroup do
|
13
|
+
show_block :all, :width => 200
|
14
|
+
show_button :save
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class InventoryTicketOpen < View
|
2
|
+
include VTListPane
|
3
|
+
include TicketLayout
|
4
|
+
def layout
|
5
|
+
t_layout( :opened )
|
6
|
+
end
|
7
|
+
|
8
|
+
def rpc_button_save_ticket( session, data )
|
9
|
+
if not data['created_by']
|
10
|
+
data['created_by'] = session.owner.full_name
|
11
|
+
end
|
12
|
+
rpc_button_save( session, data )
|
13
|
+
end
|
14
|
+
|
15
|
+
def rpc_update( session )
|
16
|
+
reply( :update, :created_by => session.owner.full_name )
|
17
|
+
end
|
18
|
+
|
19
|
+
def rpc_button_new_ticket( session, data )
|
20
|
+
rpc_button_new( session, data ) +
|
21
|
+
rpc_update( session )
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class LibraryPerson < View
|
2
|
+
def layout
|
3
|
+
@order = 100
|
4
|
+
@update = true
|
5
|
+
|
6
|
+
gui_hboxg do
|
7
|
+
gui_vboxg :nogroup do
|
8
|
+
show_entity_person :users, :single, :to_list_id,
|
9
|
+
:callback => true, :flexheight => 1
|
10
|
+
end
|
11
|
+
gui_vboxg :nogroup do
|
12
|
+
show_block :address, :flexwidth => 1
|
13
|
+
show_button :save
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def library_users(owner)
|
19
|
+
Activities.tagged_users('library').to_frontend(owner)
|
20
|
+
end
|
21
|
+
|
22
|
+
def rpc_update(session)
|
23
|
+
reply(:empty, :users) +
|
24
|
+
reply(:update, users: library_users(session.owner) )
|
25
|
+
end
|
26
|
+
|
27
|
+
def rpc_list_choice_users(session, data)
|
28
|
+
reply(:empty_nonlists) +
|
29
|
+
reply(:update, data._users.to_hash)
|
30
|
+
end
|
31
|
+
|
32
|
+
def rpc_button_save(session, data)
|
33
|
+
return unless data._users
|
34
|
+
data._users.data_set_hash(data)
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
class NetworkBlock < View
|
2
|
+
def layout
|
3
|
+
@functions_need = [:network]
|
4
|
+
@order = 100
|
5
|
+
@blocking = Entities.Statics.get(:NetworkBlock)
|
6
|
+
@blocking.data_str.class != Array and @blocking.data_str = []
|
7
|
+
update_block(@blocking.data_str)
|
8
|
+
|
9
|
+
@hosts = Entities.Statics.get(:NetworkBlockHosts)
|
10
|
+
@hosts.data_str.class != String and @hosts.data_str = ''
|
11
|
+
|
12
|
+
gui_hbox do
|
13
|
+
gui_vboxg :nogroup do
|
14
|
+
show_text :hosts, flexheight: 1
|
15
|
+
show_button :update
|
16
|
+
show_list :blocked, 'View.NetworkBlock.list_dhcp', :width => 400
|
17
|
+
show_button :block
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def update_block(ips)
|
23
|
+
Network::Captive.block ips.collect { |ip| ip.sub(/ .*/, '') }
|
24
|
+
end
|
25
|
+
|
26
|
+
def write_block(file, l)
|
27
|
+
#dputs_func
|
28
|
+
list = l.to_s.split("\n").collect { |s| s.gsub(/ /, '') }
|
29
|
+
dputs(3) { "Writing block #{list.inspect}" }
|
30
|
+
file.write(list.compact.collect { |h|
|
31
|
+
address = "address=/#{h}/127.0.0.1\n"
|
32
|
+
dputs(3) { "Outputting #{address}" }
|
33
|
+
address
|
34
|
+
}.join)
|
35
|
+
end
|
36
|
+
|
37
|
+
def update_dnsmasq_file(list, file)
|
38
|
+
block_wrote = false
|
39
|
+
tmpfile = "/tmp/#{File.basename(file)}.tmp"
|
40
|
+
FileUtils.cp file, tmpfile
|
41
|
+
File.open(file, 'w') { |f|
|
42
|
+
IO.readlines(tmpfile).each { |li|
|
43
|
+
l = li.chomp
|
44
|
+
dputs(3) { "Doing line #{l}" }
|
45
|
+
case l
|
46
|
+
when /^(#*)address.*(\/[^\/]*)$/
|
47
|
+
dputs(3) { "#{$1} - #{$2} - #{l}" }
|
48
|
+
f.write(l + "\n") if ($1 == '#' || $2 != '/127.0.0.1')
|
49
|
+
write_block(f, list) unless block_wrote
|
50
|
+
block_wrote = true
|
51
|
+
else
|
52
|
+
f.write(l + "\n")
|
53
|
+
end
|
54
|
+
}
|
55
|
+
# Add to end of file if not written yet
|
56
|
+
write_block(f, list) unless block_wrote
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
def update_dnsmasq(list)
|
61
|
+
#dputs_func
|
62
|
+
%w( /etc/dnsmasq.conf.orig /etc/dnsmasq.conf /tmp/dns.test).each do |f|
|
63
|
+
if File.exists? f
|
64
|
+
dputs(3) { "Found dnsmasq at #{f}" }
|
65
|
+
update_dnsmasq_file(list, f)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def list_dhcp
|
71
|
+
System.run_str('cut -d " " -f 3,4 /var/lib/misc/dnsmasq.leases').split("\n")
|
72
|
+
end
|
73
|
+
|
74
|
+
def rpc_update_view(session)
|
75
|
+
super(session) +
|
76
|
+
reply(:update, :blocked => @blocking.data_str, :hosts => @hosts.data_str)
|
77
|
+
end
|
78
|
+
|
79
|
+
def rpc_button_block(session, data)
|
80
|
+
update_block(@blocking.data_str = data._blocked)
|
81
|
+
end
|
82
|
+
|
83
|
+
def rpc_button_update(session, data)
|
84
|
+
update_dnsmasq(@hosts.data_str = data._hosts)
|
85
|
+
Platform.restart :dnsmasq
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class NetworkNetdevs < View
|
2
|
+
include VTListPane
|
3
|
+
|
4
|
+
def layout
|
5
|
+
@order = 200
|
6
|
+
@functions_need = [:network_pro]
|
7
|
+
|
8
|
+
set_data_class :Netdevs
|
9
|
+
|
10
|
+
gui_hbox do
|
11
|
+
gui_vbox :nogroup do
|
12
|
+
vtlp_list :netdevs, :name
|
13
|
+
show_button :delete, :new
|
14
|
+
end
|
15
|
+
gui_vbox :nogroup do
|
16
|
+
show_block :default
|
17
|
+
show_button :save
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class NetworkRestriction < View
|
2
|
+
include Network
|
3
|
+
|
4
|
+
def layout
|
5
|
+
@update = true
|
6
|
+
@functions_need = [:internet]
|
7
|
+
@visible = Persons.center && Persons.center.login_name == 'man'
|
8
|
+
|
9
|
+
gui_vbox do
|
10
|
+
show_html :state
|
11
|
+
show_button :remove_restriction, :restrict_info1, :restrict_info2
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def rpc_update( session )
|
16
|
+
if restricted = Captive.restricted
|
17
|
+
reply( :update, :state => "Restricted internet, only allowed for:<br><pre>#{ restricted }</pre>" )
|
18
|
+
else
|
19
|
+
reply( :update, :state => 'No restriction in place')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def rpc_button_remove_restriction( session, args )
|
24
|
+
Captive.restriction_set( nil )
|
25
|
+
rpc_update( session )
|
26
|
+
end
|
27
|
+
|
28
|
+
def rpc_button_restrict_info1( session, args )
|
29
|
+
Captive.restriction_set 'info1'
|
30
|
+
rpc_update( session )
|
31
|
+
end
|
32
|
+
|
33
|
+
def rpc_button_restrict_info2( session, args )
|
34
|
+
Captive.restriction_set 'info2'
|
35
|
+
rpc_update( session )
|
36
|
+
end
|
37
|
+
end
|