- redesign ui

This commit is contained in:
Stanislav Ievlev 2009-03-18 15:55:44 +03:00
parent d2f01a4a5f
commit 10dea0a623
4 changed files with 125 additions and 73 deletions

View File

@ -0,0 +1,75 @@
(document:surround "/std/frame")
(define *name* (global 'name))
(define (wireless-interface)
(form-popup "/net-wifi/" 'interface *name*))
;;; Functions
(define (ui-read)
(catch/message
(lambda()
(let ((cmd (woo-read-first "/net-eth" 'name *name*)))
(form-update-enum "controlled" (woo-list "/net-eth/avail_controlled"))
(form-update-enum "hw_binding" (woo-list "/net-eth/avail_hw_bindings"))
(form-update-value "name" *name*)
(form-update-visibility "wireless" (woo-get-option cmd 'wireless))
(form-update-value-list '("controlled" "hw_binding") cmd)))))
(define (ui-exit)
(document:end))
(define (ui-write)
(catch/message
(lambda()
(woo-write "/net-eth"
'name *name*
'hw_binding (form-value "hw_binding")
'controlled (form-value "controlled"))
(ui-exit))))
;;; UI
width 500
height 300
(gridbox
columns "0;100"
margin "10"
;;
(label text (_ "Interface:") align "right")
(label name "name")
;;
(label text (_ "Controlled by:") align "right" name "controlled")
(combobox name "controlled")
;;
(label text (_ "Hardware binding:") align "right")
(combobox name "hw_binding")
;;
(spacer)
(button text (_ "Wireless settings...")
name "wireless"
align "left"
visibility #f)
;;
(label colspan 2)
;;
(hbox align "left"
colspan 2
(button (_ "OK") name "ok")
(button (_ "Cancel") name "cancel")))
;;
(document:root
(when loaded
(ui-read)
(form-bind "wireless" "click" wireless-interface)
(form-bind "ok" "click" ui-write)
(form-bind "cancel" "click" ui-exit)))

View File

@ -18,13 +18,9 @@
'("computer_name" "dns" "search")
cmd)
(form-update-value-list
'("adaptor" "ip" "mask" "default" "hw_binding" "controlled" "configuration")
'("adaptor" "ip" "mask" "default" "configuration")
cmd)
(form-update-visibility
"wireless"
(woo-get-option cmd 'wireless))
(update-configuration (woo-get-option cmd 'configuration))))
(define (write-interface name)
@ -33,10 +29,8 @@
'name name
(form-value-list '("language"
"computer_name" "dns" "search"
"ip" "mask" "default" "hw_binding" "controlled" "configuration"))))
"ip" "mask" "default" "configuration"))))
(define (wireless-interface)
(form-replace (format #f "/net-wifi?iface=~A" (form-value "name"))))
(define (update-interface)
(or (catch/message
@ -47,10 +41,13 @@
(form-update-value "prev_name" name))))
(form-update-value "name" (form-value "prev_name"))))
(define (advanced-interface)
(form-replace (format #f "/net-eth/advanced?iface=~A" (form-value "name"))))
(define (init)
(read-interface "")
(read-interface (or (form-value "iface") ""))
(form-update-value "prev_name" (form-value "name"))
(form-bind "name" "change" update-interface)
(form-bind "configuration" "change" (lambda() (update-configuration (form-value "configuration"))))
(form-bind "wireless" "click" wireless-interface))
(form-bind "advanced" "click" advanced-interface))

View File

@ -11,17 +11,6 @@
<td><span translate="_" name="computer_name">Computer name:</span></td>
<td><input type="text" class="text" name="computer_name"/></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td><span translate="_" name="dns">DNS servers:</span></td>
<td><input type="text" class="text" name="dns"/></td>
</tr>
<tr>
<td><span translate="_" name="search">Search domains:</span></td>
<td><input type="text" class="text" name="search"/></td>
</tr>
</table>
</td>
</tr>
@ -33,7 +22,7 @@
</tr>
<tr>
<td>
<select name="name" enumref="/net-eth" size="10" style="width:150px"/>
<select name="name" enumref="/net-eth" size="16" style="width:150px"/>
<input type="hidden" name="prev_name"/>
</td>
<td>
@ -43,10 +32,6 @@
<textarea rows="2" readonly="yes" name="adaptor" style="width:98%"/>
</td>
</tr>
<tr>
<td><span translate="_">Controlled:</span></td>
<td><select name="controlled" enumref="/net-eth/avail_controlled"></select></td>
</tr>
<tr>
<td><span translate="_">Configuration:</span></td>
<td><select name="configuration" enumref="/net-eth/avail_configurations"></select></td>
@ -64,15 +49,29 @@
<td><span translate="_" name="default">Default gateway:</span></td>
<td><input type="text" class="text" name="default"></input></td>
</tr>
<tr>
<td><span translate="_">Hardware binding:</span></td>
<td><select name="hw_binding" enumref="/net-eth/avail_hw_bindings"></select></td>
<td><span translate="_" name="dns">DNS servers:</span></td>
<td><input type="text" class="text" name="dns"/></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input type="button" class="btn" name="wireless" style="display:none" value="Wireless settings..."/>
</td>
<td><span translate="_" name="search">Search domains:</span></td>
<td><input type="text" class="text" name="search"/></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<small><span translate="_">(multiple values should be space separated)</span></small>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="button" name="advanced" value="Advanced.." class="btn" style="text-align:right"/></td>
</tr>
</table>
</td>

View File

@ -17,13 +17,9 @@
'("computer_name" "dns" "search")
cmd)
(form-update-value-list
'("adaptor" "ip" "mask" "default" "hw_binding" "controlled" "configuration")
'("adaptor" "ip" "mask" "default" "configuration")
cmd)
(form-update-visibility
"wireless"
(woo-get-option cmd 'wireless))
(update-configuration (woo-get-option cmd 'configuration))))
(define (write-interface name)
@ -31,8 +27,7 @@
"/net-eth"
'name name
(form-value-list '("computer_name" "dns" "search"
"ip" "mask" "default" "hw_binding" "controlled" "configuration"))))
"ip" "mask" "default" "configuration"))))
(define (commit-interface)
(catch/message
@ -46,8 +41,6 @@
(woo-write "/net-eth" 'reset #t)
(form-update-enum "mask" (woo-list "/net-eth/avail_masks"))
(form-update-enum "hw_binding" (woo-list "/net-eth/avail_hw_bindings"))
(form-update-enum "controlled" (woo-list "/net-eth/avail_controlled"))
(form-update-enum "configuration" (woo-list "/net-eth/avail_configurations"))
(form-update-enum "name" (woo-list "/net-eth/avail_ifaces"))
@ -63,8 +56,8 @@
(form-update-value "prev_name" name))))
(form-update-value "name" (form-value "prev_name"))))
(define (wireless-interface)
(form-popup "/net-wifi/" 'interface (form-value "name")))
(define (advanced-interface)
(form-popup "/net-eth/advanced" 'name (form-value "name")))
;;; UI
@ -81,25 +74,7 @@
(label text (_ "Computer name:") name "computer_name" align "right")
(edit name "computer_name")
(spacer)
;;
(label colspan 3)
;;
(label text (_ "DNS servers:") name "dns" align "right")
(edit name "dns")
(spacer)
;;
(label text (_ "Search domains:") name "search" align "right")
(edit name "search")
(spacer)
(spacer)
(label text (string-append "<small>("
(_ "multiple values should be space separated")
")<small>"))
(spacer))
)
(separator colspan 2)
@ -112,9 +87,6 @@
;;
(textbox colspan 2 name "adaptor" max-height 60 alterability #f)
;;
(label text (_ "Controlled by:") align "right" name "controlled")
(combobox name "controlled")
;;
(label text (_ "Configuration:") align "right" name "configuration")
(combobox name "configuration")
@ -130,16 +102,25 @@
(label text (_ "Default gateway:") align "right" name "default")
(edit name "default")
;;
(label text (_ "Hardware binding:") align "right")
(combobox name "hw_binding")
(label text (_ "DNS servers:") name "dns" align "right")
(edit name "dns")
;;
(label text (_ "Search domains:") name "search" align "right")
(edit name "search")
;;
(spacer)
(button text (_ "Wireless settings...")
name "wireless"
align "left"
visibility #f))
(label text (small (_ "(multiple values should be space separated)")))
;;
(label colspan 2)
;;
(spacer)
(button text (_ "Advanced...") name "advanced" align "right")
;;
(or (global 'frame:next)
@ -150,7 +131,7 @@
(hbox align "left"
colspan 2
(button (_ "Apply") name "apply")
(button (_ "Reset") name "reset"))))
(button (_ "Reset") name "reset")))))
;;;;;;;;;;;;;;;;;;
@ -159,7 +140,7 @@
(reset-interface)
(form-bind "name" "change" update-interface)
(form-bind "configuration" "change" (lambda() (update-configuration (form-value "configuration"))))
(form-bind "wireless" "click" wireless-interface)
(form-bind "advanced" "click" advanced-interface)
(or (global 'frame:next)
(begin (form-bind "apply" "click" commit-interface)
(form-bind "reset" "click" reset-interface)))))