/**
  * Create new form with no fields.
  *
  * @param  Request $request  The request this form will use for populating its fields.
  * @param  Location $location  The location of action that will be called on submission
  * @param  int $method  The HTTP method this form will use - either Request::METHOD_POST (default) or Request::METHOD_GET
  
  */
 function __construct($request, $location, $method = Request::METHOD_POST) {
   $this->request = $request;
   $this->location = $location;
   $this->method = $method;
   
   // Add the hash if in private mode
   if($hash = Session::getPrivateMode()) {
     $this->setParameter('hash', $hash);
   }
 }
 /**
  * This static method acts as the default location rewriter. It is inherited from the <class>LocationRewriter</class>
  * interface and returns the URL of a location in default format.
  * @param  Location $l  the location to return URL for
  * @return  string  the URL of a location
  */
 static function rewrite(Location $l) {
   $rv = '';
   $query = '';
   if($a = $l->getAction()) {
     $rv = 'action=' . $a;
   }
   
   if($hash = Session::getPrivateMode()) {
     $l->setParameter['hash'] = $hash;
   }
   
   unSet($l->parameters['action']);
   foreach($l->parameters as $k=>$v) {
     $query .= ($query ? '&' : '') . $k .'=' . urlEncode($v);
   }
   unSet($l->parameters['hash']);
   
   $rv = $rv . ($query ? '&' : '') . $query;
   if($rv) {
     $rv = '?' . $rv . ($l->anchor ? '#' . $l->anchor : '');
   } else {
     $rv = '';
   }
   return Request::$URL . $rv;
 }