1
#########################################################################
2
# COPYRIGHT (C) 2003 EDF R&D WWW.CODE-ASTER.ORG #
4
# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR #
5
# MODIFY IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS #
6
# PUBLISHED BY THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE #
7
# LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION. #
8
# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, #
9
# BUT WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF #
10
# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU #
11
# GENERAL PUBLIC LICENSE FOR MORE DETAILS. #
13
# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE #
14
# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO : EDF R&D CODE_ASTER, #
15
# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. #
16
#########################################################################
18
# $Id: pref_config.tcl 3530 2008-09-26 08:45:55Z courtois $
20
# reaction a Configuration/Preferences/Generales
21
#################################################################
29
wm title $fen "[ashare::mess ihm 33] - [ashare::mess ihm 37]"
33
pack [frame $fen.liste -relief solid -bd 1]
35
pack [frame $fen.liste.tit1 -relief solid -bd 0] -fill x
36
label $fen.liste.tit1.lbl -font $astk::ihm(font,labbout) -text [ashare::mess ihm 141] -width 35 -anchor w
37
pack $fen.liste.tit1.lbl -pady 3 -side left -fill x
39
button $fen.liste.tit1.help -image [image create photo -file $astk::icon(help)] \
40
-command "grab release $fen ; aff_aide . 190" -bd 0 -bg $astk::ihm(couleur,background)
41
pack $fen.liste.tit1.help -side right
44
pack [frame $fen.liste.nom -relief solid -bd 0] -anchor w
45
label $fen.liste.nom.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 89] -width 35 -anchor w
46
entry $fen.liste.nom.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,nom_user)
47
pack $fen.liste.nom.lbl $fen.liste.nom.path -pady 3 -side left
49
pack [frame $fen.liste.email -relief solid -bd 0] -anchor w
50
label $fen.liste.email.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 90] -width 35 -anchor w
51
entry $fen.liste.email.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,email)
52
pack $fen.liste.email.lbl $fen.liste.email.path -pady 3 -side left
55
pack [frame $fen.liste.org -relief solid -bd 0] -anchor w
56
if { $astk::agla(num_serv) > -1 && [llength $astk::agla(infoid)] > 0 } {
57
set astk::config(-1,org) [lindex $astk::agla(infoid) 3]
58
label $fen.liste.org.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 240] -width 35 -anchor w
59
label $fen.liste.org.inst -font $astk::ihm(font,lab) -text $astk::config(-1,org)
60
pack $fen.liste.org.lbl $fen.liste.org.inst -pady 3 -side left
62
label $fen.liste.org.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 240] -width 35 -anchor w
63
entry $fen.liste.org.inst -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,org)
64
pack $fen.liste.org.lbl $fen.liste.org.inst -pady 3 -side left
68
pack [frame $fen.liste.agla -relief solid -bd 0] -anchor w
69
if { $astk::agla(num_serv) > -1 } {
70
label $fen.liste.agla.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 91] -width 35 -anchor w
71
label $fen.liste.agla.inst -font $astk::ihm(font,lab) -text [join $astk::agla(instance)]
72
pack $fen.liste.agla.lbl $fen.liste.agla.inst -pady 3 -side left
76
pack [frame $fen.liste.langue -relief solid -bd 0] -anchor w
77
label $fen.liste.langue.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 101] -width 35 -anchor w
78
set MenuLang [tk_optionMenu $fen.liste.langue.choix astk::config(-1,langue) $ashare::llang(lang,0)]
79
$MenuLang entryconfigure 0 -font $astk::ihm(font,labmenu)
80
for {set j 1} {$j < $ashare::llang(nb_lang)} {incr j} {
81
$MenuLang add radiobutton
82
$MenuLang entryconfigure $j -label $ashare::llang(lang,$j) -font $astk::ihm(font,labmenu) -variable astk::config(-1,langue)
84
$fen.liste.langue.choix configure -font $astk::ihm(font,labmenu) -bg $astk::ihm(couleur,liste)
85
pack $fen.liste.langue.lbl $fen.liste.langue.choix -pady 3 -side left
87
# pr�f�rences - version par d�faut
88
pack [frame $fen.liste.defvers -relief solid -bd 0] -anchor w
89
label $fen.liste.defvers.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 92] -width 35 -anchor w
90
entry $fen.liste.defvers.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,def_vers)
91
pack $fen.liste.defvers.lbl $fen.liste.defvers.path -pady 3 -side left
94
pack [frame $fen.liste.xterm -relief solid -bd 0] -anchor w
95
label $fen.liste.xterm.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 82] -width 35 -anchor w
96
entry $fen.liste.xterm.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,xterm)
97
pack $fen.liste.xterm.lbl $fen.liste.xterm.path -pady 3 -side left
100
pack [frame $fen.liste.editeur -relief solid -bd 0] -anchor w
101
label $fen.liste.editeur.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 93] -width 35 -anchor w
102
entry $fen.liste.editeur.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,editeur)
103
pack $fen.liste.editeur.lbl $fen.liste.editeur.path -pady 3 -side left
106
pack [frame $fen.liste.browser -relief solid -bd 0] -anchor w
107
label $fen.liste.browser.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 363] -width 35 -anchor w
108
entry $fen.liste.browser.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,browser)
109
pack $fen.liste.browser.lbl $fen.liste.browser.path -pady 3 -side left
111
# nbre de fichiers r�manents
112
pack [frame $fen.liste.nb_reman -relief solid -bd 0] -anchor w
113
label $fen.liste.nb_reman.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 94] -width 35 -anchor w
114
scale $fen.liste.nb_reman.scl -orient horizontal -length 200 -from 0 -to 10 -tickinterval 1 \
115
-variable astk::config(-1,nb_reman) -font $astk::ihm(font,lab) -showvalue 0
116
pack $fen.liste.nb_reman.lbl $fen.liste.nb_reman.scl -pady 3 -side left
119
pack [frame $fen.liste.dbg -relief solid -bd 0] -anchor w
120
label $fen.liste.dbg.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 36] -width 35 -anchor w
121
scale $fen.liste.dbg.scl -orient horizontal -length 200 -from 0 -to 5 -tickinterval 1 \
122
-variable astk::config(-1,dbglevel) -font $astk::ihm(font,lab) -showvalue 0
123
pack $fen.liste.dbg.lbl $fen.liste.dbg.scl -pady 3 -side left
126
pack [frame $fen.liste.bip -relief solid -bd 0] -anchor w -padx 20
127
checkbutton $fen.liste.bip.cb -variable astk::config(-1,bip) -anchor w
128
label $fen.liste.bip.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 362]"
129
pack $fen.liste.bip.cb $fen.liste.bip.lbl -pady 3 -side left
133
pack [frame $fen.liste.tit2 -relief solid -bd 0] -anchor w
134
label $fen.liste.tit2.lbl -font $astk::ihm(font,labbout) -text [ashare::mess ihm 142] -width 35 -anchor w
135
pack $fen.liste.tit2.lbl -pady 3 -side left
138
pack [frame $fen.liste.nb_ligne -relief solid -bd 0] -anchor w
139
label $fen.liste.nb_ligne.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 139] -width 35 -anchor w
140
scale $fen.liste.nb_ligne.scl -orient horizontal -length 200 -from 50 -to 450 -tickinterval 100 -resolution 10 \
141
-variable astk::config(-1,nb_ligne) -font $astk::ihm(font,lab) -showvalue 0
142
pack $fen.liste.nb_ligne.lbl $fen.liste.nb_ligne.scl -pady 3 -side left
144
# frequence d'actualisation
145
pack [frame $fen.liste.freq_actu -relief solid -bd 0] -anchor w
146
label $fen.liste.freq_actu.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 140] -width 35 -anchor w
147
scale $fen.liste.freq_actu.scl -orient horizontal -length 200 -from 1 -to 5 -tickinterval 1 \
148
-variable astk::config(-1,freq_actu) -font $astk::ihm(font,lab) -showvalue 0
149
pack $fen.liste.freq_actu.lbl $fen.liste.freq_actu.scl -pady 3 -side left
152
pack [frame $fen.valid -relief solid -bd 0]
153
button $fen.valid.annuler -font $astk::ihm(font,labbout) -text [ashare::mess ihm 85] \
154
-bg $astk::ihm(couleur,annul) \
155
-command "restaure_prefs ; destroy $fen ; grab release $fen"
156
button $fen.valid.ok -font $astk::ihm(font,labbout) -text "Ok" \
157
-bg $astk::ihm(couleur,valid) \
158
-command "accept_pref $ashare::lang ; destroy $fen ; grab release $fen"
159
pack $fen.valid.ok $fen.valid.annuler -side left -padx 10 -pady 5
164
# reaction a Configuration/Preferences/Reseau
165
#################################################################
166
proc Opt_prefs_net { } {
173
wm title $fen "[ashare::mess ihm 33] - [ashare::mess ihm 378]"
177
pack [frame $fen.liste -relief solid -bd 1]
181
pack [frame $fen.liste.tit3 -relief solid -bd 0] -anchor w
182
label $fen.liste.tit3.lbl -font $astk::ihm(font,labbout) -text [ashare::mess ihm 356] -width 35 -anchor w
183
pack $fen.liste.tit3.lbl -pady 3 -side left
185
# ipdhcp ou nom du client
186
pack [frame $fen.liste.ipdhcp -relief solid -bd 0] -anchor w
187
if { $astk::config(-1,isdhcp) == 1} {
188
label $fen.liste.ipdhcp.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 348]" -width 35 -anchor w
189
entry $fen.liste.ipdhcp.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,ipdhcp)
191
label $fen.liste.ipdhcp.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 349]" -width 35 -anchor w
192
entry $fen.liste.ipdhcp.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,nom_complet) -state disabled
194
pack $fen.liste.ipdhcp.lbl $fen.liste.ipdhcp.path -pady 3 -side left
196
# switch mode DHCP / hostname
197
pack [frame $fen.liste.mode -relief solid -bd 0] -anchor w -padx 20
198
checkbutton $fen.liste.mode.cb -variable astk::config(-1,isdhcp) -anchor w
199
label $fen.liste.mode.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 350]"
200
pack $fen.liste.mode.cb $fen.liste.mode.lbl -pady 3 -side left
203
pack [frame $fen.liste.domain -relief solid -bd 0] -anchor w
204
label $fen.liste.domain.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 322] (ex.: domain.org)" -width 35 -anchor w
205
entry $fen.liste.domain.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,nom_domaine)
206
pack $fen.liste.domain.lbl $fen.liste.domain.path -pady 3 -side left
208
# forced display variable
209
pack [frame $fen.liste.displ -relief solid -bd 0] -anchor w
210
label $fen.liste.displ.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 376]" -width 35 -anchor w
211
entry $fen.liste.displ.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,forced_display)
212
pack $fen.liste.displ.lbl $fen.liste.displ.path -pady 3 -side left
214
# remote shell protocol
215
pack [frame $fen.liste.proto1 -relief solid -bd 0] -anchor w
216
label $fen.liste.proto1.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 354]" -width 35 -anchor w
217
radiobutton $fen.liste.proto1.rsh -font $astk::ihm(font,val) -text rsh -value RSH -variable astk::config(-1,remote_shell_protocol)
218
radiobutton $fen.liste.proto1.ssh -font $astk::ihm(font,val) -text ssh -value SSH -variable astk::config(-1,remote_shell_protocol)
219
pack $fen.liste.proto1.lbl $fen.liste.proto1.rsh $fen.liste.proto1.ssh -pady 3 -side left
221
# remote copy protocol
222
pack [frame $fen.liste.proto2 -relief solid -bd 0] -anchor w
223
label $fen.liste.proto2.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 355]" -width 35 -anchor w
224
radiobutton $fen.liste.proto2.rcp -font $astk::ihm(font,val) -text rcp -value RCP -variable astk::config(-1,remote_copy_protocol)
225
radiobutton $fen.liste.proto2.scp -font $astk::ihm(font,val) -text scp -value SCP -variable astk::config(-1,remote_copy_protocol)
226
pack $fen.liste.proto2.lbl $fen.liste.proto2.rcp $fen.liste.proto2.scp -pady 3 -side left
229
pack [frame $fen.valid -relief solid -bd 0]
230
button $fen.valid.annuler -font $astk::ihm(font,labbout) -text [ashare::mess ihm 85] \
231
-bg $astk::ihm(couleur,annul) \
232
-command "restaure_prefs ; destroy $fen ; grab release $fen"
233
button $fen.valid.ok -font $astk::ihm(font,labbout) -text "Ok" \
234
-bg $astk::ihm(couleur,valid) \
235
-command "accept_pref $ashare::lang ; destroy $fen ; grab release $fen"
236
pack $fen.valid.ok $fen.valid.annuler -side left -padx 10 -pady 5
241
# Acceptation des pr�f�rences
242
#################################################################
243
proc accept_pref { old_lang } {
246
# nom de machine / domaine
247
init_nom_complet $astk::config(-1,isdhcp)
249
if { $astk::config(-1,ipdhcp) != $old_pref(-1,ipdhcp)
250
|| $astk::config(-1,isdhcp) != $old_pref(-1,isdhcp)
251
|| $astk::config(-1,nom_complet) != $old_pref(-1,nom_complet) } {
258
set ashare::dbg $astk::config(-1,dbglevel)
259
# info en cas de changement de la langue
260
if { $astk::config(-1,langue) != $old_lang } {
261
set ashare::lang $astk::config(-1,langue)
264
# mise � jour de la liste des profils (nb_reman)
266
# sauvegarde des pr�f�rences
270
#################################################################
271
proc bckup_prefs {} {
274
# valeurs actuelles dans old_pref
275
set mots_cles $ashare::mots(MCS_pref)
276
lappend mots_cles "nom_complet"
277
for { set k 0 } { $k < [ llength $mots_cles ] } { incr k } {
278
set mcs [lindex $mots_cles $k]
279
set old_pref(-1,$mcs) $astk::config(-1,$mcs)
283
#################################################################
284
proc restaure_prefs {} {
287
# r�cup�re depuis old_pref
288
set mots_cles $ashare::mots(MCS_pref)
289
lappend mots_cles "nom_complet"
290
for { set k 0 } { $k < [ llength $mots_cles ] } { incr k } {
291
set mcs [lindex $mots_cles $k]
292
set astk::config(-1,$mcs) $old_pref(-1,$mcs)