<?

/*
FlexCMS (http://www.flexcms.com)
Flexible, Powerful, Affordable.

Contents of this file are protected by the copyright
notice found at http://www.flexcms.com/flex/pages/copyright.html,
and its usage is subject to the terms of the licensing agreement 
available at http://www.flexcms.com/flex/pages/license.html
*/



	// ========================================================================================
	// Manage Calendar Prefs
	// ========================================================================================
	
	$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_calendar.gif" width="28" height="18"> '.$MsgText[1][3];
	$BrowserTitle = $MsgText[1][3];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[1][3];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[101] == 'y') {
		
			$query = "select * from `".$Settings['DBPrefix']."cl-Settings`";
			$result = mysql_query($query) or die (mysql_error());
			while ($row = mysql_fetch_array($result)) {
				$clSettings[$row['Name']] = $row['Value'];
			}
			
			if ($clSettings['NumberLocation'] < 1) {
				$clSettings['NumberLocation'] = 1;
			}
			$NumberLocationChecked[$clSettings['NumberLocation']] = ' checked';
			$CenterPopChecked = ' checked';
						
			$TitleAlignmentSelected[$clSettings['TitleAlignment']] = ' selected';
			$TopTextAlignmentSelected[$clSettings['TopTextAlignment']] = ' selected';
			$BottomTextAlignmentSelected[$clSettings['BottomTextAlignment']] = ' selected';
			$DetailsAlignmentSelected[$clSettings['DetailsAlignment']] = ' selected';
			$SortOrderSelected[$clSettings['SortOrder']] = ' selected';
			$DayNamesStyleSelected[$clSettings['DayNamesStyle']] = ' selected';
			
			$DetailsDisplaySelected[$clSettings['DetailsDisplay']] = ' checked';
			$ConvertReturnsSelected[$clSettings['ConvertReturns']] = ' checked';
			$ShowPosterSelected[$clSettings['ShowPoster']] = ' checked';
			$BorderStyleSelected[$clSettings['BorderStyle']] = ' checked';
			
			
	
			$PageContents = '<br><form name="PostForm" action="'.$MainURL.'/admin/calendar_prefs-save" method="post">
						
			<b>'.$MsgText[1][25].':</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;('.$MsgText[1][26].': <select name="TitleAlignment" style="'.$FormStyle.'">
			<option value="L"'.$TitleAlignmentSelected['L'].'> '.$MsgText[0][15].'</option>
			<option value="C"'.$TitleAlignmentSelected['C'].'> '.$MsgText[0][16].'</option>
			<option value="R"'.$TitleAlignmentSelected['R'].'> '.$MsgText[0][17].'</option>
			</select>)<br>
			<input type="text" name="PageTitle" size="45" value="'.str_replace('"','&#34;',$clSettings['PageTitle']).'" style="'.$FormStyle.'">
			<br>
			
			<script>
var ImageDestination = "";

var ExistingImagesWindowCode = "";

function SelectImage(ImageDestinationSent) {
	var WindowProperties = "width=420,height=300,left=" + (screen.width-420)/2 + ",top=" + (screen.height-300)/2 + ",location=no,menubar=no,directories=no,toolbar=no,status=no,scrollbars=no,resizable=yes";

	ImageDestination = ImageDestinationSent;

	if (ImageDestination == "Photo") {
		ExistingImagesWindowCode = window.open("'.$BaseURL.'/inc-core-admin-editor-existingimages.php?"+document.forms["PostForm"].elements["PhotoURL"].value,"existingimages",WindowProperties);
	}
	else {
		ExistingImagesWindowCode = window.open("'.$BaseURL.'/inc-core-admin-editor-existingimages.php?"+document.forms["PostForm"].elements["TitleImage"].value,"existingimages",WindowProperties);
	}
}
function ExistingImageSelected(ImageName,ImageWidth,ImageHeight) {

	ExistingImagesWindowCode.close();
	
	if (ImageDestination == "Photo") {
		document.forms["PostForm"].elements["PhotoURL"].value = "/images/uploaded/"+ImageName;
	}
	else {
		document.forms["PostForm"].elements["TitleImage"].value = "/images/uploaded/"+ImageName;
	}

}
function UploadToServer(ImageDestinationSent) {

		ImageDestination = ImageDestinationSent;

		var WindowProperties = "width=580,height=380,left=" + (screen.width-580)/2 + ",top=" + (screen.height-380)/2 + ",location=no,menubar=no,directories=no,toolbar=no,status=no,scrollbars=no,resizable=yes";

		UploadWindowCode = window.open("'.$BaseURL.'/inc-core-admin-editor-imageupload.php","imageupload",WindowProperties);

	  }

	  function UploadedImageSelected(ImageName,ImageWidth,ImageHeight) {

		UploadWindowCode.close();
		
		
		if (ImageDestination == "Photo") {
			document.forms["PostForm"].elements["PhotoURL"].value = "/images/uploaded/"+ImageName;
		}
		else {
			document.forms["PostForm"].elements["TitleImage"].value = "/images/uploaded/"+ImageName;
		}
		
	  }
</script>
			
			
			'.$MsgText[0][519].':<br>
			<input type="text" name="TitleImage" size="50" value="'.str_replace('"', '&#34;', $clSettings['TitleImage']).'" style="'.$FormStyle.'">
			<br>
			<input type="button" value="'.$MsgText[0][521].'" onClick="SelectImage();" style="'.$FormStyle.'">&nbsp;<input type="button" value="'.$MsgText[0][563].'" onClick="UploadToServer();" style="'.$FormStyle.'">
			
			<br><br><b>'.$MsgText[1][27].':</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;('.$MsgText[1][26].': <select name="TopTextAlignment" style="'.$FormStyle.'">
			<option value="L"'.$TopTextAlignmentSelected['L'].'> '.$MsgText[0][15].'</option>
			<option value="C"'.$TopTextAlignmentSelected['C'].'> '.$MsgText[0][16].'</option>
			<option value="R"'.$TopTextAlignmentSelected['R'].'> '.$MsgText[0][17].'</option>
			</select>)<br>
			<textarea name="TopText" cols="39" rows="1" wrap="virtual" style="'.$FormStyle.'">'.str_replace('<','&lt;',$clSettings['TopText']).'</textarea>
			<br><font size="1">'.$MsgText[1][28].'<br></font>

			<br><b>'.$MsgText[1][29].':</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;('.$MsgText[1][26].': <select name="BottomTextAlignment" style="'.$FormStyle.'">
			<option value="L"'.$BottomTextAlignmentSelected['L'].'> '.$MsgText[0][15].'</option>
			<option value="C"'.$BottomTextAlignmentSelected['C'].'> '.$MsgText[0][16].'</option>
			<option value="R"'.$BottomTextAlignmentSelected['R'].'> '.$MsgText[0][17].'</option>
			</select>)<br>
			<textarea name="BottomText" cols="39" rows="1" wrap="virtual" style="'.$FormStyle.'">'.str_replace('<','&lt;',$clSettings['BottomText']).'</textarea>
			<br><font size="1">'.$MsgText[1][30].'<br></font>

			
			<br><b>'.$MsgText[1][31].':</b><br>
			<table cellpadding="2" cellspacing="0" border="0"><tr><td width="20"></td><td><font face="'.$FontFace.'" size="'.$FontSize.'">
			
			'.$MsgText[1][32].': <input type="text" name="DatesToShow" size="3" value="'.$clSettings['DatesToShow'].'" style="'.$FormStyle.'"><br>
			'.$MsgText[1][33].' <input type="text" name="ReversePeriod" size="3" value="'.$clSettings['ReversePeriod'].'" style="'.$FormStyle.'"> '.$MsgText[1][34].',<br>&nbsp;&nbsp;&nbsp;'.$MsgText[1][35].' <input type="text" name="ForwardPeriod" size="3" value="'.$clSettings['ForwardPeriod'].'" style="'.$FormStyle.'"> '.$MsgText[1][36].'.
			
			</td></tr></table>
			
			
			<br><b>'.$MsgText[1][37].':</b><br>
			<table cellpadding="2" cellspacing="0" border="0"><tr><td width="20"></td><td><font face="'.$FontFace.'" size="'.$FontSize.'">
			<b>'.$MsgText[1][38].':</b><br><table border="0" cellspacing="0">
    <tr><td bgcolor="#222222">
	  
			<table width="100" height="80" border="0" cellpadding="2" cellspacing="0">
    <tr>
      <td bgcolor="#ffffff" valign="top"><input type="radio" name="NumberLocation" value="1"'.$NumberLocationChecked[1].'></td>
      <td bgcolor="#ffffff" valign="top" align="center"><input type="radio" name="NumberLocation" value="2"'.$NumberLocationChecked[2].'></td>
      <td bgcolor="#ffffff" valign="top" align="right"><input type="radio" name="NumberLocation" value="3"'.$NumberLocationChecked[3].'></td>
    </tr>
    <tr>
      <td bgcolor="#ffffff" valign="bottom"><input type="radio" name="NumberLocation" value="4"'.$NumberLocationChecked[4].'></td>
      <td bgcolor="#ffffff" valign="bottom" align="center"><input type="radio" name="NumberLocation" value="5"'.$NumberLocationChecked[5].'></td>
      <td bgcolor="#ffffff" valign="bottom" align="right"><input type="radio" name="NumberLocation" value="6"'.$NumberLocationChecked[6].'></td>
    </tr>
</table>
			
			</td>
    </tr>
</table>


			<br><b>'.$MsgText[1][39].':</b><br>
				<textarea name="GridPrefix" cols="39" rows="1" wrap="virtual" style="'.$FormStyle.'">'.str_replace('<','&lt;',$clSettings['GridPrefix']).'</textarea><br>
	<font size="1">'.$MsgText[1][40].'<br></font>


			<br><b>'.$MsgText[1][41].':</b><br>
				'.$MsgText[1][42].': <input type="text" name="ItemFontFace" size="20" value="'.$clSettings['ItemFontFace'].'" style="'.$FormStyle.'">&nbsp;&nbsp;'.$MsgText[1][43].': <input type="text" name="ItemFontSize" size="3" value="'.$clSettings['ItemFontSize'].'" style="'.$FormStyle.'">

			</td></tr></table>

			
			<br><b>'.$MsgText[1][101].':</b><br>
			<select name="DayNamesStyle" style="'.$FormStyle.'">
	<option value="1"'.$DayNamesStyleSelected['1'].'> '.$MsgText[1][102].'</option>
	<option value="2"'.$DayNamesStyleSelected['2'].'> '.$MsgText[1][103].'</option>
</select><br>

			
			<br><b>'.$MsgText[1][44].':</b><br>
				<input type="radio" name="DetailsDisplay" value="1"'.$DetailsDisplaySelected['1'].'> '.$MsgText[1][45].'
				<br>				
	<input type="radio" name="DetailsDisplay" value="2"'.$DetailsDisplaySelected['2'].'> '.$MsgText[1][46].'<br>
	
	<table cellpadding="2" cellspacing="0" border="0"><tr><td width="20"></td><td><font face="'.$FontFace.'" size="'.$FontSize.'">

				'.$MsgText[1][47].': <input type="text" name="PopWidth" size="5" value="'.$clSettings['PopWidth'].'" style="'.$FormStyle.'">&nbsp;&nbsp;'.$MsgText[1][48].': <input type="text" name="PopHeight" size="5" value="'.$clSettings['PopHeight'].'" style="'.$FormStyle.'"><br>
				'.$MsgText[1][49].': <input type="checkbox" name="CenterPop" value="y"'.$CenterPopChecked.'> '.$MsgText[0][118].'<br>
	
	</td></tr></table>
	
	
			<br><b>'.$MsgText[1][50].':</b><br>
			<table border="0" cellpadding="2" cellspacing="0">
    <tr>
      <td>
	  
	  
	  <table border="0" cellpadding="2" cellspacing="0"><tr><td bgcolor="'.$Colors['Text'].'">
		<table width="100%" border="0" cellpadding="3" cellspacing="0"><tr><td bgcolor="'.$Colors['BG'].'"><table width="100%" border="0" cellpadding="1" cellspacing="0"><tr><td bgcolor="'.$Colors['Text'].'"><table width="100%" border="0" cellpadding="4" cellspacing="0"><tr><td bgcolor="'.$Colors['BG'].'">
	  
	  <font face="'.$FontFace.'" size="'.$FontSize.'">
	  <input type="radio" name="BorderStyle" value="1"'.$BorderStyleSelected['1'].'> '.$MsgText[1][51].'&nbsp;
	  
	  </td></tr></table></td></tr></table></td></tr></table></td></tr></table>
	  
	  
	  
	  </td>
      <td>&nbsp;</td>
	  <td>
	  
	  
	  <table width="100%" border="0" cellpadding="2" cellspacing="0"><tr><td bgcolor="'.$Colors['Text'].'"><table width="100%" border="0" cellpadding="4" cellspacing="0"><tr><td bgcolor="'.$Colors['BG'].'">
	  
	  <font face="'.$FontFace.'" size="'.$FontSize.'">
	  <input type="radio" name="BorderStyle" value="2"'.$BorderStyleSelected['2'].'> '.$MsgText[1][52].'&nbsp;
	  
	  
	  </td></tr></table></td></tr></table>
	  
	  
	  </td>	  
	  <td>&nbsp;</td>
      <td>
	  
	  
	  <table width="100%" border="0" cellpadding="1" cellspacing="0"><tr><td bgcolor="'.$Colors['Text'].'"><table width="100%" border="0" cellpadding="4" cellspacing="0"><tr><td bgcolor="'.$Colors['BG'].'">
	  
	  <font face="'.$FontFace.'" size="'.$FontSize.'">
	  <input type="radio" name="BorderStyle" value="3"'.$BorderStyleSelected['3'].'> '.$MsgText[1][53].'&nbsp;
	  
	  
	  </td></tr></table></td></tr></table>
	  
	  
	  </td>
      <td>&nbsp;</td>	  
      <td><font face="'.$FontFace.'" size="'.$FontSize.'">
	  <input type="radio" name="BorderStyle" value="4"'.$BorderStyleSelected['4'].'> '.$MsgText[1][54].'</td>
    </tr>
</table>
			
			
			<br><b>'.$MsgText[1][55].':</b>&nbsp;&nbsp;<select name="DetailsAlignment" style="'.$FormStyle.'">
			<option value="L"'.$DetailsAlignmentSelected['L'].'> '.$MsgText[0][15].'</option>
			<option value="C"'.$DetailsAlignmentSelected['C'].'> '.$MsgText[0][16].'</option>
			<option value="R"'.$DetailsAlignmentSelected['R'].'> '.$MsgText[0][17].'</option>
			</select><br>
	<font size="1">'.$MsgText[1][56].'<br></font>
	
	
			<br><b>'.$MsgText[1][57].':</b><br>
				<input type="radio" name="ConvertReturns" value="y"'.$ConvertReturnsSelected['y'].'> '.$MsgText[0][118].'&nbsp;&nbsp;&nbsp;
	<input type="radio" name="ConvertReturns" value="n"'.$ConvertReturnsSelected['n'].'> '.$MsgText[0][119].'<br>
	<font size="1">'.$MsgText[1][58].'<br></font>

			<br><b>'.$MsgText[1][59].':</b><br>
				<input type="radio" name="ShowPoster" value="y"'.$ShowPosterSelected['y'].'> '.$MsgText[0][118].'&nbsp;&nbsp;&nbsp;
	<input type="radio" name="ShowPoster" value="n"'.$ShowPosterSelected['n'].'> '.$MsgText[0][119].'<br>
	
	
			
			<br><b>'.$MsgText[1][60].':</b><br>
			'.$MsgText[1][61].': <input type="text" name="DayViewDescriptionLength" size="5" value="'.$clSettings['DayViewDescriptionLength'].'" style="'.$FormStyle.'"><br>
			'.$MsgText[1][62].': <input type="text" name="DetailsPopDescriptionLength" size="5" value="'.$clSettings['DetailsPopDescriptionLength'].'" style="'.$FormStyle.'"><br>
			
			
			<br><b>'.$MsgText[1][63].':</b><br>
			<select name="SortOrder" style="'.$FormStyle.'">
				<option value="1"'.$SortOrderSelected['1'].'> '.$MsgText[1][64].'</option>
				<option value="2"'.$SortOrderSelected['2'].'> '.$MsgText[1][65].'</option>
			</select>
			<br>
			
			
			<br><br><br>
			<input type="submit" value="'.$MsgText[0][123].'" style="'.$FormStyle.'">
			</form>';
			
			
	
	
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
	

	// ========================================================================================




?>
