<?php
/*
 * This file is part of the easy-CMS project.
 * easy-CMS 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.
 *
 * easy-CMS 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 easy-CMS; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

// define the path context
chdir('..');
define('EASY_GUI_APP_DIR', '../');


include_once('config.inc.php');
include_once('classes/core/Site.class.php');

include_once('classes/system/Dir.class.php');
include_once('classes/system/File.class.php');


include_once('interface/egScript.class.php');
include_once('interface/egManager.class.php');
include_once('interface/egContainer.class.php');
include_once('interface/egMenuItem.class.php');
include_once('interface/egFrame.class.php');
include_once('interface/egToolTip.class.php');
include_once('interface/egRichText.class.php');
include_once('interface/egLink.class.php');
include_once('interface/egStatic.class.php');
include_once('interface/egEdit.class.php');
include_once('interface/egCheckBox.class.php');
include_once('interface/egRadioButton.class.php');
include_once('interface/egPressButton.class.php');
include_once('interface/egDropDownListBox.class.php');
include_once('interface/egPropertyList.class.php');
include_once('interface/egPropertySheet.class.php');
include_once('interface/egPropertyPage.class.php');
include_once('interface/egTreeNode.class.php');
include_once('interface/egTreeList.class.php');
include_once('interface/egSubWindow.class.php');

$site = &Site::getInstance();

//security check : user must be identified to browse repositories
$user = $site->getCurrentUser();
if(ENABLE_ADMIN_AREA == 0 || is_null($user) || $user->getUserId() != USER_ID_ROOT) {
	die("You do not have permissions to access the configuration panel: access denied.");
	exit();
}

$manager = &egManager::getInstance("Configuration panel");
$main = &new egContainer("main_ctn", 0, 0, 0, 0);
$manager->addContainer($main);

$homeLink   = &new egLink("home_lnk", LANG_ADMIN_MANAGER_HOME_TITLE, 10, 10, 300, 18, "window.location=\'../index.php\'", "interface/icons/icon_home.png");
$configLink = &new egLink("admin_lnk", LANG_ADMIN_MANAGER_ADMIN_TITLE, 150, 10, 300, 18, "window.location=\'./admin.php\'", "interface/icons/icon_admin.png");
$vPos = 60;

/*
 *
 * left pane
 *
 */

// template manager
$templatesManagerStatic = &new egStatic("templates_man_static", "&bull;&nbsp;".LANG_CONFIG_MANAGER_TEMPLATES_TITLE, 10, $vPos, 350, 0, true);
$vPos += 20;
// frames repository
$framesLink = &new egLink("frames_man_lnk", LANG_CONFIG_MANAGER_FRAMES_TITLE, 30, $vPos, 300, 18, "document.getElementById(\'sbw_1\').src=\'edit_frame.php\'", "interface/icons/icon_frame.png");
$vPos += 20;
// xsl repository
$xslLink = &new egLink("xsl_man_lnk", LANG_CONFIG_MANAGER_XSL_TITLE, 30, $vPos, 300, 18, "document.getElementById(\'sbw_1\').src=\'edit_xsl.php\'", "interface/icons/icon_xml.png");
$vPos += 20;


$vPos += 20;


// logs manager
$logsManagerStatic = &new egStatic("logs_man_static", "&bull;&nbsp;".LANG_CONFIG_MANAGER_LOGS_TITLE, 10, $vPos, 350, 0, true);
$vPos += 20;
// frames repository
$accessLogsLink = &new egLink("access_man_lnk", LANG_CONFIG_MANAGER_ACCESS_LOGS, 30, $vPos, 300, 18, "document.getElementById(\'sbw_1\').src=\'show_logs.php?type=access\'", "interface/icons/icon_log_access.png");
$vPos += 20;
// xsl repository
$errorLogsLink = &new egLink("error_man_lnk", LANG_CONFIG_MANAGER_ERROR_LOGS, 30, $vPos, 300, 18, "document.getElementById(\'sbw_1\').src=\'show_logs.php?type=error\'", "interface/icons/icon_log_error.png");
$vPos += 20;


$vPos += 20;


// cache manager
$cacheManagerStatic = &new egStatic("cache_man_static", "&bull;&nbsp;".LANG_CONFIG_MANAGER_CACHE_TITLE, 10, $vPos, 350, 0, true);
$vPos += 20;
// main cache repository
$cacheLink = &new egLink("cache_man_lnk", LANG_CONFIG_MANAGER_CACHE_MAIN, 30, $vPos, 300, 18, "document.getElementById(\'sbw_1\').src=\'show_cache.php\'", "interface/icons/icon_html.png");
$vPos += 20;


$vPos += 20;


// types manager
$typesManagerStatic = &new egStatic("types_man_static", "&bull;&nbsp;".LANG_CONFIG_MANAGER_TYPES_TITLE, 10, $vPos, 350, 0, true);
$vPos += 20;
// content types
$contentTypesLink = &new egLink("content_types_man_lnk", LANG_CONFIG_MANAGER_CONTENT_TYPES, 30, $vPos, 300, 18, "document.getElementById(\'sbw_1\').src=\'edit_types.php\'", "interface/icons/icon_content_types.png");
$vPos += 20;


$vPos += 20;


// garbage manager
$garbageManagerStatic = &new egStatic("garbage_man_static", "&bull;&nbsp;".LANG_CONFIG_MANAGER_GARBAGE_TITLE, 10, $vPos, 350, 0, true);
$vPos += 20;
// contents garbage
$contentsGarbageLink = &new egLink("contents_garbage_man_lnk", LANG_CONFIG_MANAGER_GARBAGE_CONTENTS, 30, $vPos, 300, 18, "document.getElementById(\'sbw_1\').src=\'show_deleted_items.php?mode=ask_show_deleted_contents\'", "interface/icons/icon_trash.png");
$vPos += 20;
// containers garbage
$containersGarbageLink = &new egLink("containers_garbage_man_lnk", LANG_CONFIG_MANAGER_GARBAGE_CONTAINERS, 30, $vPos, 300, 18, "document.getElementById(\'sbw_1\').src=\'show_deleted_items.php?mode=ask_show_deleted_containers\'", "interface/icons/icon_trash.png");
$vPos += 20;
// containersLists garbage
$containersListsGarbageLink = &new egLink("containers_lists_garbage_man_lnk", LANG_CONFIG_MANAGER_GARBAGE_CONTAINERS_LISTS, 30, $vPos, 300, 18, "document.getElementById(\'sbw_1\').src=\'show_deleted_items.php?mode=ask_show_deleted_containers_lists\'", "interface/icons/icon_trash.png");
$vPos += 20;
// pages garbage
$pagesGarbageLink = &new egLink("pages_garbage_man_lnk", LANG_CONFIG_MANAGER_CONTENT_GARBAGE_PAGES, 30, $vPos, 300, 18, "document.getElementById(\'sbw_1\').src=\'show_deleted_items.php?mode=ask_show_deleted_pages\'", "interface/icons/icon_trash.png");
$vPos += 20;


$vPos += 20;



/*
 *
 * right pane
 *
 */

$fameTop    = 60;
$fameLeft   = 230;
$fameWidth  = 680;
$fameHeight = 550;

$frame = &new egFrame("fra_1", "frame 1", $fameLeft, $fameTop, $fameWidth, $fameHeight);
$subWindow = &new egSubWindow("sbw_1", "look_at_left.php", $fameLeft+1, $fameTop+1, $fameWidth-2, $fameHeight-2);


$main->addObject($homeLink);
$main->addObject($configLink);

$main->addObject($templatesManagerStatic);
$main->addObject($framesLink);
$main->addObject($xslLink);

$main->addObject($logsManagerStatic);
$main->addObject($accessLogsLink);
$main->addObject($errorLogsLink);

$main->addObject($cacheManagerStatic);
$main->addObject($cacheLink);

$main->addObject($typesManagerStatic);
$main->addObject($contentTypesLink);

$main->addObject($garbageManagerStatic);
$main->addObject($contentsGarbageLink);
//$main->addObject($containersGarbageLink);
//$main->addObject($containersListsGarbageLink);
//$main->addObject($pagesGarbageLink);

$main->addObject($frame);
$main->addObject($subWindow);

$scripts = new egScript();
$line = "
function refreshFrame() {
	var temp = document.getElementById('sbw_1').src;
	document.getElementById('sbw_1').src = '';
	document.getElementById('sbw_1').src = temp;
}
";
$scripts->addLine($line);

$manager->addScripts($scripts);


print($manager->getHTML());

?>