Patch title: Release 96 bulk changes
Abstract:
File: /pliant/fullpliant/menu.page
Key:
    Removed line
    Added line
module "/pliant/language/context.pli"
module "/pliant/language/stream.pli"
module "/pliant/admin/file.pli"
if os_api="linux"
  module "/pliant/linux/storage/filesystem.pli"
module "/pliant/protocol/http/proxy.pli"
module "/pliant/util/crypto/proxy.pli"
module "/pliant/fullpliant/this_computer.pli"
module "/pliant/fullpliant/shutdown.pli"
if os_api="linux"
  module "/pliant/fullpliant/embedded/command.pli"
  module "/pliant/linux/storage/filesystem.pli"
  module "/pliant/linux/kernel/module.pli"

requires "local"


title "FullPliant on "+computer_fullname

header "Applications"

para
  if user_name<>""
    link "Mail" "/pliant/browse/mail/" ; fixed [  ]
  link "Standard Pliant site" "/" ; fixed [  ]
para
  if allowed:"administrator"
    link "Extended secured proxy" "/pliant/protocol/http/proxy.html"
    if http_proxy_user<>""
      highlight "on"
    eif http_proxy_running
      small text:"on"
    else
      small text:"off"
    fixed [  ]
    note "Secured proxy"
      title "Pliant secured proxy"
      select "Site you want to connect to: " (var Str site1) noeol
        option "" ""
        plugin secured
      input " " (var Str site2)
      input "Your password: " (var Str password) password
      button "Connect"
        var ExtendedStatus status := proxy http_request:user_name password (shunt site1<>"" site1 site2)
        if status=success
          goto_backward
        else
          text status:message
    if proxy_current_site<>""
      [ -> ]
      link proxy_current_site "http://localhost:"+string:secured_proxy_tcp_port+"/"
      fixed [  ]
      note "disconnect"
        proxy "" "" ""
        reload_page
  fixed [  ]
  link "Tree synchronize" "/pliant/util/crypto/synchronize"

plugin application


header "Administration"

para
  link "Server status" "/pliant/fullpliant/status" ; fixed [  ]
  if this_computer:env:"printer":size>0
    link "Print spooler" "/pliant/protocol/lpr/spooler" ; fixed [  ]
  link "trace" "/pliant/protocol/http/trace" ; fixed [  ]
  if allowed:"aministrator"
    link "Configure" "/pliant/fullpliant/configure" ; fixed [  ]
    link "Export" "/pliant/fullpliant/export" ; fixed [  ]
    link "System files" "/pliant/browse/system_file/" ; fixed [  ]
    link "Interpreter" "/pliant/appli/interpreter" ; fixed [  ]
    if os_api="linux"
      note "Root shell"
        embedded_command "xterm +sb -fg black -bg rgb:D8/D8/D8 -title ROOT" "detached"
        reload_page

plugin administration

if os_api="linux"
  button "mount floppy" noeol
    kernel_load_module "floppy"
    kernel_load_module "msdos"
    filesystem_mount "device:/fd0" "embedded:/mnt/floppy/" "filesystem [dq]msdos[dq]"
    reload_page
  button "unmount floppy" noeol
    filesystem_dismount "embedded:/mnt/floppy/"
    reload_page
  page button "mount CDROM" noeol
    kernel_load_module "cdrom"
    kernel_load_module "ide-cd"
    kernel_load_module "isofs"
    var Str device := ""
    for (var Int i) 0 3
      (var Stream proc) open "file:/proc/ide/hd"+(character "a":number+i)+"/media" in+safe
      if proc:readline="cdrom"
        device := "device:/hd"+(character "a":number+i)
    if device<>""
      filesystem_mount device "embedded:/mnt/cdrom/" "filesystem [dq]iso9660[dq] readonly"
      reload_page
    else
      text "Could not find an IDE CDROM in the computer !"
  button "unmount CDROM" noeol
    filesystem_dismount "embedded:/mnt/cdrom/"
    kernel_unload_module "isofs"
    reload_page
  page button "mount USB storage" noeol
    kernel_load_module "sg"
    kernel_load_module "sd_mod"
    kernel_load_module "usb-uhci" # 2.4
    kernel_load_module "uhci_hcd" # 2.6
    kernel_load_module "ehci_hcd"
    kernel_load_module "usb-storage"
    kernel_load_module "msdos"
    kernel_load_module "nls_cp437"
    var CBool first := true
    part scan_usb
      for (var Int i) 7 0 step -1
        if (filesystem_bus "device:/sd"+(character "a":number+i))="usb"
          var Str device := "device:/sd"+(character "a":number+i)
          for (var Int j) 0 3
            if (filesystem_mount device+(shunt (j .and. 2)<>0 "" "1") "embedded:/mnt/usb/" (shunt (j .and. 1)<>0 "filesystem [dq]msdos[dq]" ""))=success
              reload_page
              leave scan_usb
      if first
        sleep 5
        first := false
        restart scan_usb
      text "Could not find an USB storage connected to the computer !"
  button "unmount USB" noeol
    filesystem_dismount "embedded:/mnt/usb/"
    reload_page
  eol

execute_dynamic_page "pliant:/pliant/protocol/http/login.html"
button "Power off" noeol
  title "Power off"
  para
    [Do you really want to power off this computer ? ]
    button "yes" noeol
      shutdown 30 "poweroff"
    button "no"
      goto_backward
  if os_api="linux"
    para
      [Just ]
      button "suspend" noeol
        constant vesa_backup (file_query "file:/bin/vbetool" standard)=success
        module "/pliant/language/os.pli"
        module "/pliant/linux/kernel/device.pli"
        module "/pliant/linux/kernel/module.pli"
        module "/pliant/admin/execute.pli"
        kernel_unload_module "usbmouse"
        if vesa_backup
          constant os_VT_ACTIVATE 5606h
          os_ioctl 0 os_VT_ACTIVATE (cast 1 Address)
          sleep 5
          kernel_make_device "device:/mem"
          execute "vbetool vbestate save" output "file:/tmp/vesa"
        os_sync
        if false
          embedded_command "/usr/bin/apm -s" ""
        else
          # don't do that because math processor will not be restored properly
          # (var Stream s) open "file:/sys/power/state" out+safe
          # s writeline "mem"
          # s close
          execute "pliant reset command 'console [dq]mem[dq]" output "file:/sys/power/state"
        if vesa_backup
          execute "vbetool post"
          execute "vbetool vbestate restore" input "file:/tmp/vesa"
          file_delete "file:/tmp/vesa"
          os_ioctl 0 os_VT_ACTIVATE (cast 2 Address)
        kernel_load_module "usbmouse"
        goto_backward
      [ the laptop.]

if os_api="linux"
  (var Stream sys) open "file:/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies" in+safe
  var Str freqs := sys readline
  if freqs<>""
    (var Stream sys) open "file:/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" in+safe
    var Str freq := sys readline
    sys close
    fixed [   ]
    select "Processor frequency: " (var Str freq) noeol
      while (freqs parse (var Int khz) any:(var Str remain))
        option (string khz/1000000)+" Ghz" string:khz
        freqs := remain
    button "set frequency"
      (var Stream sys2) open "file:/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed" out+safe
      sys2 writeline freq
      sys2 close
      thread
        sleep 2
        embedded_command "sync" ""
        embedded_command "hdparm -y "+(file_os_name this_computer:env:"partition":"root":"device") ""
      reload_page