Version Notes
First review
Download this release
Release Info
Developer | Nam Nguyen |
Extension | NewsletterSend |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/M0/Newslettersend/Block/Adminhtml/Newsletter/Queue.php +73 -0
- app/code/local/M0/Newslettersend/controllers/Adminhtml/QueueController.php +67 -0
- app/code/local/M0/Newslettersend/etc/config.xml +79 -0
- app/design/adminhtml/default/default/template/newslettersend/queue/list.phtml +55 -0
- app/etc/modules/M0_NewsletterSend.xml +12 -0
- package.xml +18 -0
app/code/local/M0/Newslettersend/Block/Adminhtml/Newsletter/Queue.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 M0
|
22 |
+
* @package M0_NewsletterSend
|
23 |
+
* @copyright Copyright (c) 2010 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 |
+
/**
|
28 |
+
* Adminhtml queue grid block.
|
29 |
+
*
|
30 |
+
* @category M0
|
31 |
+
* @package M0_NewsletterSend
|
32 |
+
* @author magent0 <magent0.com>
|
33 |
+
*/
|
34 |
+
class M0_NewsletterSend_Block_Adminhtml_Newsletter_Queue extends Mage_Adminhtml_Block_Template
|
35 |
+
{
|
36 |
+
public function __construct()
|
37 |
+
{
|
38 |
+
|
39 |
+
$this->setTemplate('newslettersend/queue/list.phtml');
|
40 |
+
}
|
41 |
+
|
42 |
+
protected function _beforeToHtml()
|
43 |
+
{
|
44 |
+
$this->setChild('grid', $this->getLayout()->createBlock('adminhtml/newsletter_queue_grid', 'newsletter.queue.grid'));
|
45 |
+
return parent::_beforeToHtml();
|
46 |
+
}
|
47 |
+
|
48 |
+
protected function _prepareLayout()
|
49 |
+
{
|
50 |
+
$this->setChild('sendButton',
|
51 |
+
$this->getLayout()->createBlock('adminhtml/widget_button','send.button')
|
52 |
+
->setData(
|
53 |
+
array(
|
54 |
+
'label' => Mage::helper('newsletter')->__('Send Newsletter'),
|
55 |
+
'onclick' => 'queueController.sendNewsletter();'
|
56 |
+
)
|
57 |
+
)
|
58 |
+
);
|
59 |
+
|
60 |
+
return parent::_prepareLayout();
|
61 |
+
}
|
62 |
+
|
63 |
+
public function getSendButtonHtml()
|
64 |
+
{
|
65 |
+
return $this->getChildHtml('sendButton');
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getShowButtons()
|
69 |
+
{
|
70 |
+
return Mage::getResourceSingleton('newsletter/queue_collection')->getSize() > 0;
|
71 |
+
}
|
72 |
+
|
73 |
+
}
|
app/code/local/M0/Newslettersend/controllers/Adminhtml/QueueController.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2010 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 |
+
/**
|
28 |
+
* Newslettersend Adminhtml newsletter queue controller
|
29 |
+
*
|
30 |
+
* @category M0
|
31 |
+
* @package M0_NewsletterSend
|
32 |
+
* @author magent0 <magent0.com>
|
33 |
+
*/
|
34 |
+
class M0_Newslettersend_Adminhtml_QueueController extends Mage_Adminhtml_Controller_Action
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Queue list action
|
38 |
+
*/
|
39 |
+
public function indexAction()
|
40 |
+
{
|
41 |
+
if ($this->getRequest()->getQuery('ajax')) {
|
42 |
+
$countOfQueue = 3;
|
43 |
+
$countOfSubscritions = 20;
|
44 |
+
|
45 |
+
$collection = Mage::getModel('newsletter/queue')->getCollection()
|
46 |
+
->setPageSize($countOfQueue)
|
47 |
+
->setCurPage(1)
|
48 |
+
->addOnlyForSendingFilter()
|
49 |
+
->load();
|
50 |
+
|
51 |
+
$collection->walk('sendPerSubscriber', array($countOfSubscritions));
|
52 |
+
|
53 |
+
$this->_forward('grid');
|
54 |
+
return;
|
55 |
+
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Queue list Ajax action
|
61 |
+
*/
|
62 |
+
public function gridAction()
|
63 |
+
{
|
64 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('adminhtml/newsletter_queue_grid')->toHtml());
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
app/code/local/M0/Newslettersend/etc/config.xml
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<M0_Newslettersend>
|
5 |
+
<version>1.0</version>
|
6 |
+
</M0_Newslettersend>
|
7 |
+
</modules>
|
8 |
+
<admin>
|
9 |
+
<routers>
|
10 |
+
<newslettersend>
|
11 |
+
<use>admin</use>
|
12 |
+
<args>
|
13 |
+
<module>M0_Newslettersend</module>
|
14 |
+
<frontName>newslettersend</frontName>
|
15 |
+
</args>
|
16 |
+
</newslettersend>
|
17 |
+
</routers>
|
18 |
+
</admin>
|
19 |
+
<frontend>
|
20 |
+
<routers>
|
21 |
+
<sendnewsletter>
|
22 |
+
<use>standard</use>
|
23 |
+
<args>
|
24 |
+
<module>M0_Newslettersend</module>
|
25 |
+
<frontName>newslettersend</frontName>
|
26 |
+
</args>
|
27 |
+
</sendnewsletter>
|
28 |
+
</routers>
|
29 |
+
</frontend>
|
30 |
+
<adminhtml>
|
31 |
+
<acl>
|
32 |
+
<resources>
|
33 |
+
<all>
|
34 |
+
<title>Allow Everything</title>
|
35 |
+
</all>
|
36 |
+
<admin>
|
37 |
+
<children>
|
38 |
+
<M0_Newslettersend>
|
39 |
+
<title>newslettersend</title>
|
40 |
+
<sort_order>10</sort_order>
|
41 |
+
</M0_Newslettersend>
|
42 |
+
</children>
|
43 |
+
</admin>
|
44 |
+
</resources>
|
45 |
+
</acl>
|
46 |
+
</adminhtml>
|
47 |
+
<global>
|
48 |
+
<resources>
|
49 |
+
<newslettersend_setup>
|
50 |
+
<setup>
|
51 |
+
<module>M0_Newslettersend</module>
|
52 |
+
</setup>
|
53 |
+
<connection>
|
54 |
+
<use>core_setup</use>
|
55 |
+
</connection>
|
56 |
+
</newslettersend_setup>
|
57 |
+
<newslettersend_write>
|
58 |
+
<connection>
|
59 |
+
<use>core_write</use>
|
60 |
+
</connection>
|
61 |
+
</newslettersend_write>
|
62 |
+
<newslettersend_read>
|
63 |
+
<connection>
|
64 |
+
<use>core_read</use>
|
65 |
+
</connection>
|
66 |
+
</newslettersend_read>
|
67 |
+
</resources>
|
68 |
+
<blocks>
|
69 |
+
<adminhtml>
|
70 |
+
<rewrite>
|
71 |
+
<newsletter_queue>M0_Newslettersend_Block_Adminhtml_Newsletter_Queue</newsletter_queue>
|
72 |
+
</rewrite>
|
73 |
+
</adminhtml>
|
74 |
+
<newslettersend_adminhtml>
|
75 |
+
<class>M0_Newslettersend_Block_Adminhtml</class>
|
76 |
+
</newslettersend_adminhtml>
|
77 |
+
</blocks>
|
78 |
+
</global>
|
79 |
+
</config>
|
app/design/adminhtml/default/default/template/newslettersend/queue/list.phtml
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="content-header">
|
28 |
+
<table cellspacing="0">
|
29 |
+
<tr>
|
30 |
+
<td style="width:50%;"><h3 class="icon-head head-newsletter-queue"><?php echo Mage::helper('newsletter')->__('Newsletter Queue') ?></h3></td>
|
31 |
+
<?php if($this->getShowButtons()): ?>
|
32 |
+
<td class="form-buttons">
|
33 |
+
<?php echo $this->getSendButtonHtml(); ?>
|
34 |
+
</td>
|
35 |
+
<?php endif; ?>
|
36 |
+
</tr>
|
37 |
+
</table>
|
38 |
+
</div>
|
39 |
+
<div id="queue_update">
|
40 |
+
<?php echo $this->getChildHtml('grid') ?>
|
41 |
+
</div>
|
42 |
+
<script type="text/javascript">
|
43 |
+
<!--
|
44 |
+
var queueController = {
|
45 |
+
sendNewsletter: function () {
|
46 |
+
var url = "<?php echo $this->getUrl("newslettersend/adminhtml_queue/index/"); ?>";
|
47 |
+
new Ajax.Updater('', url + '?ajax=1', {onComplete:function(){ new Ajax.Updater('queueGrid', url + '?ajax=1',{onComplete:queueGridJsObject.initGrid.bind(queueGridJsObject)})
|
48 |
+
}});
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
varienGlobalEvents.attachEventHandler('gridRowClick', queueController.sendNewsletter.bind(queueController));
|
53 |
+
//-->
|
54 |
+
</script>
|
55 |
+
|
app/etc/modules/M0_NewsletterSend.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<M0_Newslettersend>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Newsletter />
|
9 |
+
</depends>
|
10 |
+
</M0_Newslettersend>
|
11 |
+
</modules>
|
12 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>NewsletterSend</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL 3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Send button for newsletters queue</summary>
|
10 |
+
<description>Send button for newsletters queue</description>
|
11 |
+
<notes>First review</notes>
|
12 |
+
<authors><author><name>Nam Nguyen</name><user>vniteam</user><email>vniteam@gmail.com</email></author></authors>
|
13 |
+
<date>2012-03-23</date>
|
14 |
+
<time>03:56:12</time>
|
15 |
+
<contents><target name="magelocal"><dir name="M0"><dir name="Newslettersend"><dir name="Block"><dir name="Adminhtml"><dir name="Newsletter"><file name="Queue.php" hash="1d3285641e0fb52fd2031a31a1446709"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="QueueController.php" hash="5cb369963434fab605a6beb0bfb6a9d9"/></dir></dir><dir name="etc"><file name="config.xml" hash="6d1d92975e4eb75b9fb14eb9b035fe86"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="M0_NewsletterSend.xml" hash="f6542c840a8430c5d69d653c7edbea38"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="newslettersend"><dir name="queue"><file name="list.phtml" hash="c64d71e6768ad445bab25eb9e3039bd2"/></dir></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|