<?vsp 
--  
--  $Id: restricted.vsp,v 1.2.2.1 2012/03/08 12:55:11 source Exp $
--  
--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
--  project.
--  
--  Copyright (C) 1998-2012 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
--  
--  


  declare err varchar;
  declare op varchar;
  declare res integer;

  op := atoi ({?'op'});
  res := 0;
  err := '';

  if (op = 1)
    res := Rest::IntegerTest ();

  declare exit handler for sqlstate '*' { err := __SQL_MESSAGE; };
    {
      if (op = 2)
	res := Rest::FileAccessTest (concat (TUTORIAL_ROOT_DIR(),'/tutorial/hosting/ho_s_11/unrestricted.cs'));

      if (op = 3)
	res := Rest::GetEnvTest ();

      if (op = 4)
	res := InternetConnect().Call_Hotmail ('', '');
    }

?>
<html>
 <HEAD>
 <link rel="stylesheet" type="text/css" href="../demo.css" />
  <STYLE>
  .filelist {
    font-family: Tahoma, sans-serif;
    background-color: #eeeeee;
    color: Black;
    border: 1px #dddddd solid;
  }
  </STYLE>
  </HEAD>
 <body>
  <H4>.NET CREATE ASSEMBLY SECURITY SAMPLE.</H4>
  This samples shows importing assemblyes with restrictions. <BR />
  The created types can't access file system, sytem variables and Web access. <BR />
  See restricted.cs for more details. <BR />
  <form method=post action="<?=http_path()?>">
  <table class="tableentry">
  <tr>
    <td>Choose Method to invoke</td>
    <td>
      <select name="op">
        <option value="1"  <?= case {?'op'} when '1' then 'selected' else '' end ?>>IntegerTest</option>
        <option value="2"  <?= case {?'op'} when '2' then 'selected' else '' end ?>>FileAccessTest</option>
        <option value="3"  <?= case {?'op'} when '3' then 'selected' else '' end ?>>GetEnvTest</option>
        <option value="4"  <?= case {?'op'} when '4' then 'selected' else '' end ?>>InternetConnect</option>
      </select>
    </td>
  </tr>
  <tr>
    <td>Start Call</td>
    <td><input type="submit" name="exec" value="Execute"></td>
  </tr>
  </table>
  </form>
<?vsp if (res <> 0)
  	{
?>
  <table>
       <tr>
	 <td>
	<table class="tableresult">
	  <tr>
	  	<td>Result:</td>
		<td><?=res?></td> </tr>
	</table>
	</td>
	</tr>
  </table>
<?vsp
  	}
 if (err <> '')
  	{
?>
  <table>
       <tr>
	 <td>
	<table class="tableresult">
	  <tr>
	  	<td>Excecution error:</td>
		<td><?=err?></td> </tr>
	</table>
	</td>
	</tr>
  </table>
<?vsp
  	}
?>
 </body>
</html>
