DMK_Postman - Version 1.0.0

Version Notes

Erstes Stable-Release.

Download this release

Release Info

Developer Holger Lösken
Extension DMK_Postman
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (91) hide show
  1. app/code/local/DMK/Postman/Block/Adminhtml/Lists.php +53 -0
  2. app/code/local/DMK/Postman/Block/Adminhtml/Lists/Edit.php +94 -0
  3. app/code/local/DMK/Postman/Block/Adminhtml/Lists/Edit/Form.php +138 -0
  4. app/code/local/DMK/Postman/Block/Adminhtml/Lists/Grid.php +156 -0
  5. app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Queue.php +52 -0
  6. app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Queue/Grid.php +161 -0
  7. app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Sent.php +54 -0
  8. app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Sent/Grid.php +191 -0
  9. app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent.php +53 -0
  10. app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent/Edit.php +97 -0
  11. app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent/Edit/Form.php +79 -0
  12. app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent/Edit/Tab/General.php +102 -0
  13. app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent/Edit/Tab/Html.php +65 -0
  14. app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent/Edit/Tab/Text.php +74 -0
  15. app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent/Edit/Tabs.php +80 -0
  16. app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent/Grid.php +154 -0
  17. app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Export.php +20 -0
  18. app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Subscribers.php +53 -0
  19. app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Subscribers/Edit.php +117 -0
  20. app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Subscribers/Edit/Form.php +56 -0
  21. app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Subscribers/Edit/Tab/Lists.php +62 -0
  22. app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Subscribers/Edit/Tab/Main.php +113 -0
  23. app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Subscribers/Edit/Tabs.php +78 -0
  24. app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Subscribers/Grid.php +152 -0
  25. app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Testrecipients.php +53 -0
  26. app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Testrecipients/Edit.php +95 -0
  27. app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Testrecipients/Edit/Form.php +95 -0
  28. app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Testrecipients/Grid.php +123 -0
  29. app/code/local/DMK/Postman/Block/Adminhtml/Widget/Grid/Column/Renderer/Action.php +78 -0
  30. app/code/local/DMK/Postman/Block/Frontend/Newsletter/Registration.php +354 -0
  31. app/code/local/DMK/Postman/Helper/Data.php +36 -0
  32. app/code/local/DMK/Postman/Helper/Email.php +194 -0
  33. app/code/local/DMK/Postman/Model/Config/Source/Emailformat.php +17 -0
  34. app/code/local/DMK/Postman/Model/Email/Template.php +145 -0
  35. app/code/local/DMK/Postman/Model/Lists.php +163 -0
  36. app/code/local/DMK/Postman/Model/Mysql4/Lists.php +143 -0
  37. app/code/local/DMK/Postman/Model/Mysql4/Lists/Collection.php +143 -0
  38. app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Queue.php +48 -0
  39. app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Queue/Collection.php +47 -0
  40. app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Queuecontent.php +70 -0
  41. app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Queuecontent/Collection.php +47 -0
  42. app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Sent.php +49 -0
  43. app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Sent/Collection.php +47 -0
  44. app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Unsent.php +119 -0
  45. app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Unsent/Collection.php +47 -0
  46. app/code/local/DMK/Postman/Model/Mysql4/Subscribers/Import.php +127 -0
  47. app/code/local/DMK/Postman/Model/Mysql4/Subscribers/Subscribers.php +47 -0
  48. app/code/local/DMK/Postman/Model/Mysql4/Subscribers/Subscribers/Collection.php +47 -0
  49. app/code/local/DMK/Postman/Model/Mysql4/Subscribers/Testrecipients.php +47 -0
  50. app/code/local/DMK/Postman/Model/Mysql4/Subscribers/Testrecipients/Collection.php +48 -0
  51. app/code/local/DMK/Postman/Model/Newsletters/Queue.php +49 -0
  52. app/code/local/DMK/Postman/Model/Newsletters/Sent.php +59 -0
  53. app/code/local/DMK/Postman/Model/Newsletters/Unsent.php +121 -0
  54. app/code/local/DMK/Postman/Model/Observer.php +57 -0
  55. app/code/local/DMK/Postman/Model/Subscribers/Import.php +11 -0
  56. app/code/local/DMK/Postman/Model/Subscribers/Subscribers.php +200 -0
  57. app/code/local/DMK/Postman/Model/Subscribers/Testrecipients.php +124 -0
  58. app/code/local/DMK/Postman/Model/Variable/Config.php +51 -0
  59. app/code/local/DMK/Postman/controllers/ActivateController.php +168 -0
  60. app/code/local/DMK/Postman/controllers/Adminhtml/ListsController.php +227 -0
  61. app/code/local/DMK/Postman/controllers/Adminhtml/Newsletters/QueueController.php +133 -0
  62. app/code/local/DMK/Postman/controllers/Adminhtml/Newsletters/SentController.php +188 -0
  63. app/code/local/DMK/Postman/controllers/Adminhtml/Newsletters/UnsentController.php +364 -0
  64. app/code/local/DMK/Postman/controllers/Adminhtml/Subscribers/ExportController.php +38 -0
  65. app/code/local/DMK/Postman/controllers/Adminhtml/Subscribers/SubscribersController.php +266 -0
  66. app/code/local/DMK/Postman/controllers/Adminhtml/Subscribers/TestrecipientsController.php +255 -0
  67. app/code/local/DMK/Postman/controllers/DeactivateController.php +69 -0
  68. app/code/local/DMK/Postman/controllers/IndexController.php +294 -0
  69. app/code/local/DMK/Postman/etc/adminhtml.xml +152 -0
  70. app/code/local/DMK/Postman/etc/config.xml +238 -0
  71. app/code/local/DMK/Postman/etc/system.xml +275 -0
  72. app/code/local/DMK/Postman/sql/postman_setup/mysql4-install-0.1.0.php +164 -0
  73. app/design/adminhtml/default/default/template/postman/dialogbox.phtml +3 -0
  74. app/etc/modules/DMK_Postman.xml +37 -0
  75. app/locale/de_DE/DMK_Postman.csv +148 -0
  76. package.xml +18 -0
  77. skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  78. skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  79. skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  80. skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  81. skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  82. skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  83. skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  84. skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  85. skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  86. skin/adminhtml/default/default/jquery-ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  87. skin/adminhtml/default/default/jquery-ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  88. skin/adminhtml/default/default/jquery-ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
  89. skin/adminhtml/default/default/jquery-ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  90. skin/adminhtml/default/default/jquery-ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  91. skin/adminhtml/default/default/jquery-ui-lightness/jquery-ui-1.8.16.custom.css +568 -0
