add save and delete actions for Storage

This commit is contained in:
Isaac Connor 2015-12-15 11:12:33 -05:00
parent c07c63cde6
commit 9ffbaabde5
1 changed files with 52 additions and 22 deletions

View File

@ -767,7 +767,8 @@ if ( !empty($action) )
// System edit actions // System edit actions
if ( canEdit( 'System' ) ) if ( canEdit( 'System' ) )
{ {
if ( isset( $_REQUEST['object'] ) and ( $_REQUEST['object'] == 'server' ) ) { if ( isset( $_REQUEST['object'] ) ) {
if ( $_REQUEST['object'] == 'server' ) {
if ( $action == "Save" ) { if ( $action == "Save" ) {
if ( !empty($_REQUEST['id']) ) if ( !empty($_REQUEST['id']) )
@ -796,6 +797,35 @@ if ( !empty($action) )
} else { } else {
Error( "Unknown action $action in saving Server" ); Error( "Unknown action $action in saving Server" );
} }
} else if ( $_REQUEST['object'] == 'storage' ) {
if ( $action == "Save" ) {
if ( !empty($_REQUEST['id']) )
$dbStorage = dbFetchOne( "SELECT * FROM Storage WHERE Id=?", NULL, array($_REQUEST['id']) );
else
$dbStorage = array();
$types = array();
$changes = getFormChanges( $dbServer, $_REQUEST['newStorage'], $types );
if ( count( $changes ) ) {
if ( !empty($_REQUEST['id']) ) {
dbQuery( "UPDATE Storage SET ".implode( ", ", $changes )." WHERE Id = ?", array($_REQUEST['id']) );
} else {
dbQuery( "INSERT INTO Storage set ".implode( ", ", $changes ) );
}
$refreshParent = true;
}
$view = 'none';
} else if ( $action == 'delete' ) {
if ( !empty($_REQUEST['markIds']) ) {
foreach( $_REQUEST['markIds'] as $Id )
dbQuery( "DELETE FROM Storage WHERE Id=?", array($Id) );
}
$refreshParent = true;
} else {
Error( "Unknown action $action in saving Storage" );
}
} # end if isset($_REQUEST['object'] )
} else if ( $action == "version" && isset($_REQUEST['option']) ) } else if ( $action == "version" && isset($_REQUEST['option']) )
{ {