<?php

#############################################################################
#           			                   Site@School
# Site@School is a website management system designed for primary schools.
#
# About Site@School:
# Comissioned by: City District 'de Baarsjes', Amsterdam, Netherlands
# Original idea, coding (version 1.0) and design : Mark de Haan (mark@starwave.nl)
# Ideas, improvements, expansions (version 1.1 - 2.3, 2,3): Fred Stuurman 
# Current coder & maintainer: Fred Stuurman (fc.stuurman@hccnet.nl)
############################################################################
# con_environment.inc.php: last changed 01/02/2005  , version: 2.3
#                          by Fred Stuurman (fc.stuurman@hccnet.nl)
#$Id: con_environment.inc.php,v 1.1 2006/10/03 08:33:55 fstuurman Exp $
############################################################################
#                        LICENSE INFORMATION
# Copyright (C) 2002 - 2005 Municipality of Amsterdam, City District
#  'de Baarsjes', Amsterdam, the Netherlands.
#
# This program 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; either version 2
# of the License, or (at your option) any later version.
#
# 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
##############################################################################
if (!defined('IN_SAS'))
{
	die("Hacking attempt");
}

$editor_rows = $sas_config['htmlarea_editor_rows'];
$num_pages = $sas_config['number_pupilpages'];
$permission_array = array (
	'0700',
	'0750',
	'0755',
	'0770',
	'0777'
);

include ("interface/header.inc.php");
include ("interface/menubar.inc.php");
include ("interface/menustart.inc.php");
include ("interface/menuend.inc.php");
include ("interface/pagestart.inc.php");

if (substr("$access", 5, 1) == "0") //bit 6 off the accessrights
{
	print "<span class=\"heading\">" . $sas_lang['noaccess'] . "<br></span>";
	print "<span class=\"text\">" . $sas_lang['noaccess_introduction'] . "</span><br><br><br>";
	include ("interface/pageend.inc.php");
	include ("interface/footer.inc.php");
	exit;
}

print "<span class=\"heading\">" . $sas_lang['environment'] . "<br></span>";
print "<span class=\"text\">" . $sas_lang['environment_introduction'] . "</span><br><br><br>";
print "<FORM METHOD=\"POST\" NAME=\"form\" ACTION=\"index.php?option=configuration&save=environment\">
      <span class=\"text\">";

print $sas_lang['language'] . "<br>
      <select size=\"1\" name=\"newlanguage\">\n"; // language selection

$dir_handle = @ opendir("$serverpath/languages") or die("<option selected value=\"$file\">Unable to open $path</option>");
while ($file = readdir($dir_handle))
{
	if ($file != "." && $file != "..")
	{
		if ($file == $language)
		{
			echo "<option selected value=\"$file\">$file</option>\n";
		}
		else
		{
			echo "<option value=\"$file\">$file</option>\n";
		}
	}
}
closedir($dir_handle);

print "</select>&nbsp;<img src=graphics/help.gif ONMOUSEOVER=\"popup('" . $sas_lang['language_tip'] . "','CCDAEC')\"; ONMOUSEOUT=\"kill()\"><br><br>";

print "<table width=\"400\"><tr><td><span class=\"text\">" . $sas_lang['date_format'] . "<br>
		<input type=text size=15 class=\"textfield\" name=\"newdateformat\" value=\"$date_format\">&nbsp;<img src=graphics/help.gif 
		ONMOUSEOVER=\"popup('" . $sas_lang['date_format_tip'] . "','CCDAEC')\"; ONMOUSEOUT=\"kill()\"></td>
	<td><span class=\"text\"><br><b>%d-%m-%Y</b> -> 22-03-2003<br>
	<b>%m-%d-%Y</b> -> 03-22-2003</span>
	<br></td></tr></table>";

print "<br><span class=\"text\">" . $sas_lang['editor_rows'] . "</span><br> ";
print "<input type=text size=\"3\" maxlength=\"2\" class=\"textfield\" name=\"editor_rows\" value=\"$editor_rows\">
       &nbsp;<img src=graphics/help.gif ONMOUSEOVER=\"popup('" . $sas_lang['editor_rows_tip'] . "','CCDAEC')\"; ONMOUSEOUT=\"kill()\">";
print "<p><span class=\"text\">" . $sas_lang['number_of_pages'] . "</span><br> ";
print "<input type=text size=\"3\" maxlength=\"2\" class=\"textfield\" name=\"num_pages\" value=\"$num_pages\">
       &nbsp;<img src=graphics/help.gif ONMOUSEOVER=\"popup('" . $sas_lang['number_of_pages_tip'] . "','CCDAEC')\"; ONMOUSEOUT=\"kill()\">";
print "<p><span class=\"text\">" . $sas_lang['file_permissions'] . "</span><br> ";
print "<select size=\"1\" name=\"file_permissions\">\n";
foreach ($permission_array as $value)
{
	if ($sas_config['file_permissions'] == "$value")
	{
		print "<option selected value=\"$value\">$value</option>\n";
	}
	else
	{
		print "<option value=\"$value\">$value</option>\n";
	}
}

print "</select>&nbsp;<img src=graphics/help.gif ONMOUSEOVER=\"popup('" . $sas_lang['file_permissions_tip'] . "','CCDAEC')\"; ONMOUSEOUT=\"kill()\">";
//print "<input type=text size=\"3\" maxlength=\"4\" class=\"textfield\" name=\"file_permissions\" value=\"".$sas_config['file_permissions']."\">	   
print "\n<br><br><input type=\"button\" value=\"&nbsp;&nbsp;&nbsp;" . $sas_lang['cancel'] . "\" name=\"backbutton\" 
		onClick=\"javascript:history.go(-1)\" class=\"backbutton\">";
print "&nbsp;<input type=\"submit\" value=\"&nbsp;&nbsp;&nbsp;" . $sas_lang['save'] . "\" name=\"savebutton\" class=\"savebutton\">";
print "</form>";

include ("interface/pageend.inc.php");
include ("interface/footer.inc.php");
?>