app/code/local/DMK/Postman/Block/Adminhtml/Lists.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Mailing lists
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Lists
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Mailing lists
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Lists extends Mage_Adminhtml_Block_Widget_Grid_Container
36
+ {
37
+ /**
38
+ * Method to initialize the grid container settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ $this->_controller = 'adminhtml_lists';
45
+ $this->_blockGroup = 'postman';
46
+ $this->_headerText = Mage::helper('postman')->__('Mailing lists');
47
+
48
+ parent::__construct();
49
+
50
+ $this->_updateButton('add', 'label', Mage::helper('postman')->__('Add mailing list'));
51
+ }
52
+
53
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Lists/Edit.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Mailing lists
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Lists Edit
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Mailing lists
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Lists_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
36
+ {
37
+ /**
38
+ * Method to initialize the form settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+ $this->_objectId = 'list_id';
46
+ $this->_blockGroup = 'postman';
47
+ $this->_controller = 'adminhtml_lists';
48
+
49
+ $this->_addButton('saveandcontinue', array(
50
+ 'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
51
+ 'onclick' => 'saveAndContinueEdit()',
52
+ 'class' => 'save',
53
+ ), -100);
54
+
55
+ $this->_formScripts[] = "
56
+ function saveAndContinueEdit(){
57
+ editForm.submit($('edit_form').action+'back/edit/');
58
+ }
59
+ ";
60
+
61
+ $this->addButton('delete', array(
62
+ 'label' => Mage::helper('postman')->__('Delete'),
63
+ 'onclick' => 'deleteConfirm(\'' . Mage::helper('adminhtml')->__('Are you sure you want to do this?') . '\', \'' . $this->getDeleteUrl() .'\')',
64
+ 'class' => 'delete'
65
+ ), 1);
66
+ }
67
+
68
+ /**
69
+ * Method to get the header text
70
+ *
71
+ * @access public
72
+ * @return string Header text
73
+ */
74
+ public function getHeaderText()
75
+ {
76
+ if( Mage::registry('list_data') && Mage::registry('list_data')->getId() ) {
77
+ return Mage::helper('postman')->__("Edit mailing list '%s'", $this->htmlEscape(Mage::registry('list_data')->getListTitle()));
78
+ } else {
79
+ return Mage::helper('postman')->__('New mailing list');
80
+ }
81
+ }
82
+
83
+ /**
84
+ * Method to get the delete url
85
+ *
86
+ * @access public
87
+ * @return string delete url
88
+ */
89
+ public function getDeleteUrl()
90
+ {
91
+ return $this->getUrl('*/adminhtml_lists/delete',
92
+ array($this->_objectId => $this->getRequest()->getParam($this->_objectId)));
93
+ }
94
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Lists/Edit/Form.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Mailing lists
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Lists Edit Form
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Mailing lists
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Lists_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+ /**
38
+ * Method to prepare edit form
39
+ *
40
+ * @access protected
41
+ * @return DMK_Postman_Block_Adminhtml_Lists_Edit_Form
42
+ */
43
+ protected function _prepareForm()
44
+ {
45
+
46
+ $model = Mage::registry('list_data');
47
+
48
+ $form = new Varien_Data_Form(array(
49
+ 'id' => 'edit_form',
50
+ 'action' => $this->getUrl('*/*/save', array('list_id' => $this->getRequest()->getParam('list_id'))),
51
+ 'method' => 'post',
52
+ )
53
+ );
54
+
55
+ $fieldset = $form->addFieldset('edit_answer_form', array('legend' => Mage::helper('postman')->__('Edit mailing list')));
56
+
57
+ $fieldset->addField('list_title', 'text', array(
58
+ 'name' => 'list_title',
59
+ 'title' => Mage::helper('postman')->__('Title'),
60
+ 'label' => Mage::helper('postman')->__('Title'),
61
+ 'required' => true,
62
+ 'class' => 'required-entry',
63
+ )
64
+ );
65
+
66
+ $fieldset->addField('list_description', 'textarea', array(
67
+ 'name' => 'list_description',
68
+ 'title' => Mage::helper('postman')->__('Description'),
69
+ 'label' => Mage::helper('postman')->__('Description'),
70
+ 'style' => 'width: 98%; height: 100px;',
71
+ )
72
+ );
73
+
74
+ $fieldset->addField('is_active', 'select', array(
75
+ 'label' => Mage::helper('postman')->__('Status'),
76
+ 'title' => Mage::helper('postman')->__('Status'),
77
+ 'name' => 'is_active',
78
+ 'options' => array(
79
+ '1' => Mage::helper('postman')->__('Enabled'),
80
+ '0' => Mage::helper('postman')->__('Disabled'),
81
+ ),
82
+ ));
83
+
84
+ if (!Mage::app()->isSingleStoreMode()) {
85
+ $fieldset->addField('store_ids', 'multiselect', array(
86
+ 'name' => 'store_ids[]',
87
+ 'label' => Mage::helper('postman')->__('Store view'),
88
+ 'title' => Mage::helper('postman')->__('Store view'),
89
+ 'required' => true,
90
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
91
+ 'value' => $model->getStoreIds()
92
+ ));
93
+ }
94
+ else {
95
+ $fieldset->addField('store_ids', 'hidden', array(
96
+ 'name' => 'store_ids[]',
97
+ 'value' => Mage::app()->getStore(true)->getId()
98
+ ));
99
+ $model->setStoreIds(Mage::app()->getStore(true)->getId());
100
+ }
101
+
102
+ $customerGroups = Mage::getResourceModel('customer/group_collection')
103
+ ->load()->toOptionArray();
104
+
105
+ $found = false;
106
+ foreach ($customerGroups as $group) {
107
+ if ($group['value']==0) {
108
+ $found = true;
109
+ }
110
+ }
111
+ if (!$found) {
112
+ array_unshift($customerGroups, array('value'=>0, 'label'=>Mage::helper('salesrule')->__('NOT LOGGED IN')));
113
+ }
114
+ /*
115
+ $fieldset->addField('customer_group_ids', 'multiselect', array(
116
+ 'name' => 'customer_group_ids[]',
117
+ 'label' => Mage::helper('postman')->__('Customer groups'),
118
+ 'title' => Mage::helper('postman')->__('Customer groups'),
119
+ 'required' => true,
120
+ 'values' => $customerGroups,
121
+ 'value' => $model->getCustomerGroupIds()
122
+ ));
123
+ */
124
+
125
+ if ($model->getId()) {
126
+ $fieldset->addField('list_id', 'hidden', array(
127
+ 'name' => 'list_id',
128
+ ));
129
+ }
130
+
131
+ $form->setValues($model->getData());
132
+ $form->setUseContainer(true);
133
+ $this->setForm($form);
134
+ return parent::_prepareForm();
135
+ }
136
+
137
+
138
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Lists/Grid.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Mailing lists
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Lists Grid
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Mailing lists
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Lists_Grid extends Mage_Adminhtml_Block_Widget_Grid
36
+ {
37
+ /**
38
+ * Method to initialize the grid settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+ $this->setId('dmk_postman_list_lists');
46
+ $this->setDefaultSort('lt.list_id');
47
+ $this->setDefaultDir('ASC');
48
+ $this->setSaveParametersInSession(true);
49
+ }
50
+
51
+ /**
52
+ * Method to prepare the mailing lists collection
53
+ *
54
+ * @access protected
55
+ * @return DMK_Postman_Block_Adminhtml_Lists_Grid
56
+ */
57
+ protected function _prepareCollection()
58
+ {
59
+ $joinTable = Mage::getSingleton('core/resource')->getTableName('postman/postman_subscribers_lists');
60
+ $collection = Mage::getResourceModel('postman/lists_collection');
61
+ $collection->getSelect()
62
+ ->joinLeft( array('lt' => $joinTable),
63
+ 'main_table.list_id = lt.list_id')
64
+ ->columns(array('COUNT(lt.subscriber_id) AS subscriber_lists_count'))
65
+ ->group('main_table.list_id');
66
+ $this->setCollection($collection);
67
+ parent::_prepareCollection();
68
+
69
+ if (!Mage::app()->isSingleStoreMode()) {
70
+ $this->getCollection()->addStoreData();
71
+ }
72
+
73
+ return $this;
74
+ }
75
+
76
+ /**
77
+ * Method to prepare the grid columns
78
+ *
79
+ * @access protected
80
+ * @return DMK_Postman_Block_Adminhtml_Lists_Grid
81
+ */
82
+ protected function _prepareColumns()
83
+ {
84
+ $this->addColumn('list_id', array(
85
+ 'header' => Mage::helper('postman')->__('ID'),
86
+ 'align' => 'right',
87
+ 'width' => '50px',
88
+ 'index' => 'list_id',
89
+ )
90
+ );
91
+
92
+ $this->addColumn('list_title', array(
93
+ 'header' => Mage::helper('postman')->__('Title'),
94
+ 'align' => 'left',
95
+ 'width' => '250px',
96
+ 'index' => 'list_title',
97
+ )
98
+ );
99
+
100
+ $this->addColumn('list_description', array(
101
+ 'header' => Mage::helper('postman')->__('Description'),
102
+ 'align' => 'left',
103
+ 'index' => 'list_description',
104
+ 'sortable' => false,
105
+ )
106
+ );
107
+
108
+ if (!Mage::app()->isSingleStoreMode()) {
109
+ $this->addColumn('visible_in', array(
110
+ 'header' => Mage::helper('postman')->__('Visible in'),
111
+ 'index' => 'stores',
112
+ 'type' => 'store',
113
+ 'width' => '250px',
114
+ 'store_all' => true,
115
+ 'store_view' => true,
116
+ 'sortable' => false,
117
+ ));
118
+ }
119
+
120
+ $this->addColumn('is_active', array(
121
+ 'header' => Mage::helper('postman')->__('Status'),
122
+ 'align' => 'left',
123
+ 'width' => '150px',
124
+ 'index' => 'is_active',
125
+ 'type' => 'options',
126
+ 'options' => array(
127
+ 0 => Mage::helper('postman')->__('Disabled'),
128
+ 1 => Mage::helper('postman')->__('Enabled'),
129
+ )
130
+ )
131
+ );
132
+
133
+ $this->addColumn('list_subscribers', array(
134
+ 'header' => Mage::helper('postman')->__('# subscribers'),
135
+ 'align' => 'left',
136
+ 'width' => '50px',
137
+ 'index' => 'subscriber_lists_count',
138
+ )
139
+ );
140
+
141
+ return parent::_prepareColumns();
142
+ }
143
+
144
+ /**
145
+ * Method to get the row edit url
146
+ *
147
+ * @access public
148
+ * @param ???
149
+ * @return string Edit url
150
+ */
151
+ public function getRowUrl($row)
152
+ {
153
+ return $this->getUrl('*/*/edit', array('list_id'=>$row->getId()));
154
+ }
155
+
156
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Queue.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Newsletters Queue
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Newsletters_Queue extends Mage_Adminhtml_Block_Widget_Grid_Container
36
+ {
37
+ /**
38
+ * Method to initialize the grid container settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ $this->_controller = 'adminhtml_newsletters_queue';
45
+ $this->_blockGroup = 'postman';
46
+ $this->_headerText = Mage::helper('postman')->__('Newsletters queue');
47
+
48
+ parent::__construct();
49
+
50
+ $this->_removeButton('add');
51
+ }
52
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Queue/Grid.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Newsletters Queue Grid
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Newsletters_Queue_Grid extends Mage_Adminhtml_Block_Widget_Grid
36
+ {
37
+ /**
38
+ * Method to initialize the grid settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+ $this->setId('dmk_postman_list_newsletters_queue');
46
+ $this->setDefaultSort('newsletter_id');
47
+ $this->setDefaultDir('ASC');
48
+ $this->setSaveParametersInSession(true);
49
+ }
50
+
51
+ /**
52
+ * Method to prepare the collection for unsent mailings
53
+ *
54
+ * @access protected
55
+ * @return DMK_Postman_Block_Adminhtml_Newsletters_Queue_Grid
56
+ */
57
+ protected function _prepareCollection()
58
+ {
59
+ $collection = Mage::getResourceModel('postman/newsletters_queue_collection');
60
+ $this->setCollection($collection);
61
+ return parent::_prepareCollection();
62
+ }
63
+
64
+ /**
65
+ * Method to prepare the grid columns
66
+ *
67
+ * @access protected
68
+ * @return DMK_Postman_Block_Adminhtml_Newsletters_Queue_Grid
69
+ */
70
+ protected function _prepareColumns()
71
+ {
72
+ $this->addColumn('sendmailqueue_id', array(
73
+ 'header' => Mage::helper('postman')->__('ID'),
74
+ 'align' => 'right',
75
+ 'width' => '50px',
76
+ 'index' => 'sendmailqueue_id',
77
+ )
78
+ );
79
+
80
+ $this->addColumn('sendmailcontent_id', array(
81
+ 'header' => Mage::helper('postman')->__('Newsletter ID'),
82
+ 'align' => 'left',
83
+ 'width' => '50px',
84
+ 'index' => 'sendmailcontent_id',
85
+ )
86
+ );
87
+
88
+ $this->addColumn('subscriber_name', array(
89
+ 'header' => Mage::helper('postman')->__('Name'),
90
+ 'align' => 'left',
91
+ 'index' => 'subscriber_name',
92
+ )
93
+ );
94
+
95
+ $this->addColumn('subscriber_email', array(
96
+ 'header' => Mage::helper('postman')->__('E-mail'),
97
+ 'align' => 'left',
98
+ 'index' => 'subscriber_email',
99
+ )
100
+ );
101
+
102
+ $this->addColumn('subscriber_emailformat', array(
103
+ 'header' => Mage::helper('postman')->__('E-mail format'),
104
+ 'align' => 'left',
105
+ 'width' => '80px',
106
+ 'index' => 'subscriber_emailformat',
107
+ 'type' => 'options',
108
+ 'options' => array(
109
+ 0 => Mage::helper('postman')->__('Text'),
110
+ 1 => Mage::helper('postman')->__('Html'),
111
+ )
112
+ )
113
+ );
114
+
115
+ $this->addColumn('sendmailqueue_trial', array(
116
+ 'header' => Mage::helper('postman')->__('Sending trials'),
117
+ 'align' => 'left',
118
+ 'width' => '50px',
119
+ 'index' => 'sendmailqueue_trial',
120
+ )
121
+ );
122
+
123
+ $this->addColumn('action', array(
124
+ 'header' => Mage::helper('postman')->__('Action'),
125
+ 'width' => '200',
126
+ 'align' => 'left',
127
+ 'type' => 'action',
128
+ 'getter' => 'getId',
129
+ 'actions' => array(
130
+ array(
131
+ 'caption' => Mage::helper('postman')->__('Delete mailing'),
132
+ 'url' => array('base' => '*/*/delete'),
133
+ 'field' => 'sendmailqueue_id',
134
+ ),
135
+ array(
136
+ 'caption' => Mage::helper('postman')->__('Reset sending trials'),
137
+ 'url' => array('base' => '*/*/resetTrials'),
138
+ 'field' => 'sendmailqueue_id',
139
+ ),
140
+ ),
141
+ 'filter' => false,
142
+ 'sortable' => false,
143
+ 'is_system' => true,
144
+ )
145
+ );
146
+
147
+ return parent::_prepareColumns();
148
+ }
149
+
150
+ /**
151
+ * Method to get the row edit url - no editing possible
152
+ *
153
+ * @access public
154
+ * @param object $row
155
+ * @return boolean false
156
+ */
157
+ public function getRowUrl($row)
158
+ {
159
+ return false;
160
+ }
161
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Sent.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Newsletters Sent
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Newsletters_Sent extends Mage_Adminhtml_Block_Widget_Grid_Container
36
+ {
37
+ /**
38
+ * Method to initialize the grid container settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ $this->_controller = 'adminhtml_newsletters_sent';
45
+ $this->_blockGroup = 'postman';
46
+ $this->_headerText = Mage::helper('postman')->__('Newsletters sent');
47
+
48
+ parent::__construct();
49
+
50
+ $this->_removeButton('add');
51
+
52
+ }
53
+
54
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Sent/Grid.php ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Newsletters Send Grid
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Newsletters_Sent_Grid extends Mage_Adminhtml_Block_Widget_Grid
36
+ {
37
+ /**
38
+ * Method to initialize the grid settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+ $this->setId('dmk_postman_list_newsletters_sent');
46
+ $this->setDefaultSort('newsletter_id');
47
+ $this->setDefaultDir('ASC');
48
+ $this->setSaveParametersInSession(true);
49
+ }
50
+
51
+ /**
52
+ * Method to prepare the collection for sent newsletters
53
+ *
54
+ * @access protected
55
+ * @return DMK_Postman_Block_Adminhtml_Newsletters_Sent_Grid
56
+ */
57
+ protected function _prepareCollection()
58
+ {
59
+ $joinTable = Mage::getSingleton('core/resource')->getTableName('admin/user/table');
60
+ $collection = Mage::getResourceModel('postman/newsletters_sent_collection')
61
+ ->addFieldToFilter(array('newsletter_mailing_date'),
62
+ array(array('neq'=>'0000-00-00 00:00:00')));
63
+ $collection->getSelect()
64
+ ->joinLeft( array('au' => $joinTable),
65
+ 'main_table.newsletter_author = au.user_id',
66
+ array('au.firstname','au.lastname'))
67
+ ->columns(array('CONCAT_WS(" ", au.firstname, au.lastname) AS fullname'));
68
+
69
+ $this->setCollection($collection);
70
+ //print($collection->getSelectSql());
71
+ return parent::_prepareCollection();
72
+ }
73
+
74
+ /**
75
+ * Method to prepare the grid columns
76
+ *
77
+ * @access protected
78
+ * @return DMK_Postman_Block_Adminhtml_Newsletters_Sent_Grid
79
+ */
80
+ protected function _prepareColumns()
81
+ {
82
+ //$collection = Mage::getModel('postman/newsletters_sent_collection')->getCollection();
83
+
84
+
85
+ $this->addColumn('newsletter_id', array(
86
+ 'header' => Mage::helper('postman')->__('ID'),
87
+ 'align' => 'right',
88
+ 'width' => '50px',
89
+ 'index' => 'newsletter_id',
90
+ )
91
+ );
92
+
93
+ $this->addColumn('newsletter_subject', array(
94
+ 'header' => Mage::helper('postman')->__('Subject'),
95
+ 'align' => 'left',
96
+ 'index' => 'newsletter_subject',
97
+ )
98
+ );
99
+
100
+ $this->addColumn('newsletter_mailing_date', array(
101
+ 'header' => Mage::helper('postman')->__('Mailing date'),
102
+ 'align' => 'left',
103
+ 'width' => '200px',
104
+ 'index' => 'newsletter_mailing_date',
105
+ 'type' => 'datetime',
106
+ )
107
+ );
108
+
109
+ $this->addColumn('newsletter_author', array(
110
+ 'header' => Mage::helper('postman')->__('Author'),
111
+ 'align' => 'left',
112
+ 'width' => '200px',
113
+ 'index' => 'newsletter_author',
114
+ 'format' => '$fullname',
115
+ 'filter' => false,
116
+ 'sortable' => false,
117
+ 'filter_condition_callback' => array($this, '_customerNameCondition')
118
+ )
119
+ );
120
+
121
+ $this->addColumn('is_active', array(
122
+ 'header' => Mage::helper('postman')->__('Status'),
123
+ 'align' => 'left',
124
+ 'width' => '150px',
125
+ 'index' => 'is_active',
126
+ 'filter_index' => 'main_table.is_active',
127
+ 'type' => 'options',
128
+ 'options' => array(
129
+ 0 => Mage::helper('postman')->__('Disabled'),
130
+ 1 => Mage::helper('postman')->__('Enabled'),
131
+ )
132
+ )
133
+ );
134
+
135
+ $this->addColumn('action', array(
136
+ 'header' => Mage::helper('postman')->__('Action'),
137
+ 'width' => '200',
138
+ 'align' => 'left',
139
+ 'type' => 'action',
140
+ 'getter' => 'getId',
141
+ 'actions' => array(
142
+ array(
143
+ 'caption' => Mage::helper('postman')->__('Copy newsletter'),
144
+ 'url' => array('base' => '*/*/copy'),
145
+ 'field' => 'newsletter_id',
146
+ ),
147
+ array(
148
+ //TODO Aktion abhängig vom is_active-Zustand ausgeben
149
+ 'caption' => Mage::helper('postman')->__('Enable newsletter'),
150
+ 'url' => array('base' => '*/*/enabledisable',
151
+ 'params'=>array('enable_newsletter'=>'1')),
152
+ 'field' => 'newsletter_id',
153
+ 'condition' => array('data'=>'is_active', 'operator'=>'eq', 'value'=>'1')
154
+ ),
155
+ array(
156
+ //TODO Aktion abhängig vom is_active-Zustand ausgeben
157
+ 'caption' => Mage::helper('postman')->__('Disable newsletter'),
158
+ 'url' => array('base' => '*/*/enabledisable',
159
+ 'params'=>array('enable_newsletter'=>'0')),
160
+ 'field' => 'newsletter_id',
161
+ 'condition' => array('data'=>'is_active', 'operator'=>'eq', 'value'=>'0')
162
+ ),
163
+ ),
164
+ 'filter' => false,
165
+ 'sortable' => false,
166
+ 'is_system' => true,
167
+ )
168
+ );
169
+
170
+ return parent::_prepareColumns();
171
+ }
172
+
173
+ /**
174
+ * Method to get the row edit url - no editing possible
175
+ *
176
+ * @access public
177
+ * @param object $row
178
+ * @return boolean false
179
+ */
180
+ public function getRowUrl($row)
181
+ {
182
+ return false;
183
+ }
184
+
185
+
186
+
187
+ protected function _customerNameCondition()
188
+ {
189
+
190
+ }
191
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Newsletters Unsent
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Newsletters_Unsent extends Mage_Adminhtml_Block_Widget_Grid_Container
36
+ {
37
+ /**
38
+ * Method to initialize the grid container settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ $this->_controller = 'adminhtml_newsletters_unsent';
45
+ $this->_blockGroup = 'postman';
46
+ $this->_headerText = Mage::helper('postman')->__('Newsletters unsent');
47
+
48
+ parent::__construct();
49
+
50
+ $this->_updateButton('add', 'label', Mage::helper('postman')->__('Add newsletter'));
51
+ }
52
+
53
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent/Edit.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Newsletters Unsent Edit
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Newsletters_Unsent_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
36
+ {
37
+ /**
38
+ * Method to initialize the form settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+
46
+ $this->_objectId = 'newsletter_id';
47
+ $this->_blockGroup = 'postman';
48
+ $this->_controller = 'adminhtml_newsletters_unsent';
49
+
50
+
51
+ $this->_addButton('saveandcontinue', array(
52
+ 'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
53
+ 'onclick' => 'saveAndContinueEdit()',
54
+ 'class' => 'save',
55
+ ), -100);
56
+
57
+ $this->_formScripts[] = "
58
+ function saveAndContinueEdit(){
59
+ editForm.submit($('edit_form').action+'back/edit/');
60
+ }
61
+ ";
62
+
63
+ $this->addButton('delete', array(
64
+ 'label' => Mage::helper('postman')->__('Delete'),
65
+ 'onclick' => 'deleteConfirm(\'' . Mage::helper('adminhtml')->__('Are you sure you want to do this?') . '\', \'' . $this->getDeleteUrl() .'\')',
66
+ 'class' => 'delete'
67
+ ), 1);
68
+
69
+ }
70
+
71
+ /**
72
+ * Method to get the header text
73
+ *
74
+ * @access public
75
+ * @return string Header text???
76
+ */
77
+ public function getHeaderText()
78
+ {
79
+ if( Mage::registry('newsletter_unsent_data') && Mage::registry('newsletter_unsent_data')->getId() ) {
80
+ return Mage::helper('postman')->__("Edit newsletter '%s'", $this->htmlEscape(Mage::registry('newsletter_unsent_data')->getNewsletterSubject()));
81
+ } else {
82
+ return Mage::helper('postman')->__('New newsletter');
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Method to get the delete url
88
+ *
89
+ * @access public
90
+ * @return string delete url
91
+ */
92
+ public function getDeleteUrl()
93
+ {
94
+ return $this->getUrl('*/adminhtml_newsletters_unsent/delete',array($this->_objectId => $this->getRequest()->getParam($this->_objectId)));
95
+ }
96
+
97
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent/Edit/Form.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Newsletters Unsent Edit Form
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Newsletters_Unsent_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+ /**
38
+ * Method to prepare the layout for the wysiwyg editor
39
+ *
40
+ * @access protected
41
+ * @return DMK_Postman_Block_Adminhtml_Newsletters_Unsent_Edit_Form???
42
+ */
43
+ protected function _prepareLayout()
44
+ {
45
+ if ($head = $this->getLayout()->getBlock('head')) {
46
+ $head->addItem('js', 'prototype/window.js')
47
+ ->addItem('js_css', 'prototype/windows/themes/default.css')
48
+ ->addItem('js_css', 'prototype/windows/themes/magento.css')
49
+ ->addItem('js', 'mage/adminhtml/variables.js')
50
+ ->addItem('js', 'mage/adminhtml/wysiwyg/widget.js');
51
+ }
52
+
53
+ parent::_prepareLayout();
54
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
55
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Method to prepare edit form
61
+ *
62
+ * @access protected
63
+ * @return DMK_Postman_Block_Adminhtml_Newsletters_Unsent_Edit_Form
64
+ */
65
+ protected function _prepareForm()
66
+ {
67
+ $form = new Varien_Data_Form(array(
68
+ 'id' => 'edit_form',
69
+ 'action' => $this->getUrl('*/*/save', array('newsletter_id' => $this->getRequest()->getParam('newsletter_id'))),
70
+ 'method' => 'post',
71
+ )
72
+ );
73
+
74
+ $form->setUseContainer(true);
75
+ $this->setForm($form);
76
+ return parent::_prepareForm();
77
+ }
78
+
79
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent/Edit/Tab/General.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Newsletters Unsent Edit Tab General
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Newsletters_Unsent_Edit_Tab_General extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+ /**
38
+ * Method to prepare edit form
39
+ *
40
+ * @access protected
41
+ * @return DMK_Postman_Block_Adminhtml_Newsletters_Unsent_Edit_Tab_General
42
+ */
43
+ protected function _prepareForm()
44
+ {
45
+
46
+ $model = Mage::registry('newsletter_unsent_data');
47
+
48
+ $form = new Varien_Data_Form();
49
+
50
+
51
+ $fieldset = $form->addFieldset('newsletters_form', array('legend'=>Mage::helper('postman')->__('Newsletter details')));
52
+ /*
53
+ $fieldset->addField('newsletter_sender_name', 'text', array(
54
+ 'label' => Mage::helper('postman')->__('Sender name'),
55
+ 'class' => 'required-entry',
56
+ 'required' => true,
57
+ 'name' => 'newsletter_sender_name',
58
+ ));
59
+
60
+ $fieldset->addField('newsletter_sender_email', 'text', array(
61
+ 'label' => Mage::helper('postman')->__('Sender e-mail'),
62
+ 'class' => 'required-entry',
63
+ 'required' => true,
64
+ 'name' => 'newsletter_sender_email',
65
+ ));
66
+
67
+ $fieldset->addField('newsletter_reply_email', 'text', array(
68
+ 'label' => Mage::helper('postman')->__('Reply e-mail'),
69
+ 'class' => 'required-entry',
70
+ 'required' => true,
71
+ 'name' => 'newsletter_reply_email',
72
+ ));
73
+ */
74
+ $fieldset->addField('newsletter_subject', 'text', array(
75
+ 'label' => Mage::helper('postman')->__('Subject'),
76
+ 'class' => 'required-entry',
77
+ 'required' => true,
78
+ 'name' => 'newsletter_subject',
79
+ ));
80
+
81
+
82
+ $fieldset = $form->addFieldset('newsletters_form_lists', array('legend'=>Mage::helper('postman')->__('Mailing lists')));
83
+
84
+ $fieldset->addField('store_id', 'multiselect', array(
85
+ 'name' => 'lists[]',
86
+ 'label' => Mage::helper('postman')->__('Mailing lists'),
87
+ 'title' => Mage::helper('postman')->__('Mailing lists'),
88
+ // 'required' => true,
89
+ 'values' => Mage::getSingleton('postman/subscribers_subscribers')->getListValuesForForm(true),
90
+ ));
91
+
92
+ if ($model->getId()) {
93
+ $fieldset->addField('newsletter_id', 'hidden', array(
94
+ 'name' => 'newsletter_id',
95
+ ));
96
+ }
97
+
98
+ $form->setValues($model->getData());
99
+ $this->setForm($form);
100
+ return parent::_prepareForm(); }
101
+ }
102
+
app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent/Edit/Tab/Html.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Newsletters Unsent Edit Tab Html
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Newsletters_Unsent_Edit_Tab_Html extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+ /**
38
+ * Method to prepare edit form
39
+ *
40
+ * @access protected
41
+ * @return DMK_Postman_Block_Adminhtml_Newsletters_Unsent_Edit_Tab_Html
42
+ */
43
+ protected function _prepareForm()
44
+ {
45
+ $model = Mage::registry('newsletter_unsent_data');
46
+ $form = new Varien_Data_Form();
47
+
48
+ $wysiwygCfg = Mage::getSingleton('cms/wysiwyg_config')->getConfig();
49
+ $wysiwygCfg->setData('widget_window_url', Mage::getSingleton('adminhtml/url')
50
+ ->getUrl('adminhtml/widget/index'));
51
+
52
+ $fieldset = $form->addFieldset('newsletters_form_html', array('legend'=>Mage::helper('postman')->__('Html version')));
53
+ $fieldset->addField('newsletter_html_version','editor', array(
54
+ 'name' => 'newsletter_html_version',
55
+ 'label' => Mage::helper('postman')->__('Html version'),
56
+ 'style' => 'width:98%; height:250px;',
57
+ 'config' => $wysiwygCfg,
58
+ 'wysiwyg' => true,
59
+ 'required' => true,
60
+ ));
61
+
62
+ $form->setValues($model->getData());
63
+ $this->setForm($form);
64
+ return parent::_prepareForm(); }
65
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent/Edit/Tab/Text.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Newsletters Unsent Edit Tab Text
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Newsletters_Unsent_Edit_Tab_Text extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+ /**
38
+ * Method to prepare edit form
39
+ *
40
+ * @access protected
41
+ * @return DMK_Postman_Block_Adminhtml_Newsletters_Unsent_Edit_Tab_Text
42
+ */
43
+ protected function _prepareForm()
44
+ {
45
+
46
+ $model = Mage::registry('newsletter_unsent_data');
47
+
48
+ $form = new Varien_Data_Form();
49
+
50
+ $fieldset = $form->addFieldset('newsletters_form_text', array('legend'=>Mage::helper('postman')->__('Text version')));
51
+
52
+ // TODO schauen, warum "Add variables nicht ausgegeben wird
53
+ $widgetFilters = array('is_email_compatible' => 1);
54
+ $wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array(
55
+ 'add_widgets' => false,
56
+ 'add_images' => false,
57
+ 'add_variables' => true,
58
+ 'widget_filters' => $widgetFilters
59
+ ));
60
+
61
+ $fieldset->addField('newsletter_text_version','editor', array(
62
+ 'name' => 'newsletter_text_version',
63
+ 'label' => Mage::helper('postman')->__('Text version'),
64
+ 'style' => 'width:500px; height:250px;',
65
+ 'config' => $wysiwygConfig,
66
+ 'wysiwyg' => false,
67
+ 'required' => true,
68
+ ));
69
+
70
+ $form->setValues($model->getData());
71
+ $this->setForm($form);
72
+ return parent::_prepareForm();
73
+ }
74
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent/Edit/Tabs.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Newsletters Unsent Edit Tabs
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Newsletters_Unsent_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
36
+ {
37
+ /**
38
+ * Constructor
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+ $this->setId('newsletters_unsent_tabs');
46
+ $this->setDestElementId('edit_form');
47
+ $this->setTitle(Mage::helper('postman')->__('Newsletter'));
48
+ }
49
+
50
+ /**
51
+ * Method to set the tabs
52
+ *
53
+ * @access protected
54
+ * @return DMK_Postman_Block_Adminhtml_Newsletters_Unsent_Edit_Tabs
55
+ */
56
+ protected function _beforeToHtml()
57
+ {
58
+ $this->addTab('general_section', array(
59
+ 'label' => Mage::helper('postman')->__('General'),
60
+ 'title' => Mage::helper('postman')->__('General'),
61
+ 'content' => $this->getLayout()->createBlock('postman/adminhtml_newsletters_unsent_edit_tab_general')->toHtml(),
62
+ ))
63
+ ;
64
+
65
+ $this->addTab('html_section', array(
66
+ 'label' => Mage::helper('postman')->__('Html version'),
67
+ 'title' => Mage::helper('postman')->__('Html version'),
68
+ 'content' => $this->getLayout()->createBlock('postman/adminhtml_newsletters_unsent_edit_tab_html')->toHtml(),
69
+ ));
70
+
71
+ $this->addTab('text_section', array(
72
+ 'label' => Mage::helper('postman')->__('Text version'),
73
+ 'title' => Mage::helper('postman')->__('Text version'),
74
+ 'content' => $this->getLayout()->createBlock('postman/adminhtml_newsletters_unsent_edit_tab_text')->toHtml(),
75
+ 'active' => ( $this->getRequest()->getParam('tab') == 'text_section' ) ? true : false,
76
+ ));
77
+
78
+ return parent::_beforeToHtml();
79
+ }
80
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Newsletters/Unsent/Grid.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Newsletters Unsent Grid
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Newsletters_Unsent_Grid extends Mage_Adminhtml_Block_Widget_Grid
36
+ {
37
+ /**
38
+ * Method to initialize the grid settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+ $this->setId('dmk_postman_list_newsletters_unsent');
46
+ $this->setDefaultSort('newsletter_id');
47
+ $this->setDefaultDir('ASC');
48
+ $this->setSaveParametersInSession(true);
49
+ }
50
+
51
+ /**
52
+ * Method to prepare the collection for unsent newsletters
53
+ *
54
+ * @access protected
55
+ * @return DMK_Postman_Block_Adminhtml_Newsletters_Unsent_Grid
56
+ */
57
+ protected function _prepareCollection()
58
+ {
59
+ $joinTable = Mage::getSingleton('core/resource')->getTableName('admin/user/table');
60
+ $collection = Mage::getResourceModel('postman/newsletters_unsent_collection')
61
+ ->addFieldToFilter('newsletter_mailing_date','0000-00-00 00:00:00');
62
+
63
+ $collection->getSelect()
64
+ ->joinLeft( array('au' => $joinTable),
65
+ 'main_table.newsletter_author = au.user_id',
66
+ array('fullname'=>'au.firstname'))
67
+ ->columns(new Zend_Db_Expr("CONCAT(`au`.`firstname`, ' ',`au`.`lastname`) AS fullname"));
68
+
69
+ $this->setCollection($collection);
70
+ return parent::_prepareCollection();
71
+ }
72
+
73
+ /**
74
+ * Method to prepare the grid columns
75
+ *
76
+ * @access protected
77
+ * @return DMK_Postman_Block_Adminhtml_Newsletters_Unsent_Grid
78
+ */
79
+ protected function _prepareColumns()
80
+ {
81
+ $this->addColumn('newsletter_id', array(
82
+ 'header' => Mage::helper('postman')->__('ID'),
83
+ 'align' => 'right',
84
+ 'width' => '50px',
85
+ 'index' => 'newsletter_id',
86
+ )
87
+ );
88
+
89
+ $this->addColumn('newsletter_subject', array(
90
+ 'header' => Mage::helper('postman')->__('Subject'),
91
+ 'align' => 'left',
92
+ 'index' => 'newsletter_subject',
93
+ )
94
+ );
95
+
96
+ $this->addColumn('newsletter_last_modification', array(
97
+ 'header' => Mage::helper('postman')->__('Last modification'),
98
+ 'align' => 'left',
99
+ 'width' => '200px',
100
+ 'index' => 'newsletter_last_modification',
101
+ 'type' => 'datetime'
102
+ )
103
+ );
104
+
105
+ $this->addColumn('newsletter_author', array(
106
+ 'header' => Mage::helper('postman')->__('Author'),
107
+ 'align' => 'left',
108
+ 'width' => '200px',
109
+ 'filter' => false,
110
+ 'sortable' => false,
111
+ 'index' => 'newsletter_author',
112
+ 'format' => '$fullname',
113
+ )
114
+ );
115
+
116
+ $this->addColumn('action', array(
117
+ 'header' => Mage::helper('postman')->__('Action'),
118
+ 'width' => '200',
119
+ 'align' => 'left',
120
+ 'type' => 'action',
121
+ 'getter' => 'getId',
122
+ 'actions' => array(
123
+ array(
124
+ 'caption' => Mage::helper('postman')->__('Send test newsletter'),
125
+ 'url' => array('base' => '*/*/sendTestnewsletter'),
126
+ 'field' => 'newsletter_id',
127
+ ),
128
+ array(
129
+ 'caption' => Mage::helper('postman')->__('Send newsletter'),
130
+ 'url' => array('base' => '*/*/sendNewsletter'),
131
+ 'field' => 'newsletter_id',
132
+ )
133
+ ),
134
+ 'filter' => false,
135
+ 'sortable' => false,
136
+ 'is_system' => true,
137
+ )
138
+ );
139
+
140
+ return parent::_prepareColumns();
141
+ }
142
+
143
+ /**
144
+ * Method to get the row edit url
145
+ *
146
+ * @access public
147
+ * @param ???
148
+ * @return string Edit url
149
+ */
150
+ public function getRowUrl($row)
151
+ {
152
+ return $this->getUrl('*/*/edit', array('newsletter_id'=>$row->getId()));
153
+ }
154
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Export.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class DMK_Postman_Block_Adminhtml_Subscribers_Export extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $this->setElement($element);
8
+ $url = $this->getUrl('postman/adminhtml_subscribers_export/export');
9
+
10
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
11
+ ->setType('button')
12
+ ->setClass('scalable')
13
+ ->setLabel('Export')
14
+ ->setOnClick("setLocation('$url')")
15
+ ->toHtml();
16
+
17
+ return $html;
18
+ }
19
+ }
20
+ ?>
app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Subscribers.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Subscribers Subscribers
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Subscribers_Subscribers extends Mage_Adminhtml_Block_Widget_Grid_Container
36
+ {
37
+ /**
38
+ * Method to initialize the grid container settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ $this->_controller = 'adminhtml_subscribers_subscribers';
45
+ $this->_blockGroup = 'postman';
46
+ $this->_headerText = Mage::helper('postman')->__('Subscribers (confirmed/unconfirmed)');
47
+
48
+ parent::__construct();
49
+
50
+ $this->updateButton('add', 'label', Mage::helper('postman')->__('Add subscriber'));
51
+ }
52
+
53
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Subscribers/Edit.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Subscribers Subscribers Edit
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Subscribers_Subscribers_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
36
+ {
37
+ /**
38
+ * Method to initialize the form settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+ $this->_objectId = 'subscriber_id';
46
+ $this->_blockGroup = 'postman';
47
+ $this->_controller = 'adminhtml_subscribers_subscribers';
48
+
49
+ $this->_addButton('saveandcontinue', array(
50
+ 'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
51
+ 'onclick' => 'saveAndContinueEdit()',
52
+ 'class' => 'save',
53
+ ), -100);
54
+
55
+ $this->_addButton('saveandnew', array(
56
+ 'label' => Mage::helper('adminhtml')->__('Save and New'),
57
+ 'onclick' => 'setLocation(\'' . $this->saveAndNew() . '\')',
58
+ 'class' => 'saveandnew',
59
+ ), -100);
60
+
61
+ $this->_formScripts[] = "
62
+
63
+
64
+
65
+
66
+
67
+ function saveAndContinueEdit(){
68
+ editForm.submit($('edit_form').action+'back/edit/');
69
+ }
70
+ ";
71
+
72
+ $this->addButton('delete', array(
73
+ 'label' => Mage::helper('postman')->__('Delete'),
74
+ 'onclick' => 'deleteConfirm(\'' . Mage::helper('adminhtml')->__('Are you sure you want to do this?') . '\', \'' . $this->getDeleteUrl() .'\')',
75
+ 'class' => 'delete'
76
+ ), 1);
77
+ }
78
+
79
+ /**
80
+ * Method to get the header text
81
+ *
82
+ * @access public
83
+ * @return string Header text
84
+ */
85
+ public function getHeaderText()
86
+ {
87
+ if( Mage::registry('subscriber_subscriber_data') && Mage::registry('subscriber_subscriber_data')->getId() ) {
88
+ return Mage::helper('postman')->__("Edit subscriber '%s'", $this->htmlEscape(Mage::registry('subscriber_subscriber_data')->getSubscriberEmail()));
89
+ } else {
90
+ return Mage::helper('postman')->__('New subscriber');
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Method to get the delete url
96
+ *
97
+ * @access public
98
+ * @return string delete url
99
+ */
100
+ public function getDeleteUrl()
101
+ {
102
+ return $this->getUrl('*/adminhtml_subscribers_subscribers/delete',
103
+ array($this->_objectId => $this->getRequest()->getParam($this->_objectId)));
104
+ }
105
+
106
+ /**
107
+ Method to get the saveAndNew url
108
+ *
109
+ * @access public
110
+ * @return string saveAndNew url
111
+ */
112
+
113
+ public function saveAndNew()
114
+ {
115
+ return $this->getUrl('*/adminhtml_subscribers_subscribers/new', array());
116
+ }
117
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Subscribers/Edit/Form.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Subscribers Subscribers Edit Form
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Subscribers_Subscribers_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+ /**
38
+ * Method to prepare edit form
39
+ *
40
+ * @access protected
41
+ * @return DMK_Postman_Block_Adminhtml_Subscribers_Subscribers_Edit_Form
42
+ */
43
+ protected function _prepareForm()
44
+ {
45
+ $form = new Varien_Data_Form(array(
46
+ 'id' => 'edit_form',
47
+ 'action' => $this->getUrl('*/*/save', array('subscriber_id' => $this->getRequest()->getParam('subscriber_id'))),
48
+ 'method' => 'post',
49
+ )
50
+ );
51
+ $form->setUseContainer(true);
52
+ $this->setForm($form);
53
+ return parent::_prepareForm();
54
+ }
55
+
56
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Subscribers/Edit/Tab/Lists.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Subscribers Subscribers Edit Tab Lists
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Subscribers_Subscribers_Edit_Tab_Lists extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+ /**
38
+ * Method to prepare edit form
39
+ *
40
+ * @access protected
41
+ * @return DMK_Postman_Block_Adminhtml_Subscribers_Subscribers_Edit_Tab_Lists
42
+ */
43
+ protected function _prepareForm()
44
+ {
45
+ $model = Mage::registry('subscriber_subscriber_data');
46
+ $form = new Varien_Data_Form();
47
+ $listToCustomer = Mage::getSingleton('postman/subscribers_subscribers')->getSelectedListsForSubscriber($model->getSubscriberId());
48
+
49
+
50
+ $fieldset = $form->addFieldset('subscribers_form', array('legend'=>Mage::helper('postman')->__('Mailing lists')));
51
+ $fieldset->addField('store_id', 'multiselect', array(
52
+ 'name' => 'lists[]',
53
+ 'label' => Mage::helper('postman')->__('Mailing lists'),
54
+ 'title' => Mage::helper('postman')->__('Mailing lists'),
55
+ 'values' => Mage::getSingleton('postman/subscribers_subscribers')->getListValuesForForm(true),
56
+ 'value' => $listToCustomer,
57
+ ));
58
+
59
+ $this->setForm($form);
60
+ return parent::_prepareForm();
61
+ }
62
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Subscribers/Edit/Tab/Main.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Subscribers Subscribers Edit Tab Main
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Subscribers_Subscribers_Edit_Tab_Main extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+ /**
38
+ * Method to prepare edit form
39
+ *
40
+ * @access protected
41
+ * @return DMK_Postman_Block_Adminhtml_Subscribers_Subscribers_Edit_Tab_Main
42
+ */
43
+ protected function _prepareForm()
44
+ {
45
+
46
+ $model = Mage::registry('subscriber_subscriber_data');
47
+
48
+ $subscriberStatus = $model->getSubscriberStatus();
49
+
50
+ $form = new Varien_Data_Form(array(
51
+ 'id' => 'edit_form',
52
+ 'action' => $this->getUrl('*/*/save', array('subscriber_id' => $this->getRequest()->getParam('subscriber_id'))),
53
+ 'method' => 'post',
54
+ )
55
+ );
56
+
57
+ $fieldset = $form->addFieldset('subscribers_form', array('legend'=>Mage::helper('postman')->__('Subscriber details')));
58
+
59
+ $fieldset->addField('subscriber_name', 'text', array(
60
+ 'label' => Mage::helper('postman')->__('Name'),
61
+ 'class' => 'entry',
62
+ 'required' => false,
63
+ 'name' => 'subscriber_name',
64
+ ));
65
+
66
+ $fieldset->addField('subscriber_email', 'text', array(
67
+ 'label' => Mage::helper('postman')->__('E-mail'),
68
+ 'required' => true,
69
+ 'name' => 'subscriber_email',
70
+ ));
71
+
72
+ $fieldset->addField('subscriber_emailformat', 'select', array(
73
+ 'label' => Mage::helper('postman')->__('E-mail format'),
74
+ 'title' => Mage::helper('postman')->__('E-mail format'),
75
+ 'name' => 'subscriber_emailformat',
76
+ 'required' => true,
77
+ 'options' => array(
78
+ '2' => Mage::helper('postman')->__('Multipart'),
79
+ '1' => Mage::helper('postman')->__('Html'),
80
+ '0' => Mage::helper('postman')->__('Text'),
81
+ ),
82
+ ));
83
+
84
+ $fieldset->addField('subscriber_status', 'checkbox', array(
85
+ 'label' => Mage::helper('postman')->__('Confirmed') . '?',
86
+ 'class' => 'entry',
87
+ 'required' => false,
88
+ 'onclick' => 'this.value = this.checked ? 1 : 0;',
89
+ 'name' => 'subscriber_status',
90
+ ));
91
+
92
+ if($subscriberStatus == 1 || $subscriberStatus == 9) {
93
+ $form->getElement('subscriber_status')->setIsChecked(true);
94
+ } else {
95
+ $form->getElement('subscriber_status')->setIsChecked(false);
96
+ }
97
+ $model->setIsEnabled(!empty($postData['subscriber_status']));
98
+
99
+
100
+ if ($model->getId()) {
101
+ $fieldset->addField('subscriber_id',
102
+ 'hidden',
103
+ array('name' => 'subscriber_id')
104
+ );
105
+ }
106
+
107
+ $form->setValues($model);
108
+ $this->setForm($form);
109
+
110
+ return parent::_prepareForm();
111
+
112
+ }
113
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Subscribers/Edit/Tabs.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Subscribers Subscribers Edit Tabs
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Subscribers_Subscribers_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
36
+ {
37
+ /**
38
+ * Constructor
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+ $this->setId('subscribers_subscribers_tabs');
46
+ $this->setDestElementId('edit_form');
47
+ $this->setTitle(Mage::helper('postman')->__('Subscriber'));
48
+ }
49
+
50
+ /**
51
+ * Method to set the tabs
52
+ *
53
+ * @access protected
54
+ * @return DMK_Postman_Block_Adminhtml_Subscribers_Subscribers_Edit_Tabs
55
+ */
56
+ protected function _beforeToHtml()
57
+ {
58
+
59
+
60
+
61
+ $this->addTab('main_section', array(
62
+ 'label' => Mage::helper('postman')->__('Details'),
63
+ 'title' => Mage::helper('postman')->__('Details'),
64
+ 'content' => $this->getLayout()->createBlock('postman/adminhtml_subscribers_subscribers_edit_tab_main')->toHtml(),
65
+ 'active' => ( $this->getRequest()->getParam('tab') == 'lists_section' ) ? true : false,
66
+ ))
67
+ ;
68
+
69
+ $this->addTab('lists_section', array(
70
+ 'label' => Mage::helper('postman')->__('Mailing lists'),
71
+ 'title' => Mage::helper('postman')->__('Mailing lists'),
72
+ 'content' => $this->getLayout()->createBlock('postman/adminhtml_subscribers_subscribers_edit_tab_lists')->toHtml(),
73
+ 'active' => ( $this->getRequest()->getParam('tab') == 'lists_section' ) ? true : false,
74
+ ));
75
+
76
+ return parent::_beforeToHtml();
77
+ }
78
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Subscribers/Grid.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Subscribers Subscribers Grid
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Subscribers_Subscribers_Grid extends Mage_Adminhtml_Block_Widget_Grid
36
+ {
37
+ /**
38
+ * Method to initialize the grid settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+ $this->setId('dmk_postman_list_subscribers_subscribers');
46
+ $this->setDefaultSort('subscriber_id');
47
+ $this->setDefaultDir('ASC');
48
+ $this->setSaveParametersInSession(true);
49
+ }
50
+
51
+ /**
52
+ * Method to prepare the subscribers collection
53
+ *
54
+ * @access protected
55
+ * @return DMK_Postman_Block_Adminhtml_Subscribers_Subscribers_Grid
56
+ */
57
+ protected function _prepareCollection()
58
+ {
59
+ $joinTable = Mage::getSingleton('core/resource')->getTableName('postman/postman_subscribers_lists');
60
+ $collection = Mage::getResourceModel('postman/subscribers_subscribers_collection')
61
+ ->addFieldToFilter(array('subscriber_status'),
62
+ array(array('neq'=>'9')));
63
+ $collection->getSelect()
64
+ ->joinLeft( array('lt' => $joinTable),
65
+ 'main_table.subscriber_id = lt.subscriber_id',
66
+ array('COUNT(lt.list_id) AS subscriber_lists_count'))
67
+ ->group('main_table.subscriber_id');
68
+ $this->setCollection($collection);
69
+ return parent::_prepareCollection();
70
+ }
71
+
72
+ /**
73
+ * Method to prepare the grid columns
74
+ *
75
+ * @access protected
76
+ * @return DMK_Postman_Block_Adminhtml_Subscribers_Subscribers_Grid
77
+ */
78
+ protected function _prepareColumns()
79
+ {
80
+ $this->addColumn('subscriber_id', array(
81
+ 'header' => Mage::helper('postman')->__('ID'),
82
+ 'align' => 'left',
83
+ 'width' => '50px',
84
+ 'index' => 'subscriber_id',
85
+ )
86
+ );
87
+
88
+ $this->addColumn('subscriber_name', array(
89
+ 'header' => Mage::helper('postman')->__('Name'),
90
+ 'align' => 'left',
91
+ 'width' => '500px',
92
+ 'index' => 'subscriber_name',
93
+ )
94
+ );
95
+
96
+ $this->addColumn('subscriber_email', array(
97
+ 'header' => Mage::helper('postman')->__('E-mail'),
98
+ 'align' => 'left',
99
+ 'index' => 'subscriber_email',
100
+ )
101
+ );
102
+
103
+ $this->addColumn('subscriber_emailformat', array(
104
+ 'header' => Mage::helper('postman')->__('E-mail format'),
105
+ 'align' => 'left',
106
+ 'width' => '80px',
107
+ 'index' => 'subscriber_emailformat',
108
+ 'type' => 'options',
109
+ 'options' => array(
110
+ 0 => 'Text',
111
+ 1 => 'Html',
112
+ 2 => 'Multipart'
113
+ )
114
+ )
115
+ );
116
+
117
+ $this->addColumn('subscriber_status', array(
118
+ 'header' => Mage::helper('postman')->__('Status'),
119
+ 'align' => 'left',
120
+ 'width' => '150px',
121
+ 'index' => 'subscriber_status',
122
+ 'type' => 'options',
123
+ 'options' => array(
124
+ 0 => Mage::helper('postman')->__('Unconfirmed'),
125
+ 1 => Mage::helper('postman')->__('Confirmed'),
126
+ )
127
+ )
128
+ );
129
+
130
+ $this->addColumn('subscriber_lists', array(
131
+ 'header' => Mage::helper('postman')->__('# lists'),
132
+ 'align' => 'left',
133
+ 'width' => '50px',
134
+ 'index' => 'subscriber_lists_count',
135
+ )
136
+ );
137
+
138
+ return parent::_prepareColumns();
139
+ }
140
+
141
+ /**
142
+ * Method to get the row edit url
143
+ *
144
+ * @access public
145
+ * @param ???
146
+ * @return string Edit url
147
+ */
148
+ public function getRowUrl($row)
149
+ {
150
+ return $this->getUrl('*/*/edit', array('subscriber_id'=>$row->getId()));
151
+ }
152
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Testrecipients.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Subscribers Testrecipients
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Subscribers_Testrecipients extends Mage_Adminhtml_Block_Widget_Grid_Container
36
+ {
37
+ /**
38
+ * Method to initialize the grid container settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ $this->_controller = 'adminhtml_subscribers_testrecipients';
45
+ $this->_blockGroup = 'postman';
46
+ $this->_headerText = Mage::helper('postman')->__('Testrecipients');
47
+
48
+ parent::__construct();
49
+
50
+ $this->updateButton('add', 'label', Mage::helper('postman')->__('Add testrecipient'));
51
+ }
52
+
53
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Testrecipients/Edit.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Subscribers Testrecipients Edit
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Subscribers_Testrecipients_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
36
+ {
37
+ /**
38
+ * Method to initialize the form settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+
46
+ $this->_objectId = 'subscriber_id';
47
+ $this->_blockGroup = 'postman';
48
+ $this->_controller = 'adminhtml_subscribers_testrecipients';
49
+
50
+ $this->_addButton('saveandcontinue', array(
51
+ 'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
52
+ 'onclick' => 'saveAndContinueEdit()',
53
+ 'class' => 'save',
54
+ ), -100);
55
+
56
+ $this->_formScripts[] = "
57
+ function saveAndContinueEdit(){
58
+ editForm.submit($('edit_form').action+'back/edit/');
59
+ }
60
+ ";
61
+
62
+ $this->addButton('delete', array(
63
+ 'label' => Mage::helper('postman')->__('Delete'),
64
+ 'onclick' => 'deleteConfirm(\'' . Mage::helper('adminhtml')->__('Are you sure you want to do this?') . '\', \'' . $this->getDeleteUrl() .'\')',
65
+ 'class' => 'delete'
66
+ ), 1);
67
+ }
68
+
69
+ /**
70
+ * Method to get the header text
71
+ *
72
+ * @access public
73
+ * @return string Header text
74
+ */
75
+ public function getHeaderText()
76
+ {
77
+ if( Mage::registry('subscriber_testrecipient_data') && Mage::registry('subscriber_testrecipient_data')->getId() ) {
78
+ return Mage::helper('postman')->__("Edit testrecipient '%s'", $this->htmlEscape(Mage::registry('subscriber_testrecipient_data')->getSubscriberEmail()));
79
+ } else {
80
+ return Mage::helper('postman')->__('New testrecipient');
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Method to get the delete url
86
+ *
87
+ * @access public
88
+ * @return string delete url
89
+ */
90
+ public function getDeleteUrl()
91
+ {
92
+ return $this->getUrl('*/adminhtml_subscribers_testrecipients/delete',array($this->_objectId => $this->getRequest()->getParam($this->_objectId)));
93
+ }
94
+
95
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Testrecipients/Edit/Form.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Subscribers Testrecipients Edit Form
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Subscribers_Testrecipients_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+ /**
38
+ * Method to prepare edit form
39
+ *
40
+ * @access protected
41
+ * @return DMK_Postman_Block_Adminhtml_Subscribers_Testrecipients_Edit_Form
42
+ */
43
+ protected function _prepareForm()
44
+ {
45
+
46
+ $model = Mage::registry('subscriber_testrecipient_data');
47
+
48
+ $form = new Varien_Data_Form(array(
49
+ 'id' => 'edit_form',
50
+ 'action' => $this->getUrl('*/*/save', array('subscriber_id' => $this->getRequest()->getParam('subscriber_id'))),
51
+ 'method' => 'post',
52
+ )
53
+ );
54
+
55
+ $fieldset = $form->addFieldset('edit_testrecipient_form', array('legend' => Mage::helper('postman')->__('Edit testrecipient')));
56
+
57
+ $fieldset->addField('subscriber_name', 'text', array(
58
+ 'label' => Mage::helper('postman')->__('Name'),
59
+ 'class' => 'required-entry',
60
+ 'required' => false,
61
+ 'name' => 'subscriber_name',
62
+ ));
63
+
64
+ $fieldset->addField('subscriber_email', 'text', array(
65
+ 'label' => Mage::helper('postman')->__('E-mail'),
66
+ 'class' => 'required-entry',
67
+ 'required' => true,
68
+ 'name' => 'subscriber_email',
69
+ ));
70
+
71
+ $fieldset->addField('subscriber_emailformat', 'select', array(
72
+ 'label' => Mage::helper('postman')->__('E-mail format'),
73
+ 'title' => Mage::helper('postman')->__('E-mail format'),
74
+ 'name' => 'subscriber_emailformat',
75
+ 'required' => true,
76
+ 'options' => array(
77
+ '2' => Mage::helper('postman')->__('Multipart'),
78
+ '1' => Mage::helper('postman')->__('Html'),
79
+ '0' => Mage::helper('postman')->__('Text'),
80
+ ),
81
+ ));
82
+
83
+ if ($model->getId()) {
84
+ $fieldset->addField('subscriber_id', 'hidden', array(
85
+ 'name' => 'subscriber_id',
86
+ ));
87
+ }
88
+
89
+ $form->setValues($model->getData());
90
+ $form->setUseContainer(true);
91
+ $this->setForm($form);
92
+ return parent::_prepareForm();
93
+ }
94
+
95
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Subscribers/Testrecipients/Grid.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Block Adminhtml Subscribers Testrecipients Grid
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Block_Adminhtml_Subscribers_Testrecipients_Grid extends Mage_Adminhtml_Block_Widget_Grid
36
+ {
37
+ /**
38
+ * Method to initialize the grid settings
39
+ *
40
+ * @access public
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+ $this->setId('dmk_postman_list_subscribers_testrecipients');
46
+ $this->setDefaultSort('subscriber_id');
47
+ $this->setDefaultDir('ASC');
48
+ $this->setSaveParametersInSession(true);
49
+ }
50
+
51
+ /**
52
+ * Method to prepare the testrecipients collection
53
+ *
54
+ * @access protected
55
+ * @return DMK_Postman_Block_Adminhtml_Subscribers_Testrecipients_Grid
56
+ */
57
+ protected function _prepareCollection()
58
+ {
59
+ $collection = Mage::getResourceModel('postman/subscribers_testrecipients_collection')
60
+ ->addFieldToFilter('subscriber_status', '9');
61
+ $this->setCollection($collection);
62
+ return parent::_prepareCollection();
63
+ }
64
+
65
+ /**
66
+ * Method to prepare the grid columns
67
+ *
68
+ * @access protected
69
+ * @return DMK_Postman_Block_Adminhtml_Subscribers_Testrecipients_Grid
70
+ */
71
+ protected function _prepareColumns()
72
+ {
73
+ $this->addColumn('subscriber_id', array(
74
+ 'header' => Mage::helper('postman')->__('ID'),
75
+ 'align' => 'right',
76
+ 'width' => '50px',
77
+ 'index' => 'subscriber_id',
78
+ )
79
+ );
80
+
81
+ $this->addColumn('subscriber_name', array(
82
+ 'header' => Mage::helper('postman')->__('Name'),
83
+ 'align' => 'left',
84
+ 'index' => 'subscriber_name',
85
+ )
86
+ );
87
+
88
+ $this->addColumn('subscriber_email', array(
89
+ 'header' => Mage::helper('postman')->__('E-mail'),
90
+ 'align' => 'left',
91
+ 'index' => 'subscriber_email',
92
+ )
93
+ );
94
+
95
+ $this->addColumn('subscriber_emailformat', array(
96
+ 'header' => Mage::helper('postman')->__('E-mail format'),
97
+ 'align' => 'left',
98
+ 'width' => '80px',
99
+ 'index' => 'subscriber_emailformat',
100
+ 'type' => 'options',
101
+ 'options' => array(
102
+ 0 => 'Text',
103
+ 1 => 'Html',
104
+ 2 => 'Multipart',
105
+ )
106
+ )
107
+ );
108
+
109
+ return parent::_prepareColumns();
110
+ }
111
+
112
+ /**
113
+ * Method to get the row edit url
114
+ *
115
+ * @access public
116
+ * @param ???
117
+ * @return string Edit url
118
+ */
119
+ public function getRowUrl($row)
120
+ {
121
+ return $this->getUrl('*/*/edit', array('subscriber_id'=>$row->getId()));
122
+ }
123
+ }
app/code/local/DMK/Postman/Block/Adminhtml/Widget/Grid/Column/Renderer/Action.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * Grid column widget for rendering action grid cells
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class DMK_Postman_Block_Adminhtml_Widget_Grid_Column_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
35
+ {
36
+ /**
37
+ * Renders column
38
+ *
39
+ * @param Varien_Object $row
40
+ * @return string
41
+ */
42
+ public function render(Varien_Object $row)
43
+ {
44
+ $actions = $this->getColumn()->getActions();
45
+ if ( empty($actions) || !is_array($actions) ) {
46
+ return '&nbsp;';
47
+ }
48
+
49
+ if(sizeof($actions)==1 && !$this->getColumn()->getNoLink()) {
50
+ foreach ($actions as $action) {
51
+ if ( is_array($action) ) {
52
+ return $this->_toLinkHtml($action, $row);
53
+ }
54
+ }
55
+ }
56
+
57
+ $controllerName = Mage::app()->getRequest()->getControllerName();
58
+
59
+ if($controllerName == 'adminhtml_newsletters_unsent') {
60
+ $out = '<select class="action-select">';
61
+ } else {
62
+ $out = '<select class="action-select" onchange="varienGridAction.execute(this);">';
63
+ }
64
+
65
+ $out .= '<option value=""></option>';
66
+
67
+
68
+ $i = 0;
69
+ foreach ($actions as $action){
70
+ $i++;
71
+ if ( is_array($action) ) {
72
+ $out .= $this->_toOptionHtml($action, $row);
73
+ }
74
+ }
75
+ $out .= '</select>';
76
+ return $out;
77
+ }
78
+ }
app/code/local/DMK/Postman/Block/Frontend/Newsletter/Registration.php ADDED
@@ -0,0 +1,354 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DMK_Postman_Block_Frontend_Newsletter_Registration extends Mage_Core_Block_Template {
4
+
5
+ /**
6
+ * Get the disclaimer link from backend
7
+ *
8
+ * @return string
9
+ */
10
+ public function getDisclaimerLink()
11
+ {
12
+ return Mage::getStoreConfig('postman_general/registration_settings/disclaimer_link');
13
+ }
14
+
15
+
16
+ /**
17
+ * Look for setting is Disclaimer active
18
+ *
19
+ * @return bool
20
+ */
21
+ public function showDisclaimer()
22
+ {
23
+ return Mage::getStoreConfig('postman_general/registration_settings/show_disclaimer');
24
+ }
25
+
26
+
27
+ /**
28
+ * Look for setting is name obligation
29
+ *
30
+ * @return bool
31
+ */
32
+ public function isNameObligation()
33
+ {
34
+ return Mage::getStoreConfig('postman_general/registration_settings/name_field_obligation');
35
+ }
36
+
37
+
38
+ /**
39
+ * Look for setting is name active and set the Zend_Form_Element
40
+ *
41
+ * @return array (Zend_Form_Element)
42
+ */
43
+ public function getNameField()
44
+ {
45
+ if(Mage::getStoreConfig('postman_general/registration_settings/show_name_field')){
46
+
47
+ $class = '';
48
+ if($this->isNameObligation()){
49
+ $class = 'input-text required-entry';
50
+ }
51
+
52
+ return array('text', 'clientname', array(
53
+ 'label' => __('Name'),
54
+ 'class' => $class,
55
+ 'id' => 'name',
56
+ 'required' => TRUE,
57
+ ));
58
+
59
+ }
60
+ }
61
+
62
+
63
+ public function getEmailField() {
64
+ return array('text', 'clientemail', array(
65
+ 'label' => __('Email'),
66
+ 'class' => 'input-text required-entry validate-email',
67
+ 'id' => 'email',
68
+ 'required' => TRUE,
69
+
70
+ ));
71
+ }
72
+
73
+
74
+ public function getDisclaimerField(){
75
+ return array('checkbox', 'checkbox', array(
76
+ 'class' => 'validate-one-required'
77
+ ));
78
+ }
79
+
80
+
81
+ public function clientIP()
82
+ {
83
+ if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
84
+ $TheIp=$_SERVER['HTTP_X_FORWARDED_FOR'];
85
+ else $TheIp=$_SERVER['REMOTE_ADDR'];
86
+
87
+ $TheIp = trim($TheIp);
88
+
89
+ return array('text', 'clientip', array(
90
+ 'value' => $TheIp,
91
+ 'class' => 'hidden'
92
+ ));
93
+ }
94
+
95
+
96
+ /**
97
+ * Retrieve form action url and set "secure" param to avoid confirm
98
+ * message when we submit form from secure page to unsecure
99
+ *
100
+ * @return string
101
+ */
102
+ public function getFormActionUrl()
103
+ {
104
+ return $this->getUrl('postman/index/newslettersubscriber/new', array('_secure' => true));
105
+ }
106
+
107
+
108
+ public function getSubmit(){
109
+ return array('submit', 'button',array(
110
+ 'label' => __('Subscribe'),
111
+ 'class' => 'button main-action'
112
+ ));
113
+ }
114
+
115
+
116
+ /*
117
+ * Build the newsletterform
118
+ */
119
+ public function getNewsletterForm() {
120
+ $view = new Zend_View;
121
+ $form = new Zend_Form;
122
+
123
+ $linkdecorator = array(
124
+ array('Description', array('escape'=>false)),
125
+ );
126
+
127
+ $link= $form->createElement('hidden', link)
128
+ ->setDescription('<a href="' . $this->getDisclaimerLink(). '">' . __('Disclaimer') . '</a>')
129
+ ->setDecorators($linkdecorator);
130
+ $wantNewsletter = $form->createElement('hidden', 'wantnewsletter');
131
+ $wantNewsletter->setValue(1);
132
+
133
+ $elements = array($this->getNameField(), $this->getEmailField(),
134
+ $this->getDisclaimerField(), $link, $wantNewsletter,
135
+ $this->getSubmit());
136
+
137
+
138
+
139
+ $form->setAttrib('id', 'postmanForm')
140
+ ->setAction($this->getFormActionUrl())
141
+ ->setMethod(Zend_Form::METHOD_POST)
142
+ ->addElements($elements);
143
+
144
+ $form->render($view);
145
+
146
+ return $form;
147
+ }
148
+
149
+
150
+ /**
151
+ * Show full registration form or the reduced
152
+ */
153
+ protected function _showReducedForm()
154
+ {
155
+ if($this->_isLoggedIn())
156
+ {
157
+ return true;
158
+ } else {
159
+ return false;
160
+ }
161
+ }
162
+
163
+
164
+ /**
165
+ * Set the checkbox 'wantnewsletter'
166
+ *
167
+ * @param bool $w true if checkbox is checked, false if not
168
+ *
169
+ * @return mixed
170
+ */
171
+ protected function _wantNewsletter($w=0)
172
+ {
173
+ $isSubscribed = $this->_isSubscribed();
174
+ $wantNewslett = (($this->getRequest()->getParam('wantnewsletter') != NULL
175
+ && $this->getRequest()->getParam('wantnewsletter') == 1
176
+ )
177
+ ? true
178
+ : false);
179
+
180
+ if($w===0) {
181
+ if($this->_isLoggedIn()) {
182
+ return $this->_isSubscribed();
183
+ } else {
184
+ (boolean)$this->getRequest()->getParam('wantnewsletter');
185
+ }
186
+ } else {
187
+ $this->_update($w);
188
+ }
189
+
190
+
191
+
192
+ }
193
+
194
+
195
+ /**
196
+ * Check if user is already logged in
197
+ *
198
+ * @return boolean
199
+ */
200
+ protected function _isLoggedIn()
201
+ {
202
+ if(Mage::getSingleton('customer/session')->isLoggedIn()) {
203
+ return true;
204
+ }
205
+
206
+ return false;
207
+ }
208
+
209
+
210
+ /**
211
+ * Gets the Id of the current user, that is logged in
212
+ *
213
+ * @return int
214
+ */
215
+ private function _getCurrentUserId()
216
+ {
217
+ if($this->_isLoggedIn()) {
218
+ return Mage::getSingleton('customer/session')->getCustomer()->getId();
219
+ }
220
+
221
+ return 0;
222
+ }
223
+
224
+
225
+ /**
226
+ * Check, if user is already subscribed to newsletter
227
+ *
228
+ * @return bool
229
+ */
230
+ protected function _isSubscribed()
231
+ {
232
+ $userName = $this->_getPostmanSubscriber()->getSubscriberId();
233
+ if(!empty($userName)) {
234
+ return true;
235
+ }
236
+
237
+ return false;
238
+ }
239
+
240
+
241
+ /**
242
+ * Get the subscriber from postman_subscribers
243
+ */
244
+ private function _getPostmanSubscriber()
245
+ {
246
+ $collection = Mage::getResourceModel('postman/subscribers_subscribers_collection')
247
+ ->addFieldToFilter('customer_id', $this->_getCurrentUserId());
248
+ $collection->load();
249
+
250
+ return $collection->getFirstItem();
251
+ }
252
+
253
+
254
+ /**
255
+ * Creates a layout block with the appropriate error/success messages
256
+ *
257
+ * @param array $block Block, name and template that should be created
258
+ */
259
+ private function _generateBlock($block)
260
+ {
261
+ return $this->getLayout()
262
+ ->createBlock($block['block'],
263
+ $block['name'],
264
+ array('template' => $block['template'])
265
+ );
266
+ }
267
+
268
+
269
+ /**
270
+ * Load and update the page layout with the messages
271
+ *
272
+ * @param type $block
273
+ */
274
+ private function _updateLayout($block)
275
+ {
276
+ $block = $this->_generateBlock($block);
277
+
278
+ $this->loadLayout();
279
+ $this->getLayout()->getBlock('content')->append($block);
280
+ $this->renderLayout();
281
+ }
282
+
283
+
284
+ /**
285
+ * Write/Delete the customer to DB
286
+ *
287
+ * @param bool $w Customer want newsletter or not
288
+ *
289
+ * @return void
290
+ */
291
+ private function _update($w)
292
+ {
293
+ if($w === true) {
294
+ $model = Mage::getModel('postman/subscribers_subscribers');
295
+
296
+ if($this->_isLoggedIn()) {
297
+ $clName = $this->_getCurrentUser()->getFirstname() . ' '
298
+ . $this->_getCurrentUser()->getLastname();
299
+ $clEmail = $this->_getCurrentUser()->getEmail();
300
+ } else {
301
+ $clName = strip_tags($this->getRequest()->getParam('clientname'));
302
+ $clEmail = strip_tags($this->getRequest()->getParam('clientemail'));
303
+ }
304
+
305
+ $clIp = $this->getRequest()->getParam('clientip');
306
+ $clToken = $clEmail . $model->getCurrentDate();
307
+
308
+ $subscriberActivation = $this->_generateLinks('activate', 'validate', array('token'=>$clToken));
309
+ $subscriberDeactivation = $this->_generateLinks('deactivate', 'index', array('token'=>$clToken));
310
+
311
+ if(isset($clEmail)){
312
+ if(!Mage::helper('postman/Email')->checkForUserEmail($clEmail)){
313
+ $emailformat = Mage::getStoreConfig('postman_general/registration_settings/default_email_format');
314
+
315
+ //Write all values into database
316
+ $model->setSubscriberName($clName);
317
+ $model->setSubscriberEmail($clEmail);
318
+ $model->setSubscriberRegistrationDate($model->getCurrentDate());
319
+ $model->setCustomerID($this->_getCurrentUserId());
320
+ $model->setSubscriberRegistrationIp($clIp);
321
+ $model->setSubscriberEmailformat($emailformat);
322
+ $model->setSubscriberActivation($subscriberActivation);
323
+ $model->setSubscriberEditlink($subscriberDeactivation);
324
+ $model->save();
325
+
326
+ //Send the mail
327
+ Mage::helper('postman/Email')->sendEmail($clName, $clEmail,
328
+ '', '',
329
+ 'register', $emailformat,
330
+ $subscriberActivation);
331
+
332
+ $this->_updateLayout(array('block' => 'Mage_Core_Block_Template',
333
+ 'name' => 'main-msg-block',
334
+ 'template' => 'postman/newsletter/subscribe/success.phtml'));
335
+ } else {
336
+ $this->_updateLayout(array('block' => 'Mage_Core_Block_Template',
337
+ 'name' => 'main-msg-block',
338
+ 'template' => 'postman/newsletter/register/already_registered.phtml'));
339
+ }
340
+ } else {
341
+ $this->_updateLayout(array('block' => 'Mage_Core_Block_Template',
342
+ 'name' => 'main-msg-block',
343
+ 'template' => 'postman/newsletter/register/please_register.phtml'));
344
+ }
345
+ } else {
346
+ if($this->_isLoggedIn() && $this->_isSubscribed()) {
347
+ $this->_getPostmanSubscriber()->delete();
348
+ $this->_updateLayout(array('block' => 'Mage_Core_Block_Template',
349
+ 'name' => 'main-msg-block',
350
+ 'template' => 'postman/newsletter/deactivate/account_deactive.phtml'));
351
+ }
352
+ }
353
+ }
354
+ }
app/code/local/DMK/Postman/Helper/Data.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * DMK Postman Helper Data
30
+ *
31
+ * @package DMK Postman
32
+ */
33
+ class DMK_Postman_Helper_Data extends Mage_Core_Helper_Abstract
34
+ {
35
+
36
+ }
app/code/local/DMK/Postman/Helper/Email.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * DMK Postman Helper Email
30
+ *
31
+ * @package DMK Postman
32
+ */
33
+
34
+
35
+ class DMK_Postman_Helper_Email extends Mage_Core_Helper_Abstract {
36
+
37
+
38
+ /*
39
+ * Check: User email already saved?
40
+ *
41
+ * @param string $email new accountname
42
+ *
43
+ * @return bool
44
+ */
45
+ public function checkForUserEmail($email)
46
+ {
47
+ //Get Emailcollection
48
+ $emailCollection = Mage::getResourceModel('postman/subscribers_subscribers_collection')
49
+ ->addFieldToFilter('subscriber_email',$email);
50
+
51
+ $emailCollection->load();
52
+
53
+ foreach($emailCollection as $email){
54
+ if(!empty($email)){
55
+ return true;
56
+ } else {
57
+ return false;
58
+ }
59
+ }
60
+ }
61
+
62
+ /*
63
+ * Check: User url and is check is already active?
64
+ *
65
+ * @param string $url to check, int $subscriberstatus look for current status
66
+ *
67
+ * @return bool
68
+ */
69
+ public function checkActivationUrl($url, $subscriberstatus){
70
+ $filtertable = '';
71
+
72
+ if($subscriberstatus == 0) {
73
+ $filtertable = 'subscriber_activation';
74
+ } elseif ($subscriberstatus == 1) {
75
+ $filtertable = 'subscriber_editlink';
76
+ }
77
+ $collection = Mage::getResourceModel('postman/subscribers_subscribers_collection')
78
+ ->addFieldToFilter('subscriber_status', $subscriberstatus)
79
+ ->addFieldToFilter($filtertable,$url);
80
+ $collection->load();
81
+
82
+ return $collection->getFirstItem();
83
+ }
84
+
85
+ /*
86
+ * Send activation Email to customer
87
+ * You can use customerName, customerEmail
88
+ * and activationLink in your email template
89
+ *
90
+ * @param string $clName new accountname
91
+ * @param string $clEmail new email
92
+ * @param string $neSubject email subject
93
+ * @param string $neContent whole email content
94
+ * @param string $action register|sendnews|sendnewstest
95
+ * @param string $format html|text|multi
96
+ * @param string $subscriberActivation link to activate the account
97
+ *
98
+ * @return null
99
+ */
100
+ public function sendEmail($clName, $clEmail,
101
+ $neSubject, $neContent,
102
+ $action, $format,
103
+ $subscriberActivationLink='')
104
+ {
105
+ // sending settings enabled ?
106
+ $canSend = Mage::getStoreConfig('postman_general/sending_settings/enabled');
107
+
108
+ if($canSend) {
109
+
110
+ // Set variables that can be used in email template
111
+ $vars = array(
112
+ 'customerName' => $clName,
113
+ 'customerEmail' => $clEmail,
114
+ 'neSubject' => $neSubject,
115
+ 'neContent' => $neContent,
116
+ );
117
+
118
+ // Decide which email template should be used
119
+ // register - new user has been registered via frontend
120
+ // sendnews - sending normal newsletter, f. ex. via backend "Sende Newsletter"
121
+ switch($action) {
122
+ case 'register':
123
+ $templateId = Mage::getStoreConfig('postman_general/registration_settings/default_registration_template');
124
+ $vars['activationLink'] = $subscriberActivationLink;
125
+ break;
126
+
127
+ case 'sendnews':
128
+ $templateId = Mage::getStoreConfig('postman_general/sending_settings/sending_email_template');
129
+ break;
130
+
131
+ case 'sendnewstest':
132
+ $templateId = Mage::getStoreConfig('postman_general/sending_settings/sending_testmail_template');
133
+ break;
134
+ }
135
+
136
+ // Set sender information
137
+ $senderName = Mage::getStoreConfig('postman_general/sending_settings/default_sender_name');
138
+ $senderEmail = Mage::getStoreConfig('postman_general/sending_settings/default_sender_email');
139
+ $sender = array('name' => $senderName,
140
+ 'email' => $senderEmail);
141
+
142
+ // Default reply email
143
+ $replyEmail = Mage::getStoreConfig('postman_general/sending_settings/default_reply_email');
144
+
145
+ // Return-Path
146
+ $returnPath = Mage::getStoreConfig('postman_general/sending_settings/default_return_path');
147
+ $tmpSplitArr = explode('@', $returnPath);
148
+ $returnPath = $tmpSplitArr[0] . '@' . $tmpSplitArr[1];
149
+
150
+ // Set recepient information
151
+ $recepientName = $clName;
152
+ $recepientEmail = $clEmail;
153
+
154
+ // Get Store ID
155
+ $storeId = Mage::app()->getStore()->getId();
156
+
157
+ $translate = Mage::getSingleton('core/translate');
158
+
159
+ // Send Transactional Email
160
+ try {
161
+ $model = Mage::getModel('core/email_template');
162
+ $model->setEmailFormat($format);
163
+ $model->setReturnPath($returnPath)
164
+ ->setReplyTo($replyEmail)
165
+ ->sendTransactional($templateId, $sender, $recepientEmail,
166
+ $recepientName, $vars, $storeId);
167
+
168
+ $translate->setTranslateInline(true);
169
+ return true;
170
+ } catch (Exception $e) {
171
+ Mage::log($e->getMessage());
172
+ return false;
173
+ }
174
+ } else {
175
+ // Sending is disabled.
176
+ Mage::log('Sending emails is not enabled');
177
+ }
178
+
179
+ }
180
+
181
+ /**
182
+ * Method to check if emailaddress and format already exists
183
+ *
184
+ * @param string $subscriber_email
185
+ * @param int $subscriber_emailformat
186
+ */
187
+ public function checkDuplicateEmailFormat($subscriber_email, $subscriber_emailformat, $subscriber_id)
188
+ {
189
+ $model = Mage::getModel('postman/subscribers_subscribers');
190
+ $id = $model->getIdByEmailAndFormat($subscriber_email, $subscriber_emailformat, $subscriber_id);
191
+
192
+ return $id ? true : false;
193
+ }
194
+ }
app/code/local/DMK/Postman/Model/Config/Source/Emailformat.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class DMK_Postman_Model_Config_Source_Emailformat
3
+ {
4
+ /**
5
+ * Options getter
6
+ *
7
+ * @return array
8
+ */
9
+ public function toOptionArray()
10
+ {
11
+ return array(
12
+ array('value' => 0, 'label'=>Mage::helper('adminhtml')->__('multipart')),
13
+ array('value' => 1, 'label'=>Mage::helper('adminhtml')->__('text')),
14
+ array('value' => 2, 'label'=>Mage::helper('adminhtml')->__('html')),
15
+ );
16
+ }
17
+ }
app/code/local/DMK/Postman/Model/Email/Template.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Core
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
+ * Template model
29
+ *
30
+ * Example:
31
+ *
32
+ * // Loading of template
33
+ * $emailTemplate = Mage::getModel('core/email_template')
34
+ * ->load(Mage::getStoreConfig('path_to_email_template_id_config'));
35
+ * $variables = array(
36
+ * 'someObject' => Mage::getSingleton('some_model')
37
+ * 'someString' => 'Some string value'
38
+ * );
39
+ * $emailTemplate->send('some@domain.com', 'Name Of User', $variables);
40
+ *
41
+ * @category Mage
42
+ * @package Mage_Core
43
+ * @author Magento Core Team <core@magentocommerce.com>
44
+ */
45
+ class DMK_Postman_Model_Email_Template extends Mage_Core_Model_Email_Template
46
+ {
47
+ private $_format;
48
+
49
+ /**
50
+ * Set the format for emails
51
+ *
52
+ * @param int $format email format 1|2|3
53
+ */
54
+ public function setEmailFormat($format)
55
+ {
56
+ $this->_format = $format;
57
+ }
58
+
59
+ /**
60
+ * Send mail to recipient
61
+ *
62
+ * @param array|string $email E-mail(s)
63
+ * @param array|string|null $name receiver name(s)
64
+ * @param array $variables template variables
65
+ * @return boolean
66
+ **/
67
+ public function send($email, $name = null, array $variables = array())
68
+ {
69
+ if (!$this->isValidForSend()) {
70
+ Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted
71
+ return false;
72
+ }
73
+
74
+ $emails = array_values((array)$email);
75
+ $names = is_array($name) ? $name : (array)$name;
76
+ $names = array_values($names);
77
+ foreach ($emails as $key => $email) {
78
+ if (!isset($names[$key])) {
79
+ $names[$key] = substr($email, 0, strpos($email, '@'));
80
+ }
81
+ }
82
+
83
+ $variables['email'] = reset($emails);
84
+ $variables['name'] = reset($names);
85
+
86
+ ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
87
+ ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
88
+
89
+ $mail = $this->getMail();
90
+
91
+ $setReturnPath = Mage::getStoreConfig(self::XML_PATH_SENDING_SET_RETURN_PATH);
92
+ switch ($setReturnPath) {
93
+ case 1:
94
+ $returnPathEmail = $this->getSenderEmail();
95
+ break;
96
+ case 2:
97
+ $returnPathEmail = Mage::getStoreConfig(self::XML_PATH_SENDING_RETURN_PATH_EMAIL);
98
+ break;
99
+ default:
100
+ $returnPathEmail = null;
101
+ break;
102
+ }
103
+
104
+ if ($returnPathEmail !== null) {
105
+ $mailTransport = new Zend_Mail_Transport_Sendmail("-f".$returnPathEmail);
106
+ Zend_Mail::setDefaultTransport($mailTransport);
107
+ }
108
+
109
+ foreach ($emails as $key => $email) {
110
+ $mail->addTo($email, '=?utf-8?B?' . base64_encode($names[$key]) . '?=');
111
+ }
112
+
113
+ $this->setUseAbsoluteLinks(true);
114
+ $text = $this->getProcessedTemplate($variables, true);
115
+
116
+ switch($this->_format) {
117
+ case 0: // text
118
+ $text = strip_tags($text);
119
+ $mail->setBodyText($text);
120
+ break;
121
+ case 1: // html
122
+ $mail->setBodyHTML($text);
123
+ break;
124
+ case 2: // multipart
125
+ $mail->setBodyText($text);
126
+ $mail->setBodyHTML($text);
127
+ break;
128
+ }
129
+
130
+ $mail->setSubject('=?utf-8?B?' . base64_encode($this->getProcessedTemplateSubject($variables)) . '?=');
131
+ $mail->setFrom($this->getSenderEmail(), $this->getSenderName());
132
+
133
+ try {
134
+ $mail->send();
135
+ $this->_mail = null;
136
+ }
137
+ catch (Exception $e) {
138
+ $this->_mail = null;
139
+ Mage::logException($e);
140
+ return false;
141
+ }
142
+
143
+ return true;
144
+ }
145
+ }
app/code/local/DMK/Postman/Model/Lists.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Mailing lists
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Lists
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Mailing lists
34
+ */
35
+ class DMK_Postman_Model_Lists extends Mage_Core_Model_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize resource model
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Lists???
42
+ */
43
+ public function _construct()
44
+ {
45
+ parent::_construct();
46
+ $this->_init('postman/lists');
47
+ }
48
+
49
+ /**
50
+ * Method to get the current date and time
51
+ *
52
+ * @access public
53
+ * @return timestamp (??) Current date
54
+ */
55
+ public function getCurrentDate()
56
+ {
57
+ return Mage::getSingleton('core/date')->gmtDate();
58
+ }
59
+
60
+ /**
61
+ * Method to add the store/storeview IDs
62
+ *
63
+ * @access public
64
+ * @param array Store IDs
65
+ * @return ???
66
+ */
67
+ public function addStoreId($storeId)
68
+ {
69
+ $ids = $this->getStoreIds();
70
+ if (!in_array($storeId, $ids)) {
71
+ $ids[] = $storeId;
72
+ }
73
+ $this->setStoreIds($ids);
74
+ return $this;
75
+ }
76
+
77
+ /**
78
+ * Method to get the store/storeview IDs
79
+ *
80
+ * @access public
81
+ * @return ???
82
+ */
83
+ public function getStoreIds()
84
+ {
85
+ $ids = $this->_getData('store_ids');
86
+ if (is_null($ids)) {
87
+ $this->loadStoreIds();
88
+ $ids = $this->getData('store_ids');
89
+ }
90
+ return $ids;
91
+ }
92
+
93
+ /**
94
+ * Method to load the store/store view IDs
95
+ *
96
+ * @access public
97
+ * @return ???
98
+ */
99
+ public function loadStoreIds()
100
+ {
101
+ $this->_getResource()->loadStoreIds($this);
102
+ }
103
+
104
+ /**
105
+ * Method to add the customer group IDs
106
+ *
107
+ * @access public
108
+ * @param array Customer group IDs
109
+ * @return ???
110
+ */
111
+ public function addCustomerGroupId($customerGroupId)
112
+ {
113
+ $ids = $this->getCustomerGroupIds();
114
+ if (!in_array($customerGroupId, $ids)) {
115
+ $ids[] = $customerGroupId;
116
+ }
117
+ $this->setStoreIds($ids);
118
+ return $this;
119
+ }
120
+
121
+ /**
122
+ * Method to get the customer group IDs
123
+ *
124
+ * @access public
125
+ * @return ???
126
+ */
127
+ public function getCustomerGroupIds()
128
+ {
129
+ $ids = $this->_getData('customer_group_ids');
130
+ if (is_null($ids)) {
131
+ $this->loadCustomerGroupIds();
132
+ $ids = $this->getData('customer_group_ids');
133
+ }
134
+ return $ids;
135
+ }
136
+
137
+ /**
138
+ * Method to load the customer group IDs
139
+ *
140
+ * @access public
141
+ * @return ???
142
+ */
143
+ public function loadCustomerGroupIds()
144
+ {
145
+ $this->_getResource()->loadCustomerGroupIds($this);
146
+ }
147
+
148
+ public function getIdByTitle($title, $storeIds)
149
+ {
150
+ $resource = Mage::getSingleton('core/resource');
151
+ $connection = $resource->getConnection('core_read');
152
+ $table = $resource->getTableName('postman/postman_lists');
153
+ $table2 = $resource->getTableName('postman/postman_lists_customer_group');
154
+ $select = $connection->select('list_id')->from(array('li' => $table))
155
+ ->join(array('licg' => $table2),
156
+ 'li.list_id = licg.list_id')
157
+ ->where('li.list_title=?', $title)
158
+ ->where('licg.customer_group_id IN (?)', $storeIds);
159
+ $result = $connection->fetchOne($select);
160
+
161
+ return $result;
162
+ }
163
+ }
app/code/local/DMK/Postman/Model/Mysql4/Lists.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Mailing lists
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Mysql4 Lists
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Mailing lists
34
+ */
35
+ class DMK_Postman_Model_Mysql4_Lists extends Mage_Core_Model_Mysql4_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize connection
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Mysql4_Lists???
42
+ */
43
+ public function _construct()
44
+ {
45
+ $this->_init('postman/postman_lists', 'list_id');
46
+ }
47
+
48
+ /**
49
+ * Method to load the store/storeview IDs
50
+ *
51
+ * @access public
52
+ * @param Dmk_Postman_Model_Lists $object
53
+ * @return ???
54
+ */
55
+ public function loadStoreIds(Dmk_Postman_Model_Lists $object)
56
+ {
57
+ $listId = $object->getId();
58
+ $storeIds = array();
59
+ if ($listId) {
60
+ $storeIds = $this->lookupStoreIds($listId);
61
+ }
62
+ $object->setStoreIds($storeIds);
63
+ }
64
+
65
+ /**
66
+ * Method to load the customer group IDs
67
+ *
68
+ * @access public
69
+ * @param Dmk_Postman_Model_Lists $object
70
+ * @return ???
71
+ */
72
+ public function loadCustomerGroupIds(Dmk_Postman_Model_Lists $object)
73
+ {
74
+ $listId = $object->getId();
75
+ $customerGroupIds = array();
76
+ if ($listId) {
77
+ $customerGroupIds = $this->lookupCustomerGroupIds($listId);
78
+ }
79
+ $object->setCustomerGroupIds($customerGroupIds);
80
+ }
81
+
82
+ /**
83
+ * Method to save the selected customer groups and stores/storeviews
84
+ *
85
+ * (non-PHPdoc)
86
+ * @see app/code/core/Mage/Core/Model/Mysql4/Mage_Core_Model_Mysql4_Abstract#_afterSave($object)
87
+ */
88
+ public function _afterSave(Mage_Core_Model_Abstract $object)
89
+ {
90
+ if ($object->getTrashFlag() == 0) {
91
+ $deleteWhere = $this->_getWriteAdapter()->quoteInto('list_id = ?', $object->getId());
92
+ $this->_getWriteAdapter()->delete($this->getTable('postman/postman_lists_store'), $deleteWhere);
93
+ $this->_getWriteAdapter()->delete($this->getTable('postman/postman_lists_customer_group'), $deleteWhere);
94
+
95
+ foreach ($object->getStoreIds() as $storeId) {
96
+ $listStoreData = array(
97
+ 'list_id' => $object->getId(),
98
+ 'store_id' => $storeId
99
+ );
100
+ $this->_getWriteAdapter()->insert($this->getTable('postman/postman_lists_store'), $listStoreData);
101
+ }
102
+
103
+ foreach ($object->getCustomerGroupIds() as $customerGroupId) {
104
+ $listCustomerGroupData = array(
105
+ 'list_id' => $object->getId(),
106
+ 'customer_group_id' => $customerGroupId
107
+ );
108
+ $this->_getWriteAdapter()->insert($this->getTable('postman/postman_lists_customer_group'), $listCustomerGroupData);
109
+ }
110
+ }
111
+
112
+ }
113
+
114
+ /**
115
+ * Method to get the store IDs to which the specified mailing list is assigned
116
+ *
117
+ * @access public
118
+ * @param int Mailing list ID
119
+ * @return array Store IDs
120
+ */
121
+ public function lookupStoreIds($id)
122
+ {
123
+ return $this->_getReadAdapter()->fetchCol($this->_getReadAdapter()->select()
124
+ ->from($this->getTable('postman/postman_lists_store'), 'store_id')
125
+ ->where("{$this->getIdFieldName()} = ?", $id)
126
+ );
127
+ }
128
+
129
+ /**
130
+ * Method to get the store IDs to which the specified mailing list is assigned
131
+ *
132
+ * @access public
133
+ * @param int Mailing list ID
134
+ * @return array Store IDs
135
+ */
136
+ public function lookupCustomerGroupIds($id)
137
+ {
138
+ return $this->_getReadAdapter()->fetchCol($this->_getReadAdapter()->select()
139
+ ->from($this->getTable('postman/postman_lists_customer_group'), 'customer_group_id')
140
+ ->where("{$this->getIdFieldName()} = ?", $id)
141
+ );
142
+ }
143
+ }
app/code/local/DMK/Postman/Model/Mysql4/Lists/Collection.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Mailing lists
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Mysql4 Lists Collection
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Mailing lists
34
+ */
35
+ class DMK_Postman_Model_Mysql4_Lists_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize the collection
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Mysql4_Lists_Collection???
42
+ */
43
+ public function _construct()
44
+ {
45
+ $this->_init('postman/lists');
46
+ }
47
+
48
+ /**
49
+ * Method to redefine the default filters
50
+ *
51
+ * @access public
52
+ * @param string Database field
53
+ * @param mixed Condition
54
+ * @return Varien_Data_Collection_Db
55
+ */
56
+ public function addFieldToFilter($field, $condition=null)
57
+ {
58
+ if ($field == 'stores') {
59
+ return $this->addStoreFilter($condition);
60
+ }
61
+ else {
62
+ return parent::addFieldToFilter($field, $condition);
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Method to add the stores filter
68
+ *
69
+ * @access public
70
+ * @param int|array Store IDs
71
+ * @return DMK_Postman_Model_Mysql4_Lists_Collection
72
+ */
73
+ public function addStoreFilter($storeId, $withAdmin = true)
74
+ {
75
+ $this->getSelect()->join(
76
+ array('store_table' => $this->getTable('postman/postman_lists_store')),
77
+ 'main_table.list_id = store_table.list_id',
78
+ array()
79
+ )
80
+ ->where('store_table.store_id in (?)', ($withAdmin ? array(0, $storeId) : $storeId))
81
+ ->group('main_table.list_id');
82
+
83
+ return $this;
84
+ }
85
+
86
+ /**
87
+ * Method to add the stores data
88
+ *
89
+ * @access public
90
+ * @return DMK_Postman_Model_Mysql4_Lists_Collection
91
+ */
92
+ public function addStoreData()
93
+ {
94
+ $listIds = $this->getColumnValues('list_id');
95
+ $storesToList = array();
96
+
97
+ if (count($listIds) > 0) {
98
+ $select = $this->getConnection()->select()
99
+ ->from($this->getTable('postman/postman_lists_store'))
100
+ ->where('list_id IN(?)', $listIds);
101
+ $result = $this->getConnection()->fetchAll($select);
102
+
103
+ foreach ($result as $row) {
104
+ if (!isset($storesToList[$row['list_id']])) {
105
+ $storesToList[$row['list_id']] = array();
106
+ }
107
+ $storesToList[$row['list_id']][] = $row['store_id'];
108
+ }
109
+ }
110
+
111
+ foreach ($this as $item) {
112
+ if(isset($storesToList[$item->getId()])) {
113
+ $item->setStores($storesToList[$item->getId()]);
114
+ } else {
115
+ $item->setStores(array());
116
+ }
117
+ }
118
+
119
+ return $this;
120
+ }
121
+
122
+ /**
123
+ * Method to select the stores/storeviews which are assigned to the mailing lists
124
+ *
125
+ * @access public
126
+ * @return ???
127
+ */
128
+ public function addSelectStores()
129
+ {
130
+ $listId = $this->getId();
131
+ $select = $this->getConnection()->select()
132
+ ->from($this->getTable('postman/postman_lists_store'))
133
+ ->where('list_id = ?', $listId);
134
+ $result = $this->getConnection()->fetchAll($select);
135
+ $stores = array();
136
+ foreach ($result as $row) {
137
+ $stores[] = $row['list_id'];
138
+ }
139
+ $this->setSelectStores($stores);
140
+
141
+ return $this;
142
+ }
143
+ }
app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Queue.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Mysql4 Newsletters Queue
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Model_Mysql4_Newsletters_Queue extends Mage_Core_Model_Mysql4_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize connection
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Mysql4_Newsletters_Queue???
42
+ */
43
+ public function _construct()
44
+ {
45
+ $this->_init('postman/postman_sendmailqueue', 'sendmailqueue_id');
46
+ }
47
+
48
+ }
app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Queue/Collection.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Mysql4 Newsletters Queue Collection
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Model_Mysql4_Newsletters_Queue_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize the collection
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Mysql4_Newsletters_Queue_Collection???
42
+ */
43
+ public function _construct()
44
+ {
45
+ $this->_init('postman/newsletters_queue');
46
+ }
47
+ }
app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Queuecontent.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Mysql4 Newsletters Queuecontent
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Model_Mysql4_Newsletters_Queuecontent
36
+ extends Mage_Core_Model_Mysql4_Abstract
37
+ {
38
+ /**
39
+ * Method to initialize connection
40
+ *
41
+ * @access public
42
+ */
43
+ public function _construct()
44
+ {
45
+ $this->_init('postman/postman_sendmailcontent', 'sendmailcontent_id');
46
+ }
47
+
48
+
49
+ /**
50
+ * Get sendmailcontent by matching sendmailqueue entry
51
+ *
52
+ * @param integer $cId sendmailcontent_id
53
+ * @param integer $cFormat sendmailcontent_emailformat
54
+ *
55
+ * @return array $result data set with newsletter content, subject
56
+ */
57
+ public function getContentByQueue($cId, $cFormat)
58
+ {
59
+ $select = $this->_getReadAdapter()
60
+ ->select()
61
+ ->from($this->getTable('postman/postman_sendmailcontent'))
62
+ ->where('sendmailcontent_id=?', $cId)
63
+ ->where('sendmailcontent_emailformat=?', $cFormat);
64
+
65
+ $result = $this->_getReadAdapter()->fetchAll($select);
66
+
67
+ return($result[0]);
68
+ }
69
+
70
+ }
app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Queuecontent/Collection.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Mysql4 Newsletters Queue Collection
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Model_Mysql4_Newsletters_Queuecontent_Collection
36
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
37
+ {
38
+ /**
39
+ * Method to initialize the collection
40
+ *
41
+ * @access public
42
+ */
43
+ public function _construct()
44
+ {
45
+ $this->_init('postman/newsletters_queuecontent');
46
+ }
47
+ }
app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Sent.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Mysql4 Newsletters Sent
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+
36
+ class DMK_Postman_Model_Mysql4_Newsletters_Sent extends Mage_Core_Model_Mysql4_Abstract
37
+ {
38
+ /**
39
+ * Method to initialize connection
40
+ *
41
+ * @access public
42
+ * @return DMK_Postman_Model_Mysql4_Newsletters_Sent
43
+ */
44
+ public function _construct()
45
+ {
46
+ $this->_init('postman/postman_newsletters', 'newsletter_id');
47
+ }
48
+
49
+ }
app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Sent/Collection.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Mysql4 Newsletters Sent Collection
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Model_Mysql4_Newsletters_Sent_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize the collection
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Mysql4_Newsletters_Sent_Collection???
42
+ */
43
+ public function _construct()
44
+ {
45
+ $this->_init('postman/newsletters_sent');
46
+ }
47
+ }
app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Unsent.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Mysql4 Newsletters Unsent
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Model_Mysql4_Newsletters_Unsent extends Mage_Core_Model_Mysql4_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize connection
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Mysql4_Newsletters_Unsent???
42
+ */
43
+ public function _construct()
44
+ {
45
+ $this->_init('postman/postman_newsletters', 'newsletter_id');
46
+ }
47
+
48
+
49
+ /**
50
+ * Method to get recipients
51
+ *
52
+ * @access public
53
+ * @param int $isTest 0|1
54
+ * @return object Testrecipients
55
+ */
56
+ public function getRecipients($isTest)
57
+ {
58
+ $where = $isTest ? 'subscriber_status = 9' // test subscriber
59
+ : 'subscriber_status = 1'; // confirmed subscriber
60
+
61
+ $select = $this->_getReadAdapter()->select()
62
+ ->from($this->getTable('postman/postman_subscribers'))
63
+ ->where($where);
64
+
65
+ $result = $this->_getReadAdapter()->fetchAll($select);
66
+
67
+ return($result);
68
+ }
69
+
70
+ /**
71
+ * Method to get the next free ID in the sendmailcontent-table
72
+ *
73
+ * @access public
74
+ * @return int ID
75
+ */
76
+ public function getNextId()
77
+ {
78
+ $select = $this->_getReadAdapter()
79
+ ->select()
80
+ ->from($this->getTable('postman/postman_sendmailcontent'), 'IFNULL(MAX(sendmailcontent_id)+1,1)');
81
+
82
+ $result = $this->_getReadAdapter()->fetchOne($select);
83
+ return($result);
84
+ }
85
+
86
+ /**
87
+ * Method to store the newsletter in the sendmailcontent-table
88
+ *
89
+ * @access public
90
+ * @param array Newsletter data
91
+ */
92
+ public function saveSendMailContent($data)
93
+ {
94
+ $select = $this->_getWriteAdapter()->insert($this->getTable('postman/postman_sendmailcontent'), $data);
95
+ }
96
+
97
+ /**
98
+ * Method to store the recipients data (testrecipients or subscribers) in the sendmailqueue-table
99
+ *
100
+ * @access public
101
+ * @param array Subscriber/Testrecipient data
102
+ */
103
+ public function saveSendMailQueue($data)
104
+ {
105
+ $select = $this->_getWriteAdapter()->insert($this->getTable('postman/postman_sendmailqueue'), $data);
106
+ }
107
+
108
+ /**
109
+ * Method to store the newsletters lists
110
+ *
111
+ * @access public
112
+ * @param array $data
113
+ */
114
+ public function saveNewslettersLists($data)
115
+ {
116
+ $select = $this->_getWriteAdapter()->insert($this->getTable('postman/postman_newsletters_lists'), $data);
117
+ }
118
+
119
+ }
app/code/local/DMK/Postman/Model/Mysql4/Newsletters/Unsent/Collection.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Mysql4 Newsletters Unsent Collection
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Model_Mysql4_Newsletters_Unsent_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize the collection
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Mysql4_Newsletters_Unsent_Collection
42
+ */
43
+ public function _construct()
44
+ {
45
+ $this->_init('postman/newsletters_unsent');
46
+ }
47
+ }
app/code/local/DMK/Postman/Model/Mysql4/Subscribers/Import.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class DMK_Postman_Model_Mysql4_Subscribers_Import extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ /**
5
+ * Count of imported subscribers
6
+ *
7
+ * @var int
8
+ */
9
+ protected $_importedRows = 0;
10
+
11
+
12
+ public function _construct()
13
+ {
14
+ $this->_init('postman/subscribers_subscribers', 'subscriber_id');
15
+ }
16
+
17
+
18
+ public function uploadAndImport(Varien_Object $obj)
19
+ {
20
+ $data = $obj->getData();
21
+ $fileName = $data['value'];
22
+ $fieldName = $data['field'];
23
+ $saveDir = Mage::getBaseDir('tmp');
24
+ $tmpDirFile = $_FILES['groups']['tmp_name']['import_subscribers']['fields'][$fieldName]['value'];
25
+
26
+ $io = new Varien_Io_File();
27
+ $info = pathinfo($tmpDirFile);
28
+ $io->open(array('path' => $info['dirname']));
29
+ $io->streamOpen($info['basename'], 'r');
30
+
31
+ while (false !== ($csvLine = $io->streamReadCsv())) {
32
+ $rowNumber ++;
33
+
34
+ if (empty($csvLine)) {
35
+ continue;
36
+ }
37
+
38
+ $row = $this->_getImportRow($csvLine, $rowNumber);
39
+ if ($row !== false) {
40
+ $importData[] = $row;
41
+ $this->_saveImportData($importData);
42
+ $importData = array();
43
+ }
44
+ }
45
+ $this->_saveImportData($importData);
46
+ $io->streamClose();
47
+
48
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('postman')->__('%s rows have been imported',
49
+ $this->_importedRows));
50
+
51
+ }
52
+
53
+
54
+ private function _getImportRow($row, $rowNumber)
55
+ {
56
+ // validate row
57
+ if (count($row) < 13) {
58
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('postman')->__('Invalid postman import format in row #%s',
59
+ $rowNumber));
60
+ return false;
61
+ }
62
+
63
+ // validate id
64
+ if($row[0] == '' || !preg_match('/[0-9]/', $row[0])) {
65
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('postman')->__('Invalid id \'%s\' in row #%s',
66
+ $row[0], $rowNumber));
67
+ return false;
68
+ }
69
+
70
+ // validate customer id
71
+ if($row[1] == '' || !preg_match('/[0-9]/', $row[0])) {
72
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('postman')->__('Invalid customer id \'%s\' in row #%s',
73
+ $row[1], $rowNumber));
74
+ return false;
75
+ }
76
+
77
+ // validate subscriber email
78
+ if($row[3] == '' || !Zend_Validate::is($row[3], 'EmailAddress')) {
79
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('postman')->__('Invalid subscriber email \'%s\' in row #%s',
80
+ $row[3], $rowNumber));
81
+ return false;
82
+ }
83
+
84
+ // validate subscriber email format
85
+ if($row[4] == '' || !preg_match('/[0-9]/', $row[4]) || $row[4] > 2) {
86
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('postman')->__('Invalid subscriber email format \'%s\' in row #%s',
87
+ $row[4], $rowNumber));
88
+ return false;
89
+ }
90
+
91
+ // validate subscriber status
92
+ if($row[5] == '' || ($row[5] != 0 && $row[5] != 1 && $row[5] != 9)) {
93
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('postman')->__('Invalid subscriber status \'%s\' in row #%s',
94
+ $row[5], $rowNumber));
95
+ return false;
96
+ }
97
+
98
+ return $row;
99
+ }
100
+
101
+
102
+ /**
103
+ * Save import data batch
104
+ *
105
+ * @param array $data
106
+ * @return DMK_Postman_Model_Mysql4_Subscribers_Import
107
+ */
108
+ protected function _saveImportData(array $data)
109
+ {
110
+ if (!empty($data)) {
111
+ $columns = array('subscriber_id', 'customer_id', 'subscriber_name',
112
+ 'subscriber_email', 'subscriber_emailformat',
113
+ 'subscriber_status', 'subscriber_activation',
114
+ 'subscriber_editlink', 'subscriber_registration_date',
115
+ 'subscriber_registered_by', 'subscriber_registration_ip',
116
+ 'subscriber_confirmation_date', 'subscriber_confirmed_by',
117
+ );
118
+ $table = Mage::getSingleton('core/resource')->getTableName('postman/postman_subscribers');
119
+ $this->_getWriteAdapter()->insertArray($table, $columns, $data);
120
+ $this->_importedRows += count($data);
121
+ }
122
+
123
+ return $this;
124
+ }
125
+
126
+ }
127
+ ?>
app/code/local/DMK/Postman/Model/Mysql4/Subscribers/Subscribers.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Mysql4 Subscribers Subscribers
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Model_Mysql4_Subscribers_Subscribers extends Mage_Core_Model_Mysql4_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize connection
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Mysql4_Subscribers_Subscribers???
42
+ */
43
+ public function _construct()
44
+ {
45
+ $this->_init('postman/postman_subscribers', 'subscriber_id');
46
+ }
47
+ }
app/code/local/DMK/Postman/Model/Mysql4/Subscribers/Subscribers/Collection.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Mysql4 Subscribers Subscribers Collection
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Model_Mysql4_Subscribers_Subscribers_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize the collection
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Mysql4_Subscribers_Subscribers_Collection???
42
+ */
43
+ public function _construct()
44
+ {
45
+ $this->_init('postman/subscribers_subscribers');
46
+ }
47
+ }
app/code/local/DMK/Postman/Model/Mysql4/Subscribers/Testrecipients.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Mysql4 Subscribers Testrecipients
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Model_Mysql4_Subscribers_Testrecipients extends Mage_Core_Model_Mysql4_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize connection
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Mysql4_Subscribers_Testrecipients???
42
+ */
43
+ public function _construct()
44
+ {
45
+ $this->_init('postman/postman_subscribers', 'subscriber_id');
46
+ }
47
+ }
app/code/local/DMK/Postman/Model/Mysql4/Subscribers/Testrecipients/Collection.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Mysql4 Subscribers Testrecipients Collection
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+
36
+ class DMK_Postman_Model_Mysql4_Subscribers_Testrecipients_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
37
+ {
38
+ /**
39
+ * Method to initialize the collection
40
+ *
41
+ * @access public
42
+ * @return DMK_Postman_Model_Mysql4_Subscribers_Testrecipients_Collection???
43
+ */
44
+ public function _construct()
45
+ {
46
+ $this->_init('postman/subscribers_testrecipients');
47
+ }
48
+ }
app/code/local/DMK/Postman/Model/Newsletters/Queue.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Newsletters Queue
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Model_Newsletters_Queue extends Mage_Core_Model_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize resource model
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Newsletters_Queue???
42
+ */
43
+ public function _construct()
44
+ {
45
+ parent::_construct();
46
+ $this->_init('postman/newsletters_queue');
47
+ }
48
+
49
+ }
app/code/local/DMK/Postman/Model/Newsletters/Sent.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Newsletters Sent
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Model_Newsletters_Sent extends Mage_Core_Model_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize resource model
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Newsletters_Sent???
42
+ */
43
+ public function _construct()
44
+ {
45
+ parent::_construct();
46
+ $this->_init('postman/newsletters_sent');
47
+ }
48
+
49
+ /**
50
+ * Method to get the current date and time
51
+ *
52
+ * @access public
53
+ * @return timestamp (??) Current date
54
+ */
55
+ public function getCurrentDate()
56
+ {
57
+ return Mage::getSingleton('core/date')->gmtDate();
58
+ }
59
+ }
app/code/local/DMK/Postman/Model/Newsletters/Unsent.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Newsletters Unsent
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Model_Newsletters_Unsent extends Mage_Core_Model_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize resource model
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Newsletters_Unsent???
42
+ */
43
+ public function _construct()
44
+ {
45
+ parent::_construct();
46
+ $this->_init('postman/newsletters_unsent');
47
+ }
48
+
49
+ /**
50
+ * Method to get the current date and time
51
+ *
52
+ * @access public
53
+ * @return timestamp (??) Current date
54
+ */
55
+ public function getCurrentDate()
56
+ {
57
+ return Mage::getSingleton('core/date')->gmtDate();
58
+ }
59
+
60
+ /**
61
+ * Method to get the testrecipients
62
+ *
63
+ * @access public
64
+ * @return ???
65
+ */
66
+ public function getRecipients($isTest)
67
+ {
68
+ return $this->_getResource()->getRecipients($isTest);
69
+ }
70
+
71
+ /**
72
+ * Method to get the next free ID in the sendmailcontent-table
73
+ *
74
+ * @access public
75
+ * @return ???
76
+ */
77
+ public function getNextId()
78
+ {
79
+ return $this->_getResource()->getNextId();
80
+ }
81
+
82
+ /**
83
+ * Method to store the newsletter in the sendmailcontent-table
84
+ *
85
+ * @access public
86
+ * @param array Newsletter data
87
+ * @return ???
88
+ */
89
+ public function saveSendMailContent($data)
90
+ {
91
+ $this->_getResource()->saveSendMailContent($data);
92
+ }
93
+
94
+ /**
95
+ * Method to store the recipients data (testrecipients or subscribers) in the sendmailqueue-table
96
+ *
97
+ * @access public
98
+ * @param array Subscriber/Testrecipient data
99
+ * @return ???
100
+ */
101
+ public function saveSendMailQueue($data)
102
+ {
103
+ $this->_getResource()->saveSendMailQueue($data);
104
+ }
105
+
106
+ /**
107
+ * Saves the selected mailinglists to a newsletter
108
+ * @param array $data
109
+ * @return ??
110
+ */
111
+ public function saveNewslettersLists($id, $data)
112
+ {
113
+ foreach($data as $item) {
114
+ $arr = array(
115
+ 'newsletter_id' => $id,
116
+ 'list_id' => $item[0],
117
+ );
118
+ $this->_getResource()->saveNewslettersLists($arr);
119
+ }
120
+ }
121
+ }
app/code/local/DMK/Postman/Model/Observer.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DMK_Postman_Model_Observer {
4
+
5
+ public function checkForEmailsToSend(){
6
+ $mailQueue = Mage::getModel('postman/newsletters_queue')->getCollection();
7
+ $cntQueue = count($mailQueue);
8
+
9
+ if($cntQueue != 0) {
10
+ $i = 1;
11
+ foreach($mailQueue as $customer) {
12
+
13
+ $qId = $customer->getSendmailcontentId();
14
+
15
+ $neSubscriberName = $customer->getSubscriberName();
16
+ $neSubscriberEmail = $customer->getSubscriberEmail();
17
+ $neAction = 'sendnews';
18
+ $neFormat = $customer->getSubscriberEmailformat();
19
+
20
+ $dbResult = Mage::getResourceModel('postman/newsletters_queuecontent')
21
+ ->getContentByQueue($qId, $neFormat);
22
+
23
+ $neContent = $dbResult['newsletter_body'];
24
+ $neSubject = $dbResult['newsletter_subject'];
25
+
26
+ try {
27
+ Mage::helper('postman/Email')->sendEmail($neSubscriberName,
28
+ $neSubscriberEmail,
29
+ $neSubject, $neContent,
30
+ $neAction, $neFormat
31
+ );
32
+
33
+ $customer->delete();
34
+ if($cntQueue == $i){
35
+ $mailQueue->delete;
36
+ }
37
+
38
+ $i++;
39
+
40
+ } catch (Exception $e) {
41
+ Mage::log($e->getMessage());
42
+ }
43
+
44
+ $customerCollection = Mage::getResourceModel('postman/newsletters_unsent_collection')
45
+ ->addFieldToFilter('subscriber_id',
46
+ $customer->getSubsriberId);
47
+ $customerCollection->getFirstItem()
48
+ ->setNewsletterMailingDate(
49
+ Mage::getSingleton('core/date')->gmtDate()
50
+ );
51
+ }
52
+ } else {
53
+ Mage::log('Mail queue size:'.$cntQueue.'. Nothing to send.');
54
+ }
55
+
56
+ }
57
+ }
app/code/local/DMK/Postman/Model/Subscribers/Import.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class DMK_Postman_Model_Subscribers_Import extends Mage_Core_Model_Config_Data
3
+ {
4
+
5
+ public function _afterSave()
6
+ {
7
+ Mage::getResourceModel('postman/subscribers_import')->uploadAndImport($this);
8
+ }
9
+
10
+ }
11
+ ?>
app/code/local/DMK/Postman/Model/Subscribers/Subscribers.php ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Subscribers Subscribers
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Model_Subscribers_Subscribers extends Mage_Core_Model_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize resource model
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Subscribers_Subscribers???
42
+ */
43
+ public function _construct()
44
+ {
45
+ parent::_construct();
46
+ $this->_init('postman/subscribers_subscribers');
47
+ }
48
+
49
+ /**
50
+ * Method to get the current date and time
51
+ *
52
+ * @access public
53
+ * @return timestamp (??) Current date
54
+ */
55
+ public function getCurrentDate()
56
+ {
57
+ return Mage::getSingleton('core/date')->gmtDate();
58
+ }
59
+
60
+ /**
61
+ * Method to get the mailing lists and the subscribed mailing lists of the subscriber
62
+ *
63
+ * @access public
64
+ * @param bool $empty
65
+ * @return array $options
66
+ */
67
+ public function getListValuesForForm($empty = false)
68
+ {
69
+ $options = array();
70
+ $resource = Mage::getSingleton('core/resource');
71
+ $connection = $resource->getConnection('core_read');
72
+ $table = $resource->getTableName('postman/postman_lists');
73
+ $select = $connection->select()->from(array('li' => $table),
74
+ array('list_id', 'list_title'))
75
+ ->where('li.is_active=?', 1);
76
+ $result = $connection->fetchAll($select);
77
+
78
+ foreach($result as $res) {
79
+ $options[] = array(
80
+ 'label' => $res['list_title'],
81
+ 'value' => $res['list_id'],
82
+ );
83
+ }
84
+
85
+ return $options;
86
+ }
87
+
88
+ /**
89
+ * Method to get the mailing lists that the subscriber has been subscribed
90
+ */
91
+ public function getSelectedListsForSubscriber($subscriberId)
92
+ {
93
+ $sortedItems = array();
94
+ $resource = Mage::getSingleton('core/resource');
95
+ $connection = $resource->getConnection('core_read');
96
+ $table = $resource->getTableName('postman/postman_subscribers_lists');
97
+ $select = $connection->select()->from(array('li' => $table),
98
+ array('li.list_id', 'li.subscriber_id'))
99
+ ->where('li.subscriber_id=?', $subscriberId);
100
+ $result = $connection->fetchAll($select);
101
+
102
+ foreach($result as $res) {
103
+ array_push($sortedItems, $res['list_id']);
104
+ }
105
+
106
+ return $sortedItems;
107
+ }
108
+
109
+ /**
110
+ * Method to get the customer ID referring to the e-mail address
111
+ *
112
+ * @access public
113
+ * @param string $email String E-mail address
114
+ * @return int $id Id of the customer
115
+ */
116
+ public function getCustomerId($email)
117
+ {
118
+ $resource = Mage::getSingleton('core/resource');
119
+ $connection = $resource->getConnection('core_read');
120
+ $table = $resource->getTableName('customer/entity', 'entity_id');
121
+ $select = $connection->select()
122
+ ->from(array('tr' => $table))
123
+ ->where('email=?', $email);
124
+ $id = $connection->fetchOne($select);
125
+ return $id;
126
+ }
127
+
128
+ /**
129
+ * Method to get the subscriber ID referring to the e-mail address
130
+ *
131
+ * @access public
132
+ * @param string $email, $format, $id
133
+ * @return int $result
134
+ */
135
+ public function getIdByEmailAndFormat($email, $format, $id)
136
+ {
137
+ $resource = Mage::getSingleton('core/resource');
138
+ $connection = $resource->getConnection('core_read');
139
+ $table = $resource->getTableName('postman/postman_subscribers');
140
+ $select = $connection->select()->from(array('tr' => $table),
141
+ 'subscriber_id')
142
+ ->where('tr.subscriber_email=?', $email)
143
+ ->where('tr.subscriber_emailformat=?', $format)
144
+ ->where('tr.subscriber_id<>?', $id);
145
+ $result = $connection->fetchOne($select);
146
+ return $result;
147
+ }
148
+
149
+ /**
150
+ * Set/save list-subscriber relation in database
151
+ *
152
+ * @access public
153
+ * @param array $lists
154
+ * @return boolean $return
155
+ */
156
+ public function setSelectedListsForSubscriber($newListValues, $subscriberId)
157
+ {
158
+ $resource = Mage::getSingleton('core/resource');
159
+ $connection = $resource->getConnection('core_write');
160
+ $table = $resource->getTableName('postman/postman_subscribers_lists');
161
+ $oldListValues = $this->getSelectedListsForSubscriber($subscriberId);
162
+ $mergeValues = array_merge($oldListValues,$newListValues);
163
+ $mergeValues = array_unique($mergeValues);
164
+ $count = count($mergeValues);
165
+
166
+ for($i=0; $i<=$count; $i++){
167
+ if(!in_array($mergeValues[$i], $newListValues)) {
168
+ $deleteQry = 'DELETE FROM ' . $table
169
+ . ' WHERE list_id="' . $mergeValues[$i] . '"'
170
+ . ' AND subscriber_id = "' . $subscriberId . '"';
171
+ $connection->query($deleteQry);
172
+ }else if(in_array($mergeValues[$i], $newListValues) && !in_array($mergeValues[$i], $oldListValues)){
173
+ $insertQry = 'INSERT INTO ' . $table
174
+ . ' SET list_id="' . $mergeValues[$i] . '",'
175
+ . ' subscriber_id="' . $subscriberId . '"';
176
+ $connection->query($insertQry);
177
+ } else if(in_array($mergeValues[$i], $newListValues) && in_array($mergeValues[$i], $oldListValues)){
178
+ continue;
179
+ }
180
+ }
181
+ }
182
+
183
+ /**
184
+ * Set/save list-subscriber relation in database
185
+ *
186
+ * @access public
187
+ * @param array $lists
188
+ * @return boolean $return
189
+ */
190
+ public function getAllCustomers()
191
+ {
192
+ $resource = Mage::getSingleton('core/resource');
193
+ $connection = $resource->getConnection('core_write');
194
+ $table = $resource->getTableName('postman/postman_subscribers');
195
+ $select = $connection->select()->from(array('tr' => $table));
196
+ $result = $connection->fetchAll($select);
197
+
198
+ return $result;
199
+ }
200
+ }
app/code/local/DMK/Postman/Model/Subscribers/Testrecipients.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Model Subscribers Testrecipients
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Model_Subscribers_Testrecipients extends Mage_Core_Model_Abstract
36
+ {
37
+ /**
38
+ * Method to initialize resource model
39
+ *
40
+ * @access public
41
+ * @return DMK_Postman_Model_Subscribers_Testrecipients???
42
+ */
43
+ public function _construct()
44
+ {
45
+ parent::_construct();
46
+ $this->_init('postman/subscribers_testrecipients');
47
+ }
48
+
49
+ /**
50
+ * Method to get the current date and time
51
+ *
52
+ * @access public
53
+ * @return timestamp (??) Current date
54
+ */
55
+ public function getCurrentDate()
56
+ {
57
+ return Mage::getSingleton('core/date')->gmtDate();
58
+ }
59
+
60
+
61
+ /**
62
+ * Method to get the customer ID referring to the e-mail address
63
+ * @param string $email
64
+ * @return int $result
65
+ */
66
+ public function getCustomerId($email)
67
+ {
68
+ $resource = Mage::getSingleton('core/resource');
69
+ $connection = $resource->getConnection('core_read');
70
+ $table = $resource->getTableName('postman/postman_subscribers');
71
+ $select = $connection->select()->from(array('tr' => $table),
72
+ 'customer_id')
73
+ ->where('tr.subscriber_email=?', $email)
74
+ ->where('tr.subscriber_status=?', 9);
75
+ $result = $connection->fetchOne($select);
76
+
77
+ return $result;
78
+ }
79
+
80
+ /**
81
+ * Method to get the admin ID referring to the e-mail address
82
+ *
83
+ * @access public
84
+ * @param string $email
85
+ * @return int $result
86
+ */
87
+ public function getAdminId($email)
88
+ {
89
+ // $resource = Mage::getSingleton('core/resource');
90
+ // $connection = $resource->getConnection('core_read');
91
+ // $table = $resource->getTableName('postman/postman_subscribers');
92
+ // $select = $connection->select('subscriber_registered_by')->from(array('tr' => $table))
93
+ // ->where('tr.subscriber_email=?', $email)
94
+ // ->where('tr.subscriber_status=?', 9);
95
+ // $result = $connection->fetchOne($select);
96
+
97
+ $user = Mage::getSingleton('admin/session');
98
+ $id = $user->getUser()->getUserId();
99
+
100
+ return $id;
101
+ }
102
+
103
+ /**
104
+ * Method to get the subscriber ID referring to the e-mail address
105
+ *
106
+ * @access public
107
+ * @param string $email, $format, $id
108
+ * @return int $result
109
+ */
110
+ public function getIdByEmailAndFormat($email, $format, $id)
111
+ {
112
+ $resource = Mage::getSingleton('core/resource');
113
+ $connection = $resource->getConnection('core_read');
114
+ $table = $resource->getTableName('postman/postman_subscribers');
115
+ $select = $connection->select()->from(array('tr' => $table),
116
+ 'subscriber_id')
117
+ ->where('tr.subscriber_email=?', $email)
118
+ ->where('tr.subscriber_emailformat=?', $format)
119
+ ->where('tr.subscriber_id<>?', $id);
120
+ $result = $connection->fetchOne($select);
121
+ return $result;
122
+ }
123
+
124
+ }
app/code/local/DMK/Postman/Model/Variable/Config.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Core
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
+ * Variable Wysiwyg Plugin Config
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Core
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class DMK_Postman_Model_Variable_Config extends Mage_Core_Model_Variable_Config
35
+ {
36
+ /**
37
+ * Return url of action to get variables
38
+ *
39
+ * @return string
40
+ */
41
+ public function getVariablesWysiwygActionUrl()
42
+ {
43
+ $moduleName = Mage::app()->getRequest()->getModuleName();
44
+
45
+ if($moduleName == 'postman')
46
+ {
47
+
48
+ return Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/system_variable/wysiwygPlugin');
49
+ }
50
+ }
51
+ }
app/code/local/DMK/Postman/controllers/ActivateController.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * @version 0.1.0
22
+ * @package DMK Postman
23
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * DMK Postman Activate Controller
29
+ *
30
+ * @package DMK Postman
31
+ */
32
+
33
+ class DMK_Postman_ActivateController extends Mage_Core_Controller_Front_Action
34
+ {
35
+ /**
36
+ * Show the edit form for new registered subscribers to change newsletter format
37
+ */
38
+ public function editAction()
39
+ {
40
+ $this->loadLayout();
41
+
42
+ if(Mage::getSingleton('core/session')->getValidationPassed())
43
+ {
44
+ $block = $this->getLayout()
45
+ ->createBlock('Mage_Core_Block_Template',
46
+ 'edit-form-block',
47
+ array('template' => 'postman/newsletter/activate/account_editform.phtml'))
48
+ ->setData('tok', Mage::getSingleton('core/session')->getTok());
49
+
50
+ $this->getLayout()->getBlock('content')->append($block);
51
+
52
+ $this->renderLayout();
53
+ } else {
54
+ $this->_redirectUrl(Mage::getBaseUrl (Mage_Core_Model_Store::URL_TYPE_WEB));
55
+ }
56
+ }
57
+
58
+
59
+ /**
60
+ * Show the success message for successfully editing the values for
61
+ * new registered subscribers
62
+ */
63
+ public function successAction()
64
+ {
65
+ $this->loadLayout();
66
+
67
+ $token = $this->_getToken();
68
+ $nformat = $this->getRequest()->getParam('newsletterformat');
69
+ $user = Mage::helper('postman/Email')->checkActivationUrl($this->_getValidationUrl(),0);
70
+
71
+ if($this->getRequest()->isPost()
72
+ && !empty($token)
73
+ && !empty($nformat)
74
+ && $token === Mage::getSingleton('core/session')->getTok()
75
+ ) {
76
+ switch($nformat) {
77
+ case 'text':
78
+ $nformat = 0;
79
+ break;
80
+ case 'html':
81
+ $nformat = 1;
82
+ break;
83
+ case 'multi':
84
+ $nformat = 2;
85
+ break;
86
+ default:
87
+ $nformat = 2;
88
+ break;
89
+ }
90
+
91
+ Mage::getSingleton('core/session')->setValidationPassed(false);
92
+
93
+ $user->setSubscriberStatus(1);
94
+ $user->setSubscriberEmailformat($nformat);
95
+ $user->setSubscriberConfirmationDate(Mage::getModel('postman/subscribers_subscribers')->getCurrentDate());
96
+ $user->save();
97
+
98
+ $block = $this->getLayout()
99
+ ->createBlock('Mage_Core_Block_Template',
100
+ 'main-msg-block',
101
+ array('template' => 'postman/newsletter/activate/account_active.phtml'));
102
+ $this->getLayout()->getBlock('content')->append($block);
103
+
104
+ } else {
105
+
106
+ $block = $this->getLayout()
107
+ ->createBlock('Mage_Core_Block_Template',
108
+ 'main-msg-block',
109
+ array('template' => 'postman/newsletter/activate/account_already_active.phtml'));
110
+ $this->getLayout()->getBlock('content')->append($block);
111
+
112
+ }
113
+
114
+ $this->renderLayout();
115
+ }
116
+
117
+
118
+
119
+ /**
120
+ * Validate the email token
121
+ */
122
+ public function validateAction()
123
+ {
124
+ if($this->_getValidationUrl())
125
+ {
126
+ Mage::getSingleton('core/session')->setTok($this->_getToken());
127
+ $user = Mage::helper('postman/Email')->checkActivationUrl($this->_getValidationUrl(),0);
128
+
129
+ if(!empty($user))
130
+ {
131
+ Mage::getSingleton('core/session')->setUser($user);
132
+ Mage::getSingleton('core/session')->setValidationPassed(true);
133
+ $this->_redirect('*/*/edit', array('tok' => $this->_getToken()));
134
+ }
135
+
136
+ } else {
137
+ $this->_redirectUrl(Mage::getBaseUrl (Mage_Core_Model_Store::URL_TYPE_WEB));
138
+ }
139
+ }
140
+
141
+
142
+ /**
143
+ * Help function for building the current URL
144
+ */
145
+ private function _getValidationUrl()
146
+ {
147
+ $token = $this->_getToken();
148
+ if(!empty($token))
149
+ {
150
+ $baseUrl = Mage::getBaseUrl (Mage_Core_Model_Store::URL_TYPE_WEB);
151
+ return $baseUrl . 'postman/activate/validate?tok=' . $token;
152
+ }
153
+
154
+ return false;
155
+ }
156
+
157
+ /**
158
+ * Help function for getting the token
159
+ */
160
+ private function _getToken()
161
+ {
162
+ return $this->getRequest()->getParam('tok');
163
+ }
164
+
165
+
166
+
167
+ }
168
+
app/code/local/DMK/Postman/controllers/Adminhtml/ListsController.php ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Mailing lists
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Adminhtml Lists Controller
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Mailing lists
34
+ */
35
+ class DMK_Postman_Adminhtml_ListsController extends Mage_Adminhtml_Controller_Action
36
+ {
37
+ /**
38
+ * Method to set the page title for the grid
39
+ *
40
+ * @access protected
41
+ * @return DMK_Postman_Adminhtml_ListsController
42
+ */
43
+ protected function _setPageTitle()
44
+ {
45
+ return $this->_title($this->__('DMK Postman'))->_title($this->__('Mailing lists'));
46
+ }
47
+
48
+ /**
49
+ * Method to set the page title for edit form
50
+ *
51
+ * @access protected
52
+ * @return DMK_Postman_Adminhtml_ListsController
53
+ */
54
+ protected function _setEditPageTitle()
55
+ {
56
+ return $this->_title($this->__('DMK Postman'))->_title($this->__('Edit mailing list'));
57
+ }
58
+
59
+ /**
60
+ * Method to set the active menu and breadcrumbs
61
+ *
62
+ * @access protected
63
+ * @return DMK_Postman_Adminhtml_ListsController
64
+ */
65
+ protected function _initAction()
66
+ {
67
+ $this->loadLayout()
68
+ ->_setActiveMenu('postman/lists')
69
+ ->_addBreadcrumb(Mage::helper('postman')->__('Mailing Lists'), Mage::helper('postman')->__('Mailing lists'));
70
+ return $this;
71
+ }
72
+
73
+ /**
74
+ * Method to prepare and display the mailing lists grid
75
+ *
76
+ * @access public
77
+ */
78
+ public function indexAction()
79
+ {
80
+ $this->_setPageTitle();
81
+ $this->_initAction();
82
+ $this->_addContent($this->getLayout()->createBlock('postman/adminhtml_lists', 'lists'));
83
+ $this->renderLayout();
84
+ }
85
+
86
+ /**
87
+ * Method to create a new mailing list (is forwarded to edit action)
88
+ *
89
+ * @access public
90
+ */
91
+ public function newAction()
92
+ {
93
+ $this->_forward('edit');
94
+ }
95
+
96
+ /**
97
+ * Method to create/edit a mailing list
98
+ *
99
+ * @access public
100
+ * @return ???
101
+ */
102
+ public function editAction()
103
+ {
104
+ $this->_setEditPageTitle();
105
+
106
+ $model = Mage::getModel('postman/lists');
107
+
108
+ if ($id = $this->getRequest()->getParam('list_id')) {
109
+ $model->load($id);
110
+ }
111
+
112
+ Mage::register('list_data', $model);
113
+
114
+ $this->loadLayout();
115
+ $this->_setActiveMenu('postman/lists');
116
+
117
+ $this->_addContent($this->getLayout()->createBlock('postman/adminhtml_lists_edit'));
118
+ $this->renderLayout();
119
+ }
120
+
121
+ /**
122
+ * Method to save a mailing list
123
+ *
124
+ * @access public
125
+ * @return ???
126
+ */
127
+ public function saveAction()
128
+ {
129
+ if ( $this->getRequest()->getPost() ) {
130
+ $session = Mage::getSingleton('adminhtml/session');
131
+ $model = Mage::getModel('postman/lists');
132
+ $postData = $this->getRequest()->getPost();
133
+ $listId = $this->getRequest()->getParam('list_id');
134
+ $error = $this->checkDuplicateTitle($postData['list_title'],
135
+ $postData['customer_group_ids']
136
+ );
137
+
138
+ if($error
139
+ && empty($listId)
140
+ ) {
141
+ $session->addError(Mage::helper('postman')->__('This title and storeview already exist'));
142
+ $this->_redirect('*/*/edit', array('list_id' => $listId));
143
+ return;
144
+ }
145
+
146
+ try {
147
+
148
+ $model->addData($postData)->save();
149
+
150
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('postman')->__('The mailing list has successfully been deleted'));
151
+ Mage::getSingleton('adminhtml/session')->setData(false);
152
+
153
+ // check if 'Save and Continue'
154
+ if ($this->getRequest()->getParam('back')) {
155
+ $this->_redirect('*/*/edit', array('list_id' => $model->getId()));
156
+ return;
157
+ }
158
+
159
+ $this->_redirect('*/*/');
160
+ return;
161
+ } catch (Exception $e) {
162
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
163
+ Mage::getSingleton('adminhtml/session')->setData($this->getRequest()->getPost());
164
+ $this->_redirect('*/*/edit', array('list_id' => $listId));
165
+ return;
166
+ }
167
+ }
168
+
169
+ $this->_redirect('*/*/');
170
+ }
171
+
172
+ /**
173
+ * Method to delete a mailing list
174
+ *
175
+ * @access public
176
+ * @return ???
177
+ */
178
+ public function deleteAction()
179
+ {
180
+ if( $this->getRequest()->getParam('list_id') > 0 ) {
181
+ try {
182
+ $model = Mage::getModel('postman/lists');
183
+ $model->setId($this->getRequest()->getParam('list_id'))
184
+ ->delete();
185
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('postman')
186
+ ->__('The mailing list has successfully been deleted'));
187
+ $this->_redirect('*/*/');
188
+ } catch (Exception $e) {
189
+ Mage::log('adminhtml/session')->addError($e->getMessage());
190
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
191
+ $this->_redirect('*/*/edit', array('list_id' => $this->getRequest()->getParam('list_id')));
192
+ }
193
+ }
194
+
195
+ $this->_redirect('*/*/');
196
+ }
197
+
198
+
199
+ /**
200
+ * Method to get the current date and time
201
+ *
202
+ * @access private
203
+ * @return timestamp (??) Current date
204
+ */
205
+ private function getCurrentDate()
206
+ {
207
+ $model = Mage::getModel('postman/subscribers_subscribers');
208
+ $currentDate = $model->getCurrentDate();
209
+
210
+ return $currentDate;
211
+ }
212
+
213
+ /**
214
+ * Method to check if a title already exists
215
+ *
216
+ * @param string $title
217
+ * @param type $storeIds
218
+ * @return int $id
219
+ */
220
+ private function checkDuplicateTitle($title, $storeIds)
221
+ {
222
+ $model = Mage::getModel('postman/lists');
223
+ $id = $model->getIdByTitle($title, $storeIds);
224
+
225
+ return $id ? true : false;
226
+ }
227
+ }
app/code/local/DMK/Postman/controllers/Adminhtml/Newsletters/QueueController.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Adminhtml Newsletter Queue Controller
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Adminhtml_Newsletters_QueueController extends Mage_Adminhtml_Controller_Action
36
+ {
37
+ /**
38
+ * Method to set the page title for the grid
39
+ *
40
+ * @access protected
41
+ * @return DMK_Postman_Adminhtml_Newsletters_QueueController
42
+ */
43
+ protected function _setTitle()
44
+ {
45
+ return $this->_title($this->__('DMK Postman'))->_title($this->__('Newsletters queue'));
46
+ }
47
+
48
+ /**
49
+ * Method to set the active menu and breadcrumbs
50
+ *
51
+ * @access protected
52
+ * @return DMK_Postman_Adminhtml_Newsletters_QueueController
53
+ */
54
+ protected function _initAction()
55
+ {
56
+ $this->loadLayout()
57
+ ->_setActiveMenu('postman/newsletters_queue')
58
+ ->_addBreadcrumb(Mage::helper('postman')->__('Newsletters queue'),
59
+ Mage::helper('postman')->__('Newsletters queue'));
60
+ return $this;
61
+ }
62
+
63
+ /**
64
+ * Method to prepare and display the grid for unsent mailings
65
+ *
66
+ * @access public
67
+ */
68
+ public function indexAction()
69
+ {
70
+ $this->_setTitle();
71
+ $this->_initAction();
72
+ $this->_addContent($this->getLayout()->createBlock('postman/adminhtml_newsletters_queue'));
73
+ $this->renderLayout();
74
+ }
75
+
76
+ /**
77
+ * Method to reset the number of sending trials
78
+ *
79
+ * @access public
80
+ */
81
+ public function resetTrialsAction()
82
+ {
83
+ $smqId = $this->getRequest()->getParam('sendmailqueue_id');
84
+
85
+ if ($smqId) {
86
+ $model = Mage::getModel('postman/newsletters_queue')->load($smqId);
87
+ try {
88
+ $model->setSendmailqueueTrial(0)
89
+ ->save();
90
+
91
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('postman')->__('The number of sending trials were successfully reset'));
92
+ } catch (Mage_Core_Exception $e) {
93
+ Mage::log('adminhtml/session')->addError($e->getMessage());
94
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('postman')
95
+ ->__('An error occurred while reseting the sending trials'));
96
+ } catch (Exception $e) {
97
+ Mage::log('adminhtml/session')->addError($e->getMessage());
98
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('postman')
99
+ ->__('An error occurred while reseting the sending trials'));
100
+ }
101
+ }
102
+
103
+ $this->_redirect('*/*');
104
+ }
105
+
106
+ /**
107
+ * Method to delete an unsent mailing
108
+ *
109
+ * @access public
110
+ */
111
+ public function deleteAction()
112
+ {
113
+ $smqId = $this->getRequest()->getParam('sendmailqueue_id');
114
+
115
+ if ($smqId) {
116
+ $model = Mage::getModel('postman/newsletters_queue')->load($smqId);
117
+ try {
118
+ $model->delete();
119
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('postman')->__('The mailing was successfully deleted'));
120
+ } catch (Mage_Core_Exception $e) {
121
+ Mage::log('adminhtml/session')->addError($e->getMessage());
122
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('postman')
123
+ ->__('An error occurred while deleting the mailing from queue'));
124
+ } catch (Exception $e) {
125
+ Mage::log('adminhtml/session')->addError($e->getMessage());
126
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('postman')
127
+ ->__('An error occurred while deleting the mailing from queue'));
128
+ }
129
+ }
130
+
131
+ $this->_redirect('*/*');
132
+ }
133
+ }
app/code/local/DMK/Postman/controllers/Adminhtml/Newsletters/SentController.php ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Adminhtml Newsletter Sent Controller
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Adminhtml_Newsletters_SentController extends Mage_Adminhtml_Controller_Action
36
+ {
37
+ /**
38
+ * Method to set the page title for the grid
39
+ *
40
+ * @access protected
41
+ * @return DMK_Postman_Adminhtml_Newsletters_SentController
42
+ */
43
+ protected function _setTitle()
44
+ {
45
+ return $this->_title($this->__('DMK Postman'))->_title($this->__('Newsletters sent'));
46
+ }
47
+
48
+ /**
49
+ * Method to set the active menu and breadcrumbs
50
+ *
51
+ * @access protected
52
+ * @return DMK_Postman_Adminhtml_Newsletters_SentController
53
+ */
54
+ protected function _initAction()
55
+ {
56
+ $this->loadLayout()
57
+ ->_setActiveMenu('postman/newsletters_sent')
58
+ ->_addBreadcrumb(Mage::helper('postman')->__('Newsletters sent'), Mage::helper('postman')->__('Newsletters sent'));
59
+ return $this;
60
+ }
61
+
62
+ /**
63
+ * Method to prepare and display the grid for sent newsletters
64
+ *
65
+ * @access public
66
+ */
67
+ public function indexAction() {
68
+ $this->_setTitle();
69
+ $this->_initAction();
70
+ $this->_addContent($this->getLayout()->createBlock('postman/adminhtml_newsletters_sent'));
71
+ $this->renderLayout();
72
+ }
73
+
74
+ /**
75
+ * Method to copy a sent newsletter
76
+ *
77
+ * @access public
78
+ * @return ???
79
+ */
80
+ public function copyAction()
81
+ {
82
+ $model = Mage::getModel('postman/newsletters_sent');
83
+ $newsletter = $model->load($this->getRequest()->getParam('newsletter_id'));
84
+
85
+ if ($model->getId()) {
86
+ try {
87
+ $model
88
+ ->setNewsletterID()
89
+ ->setNewsletterSenderName($newsletter['newsletter_sender_name'])
90
+ ->setNewsletterSenderEmail($newsletter['newsletter_sender_email'])
91
+ ->setNewsletterReplyEmail($newsletter['newsletter_reply_email'])
92
+ ->setNewsletterSubject('Copy of '.$newsletter['newsletter_subject'])
93
+ ->setNewsletterHtmlVersion($newsletter['newsletter_html_version'])
94
+ ->setNewsletterTextVersion($newsletter['newsletter_text_version'])
95
+ ->setNewsletterCreationDate($this->getCurrentDate())
96
+ ->setNewsletterLastModification($this->getCurrentDate())
97
+ ->setNewsletterMailingDate('0000-00-00 00:00:00')
98
+ ->setNewsletterAuthor($newsletter['newsletter_author'])
99
+ ->setIsActive(0)
100
+ ->save();
101
+
102
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('postman')->__('The newsletter was successfully copied and is now listed as unsent newsletter'));
103
+ } catch (Mage_Core_Exception $e) {
104
+ Mage::log($e->getMessage());
105
+ $this->_getSession()->addError($e->getMessage());
106
+ } catch (Exception $e) {
107
+ Mage::log($e->getMessage());
108
+ $this->_getSession()->addException($e, Mage::helper('postman')->__('An error occurred while copying the newsletter'));
109
+ }
110
+ }
111
+ $this->_redirect('*/*');
112
+ }
113
+
114
+ /**
115
+ * Method to enable a sent newsletter for displaying it in the fronted
116
+ *
117
+ * @access public
118
+ */
119
+ public function enabledisableAction()
120
+ {
121
+ $newsletterId = $this->getRequest()->getParam('newsletter_id');
122
+ $enableNewsletter = $this->getRequest()->getParam('enable_newsletter');
123
+
124
+ if ($newsletterId) {
125
+ $successMessage = 'The newsletter can now be displayed in the frontend';
126
+ $errorMessage = 'An error occurred while enabling the newsletter for displaying it in the frontend';
127
+ if($enableNewsletter == 0) {
128
+ $successMessage = 'The newsletter will not be displayed in the frontend';
129
+ $errorMessage = 'An error occurred while disabling the newsletter for displaying it in the frontend';
130
+ }
131
+
132
+ $model = Mage::getModel('postman/newsletters_sent')->load($newsletterId);
133
+ try {
134
+ $model->setIsActive($enableNewsletter)->save();
135
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('postman')
136
+ ->__($successMessage));
137
+ } catch (Mage_Core_Exception $e) {
138
+ Mage::log($e->getMessage());
139
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('postman')
140
+ ->__($errorMessage));
141
+ } catch (Exception $e) {
142
+ Mage::log($e->getMessage());
143
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('postman')
144
+ ->__($errorMessage));
145
+ }
146
+ }
147
+ $this->_redirect('*/*');
148
+ }
149
+
150
+ /**
151
+ * Method to delete
152
+ *
153
+ * @access public
154
+ * @return ???
155
+ */
156
+ public function deleteAction()
157
+ {
158
+ if( $this->getRequest()->getParam('newsletter_id') > 0 ) {
159
+ try {
160
+ $model = Mage::getModel('postman/newsletters_sent');
161
+ $model
162
+ ->setId($this->getRequest()->getParam('newsletter_id'))
163
+ ->delete();
164
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('postman')->__('The newsletter has successfully been deleted'));
165
+ $this->_redirect('*/*/');
166
+ } catch (Exception $e) {
167
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
168
+ $this->_redirect('*/*/edit', array('newsletter_id' => $this->getRequest()->getParam('newsletter_id')));
169
+ }
170
+ }
171
+ $this->_redirect('*/*/');
172
+ }
173
+
174
+ /**
175
+ * Method to get the current date and time
176
+ *
177
+ * @access private
178
+ * @return timestamp (??) Current date
179
+ */
180
+ private function getCurrentDate()
181
+ {
182
+ $model = Mage::getModel('postman/newsletters_sent');
183
+ $currentDate = $model->getCurrentDate();
184
+
185
+ return $currentDate;
186
+ }
187
+
188
+ }
app/code/local/DMK/Postman/controllers/Adminhtml/Newsletters/UnsentController.php ADDED
@@ -0,0 +1,364 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Newsletters
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Adminhtml Newsletter Unsent Controller
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Newsletters
34
+ */
35
+ class DMK_Postman_Adminhtml_Newsletters_UnsentController extends Mage_Adminhtml_Controller_Action
36
+ {
37
+ /**
38
+ * Method to set the page title for the grid
39
+ *
40
+ * @access protected
41
+ * @return DMK_Postman_Adminhtml_Newsletters_UnsentController
42
+ */
43
+ protected function _setPageTitle()
44
+ {
45
+ return $this->_title($this->__('DMK Postman'))->_title($this->__('Newsletters unsent'));
46
+ }
47
+
48
+ /**
49
+ * Method to set the page title for edit form
50
+ *
51
+ * @access protected
52
+ * @return DMK_Postman_Adminhtml_Newsletters_UnsentController
53
+ */
54
+ protected function _setEditPageTitle()
55
+ {
56
+ return $this->_title($this->__('DMK Postman'))->_title($this->__('Edit Newsletter'));
57
+ }
58
+
59
+ /**
60
+ * Method to set the active menu and breadcrumbs
61
+ *
62
+ * @access protected
63
+ * @return DMK_Postman_Adminhtml_Newsletters_UnsentController
64
+ */
65
+ protected function _initAction()
66
+ {
67
+ $this->loadLayout()
68
+ ->_setActiveMenu('postman/newsletters_unsent')
69
+ ->_addBreadcrumb(Mage::helper('postman')->__('Newsletters unsent'), Mage::helper('postman')->__('Newsletters unsent'));
70
+ return $this;
71
+ }
72
+
73
+ /**
74
+ * Method to prepare and display the grid for unsent newsletters
75
+ *
76
+ * @access public
77
+ */
78
+ public function indexAction() {
79
+ $this->_setPageTitle();
80
+ $this->_initAction();
81
+ $this->_addContent($this->getLayout()->createBlock('postman/adminhtml_newsletters_unsent'));
82
+
83
+ $block = $this->getLayout()->createBlock('Mage_Core_Block_Template',
84
+ 'dialog-block',
85
+ array('template' => 'postman/dialogbox.phtml'));
86
+ $this->getLayout()->getBlock('content')->append($block);
87
+
88
+ $this->renderLayout();
89
+ }
90
+
91
+ /**
92
+ * Method to create a new newsletter (is forwarded to edit action)
93
+ *
94
+ * @access public
95
+ */
96
+ public function newAction()
97
+ {
98
+ $this->_forward('edit');
99
+ }
100
+
101
+ /**
102
+ * Method to create/edit a newsletter
103
+ *
104
+ * @access public
105
+ * @return ???
106
+ */
107
+ public function editAction()
108
+ {
109
+ $this->_setEditPageTitle();
110
+
111
+ $model = Mage::getModel('postman/newsletters_unsent');
112
+
113
+ if ($id = $this->getRequest()->getParam('newsletter_id')) {
114
+ $model->load($id);
115
+ }
116
+
117
+ Mage::register('newsletter_unsent_data', $model);
118
+
119
+ $this->loadLayout();
120
+ $this->_setActiveMenu('postman/newsletters_unsent');
121
+
122
+ $this->_addContent($this->getLayout()->createBlock('postman/adminhtml_newsletters_unsent_edit'))
123
+ ->_addLeft($this->getLayout()->createBlock('postman/adminhtml_newsletters_unsent_edit_tabs'));
124
+ $this->renderLayout();
125
+ }
126
+
127
+ /**
128
+ * Method to save a newsletter
129
+ *
130
+ * @access public
131
+ * @return ???
132
+ */
133
+ public function saveAction()
134
+ {
135
+ if ( $this->getRequest()->getPost() ) {
136
+ try {
137
+ $postData = $this->getRequest()->getPost();
138
+ $model = Mage::getModel('postman/newsletters_unsent');
139
+ $newsId = $this->getRequest()->getParam('newsletter_id');
140
+ $user = Mage::getSingleton('admin/session');
141
+ $userId = $user->getUser()->getUserId();
142
+
143
+ if (!$newsId) {
144
+ // ADD
145
+ $model->addData($postData)
146
+ ->setNewsletterCreationDate($this->_getCurrentDate())
147
+ ->setNewsletterLastModification($this->_getCurrentDate())
148
+ ->setNewsletterAuthor($userId)
149
+ ->save();
150
+ $model->saveNewslettersLists($postData['lists']);
151
+ } else {
152
+ // UPDATE
153
+ $model->addData($postData)
154
+ ->setNewsletterLastModification($this->_getCurrentDate())
155
+ ->save();
156
+ $model->saveNewslettersLists($newsId, $postData['lists']);
157
+ }
158
+
159
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('postman')->__('The newsletter was successfully saved'));
160
+ Mage::getSingleton('adminhtml/session')->setData(false);
161
+
162
+ // check if 'Save and Continue'
163
+ if ($this->getRequest()->getParam('back')) {
164
+ $this->_redirect('*/*/edit', array('newsletter_id' => $model->getId()));
165
+ return;
166
+ }
167
+
168
+ $this->_redirect('*/*/');
169
+ return;
170
+ } catch (Exception $e) {
171
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
172
+ //Mage::getSingleton('adminhtml/session')->setData($this->getRequest()->getPost());
173
+ $this->_redirect('*/*/edit', array('newsletter_id' => $this->getRequest()->getParam('newsletter_id')));
174
+ return;
175
+ }
176
+ }
177
+ $this->_redirect('*/*/');
178
+ }
179
+
180
+ /**
181
+ * Method to delete a newsletter
182
+ *
183
+ * @access public
184
+ * @return ???
185
+ */
186
+ public function deleteAction()
187
+ {
188
+ if( $this->getRequest()->getParam('newsletter_id') > 0 ) {
189
+ try {
190
+ $model = Mage::getModel('postman/newsletters_unsent');
191
+ $model->setId($this->getRequest()->getParam('newsletter_id'))
192
+ ->delete();
193
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('postman')->__('The newsletter has successfully been deleted'));
194
+ $this->_redirect('*/*/');
195
+ } catch (Exception $e) {
196
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
197
+ $this->_redirect('*/*/edit', array('newsletter_id' => $this->getRequest()->getParam('newsletter_id')));
198
+ }
199
+ }
200
+ $this->_redirect('*/*/');
201
+ }
202
+
203
+ /**
204
+ * Method to send a test newsletter to testrecipients
205
+ *
206
+ * @access public
207
+ */
208
+ public function sendTestnewsletterAction()
209
+ {
210
+ $recipients = $this->_prepareNewsletterForSending(1);
211
+
212
+ foreach($recipients as $r) {
213
+ $this->_sendNewsletter($r['subscriber_name'],
214
+ $r['subscriber_email'],
215
+ $recipients['newsletter']['subject'],
216
+ $recipients['newsletter']['body'],
217
+ $r['subscriber_emailformat'],
218
+ $r['subscriber_activation'],
219
+ 1);
220
+ }
221
+ $this->_redirect('*/*/');
222
+ }
223
+
224
+ /**
225
+ * Method to send a newsletter to the selected mailing lists
226
+ *
227
+ * @access public
228
+ */
229
+ public function sendNewsletterAction()
230
+ {
231
+ $recipients = $this->_prepareNewsletterForSending();
232
+
233
+ foreach($recipients as $r) {
234
+ $this->_sendNewsletter($r['subscriber_name'],
235
+ $r['subscriber_email'],
236
+ $recipients['newsletter']['subject'],
237
+ $recipients['newsletter']['body'],
238
+ $r['subscriber_emailformat'],
239
+ $r['subscriber_activation'],
240
+ 0);
241
+ }
242
+ $this->_redirect('*/*/');
243
+ }
244
+
245
+ /**
246
+ * Method to prepare newsletter data for sending and saving
247
+ * in newseletter queue
248
+ *
249
+ * @return boolean true
250
+ */
251
+ private function _prepareNewsletterForSending($isTest = 0)
252
+ {
253
+ if( $this->getRequest()->getParam('newsletter_id') > 0 ) {
254
+ try {
255
+ $model = Mage::getModel('postman/newsletters_unsent');
256
+
257
+ $newsletter_id = $this->getRequest()->getParam('newsletter_id');
258
+ $newsletter = $model->load($newsletter_id);
259
+ $recipients = $model->getRecipients($isTest);
260
+ $nextId = $model->getNextId();
261
+
262
+ $textData = array();
263
+ $textData['sendmailcontent_id'] = $nextId;
264
+ $textData['sendmailcontent_emailformat'] = 0;
265
+ $textData['newsletter_id'] = $newsletter_id;
266
+ $textData['newsletter_sender_name'] = $newsletter['newsletter_sender_name'];
267
+ $textData['newsletter_sender_email'] = $newsletter['newsletter_sender_email'];
268
+ $textData['newsletter_subject'] = $newsletter['newsletter_subject'];
269
+ $textData['newsletter_body'] = $newsletter['newsletter_text_version'];
270
+ $textData['newsletter_reply_email'] = $newsletter['newsletter_reply_email'];
271
+ $textData['newsletter_reply_name'] = $newsletter['newsletter_sender_name'];
272
+
273
+ $model->saveSendMailContent($textData);
274
+
275
+ $htmlData = array();
276
+ $htmlData['sendmailcontent_id'] = $nextId;
277
+ $htmlData['sendmailcontent_emailformat'] = 1;
278
+ $htmlData['newsletter_id'] = $newsletter_id;
279
+ $htmlData['newsletter_sender_name'] = $newsletter['newsletter_sender_name'];
280
+ $htmlData['newsletter_sender_email'] = $newsletter['newsletter_sender_email'];
281
+ $htmlData['newsletter_subject'] = $newsletter['newsletter_subject'];
282
+ $htmlData['newsletter_body'] = $newsletter['newsletter_html_version'];
283
+ $htmlData['newsletter_reply_email'] = $newsletter['newsletter_reply_email'];
284
+ $htmlData['newsletter_reply_name'] = $newsletter['newsletter_sender_name'];
285
+
286
+ $model->saveSendMailContent($htmlData);
287
+
288
+ // Save the recipients in sendmailqueue table
289
+ foreach ($recipients as $recipient) {
290
+ $recipientData = array();
291
+ $recipientData['sendmailcontent_id'] = $nextId;
292
+ $recipientData['subscriber_id'] = $recipient['subscriber_id'];
293
+ $recipientData['subscriber_email'] = $recipient['subscriber_email'];
294
+ $recipientData['subscriber_emailformat'] = $recipient['subscriber_emailformat'];
295
+ $recipientData['subscriber_name'] = $recipient['subscriber_name'];
296
+ $recipientData['sendmailqueue_trial'] = 0;
297
+
298
+ // Saving in mailqueue
299
+ $model->saveSendMailQueue($recipientData);
300
+ }
301
+
302
+ if(!$isTest) {
303
+ $newsletter->setNewsletterMailingDate($this->_getCurrentDate());
304
+ }
305
+
306
+ $newsletter->save();
307
+
308
+ $recipients['newsletter']['subject'] = $newsletter['newsletter_subject'];
309
+ $recipients['newsletter']['body'] = $htmlData['newsletter_body'];
310
+
311
+ return $recipients;
312
+
313
+ } catch (Exception $e) {
314
+ Mage::log($e->getMessage());
315
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('postman')
316
+ ->__('An error occured while preparing the newsletter'));
317
+ $this->_redirect('*/*/');
318
+ }
319
+ }
320
+ }
321
+
322
+
323
+ /**
324
+ * Method for sending the newsletter
325
+ *
326
+ * @access private
327
+ * @param string $name
328
+ * @param string $email
329
+ * @param string $activationLink
330
+ */
331
+ private function _sendNewsletter($name, $email, $subject, $content, $format, $activationLink, $isTest)
332
+ {
333
+ $action = ($isTest ? 'sendnewstest' : 'sendnews');
334
+
335
+ try {
336
+ Mage::helper('postman/email')->sendEmail($name, $email,
337
+ $subject, $content,
338
+ $action, $format,
339
+ $activationLink);
340
+ Mage::getSingleton('adminhtml/session')->addSuccess(sprintf(Mage::helper('postman')
341
+ ->__('The newsletter and recipient (%s) were successfully saved in the sendmail-Tables'),$name));
342
+ } catch (Exception $e) {
343
+ Mage::log($e->getMessage());
344
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('postman')
345
+ ->__('An error occured while sending the newsletter'));
346
+ $this->_redirect('*/*/');
347
+ }
348
+
349
+ }
350
+
351
+
352
+ /**
353
+ * Method to get the current date and time
354
+ *
355
+ * @access private
356
+ * @return timestamp (??) Current date
357
+ */
358
+ private function _getCurrentDate()
359
+ {
360
+ $model = Mage::getModel('postman/newsletters_unsent');
361
+ $currentDate = $model->getCurrentDate();
362
+ return $currentDate;
363
+ }
364
+ }
app/code/local/DMK/Postman/controllers/Adminhtml/Subscribers/ExportController.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class DMK_Postman_Adminhtml_Subscribers_ExportController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ public function exportAction()
5
+ {
6
+ $fileName = 'newsletter_subscribers.csv';
7
+ $savePath = Mage::getBaseDir('cache') . '/' . $fileName;
8
+ $data = Mage::getModel('postman/subscribers_subscribers')->getAllCustomers();
9
+
10
+ $csv = new Varien_File_Csv();
11
+ $csv->saveData($savePath, $data);
12
+ $csvContent = file_get_contents($savePath);
13
+
14
+ $this->_prepareDownloadResponse($fileName, $csvContent);
15
+ }
16
+
17
+ protected function _prepareDownloadResponse($fileName, $content, $contentType = 'application/octet-stream', $contentLength = null)
18
+ {
19
+ $session = Mage::getSingleton('admin/session');
20
+ if ($session->isFirstPageAfterLogin()) {
21
+ $this->_redirect($session->getUser()->getStartupPageUrl());
22
+ return $this;
23
+ }
24
+ $this->getResponse()
25
+ ->setHttpResponseCode(200)
26
+ ->setHeader('Pragma', 'public', true)
27
+ ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
28
+ ->setHeader('Content-type', $contentType, true)
29
+ ->setHeader('Content-Length', is_null($contentLength) ? strlen($content) : $contentLength)
30
+ ->setHeader('Content-Disposition', 'attachment; filename=' . $fileName)
31
+ ->setHeader('Last-Modified', date('r'));
32
+ if (!is_null($content)) {
33
+ $this->getResponse()->setBody($content);
34
+ }
35
+ return $this;
36
+ }
37
+ }
38
+ ?>
app/code/local/DMK/Postman/controllers/Adminhtml/Subscribers/SubscribersController.php ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Adminhtml Subscribers Subscribers Controller
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ */
35
+ class DMK_Postman_Adminhtml_Subscribers_SubscribersController extends Mage_Adminhtml_Controller_Action
36
+ {
37
+ /**
38
+ * Method to set the page title for the grid
39
+ *
40
+ * @access protected
41
+ * @return DMK_Postman_Adminhtml_Subscribers_SubscribersController
42
+ */
43
+ protected function _setPageTitle()
44
+ {
45
+ return $this->_title($this->__('DMK Postman'))->_title($this->__('Subscribers (confirmed/unconfirmed)'));
46
+ }
47
+
48
+ /**
49
+ * Method to set the page title for edit form
50
+ *
51
+ * @access protected
52
+ * @return DMK_Postman_Adminhtml_Subscribers_SubscribersController
53
+ */
54
+ protected function _setEditPageTitle()
55
+ {
56
+ return $this->_title($this->__('DMK Postman'))->_title($this->__('Edit subscriber'));
57
+ }
58
+
59
+ /**
60
+ * Method to set the active menu and breadcrumbs
61
+ *
62
+ * @access protected
63
+ * @return DMK_Postman_Adminhtml_Subscribers_SubscribersController
64
+ */
65
+ protected function _initAction()
66
+ {
67
+ $this->loadLayout()
68
+ ->_setActiveMenu('postman/subscribers_subscribers')
69
+ ->_addBreadcrumb(Mage::helper('postman')->__('Subscribers (confirmed/unconfirmed)'), Mage::helper('postman')->__('Subscribers (confirmed/unconfirmed)'));
70
+ return $this;
71
+ }
72
+
73
+ /**
74
+ * Method to prepare and display the subscribers grid
75
+ *
76
+ * @access public
77
+ */
78
+ public function indexAction() {
79
+ $this->_setPageTitle();
80
+ $this->_initAction();
81
+ $this->_addContent($this->getLayout()->createBlock('postman/adminhtml_subscribers_subscribers'));
82
+ $this->renderLayout();
83
+ }
84
+
85
+ /**
86
+ * Method to create a new subscriber (is forwarded to edit action)
87
+ *
88
+ * @access public
89
+ */
90
+ public function newAction()
91
+ {
92
+ $this->_forward('edit');
93
+ }
94
+
95
+ /**
96
+ * Method to create/edit a subscriber
97
+ *
98
+ * @access public
99
+ * @return ???
100
+ */
101
+ public function editAction()
102
+ {
103
+ $this->_setEditPageTitle();
104
+
105
+ $model = Mage::getModel('postman/subscribers_subscribers');
106
+
107
+ if ($id = $this->getRequest()->getParam('subscriber_id')) {
108
+ $model->load($id);
109
+ }
110
+
111
+ Mage::register('subscriber_subscriber_data', $model);
112
+
113
+ $this->loadLayout();
114
+ $this->_setActiveMenu('postman/subscribers_subscribers');
115
+
116
+ $this->_addContent($this->getLayout()->createBlock('postman/adminhtml_subscribers_subscribers_edit'))
117
+ ->_addLeft($this->getLayout()->createBlock('postman/adminhtml_subscribers_subscribers_edit_tabs'));
118
+ $this->renderLayout();
119
+ }
120
+
121
+ /**
122
+ * Method to save a subscriber
123
+ *
124
+ * @access public
125
+ * @return ???
126
+ */
127
+ public function saveAction()
128
+ {
129
+ if ( $this->getRequest()->getPost() ) {
130
+ try {
131
+ $postData = $this->getRequest()->getPost();
132
+
133
+ $session = Mage::getSingleton('adminhtml/session');
134
+ $error = Mage::helper('postman/email')->checkDuplicateEmailFormat($postData['subscriber_email'],
135
+ $postData['subscriber_emailformat'],
136
+ $this->getRequest()->getParam('subscriber_id')
137
+ );
138
+ if($error) {
139
+ $session->addError(Mage::helper('postman')->__('Email address with given format already exists'));
140
+ $this->_redirect('*/*/edit', array('subscriber_id' => $this->getRequest()->getParam('subscriber_id')));
141
+ return;
142
+ }
143
+
144
+ $model = Mage::getModel('postman/subscribers_subscribers');
145
+ $customerId = $model->getCustomerId($postData['subscriber_email']);
146
+
147
+ if(!empty($customerId)) {
148
+ $postData['customer_id'] = $customerId;
149
+ }
150
+
151
+ if(array_key_exists('lists', $postData)) {
152
+ $model->setSelectedListsForSubscriber($postData['lists'],
153
+ $this->getRequest()
154
+ ->getParam('subscriber_id')
155
+ );
156
+ unset($postData['lists']);
157
+ }
158
+
159
+ if (!$this->getRequest()->getParam('subscriber_id')) {
160
+ $model->addData($postData);
161
+
162
+ if (array_key_exists('confirm',$postData)) {
163
+ $model->setSubscriberStatus(1)
164
+ ->setSubscriberConfirmationDate($this->getCurrentDate());
165
+ } else {
166
+ $model->setSubscriberStatus(0)
167
+ ->setSubscriberRegistrationDate($this->getCurrentDate());
168
+ }
169
+ $model->save();
170
+ } else {
171
+ if(!$postData['subscriber_status']) {
172
+ $model->setSubscriberStatus(0);
173
+ }
174
+
175
+ $model->addData($postData)
176
+ ->save();
177
+ }
178
+
179
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('postman')->__('The subscriber was successfully saved'));
180
+ Mage::getSingleton('adminhtml/session')->setData(false);
181
+
182
+ if ($this->getRequest()->getParam('back')) {
183
+ $this->_redirect('*/*/edit', array('subscriber_id' => $model->getId()));
184
+ return;
185
+ }
186
+ $this->_redirect('*/*/');
187
+ return;
188
+ } catch (Exception $e) {
189
+ Mage::log($e->getMessage());
190
+ Mage::getSingleton('adminhtml/session')->setData($this->getRequest()->getPost());
191
+ $this->_redirect('*/*/edit', array('subscriber_id' => $this->getRequest()->getParam('subscriber_id')));
192
+ return;
193
+ }
194
+ }
195
+ print "dudu";
196
+ die();
197
+ $this->_redirect('*/*/');
198
+ }
199
+
200
+ /**
201
+ * Method to delete a subscriber
202
+ *
203
+ * @access public
204
+ * @return ???
205
+ */
206
+ public function deleteAction()
207
+ {
208
+ if( $this->getRequest()->getParam('subscriber_id') > 0 ) {
209
+ try {
210
+ $model = Mage::getModel('postman/subscribers_subscribers');
211
+ $model->setId($this->getRequest()->getParam('subscriber_id'))
212
+ ->delete();
213
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('postman')
214
+ ->__('The subscriber has successfully been deleted'));
215
+ $this->_redirect('*/*/index');
216
+ } catch (Exception $e) {
217
+ Mage::log($e->getMessage());
218
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
219
+ $this->_redirect('*/*/edit', array('subscriber_id' => $this->getRequest()->getParam('subscriber_id')));
220
+ }
221
+ }
222
+ $this->_redirect('*/*/');
223
+ }
224
+
225
+ /**
226
+ * Method to get the current date and time
227
+ *
228
+ * @access private
229
+ * @return timestamp (??) Current date
230
+ */
231
+ private function getCurrentDate()
232
+ {
233
+ $model = Mage::getModel('postman/subscribers_subscribers');
234
+ $currentDate = $model->getCurrentDate();
235
+
236
+ return $currentDate;
237
+ }
238
+
239
+ /**
240
+ * Method to get the customer ID referring to the e-mail address
241
+ *
242
+ * @access private
243
+ * @return int Customer ID
244
+ */
245
+ private function getCustomerId($email)
246
+ {
247
+ $model = Mage::getModel('postman/subscribers_subscribers');
248
+ $id = $model->getCustomerId($email);
249
+
250
+ return $id;
251
+ }
252
+
253
+ /**
254
+ * Method to get the admin ID referring to the e-mail address
255
+ *
256
+ * @access private
257
+ * @return int Admin ID
258
+ */
259
+ private function getAdminId($email)
260
+ {
261
+ $model = Mage::getModel('postman/subscribers_subscribers');
262
+ $id = $model->getAdminId($email);
263
+
264
+ return $id;
265
+ }
266
+ }
app/code/local/DMK/Postman/controllers/Adminhtml/Subscribers/TestrecipientsController.php ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @subpackage Subscribers
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * DMK Postman Adminhtml Subscribers Testrecipients Controller
31
+ *
32
+ * @package DMK Postman
33
+ * @subpackage Subscribers
34
+ * @author Holger Lösken <holger.loesken@das-medienkombinat.de>
35
+ */
36
+ class DMK_Postman_Adminhtml_Subscribers_TestrecipientsController extends Mage_Adminhtml_Controller_Action
37
+ {
38
+ /**
39
+ * Method to set the page title for the grid
40
+ *
41
+ * @access protected
42
+ * @return DMK_Postman_Adminhtml_Subscribers_TestrecipientsController
43
+ */
44
+ protected function _setPageTitle()
45
+ {
46
+ return $this->_title($this->__('DMK Postman'))
47
+ ->_title($this->__('Testrecipients'));
48
+ }
49
+
50
+ /**
51
+ * Method to set the page title for edit form
52
+ *
53
+ * @access protected
54
+ * @return DMK_Postman_Adminhtml_Subscribers_TestrecipientsController
55
+ */
56
+ protected function _setEditPageTitle()
57
+ {
58
+ return $this->_title($this->__('DMK Postman'))
59
+ ->_title($this->__('Edit testrecipient'));
60
+ }
61
+
62
+ /**
63
+ * Method to set the active menu and breadcrumbs
64
+ *
65
+ * @access protected
66
+ * @return DMK_Postman_Adminhtml_Subscribers_TestrecipientsController
67
+ */
68
+ protected function _initAction()
69
+ {
70
+ $this->loadLayout()
71
+ ->_setActiveMenu('postman/subscribers_testrecipients')
72
+ ->_addBreadcrumb(Mage::helper('postman')->__('Testrecipients'), Mage::helper('postman')->__('Testrecipients'));
73
+ return $this;
74
+ }
75
+
76
+ /**
77
+ * Method to prepare and display the mailing lists grid
78
+ *
79
+ * @access public
80
+ */
81
+ public function indexAction() {
82
+ $this->_setEditPageTitle();
83
+ $this->_initAction();
84
+ $this->_addContent($this->getLayout()->createBlock('postman/adminhtml_subscribers_testrecipients'));
85
+ $this->_initLayoutMessages('adminhtml/session');
86
+ $this->renderLayout();
87
+ }
88
+
89
+ /**
90
+ * Method to create a new testrecipient (is forwarded to edit action)
91
+ *
92
+ * @access public
93
+ */
94
+ public function newAction()
95
+ {
96
+ $this->_forward('edit');
97
+ }
98
+
99
+ /**
100
+ * Method to create/edit a testrecipient
101
+ *
102
+ * @access public
103
+ * @return ???
104
+ */
105
+ public function editAction()
106
+ {
107
+ $this->_setEditPageTitle();
108
+ $model = Mage::getModel('postman/subscribers_testrecipients');
109
+
110
+ if ($id = $this->getRequest()->getParam('subscriber_id')) {
111
+ $model->load($id);
112
+ }
113
+
114
+ Mage::register('subscriber_testrecipient_data', $model);
115
+
116
+ $this->loadLayout();
117
+ $this->_initLayoutMessages('adminhtml/session');
118
+ $this->_setActiveMenu('postman/subscribers_testrecipients');
119
+ $this->_addContent($this->getLayout()->createBlock('postman/adminhtml_subscribers_testrecipients_edit'));
120
+ $this->renderLayout();
121
+ }
122
+
123
+ /**
124
+ * Method to save a testrecipient
125
+ * Subscriber status 9 for testrecipients
126
+ *
127
+ * @access public
128
+ * @return ???
129
+ */
130
+ public function saveAction()
131
+ {
132
+ if ( $this->getRequest()->getPost() ) {
133
+ $postData = $this->getRequest()->getPost();
134
+ $session = Mage::getSingleton('adminhtml/session');
135
+ $error = Mage::helper('postman/email')->checkDuplicateEmailFormat($postData['subscriber_email'],
136
+ $postData['subscriber_emailformat'],
137
+ $this->getRequest()->getParam('subscriber_id')
138
+ );
139
+ if($error) {
140
+ $session->addError(Mage::helper('postman')->__('Email address with given format already exists'));
141
+ $this->_redirect('*/*/edit', array('subscriber_id' => $this->getRequest()->getParam('subscriber_id')));
142
+ return;
143
+ }
144
+
145
+ try {
146
+ $customerId = 0;
147
+ $adminId = 0;
148
+ $model = Mage::getModel('postman/subscribers_testrecipients');
149
+
150
+ $user = Mage::getSingleton('admin/session');
151
+ $registeredById = $user->getUser()->getUserId();
152
+
153
+ $user = Mage::getSingleton('customer/session');
154
+ if (!$this->getRequest()->getParam('subscriber_id')) {
155
+ $model->addData($postData)
156
+ ->setSubscriberStatus(9)
157
+ ->setSubscriberRegistrationDate($this->getCurrentDate())
158
+ ->setSubscriberRegisteredBy($registeredById)
159
+ ->setSubscriberConfirmationDate($this->getCurrentDate())
160
+ ->save();
161
+ } else {
162
+ $model->addData($postData)
163
+ ->save();
164
+ }
165
+
166
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('postman')->__('The testrecipient was successfully saved'));
167
+ Mage::getSingleton('adminhtml/session')->setData(false);
168
+
169
+ // check if 'Save and Continue'
170
+ if ($this->getRequest()->getParam('back')) {
171
+ $this->_redirect('*/*/edit', array('subscriber_id' => $model->getId()));
172
+ return;
173
+ }
174
+
175
+ $this->_redirect('*/*/');
176
+ return;
177
+ } catch (Exception $e) {
178
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
179
+ Mage::getSingleton('adminhtml/session')->setData($this->getRequest()->getPost());
180
+ $this->_redirect('*/*/edit', array('subscriber_id' => $this->getRequest()->getParam('subscriber_id')));
181
+ return;
182
+ }
183
+ }
184
+
185
+ $this->_redirect('*/*/');
186
+ }
187
+
188
+ /**
189
+ * Method to delete a testrecipient
190
+ *
191
+ * @access public
192
+ * @return nothing
193
+ */
194
+ public function deleteAction()
195
+ {
196
+ if( $this->getRequest()->getParam('subscriber_id') > 0 ) {
197
+ try {
198
+ $model = Mage::getModel('postman/subscribers_testrecipients');
199
+ $model->setId($this->getRequest()->getParam('subscriber_id'))
200
+ ->delete();
201
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('postman')
202
+ ->__('The testrecipient has successfully been deleted'));
203
+ $this->_redirect('*/*/index');
204
+ } catch (Exception $e) {
205
+ Mage::log('adminhtml/session')->addError($e->getMessage());
206
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('postman')
207
+ ->__('The testrecipient has not successfully been deleted'));
208
+ $this->_redirect('*/*/edit', array('subscriber_id' => $this->getRequest()->getParam('subscriber_id')));
209
+ }
210
+ }
211
+ $this->_redirect('*/*/');
212
+ }
213
+
214
+ /**
215
+ * Method to get the current date and time
216
+ *
217
+ * @access private
218
+ * @return timestamp (??) Current date
219
+ */
220
+ private function getCurrentDate()
221
+ {
222
+ $model = Mage::getModel('postman/subscribers_testrecipients');
223
+ $currentDate = $model->getCurrentDate();
224
+
225
+ return $currentDate;
226
+ }
227
+
228
+ /**
229
+ * Method to get the customer ID referring to the e-mail address
230
+ *
231
+ * @access private
232
+ * @return int Customer ID
233
+ */
234
+ private function getCustomerId($email)
235
+ {
236
+ $model = Mage::getModel('postman/subscribers_testrecipients');
237
+ $id = $model->getCustomerId($email);
238
+
239
+ return $id;
240
+ }
241
+
242
+ /**
243
+ * Method to get the admin ID referring to the e-mail address
244
+ *
245
+ * @access private
246
+ * @return int Admin ID
247
+ */
248
+ private function getAdminId($email)
249
+ {
250
+ $model = Mage::getModel('postman/subscribers_testrecipients');
251
+ $id = $model->getAdminId($email);
252
+
253
+ return $id;
254
+ }
255
+ }
app/code/local/DMK/Postman/controllers/DeactivateController.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * @version 0.1.0
22
+ * @package DMK Postman
23
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * DMK Postman Deactivate Controller
29
+ *
30
+ * @package DMK Postman
31
+ */
32
+
33
+
34
+ class DMK_Postman_DeactivateController extends Mage_Core_Controller_Front_Action {
35
+
36
+ /*
37
+ * Check: User url and is check is already active? If yes delete this record.
38
+ * Show: Show user is deleted or unknown url.
39
+ */
40
+
41
+ public function indexAction(){
42
+ $this->loadLayout();
43
+ $user = Mage::helper('postman/Email')->checkActivationUrl(Mage::helper('core/url')->getCurrentUrl(),1);
44
+
45
+ if($user->getSubscriberName()) {
46
+ try {
47
+ $user->delete();
48
+
49
+ $block = $this->getLayout()
50
+ ->createBlock('Mage_Core_Block_Template',
51
+ 'main-msg-block',
52
+ array('template' => 'postman/newsletter/deactivate/account_deactive.phtml'));
53
+ $this->getLayout()->getBlock('content')->append($block);
54
+
55
+ } catch (Exception $e){
56
+ echo $e->getMessage();
57
+ }
58
+ } else {
59
+ $block = $this->getLayout()
60
+ ->createBlock('Mage_Core_Block_Template',
61
+ 'main-msg-block',
62
+ array('template' => 'postman/newsletter/global/unknown.phtml'));
63
+ $this->getLayout()->getBlock('content')->append($block);
64
+
65
+ }
66
+
67
+ $this->renderLayout();
68
+ }
69
+ }
app/code/local/DMK/Postman/controllers/IndexController.php ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * DMK Postman Index Controller
30
+ *
31
+ * @package DMK Postman
32
+ */
33
+ class DMK_Postman_IndexController extends Mage_Core_Controller_Front_Action
34
+ {
35
+ /**
36
+ * Method to prepare the display
37
+ *
38
+ * @access public
39
+ */
40
+ public function indexAction()
41
+ {
42
+ $this->loadLayout();
43
+ $this->renderLayout();
44
+ }
45
+
46
+
47
+ /*
48
+ * Acton when user (un)subscribes for the newsletter
49
+ *
50
+ * @return void
51
+ */
52
+ public function newslettersubscriberAction(){
53
+ $isSubscribed = $this->_isSubscribed();
54
+ $wantNewslett = $this->_wantNewsletter();
55
+
56
+ //print "isSub:" . $isSubscribed . "<br>";
57
+ //print "want:" . $wantNewslett;
58
+ //die();
59
+
60
+ if($isSubscribed != $wantNewslett) {
61
+ if($wantNewslett) {
62
+ $this->_wantNewsletter(true);
63
+ } else {
64
+ $this->_wantNewsletter(false);
65
+ }
66
+ } else {
67
+ $this->_wantNewsletter();
68
+ $this->_updateLayout();
69
+ }
70
+ }
71
+
72
+
73
+ /**
74
+ * Check if user is already logged in
75
+ *
76
+ * @return boolean
77
+ */
78
+ private function _isLoggedIn()
79
+ {
80
+ if(Mage::getSingleton('customer/session')->isLoggedIn()) {
81
+ return true;
82
+ }
83
+
84
+ return false;
85
+ }
86
+
87
+
88
+ /**
89
+ * Gets the Id of the current user, that is logged in
90
+ *
91
+ * @return int
92
+ */
93
+ private function _getCurrentUserId()
94
+ {
95
+ if($this->_isLoggedIn()) {
96
+ return Mage::getSingleton('customer/session')->getCustomer()->getId();
97
+ } else if(!$this->_isLoggedIn()) {
98
+ $collection = Mage::getModel('customer/customer')->getCollection()
99
+ ->addFieldToFilter('email', strip_tags($this->getRequest()->getParam('clientemail')));
100
+ $collection->load();
101
+ $user = $collection->getFirstItem();
102
+
103
+ return $user->getEntityId();
104
+ }
105
+
106
+ return 0;
107
+ }
108
+
109
+
110
+ /**
111
+ * Get the object of the current user, that is logged in
112
+ */
113
+ private function _getCurrentUser()
114
+ {
115
+ $id = $this->_getCurrentUserId();
116
+ if(!empty($id)) {
117
+ return Mage::getSingleton('customer/session')->getCustomer();
118
+ }
119
+ }
120
+
121
+
122
+ /**
123
+ * Check, if user is already subscribed to newsletter
124
+ *
125
+ * @return bool
126
+ */
127
+ private function _isSubscribed()
128
+ {
129
+ $userName = $this->_getPostmanSubscriber()->getSubscriberId();
130
+ if(!empty($userName)) {
131
+ return true;
132
+ }
133
+
134
+ return false;
135
+ }
136
+
137
+
138
+ /**
139
+ * Get the subscriber from postman_subscribers
140
+ */
141
+ private function _getPostmanSubscriber()
142
+ {
143
+ if($this->_getCurrentUserId()) {
144
+ $collection = Mage::getResourceModel('postman/subscribers_subscribers_collection')
145
+ ->addFieldToFilter('customer_id', $this->_getCurrentUserId());
146
+ } else {
147
+ $collection = Mage::getResourceModel('postman/subscribers_subscribers_collection')
148
+ ->addFieldToFilter('subscriber_email', strip_tags($this->getRequest()->getParam('clientemail')));
149
+ }
150
+
151
+ $collection->load();
152
+
153
+ return $collection->getFirstItem();
154
+ }
155
+
156
+
157
+ /**
158
+ * Set the checkbox 'wantnewsletter'
159
+ *
160
+ * @param bool $w true if checkbox is checked, false if not
161
+ *
162
+ * @return mixed
163
+ */
164
+ private function _wantNewsletter($w=0)
165
+ {
166
+ if($w===0) {
167
+ return ($this->getRequest()->getParam('wantnewsletter')
168
+ ? true : false);
169
+ } else {
170
+ $this->_update($w);
171
+ }
172
+ }
173
+
174
+
175
+ /**
176
+ * Generate activate and deactivate links
177
+ *
178
+ * @param string @ctrl Controller action
179
+ * @param string @action Action from controller
180
+ * @param array $params Parameter that can be passed to the method,
181
+ * f.ex. the token
182
+ *
183
+ * @return string
184
+ */
185
+ private function _generateLinks($ctrl, $action, $params=array())
186
+ {
187
+ $token = md5($params['token']);
188
+ return strip_tags(Mage::getBaseUrl()
189
+ . 'postman/' . $ctrl . '/' . $action . '?tok='
190
+ . $token);
191
+ }
192
+
193
+
194
+ /**
195
+ * Creates a layout block with the appropriate error/success messages
196
+ *
197
+ * @param array $block Block, name and template that should be created
198
+ */
199
+ private function _generateBlock($block)
200
+ {
201
+ return $this->getLayout()
202
+ ->createBlock($block['block'],
203
+ $block['name'],
204
+ array('template' => $block['template'])
205
+ );
206
+ }
207
+
208
+ /**
209
+ * Load and update the page layout with the messages
210
+ *
211
+ * @param type $block
212
+ */
213
+ private function _updateLayout($block)
214
+ {
215
+ $this->loadLayout();
216
+
217
+ if(!empty($block)) {
218
+ $block = $this->_generateBlock($block);
219
+ $this->getLayout()->getBlock('content')->append($block);
220
+ }
221
+ $this->renderLayout();
222
+ }
223
+
224
+ /**
225
+ * Write/Delete the customer to DB
226
+ *
227
+ * @param bool $w Customer want newsletter or not
228
+ *
229
+ * @return void
230
+ */
231
+ private function _update($w)
232
+ {
233
+ if($w === true) {
234
+ $model = Mage::getModel('postman/subscribers_subscribers');
235
+
236
+ if($this->_isLoggedIn()) {
237
+ $clName = $this->_getCurrentUser()->getFirstname() . ' '
238
+ . $this->_getCurrentUser()->getLastname();
239
+ $clEmail = $this->_getCurrentUser()->getEmail();
240
+ } else {
241
+ $clName = strip_tags($this->getRequest()->getParam('clientname'));
242
+ $clEmail = strip_tags($this->getRequest()->getParam('clientemail'));
243
+ }
244
+
245
+ $clIp = $this->getRequest()->getParam('clientip');
246
+ $clToken = $clEmail . $model->getCurrentDate();
247
+
248
+ $subscriberActivation = $this->_generateLinks('activate', 'validate', array('token'=>$clToken));
249
+ $subscriberDeactivation = $this->_generateLinks('deactivate', 'index', array('token'=>$clToken));
250
+
251
+ if(isset($clEmail)){
252
+ if(!Mage::helper('postman/Email')->checkForUserEmail($clEmail)){
253
+ $emailformat = Mage::getStoreConfig('postman_general/registration_settings/default_email_format');
254
+
255
+ //Write all values into database
256
+ $model->setSubscriberName($clName);
257
+ $model->setSubscriberEmail($clEmail);
258
+ $model->setSubscriberRegistrationDate($model->getCurrentDate());
259
+ $model->setCustomerId($this->_getCurrentUserId());
260
+ $model->setSubscriberRegistrationIp($clIp);
261
+ $model->setSubscriberEmailformat($emailformat);
262
+ $model->setSubscriberActivation($subscriberActivation);
263
+ $model->setSubscriberEditlink($subscriberDeactivation);
264
+ $model->save();
265
+
266
+ //Send the mail
267
+ Mage::helper('postman/Email')->sendEmail($clName, $clEmail,
268
+ '', '',
269
+ 'register', $emailformat,
270
+ $subscriberActivation);
271
+
272
+ $this->_updateLayout(array('block' => 'Mage_Core_Block_Template',
273
+ 'name' => 'main-msg-block',
274
+ 'template' => 'postman/newsletter/subscribe/success.phtml'));
275
+ } else {
276
+ $this->_updateLayout(array('block' => 'Mage_Core_Block_Template',
277
+ 'name' => 'main-msg-block',
278
+ 'template' => 'postman/newsletter/register/already_registered.phtml'));
279
+ }
280
+ } else {
281
+ $this->_updateLayout(array('block' => 'Mage_Core_Block_Template',
282
+ 'name' => 'main-msg-block',
283
+ 'template' => 'postman/newsletter/register/please_register.phtml'));
284
+ }
285
+ } else {
286
+ if($this->_isLoggedIn() && $this->_isSubscribed()) {
287
+ $this->_getPostmanSubscriber()->delete();
288
+ $this->_updateLayout(array('block' => 'Mage_Core_Block_Template',
289
+ 'name' => 'main-msg-block',
290
+ 'template' => 'postman/newsletter/deactivate/account_deactive.phtml'));
291
+ }
292
+ }
293
+ }
294
+ }
app/code/local/DMK/Postman/etc/adminhtml.xml ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+
4
+ /**
5
+ * Magento
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * DISCLAIMER
18
+ *
19
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
20
+ * versions in the future. If you wish to customize Magento for your
21
+ * needs please refer to http://www.magentocommerce.com for more information.
22
+ *
23
+ * @version 0.1.0
24
+ * @package DMK Postman
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ -->
30
+ <config>
31
+ <menu>
32
+ <postman module="postman">
33
+ <title>DMK Postman</title>
34
+ <sort_order>71</sort_order>
35
+ <children>
36
+ <newsletter translate="title" module="postman">
37
+ <title>Newsletters</title>
38
+ <sort_order>0</sort_order>
39
+ <children>
40
+ <newsletter_unsent translate="title" module="postman">
41
+ <title>Newsletters unsent</title>
42
+ <sort_order>0</sort_order>
43
+ <action>postman/adminhtml_newsletters_unsent</action>
44
+ </newsletter_unsent>
45
+ <newsletter_sent translate="title" module="postman">
46
+ <title>Newsletters sent</title>
47
+ <sort_order>1</sort_order>
48
+ <action>postman/adminhtml_newsletters_sent</action>
49
+ </newsletter_sent>
50
+ <newsletter_queue translate="title" module="postman">
51
+ <title>Newsletters queue</title>
52
+ <sort_order>2</sort_order>
53
+ <action>postman/adminhtml_newsletters_queue</action>
54
+ </newsletter_queue>
55
+ </children>
56
+ </newsletter>
57
+ <subscriber translate="title" module="postman">
58
+ <title>Subscribers</title>
59
+ <sort_order>5</sort_order>
60
+ <children>
61
+ <subscriber_subscriber translate="title" module="postman">
62
+ <title>Subscribers (confirmed/unconfirmed)</title>
63
+ <sort_order>0</sort_order>
64
+ <action>postman/adminhtml_subscribers_subscribers</action>
65
+ </subscriber_subscriber>
66
+ <subscriber_testrecipients translate="title" module="postman">
67
+ <title>Testrecipients</title>
68
+ <sort_order>1</sort_order>
69
+ <action>postman/adminhtml_subscribers_testrecipients</action>
70
+ </subscriber_testrecipients>
71
+ </children>
72
+ </subscriber>
73
+ <list translate="title" module="postman">
74
+ <title>Mailing lists</title>
75
+ <sort_order>10</sort_order>
76
+ <action>postman/adminhtml_lists</action>
77
+ </list>
78
+ </children>
79
+ </postman>
80
+ </menu>
81
+ <acl>
82
+ <resources>
83
+ <admin>
84
+ <children>
85
+ <system>
86
+ <children>
87
+ <config>
88
+ <children>
89
+ <postman_general translate="title" module="postman">
90
+ <title>DMK General</title>
91
+ <sort_order>100</sort_order>
92
+
93
+ </postman_general>
94
+ <postman_export translate="title" module="postman">
95
+ <title>DMK Export</title>
96
+ <sort_order>101</sort_order>
97
+ </postman_export>
98
+ <postman_import translate="title" module="postman">
99
+ <title>DMK Import</title>
100
+ <sort_order>102</sort_order>
101
+ </postman_import>
102
+ </children>
103
+ </config>
104
+ </children>
105
+ </system>
106
+ <postman translate="title" module="postman">
107
+ <title>DMK Postman</title>
108
+ <sort_order>71</sort_order>
109
+ <children>
110
+ <newsletter translate="title" module="postman">
111
+ <title>Newsletters</title>
112
+ <sort_order>0</sort_order>
113
+ <children>
114
+ <newsletter_unsent translate="title" module="postman">
115
+ <title>Newsletters unsent</title>
116
+ <sort_order>0</sort_order>
117
+ </newsletter_unsent>
118
+ <newsletter_sent translate="title" module="postman">
119
+ <title>Newsletters sent</title>
120
+ <sort_order>1</sort_order>
121
+ </newsletter_sent>
122
+ <newsletter_queue translate="title" module="postman">
123
+ <title>Newsletters queue</title>
124
+ <sort_order>2</sort_order>
125
+ </newsletter_queue>
126
+ </children>
127
+ </newsletter>
128
+ <subscriber translate="title" module="postman">
129
+ <title>Subscribers</title>
130
+ <sort_order>5</sort_order>
131
+ <children>
132
+ <subscriber_subscriber translate="title" module="postman">
133
+ <title>Subscribers (confirmed/unconfirmed)</title>
134
+ <sort_order>0</sort_order>
135
+ </subscriber_subscriber>
136
+ <subscriber_testrecipients translate="title" module="postman">
137
+ <title>Testrecipients</title>
138
+ <sort_order>1</sort_order>
139
+ </subscriber_testrecipients>
140
+ </children>
141
+ </subscriber>
142
+ <list translate="title" module="postman">
143
+ <title>Mailing lists</title>
144
+ <sort_order>10</sort_order>
145
+ </list>
146
+ </children>
147
+ </postman>
148
+ </children>
149
+ </admin>
150
+ </resources>
151
+ </acl>
152
+ </config>
app/code/local/DMK/Postman/etc/config.xml ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <!--
4
+
5
+ /**
6
+ * Magento
7
+ *
8
+ * NOTICE OF LICENSE
9
+ *
10
+ * This source file is subject to the Open Software License (OSL 3.0)
11
+ * that is bundled with this package in the file LICENSE.txt.
12
+ * It is also available through the world-wide-web at this URL:
13
+ * http://opensource.org/licenses/osl-3.0.php
14
+ * If you did not receive a copy of the license and are unable to
15
+ * obtain it through the world-wide-web, please send an email
16
+ * to license@magentocommerce.com so we can send you a copy immediately.
17
+ *
18
+ * DISCLAIMER
19
+ *
20
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
21
+ * versions in the future. If you wish to customize Magento for your
22
+ * needs please refer to http://www.magentocommerce.com for more information.
23
+ *
24
+ * @version 1.0.0
25
+ * @package DMK Postman
26
+ * @copyright (C) 2011 das Medienkombinat <kontakt@das-medienkombinat.de>
27
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
28
+ */
29
+
30
+ -->
31
+ <config>
32
+ <modules>
33
+ <DMK_Postman>
34
+ <version>1.0.0</version>
35
+ </DMK_Postman>
36
+ </modules>
37
+
38
+ <frontend>
39
+ <routers>
40
+ <postman>
41
+ <use>standard</use>
42
+ <args>
43
+ <module>DMK_Postman</module>
44
+ <frontName>postman</frontName>
45
+ </args>
46
+ </postman>
47
+ </routers>
48
+ <layout>
49
+ <updates>
50
+ <postman>
51
+ <file>postman.xml</file>
52
+ </postman>
53
+ </updates>
54
+ </layout>
55
+ <translate>
56
+ <modules>
57
+ <DMK_Postman>
58
+ <files>
59
+ <default>DMK_Postman.csv</default>
60
+ </files>
61
+ </DMK_Postman>
62
+ </modules>
63
+ </translate>
64
+ </frontend>
65
+ <admin>
66
+ <routers>
67
+ <postman>
68
+ <use>admin</use>
69
+ <args>
70
+ <module>DMK_Postman</module>
71
+ <frontName>postman</frontName>
72
+ </args>
73
+ </postman>
74
+ </routers>
75
+ </admin>
76
+ <adminhtml>
77
+ <translate>
78
+ <modules>
79
+ <DMK_Postman>
80
+ <files>
81
+ <default>DMK_Postman.csv</default>
82
+ </files>
83
+ </DMK_Postman>
84
+ </modules>
85
+ </translate>
86
+ <layout>
87
+ <updates>
88
+ <postman>
89
+ <file>postman.xml</file>
90
+ </postman>
91
+ </updates>
92
+ </layout>
93
+ </adminhtml>
94
+ <global>
95
+
96
+ <template>
97
+ <email>
98
+ <postman_general_registration_settings_default_registration_template translate="label" module="postman">
99
+ <label>New postman registration subscriber</label>
100
+ <file>postman/subscriber_confirm.html</file>
101
+ <type>html</type>
102
+ </postman_general_registration_settings_default_registration_template>
103
+
104
+ <postman_general_registration_settings_default_editlink_template translate="label" module="postman">
105
+ <label>New postman editlink subscriber</label>
106
+ <file>postman/subscriber_confirm.html</file>
107
+ <type>html</type>
108
+ </postman_general_registration_settings_default_editlink_template>
109
+
110
+ <postman_general_sending_settings_sending_testmail_template translate="label" module="postman">
111
+ <label>Testmail</label>
112
+ <file>postman/testmail.html</file>
113
+ <type>html</type>
114
+ </postman_general_sending_settings_sending_testmail_template>
115
+
116
+ <postman_general_sending_settings_sending_email_template translate="label" module="postman">
117
+ <label>Newsletter</label>
118
+ <file>postman/newsletter_template.html</file>
119
+ <type>html</type>
120
+ </postman_general_sending_settings_sending_email_template>
121
+ </email>
122
+ </template>
123
+
124
+ <models>
125
+ <postman>
126
+ <class>DMK_Postman_Model</class>
127
+ <resourceModel>postman_mysql4</resourceModel>
128
+ </postman>
129
+ <postman_mysql4>
130
+ <class>DMK_Postman_Model_Mysql4</class>
131
+ <entities>
132
+ <postman_lists>
133
+ <table>dmk_postman_lists</table>
134
+ </postman_lists>
135
+ <postman_lists_store>
136
+ <table>dmk_postman_lists_store</table>
137
+ </postman_lists_store>
138
+ <postman_lists_customer_group>
139
+ <table>dmk_postman_lists_customer_group</table>
140
+ </postman_lists_customer_group>
141
+ <postman_newsletters>
142
+ <table>dmk_postman_newsletters</table>
143
+ </postman_newsletters>
144
+ <postman_newsletters_lists>
145
+ <table>dmk_postman_newsletters_lists</table>
146
+ </postman_newsletters_lists>
147
+ <postman_sendmailcontent>
148
+ <table>dmk_postman_sendmailcontent</table>
149
+ </postman_sendmailcontent>
150
+ <postman_sendmailqueue>
151
+ <table>dmk_postman_sendmailqueue</table>
152
+ </postman_sendmailqueue>
153
+ <postman_subscribers>
154
+ <table>dmk_postman_subscribers</table>
155
+ </postman_subscribers>
156
+ <postman_subscribers_lists>
157
+ <table>dmk_postman_subscribers_lists</table>
158
+ </postman_subscribers_lists>
159
+ </entities>
160
+ </postman_mysql4>
161
+ <core>
162
+ <rewrite>
163
+ <email_template>DMK_Postman_Model_Email_Template</email_template>
164
+ </rewrite>
165
+ </core>
166
+ </models>
167
+ <resources>
168
+ <postman_setup>
169
+ <setup>
170
+ <module>DMK_Postman</module>
171
+ </setup>
172
+ <connection>
173
+ <use>core_setup</use>
174
+ </connection>
175
+ </postman_setup>
176
+ <postman_write>
177
+ <connection>
178
+ <use>core_write</use>
179
+ </connection>
180
+ </postman_write>
181
+ <postman_read>
182
+ <connection>
183
+ <use>core_read</use>
184
+ </connection>
185
+ </postman_read>
186
+ </resources>
187
+ <blocks>
188
+ <postman>
189
+ <class>DMK_Postman_Block</class>
190
+ </postman>
191
+ <adminhtml>
192
+ <rewrite>
193
+ <widget_grid_column_renderer_action>DMK_Postman_Block_Adminhtml_Widget_Grid_Column_Renderer_Action</widget_grid_column_renderer_action>
194
+ </rewrite>
195
+ </adminhtml>
196
+ </blocks>
197
+ <helpers>
198
+ <postman>
199
+ <class>DMK_Postman_Helper</class>
200
+ </postman>
201
+ </helpers>
202
+ </global>
203
+ <default>
204
+
205
+ <postman_general>
206
+ <registration_settings>
207
+ <default_registration_template>
208
+ postman_general_registration_settings_default_registration_template
209
+ </default_registration_template>
210
+ <default_editlink_template>
211
+ postman_general_registration_settings_default_editlink_template
212
+ </default_editlink_template>
213
+
214
+ </registration_settings>
215
+ <sending_settings>
216
+ <sending_testmail_template>
217
+ postman_general_sending_settings_sending_testmail_template
218
+ </sending_testmail_template>
219
+ <sending_email_template>
220
+ postman_general_sending_settings_sending_email_template
221
+ </sending_email_template>
222
+ </sending_settings>
223
+ </postman_general>
224
+ </default>
225
+
226
+ <crontab>
227
+ <jobs>
228
+ <dmk_postman>
229
+ <schedule>
230
+ <cron_expr>* * * * *</cron_expr>
231
+ </schedule>
232
+ <run>
233
+ <model>postman/observer::checkForEmailsToSend</model>
234
+ </run>
235
+ </dmk_postman>
236
+ </jobs>
237
+ </crontab>
238
+ </config>
app/code/local/DMK/Postman/etc/system.xml ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+
4
+ /**
5
+ * Magento
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * DISCLAIMER
18
+ *
19
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
20
+ * versions in the future. If you wish to customize Magento for your
21
+ * needs please refer to http://www.magentocommerce.com for more information.
22
+ *
23
+ * @version 0.1.0
24
+ * @package DMK Postman
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ -->
30
+ <config>
31
+ <tabs>
32
+ <postman translate="label" module="postman">
33
+ <label>DMK Postman</label>
34
+ <sort_order>300</sort_order>
35
+ </postman>
36
+ </tabs>
37
+
38
+
39
+ <sections>
40
+ <postman_general translate="label" module="postman">
41
+ <label>General</label>
42
+ <tab>postman</tab>
43
+ <sort_order>100</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ <!-- TODO: Konfiguration schreiben -->
48
+ <groups>
49
+ <sending_settings translate="label" module="postman">
50
+ <label>Sending settings</label>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>1</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ <fields>
57
+ <enabled translate="label" module="postman">
58
+ <label>Enabled</label>
59
+ <frontend_type>select</frontend_type>
60
+ <source_model>adminhtml/system_config_source_yesno</source_model>
61
+ <sort_order>1</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ </enabled>
66
+ <default_sender_name translate="label" module="postman">
67
+ <label>Default sender name</label>
68
+ <comment><![CDATA[Please enter the sender's name here, which should be used by default for sending newsletters and confirmation emails.]]></comment>
69
+ <frontend_type>text</frontend_type>
70
+ <sort_order>2</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ </default_sender_name>
75
+ <default_sender_email translate="label" module="postman">
76
+ <label>Default sender e-mail</label>
77
+ <comment><![CDATA[Please enter the sender's e-mail address here, which should be used by default for sending newsletters and confirmation e-mails.]]></comment>
78
+ <frontend_type>text</frontend_type>
79
+ <sort_order>3</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>1</show_in_store>
83
+ </default_sender_email>
84
+ <default_reply_email translate="label" module="postman">
85
+ <label>Default reply e-mail</label>
86
+ <comment><![CDATA[Please enter the reply e-mail address, which should be used by default for sending newsletters and confirmation e-mails.]]></comment>
87
+ <frontend_type>text</frontend_type>
88
+ <sort_order>4</sort_order>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ </default_reply_email>
93
+ <default_return_path translate="label" module="postman">
94
+ <label>Default return path</label>
95
+ <comment><![CDATA[Please enter your default return email address. It's used for sending ]]></comment>
96
+ <frontent_type>text</frontent_type>
97
+ <sort_order>5</sort_order>
98
+ <show_in_default>1</show_in_default>
99
+ <show_in_website>1</show_in_website>
100
+ <show_in_store>1</show_in_store>
101
+ </default_return_path>
102
+ <!--sending_trials translate="label" module="postman">
103
+ <label>Number of sending trials</label>
104
+ <comment><![CDATA[Please enter the number of sending trials (how often shall a mailing be tried to send until it won't be involved into further sending processes).]]></comment>
105
+ <frontend_type>text</frontend_type>
106
+ <sort_order>6</sort_order>
107
+ <show_in_default>1</show_in_default>
108
+ <show_in_website>1</show_in_website>
109
+ <show_in_store>1</show_in_store>
110
+ </sending_trials-->
111
+ <sending_testmail_template translate="label">
112
+ <label>Testmail Template</label>
113
+ <comment><![CDATA[Choose a template for your testmail]]></comment>
114
+ <frontend_type>select</frontend_type>
115
+ <source_model>adminhtml/system_config_source_email_template</source_model>
116
+ <sort_order>7</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>1</show_in_store>
120
+ </sending_testmail_template>
121
+ <sending_email_template translate="label">
122
+ <label>Newsletter Template</label>
123
+ <comment><![CDATA[Choose a template for your newsletter email]]></comment>
124
+ <frontend_type>select</frontend_type>
125
+ <source_model>adminhtml/system_config_source_email_template</source_model>
126
+ <sort_order>8</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>1</show_in_store>
130
+ </sending_email_template>
131
+ </fields>
132
+ </sending_settings>
133
+ <registration_settings translate="label" module="postman">
134
+ <label>Registration settings</label>
135
+ <frontend_type>text</frontend_type>
136
+ <sort_order>2</sort_order>
137
+ <show_in_default>1</show_in_default>
138
+ <show_in_website>1</show_in_website>
139
+ <show_in_store>1</show_in_store>
140
+ <fields>
141
+ <show_name_field translate="label" module="postman">
142
+ <label>Display form field name</label>
143
+ <comment><![CDATA[Please select here if the name field should be displayed in the registration form in the frontend.]]></comment>
144
+ <frontend_type>select</frontend_type>
145
+ <source_model>adminhtml/system_config_source_yesno</source_model>
146
+ <sort_order>1</sort_order>
147
+ <show_in_default>1</show_in_default>
148
+ <show_in_website>1</show_in_website>
149
+ <show_in_store>1</show_in_store>
150
+ </show_name_field>
151
+ <name_field_obligation translate="label" module="postman">
152
+ <label>Name is obligation</label>
153
+ <comment><![CDATA[Please select here if the indication of the name in the frontend and while creating a new subscriber or testrecipient via the backend should be an obligation.]]></comment>
154
+ <frontend_type>select</frontend_type>
155
+ <source_model>adminhtml/system_config_source_yesno</source_model>
156
+ <sort_order>2</sort_order>
157
+ <show_in_default>1</show_in_default>
158
+ <show_in_website>1</show_in_website>
159
+ <show_in_store>1</show_in_store>
160
+ </name_field_obligation>
161
+ <default_email_format translate="label" module="postman">
162
+ <label>Default e-mail format</label>
163
+ <comment><![CDATA[Please enter here which e-mail format should be set by default with new subscribers.]]></comment>
164
+ <frontend_type>select</frontend_type>
165
+ <source_model>postman/config_source_emailformat</source_model>
166
+ <sort_order>3</sort_order>
167
+ <show_in_default>1</show_in_default>
168
+ <show_in_website>1</show_in_website>
169
+ <show_in_store>1</show_in_store>
170
+ </default_email_format>
171
+ <show_disclaimer translate="label" module="postman">
172
+ <label>Display disclaimer</label>
173
+ <comment><![CDATA[Please select here if the disclaimer should be displayed in the registration form in the frontend. If you choose the option yes the user has to accept the disclaimer before sending their newsletter registration.]]></comment>
174
+ <frontend_type>select</frontend_type>
175
+ <source_model>adminhtml/system_config_source_yesno</source_model>
176
+ <sort_order>4</sort_order>
177
+ <show_in_default>1</show_in_default>
178
+ <show_in_website>1</show_in_website>
179
+ <show_in_store>1</show_in_store>
180
+ </show_disclaimer>
181
+ <disclaimer_link translate="label" module="postman">
182
+ <label>Link for the disclaimer</label>
183
+ <comment><![CDATA[Please enter the link for the disclaimer here.]]></comment>
184
+ <frontend_type>text</frontend_type>
185
+ <sort_order>5</sort_order>
186
+ <show_in_default>1</show_in_default>
187
+ <show_in_website>1</show_in_website>
188
+ <show_in_store>1</show_in_store>
189
+ </disclaimer_link>
190
+ <default_registration_template translate="label">
191
+ <label>Default registration template</label>
192
+ <comment><![CDATA[Please select here the default e-mail template for the registration e-mails.]]></comment>
193
+ <frontend_type>select</frontend_type>
194
+ <source_model>adminhtml/system_config_source_email_template</source_model>
195
+ <sort_order>6</sort_order>
196
+ <show_in_default>1</show_in_default>
197
+ <show_in_website>1</show_in_website>
198
+ <show_in_store>1</show_in_store>
199
+ </default_registration_template>
200
+ <default_editlink_template translate="label">
201
+ <label>Default editlink template</label>
202
+ <comment><![CDATA[Please select here the default e-mail template for the editlink e-mails.]]></comment>
203
+ <frontend_type>select</frontend_type>
204
+ <source_model>adminhtml/system_config_source_email_template</source_model>
205
+ <sort_order>7</sort_order>
206
+ <show_in_default>1</show_in_default>
207
+ <show_in_website>1</show_in_website>
208
+ <show_in_store>1</show_in_store>
209
+ </default_editlink_template>
210
+ </fields>
211
+ </registration_settings>
212
+
213
+ </groups>
214
+ </postman_general>
215
+ <postman_export>
216
+ <label>Export</label>
217
+ <tab>postman</tab>
218
+ <sort_order>200</sort_order>
219
+ <show_in_default>1</show_in_default>
220
+ <show_in_website>1</show_in_website>
221
+ <show_in_store>1</show_in_store>
222
+
223
+ <groups>
224
+ <export_subscribers translate="label">
225
+ <label>Export subscribers</label>
226
+ <frontend_type>text</frontend_type>
227
+ <sort_order>4</sort_order>
228
+ <show_in_default>1</show_in_default>
229
+ <show_in_website>1</show_in_website>
230
+ <show_in_store>1</show_in_store>
231
+ <fields>
232
+ <show_export_button translate="label" module="postman">
233
+ <frontend_model>postman/adminhtml_subscribers_export</frontend_model>
234
+ <sort_order>300</sort_order>
235
+ <show_in_default>1</show_in_default>
236
+ <show_in_website>1</show_in_website>
237
+ <show_in_store>1</show_in_store>
238
+ <comment><![CDATA[Click on the button to download the .csv file]]></comment>
239
+ </show_export_button>
240
+ </fields>
241
+ </export_subscribers>
242
+ </groups>
243
+ </postman_export>
244
+ <postman_import>
245
+ <label>Import</label>
246
+ <tab>postman</tab>
247
+ <sort_order>300</sort_order>
248
+ <show_in_default>1</show_in_default>
249
+ <show_in_website>1</show_in_website>
250
+ <show_in_store>1</show_in_store>
251
+
252
+ <groups>
253
+ <import_subscribers translate="label">
254
+ <label>Import subscribers</label>
255
+ <frontend_type>text</frontend_type>
256
+ <sort_order>3</sort_order>
257
+ <show_in_default>1</show_in_default>
258
+ <show_in_website>1</show_in_website>
259
+ <show_in_store>1</show_in_store>
260
+ <fields>
261
+ <show_import_field translate="label" module="postman">
262
+ <comment><![CDATA[Please select your .csv]]></comment>
263
+ <frontend_type>import</frontend_type>
264
+ <backend_model>postman/subscribers_import</backend_model>
265
+ <sort_order>1</sort_order>
266
+ <show_in_default>1</show_in_default>
267
+ <show_in_website>1</show_in_website>
268
+ <show_in_store>1</show_in_store>
269
+ </show_import_field>
270
+ </fields>
271
+ </import_subscribers>
272
+ </groups>
273
+ </postman_import>
274
+ </sections>
275
+ </config>
app/code/local/DMK/Postman/sql/postman_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @version 0.1.0
23
+ * @package DMK Postman
24
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ $installer = $this;
29
+ $installer->startSetup();
30
+ $installer->run("
31
+
32
+ DROP TABLE IF EXISTS {$this->getTable('dmk_postman_lists_store')};
33
+ DROP TABLE IF EXISTS {$this->getTable('dmk_postman_lists_customer_group')};
34
+
35
+ /*Table structure for table `dmk_postman_lists` */
36
+
37
+ DROP TABLE IF EXISTS {$this->getTable('dmk_postman_lists')};
38
+ CREATE TABLE IF NOT EXISTS {$this->getTable('dmk_postman_lists')} (
39
+ `list_id` int(11) unsigned NOT NULL auto_increment,
40
+ `store_id` smallint(5) unsigned default '0',
41
+ `list_title` varchar(255) NOT NULL,
42
+ `list_description` text NOT NULL,
43
+ `customer_group_id` smallint(3) unsigned default '0',
44
+ `is_active` tinyint(1) NOT NULL default '0',
45
+ PRIMARY KEY (`list_id`),
46
+ CONSTRAINT `FK_POSTMAN_LISTS_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE SET NULL ON UPDATE CASCADE,
47
+ CONSTRAINT `FK_POSTMAN_LISTS_GROUP` FOREIGN KEY (`customer_group_id`) REFERENCES {$this->getTable('customer_group')} (`customer_group_id`) ON DELETE SET NULL ON UPDATE CASCADE
48
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
49
+
50
+ /*Table structure for table `dmk_postman_lists_store` */
51
+
52
+ CREATE TABLE {$this->getTable('dmk_postman_lists_store')} (
53
+ `list_id` int(11) unsigned NOT NULL default '0',
54
+ `store_id` smallint(5) unsigned NOT NULL default '0',
55
+ PRIMARY KEY (`list_id`,`store_id`),
56
+ CONSTRAINT `FK_POSTMAN_LISTS_STORE_POSTMAN_LISTS` FOREIGN KEY (`list_id`) REFERENCES {$this->getTable('dmk_postman_lists')} (`list_id`) ON DELETE CASCADE,
57
+ CONSTRAINT `FK_POSTMAN_LISTS_STORE_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
58
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
59
+
60
+ /*Table structure for table `dmk_postman_lists_customer_group` */
61
+
62
+ CREATE TABLE {$this->getTable('dmk_postman_lists_customer_group')} (
63
+ `list_id` int(11) unsigned NOT NULL default '0',
64
+ `customer_group_id` smallint(3) unsigned NOT NULL default '0',
65
+ PRIMARY KEY (`list_id`,`customer_group_id`),
66
+ CONSTRAINT `FK_POSTMAN_LISTS_CUSTOMER_GROUP_POSTMAN_LISTS` FOREIGN KEY (`list_id`) REFERENCES {$this->getTable('dmk_postman_lists')} (`list_id`) ON DELETE CASCADE,
67
+ CONSTRAINT `FK_POSTMAN_LISTS_CUSTOMER_GROUP_GROUP` FOREIGN KEY (`customer_group_id`) REFERENCES {$this->getTable('customer_group')} (`customer_group_id`) ON DELETE CASCADE ON UPDATE CASCADE
68
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
69
+
70
+ /*Table structure for table `dmk_postman_newsletters` */
71
+
72
+ DROP TABLE IF EXISTS {$this->getTable('dmk_postman_newsletters')};
73
+ CREATE TABLE IF NOT EXISTS {$this->getTable('dmk_postman_newsletters')} (
74
+ `newsletter_id` int(11) NOT NULL auto_increment,
75
+ `newsletter_sender_name` varchar(255) NOT NULL,
76
+ `newsletter_sender_email` varchar(100) NOT NULL,
77
+ `newsletter_reply_email` varchar(100) NOT NULL,
78
+ `newsletter_subject` varchar(255) NOT NULL,
79
+ `newsletter_multipart_version` longtext NOT NULL,
80
+ `newsletter_html_version` longtext NOT NULL,
81
+ `newsletter_text_version` longtext NOT NULL,
82
+ `newsletter_creation_date` datetime NOT NULL default '0000-00-00 00:00:00',
83
+ `newsletter_last_modification` datetime NOT NULL default '0000-00-00 00:00:00',
84
+ `newsletter_mailing_date` datetime NOT NULL default '0000-00-00 00:00:00',
85
+ `newsletter_author` int(11) NOT NULL default '0',
86
+ `is_active` tinyint(1) unsigned NOT NULL default '0',
87
+ PRIMARY KEY (`newsletter_id`)
88
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
89
+
90
+ /*Table structure for table `dmk_postman_newsletters_lists` */
91
+
92
+ DROP TABLE IF EXISTS {$this->getTable('dmk_postman_newsletters_lists')};
93
+ CREATE TABLE IF NOT EXISTS {$this->getTable('dmk_postman_newsletters_lists')} (
94
+ `newsletter_id` int(11) NOT NULL,
95
+ `list_id` int(11) NOT NULL
96
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
97
+
98
+ /*Table structure for table `dmk_postman_sendmailcontent` */
99
+
100
+ DROP TABLE IF EXISTS {$this->getTable('dmk_postman_sendmailcontent')};
101
+ CREATE TABLE IF NOT EXISTS {$this->getTable('dmk_postman_sendmailcontent')} (
102
+ `sendmailcontent_id` int(11) NOT NULL,
103
+ `sendmailcontent_emailformat` int(1) NOT NULL,
104
+ `newsletter_id` int(11) NOT NULL,
105
+ `newsletter_sender_name` varchar(255) NOT NULL,
106
+ `newsletter_sender_email` varchar(100) NOT NULL,
107
+ `newsletter_subject` varchar(255) NOT NULL,
108
+ `newsletter_body` longtext NOT NULL,
109
+ `newsletter_cc_email` varchar(100) NOT NULL,
110
+ `newsletter_bcc_email` varchar(100) NOT NULL,
111
+ `newsletter_reply_email` varchar(100) NOT NULL,
112
+ `newsletter_reply_name` varchar(255) NOT NULL,
113
+ `newsletter_attachement` text NOT NULL,
114
+ PRIMARY KEY (`sendmailcontent_id`,`sendmailcontent_emailformat`)
115
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
116
+
117
+ /*Table structure for table `dmk_postman_sendmailqueue` */
118
+
119
+ DROP TABLE IF EXISTS {$this->getTable('dmk_postman_sendmailqueue')};
120
+ CREATE TABLE IF NOT EXISTS {$this->getTable('dmk_postman_sendmailqueue')} (
121
+ `sendmailqueue_id` int(11) NOT NULL auto_increment,
122
+ `sendmailcontent_id` int(11) NOT NULL,
123
+ `subscriber_email` varchar(100) NOT NULL,
124
+ `subscriber_emailformat` int(1) NOT NULL,
125
+ `subscriber_name` varchar(255) NOT NULL,
126
+ `subscriber_id` int(11) NOT NULL default '0',
127
+ `sendmailqueue_trial` int(5) NOT NULL default '0',
128
+ PRIMARY KEY (`sendmailqueue_id`)
129
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
130
+
131
+ /*Table structure for table `dmk_postman_subscribers` */
132
+
133
+ DROP TABLE IF EXISTS {$this->getTable('dmk_postman_subscribers')};
134
+ CREATE TABLE IF NOT EXISTS {$this->getTable('dmk_postman_subscribers')} (
135
+ `subscriber_id` int(11) NOT NULL auto_increment,
136
+ `customer_id` int(11) NOT NULL,
137
+ `subscriber_name` varchar(255) NOT NULL,
138
+ `subscriber_email` varchar(100) NOT NULL,
139
+ `subscriber_emailformat` tinyint(1) NOT NULL,
140
+ `subscriber_status` int(1) NOT NULL,
141
+ `subscriber_activation` varchar(100) NOT NULL,
142
+ `subscriber_editlink` varchar(100) NOT NULL,
143
+ `subscriber_registration_date` datetime NOT NULL default '0000-00-00 00:00:00',
144
+ `subscriber_registered_by` int(11) NOT NULL default '0',
145
+ `subscriber_registration_ip` varchar(15) NOT NULL,
146
+ `subscriber_confirmation_date` datetime NOT NULL default '0000-00-00 00:00:00',
147
+ `subscriber_confirmed_by` int(11) NOT NULL default '0',
148
+ PRIMARY KEY (`subscriber_id`)
149
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
150
+
151
+ /*Table structure for table `dmk_postman_subscribers_lists` */
152
+
153
+ DROP TABLE IF EXISTS {$this->getTable('dmk_postman_subscribers_lists')};
154
+ CREATE TABLE IF NOT EXISTS {$this->getTable('dmk_postman_subscribers_lists')} (
155
+ `subscriber_id` int(11) NOT NULL,
156
+ `list_id` int(11) NOT NULL,
157
+ PRIMARY KEY (`subscriber_id`,`list_id`)
158
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
159
+
160
+ ");
161
+
162
+
163
+
164
+ $installer->endSetup;
app/design/adminhtml/default/default/template/postman/dialogbox.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <div id="dialog" title="" style="display:none">
2
+ <p><?php echo Mage::helper('postman')->__('Do you really want to execute this action'); ?>?</p>
3
+ </div>
app/etc/modules/DMK_Postman.xml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+
4
+ /**
5
+ * Magento
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * DISCLAIMER
18
+ *
19
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
20
+ * versions in the future. If you wish to customize Magento for your
21
+ * needs please refer to http://www.magentocommerce.com for more information.
22
+ *
23
+ * @version 0.1.0
24
+ * @package DMK Postman
25
+ * @copyright (C) 2011 das medienkombinat <kontakt@das-medienkombinat.de>
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ -->
30
+ <config>
31
+ <modules>
32
+ <DMK_Postman>
33
+ <active>true</active>
34
+ <codePool>local</codePool>
35
+ </DMK_Postman>
36
+ </modules>
37
+ </config>
app/locale/de_DE/DMK_Postman.csv ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "# lists","# Mailinglisten"
2
+ "# subscribers","# Abonnenten"
3
+ "%s rows have been imported","%s Einträge wurden importiert"
4
+ "Action","Aktion"
5
+ "Add mailing list","Erstelle Mailingliste"
6
+ "Add newsletter","Erstelle Newsletter"
7
+ "Add subscriber","Erstelle Abonnent"
8
+ "Add testrecipient","Erstelle Testempfänger"
9
+ "An error occurred while reseting the sending trials","Es ist ein Fehler beim ZurĂĽcksetzen der Zustellversuche aufgetreten"
10
+ "An error occurred while deleting the mailing from queue","Es ist ein Fehler beim Löschen des Newsletters aus der Warteschlange aufgetreten"
11
+ "An error occured while sending the newsletter","Es ist ein Fehler beim Senden des Newsletters aufgetreten"
12
+ "An error occured while preparing the newsletter","Es ist ein Fehler bei der Sendungsvorbereitung aufgetreten"
13
+ "An error occured while uploading the file","Beim Upload der Datei ist ein Fehler aufgetreten"
14
+ "Author","Autor"
15
+ "Choose a template for your testmail","Wählen Sie ein Template für den Versand der Test E-mails aus."
16
+ "Choose your newsletter format","Wählen Sie bitte Ihr Newsletterformat aus"
17
+ "Confirm","Bestätigen?"
18
+ "Confirmed","Bestätigt"
19
+ "Copy newsletter","Kopiere Newsletter"
20
+ "Customer groups","Kundengruppen"
21
+ "Default e-mail format","Standard E-Mail Format"
22
+ "Default registration template","Standard Registrierungstemplate"
23
+ "Default sender name","Standard Absendername"
24
+ "Default sender e-mail","Standard Absender E-Mail Adresse"
25
+ "Default reply e-mail","Standard Antwort E-Mail Adresse"
26
+ "Delete mailing","Lösche Mailing"
27
+ "Description","Beschreibung"
28
+ "Details","Details"
29
+ "Disable newsletter","Deaktiviere Newsletter"
30
+ "Disabled","Deaktiviert"
31
+ "Disclaimer","Haftungsausschluss"
32
+ "Display disclaimer","Haftungsausschluss anzeigen (Pflichtfeld)"
33
+ "DMK Postman","DMK Postman"
34
+ "DMK","DMK"
35
+ "Do you really want to execute this action","Wollen Sie diese Aktion wirklich ausfĂĽllen"
36
+ "Delete","Löschen"
37
+ "Edit mailing list '%s'","Bearbeite Mailingliste '%s'"
38
+ "Edit mailing list","Bearbeite Mailingliste"
39
+ "Edit newsletter '%s'","Bearbeite Newsletter '%s'"
40
+ "Edit newsletter","Bearbeite Newsletter"
41
+ "Edit subscriber '%s'","Bearbeite Abonnent '%s'"
42
+ "Edit subscriber","Bearbeite Abonnent"
43
+ "Edit testrecipient '%s'","Bearbeite Testempfänger '%s'"
44
+ "Edit testrecipient","Bearbeite Testempfänger"
45
+ "E-mail format","E-Mail Format"
46
+ "E-mail","E-Mail"
47
+ "Email address with given format already exists", "Die angegebene E-Mail-Adresse existiert bereits"
48
+ "Enable newsletter","Aktiviere Newsletter"
49
+ "Enabled","Aktiviert"
50
+ "File was not uploaded","Die Datei wurde nicht hochgeladen"
51
+ "General","Allgemein"
52
+ "Html version","Html version"
53
+ "Html","Html"
54
+ "ID","ID"
55
+ "Import subscribers","Abonnenten importieren"
56
+ "Import file","Datei importieren"
57
+ "Invalid postman import format in row #%s","UngĂĽltiges Postman Importformat bei Eintrag #%s"
58
+ "Invalid id '%s' in row #%s","UngĂĽltige ID '%s' bei Eintrag #%s"
59
+ "Invalid customer id '%s' in row #%s","UngĂĽltige Kunden-ID '%s' bei Eintrag #%s"
60
+ "Invalid subscriber email '%s' in row #%s","UngĂĽltige Emailadresse '%s' bei Eintrag #%s"
61
+ "Invalid subscriber email format '%s' in row #%s","UngĂĽltiges Format '%s' der Emailadresse bei Eintrag #%s"
62
+ "Invalid subscriber status '%s' in row #%s","UngĂĽltiger Status '%s' bei Eintrag #%s"
63
+ "Last modification","Letzte Ă„nderung"
64
+ "Link for the disclaimer","Link zum Haftungsausschluss"
65
+ "Mailing date","Versanddatum"
66
+ "Mailing list","Mailingliste"
67
+ "Mailing lists","Mailinglisten"
68
+ "Name","Name"
69
+ "New mailing list","Neue Mailingliste"
70
+ "New newsletter","Neuer Newsletter"
71
+ "New subscriber","Neuer Abonnent"
72
+ "New testrecipient","Neuer Testempfänger"
73
+ "Newsletter details","Newsletter Details"
74
+ "Newsletter ID","Newsletter ID"
75
+ "Newsletter queue","Newsletter Warteschlange"
76
+ "Newsletter sent","versendeter Newsletter"
77
+ "Newsletter unsent","nicht versendeter Newsletter"
78
+ "Newsletter","Newsletter"
79
+ "Newsletters queue","Newsletter Warteschlange"
80
+ "Newsletters sent","Versendete Newsletter"
81
+ "Newsletters unsent","Nicht versendete Newsletter"
82
+ "No file has been selected to upload","Es wurde keine Datei für den Upload ausgewählt"
83
+ "Number of sending trials","Anzahl der Sendungsversuche"
84
+ "Please enter the link for the disclaimer here.","Bitte geben Sie hier den Link zu der Seite mit dem Haftungsausschluss ein."
85
+ "Please register","Bitte registrieren"
86
+ "Please select here the default e-mail template for the registration e-mails.","Bitte wählen Sie hier Ihr Standard E-Mail Template für die Registrierungsemail aus."
87
+ "Please select your .csv","Bitte wählen Sie Ihre CSV-Datei aus"
88
+ "Please select here if the disclaimer should be displayed in the registration form in the frontend. If you choose the option yes the user has to accept the disclaimer before sending their newsletter registration.","Wählen Sie 'Ja' wenn der Haftungsausschluss im Frontend im Registrierungsformular angezeigt werden soll. Der Benutzer muss diesen akzeptieren bevor er sich für einen Newsletter registrieren kann."
89
+ "Postman","Postman"
90
+ "Reply e-mail","Antwort-An E-Mail"
91
+ "Reset sending trials","Setze Zustellversuche zurĂĽck"
92
+ "Send newsletter","Sende Newsletter"
93
+ "Send test newsletter","Sende Test-Newsletter"
94
+ "Sender e-mail","E-Mail Absender"
95
+ "Sender name","Absendername"
96
+ "Sending trials","Zustellversuche"
97
+ "Status","Status"
98
+ "Store view","Storeview"
99
+ "Subject","Betreff"
100
+ "Subscriber (confirmed/unconfirmed)","Abonnent (bestätigt/unbestätigt)"
101
+ "Subscriber details","Abonnenten-Details"
102
+ "Subscriber","Abonnent"
103
+ "Subscribers (confirmed/unconfirmed)","Abonnenten (bestätigt/unbestätigt)"
104
+ "Testrecipient","Testempfänger"
105
+ "Testrecipients","Testempfänger"
106
+ "Text version","Text version"
107
+ "Text","Text"
108
+ "The activation email was sent. Please activate your account","Ihr Email zur Aktivierung wurde versendet. Bitte prĂĽfen Sie Ihr Email-Postfach."
109
+ "The mailing list has successfully been deleted","Die Mailingliste wurde erfolgreich gelöscht"
110
+ "The mailing list was successfully save","Die Mailingliste wurde erfolgreich gespeichert"
111
+ "The mailing was successfully deleted","Der Newsletter wurde erfolgreich aus der Warteschlange gelöscht"
112
+ "The number of sending trials were successfully reset","Die Anzahl der Zustellversuche wurde erfolgreich zurĂĽckgesetzt"
113
+ "The newsletter can now be displayed in the frontend","Der Newsletter kann nun im Frontend angezeigt werden"
114
+ "The newsletter will not be displayed in the frontend","Der Newsletter wird nicht im Frontend angezeigt werden"
115
+ "The newsletter has successfully been deleted","Der Newsletter wurde erfolgreich gelöscht"
116
+ "The newsletter was successfully saved","Der Newsletter wurde erfolgreich gespeichert"
117
+ "The newsletter was successfully copied and is now listed as unsent newsletter","Der Newsletter wurde erfolgreich kopiert und ist nun unter 'Nicht versendete Newsletter' aufgelistet"
118
+ "The subscriber has successfully been deleted","Der Abonnent wurde erfolgreich gelöscht"
119
+ "The subscriber has not successfully been deleted","Der Abonnent wurde nicht gelöscht"
120
+ "The subscriber was successfully saved","Der Abonnent wurde erfolgreich gespeichert"
121
+ "The testrecipient has successfully been deleted","Der Testempfänger wurde erfolgreich gelöscht"
122
+ "The testrecipient has not successfully been deleted","Der Testempfänger wurde nicht gelöscht"
123
+ "The testrecipient was successfully saved","Der Testempfänger wurde erfolgreich gespeichert"
124
+ "The newsletter and recipient (%s) were successfully saved in the sendmail-Tables","Der Newsletter inkl. Empfänger (%s) wurde erfolgreich in der Warteschlange gespeichert"
125
+ "This title and storeview already exist","Dieses Titel mit der dazugehörigen Kundengruppe existiert bereits"
126
+ "Title","Titel"
127
+ "Trash","Papierkorb"
128
+ "Unconfirmed","Unbestätigt"
129
+ "Visible in","Sichtbar in"
130
+ "You are already registered","Sie sind bereits registriert"
131
+ "Your account is now active","Ihr Account ist jetzt aktiv."
132
+ "Your account is already active","Ihr Account ist bereits aktiv."
133
+ "Testmail Template","Testmail Template"
134
+ "Newsletter Template","Newsletter Template"
135
+ "Choose a template for your newsletter email", "Wählen Sie eine Vorlage für den Versand Ihrer Newsletter E-mail."
136
+ "Please enter the sender's name here, which should be used by default for sending newsletters and confirmation emails.","Geben Sie einen Absendername ein. Dieser Absendername wird bei den Versand von Newslettern sowie bestätigungs E-Mails verwendet."
137
+ "Please enter the sender's e-mail address here, which should be used by default for sending newsletters and confirmation e-mails.", "Geben Sie eine Absenderadresse ein. Diese wird für den Versand von Newslettern sowie bestätigungs E-Mails verwendet."
138
+ "Please enter the reply e-mail address, which should be used by default for sending newsletters and confirmation e-mails.", "Geben Sie eine Antwort E-Mail Adresse ein. Diese wird für den Versand von Newslettern sowie bestätigungs E-Mails verwendet."
139
+ "Display form field name", "Feld Name anzeigen"
140
+ "Please select here if the name field should be displayed in the registration form in the frontend." ,"Wählen Sie, ob das Feld Name auf Ihrer Webseite angezeigt werden soll"
141
+ "Name is obligation", "Name ist Pflicht"
142
+ "Please select here if the indication of the name in the frontend and while creating a new subscriber or testrecipient via the backend should be an obligation.", "Wählen Sie 'Ja' um das Feld als Pflichtfeld zu definieren."
143
+ "Please enter here which e-mail format should be set by default with new subscribers.","Wählen Sie Ihr Standard E-Mail Format. Diese Einstellung wird verwendet, wenn der Benutzer keine Abonement keine Einstellung getroffen hat."
144
+ "Save and New", "Speichern und neu"
145
+ "Default return path,"Standard RĂĽckantwort E-Mail"
146
+ "Please enter your default return email address. It's used for sending ","Bitte geben Sie eine Standard E-Mail Adresse ein. An dieser Adresse werden Ihnen Fehlermeldungen die bei der Ăśbertragung aufgetreten sind gesandt."
147
+ "Sending settings", "Versand Einstellungen"
148
+ "Registration settings","Registrierungs Einstellungen"
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>DMK_Postman</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>DMK Postman ersetzt die Magento-eigene Newsletter Verwaltung.</summary>
10
+ <description>Durch Postman ist es m&#xF6;glich, kundenspezifisch bzw. anhand von speziellen Mailinglisten Ihre Kunden gezielt &#xFC;ber neue Produkte und Updates zu informieren.</description>
11
+ <notes>Erstes Stable-Release.</notes>
12
+ <authors><author><name>Holger L&#xF6;sken</name><user>holgerloesken</user><email>holger.loesken@das-medienkombinat.de</email></author><author><name>Thomas Schmidt</name><user>ithommy</user><email>thomas.schmidt@das-medienkombinat.de</email></author></authors>
13
+ <date>2011-12-27</date>
14
+ <time>15:23:00</time>
15
+ <contents><target name="magelocal"><dir name="DMK"><dir name="Postman"><dir name="Block"><dir name="Adminhtml"><dir name="Lists"><dir name="Edit"><file name="Form.php" hash="723b0fa06409f00ace4727feba0eeef0"/></dir><file name="Edit.php" hash="48e49cb4b63b941aac698fb9ef622bb9"/><file name="Grid.php" hash="8b621b7a1881691a9e7a51296b422e23"/></dir><file name="Lists.php" hash="4e2e69338483dc2c5f291b2594d8c5ce"/><dir name="Newsletters"><dir name="Queue"><file name="Grid.php" hash="5dee3fc2c885d9fb2664d0fe3a18e16a"/></dir><file name="Queue.php" hash="0c9faa181f647c95d6c6c339bc5700a9"/><dir name="Sent"><file name="Grid.php" hash="5915867e2ae5de8a6604a869899dd9ac"/></dir><file name="Sent.php" hash="e4f711246dfbade60e0baee731613a48"/><dir name="Unsent"><dir name="Edit"><file name="Form.php" hash="928fc5a2944a7087db1973ce700349a3"/><dir name="Tab"><file name="General.php" hash="39d85c547d64568e0f0ba1c4d17ff86d"/><file name="Html.php" hash="9ff3f1557e0515665a30de03bfee0bba"/><file name="Text.php" hash="c8f3d7979167d11527fcbdf3761975f9"/></dir><file name="Tabs.php" hash="cae1cfbaa2becbae2e0f245f5d0fd9a0"/></dir><file name="Edit.php" hash="d6444a27cd75a9f233c65861a1d036f6"/><file name="Grid.php" hash="9b18196852223dd220398d6d0feabdc5"/></dir><file name="Unsent.php" hash="bd997d25d24d88e6e0d4c9daf72787d1"/></dir><dir name="Subscribers"><file name="Export.php" hash="05c2b2ec4f521cb4ba64999682bc61e1"/><dir name="Subscribers"><dir name="Edit"><file name="Form.php" hash="f223ed1f0c83c31c57125dfd085bd4c4"/><dir name="Tab"><file name="Lists.php" hash="59b951a65358548cc85d7a5a25b112ab"/><file name="Main.php" hash="5f7e007d10d4498c7b74179fb1723eb8"/></dir><file name="Tabs.php" hash="ff903a84ec658f5026ade6ae4f5fbf7f"/></dir><file name="Edit.php" hash="4bd24e0a780b6809d04f26c91a18b5ee"/><file name="Grid.php" hash="a3fbb5a37ae85db680c99e9c37d06024"/></dir><file name="Subscribers.php" hash="eb9971b950c3a3ff8658f7cd9b0ba740"/><dir name="Testrecipients"><dir name="Edit"><file name="Form.php" hash="3f7a3fdbabd1e199cece71b594c69524"/></dir><file name="Edit.php" hash="eee832fb91cc200728277fdf61e6cab1"/><file name="Grid.php" hash="f44955eb95ead64ee1b418df7588cc5d"/></dir><file name="Testrecipients.php" hash="3849ebb84a2e7666c8679d2de1737fe5"/></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Action.php" hash="7dab60ab16aad402b7e69a9af7a2fde0"/></dir></dir></dir></dir></dir><dir name="Frontend"><dir name="Newsletter"><file name="Registration.php" hash="9c2775b8dfc6e4f08fcb7266cf71b734"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="8af7b82d1ffa487f5220d8f8e0d60f7f"/><file name="Email.php" hash="5ea65aa44764bbfd4612092c6f4afb28"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Emailformat.php" hash="283aaf44d17072a6b7ce2c8573d0f00d"/></dir></dir><dir name="Email"><file name="Template.php" hash="933eaea11aff0b7f20ca93c8daf28c1b"/></dir><file name="Lists.php" hash="53c11d3a300e5f95bf142dc289632144"/><dir name="Mysql4"><dir name="Lists"><file name="Collection.php" hash="6e48d15a5cc7b84c48ed011d55d959fe"/></dir><file name="Lists.php" hash="e91d8fab4eaaf4dc6a657e022902f0c1"/><dir name="Newsletters"><dir name="Queue"><file name="Collection.php" hash="1a6342561086933688852fbb29467681"/></dir><file name="Queue.php" hash="1c2b1426676fc44173d2139f65cb4278"/><dir name="Queuecontent"><file name="Collection.php" hash="4be06a61d0ec769dc8d6217a3ba08fe2"/></dir><file name="Queuecontent.php" hash="452912180a8393c0e863c55ab3645bc9"/><dir name="Sent"><file name="Collection.php" hash="81d7ada926295e9af8a1f4623c26fffc"/></dir><file name="Sent.php" hash="47cc36df1880d493d8731e9ac0767822"/><dir name="Unsent"><file name="Collection.php" hash="f0873c6e042f3a5162675887c9c9ad92"/></dir><file name="Unsent.php" hash="c023cfbb4f0c94160c9af841d3bf3c61"/></dir><dir name="Subscribers"><file name="Import.php" hash="ec7c504115b051c1bd3f3ba4b576ec7c"/><dir name="Subscribers"><file name="Collection.php" hash="641d9c5f2db8d79889f161f32d82b4d0"/></dir><file name="Subscribers.php" hash="5a1e68caf04d91c948de7d969d7d19e8"/><dir name="Testrecipients"><file name="Collection.php" hash="11808219be5094f5344e419e871424bc"/></dir><file name="Testrecipients.php" hash="1398617064be29cc5415dd49c5682751"/></dir></dir><dir name="Newsletters"><file name="Queue.php" hash="5871609b429df859d81d11c36f03feb3"/><file name="Sent.php" hash="09240df2bc90bc93ebc64e2e5694a5a5"/><file name="Unsent.php" hash="db22c75c6f76cf5a057b2485d0db9160"/></dir><file name="Observer.php" hash="016e4d60cc849b58ec96d14468ea62af"/><dir name="Subscribers"><file name="Import.php" hash="6ddfd16e9067c0a406e54082b536531f"/><file name="Subscribers.php" hash="27585e2f94e07060212cb634b042b9c2"/><file name="Testrecipients.php" hash="c72cdb5594b50a4ce663e253b864f952"/></dir><dir name="Variable"><file name="Config.php" hash="e2f68c55cd1b2bd59054d0848172c39e"/></dir></dir><dir name="controllers"><file name="ActivateController.php" hash="06419a437f236092d9e958e5262ce593"/><dir name="Adminhtml"><file name="ListsController.php" hash="390096a45a6ce78cbc798ef09ca0601d"/><dir name="Newsletters"><file name="QueueController.php" hash="9d75958136bb4b04b1cebf56ee09bf34"/><file name="SentController.php" hash="2dc62fea66d64cfb608b5570a5f76e79"/><file name="UnsentController.php" hash="710192fb449ce46e14a19999eee4eece"/></dir><dir name="Subscribers"><file name="ExportController.php" hash="421f79102d6b346970343942df63152b"/><file name="SubscribersController.php" hash="672a0f63da44b07222148bd182b7ff02"/><file name="TestrecipientsController.php" hash="20d828ecbf31bdc1b97c5a6e4833b0df"/></dir></dir><file name="DeactivateController.php" hash="4844da764eb8f276fefa8cad2904484a"/><file name="IndexController.php" hash="48959141c629f6d43807685525dd31e2"/></dir><dir name="etc"><file name="adminhtml.xml" hash="41afe566378ad4ec414ad1975f00d61c"/><file name="config.xml" hash="ad28e48eaf856c02965bfd47b2456456"/><file name="system.xml" hash="1425f8fc3ba2c7d345319c6e5894176c"/></dir><dir name="sql"><dir name="postman_setup"><file name="mysql4-install-0.1.0.php" hash="2ad25c4257aa8b31042a9929ae4b94a1"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="postman"><file name="dialogbox.phtml" hash="eda868da21e15f0ccb3a0c9a605f1524"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DMK_Postman.xml" hash="0ef5caadc94cd87b01009a4ebef7def3"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="DMK_Postman.csv" hash="6f80feef0ab680ffdec7b9f550c5b47b"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="jquery-ui-lightness"><dir name="images"><file name="ui-bg_diagonals-thick_18_b81900_40x40.png" hash="1c7fc3f027768438a5e12572a3ca1233"/><file name="ui-bg_diagonals-thick_20_666666_40x40.png" hash="f040b255ca13e693da34ab33c7d6b554"/><file name="ui-bg_flat_10_000000_40x100.png" hash="c18cd01623c7fed23c80d53e2f5e7c78"/><file name="ui-bg_glass_100_f6f6f6_1x400.png" hash="5f1847175ba18c41322cb9cb0581e0fb"/><file name="ui-bg_glass_100_fdf5ce_1x400.png" hash="d26e8f463195a7b86f86b7d550cfc114"/><file name="ui-bg_glass_65_ffffff_1x400.png" hash="e5a8f32e28fd5c27bf0fed33c8a8b9b5"/><file name="ui-bg_gloss-wave_35_f6a828_500x100.png" hash="58d2cd501e01573cf537089c694ba899"/><file name="ui-bg_highlight-soft_100_eeeeee_1x100.png" hash="384c3f17709ba0f809b023b6e7b10b84"/><file name="ui-bg_highlight-soft_75_ffe45c_1x100.png" hash="b806658954cb4d16ade8977af737f486"/><file name="ui-icons_222222_256x240.png" hash="ebe6b6902a408fbf9cac6379a1477525"/><file name="ui-icons_228ef1_256x240.png" hash="79f41c0765e9ec18562b20b0801d748b"/><file name="ui-icons_ef8c08_256x240.png" hash="ef9a6ccfe3b14041928ddc708665b226"/><file name="ui-icons_ffd27a_256x240.png" hash="ab8c30acc0e3608fb79e01fccf832c70"/><file name="ui-icons_ffffff_256x240.png" hash="342bc03f6264c75d3f1d7f99e34295b9"/></dir><file name="jquery-ui-1.8.16.custom.css" hash="3ce894effc03c489506c7d0dab5246d5"/></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.4</min><max>5.3.6</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png ADDED
Binary file
skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png ADDED
Binary file
skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_flat_10_000000_40x100.png ADDED
Binary file
skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png ADDED
Binary file
skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png ADDED
Binary file
skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png ADDED
Binary file
skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png ADDED
Binary file
skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png ADDED
Binary file
skin/adminhtml/default/default/jquery-ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png ADDED
Binary file
skin/adminhtml/default/default/jquery-ui-lightness/images/ui-icons_222222_256x240.png ADDED
Binary file
skin/adminhtml/default/default/jquery-ui-lightness/images/ui-icons_228ef1_256x240.png ADDED
Binary file
skin/adminhtml/default/default/jquery-ui-lightness/images/ui-icons_ef8c08_256x240.png ADDED
Binary file
skin/adminhtml/default/default/jquery-ui-lightness/images/ui-icons_ffd27a_256x240.png ADDED
Binary file
skin/adminhtml/default/default/jquery-ui-lightness/images/ui-icons_ffffff_256x240.png ADDED
Binary file
skin/adminhtml/default/default/jquery-ui-lightness/jquery-ui-1.8.16.custom.css ADDED
@@ -0,0 +1,568 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI CSS Framework 1.8.16
3
+ *
4
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Theming/API
9
+ */
10
+
11
+ /* Layout helpers
12
+ ----------------------------------*/
13
+ .ui-helper-hidden { display: none; }
14
+ .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
15
+ .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
16
+ .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
17
+ .ui-helper-clearfix { display: inline-block; }
18
+ /* required comment for clearfix to work in Opera \*/
19
+ * html .ui-helper-clearfix { height:1%; }
20
+ .ui-helper-clearfix { display:block; }
21
+ /* end clearfix */
22
+ .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
23
+
24
+
25
+ /* Interaction Cues
26
+ ----------------------------------*/
27
+ .ui-state-disabled { cursor: default !important; }
28
+
29
+
30
+ /* Icons
31
+ ----------------------------------*/
32
+
33
+ /* states and images */
34
+ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
35
+
36
+
37
+ /* Misc visuals
38
+ ----------------------------------*/
39
+
40
+ /* Overlays */
41
+ .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
42
+
43
+
44
+ /*
45
+ * jQuery UI CSS Framework 1.8.16
46
+ *
47
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
48
+ * Dual licensed under the MIT or GPL Version 2 licenses.
49
+ * http://jquery.org/license
50
+ *
51
+ * http://docs.jquery.com/UI/Theming/API
52
+ *
53
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
54
+ */
55
+
56
+
57
+ /* Component containers
58
+ ----------------------------------*/
59
+ .ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
60
+ .ui-widget .ui-widget { font-size: 1em; }
61
+ .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
62
+ .ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
63
+ .ui-widget-content a { color: #333333; }
64
+ .ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
65
+ .ui-widget-header a { color: #ffffff; }
66
+
67
+ /* Interaction states
68
+ ----------------------------------*/
69
+ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; }
70
+ .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
71
+ .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; }
72
+ .ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; }
73
+ .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; }
74
+ .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; }
75
+ .ui-widget :active { outline: none; }
76
+
77
+ /* Interaction Cues
78
+ ----------------------------------*/
79
+ .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
80
+ .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
81
+ .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
82
+ .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
83
+ .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; }
84
+ .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
85
+ .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
86
+ .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
87
+
88
+ /* Icons
89
+ ----------------------------------*/
90
+
91
+ /* states and images */
92
+ .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
93
+ .ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
94
+ .ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
95
+ .ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); }
96
+ .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
97
+ .ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
98
+ .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); }
99
+ .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
100
+
101
+ /* positioning */
102
+ .ui-icon-carat-1-n { background-position: 0 0; }
103
+ .ui-icon-carat-1-ne { background-position: -16px 0; }
104
+ .ui-icon-carat-1-e { background-position: -32px 0; }
105
+ .ui-icon-carat-1-se { background-position: -48px 0; }
106
+ .ui-icon-carat-1-s { background-position: -64px 0; }
107
+ .ui-icon-carat-1-sw { background-position: -80px 0; }
108
+ .ui-icon-carat-1-w { background-position: -96px 0; }
109
+ .ui-icon-carat-1-nw { background-position: -112px 0; }
110
+ .ui-icon-carat-2-n-s { background-position: -128px 0; }
111
+ .ui-icon-carat-2-e-w { background-position: -144px 0; }
112
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
113
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
114
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
115
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
116
+ .ui-icon-triangle-1-s { background-position: -64px -16px; }
117
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
118
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
119
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
120
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
121
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
122
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
123
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
124
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
125
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
126
+ .ui-icon-arrow-1-s { background-position: -64px -32px; }
127
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
128
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
129
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
130
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
131
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
132
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
133
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
134
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
135
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
136
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
137
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
138
+ .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
139
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
140
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
141
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
142
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
143
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
144
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
145
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
146
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
147
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
148
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
149
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
150
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
151
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
152
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
153
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
154
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
155
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
156
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
157
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
158
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
159
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
160
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
161
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
162
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
163
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
164
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
165
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
166
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
167
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
168
+ .ui-icon-extlink { background-position: -32px -80px; }
169
+ .ui-icon-newwin { background-position: -48px -80px; }
170
+ .ui-icon-refresh { background-position: -64px -80px; }
171
+ .ui-icon-shuffle { background-position: -80px -80px; }
172
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
173
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
174
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
175
+ .ui-icon-folder-open { background-position: -16px -96px; }
176
+ .ui-icon-document { background-position: -32px -96px; }
177
+ .ui-icon-document-b { background-position: -48px -96px; }
178
+ .ui-icon-note { background-position: -64px -96px; }
179
+ .ui-icon-mail-closed { background-position: -80px -96px; }
180
+ .ui-icon-mail-open { background-position: -96px -96px; }
181
+ .ui-icon-suitcase { background-position: -112px -96px; }
182
+ .ui-icon-comment { background-position: -128px -96px; }
183
+ .ui-icon-person { background-position: -144px -96px; }
184
+ .ui-icon-print { background-position: -160px -96px; }
185
+ .ui-icon-trash { background-position: -176px -96px; }
186
+ .ui-icon-locked { background-position: -192px -96px; }
187
+ .ui-icon-unlocked { background-position: -208px -96px; }
188
+ .ui-icon-bookmark { background-position: -224px -96px; }
189
+ .ui-icon-tag { background-position: -240px -96px; }
190
+ .ui-icon-home { background-position: 0 -112px; }
191
+ .ui-icon-flag { background-position: -16px -112px; }
192
+ .ui-icon-calendar { background-position: -32px -112px; }
193
+ .ui-icon-cart { background-position: -48px -112px; }
194
+ .ui-icon-pencil { background-position: -64px -112px; }
195
+ .ui-icon-clock { background-position: -80px -112px; }
196
+ .ui-icon-disk { background-position: -96px -112px; }
197
+ .ui-icon-calculator { background-position: -112px -112px; }
198
+ .ui-icon-zoomin { background-position: -128px -112px; }
199
+ .ui-icon-zoomout { background-position: -144px -112px; }
200
+ .ui-icon-search { background-position: -160px -112px; }
201
+ .ui-icon-wrench { background-position: -176px -112px; }
202
+ .ui-icon-gear { background-position: -192px -112px; }
203
+ .ui-icon-heart { background-position: -208px -112px; }
204
+ .ui-icon-star { background-position: -224px -112px; }
205
+ .ui-icon-link { background-position: -240px -112px; }
206
+ .ui-icon-cancel { background-position: 0 -128px; }
207
+ .ui-icon-plus { background-position: -16px -128px; }
208
+ .ui-icon-plusthick { background-position: -32px -128px; }
209
+ .ui-icon-minus { background-position: -48px -128px; }
210
+ .ui-icon-minusthick { background-position: -64px -128px; }
211
+ .ui-icon-close { background-position: -80px -128px; }
212
+ .ui-icon-closethick { background-position: -96px -128px; }
213
+ .ui-icon-key { background-position: -112px -128px; }
214
+ .ui-icon-lightbulb { background-position: -128px -128px; }
215
+ .ui-icon-scissors { background-position: -144px -128px; }
216
+ .ui-icon-clipboard { background-position: -160px -128px; }
217
+ .ui-icon-copy { background-position: -176px -128px; }
218
+ .ui-icon-contact { background-position: -192px -128px; }
219
+ .ui-icon-image { background-position: -208px -128px; }
220
+ .ui-icon-video { background-position: -224px -128px; }
221
+ .ui-icon-script { background-position: -240px -128px; }
222
+ .ui-icon-alert { background-position: 0 -144px; }
223
+ .ui-icon-info { background-position: -16px -144px; }
224
+ .ui-icon-notice { background-position: -32px -144px; }
225
+ .ui-icon-help { background-position: -48px -144px; }
226
+ .ui-icon-check { background-position: -64px -144px; }
227
+ .ui-icon-bullet { background-position: -80px -144px; }
228
+ .ui-icon-radio-off { background-position: -96px -144px; }
229
+ .ui-icon-radio-on { background-position: -112px -144px; }
230
+ .ui-icon-pin-w { background-position: -128px -144px; }
231
+ .ui-icon-pin-s { background-position: -144px -144px; }
232
+ .ui-icon-play { background-position: 0 -160px; }
233
+ .ui-icon-pause { background-position: -16px -160px; }
234
+ .ui-icon-seek-next { background-position: -32px -160px; }
235
+ .ui-icon-seek-prev { background-position: -48px -160px; }
236
+ .ui-icon-seek-end { background-position: -64px -160px; }
237
+ .ui-icon-seek-start { background-position: -80px -160px; }
238
+ /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
239
+ .ui-icon-seek-first { background-position: -80px -160px; }
240
+ .ui-icon-stop { background-position: -96px -160px; }
241
+ .ui-icon-eject { background-position: -112px -160px; }
242
+ .ui-icon-volume-off { background-position: -128px -160px; }
243
+ .ui-icon-volume-on { background-position: -144px -160px; }
244
+ .ui-icon-power { background-position: 0 -176px; }
245
+ .ui-icon-signal-diag { background-position: -16px -176px; }
246
+ .ui-icon-signal { background-position: -32px -176px; }
247
+ .ui-icon-battery-0 { background-position: -48px -176px; }
248
+ .ui-icon-battery-1 { background-position: -64px -176px; }
249
+ .ui-icon-battery-2 { background-position: -80px -176px; }
250
+ .ui-icon-battery-3 { background-position: -96px -176px; }
251
+ .ui-icon-circle-plus { background-position: 0 -192px; }
252
+ .ui-icon-circle-minus { background-position: -16px -192px; }
253
+ .ui-icon-circle-close { background-position: -32px -192px; }
254
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
255
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
256
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
257
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
258
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
259
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
260
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
261
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
262
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
263
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
264
+ .ui-icon-circle-check { background-position: -208px -192px; }
265
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
266
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
267
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
268
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
269
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
270
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
271
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
272
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
273
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
274
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
275
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
276
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
277
+
278
+
279
+ /* Misc visuals
280
+ ----------------------------------*/
281
+
282
+ /* Corner radius */
283
+ .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
284
+ .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
285
+ .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
286
+ .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
287
+
288
+ /* Overlays */
289
+ .ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
290
+ .ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/*
291
+ * jQuery UI Resizable 1.8.16
292
+ *
293
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
294
+ * Dual licensed under the MIT or GPL Version 2 licenses.
295
+ * http://jquery.org/license
296
+ *
297
+ * http://docs.jquery.com/UI/Resizable#theming
298
+ */
299
+ .ui-resizable { position: relative;}
300
+ .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
301
+ .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
302
+ .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
303
+ .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
304
+ .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
305
+ .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
306
+ .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
307
+ .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
308
+ .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
309
+ .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
310
+ * jQuery UI Selectable 1.8.16
311
+ *
312
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
313
+ * Dual licensed under the MIT or GPL Version 2 licenses.
314
+ * http://jquery.org/license
315
+ *
316
+ * http://docs.jquery.com/UI/Selectable#theming
317
+ */
318
+ .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
319
+ /*
320
+ * jQuery UI Accordion 1.8.16
321
+ *
322
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
323
+ * Dual licensed under the MIT or GPL Version 2 licenses.
324
+ * http://jquery.org/license
325
+ *
326
+ * http://docs.jquery.com/UI/Accordion#theming
327
+ */
328
+ /* IE/Win - Fix animation bug - #4615 */
329
+ .ui-accordion { width: 100%; }
330
+ .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
331
+ .ui-accordion .ui-accordion-li-fix { display: inline; }
332
+ .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
333
+ .ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
334
+ .ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
335
+ .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
336
+ .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
337
+ .ui-accordion .ui-accordion-content-active { display: block; }
338
+ /*
339
+ * jQuery UI Autocomplete 1.8.16
340
+ *
341
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
342
+ * Dual licensed under the MIT or GPL Version 2 licenses.
343
+ * http://jquery.org/license
344
+ *
345
+ * http://docs.jquery.com/UI/Autocomplete#theming
346
+ */
347
+ .ui-autocomplete { position: absolute; cursor: default; }
348
+
349
+ /* workarounds */
350
+ * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
351
+
352
+ /*
353
+ * jQuery UI Menu 1.8.16
354
+ *
355
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
356
+ * Dual licensed under the MIT or GPL Version 2 licenses.
357
+ * http://jquery.org/license
358
+ *
359
+ * http://docs.jquery.com/UI/Menu#theming
360
+ */
361
+ .ui-menu {
362
+ list-style:none;
363
+ padding: 2px;
364
+ margin: 0;
365
+ display:block;
366
+ float: left;
367
+ }
368
+ .ui-menu .ui-menu {
369
+ margin-top: -3px;
370
+ }
371
+ .ui-menu .ui-menu-item {
372
+ margin:0;
373
+ padding: 0;
374
+ zoom: 1;
375
+ float: left;
376
+ clear: left;
377
+ width: 100%;
378
+ }
379
+ .ui-menu .ui-menu-item a {
380
+ text-decoration:none;
381
+ display:block;
382
+ padding:.2em .4em;
383
+ line-height:1.5;
384
+ zoom:1;
385
+ }
386
+ .ui-menu .ui-menu-item a.ui-state-hover,
387
+ .ui-menu .ui-menu-item a.ui-state-active {
388
+ font-weight: normal;
389
+ margin: -1px;
390
+ }
391
+ /*
392
+ * jQuery UI Button 1.8.16
393
+ *
394
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
395
+ * Dual licensed under the MIT or GPL Version 2 licenses.
396
+ * http://jquery.org/license
397
+ *
398
+ * http://docs.jquery.com/UI/Button#theming
399
+ */
400
+ .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
401
+ .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
402
+ button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
403
+ .ui-button-icons-only { width: 3.4em; }
404
+ button.ui-button-icons-only { width: 3.7em; }
405
+
406
+ /*button text element */
407
+ .ui-button .ui-button-text { display: block; line-height: 1.4; }
408
+ .ui-button-text-only .ui-button-text { padding: .4em 1em; }
409
+ .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
410
+ .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
411
+ .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
412
+ .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
413
+ /* no icon support for input elements, provide padding by default */
414
+ input.ui-button { padding: .4em 1em; }
415
+
416
+ /*button icon element(s) */
417
+ .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
418
+ .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
419
+ .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
420
+ .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
421
+ .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
422
+
423
+ /*button sets*/
424
+ .ui-buttonset { margin-right: 7px; }
425
+ .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
426
+
427
+ /* workarounds */
428
+ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
429
+ /*
430
+ * jQuery UI Dialog 1.8.16
431
+ *
432
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
433
+ * Dual licensed under the MIT or GPL Version 2 licenses.
434
+ * http://jquery.org/license
435
+ *
436
+ * http://docs.jquery.com/UI/Dialog#theming
437
+ */
438
+ .ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
439
+ .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
440
+ .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
441
+ .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
442
+ .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
443
+ .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
444
+ .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
445
+ .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
446
+ .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
447
+ .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
448
+ .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
449
+ .ui-draggable .ui-dialog-titlebar { cursor: move; }
450
+ /*
451
+ * jQuery UI Slider 1.8.16
452
+ *
453
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
454
+ * Dual licensed under the MIT or GPL Version 2 licenses.
455
+ * http://jquery.org/license
456
+ *
457
+ * http://docs.jquery.com/UI/Slider#theming
458
+ */
459
+ .ui-slider { position: relative; text-align: left; }
460
+ .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
461
+ .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
462
+
463
+ .ui-slider-horizontal { height: .8em; }
464
+ .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
465
+ .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
466
+ .ui-slider-horizontal .ui-slider-range-min { left: 0; }
467
+ .ui-slider-horizontal .ui-slider-range-max { right: 0; }
468
+
469
+ .ui-slider-vertical { width: .8em; height: 100px; }
470
+ .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
471
+ .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
472
+ .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
473
+ .ui-slider-vertical .ui-slider-range-max { top: 0; }/*
474
+ * jQuery UI Tabs 1.8.16
475
+ *
476
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
477
+ * Dual licensed under the MIT or GPL Version 2 licenses.
478
+ * http://jquery.org/license
479
+ *
480
+ * http://docs.jquery.com/UI/Tabs#theming
481
+ */
482
+ .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
483
+ .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
484
+ .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
485
+ .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
486
+ .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
487
+ .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
488
+ .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
489
+ .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
490
+ .ui-tabs .ui-tabs-hide { display: none !important; }
491
+ /*
492
+ * jQuery UI Datepicker 1.8.16
493
+ *
494
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
495
+ * Dual licensed under the MIT or GPL Version 2 licenses.
496
+ * http://jquery.org/license
497
+ *
498
+ * http://docs.jquery.com/UI/Datepicker#theming
499
+ */
500
+ .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
501
+ .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
502
+ .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
503
+ .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
504
+ .ui-datepicker .ui-datepicker-prev { left:2px; }
505
+ .ui-datepicker .ui-datepicker-next { right:2px; }
506
+ .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
507
+ .ui-datepicker .ui-datepicker-next-hover { right:1px; }
508
+ .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
509
+ .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
510
+ .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
511
+ .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
512
+ .ui-datepicker select.ui-datepicker-month,
513
+ .ui-datepicker select.ui-datepicker-year { width: 49%;}
514
+ .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
515
+ .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
516
+ .ui-datepicker td { border: 0; padding: 1px; }
517
+ .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
518
+ .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
519
+ .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
520
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
521
+
522
+ /* with multiple calendars */
523
+ .ui-datepicker.ui-datepicker-multi { width:auto; }
524
+ .ui-datepicker-multi .ui-datepicker-group { float:left; }
525
+ .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
526
+ .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
527
+ .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
528
+ .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
529
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
530
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
531
+ .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
532
+ .ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
533
+
534
+ /* RTL support */
535
+ .ui-datepicker-rtl { direction: rtl; }
536
+ .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
537
+ .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
538
+ .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
539
+ .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
540
+ .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
541
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
542
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
543
+ .ui-datepicker-rtl .ui-datepicker-group { float:right; }
544
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
545
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
546
+
547
+ /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
548
+ .ui-datepicker-cover {
549
+ display: none; /*sorry for IE5*/
550
+ display/**/: block; /*sorry for IE5*/
551
+ position: absolute; /*must have*/
552
+ z-index: -1; /*must have*/
553
+ filter: mask(); /*must have*/
554
+ top: -4px; /*must have*/
555
+ left: -4px; /*must have*/
556
+ width: 200px; /*must have*/
557
+ height: 200px; /*must have*/
558
+ }/*
559
+ * jQuery UI Progressbar 1.8.16
560
+ *
561
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
562
+ * Dual licensed under the MIT or GPL Version 2 licenses.
563
+ * http://jquery.org/license
564
+ *
565
+ * http://docs.jquery.com/UI/Progressbar#theming
566
+ */
567
+ .ui-progressbar { height:2em; text-align: left; }
568
+ .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }