Location: PHPKode > projects > HelpCORE > helpcore/module_helpcore_secure/maint_text_templates.php
<?php

/*
 * HelpCORE source file 
 * ====================
 * 
 * CVS:
 * ----
 * $header$
 * 
 * Purpose:
 * --------
 * Manages maintainance text templates
 * 
 * Copyright:
 * ----------
 * Copyright (C) 2002-2003 Dennis Fleurbaaij <hide@address.com>
 * Copyright (C) 2002-2005 IO Software <hide@address.com>
 * 
 * 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., 675 Mass Ave, 
 * Cambridge, MA 02139, USA.
 * 
 * Please note that this software is dual licensed. For the commercial use of this 
 * software you will need a Commercial License. Please see http://www.io-software.nl
 * for the terms and conditions.
 * 
 * For more information you can contact IO Software at http://www.io-software.nl
 */ 

if (! include('../coreapm/coreapm.php')) {
    die('Cannot include CORE APM');
} 
$GLOBALS['security']->secure();
$coreapm->start();

if( ! ( O_MAINT_USETEMPLATES || USE_MAINTAINANCE ) ) {
    $GLOBALS['box']->add( text('warning'), text('administrator_disabled') );
    $coreapm->finish();
    die;
}


$limits = null;
if (! $GLOBALS['security']->is_admin) {
    $limits = NO_ADD | NO_EDIT | NO_DELETE;
} 


if( isset( $_GET['insert'] ) ) {

	/**
	 * Callback function to change the value of the insert column to allow the usage of this text in maintanance
	 */
	function insert( $value, &$row ) {
    	return '<a href="JavaScript:window.opener.document.hardware.hardwaremaint_text.value=\''.str_replace( "\n", '\n', stripslashes( $row['description'] ) ).'\';window.close();">'.text('use_this').'</a>';
	}

	
	$GLOBALS['relational']->add_table_column( '', text('insert'), NOT_IN_TABLE | INLINE_FUNCTION('insert'));
}

$GLOBALS['relational']->add_table_column('name', 		text('name'), 		TYPE_STRING(255) | REL_OBLIGATORY);
$GLOBALS['relational']->add_table_column('description',		text('description'), 	TYPE_TEXT(2000) | REL_OBLIGATORY | VIS_NO_INDEX| VIS_NO_SEARCH);
$GLOBALS['relational']->add_table_column('hardware_type_id',	text('hardware_type'), 	TYPE_JOIN('hardware_types', 'name'));
$GLOBALS['relational']->manage('maint_text_templates', text('maint_text_templates'), $limits);

$coreapm->finish();

?>
Return current item: HelpCORE