Permalink
Browse files

Support nested Actions (Admin/Countries Application)

  • Loading branch information...
1 parent 4fd10ca commit b2bcfe5212485e7060ddfac1ef96eca91e8b3cdd @haraldpdl haraldpdl committed with Jul 30, 2010
Showing with 225 additions and 129 deletions.
  1. +0 −22 osCommerce/OM/Core/Site/Admin/Application/Countries/Action/BatchDelete.php
  2. +38 −0 osCommerce/OM/Core/Site/Admin/Application/Countries/Action/BatchDelete/Process.php
  3. +0 −22 osCommerce/OM/Core/Site/Admin/Application/Countries/Action/BatchDeleteZones.php
  4. +38 −0 osCommerce/OM/Core/Site/Admin/Application/Countries/Action/BatchDeleteZones/Process.php
  5. +0 −13 osCommerce/OM/Core/Site/Admin/Application/Countries/Action/Delete.php
  6. +29 −0 osCommerce/OM/Core/Site/Admin/Application/Countries/Action/Delete/Process.php
  7. +0 −18 osCommerce/OM/Core/Site/Admin/Application/Countries/Action/Save.php
  8. +34 −0 osCommerce/OM/Core/Site/Admin/Application/Countries/Action/Save/Process.php
  9. +0 −13 osCommerce/OM/Core/Site/Admin/Application/Countries/Action/ZoneDelete.php
  10. +29 −0 osCommerce/OM/Core/Site/Admin/Application/Countries/Action/ZoneDelete/Process.php
  11. +0 −17 osCommerce/OM/Core/Site/Admin/Application/Countries/Action/ZoneSave.php
  12. +33 −0 osCommerce/OM/Core/Site/Admin/Application/Countries/Action/ZoneSave/Process.php
  13. +2 −2 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/batch_delete.php
  14. +2 −2 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/delete.php
  15. +2 −2 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/edit.php
  16. +4 −4 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/main.php
  17. +2 −2 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/new.php
  18. +4 −4 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/zones.php
  19. +2 −2 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/zones_batch_delete.php
  20. +2 −2 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/zones_delete.php
  21. +2 −2 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/zones_edit.php
  22. +2 −2 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/zones_new.php
@@ -11,33 +11,11 @@
namespace osCommerce\OM\Core\Site\Admin\Application\Countries\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\Countries\Countries;
- 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 ( !Countries::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\Countries\Action\BatchDelete;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\Countries\Countries;
+ 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 ( !Countries::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\Countries\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\Countries\Countries;
- use osCommerce\OM\Core\Registry;
- use osCommerce\OM\Core\OSCOM;
class BatchDeleteZones {
public static function execute(ApplicationAbstract $application) {
if ( isset($_POST['batch']) && is_array($_POST['batch']) && !empty($_POST['batch']) ) {
$application->setPageContent('zones_batch_delete.php');
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- $error = false;
-
- foreach ( $_POST['batch'] as $id ) {
- if ( !Countries::deleteZone($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\Countries\Action\BatchDeleteZones;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\Countries\Countries;
+ 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 ( !Countries::deleteZone($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\Countries\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\Countries\Countries;
- 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 ( Countries::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\Countries\Action\Delete;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\Countries\Countries;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ if ( Countries::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,9 +11,6 @@
namespace osCommerce\OM\Core\Site\Admin\Application\Countries\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\Countries\Countries;
- 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['countries_name'],
- 'iso_code_2' => $_POST['countries_iso_code_2'],
- 'iso_code_3' => $_POST['countries_iso_code_3'],
- 'address_format' => $_POST['address_format']);
-
- if ( Countries::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,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\Countries\Action\Save;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\Countries\Countries;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ $data = array('name' => $_POST['countries_name'],
+ 'iso_code_2' => $_POST['countries_iso_code_2'],
+ 'iso_code_3' => $_POST['countries_iso_code_3'],
+ 'address_format' => $_POST['address_format']);
+
+ if ( Countries::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());
+ }
+ }
+?>
@@ -11,23 +11,10 @@
namespace osCommerce\OM\Core\Site\Admin\Application\Countries\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\Countries\Countries;
- use osCommerce\OM\Core\Registry;
- use osCommerce\OM\Core\OSCOM;
class ZoneDelete {
public static function execute(ApplicationAbstract $application) {
$application->setPageContent('zones_delete.php');
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- if ( Countries::deleteZone($_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\Countries\Action\ZoneDelete;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\Countries\Countries;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ if ( Countries::deleteZone($_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\Countries\Action;
use osCommerce\OM\Core\ApplicationAbstract;
- use osCommerce\OM\Core\Site\Admin\Application\Countries\Countries;
- use osCommerce\OM\Core\Registry;
- use osCommerce\OM\Core\OSCOM;
class ZoneSave {
public static function execute(ApplicationAbstract $application) {
@@ -22,20 +19,6 @@ public static function execute(ApplicationAbstract $application) {
} else {
$application->setPageContent('zones_new.php');
}
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- $data = array('name' => $_POST['zone_name'],
- 'code' => $_POST['zone_code'],
- 'country_id' => $_GET['id']);
-
- if ( Countries::saveZone((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\Countries\Action\ZoneSave;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\Countries\Countries;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ $data = array('name' => $_POST['zone_name'],
+ 'code' => $_POST['zone_code'],
+ 'country_id' => $_GET['id']);
+
+ if ( Countries::saveZone((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']));
+ }
+ }
+?>
Oops, something went wrong.

0 comments on commit b2bcfe5

Please sign in to comment.