Commit 43c3b6f6 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Move data to its appropriate implementation file.

These files need to be rewritten/adapted for web2Project
parent a586b2c5
<?php
/* Backup database module for web2Project
* based on backup database module for dotProject
*
* Copyright (C) 2015, M2X BV
*
* Authors: Jean-Paul Saman
*
* 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
// Create new backup class
$backup_id = (int)w2PgetParam($_GET, "backup_id", 0);
// Backup object
$backup = new CBackup();
$backup->backup_id = $backup_id;
// we check for permissions on this module
$perms = $AppUI->acl();
if (!$perms->checkModuleItem('backup', 'access')) {
$AppUI->redirect(ACCESS_DENIED);
}
$canView = $perms->checkModule( $m, 'view' );
$canEdit = $perms->checkModule( $m, 'edit' );
$canDelete = $perms->checkModule( $m, 'delete' );
if (!$canEdit || !$canView) {
$AppUI->redirect(ACCESS_DENIED);
}
// Load object
$backup->load(null, $backup_id);
if (!$backup && $backup_id > 0) {
$AppUI->setMsg('Backup');
$AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
$AppUI->redirect(); // go back to the calling location
}
// setup the title block
// Fill the title block either with 'Edit' or with 'New' depending on
// if backup_id has been transmitted via GET or is empty
$ttl = ( $backup_id > 0 ) ? "Restore" : "Backup";
$titleBlock = new w2p_Theme_TitleBlock( $ttl, 'company.gif', $m, '$m' . '.' . '$a' );
$titleBlock->addCrumb( "?m=backup", "view all backup" );
if ($canDelete && ($timesheet_id > 0) ) {
$titleBlock->addCrumbDelete( 'delete backup', $canDelete, $msg );
}
$titleBlock->show();
?>
<script language="javascript" type="text/javascript">
function check_backup_options()
{
var f = document.frmBackup;
if(f.export_what.options[f.export_what.selectedIndex].value == 'data')
{
f.droptable.enabled=false;
f.droptable.checked=false;
}
else
{
f.droptable.enabled=true;
}
}
</script>
<table cellspacing="0" cellpadding="4" border="0" width="100%" class="std">
<form onclick="check_backup_options()" name="frmBackup" action="<?php echo "$baseUrl/index.php?m=backup&a=do_backup&suppressHeaders=1"; ?>" method="post">
<tr>
<td align="right" valign="top" nowrap="nowrap">
<?php echo $AppUI->_('Export'); ?>
</td>
<td width="100%" nowrap="nowrap">
<select name="export_what" class="text" >
<option value="all" checked="checked"><?php echo $AppUI->_('Table structure and data'); ?></option>
<option value="table"><?php echo $AppUI->_('Only table structure'); ?></option>
<option value="data"><?php echo $AppUI->_('Only data'); ?></option>
</select>
</td>
</tr>
<tr>
<td align="right" valign="top" nowrap="nowrap"><?php echo $AppUI->_('Options'); ?></td>
<td width="100%" nowrap="nowrap">
<input type="checkbox" name="droptable" value="1" checked="checked" /><?php echo $AppUI->_("Add 'DROP TABLE' to output-script"); ?><br />
</td>
</tr>
<tr>
<td align="right" valign="top" nowrap="nowrap"><?php echo $AppUI->_('Save as'); ?></td>
<td width="100%" nowrap="nowrap">
<select name="output_format" class="text" >
<option value="zip" checked="checked"><?php echo $AppUI->_('Compressed ZIP SQL file', UI_OUTPUT_RAW); ?></option>
<option value="sql"><?php echo $AppUI->_('Plain text SQL file', UI_OUTPUT_RAW); ?></option>
<option value="xml"><?php echo $AppUI->_('XML file', UI_OUTPUT_RAW); ?></option>
</select>
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
<td align="right">
<input type="submit" value="<?php echo $AppUI->_('Download backup'); ?>" class="button"/>
</td>
</tr>
</form>
</table>
<?php <?php
/* /*
* Copyright (C) 2015, M2X * Copyright (C) 2015, M2X BV
* *
* Authors: Jean-Paul Saman * Authors: Jean-Paul Saman
* *
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
// Completely reworked the backup system to use ADODB primitives. // Completely reworked the backup system to use ADODB primitives.
// Added localisation code so that it can be translated. // Added localisation code so that it can be translated.
// Backup database module for web2Project
// Copyright (C) 2015, M2X BV
// Jean-Paul Saman
$perms = &$AppUI->acl(); $perms = &$AppUI->acl();
if (!$perms->checkModuleItem('backup', 'access')) { if (!$perms->checkModuleItem('backup', 'access')) {
$AppUI->redirect(ACCESS_DENIED); $AppUI->redirect(ACCESS_DENIED);
...@@ -42,70 +46,9 @@ $title->show(); ...@@ -42,70 +46,9 @@ $title->show();
// now prepare and show the tabbed information boxes // now prepare and show the tabbed information boxes
// The Period default for the timesheets (month,week)
// $period = $AppUI->getPref('TIMESHEET_PERIOD');
// build new tab box object // build new tab box object
$tabBox = new CTabBox( "?m=$m", W2P_BASE_DIR . "/modules/$m/", $tab ); $tabBox = new CTabBox( "?m=$m", W2P_BASE_DIR . "/modules/$m/", $tab );
$tabBox->add( 'vw_idx_backup', 'All backup' ); $tabBox->add( 'vw_backup', 'Backups' );
$tabBox->add( 'vw_restore', "Restore' );
$tabBox->show(); $tabBox->show();
// FIXME: the below should be rewritten to match web2Project
?> ?>
<script>
function check_backup_options()
{
var f = document.frmBackup;
if(f.export_what.options[f.export_what.selectedIndex].value == 'data')
{
f.droptable.enabled=false;
f.droptable.checked=false;
}
else
{
f.droptable.enabled=true;
}
}
</script>
<table cellspacing="0" cellpadding="4" border="0" width="100%" class="std">
<form onclick="check_backup_options()" name="frmBackup" action="<?php echo "$baseUrl/index.php?m=backup&a=do_backup&suppressHeaders=1"; ?>" method="post">
<tr>
<td align="right" valign="top" nowrap="nowrap">
<?php echo $AppUI->_('Export'); ?>
</td>
<td width="100%" nowrap="nowrap">
<select name="export_what" class="text" >
<option value="all" checked="checked"><?php echo $AppUI->_('Table structure and data'); ?></option>
<option value="table"><?php echo $AppUI->_('Only table structure'); ?></option>
<option value="data"><?php echo $AppUI->_('Only data'); ?></option>
</select>
</td>
</tr>
<tr>
<td align="right" valign="top" nowrap="nowrap"><?php echo $AppUI->_('Options'); ?></td>
<td width="100%" nowrap="nowrap">
<input type="checkbox" name="droptable" value="1" checked="checked" /><?php echo $AppUI->_("Add 'DROP TABLE' to output-script"); ?><br />
</td>
</tr>
<tr>
<td align="right" valign="top" nowrap="nowrap"><?php echo $AppUI->_('Save as'); ?></td>
<td width="100%" nowrap="nowrap">
<select name="output_format" class="text" >
<option value="zip" checked="checked"><?php echo $AppUI->_('Compressed ZIP SQL file', UI_OUTPUT_RAW); ?></option>
<option value="sql"><?php echo $AppUI->_('Plain text SQL file', UI_OUTPUT_RAW); ?></option>
<option value="xml"><?php echo $AppUI->_('XML file', UI_OUTPUT_RAW); ?></option>
</select>
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
<td align="right">
<input type="submit" value="<?php echo $AppUI->_('Download backup'); ?>" class="button"/>
</td>
</tr>
</form>
</table>
...@@ -14,6 +14,7 @@ $AppUI->savePlace(); ...@@ -14,6 +14,7 @@ $AppUI->savePlace();
$titleBlock = new CTitleBlock('Restore Database', 'companies.gif', $m, $m.'.'.$a); $titleBlock = new CTitleBlock('Restore Database', 'companies.gif', $m, $m.'.'.$a);
$titleBlock->show(); $titleBlock->show();
?> ?>
<form name="frmRestore" enctype="multipart/form-data" action="<?php echo "$baseUrl/index.php?m=backup&a=do_restore"; ?>" method="post"> <form name="frmRestore" enctype="multipart/form-data" action="<?php echo "$baseUrl/index.php?m=backup&a=do_restore"; ?>" method="post">
<div align="center"> <div align="center">
<table cellspacing="0" cellpadding="4" border="0" width="80%" class="std"> <table cellspacing="0" cellpadding="4" border="0" width="80%" class="std">
......
<?php
/* Backup database module for web2Project
* based on backup database module for dotProject
*
* Copyright (C) 2015, M2X
*
* Authors: Jean-Paul Saman
*
* 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
?>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment