<?php
// Call in the XComponents engine and options file
define('MOD_PHP', substr(PHP_SAPI, 0, 3) != 'cgi'); // Are we running as mod_php?
define('DOCROOT', 
	MOD_PHP && isset($_SERVER['DOCUMENT_ROOT']) ? 
		$_SERVER['DOCUMENT_ROOT'] : 
		(
			MOD_PHP && isset($_SERVER['SCRIPT_FILENAME']) ? 
				substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF'])) : 
				(
					substr(str_repeat('../', count(explode('/', preg_replace('_/+_', '/', $_SERVER['PHP_SELF'])))-2), 0, -1) != '' ?
						substr(str_repeat('../', count(explode('/', preg_replace('_/+_', '/', $_SERVER['PHP_SELF'])))-2), 0, -1) :
						'.'
				)
		)
	);
include(DOCROOT . '/dmx/dmx_options.php');
include(DOCROOT . '/dmx/core/php/dmx_shop_handler.php');
include(DOCROOT . '/dmx/core/php/dmx_shop_components.php');
?>
<?php
$abs_root = '';
@include(DOCROOT . '/abs_version_control.php');
include(DOCROOT . $abs_root . '/common/authenticate.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
	<title>{SUB:company_brandname} ::: advanced telecommunications</title>
	<meta name="description" content="">
	<meta name="keywords" content="">

	<!-- CALENDER DATE PICKER JS & CSS -->
	<script type="text/javascript" src="js/mootools-release-1.11.js"></script>
	<script type="text/javascript" src="js/calendar.rc4.js"></script>
	<script type="text/javascript">
	<!--
	window.addEvent('domready', function() { myCal = new Calendar({ edit_date: 'd-m-Y', tweak: {x: 100, y: 0} }); });
	// -->
	</script>
	<link href="css/calender.css" rel="stylesheet" type="text/css" />
	<!-- END CALENDER DATE PICKER JS & CSS -->

	<?php
	include(DOCROOT . $abs_root . '/common/header.php');

	if (isset($_GET['archive']))
	{
		$panel->create_duplicate_version('english_1', 'english_2');
	}

	// Search the /_PANELS/ directory for its subdirectories
	$dh = dir(DOCROOT . $abs_root . '/_CONTENT/_PANELS/');
	while ($d = $dh->read()) {
		if (substr($d, 0, 1) != '.') $dirs[] = $d;
	}
	$dirs = dmx_generate_select($dirs, $abs_content['version']);
	
	?>

<!-- MAIN CONTENT AREA -->
<div id="main_area" onmouseover="sub_menu_hide();">
	<div id="main_area_content">
		
		<div class="main_column">
		<!-- ----------------- -->
		<!-- BEGIN MAIN COLUMN -->
		<!-- ----------------- -->
			
<h1>Choose an edit date and content version</h1>

<p>
dmABS supports multiple content versions, and allows you to make edits that go live on a date of your choice. Choose the version you want to edit, and set the date on which edits you make go live.
<p>

<p>
<b>If you choose a date in the future, then while you are logged in you will see the site as it appears on that future date.</b> Logout to see the site as visitors see it today.
</p>

<!--
<p>
<a href="?archive=1">ARCHIVE</a>
</p>
// -->

<br />

<form name="version_selector_form">
Edit Date <input id="edit_date" name="edit_date" type="text" size="10" maxlength="10" value="" /> 
&nbsp;&nbsp;&nbsp;&nbsp;
Version
<select name="content_directory">
<?=$dirs;?>	
</select>
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" value="set" onclick="set_content_version();" />
</form>

<script language="javascript" type="text/javascript">
<!--

function set_content_version()
{
	var exp = dmb1_get_exp_date(1,0,0); // Set a cookie expiry 1 day from now
	// Get the directory to edit and store in cookie
	var ver = document.version_selector_form.content_directory.options[document.version_selector_form.content_directory.selectedIndex].text;
	var date  = document.version_selector_form.edit_date.value;
	date = date.substring(6) + date.substring(3, 5) + date.substring(0, 2);
	ver += '__' + date;
	ver += '__on';
	dmb1_set_cookie('abs_content', ver, exp, '/');
}

var init_date = '<?=$panel->today;?>';
init_date = init_date.substring(6) + '-' + init_date.substring(4, 6) + '-' + init_date.substring(0, 4);
document.version_selector_form.edit_date.value = init_date;

set_content_version();	

// -->
</script>

<br /><br /><br />


		<!-- --------------- -->
		<!-- END MAIN COLUMN -->
		<!-- --------------- -->
		</div>
		
		<div class="sidebar">
		<!-- ------- -->
		<!-- SIDEBAR -->
		<!-- ------- -->
					
			<div class="sidebar_box_heading">
				<h2>Controls</h2>
			</div>
			<div class="sidebar_box_content">
				<div>
					
					<h2>Content Management</h2>
					<p>
					<a href="manage_panels.php">Manage Panels and Panel Updates</a>
					<br>
					<a href="version_date.php">Set Edit Date &amp; Version</a>
					<br>
					<a href="adaptingbody/index.php">Show Adapting Bodies</a>
					</p>
					
					<h2>SEO</h2>
					<p>
					<a href="seo_regenerate.php">Reload Easy SEO Data</a>
					</p>
			
					<h2>Security</h2>
					<p>
					<a href="set_pw.php">Reset Username and Password</a>
					</p>
					
				</div>
			</div>

		<!-- ----------- -->
		<!-- END SIDEBAR -->
		<!-- ----------- -->
		</div>
		
	</div>
</div>
<!-- END MAIN CONTENT AREA -->

<br style="clear: both;">
<br>

<?php include(DOCROOT . $abs_root . '/common/footer.php'); ?>
