Permalink
Browse files

Support nested Actions (Admin/ZoneGroups Application)

  • Loading branch information...
haraldpdl authored and tgely committed Jul 30, 2010
1 parent 0bb0049 commit 26dbd8cd9dab9bfd3826a2bccd917910a49536d3
Showing with 223 additions and 127 deletions.
  1. +0 −22 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/Action/BatchDelete.php
  2. +38 −0 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/Action/BatchDelete/Process.php
  3. +0 −22 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/Action/BatchDeleteEntries.php
  4. +38 −0 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/Action/BatchDeleteEntries/Process.php
  5. +0 −13 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/Action/Delete.php
  6. +29 −0 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/Action/Delete/Process.php
  7. +0 −13 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/Action/EntryDelete.php
  8. +29 −0 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/Action/EntryDelete/Process.php
  9. +0 −17 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/Action/EntrySave.php
  10. +33 −0 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/Action/EntrySave/Process.php
  11. +0 −16 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/Action/Save.php
  12. +32 −0 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/Action/Save/Process.php
  13. +2 −2 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/batch_delete.php
  14. +2 −2 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/delete.php
  15. +2 −2 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/edit.php
  16. +4 −4 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/entries.php
  17. +2 −2 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/entries_batch_delete.php
  18. +2 −2 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/entries_delete.php
  19. +2 −2 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/entries_edit.php
  20. +2 −2 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/entries_new.php
  21. +4 −4 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/main.php
  22. +2 −2 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/new.php
@@ -11,33 +11,11 @@
namespace osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\ZoneGroups;
- 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 ( !ZoneGroups::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());
- }
}
}
}
@@ -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\ZoneGroups\Action\BatchDelete;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\ZoneGroups;
+ 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 ( !ZoneGroups::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());
+ }
+ }
+?>
@@ -11,33 +11,11 @@
namespace osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\ZoneGroups;
- use osCommerce\OM\Core\Registry;
- use osCommerce\OM\Core\OSCOM;
class BatchDeleteEntries {
public static function execute(ApplicationAbstract $application) {
if ( isset($_POST['batch']) && is_array($_POST['batch']) && !empty($_POST['batch']) ) {
$application->setPageContent('entries_batch_delete.php');
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- $error = false;
-
- foreach ( $_POST['batch'] as $id ) {
- if ( !ZoneGroups::deleteEntry($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(null, null, 'id=' . $_GET['id']));
- }
}
}
}
@@ -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\ZoneGroups\Action\BatchDeleteEntries;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\ZoneGroups;
+ 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 ( !ZoneGroups::deleteEntry($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(null, null, 'id=' . $_GET['id']));
+ }
+ }
+?>
@@ -11,23 +11,10 @@
namespace osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\ZoneGroups;
- 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 ( ZoneGroups::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());
- }
}
}
?>
@@ -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\ZoneGroups\Action\Delete;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\ZoneGroups;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ if ( ZoneGroups::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());
+ }
+ }
+?>
@@ -11,23 +11,10 @@
namespace osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\ZoneGroups;
- use osCommerce\OM\Core\Registry;
- use osCommerce\OM\Core\OSCOM;
class EntryDelete {
public static function execute(ApplicationAbstract $application) {
$application->setPageContent('entries_delete.php');
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- if ( ZoneGroups::deleteEntry($_GET['zID']) ) {
- 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']));
- }
}
}
?>
@@ -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\ZoneGroups\Action\EntryDelete;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\ZoneGroups;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ if ( ZoneGroups::deleteEntry($_GET['zID']) ) {
+ 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']));
+ }
+ }
+?>
@@ -11,9 +11,6 @@
namespace osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\ZoneGroups;
- use osCommerce\OM\Core\Registry;
- use osCommerce\OM\Core\OSCOM;
class EntrySave {
public static function execute(ApplicationAbstract $application) {
@@ -22,20 +19,6 @@ public static function execute(ApplicationAbstract $application) {
} else {
$application->setPageContent('entries_new.php');
}
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- $data = array('group_id' => $_GET['id'],
- 'country_id' => $_POST['zone_country_id'],
- 'zone_id' => $_POST['zone_id']);
-
- if ( ZoneGroups::saveEntry((isset($_GET['zID']) && is_numeric($_GET['zID']) ? $_GET['zID'] : 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(null, null, 'id=' . $_GET['id']));
- }
}
}
?>
@@ -0,0 +1,33 @@
+<?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\ZoneGroups\Action\EntrySave;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\ZoneGroups;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ $data = array('group_id' => $_GET['id'],
+ 'country_id' => $_POST['zone_country_id'],
+ 'zone_id' => $_POST['zone_id']);
+
+ if ( ZoneGroups::saveEntry((isset($_GET['zID']) && is_numeric($_GET['zID']) ? $_GET['zID'] : 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(null, null, 'id=' . $_GET['id']));
+ }
+ }
+?>
@@ -11,9 +11,6 @@
namespace osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\ZoneGroups;
- use osCommerce\OM\Core\Registry;
- use osCommerce\OM\Core\OSCOM;
class Save {
public static function execute(ApplicationAbstract $application) {
@@ -22,19 +19,6 @@ public static function execute(ApplicationAbstract $application) {
} else {
$application->setPageContent('new.php');
}
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- $data = array('zone_name' => $_POST['zone_name'],
- 'zone_description' => $_POST['zone_description']);
-
- if ( ZoneGroups::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());
- }
}
}
?>
@@ -0,0 +1,32 @@
+<?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\ZoneGroups\Action\Save;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\ZoneGroups;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ $data = array('zone_name' => $_POST['zone_name'],
+ 'zone_description' => $_POST['zone_description']);
+
+ if ( ZoneGroups::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());
+ }
+ }
+?>
@@ -23,7 +23,7 @@
<div class="infoBox">
<h3><?php echo osc_icon('trash.png') . ' ' . OSCOM::getDef('action_heading_batch_delete_zone_groups'); ?></h3>
- <form name="zDeleteBatch" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'action=BatchDelete'); ?>" method="post">
+ <form name="zDeleteBatch" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'BatchDelete&Process'); ?>" method="post">
<p><?php echo OSCOM::getDef('introduction_batch_delete_zone_groups'); ?></p>
@@ -45,7 +45,7 @@
}
if ( !empty($names_string) ) {
- $names_string = substr($names_string, 0, -2) . osc_draw_hidden_field('subaction', 'confirm');
+ $names_string = substr($names_string, 0, -2);
}
echo '<p>' . $names_string . '</p>';
Oops, something went wrong.

0 comments on commit 26dbd8c

Please sign in to comment.