Location: PHPKode > projects > Terra-Terra, A Virtual Operating System > terra-terra.0.0.5/index.php
<?php
/****m*
 * NAME
 *  index.php --- This is the starting point of a new Terra-Terra session
 *
 * DESCRIPTION
 *  This file is sent to browser when the Terra-Terra workspace is (re)loaded.
 *
 * AUTHOR
 *  Oscar van Eijk, Oveas Functionality Provider
 *
 * COPYRIGHT
 *  (c) 2003-2006 by Oscar van Eijk/Oveas Functionality Provider 
 ***/
/*
 * This module is part of Terra-Terra, the Virtual Operating System
 * http://terra-terra.com
 * ------------------------------------------------------------------------
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License,
 * or any later version.
 * This library 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 Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * ------------------------------------------------------------------------
 * $Id: index.php,v 1.4 2006/01/04 12:23:30 tt_oscar Exp $ 
 */

define ('TT_MASTER_PROCESS', '1');		// This is the TT toplevel

if (!file_exists ('lib/TTinclude.pinc')) {
	echo ('<h3>Error loading the kernel. Has Terra-Terra been installed properly ?</h3>');
	exit();
}

if (file_exists ('install') && is_dir ('install')) {
	echo ('<h3>Installation file still exists</h3>');
	echo ('Appearantly, the installation procedure has not been able to remove itseld.');
	echo ('For security reasons, make sure the <tt>install</tt> directory is deleted <i>entirely</i> before attemting to start Terra-Terra');
	exit();
}

$TT_Warnings = '';	// Temporary
require_once ('kernel/TTinit.pinc');

$TT_session->add_return_value("TTroot", TT_ROOT);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php echo ($TT_workspace->title); ?></title>
<script language="JavaScript" src="kernel/terra-terra.js"></script>
<script language="JavaScript" src="kernel/terra-terra_wa.js"></script>
<link href="themes/<?php echo ($TT_workspace->theme); ?>/terra-terra.css" rel="stylesheet" type="text/css" />
</head>
<body style="overflow: hidden; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;" onload="InitWorkSpace();" onunload="DestroyWorkSpace();" onresize="ResizeWorkSpace();">
<?php

// "Splash" screen
//
echo ('<div '
.	'align="left" '
.	'style="position: absolute; '
.		'left: 0px; '
.		'top: 0px; '
.		'width: 100%; '
.		'height: 100%; '
//.		'width: 4000px; '
//.		'height: 4000px; '
.		'visibility: ' . ($TT_conf['debug'] ? 'hidden' : 'visible') . '; '
.		'background-color: white; '
.		'color: black; '
.		'overflow: none; '
.		'z-index: 999; '
.	'" '
.	'id="TT_curtain">'
.	$TT_conf['splash_text']
.	'</div>');

// Background
//
echo ('<div '
.	'align="left" '
.	'style="position: absolute; '
.		'left: 0px; '
.		'top: 0px; '
.		'width: 0px; '
.		'height: 0px; '
.		'visibility: hidden; '
.		'z-index: 1; '
.	'" '
.	'id="TT_background">');
//
// When not in Debug mode, display the background image
//
if (!$TT_conf['debug']) {
	echo ('<img '
	.	'src="' . $TT_workspace->wallpaper . '" '
	.	'width="0px" '
	.	'height="0px" '
	.	'id="TT_bgImage" '
	.	'/>');
}
echo ("</div>\n");

/******
 * Interface layer; the only IFrame; this layer handles the communication between
 * the client en the Terra-Terra server; the server writes to this layer,
 * each document written here MUST have the following body tag:
 *    <body onload="top.SC_Interface(document.body.innerHTML);">
 * to call the JavaScript that'll move all incoming data to the destination WA.
 */

/* !!!!!!!!!! This was implemented for v0.0.3, but never
   !!!!!!!!!! worked ok. In v0.0.4 it's outcommented, *NOT YET* removed!
   !!!!!!!!!! All Interface stuff can be removed when the areas work
   !!!!!!!!!! in all browsers

$__show_sc_area = False;	// Set to True for debug puposes; makes the area visible
echo ('<div '
.	'style="position: absolute; ');
if ($__show_sc_area) {
	echo ('left: 300px; '
	.	'top: 200px; '
	.	'height: 300px; '
	.	'width: 300px; '
	.	'background-color: yellow; '
	.	'z-index: 990; ');
} else {
	echo (		'left: 0px; '
	.		'top: 0px; '
	.		'visibility: hidden; ');
}
echo ('" '
.	'id="TT_sc_interface_area">');

echo ('<iframe '
.	'style="position: absolute; ');
if ($__show_sc_area) {
	echo ('left: 0px; '
	.	'top: 0px; '
	.	'height: 300px; '
	.	'width: 300px; '
	.	'background-color: yellow; '
	.	'z-index: 999; ');
} else {
	echo ('style="visibility: hidden; " ');
}
echo ('" '
.	'id="TT_sc_interface" '
.	'name="TT_sc_interface" '
.	'src="kernel/TTinterface_sc.php">');
// Embedded <LAYER> for NetScape 4 compatibility
echo ('<layer '
.	'style="visibility: hidden; " '
.	'id="TT_sc_interface" '
.	'src="kernel/TTinterface_sc.php">');
echo ('</layer>');
echo ('</iframe>');
echo ('</div>');
//
//***** End Interface layer


*/


$TT_session->display_workareas();

// This layer is used to hold configuration values.
// Values are filled by PHP and read by JavaScript.
// The contents of this layer should never be visible to the user.
//
echo ('<div '
.	'style="position: absolute; '
.		'left: 0px; '
.		'top: 0px; '
.		'visibility: hidden; '
.		'width: 0px; '
.		'z-index: 0; '
.	'" '
.	'id="TT_config">');

// Layout
echo ('<input type="hidden" id="theme" value="' . $TT_workspace->theme . '" />');
echo ('<input type="hidden" id="workspacetop" value="0" />');
echo ('<input type="hidden" id="workspaceleft" value="0" />');
echo ('<input type="hidden" id="titlebarheight" value="' . $TT_workspace->tb_height . '" />');
echo ('<input type="hidden" id="bottombarheight" value="' . $TT_workspace->bb_height . '" />');
echo ('<input type="hidden" id="areaborderwidth" value="' . $TT_workspace->border . '" />');

// Workspace attributes
/*
 * ##### TODO #####
 * This value should be configurable
 */
echo ('<input type="hidden" id="docking_grid" value="8" />');


// Language
echo ('<input type="hidden" id="prompt_maxiwa" value="' . $TT_workspace->get_prompt('MAXIWA') . '" />');
echo ('<input type="hidden" id="prompt_resiwa" value="' . $TT_workspace->get_prompt('RESIWA') . '" />');
echo ('<input type="hidden" id="prompt_shadwa" value="' . $TT_workspace->get_prompt('SHADWA') . '" />');
echo ('<input type="hidden" id="prompt_reviwa" value="' . $TT_workspace->get_prompt('REVIWA') . '" />');

// URL's
echo ('<input type="hidden" id="tttopurl" value="' . TT_URL . '" />');

// If information needs to be returned to the browser as form fields, do it now.
//
$TT_session->send_info(RETURN_FORM);
echo ("</div>\n");


if (!empty($TT_Warnings)) {
	/*
	 * ##### TODO #####
	 * This is a temporary way to signal warnings. In a future release
	 * there will be some kind'a console with message.
	 * Right now, the function TT_Panic() in /lib/TTtools.pinc
	 * just displays a very user-/un/friendly message on errors and exists,
	 * on warnings a similar message is added to $TT_Warnings to be
	 * displayed in the console window using JavaScript here.
	 * The reason for this workaround is, cookies won't work when warnings
	 * are displayed at signal time. This causes problems e.g. on session
	 * timeouts (autologoff doesn't work then).
	 * On errors that doesn't matter anyway......
	 */
	$TT_workspace->add_js_code ("TT_Console = GetWAIDByName ('TTconsole');\n"
	.				"TT_ConsoleBody = GetObjectByID ('TT_wa' + TT_Console + '_body');\n"
	.				"TT_ConsoleBody.src = TT_ConsoleBody.src + '&console_msg=" . urlencode($TT_Warnings) . "';\n"
	.				"PopUp('TTconsole');\n");

}

?>
</body>
</html>
Return current item: Terra-Terra, A Virtual Operating System