Mastodon

WARP uses the abstractions in WebFace to create a facility where multiple pages can share the same control mechanism. i.e. show_log1.php can use the,

index.php?WRP001X1_sortorder=0
component of the GET request, while free_space.php can use,
&WRP002X2_disk=3

It does this, primarily, by replacing the Web_Ctrl feature to build custom links for each "applet". (Each, applet being the name for the various server-side files that handle application-specific functionality.)

The replacement code is small:

    function getParameterValue($param)
    {
        $app =& $this->_appman->getCurrentApplet();
        $full = $this->_appman->getParameter($app, $param);
        return $this->_appman->queryArgument($full);
    }
This is because the work is done by the appletmanager, which keeps a list of all applets running in the system (and their IDs).
So, the code is simply,
    function getParameter(&$applet, $argName)
    {
        $idx = $this->getAppletIndex($applet);
        return $applet->getID($this).$idx."_".$argName;
    }
This ensures a unique parameter ID for each applet. You can see this by studying the URL,
http://www.warpdemo.homelinux.net/index.php?WRP001X1_current=0&
   WRP003X3_current=1&MIN004A4_current=0&WRP004X5_sort=11&WRP004X5_mx=10&
   WRP004X5_opt=&WRP005X6_sort=11&WRP005X6_mx=10&WRP005X6_opt=&
   max=WRP003X&wintype=main&content=WRP003X&WRP003X3_cmd=next
If we break it down, you'll see these system parameters:
  • max=WRP003X
  • wintype=main
  • content=WRP003X
Where wintype can be:
  • Minimized, as a panel
  • Maximised, in the window
  • Running a configuration screen
  • Displaying help/information


Directory structure

Underneath, the directory structure keeps applets separate. The directories within WARP are: applets conf system warplib

  • applets
  • Each applet has its own directory with all its source and images. Stops collisions. It may also have its own specific ID. If not one is not supplied, it is auto generated. A specific ID indicates it has been 'signed', and the codes (such as) 'MIN000a' are distributed on request.
  • conf
  • Applet-specific settings. E.g. list of photos or which drives to use for diskfree. It may also contain content.
  • system
  • System-specific settings. E.g. contents of master bar, directory paths to /var/www
  • warplib
  • The appletmanager, specific web-face visualizer, applet base class, and so on.

    PHP Usage

    During the applets initialization, you have the opportunity to parse the GET arguments. Note that the Applet Manager does all the work!

        function init(&$appMan)
        {
            // pickup any control parameters passed in
            $prm = $appMan->queryParameter($this, "on");
            if ($prm != "") {
                X10::setStatus($prm, X10::$device_on);
            }
        }
    
    The other half of the equation involves creating a suitably configured link:
        $html.= $appMan->getAppletLink($this, "on", "bedroom_light", "Switch Light On");
    
    For anything that isn't a command, but merely holds additional state there this:
        function getRefreshParams(&$appMan)
        {
            return $appMan->getArgument($this, "current", $this->_which);
        }
    

    Download

    The best location for these files are from the Minerva bundle, as this is the biggest project (to date) which uses them, and keeps the files up-to-date.