Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support nested Actions (Admin/CreditCards Application)

  • Loading branch information...
commit 8b3d1d3fefddcc7b5f0846cd47af7d041e57dcba 1 parent b2bcfe5
@haraldpdl haraldpdl authored committed
View
22 osCommerce/OM/Core/Site/Admin/Application/CreditCards/Action/BatchDelete.php
@@ -11,33 +11,11 @@
namespace osCommerce\OM\Core\Site\Admin\Application\CreditCards\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\CreditCards\CreditCards;
- use osCommerce\OM\Core\Registry;
- use osCommerce\OM\Core\OSCOM;
class BatchDelete {
public static function execute(ApplicationAbstract $application) {
if ( isset($_POST['batch']) && is_array($_POST['batch']) && !empty($_POST['batch']) ) {
$application->setPageContent('batch_delete.php');
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- $error = false;
-
- foreach ( $_POST['batch'] as $id ) {
- if ( !CreditCards::delete($id) ) {
- $error = true;
- break;
- }
- }
-
- if ( $error === false ) {
- Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success');
- } else {
- Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error');
- }
-
- osc_redirect_admin(OSCOM::getLink());
- }
}
}
}
View
38 osCommerce/OM/Core/Site/Admin/Application/CreditCards/Action/BatchDelete/Process.php
@@ -0,0 +1,38 @@
+<?php
+/*
+ osCommerce Online Merchant $osCommerce-SIG$
+ Copyright (c) 2010 osCommerce (http://www.oscommerce.com)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License v2 (1991)
+ as published by the Free Software Foundation.
+*/
+
+ namespace osCommerce\OM\Core\Site\Admin\Application\CreditCards\Action\BatchDelete;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\CreditCards\CreditCards;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ $error = false;
+
+ foreach ( $_POST['batch'] as $id ) {
+ if ( !CreditCards::delete($id) ) {
+ $error = true;
+ break;
+ }
+ }
+
+ if ( $error === false ) {
+ Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success');
+ } else {
+ Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error');
+ }
+
+ osc_redirect_admin(OSCOM::getLink());
+ }
+ }
+?>
View
22 osCommerce/OM/Core/Site/Admin/Application/CreditCards/Action/BatchSave.php
@@ -11,33 +11,11 @@
namespace osCommerce\OM\Core\Site\Admin\Application\CreditCards\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\CreditCards\CreditCards;
- use osCommerce\OM\Core\Registry;
- use osCommerce\OM\Core\OSCOM;
class BatchSave {
public static function execute(ApplicationAbstract $application) {
if ( isset($_POST['batch']) && is_array($_POST['batch']) && !empty($_POST['batch']) ) {
$application->setPageContent('batch_edit.php');
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- $error = false;
-
- foreach ( $_POST['batch'] as $id ) {
- if ( !CreditCards::setStatus($id, (($_POST['type'] == 'activate') ? true : false)) ) {
- $error = true;
- break;
- }
- }
-
- if ( $error === false ) {
- Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success');
- } else {
- Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error');
- }
-
- osc_redirect_admin(OSCOM::getLink());
- }
}
}
}
View
38 osCommerce/OM/Core/Site/Admin/Application/CreditCards/Action/BatchSave/Process.php
@@ -0,0 +1,38 @@
+<?php
+/*
+ osCommerce Online Merchant $osCommerce-SIG$
+ Copyright (c) 2010 osCommerce (http://www.oscommerce.com)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License v2 (1991)
+ as published by the Free Software Foundation.
+*/
+
+ namespace osCommerce\OM\Core\Site\Admin\Application\CreditCards\Action\BatchSave;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\CreditCards\CreditCards;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ $error = false;
+
+ foreach ( $_POST['batch'] as $id ) {
+ if ( !CreditCards::setStatus($id, (($_POST['type'] == 'activate') ? true : false)) ) {
+ $error = true;
+ break;
+ }
+ }
+
+ if ( $error === false ) {
+ Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success');
+ } else {
+ Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error');
+ }
+
+ osc_redirect_admin(OSCOM::getLink());
+ }
+ }
+?>
View
13 osCommerce/OM/Core/Site/Admin/Application/CreditCards/Action/Delete.php
@@ -11,23 +11,10 @@
namespace osCommerce\OM\Core\Site\Admin\Application\CreditCards\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\CreditCards\CreditCards;
- use osCommerce\OM\Core\Registry;
- use osCommerce\OM\Core\OSCOM;
class Delete {
public static function execute(ApplicationAbstract $application) {
$application->setPageContent('delete.php');
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- if ( CreditCards::delete($_GET['id']) ) {
- Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success');
- } else {
- Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error');
- }
-
- osc_redirect_admin(OSCOM::getLink());
- }
}
}
?>
View
29 osCommerce/OM/Core/Site/Admin/Application/CreditCards/Action/Delete/Process.php
@@ -0,0 +1,29 @@
+<?php
+/*
+ osCommerce Online Merchant $osCommerce-SIG$
+ Copyright (c) 2010 osCommerce (http://www.oscommerce.com)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License v2 (1991)
+ as published by the Free Software Foundation.
+*/
+
+ namespace osCommerce\OM\Core\Site\Admin\Application\CreditCards\Action\Delete;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\CreditCards\CreditCards;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ if ( CreditCards::delete($_GET['id']) ) {
+ Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success');
+ } else {
+ Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error');
+ }
+
+ osc_redirect_admin(OSCOM::getLink());
+ }
+ }
+?>
View
18 osCommerce/OM/Core/Site/Admin/Application/CreditCards/Action/Save.php
@@ -11,9 +11,6 @@
namespace osCommerce\OM\Core\Site\Admin\Application\CreditCards\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\CreditCards\CreditCards;
- use osCommerce\OM\Core\Registry;
- use osCommerce\OM\Core\OSCOM;
class Save {
public static function execute(ApplicationAbstract $application) {
@@ -22,21 +19,6 @@ public static function execute(ApplicationAbstract $application) {
} else {
$application->setPageContent('new.php');
}
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- $data = array('name' => $_POST['credit_card_name'],
- 'pattern' => $_POST['pattern'],
- 'status' => (isset($_POST['credit_card_status']) && ($_POST['credit_card_status'] == '1') ? 1 : 0),
- 'sort_order' => $_POST['sort_order']);
-
- if ( CreditCards::save((isset($_GET['id']) && is_numeric($_GET['id']) ? $_GET['id'] : null), $data) ) {
- Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success');
- } else {
- Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error');
- }
-
- osc_redirect_admin(OSCOM::getLink());
- }
}
}
?>
View
34 osCommerce/OM/Core/Site/Admin/Application/CreditCards/Action/Save/Process.php
@@ -0,0 +1,34 @@
+<?php
+/*
+ osCommerce Online Merchant $osCommerce-SIG$
+ Copyright (c) 2010 osCommerce (http://www.oscommerce.com)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License v2 (1991)
+ as published by the Free Software Foundation.
+*/
+
+ namespace osCommerce\OM\Core\Site\Admin\Application\CreditCards\Action\Save;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\CreditCards\CreditCards;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ $data = array('name' => $_POST['credit_card_name'],
+ 'pattern' => $_POST['pattern'],
+ 'status' => (isset($_POST['credit_card_status']) && ($_POST['credit_card_status'] == '1') ? 1 : 0),
+ 'sort_order' => $_POST['sort_order']);
+
+ if ( CreditCards::save((isset($_GET['id']) && is_numeric($_GET['id']) ? $_GET['id'] : null), $data) ) {
+ Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success');
+ } else {
+ Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error');
+ }
+
+ osc_redirect_admin(OSCOM::getLink());
+ }
+ }
+?>
View
4 osCommerce/OM/Core/Site/Admin/Application/CreditCards/pages/batch_delete.php
@@ -22,7 +22,7 @@
<div class="infoBox">
<h3><?php echo osc_icon('trash.png') . ' ' . OSCOM::getDef('action_heading_batch_delete_cards'); ?></h3>
- <form name="ccDeleteBatch" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'action=BatchDelete'); ?>" method="post">
+ <form name="ccDeleteBatch" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'BatchDelete&Process'); ?>" method="post">
<p><?php echo OSCOM::getDef('introduction_batch_delete_cards'); ?></p>
@@ -44,7 +44,7 @@
echo '<p>' . $names_string . '</p>';
?>
- <p><?php echo osc_draw_hidden_field('subaction', 'confirm') . osc_draw_button(array('priority' => 'primary', 'icon' => 'trash', 'title' => OSCOM::getDef('button_delete'))) . ' ' . osc_draw_button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
+ <p><?php echo osc_draw_button(array('priority' => 'primary', 'icon' => 'trash', 'title' => OSCOM::getDef('button_delete'))) . ' ' . osc_draw_button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
</form>
</div>
View
4 osCommerce/OM/Core/Site/Admin/Application/CreditCards/pages/batch_edit.php
@@ -22,7 +22,7 @@
<div class="infoBox">
<h3><?php echo osc_icon('edit.png') . ' ' . OSCOM::getDef('action_heading_batch_edit_cards'); ?></h3>
- <form name="ccEditBatch" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'action=BatchSave'); ?>" method="post">
+ <form name="ccEditBatch" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'BatchSave&Process'); ?>" method="post">
<p><?php echo OSCOM::getDef('introduction_batch_edit_cards'); ?></p>
@@ -46,7 +46,7 @@
echo '<p>' . osc_draw_radio_field('type', array(array('id' => 'activate', 'text' => OSCOM::getDef('activate')), array('id' => 'deactivate', 'text' => OSCOM::getDef('deactivate'))), 'activate') . '</p>';
?>
- <p><?php echo osc_draw_hidden_field('subaction', 'confirm') . osc_draw_button(array('priority' => 'primary', 'icon' => 'check', 'title' => OSCOM::getDef('button_save'))) . ' ' . osc_draw_button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
+ <p><?php echo osc_draw_button(array('priority' => 'primary', 'icon' => 'check', 'title' => OSCOM::getDef('button_save'))) . ' ' . osc_draw_button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
</form>
</div>
View
4 osCommerce/OM/Core/Site/Admin/Application/CreditCards/pages/delete.php
@@ -26,13 +26,13 @@
<div class="infoBox">
<h3><?php echo osc_icon('trash.png') . ' ' . $OSCOM_ObjectInfo->getProtected('credit_card_name'); ?></h3>
- <form name="aDelete" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'id=' . $OSCOM_ObjectInfo->getInt('id') . '&action=Delete'); ?>" method="post">
+ <form name="aDelete" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'Delete&Process&id=' . $OSCOM_ObjectInfo->getInt('id')); ?>" method="post">
<p><?php echo OSCOM::getDef('introduction_delete_card'); ?></p>
<p><?php echo '<b>' . $OSCOM_ObjectInfo->getProtected('credit_card_name') . '</b>'; ?></p>
- <p><?php echo osc_draw_hidden_field('subaction', 'confirm') . osc_draw_button(array('priority' => 'primary', 'icon' => 'trash', 'title' => OSCOM::getDef('button_delete'))) . ' ' . osc_draw_button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
+ <p><?php echo osc_draw_button(array('priority' => 'primary', 'icon' => 'trash', 'title' => OSCOM::getDef('button_delete'))) . ' ' . osc_draw_button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
</form>
</div>
View
4 osCommerce/OM/Core/Site/Admin/Application/CreditCards/pages/edit.php
@@ -26,7 +26,7 @@
<div class="infoBox">
<h3><?php echo osc_icon('edit.png') . ' ' . $OSCOM_ObjectInfo->getProtected('credit_card_name'); ?></h3>
- <form name="ccEdit" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'id=' . $OSCOM_ObjectInfo->getInt('id') . '&action=Save'); ?>" method="post">
+ <form name="ccEdit" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'Save&Process&id=' . $OSCOM_ObjectInfo->getInt('id')); ?>" method="post">
<p><?php echo OSCOM::getDef('introduction_edit_card'); ?></p>
@@ -37,7 +37,7 @@
<p><label for="credit_card_status"><?php echo OSCOM::getDef('field_status'); ?></label><?php echo osc_draw_checkbox_field('credit_card_status', '1', $OSCOM_ObjectInfo->get('credit_card_status')); ?></p>
</fieldset>
- <p><?php echo osc_draw_hidden_field('subaction', 'confirm') . osc_draw_button(array('priority' => 'primary', 'icon' => 'check', 'title' => OSCOM::getDef('button_save'))) . ' ' . osc_draw_button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
+ <p><?php echo osc_draw_button(array('priority' => 'primary', 'icon' => 'check', 'title' => OSCOM::getDef('button_save'))) . ' ' . osc_draw_button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
</form>
</div>
View
8 osCommerce/OM/Core/Site/Admin/Application/CreditCards/pages/main.php
@@ -22,7 +22,7 @@
<form id="liveSearchForm">
<input type="text" id="liveSearchField" name="search" class="searchField fieldTitleAsDefault" title="Search.." /><?php echo osc_draw_button(array('type' => 'button', 'params' => 'onclick="osC_DataTable.reset();"', 'title' => 'Reset')); ?>
- <span style="float: right;"><?php echo osc_draw_button(array('href' => OSCOM::getLink(null, null, 'action=Save'), 'icon' => 'plus', 'title' => OSCOM::getDef('button_insert'))); ?></span>
+ <span style="float: right;"><?php echo osc_draw_button(array('href' => OSCOM::getLink(null, null, 'Save'), 'icon' => 'plus', 'title' => OSCOM::getDef('button_insert'))); ?></span>
</form>
<div style="padding: 20px 5px 5px 5px; height: 16px;">
@@ -43,7 +43,7 @@
</thead>
<tfoot>
<tr>
- <th align="right" colspan="3"><?php echo '<input type="image" src="' . osc_icon_raw('edit.png') . '" title="' . OSCOM::getDef('icon_edit') . '" onclick="document.batch.action=\'' . OSCOM::getLink(null, null, 'action=BatchSave') . '\';" />&nbsp;<input type="image" src="' . osc_icon_raw('trash.png') . '" title="' . OSCOM::getDef('icon_trash') . '" onclick="document.batch.action=\'' . OSCOM::getLink(null, null, 'action=BatchDelete') . '\';" />'; ?></th>
+ <th align="right" colspan="3"><?php echo '<input type="image" src="' . osc_icon_raw('edit.png') . '" title="' . OSCOM::getDef('icon_edit') . '" onclick="document.batch.action=\'' . OSCOM::getLink(null, null, 'BatchSave') . '\';" />&nbsp;<input type="image" src="' . osc_icon_raw('trash.png') . '" title="' . OSCOM::getDef('icon_trash') . '" onclick="document.batch.action=\'' . OSCOM::getLink(null, null, 'BatchDelete') . '\';" />'; ?></th>
<th align="center" width="20"><?php echo osc_draw_checkbox_field('batchFlag', null, null, 'onclick="flagCheckboxes(this);"'); ?></th>
</tr>
</tfoot>
@@ -74,10 +74,10 @@
var dataTableName = 'ccDataTable';
var dataTableDataURL = '<?php echo OSCOM::getRPCLink(null, null, 'action=getAll'); ?>';
- var ccEditLink = '<?php echo OSCOM::getLink(null, null, 'id=CCID&action=Save'); ?>';
+ var ccEditLink = '<?php echo OSCOM::getLink(null, null, 'Save&id=CCID'); ?>';
var ccEditLinkIcon = '<?php echo osc_icon('edit.png'); ?>';
- var ccDeleteLink = '<?php echo OSCOM::getLink(null, null, 'id=CCID&action=Delete'); ?>';
+ var ccDeleteLink = '<?php echo OSCOM::getLink(null, null, 'Delete&id=CCID'); ?>';
var ccDeleteLinkIcon = '<?php echo osc_icon('trash.png'); ?>';
var osC_DataTable = new osC_DataTable();
View
4 osCommerce/OM/Core/Site/Admin/Application/CreditCards/pages/new.php
@@ -22,7 +22,7 @@
<div class="infoBox">
<h3><?php echo osc_icon('new.png') . ' ' . OSCOM::getDef('action_heading_new_card'); ?></h3>
- <form name="ccNew" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'action=Save'); ?>" method="post">
+ <form name="ccNew" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'Save&Process'); ?>" method="post">
<p><?php echo OSCOM::getDef('introduction_new_card'); ?></p>
@@ -33,7 +33,7 @@
<p><label for="credit_card_status"><?php echo OSCOM::getDef('field_status'); ?></label><?php echo osc_draw_checkbox_field('credit_card_status', '1'); ?></p>
</fieldset>
- <p><?php echo osc_draw_hidden_field('subaction', 'confirm') . osc_draw_button(array('priority' => 'primary', 'icon' => 'check', 'title' => OSCOM::getDef('button_save'))) . ' ' . osc_draw_button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
+ <p><?php echo osc_draw_button(array('priority' => 'primary', 'icon' => 'check', 'title' => OSCOM::getDef('button_save'))) . ' ' . osc_draw_button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
</form>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.