Skip to content
Browse files

Support nested Actions (Admin/Configuration Application)

  • Loading branch information...
1 parent 56d738d commit fe32d5ca361bdcb4454f3377462743b425b7adf0 @haraldpdl haraldpdl committed with Jul 30, 2010
View
22 osCommerce/OM/Core/Site/Admin/Application/Configuration/Action/BatchSaveEntries.php
@@ -11,33 +11,11 @@
namespace osCommerce\OM\Core\Site\Admin\Application\Configuration\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\Configuration\Configuration;
- use osCommerce\OM\Core\Registry;
- use osCommerce\OM\Core\OSCOM;
class BatchSaveEntries {
public static function execute(ApplicationAbstract $application) {
if ( isset($_POST['batch']) && is_array($_POST['batch']) && !empty($_POST['batch']) ) {
$application->setPageContent('entries_batch_edit.php');
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- $error = false;
-
- foreach ( $_POST['configuration'] as $key => $param ) {
- if ( !Configuration::saveEntry(array($key => $param)) ) {
- $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(null, null, 'id=' . $_GET['id']));
- }
}
}
}
View
38 osCommerce/OM/Core/Site/Admin/Application/Configuration/Action/BatchSaveEntries/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\Configuration\Action\BatchSaveEntries;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\Configuration\Configuration;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ $error = false;
+
+ foreach ( $_POST['configuration'] as $key => $param ) {
+ if ( !Configuration::saveEntry(array($key => $param)) ) {
+ $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(null, null, 'id=' . $_GET['id']));
+ }
+ }
+?>
View
13 osCommerce/OM/Core/Site/Admin/Application/Configuration/Action/EntrySave.php
@@ -11,23 +11,10 @@
namespace osCommerce\OM\Core\Site\Admin\Application\Configuration\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\Configuration\Configuration;
- use osCommerce\OM\Core\Registry;
- use osCommerce\OM\Core\OSCOM;
class EntrySave {
public static function execute(ApplicationAbstract $application) {
$application->setPageContent('entries_edit.php');
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- if ( Configuration::saveEntry($_POST['configuration']) ) {
- 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(null, null, 'id=' . $_GET['id']));
- }
}
}
?>
View
29 osCommerce/OM/Core/Site/Admin/Application/Configuration/Action/EntrySave/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\Configuration\Action\EntrySave;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\Configuration\Configuration;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ if ( Configuration::saveEntry($_POST['configuration']) ) {
+ 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(null, null, 'id=' . $_GET['id']));
+ }
+ }
+?>
View
4 osCommerce/OM/Core/Site/Admin/Application/Configuration/pages/entries.php
@@ -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, 'id=' . $_GET['id'] . '&action=BatchSaveEntries') . '\';" />'; ?></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, 'BatchSaveEntries&id=' . $_GET['id']) . '\';" />'; ?></th>
<th align="center" width="20"><?php echo osc_draw_checkbox_field('batchFlag', null, null, 'onclick="flagCheckboxes(this);"'); ?></th>
</tr>
</tfoot>
@@ -74,7 +74,7 @@
var dataTableName = 'configurationDataTable';
var dataTableDataURL = '<?php echo OSCOM::getRPCLink(null, null, 'id=' . $_GET['id'] . '&action=getAllEntries'); ?>';
- var configEditLink = '<?php echo OSCOM::getLink(null, null, 'id=' . (int)$_GET['id'] . '&pID=CONFIGID&action=EntrySave'); ?>';
+ var configEditLink = '<?php echo OSCOM::getLink(null, null, 'EntrySave&id=' . (int)$_GET['id'] . '&pID=CONFIGID'); ?>';
var configEditLinkIcon = '<?php echo osc_icon('edit.png'); ?>';
var osC_DataTable = new osC_DataTable();
View
4 osCommerce/OM/Core/Site/Admin/Application/Configuration/pages/entries_batch_edit.php
@@ -23,7 +23,7 @@
<div class="infoBox">
<h3><?php echo osc_icon('edit.png') . ' ' . OSCOM::getDef('action_heading_batch_edit_configuration_parameters'); ?></h3>
- <form name="cEditBatch" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'id=' . $_GET['id'] . '&action=BatchSaveEntries'); ?>" method="post">
+ <form name="cEditBatch" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'BatchSaveEntries&Process&id=' . $_GET['id']); ?>" method="post">
<p><?php echo OSCOM::getDef('introduction_batch_edit_configuration_parameters'); ?></p>
@@ -52,7 +52,7 @@
</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(null, null, 'id=' . $_GET['id']), '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(null, null, 'id=' . $_GET['id']), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
</form>
</div>
View
4 osCommerce/OM/Core/Site/Admin/Application/Configuration/pages/entries_edit.php
@@ -32,7 +32,7 @@
<div class="infoBox">
<h3><?php echo osc_icon('edit.png') . ' ' . $OSCOM_ObjectInfo->getProtected('configuration_title'); ?></h3>
- <form name="cEdit" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'id=' . $_GET['id'] . '&action=EntrySave'); ?>" method="post">
+ <form name="cEdit" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'EntrySave&Process&id=' . $_GET['id']); ?>" method="post">
<p><?php echo OSCOM::getDef('introduction_edit_parameter'); ?></p>
@@ -41,7 +41,7 @@
<p><?php echo $OSCOM_ObjectInfo->get('configuration_description'); ?></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(null, null, 'id=' . $_GET['id']), '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(null, null, 'id=' . $_GET['id']), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
</form>
</div>

0 comments on commit fe32d5c

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