Skip to content
Browse files

Support nested Actions (Admin/Currencies Application)

  • Loading branch information...
1 parent 8b3d1d3 commit 7f15067aa73ea43faf1932d6637008436090ad02 @haraldpdl haraldpdl committed with Jul 30, 2010
View
22 osCommerce/OM/Core/Site/Admin/Application/Currencies/Action/BatchDelete.php
@@ -11,33 +11,11 @@
namespace osCommerce\OM\Core\Site\Admin\Application\Currencies\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\Currencies\Currencies;
- 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 ( !Currencies::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/Currencies/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\Currencies\Action\BatchDelete;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\Currencies\Currencies;
+ 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 ( !Currencies::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
13 osCommerce/OM/Core/Site/Admin/Application/Currencies/Action/Delete.php
@@ -11,23 +11,10 @@
namespace osCommerce\OM\Core\Site\Admin\Application\Currencies\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\Currencies\Currencies;
- 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 ( Currencies::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/Currencies/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\Currencies\Action\Delete;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\Currencies\Currencies;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ if ( Currencies::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
20 osCommerce/OM/Core/Site/Admin/Application/Currencies/Action/Save.php
@@ -11,9 +11,6 @@
namespace osCommerce\OM\Core\Site\Admin\Application\Currencies\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\Currencies\Currencies;
- use osCommerce\OM\Core\Registry;
- use osCommerce\OM\Core\OSCOM;
class Save {
public static function execute(ApplicationAbstract $application) {
@@ -22,23 +19,6 @@ public static function execute(ApplicationAbstract $application) {
} else {
$application->setPageContent('new.php');
}
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- $data = array('title' => $_POST['title'],
- 'code' => $_POST['code'],
- 'symbol_left' => $_POST['symbol_left'],
- 'symbol_right' => $_POST['symbol_right'],
- 'decimal_places' => $_POST['decimal_places'],
- 'value' => $_POST['value']);
-
- if ( Currencies::save((isset($_GET['id']) && is_numeric($_GET['id']) ? $_GET['id'] : null), $data, ((isset($_POST['default']) && ($_POST['default'] == 'on')) || (isset($_POST['is_default']) && ($_POST['is_default'] == 'true') && ($_POST['code'] != DEFAULT_CURRENCY)))) ) {
- 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
36 osCommerce/OM/Core/Site/Admin/Application/Currencies/Action/Save/Process.php
@@ -0,0 +1,36 @@
+<?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\Currencies\Action\Save;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\Currencies\Currencies;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ $data = array('title' => $_POST['title'],
+ 'code' => $_POST['code'],
+ 'symbol_left' => $_POST['symbol_left'],
+ 'symbol_right' => $_POST['symbol_right'],
+ 'decimal_places' => $_POST['decimal_places'],
+ 'value' => $_POST['value']);
+
+ if ( Currencies::save((isset($_GET['id']) && is_numeric($_GET['id']) ? $_GET['id'] : null), $data, ((isset($_POST['default']) && ($_POST['default'] == 'on')) || (isset($_POST['is_default']) && ($_POST['is_default'] == 'true') && ($_POST['code'] != DEFAULT_CURRENCY)))) ) {
+ 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
19 osCommerce/OM/Core/Site/Admin/Application/Currencies/Action/UpdateRates.php
@@ -11,29 +11,10 @@
namespace osCommerce\OM\Core\Site\Admin\Application\Currencies\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\Currencies\Currencies;
- use osCommerce\OM\Core\Registry;
- use osCommerce\OM\Core\OSCOM;
class UpdateRates {
public static function execute(ApplicationAbstract $application) {
$application->setPageContent('update_rates.php');
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- if ( isset($_POST['service']) && (($_POST['service'] == 'oanda') || ($_POST['service'] == 'xe')) ) {
- $results = Currencies::updateRates($_POST['service']);
-
- foreach ( $results[0] as $result ) {
- Registry::get('MessageStack')->add(null, sprintf(OSCOM::getDef('ms_error_invalid_currency'), $result['title'], $result['code']), 'error');
- }
-
- foreach ( $results[1] as $result ) {
- Registry::get('MessageStack')->add(null, sprintf(OSCOM::getDef('ms_success_currency_updated'), $result['title'], $result['code']), 'success');
- }
- }
-
- osc_redirect_admin(OSCOM::getLink());
- }
}
}
?>
View
35 osCommerce/OM/Core/Site/Admin/Application/Currencies/Action/UpdateRates/Process.php
@@ -0,0 +1,35 @@
+<?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\Currencies\Action\UpdateRates;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\Currencies\Currencies;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ if ( isset($_POST['service']) && (($_POST['service'] == 'oanda') || ($_POST['service'] == 'xe')) ) {
+ $results = Currencies::updateRates($_POST['service']);
+
+ foreach ( $results[0] as $result ) {
+ Registry::get('MessageStack')->add(null, sprintf(OSCOM::getDef('ms_error_invalid_currency'), $result['title'], $result['code']), 'error');
+ }
+
+ foreach ( $results[1] as $result ) {
+ Registry::get('MessageStack')->add(null, sprintf(OSCOM::getDef('ms_success_currency_updated'), $result['title'], $result['code']), 'success');
+ }
+ }
+
+ osc_redirect_admin(OSCOM::getLink());
+ }
+ }
+?>
View
4 osCommerce/OM/Core/Site/Admin/Application/Currencies/pages/batch_delete.php
@@ -22,7 +22,7 @@
<div class="infoBox">
<h3><?php echo osc_icon('trash.png') . ' ' . OSCOM::getDef('action_heading_batch_delete_currency'); ?></h3>
- <form name="aDeleteBatch" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'action=BatchDelete'); ?>" method="post">
+ <form name="aDeleteBatch" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'BatchDelete&Process'); ?>" method="post">
<p><?php echo OSCOM::getDef('introduction_batch_delete_currencies'); ?></p>
@@ -50,7 +50,7 @@
echo '<p>' . $names_string . '</p>';
if ( $check_default_flag === false ) {
- echo '<p>' . 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>';
+ echo '<p>' . 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>';
} else {
echo '<p><b>' . OSCOM::getDef('introduction_delete_currency_invalid') . '</b></p>';
View
4 osCommerce/OM/Core/Site/Admin/Application/Currencies/pages/delete.php
@@ -38,13 +38,13 @@
} else {
?>
- <form name="cDelete" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'id=' . $_GET['id'] . '&action=Delete'); ?>" method="post">
+ <form name="cDelete" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'Delete&Process&id=' . $_GET['id']); ?>" method="post">
<p><?php echo OSCOM::getDef('introduction_delete_currency'); ?></p>
<p><?php echo '<b>' . $OSCOM_ObjectInfo->getProtected('title') . '</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>
View
4 osCommerce/OM/Core/Site/Admin/Application/Currencies/pages/edit.php
@@ -26,7 +26,7 @@
<div class="infoBox">
<h3><?php echo osc_icon('edit.png') . ' ' . $OSCOM_ObjectInfo->getProtected('title'); ?></h3>
- <form name="cEdit" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'id=' . $_GET['id'] . '&action=Save'); ?>" method="post">
+ <form name="cEdit" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'Save&Process&id=' . $_GET['id']); ?>" method="post">
<p><?php echo OSCOM::getDef('introduction_edit_currency'); ?></p>
@@ -57,7 +57,7 @@
echo osc_draw_hidden_field('is_default', 'true');
}
- 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')));
+ 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>
View
8 osCommerce/OM/Core/Site/Admin/Application/Currencies/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=UpdateRates'), 'icon' => 'refresh', 'title' => OSCOM::getDef('button_update_currency_exchange_rates'))) . ' ' . 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, 'UpdateRates'), 'icon' => 'refresh', 'title' => OSCOM::getDef('button_update_currency_exchange_rates'))) . ' ' . 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;">
@@ -44,7 +44,7 @@
</thead>
<tfoot>
<tr>
- <th align="right" colspan="4"><?php echo '<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="4"><?php echo '<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>
@@ -75,10 +75,10 @@
var dataTableName = 'currenciesDataTable';
var dataTableDataURL = '<?php echo OSCOM::getRPCLink(null, null, 'action=getAll'); ?>';
- var cEditLink = '<?php echo OSCOM::getLink(null, null, 'id=CID&action=Save'); ?>';
+ var cEditLink = '<?php echo OSCOM::getLink(null, null, 'Save&id=CID'); ?>';
var cEditLinkIcon = '<?php echo osc_icon('edit.png'); ?>';
- var cDeleteLink = '<?php echo OSCOM::getLink(null, null, 'id=CID&action=Delete'); ?>';
+ var cDeleteLink = '<?php echo OSCOM::getLink(null, null, 'Delete&id=CID'); ?>';
var cDeleteLinkIcon = '<?php echo osc_icon('trash.png'); ?>';
var defaultCurrency = '<?php echo DEFAULT_CURRENCY; ?>';
View
4 osCommerce/OM/Core/Site/Admin/Application/Currencies/pages/new.php
@@ -22,7 +22,7 @@
<div class="infoBox">
<h3><?php echo osc_icon('new.png') . ' ' . OSCOM::getDef('action_heading_new_currency'); ?></h3>
- <form name="cNew" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'action=Save'); ?>" method="post">
+ <form name="cNew" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'Save&Process'); ?>" method="post">
<p><?php echo OSCOM::getDef('introduction_new_currency'); ?></p>
@@ -36,7 +36,7 @@
<p><label for="default"><?php echo OSCOM::getDef('field_set_default'); ?></label><?php echo osc_draw_checkbox_field('default'); ?></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
4 osCommerce/OM/Core/Site/Admin/Application/Currencies/pages/update_rates.php
@@ -27,7 +27,7 @@
<div class="infoBox">
<h3><?php echo osc_icon('update.png') . ' ' . OSCOM::getDef('action_heading_update_rates'); ?></h3>
- <form name="cUpdate" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'action=UpdateRates'); ?>" method="post">
+ <form name="cUpdate" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'UpdateRates&Process'); ?>" method="post">
<p><?php echo OSCOM::getDef('introduction_update_exchange_rates'); ?></p>
@@ -37,7 +37,7 @@
<p><?php echo OSCOM::getDef('service_terms_agreement'); ?></p>
- <p><?php echo osc_draw_hidden_field('subaction', 'confirm') . osc_draw_button(array('priority' => 'primary', 'icon' => 'refresh', 'title' => OSCOM::getDef('button_update'))) . ' ' . 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' => 'refresh', 'title' => OSCOM::getDef('button_update'))) . ' ' . osc_draw_button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
</form>
</div>

0 comments on commit 7f15067

Please sign in to comment.
Something went wrong with that request. Please try again.