Location: PHPKode > projects > Aukyla Document Management System > adms2/plugins/Frontends/ADMS/ClassicFrontend.php
<?php
/*
     ClassicFrontend.php, frontend for ADMS -- much like ADMS 1.0
     Copyright (C) 2003-2005 Arend van Beelen, Auton Rijnsburg

     This program 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.

     This program 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 this program; if not, write to the Free Software Foundation, Inc.,
     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

     For any questions, comments or whatever, you may mail me at: hide@address.com
*/

require_once('Config.php');
require_once('ConfigEditor.php');
require_once('Decoration.php');
require_once('Document.php');
require_once('Forms.php');
require_once('Frontend.php');
require_once('Locale.php');
require_once('Login.php');
require_once('Menus.php');
require_once('Messages.php');
require_once('String.php');
require_once('Views.php');
require_once('Widgets.php');

require_once('ADMS/Application.php');

class ADMS_ClassicFrontend implements Frontend
{
	function __construct()
	{
		// initialize localization
		Locale::init('plugins/Frontends/ADMS');
	}

	public function buildGUI()
	{
		$directory = Config::request('ADMS_dir');
		if($directory == '')
		{
			$directory = Login::sessionVariable('ADMS_dir', 'ADMS://docs/0');
		}

		$this->mainWindow = new MainWindow('ADMS');
		$this->mainWindow->setShortcutIcon('/resources/plugins/Frontends/ADMS/Classic/shortcut.png');
		$this->mainWindow->addStyleSheet('resources/plugins/Frontends/ADMS/Classic/print.css', 'print');

		new Box($this->mainWindow, 'logo');

		$mainmenu = new Menu($this->mainWindow, 'mainmenu');
		$menuEntry = new MenuEntry($mainmenu, 'Auton');
		$menuEntry->setLink('http://www.auton.nl/');
		$menuEntry->setPriority(-10);
		$menuEntry->setCssClass('home');

		$submenu = new Menu($this->mainWindow, 'submenu');

		$menuHead = new MenuHead($submenu, i18n('System'));
		$menuHead->setPriority(10);

		// create menu entries
		if(String::startsWith(Login::username(), 'anonymous'))
		{
			$menuEntry = new MenuEntry($submenu, i18n('Login'));
			$menuEntry->setLink(Config::globals('secureBaseURL').'?view=Login');
			$menuEntry->setPriority(10);
		}
		else
		{
			$menuEntry = new MenuEntry($submenu, i18n('Preferences'));
			$menuEntry->setLink(Config::globals('baseURL').'?view=ConfigEditor');
			$menuEntry->setPriority(-10);
			$menuEntry = new MenuEntry($submenu, i18n('Logout'));
			$menuEntry->setLink(Config::globals('baseURL').'?action=Logout');
			$menuEntry->setPriority(-10);
		}

		$menuHead = new MenuHead($submenu, i18n('Search'));
		$menuHead->setPriority(-12);
		$searchEntry = new MenuEntry($submenu);
		$searchEntry->setPriority(-12);
		$searchForm = new Form($searchEntry, Config::globals('baseURL').'?ADMS_action=Search');
		$searchForm->setErrorMessage(i18n('Please enter some keyword(s).'));
		$oldDirInput = new HiddenInput($searchForm, 'ADMS_oldLocation');
		$oldDirInput->setValue($directory);
		$textInput = new TextInput($searchForm, 'ADMS_keywords');
		$textInput->setRequired(true);
		$textInput->addCssStyle('width: 125px; top-margin: 2px');
		$button = new Button($searchForm, 'button');
		$button->setValue(i18n('Search'));
		$button->setConfirm(true);
		//$menuEntry = new MenuEntry($submenu, i18n('Advanced Search'));
		//$menuEntry->setLink(Config::globals('baseURL').'?ADMS_view=AdvancedSearch');
		//$menuEntry->setPriority(-12);

		$main = new Box($this->mainWindow, 'main');
		new MessagesWidget($main);

		$viewContainer = new ViewContainer($main);
		if($viewContainer->view() == 'Login')
		{
			$view = new View($viewContainer, 'Login');
			new LoginForm($view);
		}
		elseif($viewContainer->view() == 'ConfigEditor')
		{
			$view = new View($viewContainer, 'ConfigEditor');
			$configEditor = new ConfigEditor($view);
			$page = new ConfigTab($configEditor, i18n('General'), 'global');
			new SelectConfigOption($page, 'theme', Decoration::theme(), Decoration::availableThemes(), i18n('Choose a theme:'),
			                       i18n('Themes are used to give applications a certain look and feel.'));
			new SelectConfigOption($page, 'language', Locale::language(), Locale::availableLanguages(), i18n('Choose a language:'),
			                       i18n('Here you can choose in what language texts should be presented to you.'));

			$config = new Config('adms', Login::username());
			$appendGoogleResults = $config->variable('appendGoogleResults', 'true');
			$showEmptyFolders = $config->variable('showEmptyFolders', 'true');
			$showLastAddedDocuments = $config->variable('showLastAddedDocuments', 'true');
			$showLastModifiedDocuments = $config->variable('showLastModifiedDocuments', 'false');
			$page = new ConfigTab($configEditor, i18n('ADMS'), 'adms');
			new CheckboxConfigOption($page, 'appendGoogleResults', $appendGoogleResults, i18n('Append Google Search Results.'),
			                         i18n('If you check this option, any search you do will be forwarded to Google and results from Google will be appended to your regular results.'));
			new CheckboxConfigOption($page, 'showEmptyFolders', $showEmptyFolders, i18n('Show empty folders.'),
			                         i18n('Uncheck this option if you want empty folders to be hidden.'));
			new CheckboxConfigOption($page, 'showLastAddedDocuments', $showLastAddedDocuments, i18n('Show last added documents.'),
			                         i18n('Uncheck this option if you don\'t want to see the last added documents overview.'));
			new CheckboxConfigOption($page, 'showLastModifiedDocuments', $showLastModifiedDocuments, i18n('Show last modified documents.'),
			                         i18n('Check this option if you want to see the last modified documents overview.'));
		}
		else
		{
			$view = new View($viewContainer);
			new ADMS_Application($view, $submenu);
		}
	}

	public function showGUI()
	{
		$this->mainWindow->show();
	}

	private $mainWindow;
}

?>
Return current item: Aukyla Document Management System