<?php
/*
* HelpCORE source file
* ====================
*
* CVS:
* ----
* $header$
*
* Purpose:
* --------
* Software callbacks
*
* 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
*/
// Only load if CoreAPM is loaded
if( ! isset( $GLOBALS['coreapm'] ) ) {
die( __FILE__ . '('.__LINE__.'): CoreAPM not set' );
}
/**
* Callback function for CoreAPM to delete all related data when deleting software
*/
function software_post_delete( $table_name, $id, &$message )
{
include( 'knowledge_base_functions.php' );
kb_parent_delete( 'software', $id );
$GLOBALS['db']->query( 'DELETE FROM users_software WHERE software_id=' . $id );
$GLOBALS['db']->query( 'DELETE FROM hardware_software WHERE software_id=' . $id );
$GLOBALS['db']->query( 'DELETE FROM allowed_software_users WHERE software_id='.$id );
$GLOBALS['db']->query( 'DELETE FROM allowed_software_organisation WHERE software_id='.$id );
$GLOBALS['db']->query( 'DELETE FROM allowed_software_buildings WHERE software_id='.$id );
$GLOBALS['db']->query( 'DELETE FROM allowed_software_rooms WHERE software_id='.$id );
$GLOBALS['db']->query( 'DELETE FROM allowed_software_departments WHERE software_id='.$id );
$GLOBALS['db']->query( 'DELETE FROM allowed_software_groups WHERE software_id='.$id );
$GLOBALS['db']->query( 'DELETE FROM allowed_software_hardware WHERE software_id='.$id );
$GLOBALS['db']->query( 'DELETE FROM allowed_software_config WHERE software_id='.$id );
$GLOBALS['db']->query( 'DELETE FROM software_to_image WHERE software_id='.$id );
return true;
}
$GLOBALS['coreapm']->plugin_register_relational_callback( 'software', 'post_delete', 'software_post_delete' );
/**
* Callback function for CoreAPM to edit all related data when editing software
*/
function software_post_edit( $table_name, $id )
{
include_once( 'device_software_handler.php' );
software_allowed_overview( $id, true );
$GLOBALS['tabs']->addDataPanel( text( 'software_by_user' ), nm_software_users( $id ) );
$GLOBALS['tabs']->addDataPanel( text( 'software_by_hardware' ), nm_software_hardware( $id ) );
include( 'knowledge_base_functions.php' );
kb_handler( 'software', $id, true );
}
$GLOBALS['coreapm']->plugin_register_relational_callback( 'software', 'post_edit', 'software_post_edit' );
/**
* Callback function for CoreAPM to show all related data when showing software
*/
function software_post_show( $table_name, $id )
{
include_once( 'device_software_handler.php' );
software_allowed_overview( $id, false );
nm_software_users( $id );
nm_software_hardware( $id );
include( 'knowledge_base_functions.php' );
kb_handler( 'software', $id, false );
}
$GLOBALS['coreapm']->plugin_register_relational_callback( 'software', 'post_show', 'software_post_show' );
?>