<?xml version="1.0"?>
<!--
 -
 -  $Id$
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -
 -  Copyright (C) 1998-2018 OpenLink Software
 -
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -
-->
<v:page name="dav_browser" style="index.xsl"
      fast-render="1"
      doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
      xmlns:v="http://www.openlinksw.com/vspx/"
      xmlns:xhtml="http://www.w3.org/1999/xhtml"
      xmlns:vm="http://www.openlinksw.com/vspx/ods/">
  <v:variable name="realm1" type="varchar" default="null"/>
  <v:variable name="sid1" type="varchar" default="null"/>
  <v:variable name="curpath1" type="varchar" default="''"/>
  <v:variable name="file1" type="varchar" default="null" />
  <?vsp
    declare _content any;
    declare _mime varchar;
    self.realm1 := get_keyword('realm', params);
    self.sid1 := get_keyword('sid', params);
    self.curpath1 := get_keyword('path', params, '');
    self.file1 := get_keyword('file', params);
    http_rewrite();
    self.curpath1 := trim(self.curpath1, '/');
    if (self.curpath1 <> '')
      self.curpath1 := concat('/', self.curpath1, '/');
    select blob_to_string (RES_CONTENT), RES_TYPE into _content, _mime from WS.WS.SYS_DAV_RES where RES_FULL_PATH = concat(self.curpath1, self.file1);
    http_header (sprintf('Content-Type: %s\r\n', _mime));
    if (_mime = 'text/plain')
      http ('<HTML>\r\n<BODY>\r\n<PRE>\r\n');
    http(_content);
    if (_mime = 'text/plain')
      http ('\r\n</PRE>\r\n</BODY>\r\n</HTML>\r\n');
    http_flush();
  ?>
</v:page>
