1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_Adminhtml
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26:
27: include_once "ProfileController.php";
28:
29: /**
30: * Convert GUI admin controller
31: *
32: * @category Mage
33: * @package Mage_Adminhtml
34: * @author Magento Core Team <core@magentocommerce.com>
35: */
36: class Mage_Adminhtml_System_Convert_GuiController extends Mage_Adminhtml_System_Convert_ProfileController
37: {
38: /**
39: * Profiles list action
40: */
41: public function indexAction()
42: {
43: $this->_title($this->__('System'))
44: ->_title($this->__('Import and Export'))
45: ->_title($this->__('Profiles'));
46:
47: if ($this->getRequest()->getQuery('ajax')) {
48: $this->_forward('grid');
49: return;
50: }
51: $this->loadLayout();
52:
53: /**
54: * Set active menu item
55: */
56: $this->_setActiveMenu('system/convert');
57:
58: /**
59: * Append profiles block to content
60: */
61: $this->_addContent(
62: $this->getLayout()->createBlock('adminhtml/system_convert_gui', 'convert_profile')
63: );
64:
65: /**
66: * Add breadcrumb item
67: */
68: $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Import/Export'), Mage::helper('adminhtml')->__('Import/Export'));
69: $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Profiles'), Mage::helper('adminhtml')->__('Profiles'));
70:
71: $this->renderLayout();
72: }
73:
74: public function gridAction()
75: {
76: $this->getResponse()->setBody($this->getLayout()->createBlock('adminhtml/system_convert_gui_grid')->toHtml());
77: }
78:
79: /**
80: * Profile edit action
81: */
82: public function editAction()
83: {
84: $this->_initProfile();
85: $this->loadLayout();
86:
87: $profile = Mage::registry('current_convert_profile');
88:
89: // set entered data if was error when we do save
90: $data = Mage::getSingleton('adminhtml/session')->getConvertProfileData(true);
91:
92: if (!empty($data)) {
93: $profile->addData($data);
94: }
95:
96: $this->_title($profile->getId() ? $profile->getName() : $this->__('New Profile'));
97:
98: $this->_setActiveMenu('system/convert');
99:
100:
101: $this->_addContent(
102: $this->getLayout()->createBlock('adminhtml/system_convert_gui_edit')
103: );
104:
105: /**
106: * Append edit tabs to left block
107: */
108: $this->_addLeft($this->getLayout()->createBlock('adminhtml/system_convert_gui_edit_tabs'));
109:
110: $this->renderLayout();
111: }
112:
113: public function uploadAction()
114: {
115: $this->_initProfile();
116: $profile = Mage::registry('current_convert_profile');
117: }
118:
119: public function uploadPostAction()
120: {
121: $this->_initProfile();
122: $profile = Mage::registry('current_convert_profile');
123: }
124:
125: public function downloadAction()
126: {
127: $filename = $this->getRequest()->getParam('filename');
128: if (!$filename || strpos($filename, '..')!==false || $filename[0]==='.') {
129: return;
130: }
131: $this->_initProfile();
132: $profile = Mage::registry('current_convert_profile');
133: }
134:
135: protected function _isAllowed()
136: {
137: // switch ($this->getRequest()->getActionName()) {
138: // case 'index':
139: // $aclResource = 'admin/system/convert/gui';
140: // break;
141: // case 'grid':
142: // $aclResource = 'admin/system/convert/gui';
143: // break;
144: // case 'run':
145: // $aclResource = 'admin/system/convert/gui/run';
146: // break;
147: // default:
148: // $aclResource = 'admin/system/convert/gui/edit';
149: // break;
150: // }
151:
152: return Mage::getSingleton('admin/session')->isAllowed('admin/system/convert/gui');
153: }
154: }
155: