Location: PHPKode > projects > Aukyla Document Management System > plugins/DocumentHandlers/text_x_uri_DocumentHandler.php
     text_x_uri_DocumentHandler.php, handler for links
     Copyright (C) 2004 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


class text_x_uri_DocumentHandler extends DocumentHandler
	public static function view(Container $parent, $uri)
		$contents = trim(URI::fileGetContents($uri));

		new Paragraph($parent, i18n('You are being redirected to an external page. If nothing happens, please click the following link:'));
		$link = new Link($parent, $contents);
		new JavaScript($parent, "setTimeout('window.location=\"$contents\";', 250);");

	public static function supportsEditing()
		return true;

	public static function edit(Container $parent, $id, $uri)
		$text = trim($uri == '' ? '' : URI::fileGetContents($uri));

		$textInput = new TextInput($parent, $id);
		$textInput->setText(i18n('Link: '));

	public static function save($id, $uri)
		return Document::save($id, $uri, 'text/plain');

Return current item: Aukyla Document Management System