Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update Admin PaymentModules Application

by hand
Signed-off-by: Gergely <t-gely@freemail.hu>
  • Loading branch information...
commit f092a5de9919e19c8fc73f4ec312d1bee9132ee2 1 parent 4767587
@tgely authored
Showing with 649 additions and 255 deletions.
  1. +20 −0 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Action/Install.php
  2. +31 −0 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Action/Install/Process.php
  3. +20 −0 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Action/Save.php
  4. +31 −0 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Action/Save/Process.php
  5. +20 −0 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Action/Uninstall.php
  6. +31 −0 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Action/Uninstall/Process.php
  7. +13 −149 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Controller.php
  8. +215 −0 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/PaymentModules.php
  9. +48 −0 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/RPC.php
  10. +24 −27 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/edit.php
  11. +100 −0 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/install.php
  12. +75 −52 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/main.php
  13. +17 −21 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/uninstall.php
  14. +4 −6 osCommerce/OM/Core/Site/Admin/languages/en_US/PaymentModules.php
  15. BIN  public/sites/Admin/images/applications/16/paymentmodules.png
  16. BIN  public/sites/Admin/images/applications/32/paymentmodules.png
View
20 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Action/Install.php
@@ -0,0 +1,20 @@
+<?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\PaymentModules\Action;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+
+ class Install {
+ public static function execute(ApplicationAbstract $application) {
+ $application->setPageContent('install.php');
+ }
+ }
+?>
View
31 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Action/Install/Process.php
@@ -0,0 +1,31 @@
+<?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\PaymentModules\Action\Install;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\PaymentModules\PaymentModules;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ $data = osc_sanitize_string(basename($_GET['code']));
+
+ if ( PaymentModules::install($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
20 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Action/Save.php
@@ -0,0 +1,20 @@
+<?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\PaymentModules\Action;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+
+ class Save {
+ public static function execute(ApplicationAbstract $application) {
+ $application->setPageContent('edit.php');
+ }
+ }
+?>
View
31 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Action/Save/Process.php
@@ -0,0 +1,31 @@
+<?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\PaymentModules\Action\Save;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\PaymentModules\PaymentModules;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ $data = array('configuration' => $_POST['configuration']);
+
+ if ( PaymentModules::save($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
20 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Action/Uninstall.php
@@ -0,0 +1,20 @@
+<?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\PaymentModules\Action;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+
+ class Uninstall {
+ public static function execute(ApplicationAbstract $application) {
+ $application->setPageContent('uninstall.php');
+ }
+ }
+?>
View
31 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Action/Uninstall/Process.php
@@ -0,0 +1,31 @@
+<?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\PaymentModules\Action\Uninstall;
+
+ use osCommerce\OM\Core\ApplicationAbstract;
+ use osCommerce\OM\Core\Site\Admin\Application\PaymentModules\PaymentModules;
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\OSCOM;
+
+ class Process {
+ public static function execute(ApplicationAbstract $application) {
+ $data = osc_sanitize_string(basename($_GET['code']));
+
+ if ( PaymentModules::uninstall($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
162 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Controller.php
@@ -1,164 +1,28 @@
<?php
/*
- $Id: $
-
- osCommerce, Open Source E-Commerce Solutions
- http://www.oscommerce.com
-
- Copyright (c) 2009 osCommerce
+ 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.
*/
- class osC_Application_Modules_payment extends osC_Template_Admin {
-
-/* Protected variables */
-
- protected $_module = 'modules_payment',
- $_page_title,
- $_page_contents = 'main.php';
-
-/* Class constructor */
-
- function __construct() {
- global $osC_Language, $osC_MessageStack;
-
- $this->_page_title = $osC_Language->get('heading_title');
-
- if ( !isset($_GET['action']) ) {
- $_GET['action'] = '';
- }
-
- include('includes/classes/payment.php');
-
- if ( !empty($_GET['action']) ) {
- switch ( $_GET['action'] ) {
- case 'save':
- $this->_page_contents = 'edit.php';
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- $data = array('configuration' => $_POST['configuration']);
-
- if ( $this->_save($data) ) {
- $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
- } else {
- $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
- }
-
- osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module));
- }
-
- break;
-
- case 'install':
- if ( $this->_install($_GET['module']) ) {
- $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
- } else {
- $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
- }
-
- osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module));
-
- break;
-
- case 'uninstall':
- $this->_page_contents = 'uninstall.php';
-
- if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
- if ( $this->_uninstall($_GET['module']) ) {
- $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
- } else {
- $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
- }
-
- osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module));
- }
-
- break;
- }
- }
- }
-
-/* Private methods */
+ namespace osCommerce\OM\Core\Site\Admin\Application\PaymentModules;
- function _save($data) {
- global $osC_Database;
+ use osCommerce\OM\Core\OSCOM;
- $error = false;
+ class Controller extends \osCommerce\OM\Core\Site\Admin\ApplicationAbstract {
+ protected $_group = 'modules';
+ protected $_icon = 'paymentmodules.png';
+ protected $_sort_order = 100;
- $osC_Database->startTransaction();
-
- foreach ( $data['configuration'] as $key => $value ) {
- $Qupdate = $osC_Database->query('update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key');
- $Qupdate->bindTable(':table_configuration', TABLE_CONFIGURATION);
- $Qupdate->bindValue(':configuration_value', is_array($data['configuration'][$key]) ? implode(',', $data['configuration'][$key]) : $value);
- $Qupdate->bindValue(':configuration_key', $key);
- $Qupdate->setLogging($_SESSION['module']);
- $Qupdate->execute();
-
- if ( $osC_Database->isError() ) {
- $error = true;
- break;
- }
- }
-
- if ( $error === false ) {
- $osC_Database->commitTransaction();
-
- osC_Cache::clear('configuration');
-
- return true;
- }
-
- $osC_Database->rollbackTransaction();
-
- return false;
+ protected function initialize() {
+ $this->_title = OSCOM::getDef('app_title');
}
- function _install($key) {
- global $osC_Database, $osC_Language;
-
- if ( file_exists('includes/modules/payment/' . $key . '.php') ) {
- $osC_Language->injectDefinitions('modules/payment/' . $key . '.xml');
-
- include('includes/modules/payment/' . $key . '.php');
-
- $module = 'osC_Payment_' . $key;
- $module = new $module();
-
- $module->install();
-
- osC_Cache::clear('modules-payment');
- osC_Cache::clear('configuration');
-
- return true;
- }
-
- return false;
- }
-
- function _uninstall($key) {
- global $osC_Database, $osC_Language;
-
- if ( file_exists('includes/modules/payment/' . $key . '.php') ) {
- $osC_Language->injectDefinitions('modules/payment/' . $key . '.xml');
-
- include('includes/modules/payment/' . $key . '.php');
-
- $module = 'osC_Payment_' . $key;
- $module = new $module();
-
- $module->remove();
-
- osC_Cache::clear('modules-payment');
- osC_Cache::clear('configuration');
-
- return true;
- }
-
- return false;
+ protected function process() {
+ $this->_page_title = OSCOM::getDef('heading_title');
}
}
-?>
+?>
View
215 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/PaymentModules.php
@@ -0,0 +1,215 @@
+<?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\PaymentModules;
+
+ use osCommerce\OM\Core\Registry;
+ use osCommerce\OM\Core\DirectoryListing;
+ use osCommerce\OM\Core\OSCOM;
+ use osCommerce\OM\Core\Cache;
+
+ class PaymentModules {
+ public static function get($code) {
+ $OSCOM_Language = Registry::get('Language');
+
+ $class = 'osCommerce\\OM\\Core\\Site\\Admin\\Module\\Payment\\' . $code;
+
+ $OSCOM_Language->injectDefinitions('modules/payment/' . $code . '.xml');
+
+ $OSCOM_PM = new $class();
+
+ $result = array('code' => $OSCOM_PM->getCode(),
+ 'title' => $OSCOM_PM->getTitle(),
+ 'sort_order' => $OSCOM_PM->getSortOrder(),
+ 'status' => $OSCOM_PM->isEnabled(),
+ 'keys' => $OSCOM_PM->getKeys());
+
+ return $result;
+ }
+
+ public static function getInstalled() {
+ $OSCOM_Database = Registry::get('Database');
+ $OSCOM_Language = Registry::get('Language');
+
+ $result = array('entries' => array());
+
+ $Qpm = $OSCOM_Database->query('select code from :table_templates_boxes where modules_group = :modules_group order by code');
+ $Qpm->bindValue(':modules_group', 'Payment');
+ $Qpm->execute();
+
+ while ( $Qpm->next() ) {
+ $class = 'osCommerce\\OM\\Core\\Site\\Admin\\Module\\Payment\\' . $Qpm->value('code');
+
+ if ( class_exists($class) ) {
+ $OSCOM_Language->injectDefinitions('modules/payment/' . $Qpm->value('code') . '.xml');
+
+ $OSCOM_PM = new $class();
+
+ $result['entries'][] = array('code' => $OSCOM_PM->getCode(),
+ 'title' => $OSCOM_PM->getTitle(),
+ 'sort_order' => $OSCOM_PM->getSortOrder(),
+ 'status' => $OSCOM_PM->isInstalled() && $OSCOM_PM->isEnabled());
+ }
+ }
+
+ $result['total'] = count($result['entries']);
+
+ return $result;
+ }
+
+ public static function findInstalled($search) {
+ $modules = self::getInstalled();
+
+ $result = array('entries' => array());
+
+ foreach ( $modules['entries'] as $module ) {
+ if ( (stripos($module['code'], $search) !== false) || (stripos($module['title'], $search) !== false) ) {
+ $result['entries'][] = $module;
+ }
+ }
+
+ $result['total'] = count($result['entries']);
+
+ return $result;
+ }
+
+ public static function getUninstalled() {
+ $OSCOM_Database = Registry::get('Database');
+ $OSCOM_Language = Registry::get('Language');
+
+ $installed = array();
+
+ $Qpm = $OSCOM_Database->query('select code from :table_templates_boxes where modules_group = :modules_group');
+ $Qpm->bindValue(':modules_group', 'Payment');
+ $Qpm->execute();
+
+ while ( $Qpm->next() ) {
+ $installed[] = $Qpm->value('code');
+ }
+
+ $result = array('entries' => array());
+
+ $DLpm = new DirectoryListing(OSCOM::BASE_DIRECTORY . 'Core/Site/Admin/Module/Payment');
+ $DLpm->setIncludeDirectories(false);
+
+ foreach ( $DLpm->getFiles() as $file ) {
+ $module = substr($file['name'], 0, strrpos($file['name'], '.'));
+
+ if ( !in_array($module, $installed) ) {
+ $class = 'osCommerce\\OM\\Core\\Site\\Admin\\Module\\Payment\\' . $module;
+
+ if ( class_exists($class) ) {
+ $OSCOM_Language->injectDefinitions('modules/payment/' . $module . '.xml');
+
+ $OSCOM_PM = new $class();
+
+ $result['entries'][] = array('code' => $OSCOM_PM->getCode(),
+ 'title' => $OSCOM_PM->getTitle(),
+ 'sort_order' => $OSCOM_PM->getSortOrder(),
+ 'status' => $OSCOM_PM->isEnabled());
+ }
+ }
+ }
+
+ $result['total'] = count($result['entries']);
+
+ return $result;
+ }
+
+ public static function findUninstalled($search) {
+ $modules = self::getUninstalled();
+
+ $result = array('entries' => array());
+
+ foreach ( $modules['entries'] as $module ) {
+ if ( (stripos($module['code'], $search) !== false) || (stripos($module['title'], $search) !== false) ) {
+ $result['entries'][] = $module;
+ }
+ }
+
+ $result['total'] = count($result['entries']);
+
+ return $result;
+ }
+
+ public static function save($data) {
+ $OSCOM_Database = Registry::get('Database');
+
+ $error = false;
+
+ $OSCOM_Database->startTransaction();
+
+ foreach ( $data['configuration'] as $key => $value ) {
+ $Qupdate = $OSCOM_Database->query('update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key');
+ $Qupdate->bindValue(':configuration_value', is_array($data['configuration'][$key]) ? implode(',', $data['configuration'][$key]) : $value);
+ $Qupdate->bindValue(':configuration_key', $key);
+// HPDL $Qupdate->setLogging($_SESSION['module']);
+ $Qupdate->execute();
+
+ if ( $OSCOM_Database->isError() ) {
+ $error = true;
+ break;
+ }
+ }
+
+ if ( $error === false ) {
+ $OSCOM_Database->commitTransaction();
+
+ Cache::clear('configuration');
+
+ return true;
+ }
+
+ $OSCOM_Database->rollbackTransaction();
+
+ return false;
+ }
+
+ public static function install($module) {
+ $OSCOM_Language = Registry::get('Language');
+
+ $class = 'osCommerce\\OM\\Core\\Site\\Admin\\Module\\Payment\\' . $module;
+
+ if ( class_exists($class) ) {
+ $OSCOM_Language->injectDefinitions('modules/payment/' . $module . '.xml');
+
+ $OSCOM_PM = new $class();
+ $OSCOM_PM->install();
+
+ Cache::clear('modules-payment');
+ Cache::clear('configuration');
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public static function uninstall($module) {
+ $OSCOM_Language = Registry::get('Language');
+
+ $class = 'osCommerce\\OM\\Core\\Site\\Admin\\Module\\Payment\\' . $module;
+
+ if ( class_exists($class) ) {
+ $OSCOM_Language->injectDefinitions('modules/payment/' . $module . '.xml');
+
+ $OSCOM_PM = new $class();
+ $OSCOM_PM->remove();
+
+ Cache::clear('modules-payment');
+ Cache::clear('configuration');
+
+ return true;
+ }
+
+ return false;
+ }
+ }
+?>
View
48 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/RPC.php
@@ -0,0 +1,48 @@
+<?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\PaymentModules;
+
+ use osCommerce\OM\Core\Site\RPC\Controller as OSCOM_Site_RPC;
+
+ class RPC {
+ public static function getInstalled() {
+ if ( !isset($_GET['search']) ) {
+ $_GET['search'] = '';
+ }
+
+ if ( !empty($_GET['search']) ) {
+ $result = PaymentModules::findInstalled($_GET['search']);
+ } else {
+ $result = PaymentModules::getInstalled();
+ }
+
+ $result['rpcStatus'] = OSCOM_Site_RPC::STATUS_SUCCESS;
+
+ echo json_encode($result);
+ }
+
+ public static function getUninstalled() {
+ if ( !isset($_GET['search']) ) {
+ $_GET['search'] = '';
+ }
+
+ if ( !empty($_GET['search']) ) {
+ $result = PaymentModules::findUninstalled($_GET['search']);
+ } else {
+ $result = PaymentModules::getUninstalled();
+ }
+
+ $result['rpcStatus'] = OSCOM_Site_RPC::STATUS_SUCCESS;
+
+ echo json_encode($result);
+ }
+ }
+?>
View
51 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/edit.php
@@ -1,49 +1,46 @@
<?php
/*
- $Id: $
-
- osCommerce, Open Source E-Commerce Solutions
- http://www.oscommerce.com
-
- Copyright (c) 2007 osCommerce
+ 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.
*/
- include('includes/modules/payment/' . $_GET['module'] . '.php');
-
- $osC_Language->injectDefinitions('modules/payment/' . $_GET['module'] . '.xml');
+ use osCommerce\OM\Core\ObjectInfo;
+ use osCommerce\OM\Core\Site\Admin\Application\PaymentModules\PaymentModules;
+ use osCommerce\OM\Core\OSCOM;
- $module = 'osC_Payment_' . $_GET['module'];
- $module = new $module();
+ $OSCOM_ObjectInfo = new ObjectInfo(PaymentModules::get($_GET['code']));
?>
-<h1><?php echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), $osC_Template->getPageTitle()); ?></h1>
+<h1><?php echo $OSCOM_Template->getIcon(32) . osc_link_object(OSCOM::getLink(), $OSCOM_Template->getPageTitle()); ?></h1>
<?php
- if ( $osC_MessageStack->size($osC_Template->getModule()) > 0 ) {
- echo $osC_MessageStack->get($osC_Template->getModule());
+ if ( $OSCOM_MessageStack->exists() ) {
+ echo $OSCOM_MessageStack->get();
}
?>
-<div class="infoBoxHeading"><?php echo osc_icon('edit.png') . ' ' . $module->getTitle(); ?></div>
-<div class="infoBoxContent">
- <form name="mEdit" action="<?php echo osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&module=' . $module->getCode() . '&action=save'); ?>" method="post">
+<div class="infoBox">
+ <h3><?php echo osc_icon('edit.png') . ' ' . $OSCOM_ObjectInfo->getProtected('title'); ?></h3>
+
+ <form name="pmEdit" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'Save&Process&code=' . $OSCOM_ObjectInfo->get('code')); ?>" method="post">
+
+ <p><?php echo OSCOM::getDef('introduction_edit_payment_module'); ?></p>
- <p><?php echo $osC_Language->get('introduction_edit_payment_module'); ?></p>
+ <fieldset>
<?php
$keys = '';
- foreach ( $module->getKeys() as $key ) {
- $Qkey = $osC_Database->query('select configuration_title, configuration_value, configuration_description, use_function, set_function from :table_configuration where configuration_key = :configuration_key');
- $Qkey->bindTable(':table_configuration', TABLE_CONFIGURATION);
+ foreach ( $OSCOM_ObjectInfo->get('keys') as $key ) {
+ $Qkey = $OSCOM_Database->query('select configuration_title, configuration_value, configuration_description, use_function, set_function from :table_configuration where configuration_key = :configuration_key');
$Qkey->bindValue(':configuration_key', $key);
$Qkey->execute();
- $keys .= '<b>' . $Qkey->value('configuration_title') . '</b><br />' . $Qkey->value('configuration_description') . '<br />';
+ $keys .= '<p><label for="' . $key . '">' . $Qkey->value('configuration_title') . '</label><br />' . $Qkey->value('configuration_description');
if ( !osc_empty($Qkey->value('set_function')) ) {
$keys .= osc_call_user_func($Qkey->value('set_function'), $Qkey->value('configuration_value'), $key);
@@ -51,15 +48,15 @@
$keys .= osc_draw_input_field('configuration[' . $key . ']', $Qkey->value('configuration_value'));
}
- $keys .= '<br /><br />';
+ $keys .= '</p>';
}
- $keys = substr($keys, 0, strrpos($keys, '<br /><br />'));
+ echo $keys;
?>
- <p><?php echo $keys; ?></p>
+ </fieldset>
- <p align="center"><?php echo osc_draw_hidden_field('subaction', 'confirm') . '<input type="submit" value="' . $osC_Language->get('button_save') . '" class="operationButton" /> <input type="button" value="' . $osC_Language->get('button_cancel') . '" onclick="document.location.href=\'' . osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()) . '\';" class="operationButton" />'; ?></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>
+</div>
View
100 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/install.php
@@ -0,0 +1,100 @@
+<?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.
+*/
+
+ use osCommerce\OM\Core\OSCOM;
+?>
+
+<h1><?php echo $OSCOM_Template->getIcon(32) . osc_link_object(OSCOM::getLink(), $OSCOM_Template->getPageTitle()); ?></h1>
+
+<?php
+ if ( $OSCOM_MessageStack->exists() ) {
+ echo $OSCOM_MessageStack->get();
+ }
+?>
+
+<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(), 'priority' => 'secondary', 'icon' => 'triangle-1-w', 'title' => OSCOM::getDef('button_back'))); ?></span>
+</form>
+
+<div style="padding: 20px 5px 5px 5px; height: 16px;">
+ <span id="batchTotalPages"></span>
+ <span id="batchPageLinks"></span>
+</div>
+
+<form name="batch" action="#" method="post">
+
+<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable" id="paymentModulesDataTable">
+ <thead>
+ <tr>
+ <th><?php echo OSCOM::getDef('table_heading_payment_modules'); ?></th>
+ <th width="150"><?php echo OSCOM::getDef('table_heading_action'); ?></th>
+ </tr>
+ </thead>
+ <tfoot>
+ <tr>
+ <th colspan="2">&nbsp;</th>
+ </tr>
+ </tfoot>
+ <tbody>
+ </tbody>
+</table>
+
+</form>
+
+<div style="padding: 5px;">
+ <span id="dataTableLegend"><?php echo '<b>' . OSCOM::getDef('table_action_legend') . '</b> ' . osc_icon('install.png') . '&nbsp;' . OSCOM::getDef('icon_install'); ?></span>
+ <span id="batchPullDownMenu"></span>
+</div>
+
+<script type="text/javascript">
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'install_page';
+
+ var moduleParams = new Object();
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
+
+ if ( $.cookie(moduleParamsCookieName) != null ) {
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
+ }
+
+ var dataTableName = 'paymentModulesDataTable';
+ var dataTableDataURL = '<?php echo OSCOM::getRPCLink(null, null, 'action=getUninstalled'); ?>';
+
+ var pmInstallLink = '<?php echo OSCOM::getLink(null, null, 'Install&Process&code=PMCODE'); ?>';
+ var pmInstallLinkIcon = '<?php echo osc_icon('install.png'); ?>';
+
+ var osC_DataTable = new osC_DataTable();
+ osC_DataTable.load();
+
+ function feedDataTable(data) {
+ var rowCounter = 0;
+
+ for ( var r in data.entries ) {
+ var record = data.entries[r];
+
+ var newRow = $('#' + dataTableName)[0].tBodies[0].insertRow(rowCounter);
+ newRow.id = 'row' + record.code;
+
+ $('#row' + record.code).hover( function() { $(this).addClass('mouseOver'); }, function() { $(this).removeClass('mouseOver'); }).css('cursor', 'pointer');
+
+ var newCell = newRow.insertCell(0);
+ newCell.innerHTML = htmlSpecialChars(record.title);
+
+ newCell = newRow.insertCell(1);
+ newCell.innerHTML = '<a href="' + pmInstallLink.replace('PMCODE', htmlSpecialChars(record.code)) + '">' + pmInstallLinkIcon + '</a>';
+ newCell.align = 'right';
+
+ rowCounter++;
+ }
+ }
+</script>
View
127 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/main.php
@@ -1,36 +1,43 @@
<?php
/*
- $Id: $
-
- osCommerce, Open Source E-Commerce Solutions
- http://www.oscommerce.com
-
- Copyright (c) 2007 osCommerce
+ 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.
*/
- $osC_DirectoryListing = new osC_DirectoryListing('includes/modules/payment');
- $osC_DirectoryListing->setIncludeDirectories(false);
- $files = $osC_DirectoryListing->getFiles();
+ use osCommerce\OM\Core\OSCOM;
?>
-<h1><?php echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), $osC_Template->getPageTitle()); ?></h1>
+<h1><?php echo $OSCOM_Template->getIcon(32) . osc_link_object(OSCOM::getLink(), $OSCOM_Template->getPageTitle()); ?></h1>
<?php
- if ( $osC_MessageStack->size($osC_Template->getModule()) > 0 ) {
- echo $osC_MessageStack->get($osC_Template->getModule());
+ if ( $OSCOM_MessageStack->exists() ) {
+ echo $OSCOM_MessageStack->get();
}
?>
-<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">
+<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, 'Install'), 'icon' => 'plus', 'title' => OSCOM::getDef('button_install'))); ?></span>
+</form>
+
+<div style="padding: 20px 5px 5px 5px; height: 16px;">
+ <span id="batchTotalPages"></span>
+ <span id="batchPageLinks"></span>
+</div>
+
+<form name="batch" action="#" method="post">
+
+<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable" id="paymentModulesDataTable">
<thead>
<tr>
- <th><?php echo $osC_Language->get('table_heading_payment_modules'); ?></th>
- <th><?php echo $osC_Language->get('table_heading_sort_order'); ?></th>
- <th width="150"><?php echo $osC_Language->get('table_heading_action'); ?></th>
+ <th><?php echo OSCOM::getDef('table_heading_payment_modules'); ?></th>
+ <th><?php echo OSCOM::getDef('table_heading_sort_order'); ?></th>
+ <th width="150"><?php echo OSCOM::getDef('table_heading_action'); ?></th>
</tr>
</thead>
<tfoot>
@@ -39,50 +46,66 @@
</tr>
</tfoot>
<tbody>
+ </tbody>
+</table>
-<?php
- $installed_modules = array();
+</form>
- foreach ( $files as $file ) {
- include('includes/modules/payment/' . $file['name']);
+<div style="padding: 5px;">
+ <span id="dataTableLegend"><?php echo '<b>' . OSCOM::getDef('table_action_legend') . '</b> ' . osc_icon('edit.png') . '&nbsp;' . OSCOM::getDef('icon_edit') . '&nbsp;&nbsp;' . osc_icon('uninstall.png') . '&nbsp;' . OSCOM::getDef('icon_uninstall'); ?></span>
+ <span id="batchPullDownMenu"></span>
+</div>
- $class = substr($file['name'], 0, strrpos($file['name'], '.'));
+<script type="text/javascript">
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'page';
- if ( class_exists('osC_Payment_' . $class) ) {
- $osC_Language->injectDefinitions('modules/payment/' . $class . '.xml');
+ var moduleParams = new Object();
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
- $module = 'osC_Payment_' . $class;
- $module = new $module();
-?>
+ if ( $.cookie(moduleParamsCookieName) != null ) {
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
+ }
- <tr onmouseover="rowOverEffect(this);" onmouseout="rowOutEffect(this);" <?php echo ( $module->isInstalled() && !$module->isEnabled() ? 'class="deactivatedRow"' : '') ?>>
- <td><?php echo $module->getTitle(); ?></td>
- <td><?php echo $module->getSortOrder(); ?></td>
- <td align="right">
+ var dataTableName = 'paymentModulesDataTable';
+ var dataTableDataURL = '<?php echo OSCOM::getRPCLink(null, null, 'action=getInstalled'); ?>';
-<?php
- if ( $module->isInstalled() ) {
- echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&module=' . $module->getCode() . '&action=save'), osc_icon('edit.png')) . '&nbsp;' .
- osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&module=' . $module->getCode() . '&action=uninstall'), osc_icon('uninstall.png'));
- } else {
- echo osc_image('images/pixel_trans.gif', '', '16', '16') . '&nbsp;' .
- osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&module=' . $module->getCode() . '&action=install'), osc_icon('install.png'));
- }
-?>
+ var pmEditLink = '<?php echo OSCOM::getLink(null, null, 'Save&code=PMCODE'); ?>';
+ var pmEditLinkIcon = '<?php echo osc_icon('edit.png'); ?>';
- </td>
- </tr>
+ var pmUninstallLink = '<?php echo OSCOM::getLink(null, null, 'Uninstall&code=PMCODE'); ?>';
+ var pmUninstallLinkIcon = '<?php echo osc_icon('uninstall.png'); ?>';
-<?php
- }
- }
-?>
+ var osC_DataTable = new osC_DataTable();
+ osC_DataTable.load();
- </tbody>
-</table>
+ function feedDataTable(data) {
+ var rowCounter = 0;
-<table border="0" width="100%" cellspacing="0" cellpadding="2">
- <tr>
- <td style="opacity: 0.5; filter: alpha(opacity=50);"><?php echo '<b>' . $osC_Language->get('table_action_legend') . '</b> ' . osc_icon('edit.png') . '&nbsp;' . $osC_Language->get('icon_edit') . '&nbsp;&nbsp;' . osc_icon('install.png') . '&nbsp;' . $osC_Language->get('icon_install') . '&nbsp;&nbsp;' . osc_icon('uninstall.png') . '&nbsp;' . $osC_Language->get('icon_uninstall'); ?></td>
- </tr>
-</table>
+ for ( var r in data.entries ) {
+ var record = data.entries[r];
+
+ var newRow = $('#' + dataTableName)[0].tBodies[0].insertRow(rowCounter);
+ newRow.id = 'row' + record.code;
+
+ if ( record.status != true ) {
+ $('#row' + record.code).addClass('deactivatedRow');
+ }
+
+ $('#row' + record.code).hover( function() { $(this).addClass('mouseOver'); }, function() { $(this).removeClass('mouseOver'); }).css('cursor', 'pointer');
+
+ var newCell = newRow.insertCell(0);
+ newCell.innerHTML = htmlSpecialChars(record.title);
+
+ newCell = newRow.insertCell(1);
+ newCell.innerHTML = parseInt(record.sort_order);
+
+ newCell = newRow.insertCell(2);
+ newCell.innerHTML = '<a href="' + pmEditLink.replace('PMCODE', htmlSpecialChars(record.code)) + '">' + pmEditLinkIcon + '</a>&nbsp;<a href="' + pmUninstallLink.replace('PMCODE', htmlSpecialChars(record.code)) + '">' + pmUninstallLinkIcon + '</a>';
+ newCell.align = 'right';
+
+ rowCounter++;
+ }
+ }
+</script>
View
38 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/uninstall.php
@@ -1,42 +1,38 @@
<?php
/*
- $Id: $
-
- osCommerce, Open Source E-Commerce Solutions
- http://www.oscommerce.com
-
- Copyright (c) 2007 osCommerce
+ 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.
*/
- include('includes/modules/payment/' . $_GET['module'] . '.php');
+ use osCommerce\OM\Core\ObjectInfo;
+ use osCommerce\OM\Core\Site\Admin\Application\PaymentModules\PaymentModules;
+ use osCommerce\OM\Core\OSCOM;
- $osC_Language->injectDefinitions('modules/payment/' . $_GET['module'] . '.xml');
-
- $module = 'osC_Payment_' . $_GET['module'];
- $module = new $module();
+ $OSCOM_ObjectInfo = new ObjectInfo(PaymentModules::get($_GET['code']));
?>
-<h1><?php echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), $osC_Template->getPageTitle()); ?></h1>
+<h1><?php echo $OSCOM_Template->getIcon(32) . osc_link_object(OSCOM::getLink(), $OSCOM_Template->getPageTitle()); ?></h1>
<?php
- if ( $osC_MessageStack->size($osC_Template->getModule()) > 0 ) {
- echo $osC_MessageStack->get($osC_Template->getModule());
+ if ( $OSCOM_MessageStack->exists() ) {
+ echo $OSCOM_MessageStack->get();
}
?>
-<div class="infoBoxHeading"><?php echo osc_icon('uninstall.png') . ' ' . $module->getTitle(); ?></div>
-<div class="infoBoxContent">
- <form name="mUninstall" action="<?php echo osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&module=' . $module->getCode() . '&action=uninstall'); ?>" method="post">
+<div class="infoBox">
+ <h3><?php echo osc_icon('uninstall.png') . ' ' . $OSCOM_ObjectInfo->getProtected('title'); ?></h3>
+
+ <form name="mUninstall" class="dataForm" action="<?php echo OSCOM::getLink(null, null, 'Uninstall&Process&code=' . $OSCOM_ObjectInfo->get('code')); ?>" method="post">
- <p><?php echo $osC_Language->get('introduction_uninstall_payment_module'); ?></p>
+ <p><?php echo OSCOM::getDef('introduction_uninstall_payment_module'); ?></p>
- <p><?php echo '<b>' . $module->getTitle() . '</b>'; ?></p>
+ <p><?php echo '<b>' . $OSCOM_ObjectInfo->getProtected('title') . '</b>'; ?></p>
- <p align="center"><?php echo osc_draw_hidden_field('subaction', 'confirm') . '<input type="submit" value="' . $osC_Language->get('button_uninstall') . '" class="operationButton" /> <input type="button" value="' . $osC_Language->get('button_cancel') . '" onclick="document.location.href=\'' . osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()) . '\';" class="operationButton" />'; ?></p>
+ <p><?php echo osc_draw_button(array('priority' => 'primary', 'icon' => 'trash', 'title' => OSCOM::getDef('button_uninstall'))) . ' ' . osc_draw_button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
</form>
-</div>
+</div>
View
10 osCommerce/OM/Core/Site/Admin/languages/en_US/PaymentModules.php
@@ -1,14 +1,12 @@
-# $Id: $
-#
-# osCommerce, Open Source E-Commerce Solutions
-# http://www.oscommerce.com
-#
-# Copyright (c) 2007 osCommerce
+# 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.
+app_title = Payment Modules
+
heading_title = Payment Modules
table_heading_payment_modules = Payment Modules
View
BIN  public/sites/Admin/images/applications/16/paymentmodules.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  public/sites/Admin/images/applications/32/paymentmodules.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.