<html>
{assign var="tab" value=$smarty.request.tab|default:"list"}
{assign var="fsId" value=$smarty.request.fsId}
{assign var="pgLayout" value="dont_use_any"}
{if !$acm->checkAccess('edit', '_fs', $fsId)}
	{message type="error" value="You do not have access to edit the specified page."}
	<head>
		<title>File System Manager - Access Denied</title>
		<link rel="stylesheet" href="{$skinFolder}edit.css">
	</head>
	<body bgcolor="#DDDDDD" background="{$skinFolder}img/editBg.gif">
		{include file="file:./pages/edit/pageMessages.tpl"}
	</body>
	</html>
{else}
{* include_php file="spade/handle.fileSystem.php" *}
{* CHECK AND STORE ALL ACCESS RIGHTS RELATED TO THE PAGE EDITOR *}
{assign var="addAccess" value=$acm->checkAccess('add', '_toc', $tocId)}
{assign var="deleteAccess" value=$acm->checkAccess('delete', '_toc', $tocId)}
{assign var="changeAccess" value=$acm->checkAccess('changeAccess', '_toc', $tocId)}
{assign var="viewAccess" value=$acm->checkAccess('viewAccess', '_toc', $tocId)}

<head>
	<title>File System Manager - {$aEditPage.title}</title>
	<link rel="stylesheet" href="{$skinFolder}edit.css">
{if $isIE AND $modules.spadeEditor}
	<script language="JavaScript" src="{$modules.spadeEditor}"></script>
{/if}
</head>
<body bgcolor="#DDDDDD" background="{$skinFolder}img/editBg.gif">
	<script language="JavaScript">
		var popupError = 'There was an error opening the popup window.\n\nYou must disable any popup blocking software\nin order for this feature to work properly.';
		{literal}
		function gotoTab(newTab) {
			var dF = document.fileSystemForm;
			if (dF.isChanged.value || dF.editPageAction.value != '') {
				dF.editPageAction.value = 'store';
				dF.tab.value = newTab;
				dF.submit();
				return false;
			}
			return true;
		}
		
		function saveChanges() {
			{/literal}
			var df = document.editPageForm;
			{if $smarty.request.tab eq "history"}
			var inDanger = (historyCount - parseInt(df.historyLimit.value){if $aEditPage.isContentChanged} + 1{/if});
			{elseif $smarty.request.tab eq "content"}
			var inDanger = parseInt(historyCount) - {$aEditPage.historyLimit} + ((df.isContentChanged.value != '') ? 1 : 0);
			{else}
			var inDanger = historyCount - {$aEditPage.historyLimit}{if $aEditPage.isContentChanged} + 1{/if};
			{/if}
			{if $smarty.request.tab eq "content"}
			var isChanged = (df.isContentChanged.value != '');
			{else}
			var isChanged = '{$aEditPage.isContentChanged}';
			{/if}

			{if $changeVersion OR $historySettings}if ((inDanger > 0 && confirm('The current specified history limit is less than the number of versions\ncurrently stored in the history' + ((isChanged) ? ' (plus the new version you are saving)' : '') + '.\n\nThe ' + ((inDanger > 1) ? inDanger+' oldest versions' : 'oldest version') + ' will be deleted.\n\nIf you would like to save ' + ((inDanger > 1) ? 'these versions' : 'this version') + ', or manually select\nthe version(s) to delete, click Cancel and do so now.\n\nIf you would like to continue and automatically delete\n'+((inDanger > 1) ? 'these '+inDanger+' versions' : 'the oldest version') + ', click OK.')) || inDanger <= 0){/if}{literal} {
			df.editPageAction.value='save'; 
			df.submit();
			}
		}
		{/literal}
	</script>
<form name="editPageForm" method="post" action="index.php" style="margin:0px;">
<input type="hidden" name="no_expire" value="true">
<input type="hidden" name="no_expire_keep_alive" value="fssId tab">
<input type="hidden" name="fileSystemAction" value="">
<input type="hidden" name="pg" value="fsm/main">
<input type="hidden" name="fsId" value="{$fsId}">
<input type="hidden" name="tab" value="{$tab}">
<input type="hidden" name="isChanged" value="">
<input type="hidden" name="isPreview" value="">
<input type="hidden" name="preferredPreviewHeight" value="{$s.preferredPreviewHeight}">
<input type="hidden" name="preferredPreviewWidth" value="{$s.preferredPreviewWidth}">
<input type="hidden" name="preferredEditorHeight" value="{$s.preferredEditorHeight}">
<input type="hidden" name="preferredEditorWidth" value="{$s.preferredEditorWidth}">
<table width="100%">
	<tr>
		<td nowrap><a href="http://spade.onai.net" target="_blank"><img src="./img/logos/spade.gif" style="margin-bottom:8px;" border="0"></a> &nbsp; <a href="http://www.onai.net" target="_blank"><img src="./img/logos/onai.gif" style="margin-bottom:8px;" border="0"></a></td>
		<td width="100%" align="center">&nbsp;</td>
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="border:#000000 1px solid;">
	<tr>
		<td background="{$skinFolder}img/fade_gray.gif" bgcolor="#B0BEC0" valign="bottom" style="background-repeat:repeat-x;">
			<span style="padding:3px 3px 0px 3px;"><img src="./img/blank.gif" width="1" height="20" alt="" border="0">
			<a href="?pg=fsm/main&tab=list&fsId={$fsId}" class="tab{if $tab eq "list"}_on{/if}" onclick="return gotoTab('list');">&nbsp;Folder&nbsp;Contents&nbsp;</a>| 
			 
		</span></td>
	</tr>
	<tr>
		<td bgcolor="#FFFFFF">
			<div style="margin:10px;">
			<noscript>
				<div style="color:#FF0000;" align="center">JavaScript must be enabled for this feature to work properly.<br />You may be able to continue with some features, but enabling JavaScript is highly recommended.</div>
			</noscript>
			{include file="file:./pages/edit/pageMessages.tpl"}
			{include file="file:./pages/fsm/`$tab`.tpl"}
			<hr noshade size="1">
			<h2>Current Folder Summary</h2>
			
			<strong>Folder Name:</strong> {$aEditPage.name|default:"Unknown"} &nbsp; <br>
			<strong>Folder Path:</strong> {$aEditPage.title|default:"Unknown"} &nbsp; <br>
			</div></td>
	</tr>
</table>
</form>
 
</body>
</html>
{/if}