Downloadexports - Version 0.1.0

Version Notes

Nope.

Download this release

Release Info

Developer Magento Core Team
Extension Downloadexports
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/local/Mage/Downloadexports/Block/Exportview.php ADDED
File without changes
app/code/local/Mage/Downloadexports/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?PHP
2
+
3
+ class Mage_Downloadexports_Helper_Data extends Mage_Core_Helper_Abstract {
4
+
5
+ }
app/code/local/Mage/Downloadexports/controllers/Adminhtml/ExportviewController.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Mage_Downloadexports_Adminhtml_ExportviewController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ $this->loadLayout()->renderLayout();
8
+ }
9
+
10
+ public function downloadAction()
11
+ {
12
+ $post = $this->getRequest()->getPost();
13
+
14
+ try {
15
+ if (empty($post)) {
16
+ Mage::throwException($this->__('Invalid form data.'));
17
+ }
18
+ if(count($post['downloadform']['export'])>1) {
19
+ $zip_str = '';
20
+ foreach($post['downloadform']['export'] as $k=>$v) {
21
+ $zip_str .= dirname(__FILE__).'/../../../../../../../var/export/'.$v.' ';
22
+ }
23
+ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT\n");
24
+ header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
25
+ header("Content-type: application/zip;\n");
26
+ header("Content-Transfer-Encoding: binary");
27
+ header("Cache-Control: no-cache");
28
+ header("Expires: -1");
29
+ header("Content-Disposition: attachment; filename=\"export_".date('m-d-Y').".zip\";\n\n");
30
+ die(passthru("zip -j - $zip_str | cat"));
31
+ } else {
32
+ $v = $post['downloadform']['export'][0];
33
+ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT\n");
34
+ header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
35
+ header("Content-type: text/csv;\n");
36
+ header("Content-Transfer-Encoding: binary");
37
+ header("Cache-Control: no-cache");
38
+ header("Expires: -1");
39
+ header("Content-Disposition: attachment; filename=\"$v\";\n\n");
40
+ echo file_get_contents(dirname(__FILE__).'/../../../../../../../var/export/'.$v);
41
+ die();
42
+ }
43
+
44
+ $message = $this->__('Your form has been submitted successfully.');
45
+ Mage::getSingleton('adminhtml/session')->addSuccess($message);
46
+ } catch (Exception $e) {
47
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
48
+ }
49
+ $this->_redirect('*/*');
50
+ }
51
+ }
app/code/local/Mage/Downloadexports/etc/config.xml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Mage_Downloadexports>
5
+ <version>0.1.0</version>
6
+ </Mage_Downloadexports>
7
+ </modules>
8
+
9
+ <global>
10
+ <models>
11
+ <downloadexports>
12
+ <class>Mage_Downloadexports_Model</class>
13
+ <resourceModel>downloadexports_mysql4</resourceModel>
14
+ </downloadexports>
15
+ <downloadexports_mysql4>
16
+ <class>Mage_Downloadexports_Model_Mysql4</class>
17
+ </downloadexports_mysql4>
18
+ </models>
19
+ <blocks>
20
+ <downloadexports>
21
+ <class>Mage_Downloadexports_Block</class>
22
+ </downloadexports>
23
+ </blocks>
24
+ <helpers>
25
+ <downloadexports>
26
+ <class>Mage_Downloadexports_Helper</class>
27
+ </downloadexports>
28
+ </helpers>
29
+ </global>
30
+
31
+ <admin>
32
+ <routers>
33
+ <downloadexports>
34
+ <use>admin</use>
35
+ <args>
36
+ <module>Mage_Downloadexports</module>
37
+ <frontName>downloadexports</frontName>
38
+ </args>
39
+ </downloadexports>
40
+ </routers>
41
+ </admin>
42
+
43
+ <adminhtml>
44
+ <translate>
45
+ <modules>
46
+ <mage_adminhtml>
47
+ <files>
48
+ <downloadexports>Mage_Downloadexports.csv</downloadexports>
49
+ </files>
50
+ </mage_adminhtml>
51
+ </modules>
52
+ </translate>
53
+
54
+ <menu>
55
+ <system>
56
+ <children>
57
+ <convert>
58
+ <children>
59
+ <downloadexports_adminform translate="title" module="downloadexports">
60
+ <title>Download Exported Files</title>
61
+ <action>downloadexports/adminhtml_exportview</action>
62
+ </downloadexports_adminform>
63
+ </children>
64
+ </convert>
65
+ </children>
66
+ </system>
67
+ </menu>
68
+
69
+ <acl>
70
+ <resources>
71
+ <admin>
72
+ <children>
73
+ <system>
74
+ <children>
75
+ <downloadexports_adminform>
76
+ <title>Download Exported Files</title>
77
+ </downloadexports_adminform>
78
+ </children>
79
+ </system>
80
+ </children>
81
+ </admin>
82
+ </resources>
83
+ </acl>
84
+
85
+ <layout>
86
+ <updates>
87
+ <downloadexports>
88
+ <file>downloadexports.xml</file>
89
+ </downloadexports>
90
+ </updates>
91
+ </layout>
92
+ </adminhtml>
93
+ </config>
app/design/adminhtml/default/default/layout/downloadexports.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <downloadexports_adminhtml_exportview_index>
4
+ <update handle="downloadexports_exportview_index"/>
5
+ <reference name="content">
6
+ <block type="adminhtml/template" name="exportview" template="downloadexports/exportview.phtml"/>
7
+ </reference>
8
+ </downloadexports_adminhtml_exportview_index>
9
+ </layout>
app/design/adminhtml/default/default/template/downloadexports/exportview.phtml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <table cellspacing="0" class="grid-header">
3
+ <tr>
4
+ <td><h3><?=$this->__('Download Exported Files')?></h3></td>
5
+ <td class="a-right">
6
+ <button onclick="editForm.submit()" class="scalable save" type="button"><span>Download</span></button>
7
+ </td>
8
+ </tr>
9
+ </table>
10
+ </div>
11
+ <div class="entry-edit">
12
+ <form id="edit_form" name="edit_form" method="post" action="<?=$this->getUrl('*/*/download')?>">
13
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
14
+ <h4 class="icon-head head-edit-form fieldset-legend"><?=$this->__('Select Files to Download')?></h4>
15
+ <span class="smalltext">Multiple selections will be zip archived</span>
16
+ <table cellspacing="0" class="grid" width="100%">
17
+ <tr class="headings">
18
+ <th>&nbsp;</th>
19
+ <th>Filename</th>
20
+ <th>Created</th>
21
+ <th>File Size</th>
22
+ </tr>
23
+ <?php
24
+ $x = opendir(dirname(__FILE__)."/../../../../../../../var/export");
25
+ $odd_or_even = 0;
26
+ while($x && $z = readdir($x)) {
27
+ if($z!='..' && $z!='.') {
28
+ $fullpath = dirname(__FILE__)."/../../../../../../../var/export/".$z;
29
+ ?>
30
+ <tr class="<?=($odd_or_even%2)?'odd':'even'?>">
31
+ <td style="width:50px" class="a-center"><input type="checkbox" id="downloadform[export_<?=$odd_or_even?>]" name="downloadform[export][<?=$odd_or_even?>]" value="<?=$z?>" /></td>
32
+ <td><label for="downloadform[export_<?=$odd_or_even?>]"><?=$z?></label></td>
33
+ <td><?=date('m-d-Y h:i:s', filectime($fullpath))?></td>
34
+ <td><?=round((filesize($fullpath)/1000),1)?> Kb</td>
35
+ </tr>
36
+ <?php
37
+ $odd_or_even++;
38
+ }
39
+ }?>
40
+ <!-- <tr>
41
+ <td class="label"><?=$this->__('Field label')?> <span class="required">*</span></td>
42
+ <td class="input-ele"><input class="input-text required-entry" name="myform[myfield]" /></td>
43
+ </tr> -->
44
+ </table>
45
+ </form>
46
+ </div>
47
+ <script type="text/javascript">
48
+ var editForm = new varienForm('edit_form');
49
+ </script>
app/etc/modules/Mage_Downloadexports.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Mage_Downloadexports>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Mage_Downloadexports>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Downloadexports</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Creates a screen in the magento administration panel to download individual or zipped archives of exports.</summary>
10
+ <description>Summary
11
+
12
+ Creates a screen in the magento administration panel to download individual or zipped archives of exports. Select one or many of the export files created in var/export and download over the web, as opposed to needing to ssh or ftp into your site to retrieve them.
13
+
14
+ Once installed it is visible under the menu System &gt; Import/Export &gt; Download Exported Files
15
+
16
+
17
+
18
+ Installation
19
+
20
+ It is very important to chmod recursively the var directory in magento's document root to 0777. It's alright, the .htaccess on this directory will still prevent any unwanted eyes from downloading the files over the web.</description>
21
+ <notes>Nope.</notes>
22
+ <authors><author><name>Brad Zasada</name><user>auto-converted</user><email>zasadab03@gmail.com</email></author></authors>
23
+ <date>2010-11-29</date>
24
+ <time>21:08:57</time>
25
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="downloadexports.xml" hash="40af93bd0c91d7b258c2da9ccf3a49dc"/></dir><dir name="template"><dir name="downloadexports"><file name="exportview.phtml" hash="fd853dc26cd4e0f75decaa1aebb553dc"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Mage"><dir name="Downloadexports"><dir name="Block"><file name="Exportview.php" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ExportviewController.php" hash="7c4118ac03c06a46fdcade1520b14ded"/></dir></dir><dir name="etc"><file name="config.xml" hash="27c4206c0d0af124cb6e940a5098c582"/></dir><dir name="Helper"><file name="Data.php" hash="83c91780a78eb431619445de0a3c5284"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_Downloadexports.xml" hash="9cde0ce7caa45608e0de3052044d20ad"/></dir></target></contents>
26
+ <compatible/>
27
+ <dependencies/>
28
+ </package>