sendmachine - Version 1.0.7

Version Notes

Fixed inheritance problems

Download this release

Release Info

Developer Sendmachine
Extension sendmachine
Version 1.0.7
Comparing to
See all releases


Code changes from version 1.0.6 to 1.0.7

app/code/community/Sendmachine/Sendmachine/Block/AppContainer/Tab/Email.php CHANGED
@@ -3,25 +3,33 @@
3
  class Sendmachine_Sendmachine_Block_AppContainer_Tab_Email extends Mage_Adminhtml_Block_Widget_Form {
4
 
5
  private $store = null;
 
6
 
7
  protected function _prepareForm() {
8
 
9
  $sm = Mage::registry('sm_model');
10
  $form = new Varien_Data_Form(array(
11
- 'id' => 'edit_form',
12
- 'action' => $this->getUrl('*/*/save'),
13
- 'method' => 'post'
14
- )
15
- );
16
 
17
- $request = Mage::app()->getRequest();
18
  $this->store = $request->getParam('store');
 
19
 
20
  $form->setUseContainer(true);
21
-
22
-
23
- $fieldset = $form->addFieldset('email_fieldset', array('legend' => Mage::helper('sendmachine')->__('Email Settings')));
24
- $tranzactionalfieldset = $form->addFieldset('tranzactional_fieldset', array('legend' => Mage::helper('sendmachine')->__('Transactional groups settings')));
 
 
 
 
 
 
 
25
  if($this->store) {
26
  $testfieldset = $form->addFieldset('emailtest_fieldset', array('legend' => Mage::helper('sendmachine')->__('Test Configuration')));
27
  }
@@ -33,7 +41,7 @@ class Sendmachine_Sendmachine_Block_AppContainer_Tab_Email extends Mage_Adminhtm
33
 
34
  $fieldset->addField('website_email', 'hidden', array(
35
  'name' => 'website',
36
- 'value' => $request->getParam('website')
37
  ));
38
 
39
  $fieldset->addField('store_email', 'hidden', array(
3
  class Sendmachine_Sendmachine_Block_AppContainer_Tab_Email extends Mage_Adminhtml_Block_Widget_Form {
4
 
5
  private $store = null;
6
+ private $website = null;
7
 
8
  protected function _prepareForm() {
9
 
10
  $sm = Mage::registry('sm_model');
11
  $form = new Varien_Data_Form(array(
12
+ 'id' => 'edit_form',
13
+ 'action' => $this->getUrl('*/*/save'),
14
+ 'method' => 'post'
15
+ ));
 
16
 
17
+ $request = Mage::app()->getRequest();
18
  $this->store = $request->getParam('store');
19
+ $this->website = $request->getParam('website');
20
 
21
  $form->setUseContainer(true);
22
+
23
+ $defaults = $sm->get("is_default");
24
+
25
+ $disabled_email = isset($defaults['email']) ? $defaults['email'] : true;
26
+ $checkbox_email = $sm->resetvaluescheckbox($this->store, $this->website, $disabled_email, "email");
27
+ $fieldset = $form->addFieldset('email_fieldset', array('legend' => Mage::helper('sendmachine')->__('Email Settings' . $checkbox_email)));
28
+
29
+ $disabled_transactional = isset($defaults['transactional']) ? $defaults['transactional'] : true;
30
+ $checkbox_tranzactional = $sm->resetvaluescheckbox($this->store, $this->website, $disabled_transactional, "transactional");
31
+ $tranzactionalfieldset = $form->addFieldset('transactional_fieldset', array('legend' => Mage::helper('sendmachine')->__('Transactional groups settings' . $checkbox_tranzactional)));
32
+
33
  if($this->store) {
34
  $testfieldset = $form->addFieldset('emailtest_fieldset', array('legend' => Mage::helper('sendmachine')->__('Test Configuration')));
35
  }
41
 
42
  $fieldset->addField('website_email', 'hidden', array(
43
  'name' => 'website',
44
+ 'value' => $request->getParam('website'),
45
  ));
46
 
47
  $fieldset->addField('store_email', 'hidden', array(
app/code/community/Sendmachine/Sendmachine/Block/AppContainer/Tab/General.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  class Sendmachine_Sendmachine_Block_AppContainer_Tab_General extends Mage_Adminhtml_Block_Widget_Form {
4
 
 
 
 
5
  protected function _prepareForm() {
6
 
7
  $sm = Mage::registry('sm_model');
@@ -12,9 +15,16 @@ class Sendmachine_Sendmachine_Block_AppContainer_Tab_General extends Mage_Adminh
12
  ));
13
 
14
  $request = Mage::app()->getRequest();
 
 
 
15
  $form->setUseContainer(true);
16
-
17
- $fieldset = $form->addFieldset('general_fieldset', array('legend' => Mage::helper('sendmachine')->__('General Settings')));
 
 
 
 
18
 
19
  $fieldset->addField('tab_general', 'hidden', array(
20
  'name' => 'tab',
@@ -30,7 +40,7 @@ class Sendmachine_Sendmachine_Block_AppContainer_Tab_General extends Mage_Adminh
30
  'name' => 'store',
31
  'value' => $request->getParam('store')
32
  ));
33
-
34
  $fieldset->addField('plugin_enabled', 'select', array(
35
  'name' => 'plugin_enabled',
36
  'label' => Mage::helper('sendmachine')->__('Plugin enabled'),
2
 
3
  class Sendmachine_Sendmachine_Block_AppContainer_Tab_General extends Mage_Adminhtml_Block_Widget_Form {
4
 
5
+ private $store = null;
6
+ private $website = null;
7
+
8
  protected function _prepareForm() {
9
 
10
  $sm = Mage::registry('sm_model');
15
  ));
16
 
17
  $request = Mage::app()->getRequest();
18
+ $this->store = $request->getParam('store');
19
+ $this->website = $request->getParam('website');
20
+
21
  $form->setUseContainer(true);
22
+
23
+ $defaults = $sm->get("is_default");
24
+
25
+ $disabled_general = isset($defaults['general']) ? $defaults['general'] : true;
26
+ $checkbox_general = $sm->resetvaluescheckbox($this->store, $this->website, $disabled_general, "general");
27
+ $fieldset = $form->addFieldset('general_fieldset', array('legend' => Mage::helper('sendmachine')->__('General Settings' . $checkbox_general)));
28
 
29
  $fieldset->addField('tab_general', 'hidden', array(
30
  'name' => 'tab',
40
  'name' => 'store',
41
  'value' => $request->getParam('store')
42
  ));
43
+
44
  $fieldset->addField('plugin_enabled', 'select', array(
45
  'name' => 'plugin_enabled',
46
  'label' => Mage::helper('sendmachine')->__('Plugin enabled'),
app/code/community/Sendmachine/Sendmachine/Block/AppContainer/Tab/Lists.php CHANGED
@@ -3,24 +3,29 @@
3
  class Sendmachine_Sendmachine_Block_AppContainer_Tab_Lists extends Mage_Adminhtml_Block_Widget_Form {
4
 
5
  private $store = null;
 
6
 
7
  protected function _prepareForm() {
8
 
9
  $sm = Mage::registry('sm_model');
10
  $form = new Varien_Data_Form(array(
11
- 'id' => 'edit_form',
12
- 'action' => $this->getUrl('*/*/save'),
13
- 'method' => 'post'
14
- )
15
- );
16
 
17
- $request = Mage::app()->getRequest();
18
  $this->store = $request->getParam('store');
 
19
 
20
  $form->setUseContainer(true);
21
-
22
- $fieldset = $form->addFieldset('lists_fieldset', array('legend' => Mage::helper('sendmachine')->__('List Settings')));
23
- $popupfieldset = $form->addFieldset('lists_fieldset_popup', array('legend' => Mage::helper('sendmachine')->__('Popup Settings')));
 
 
 
 
24
  if($this->store) {
25
  $importexport = $form->addFieldset('lists_fieldset_importexport', array('legend' => Mage::helper('sendmachine')->__('Import/Export Users')));
26
  }
@@ -69,39 +74,39 @@ class Sendmachine_Sendmachine_Block_AppContainer_Tab_Lists extends Mage_Adminhtm
69
  'values' => Mage::getModel('sendmachine/source_importExportLimit')->toOptionArray()
70
  ));
71
 
72
- $popupfieldset->addField('enable_subscribe_popup', 'select', array(
73
  'name' => 'enable_subscribe_popup',
74
  'label' => Mage::helper('sendmachine')->__('Subscribe popup'),
75
  'title' => Mage::helper('sendmachine')->__('Subscribe popup'),
76
  'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray()
77
  ));
78
 
79
- $popupfieldset->addField('popup_show_after_page', 'text', array(
80
  'name' => 'popup_show_after_page',
81
  'label' => Mage::helper('sendmachine')->__('Show On Page View'),
82
- 'title' => Mage::helper('sendmachine')->__('Show On Page View'),
83
  ));
84
 
85
- $popupfieldset->addField('popup_delay', 'text', array(
86
  'name' => 'popup_delay',
87
  'label' => Mage::helper('sendmachine')->__('Popup Delay (ms)'),
88
- 'title' => Mage::helper('sendmachine')->__('Popup Delay (ms)'),
89
  ));
90
 
91
- $popupfieldset->addField('hide_after_subscribe', 'text', array(
92
  'name' => 'hide_after_subscribe',
93
  'label' => Mage::helper('sendmachine')->__('Dismiss popup (s)'),
94
  'title' => Mage::helper('sendmachine')->__('Dismiss popup (s)'),
95
  'after_element_html' => '<small>' . Mage::helper('sendmachine')->__('Dismiss popup box after successful subscribe or no activity. 0 means no dismiss') . '</small>'
96
  ));
97
 
98
- $popupfieldset->addField('popup_text_header', 'text', array(
99
  'name' => 'popup_text_header',
100
  'label' => Mage::helper('sendmachine')->__("Popup header text"),
101
- 'title' => Mage::helper('sendmachine')->__("Popup header text"),
102
  ));
103
 
104
- $popupfieldset->addField('popup_custom_fields', 'checkbox', array(
105
  'style' => 'display:none',
106
  'label' => Mage::helper('sendmachine')->__("Popup custom fields"),
107
  'title' => Mage::helper('sendmachine')->__("Popup custom fields"),
3
  class Sendmachine_Sendmachine_Block_AppContainer_Tab_Lists extends Mage_Adminhtml_Block_Widget_Form {
4
 
5
  private $store = null;
6
+ private $website = null;
7
 
8
  protected function _prepareForm() {
9
 
10
  $sm = Mage::registry('sm_model');
11
  $form = new Varien_Data_Form(array(
12
+ 'id' => 'edit_form',
13
+ 'action' => $this->getUrl('*/*/save'),
14
+ 'method' => 'post'
15
+ ));
 
16
 
17
+ $request = Mage::app()->getRequest();
18
  $this->store = $request->getParam('store');
19
+ $this->website = $request->getParam('website');
20
 
21
  $form->setUseContainer(true);
22
+
23
+ $defaults = $sm->get("is_default");
24
+
25
+ $disabled_lists = isset($defaults['lists']) ? $defaults['lists'] : true;
26
+ $checkbox_lists = $sm->resetvaluescheckbox($this->store, $this->website, $disabled_lists, "lists");
27
+ $fieldset = $form->addFieldset('lists_fieldset', array('legend' => Mage::helper('sendmachine')->__('List Settings' . $checkbox_lists)));
28
+
29
  if($this->store) {
30
  $importexport = $form->addFieldset('lists_fieldset_importexport', array('legend' => Mage::helper('sendmachine')->__('Import/Export Users')));
31
  }
74
  'values' => Mage::getModel('sendmachine/source_importExportLimit')->toOptionArray()
75
  ));
76
 
77
+ $fieldset->addField('enable_subscribe_popup', 'select', array(
78
  'name' => 'enable_subscribe_popup',
79
  'label' => Mage::helper('sendmachine')->__('Subscribe popup'),
80
  'title' => Mage::helper('sendmachine')->__('Subscribe popup'),
81
  'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray()
82
  ));
83
 
84
+ $fieldset->addField('popup_show_after_page', 'text', array(
85
  'name' => 'popup_show_after_page',
86
  'label' => Mage::helper('sendmachine')->__('Show On Page View'),
87
+ 'title' => Mage::helper('sendmachine')->__('Show On Page View')
88
  ));
89
 
90
+ $fieldset->addField('popup_delay', 'text', array(
91
  'name' => 'popup_delay',
92
  'label' => Mage::helper('sendmachine')->__('Popup Delay (ms)'),
93
+ 'title' => Mage::helper('sendmachine')->__('Popup Delay (ms)')
94
  ));
95
 
96
+ $fieldset->addField('hide_after_subscribe', 'text', array(
97
  'name' => 'hide_after_subscribe',
98
  'label' => Mage::helper('sendmachine')->__('Dismiss popup (s)'),
99
  'title' => Mage::helper('sendmachine')->__('Dismiss popup (s)'),
100
  'after_element_html' => '<small>' . Mage::helper('sendmachine')->__('Dismiss popup box after successful subscribe or no activity. 0 means no dismiss') . '</small>'
101
  ));
102
 
103
+ $fieldset->addField('popup_text_header', 'text', array(
104
  'name' => 'popup_text_header',
105
  'label' => Mage::helper('sendmachine')->__("Popup header text"),
106
+ 'title' => Mage::helper('sendmachine')->__("Popup header text")
107
  ));
108
 
109
+ $fieldset->addField('popup_custom_fields', 'checkbox', array(
110
  'style' => 'display:none',
111
  'label' => Mage::helper('sendmachine')->__("Popup custom fields"),
112
  'title' => Mage::helper('sendmachine')->__("Popup custom fields"),
app/code/community/Sendmachine/Sendmachine/Model/Sendmachine.php CHANGED
@@ -32,6 +32,12 @@ class Sendmachine_Sendmachine_Model_Sendmachine extends Mage_Core_Model_Abstract
32
  public function getStore() {
33
  return $this->store;
34
  }
 
 
 
 
 
 
35
 
36
  public function get($key = NULL, $forceFetch = false) {
37
 
@@ -385,5 +391,110 @@ class Sendmachine_Sendmachine_Model_Sendmachine extends Mage_Core_Model_Abstract
385
  }
386
  }
387
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
388
 
389
- }
32
  public function getStore() {
33
  return $this->store;
34
  }
35
+
36
+ public function resetData() {
37
+
38
+ Mage::app()->getCacheInstance()->cleanType('config');
39
+ $this->appData = NULL;
40
+ }
41
 
42
  public function get($key = NULL, $forceFetch = false) {
43
 
391
  }
392
  }
393
  }
394
+
395
+ public function resetvaluescheckbox($storeid = "", $websiteid = "", $checked = false, $action = "") {
396
+
397
+ $toret = "";
398
+
399
+ if ($storeid || $websiteid) {
400
+
401
+ $scope = $storeid ? "website" : "default";
402
+ $jsresetaction = "onchange='resetToParent(this.checked,\"$action\")'";
403
+
404
+ $checkbox = '<input value="1" name="override_details[' . $action . ']" ' . $jsresetaction . ' ' . ($checked ? "checked" : "") . ' type="checkbox"/>';
405
+ $input = '<input value="0" name="override_details[' . $action . ']" type="hidden">';
406
+ $label = '<label style="color: white;">' . $input . " " . $checkbox . ' Use ' . $scope . ' values</label>';
407
+ $toret = ' <span style="margin-left: 10px;">[ ' . $label . ']</span>';
408
+ $toret .= '<img src="" onerror="initResetToParent(\'' . $checked . '\', \'' . $action . '\')">';
409
+ }
410
+
411
+ return $toret;
412
+ }
413
+
414
+ public function getArea($needed_areas = "") {
415
+
416
+ $areas = array(
417
+ "email" => array("email_enabled", "smtp_encryption", "from_email", "from_name"),
418
+ "transactional" => array("transactional_campaigns_enabled", "transactional_campaign_prefix", "transactional_campaign_areas", "transactional_campaign_suffix"),
419
+ "general" => array("plugin_enabled", "api_username", "api_password"),
420
+ "lists" => array("selected_contact_list", "keep_users_synced", "import_subscribers_limit", "export_subscribers_limit", "enable_subscribe_popup", "popup_show_after_page", "popup_delay", "hide_after_subscribe", "popup_text_header", "list_custom_fields","contact_lists")
421
+ );
422
+
423
+ $known_areas = array_keys($areas);
424
+
425
+ $values = $this->get();
426
+ $toret = NULL;
427
+
428
+ if (!is_array($needed_areas)) {
429
+ $needed_areas = array($needed_areas);
430
+ }
431
+
432
+ foreach ($needed_areas as $area) {
433
+
434
+ if (!in_array($area, $known_areas)) {
435
+ continue;
436
+ }
437
+
438
+ foreach ($areas[$area] as $v) {
439
+ $toret[$v] = $values[$v];
440
+ }
441
+ }
442
+
443
+ return $toret;
444
+ }
445
+
446
+ public function updateChildrens() {
447
+
448
+ $content = $this->get();
449
+
450
+ if(!$this->website AND !$this->store) {
451
+
452
+ foreach(Mage::app()->getWebsites() as $website) {
453
+
454
+ $this->setWebsite($website->getCode());
455
+ $this->setStore(null, false);
456
+
457
+ $this->_doUpdateTarget($content);
458
+
459
+ foreach($website->getStores() as $store) {
460
+
461
+ $this->setWebsite($website->getCode());
462
+ $this->setStore($store->getCode());
463
+
464
+ $this->_doUpdateTarget($content);
465
+ }
466
+ }
467
+
468
+ } elseif(!$this->store && $this->website) {
469
+
470
+ $website = Mage::app()->getWebsite($this->website);
471
+ foreach($website->getStores() as $store) {
472
+
473
+ $this->setWebsite($this->website);
474
+ $this->setStore($store->getCode());
475
+
476
+ $this->_doUpdateTarget($content);
477
+ }
478
+ }
479
+
480
+ }
481
+
482
+ private function _doUpdateTarget($parent_data = array()) {
483
+
484
+ $this->resetData();
485
+
486
+ $update_data = array();
487
+ $areas = array_keys(array_filter($this->get("is_default")));
488
+
489
+ if ($areas && ($target_data = $this->getArea($areas)) && is_array($target_data)) {
490
+
491
+ foreach($target_data as $target_key => $target_value) {
492
+ $update_data[$target_key] = $parent_data[$target_key];
493
+ }
494
+
495
+ $this->set($update_data);
496
+ $this->commit();
497
+ }
498
+ }
499
 
500
+ }
app/code/community/Sendmachine/Sendmachine/controllers/SendmachineController.php CHANGED
@@ -25,7 +25,6 @@ class Sendmachine_Sendmachine_SendmachineController extends Mage_Adminhtml_Contr
25
  $request = Mage::app()->getRequest();
26
  $website = $request->getParam('website');
27
  $store = $request->getParam('store');
28
- $button_data = null;
29
 
30
  $this->sm->setWebsite($website);
31
  $this->sm->setStore($store, false);
@@ -44,28 +43,11 @@ class Sendmachine_Sendmachine_SendmachineController extends Mage_Adminhtml_Contr
44
  $conflicts = implode("</li><li>", $conflicts);
45
  Mage::getSingleton('core/session')->addError("<span>Detected overwrite conflict:</span><ul style='list-style-type: disc;margin-top: 5px;'><li>$conflicts</li></ul>");
46
  }
47
-
48
- if ($website AND $store) {
49
- $button_data = array(
50
- 'label' => $this->__('Reset values to website'),
51
- 'class' => 'reset_to_parent',
52
- 'onclick' => "resetToParent('" . Mage::helper('adminhtml')->getUrl('adminhtml/sendmachine/resetoparent') . "', '$website', '$store', 'website')"
53
- );
54
- } elseif ($website) {
55
- $button_data = array(
56
- 'label' => $this->__('Reset values to default'),
57
- 'class' => 'reset_to_parent',
58
- 'onclick' => "resetToParent('" . Mage::helper('adminhtml')->getUrl('adminhtml/sendmachine/resetoparent') . "', '$website', '$store', 'default')"
59
- );
60
- }
61
 
62
  $this->loadLayout();
63
- $this->_setActiveMenu('system/sendmachine');
64
  $this->_addContent($this->getLayout()->createBlock('adminhtml/system_config_switcher'));
65
- if($button_data) {
66
- $this->_addContent($this->getLayout()->createBlock('sendmachine/appContainer_main', 'smMainFormContainer', array('tab' => $tab))->addButton('reset_to_parent', $button_data, -1, 1));
67
- }
68
- else $this->_addContent($this->getLayout()->createBlock('sendmachine/appContainer_main', 'smMainFormContainer', array('tab' => $tab)));
69
  $this->_addLeft($this->getLayout()->createBlock('sendmachine/appContainer_tabs'));
70
  $this->getLayout()->getBlock('head')->addJs("sendmachine/admin.js");
71
  $this->renderLayout();
@@ -95,7 +77,8 @@ class Sendmachine_Sendmachine_SendmachineController extends Mage_Adminhtml_Contr
95
  $tab = isset($params['tab']) ? $params['tab'] : "index";
96
  $website = $params['website'];
97
  $store = $params['store'];
98
-
 
99
  unset($params['tab']);
100
  unset($params['limit']);
101
  unset($params['page']);
@@ -103,27 +86,40 @@ class Sendmachine_Sendmachine_SendmachineController extends Mage_Adminhtml_Contr
103
  unset($params['form_key']);
104
  unset($params['website']);
105
  unset($params['store']);
106
-
107
- if(isset($params['reset_to_parent']) AND $params['reset_to_parent'] AND ($website OR $store)) {
108
-
109
- if($store AND $website) {
110
- $this->sm->setWebsite($website);
111
- $this->sm->setStore(null, false);
112
- }
113
- else {
114
- $this->sm->setWebsite(null);
115
- $this->sm->setStore(null, false);
116
- }
117
-
118
- $_params = $this->sm->get();
119
- foreach($params as $k => &$v) {
120
- $v = isset($_params[$k]) ? $_params[$k] : "";
121
- }
122
- }
123
-
124
- $this->sm->setWebsite($website);
125
- $this->sm->setStore($store);
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  $initial_credentials = $this->sm->getCredentials();
128
  $initial_listid = $this->sm->get('selected_contact_list');
129
  $initial_smtp_encryption = $this->sm->get('smtp_encryption');
@@ -165,6 +161,8 @@ class Sendmachine_Sendmachine_SendmachineController extends Mage_Adminhtml_Contr
165
  }
166
 
167
  $this->sm->commit();
 
 
168
 
169
  if (!$errorHandled) {
170
  Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Successfully saved'));
@@ -303,8 +301,16 @@ class Sendmachine_Sendmachine_SendmachineController extends Mage_Adminhtml_Contr
303
  Mage::getSingleton('adminhtml/session')->addError($this->__('Api not connected'));
304
  }
305
  }
 
 
 
 
 
 
 
 
306
 
307
- private function _initApp() {
308
 
309
  $this->sm->set('api_connected', true);
310
  $this->sm->set('plugin_enabled', true);
25
  $request = Mage::app()->getRequest();
26
  $website = $request->getParam('website');
27
  $store = $request->getParam('store');
 
28
 
29
  $this->sm->setWebsite($website);
30
  $this->sm->setStore($store, false);
43
  $conflicts = implode("</li><li>", $conflicts);
44
  Mage::getSingleton('core/session')->addError("<span>Detected overwrite conflict:</span><ul style='list-style-type: disc;margin-top: 5px;'><li>$conflicts</li></ul>");
45
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  $this->loadLayout();
48
+ $this->_setActiveMenu('sendmachine/sendmachine');
49
  $this->_addContent($this->getLayout()->createBlock('adminhtml/system_config_switcher'));
50
+ $this->_addContent($this->getLayout()->createBlock('sendmachine/appContainer_main', 'smMainFormContainer', array('tab' => $tab)));
 
 
 
51
  $this->_addLeft($this->getLayout()->createBlock('sendmachine/appContainer_tabs'));
52
  $this->getLayout()->getBlock('head')->addJs("sendmachine/admin.js");
53
  $this->renderLayout();
77
  $tab = isset($params['tab']) ? $params['tab'] : "index";
78
  $website = $params['website'];
79
  $store = $params['store'];
80
+ $override_details = isset($params['override_details']) ? $params['override_details'] : false;
81
+
82
  unset($params['tab']);
83
  unset($params['limit']);
84
  unset($params['page']);
86
  unset($params['form_key']);
87
  unset($params['website']);
88
  unset($params['store']);
89
+ unset($params['override_details']);
90
+
91
+ if ($override_details AND is_array($override_details) AND ( $website OR $store)) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
+ foreach ($override_details as $area => $do_override) {
94
+
95
+ if ($do_override) {
96
+
97
+ if ($store AND $website) {
98
+ $this->sm->setWebsite($website);
99
+ $this->sm->setStore(null, false);
100
+ $scope = "";
101
+ } else {
102
+ $this->sm->setWebsite(null);
103
+ $this->sm->setStore(null, false);
104
+ $scope = "";
105
+ }
106
+
107
+ if (($_params = $this->sm->getArea($area)) && is_array($_params)) {
108
+
109
+ $params = array_merge($params, $_params);
110
+ }
111
+ $params['is_default'][$area] = 1;
112
+ } else {
113
+ $params['is_default'][$area] = 0;
114
+ }
115
+ }
116
+ }
117
+
118
+ $this->sm->setWebsite($website);
119
+ $this->sm->setStore($store);
120
+
121
+ $this->sm->resetData();
122
+
123
  $initial_credentials = $this->sm->getCredentials();
124
  $initial_listid = $this->sm->get('selected_contact_list');
125
  $initial_smtp_encryption = $this->sm->get('smtp_encryption');
161
  }
162
 
163
  $this->sm->commit();
164
+ $this->sm->updateChildrens();
165
+
166
 
167
  if (!$errorHandled) {
168
  Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Successfully saved'));
301
  Mage::getSingleton('adminhtml/session')->addError($this->__('Api not connected'));
302
  }
303
  }
304
+
305
+ public function resetvaluesAction() {
306
+
307
+ $this->sm->setWebsite($this->getRequest()->getParam('website'));
308
+ $this->sm->setStore($this->getRequest()->getParam('store'));
309
+
310
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Hello'));
311
+ }
312
 
313
+ private function _initApp() {
314
 
315
  $this->sm->set('api_connected', true);
316
  $this->sm->set('plugin_enabled', true);
app/code/community/Sendmachine/Sendmachine/etc/adminhtml.xml CHANGED
@@ -1,14 +1,16 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <config>
3
- <menu>
4
- <system>
5
- <children>
6
- <sendmachine translate="title" module="sendmachine">
7
- <title>Sendmachine</title>
8
- <sort_order>110</sort_order>
9
- <action>adminhtml/sendmachine</action>
10
- </sendmachine>
11
- </children>
12
- </system>
13
- </menu>
 
 
14
  </config>
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <config>
3
+ <menu>
4
+ <sendmachine module="sendmachine">
5
+ <title>Sendmachine</title>
6
+ <sort_order>110</sort_order>
7
+ <children>
8
+ <sendmachine translate="title" module="sendmachine">
9
+ <title>Configuration</title>
10
+ <sort_order>110</sort_order>
11
+ <action>adminhtml/sendmachine</action>
12
+ </sendmachine>
13
+ </children>
14
+ </sendmachine>
15
+ </menu>
16
  </config>
js/sendmachine/admin.js CHANGED
@@ -101,14 +101,29 @@ function smRefreshCachedLists(url) {
101
  });
102
  }
103
 
104
- function resetToParent() {
105
-
106
- var input = document.createElement("input");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
- input.setAttribute("type", "hidden");
109
- input.setAttribute("name", "reset_to_parent");
110
- input.setAttribute("value", "1");
111
 
112
- document.getElementById("edit_form").appendChild(input);
113
- editForm.submit();
114
  }
101
  });
102
  }
103
 
104
+ function initResetToParent(disable, area) {
105
+
106
+ var fieldset = document.getElementById(area + '_fieldset');
107
+
108
+ if(fieldset) {
109
+
110
+ fieldset.style.position = "relative";
111
+
112
+ var node = document.createElement("DIV");
113
+ node.setAttribute("style", "position:absolute;top:0px;left:0px;width:100%;height:100%;background:rgba(255,255,255,0.3);display:none;");
114
+ node.setAttribute("id", "disabled_overlay_" + area);
115
+ fieldset.appendChild(node);
116
+
117
+ resetToParent(disable, area);
118
+ }
119
+ }
120
+
121
+ function resetToParent(disable, area) {
122
+
123
+ var overlay = document.getElementById("disabled_overlay_" + area);
124
 
125
+ if (overlay) {
 
 
126
 
127
+ overlay.style.display = disable ? "block" : "none";
128
+ }
129
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>sendmachine</name>
4
- <version>1.0.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
@@ -32,11 +32,11 @@
32
  &lt;/li&gt;&#xD;
33
  &lt;/ul&gt;&#xD;
34
  &lt;/div&gt;</description>
35
- <notes>List cache refresh fix.</notes>
36
  <authors><author><name>Sendmachine</name><user>sendmachine</user><email>support@sendmachine.com</email></author></authors>
37
- <date>2017-04-13</date>
38
- <time>13:02:25</time>
39
- <contents><target name="magecommunity"><dir name="Sendmachine"><dir name="Sendmachine"><dir name="Block"><dir name="AppContainer"><file name="Grid.php" hash="93132a7ae131d9a446cd6897aeface90"/><file name="Main.php" hash="72bfae321e391f0f6c9534b2c2cf5bdb"/><dir name="Tab"><file name="Email.php" hash="b1804373a660ebd171104f75f3146d83"/><file name="General.php" hash="43131871f9862e88d5bbf2aea388cda6"/><file name="Lists.php" hash="b4422f9c2f7043bb280bf789f2955a14"/></dir><file name="Tabs.php" hash="35a2ee900e946b65dbbe9f025b45a7d2"/></dir><file name="PopupBlock.php" hash="4cd81d501ad55345a8d9af28bd5271af"/></dir><dir name="Helper"><file name="Data.php" hash="07f2706e7c8a5535aea556f13d13f8f6"/></dir><dir name="Model"><file name="Cronjobs.php" hash="c9189af524b66278b60a272382777313"/><dir name="Email"><file name="Queue.php" hash="565cf2bee7c364027bd853ccac13a0c8"/><file name="Template.php" hash="e34560b42fad5c838a58655fb2d1e7c4"/></dir><dir name="Mysql4"><dir name="Sendmachine"><file name="Collection.php" hash="e9c6c5e6b32f8ce661448528627f44ee"/></dir><file name="Sendmachine.php" hash="70d59dd115baa6d9e6d7f398508eeb95"/></dir><file name="Observer.php" hash="5cd573bc8bc33e94ad145dc385f8d8ef"/><file name="Sendmachine.php" hash="a6a1983ee5773eb9de868911b241dda5"/><dir name="Source"><file name="Contactlist.php" hash="399c3de2d3616e98bb97310a34c8ae16"/><file name="ImportExportLimit.php" hash="3bde4faece90495bef39e6c862f09350"/><file name="Smtp.php" hash="a99f6c2795a1a2c479bfcef9e8b4d9de"/><file name="TransactionalCampAreas.php" hash="94ec1556a650739051c5d3d3da38be60"/></dir></dir><dir name="controllers"><file name="SendmachineController.php" hash="04436097484e0acfc9bd91252a9299e9"/><file name="SubscribeController.php" hash="4beb41648b4efdb530113b6e4cf5d4d7"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2b9bc07f400202cbf4a92e4256319d28"/><file name="config.xml" hash="28d70bc47258baad427a98a02561a088"/></dir><dir name="sql"><dir name="sendmachine_setup"><file name="mysql4-install-1.0.0.php" hash="c7fb051da24f17f073dd0c3fc76a79c1"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="062cab72ea965e951acd43c3f3abc2bb"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sendmachine_Sendmachine.xml" hash="8378d3fff65502b2677cb5439af9a091"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="sendmachine.xml" hash="111176ded682edb4732351af44f2fa66"/></dir><dir name="template"><dir name="sendmachine"><file name="popup.phtml" hash="456a82301ee6d038a4964ab857645d6b"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Sendmachine_Sendmachine.csv" hash="bdfdd5fda92cf52a1e9c07801f7b2a64"/><dir name="template"><dir name="email"><dir name="sendmachine"><file name="sm_send_test_email.html" hash="572e49104e369c140ea691b83e4888c0"/></dir></dir></dir></dir></target><target name="magelib"><dir name="SendmachineApi"><file name="README.md" hash="4f3be41975112c7b0e2d1b420362ca88"/><file name="SendmachineApiClient.php" hash="780707f47e9640ece77dc63dc0b90300"/><file name="composer.json" hash="14472d29d81169ec0865135d75ceda44"/><dir name="library"><file name="Account.php" hash="d385b9bf2c6ab2cfe59224376b6e5ddd"/><file name="Campaigns.php" hash="27eea607162456cb580ae5b468384cdc"/><file name="Lists.php" hash="1e15afc8cb1bb149df1a3ccf85758dd5"/><file name="Sender.php" hash="fb45b76646ed6a5708f5234955fc327f"/><file name="Templates.php" hash="03c967a70588670bc6a7318a3214e0a1"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="sendmachine"><file name="logo.png" hash="3ded087eb9efd7c6bdcaade0fec6f9e5"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="sendmachine"><file name="frontend.css" hash="d02fbf9fe0d145c7a9e8d59a91b7055d"/><file name="frontend.js" hash="ca7ca5de929041908f263f68ade035bf"/><file name="loading.gif" hash="3fce1e41ae8b01675553928349770faa"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="sendmachine"><file name="admin.js" hash="e1173888a67a91bd191703fcc1620d02"/></dir></dir></target></contents>
40
  <compatible/>
41
  <dependencies><required><php><min>5.3.0</min><max>7.0.0</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
42
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>sendmachine</name>
4
+ <version>1.0.7</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
32
  &lt;/li&gt;&#xD;
33
  &lt;/ul&gt;&#xD;
34
  &lt;/div&gt;</description>
35
+ <notes>Fixed inheritance problems</notes>
36
  <authors><author><name>Sendmachine</name><user>sendmachine</user><email>support@sendmachine.com</email></author></authors>
37
+ <date>2017-04-19</date>
38
+ <time>14:00:22</time>
39
+ <contents><target name="magecommunity"><dir name="Sendmachine"><dir name="Sendmachine"><dir name="Block"><dir name="AppContainer"><file name="Grid.php" hash="93132a7ae131d9a446cd6897aeface90"/><file name="Main.php" hash="72bfae321e391f0f6c9534b2c2cf5bdb"/><dir name="Tab"><file name="Email.php" hash="31e9e4c18313979404e6e373ed04e07e"/><file name="General.php" hash="c1435243f9dc1e63dba1e56085b91f08"/><file name="Lists.php" hash="d3bf5a6aa0e2fae1d32b1e1e2977e6be"/></dir><file name="Tabs.php" hash="35a2ee900e946b65dbbe9f025b45a7d2"/></dir><file name="PopupBlock.php" hash="4cd81d501ad55345a8d9af28bd5271af"/></dir><dir name="Helper"><file name="Data.php" hash="07f2706e7c8a5535aea556f13d13f8f6"/></dir><dir name="Model"><file name="Cronjobs.php" hash="c9189af524b66278b60a272382777313"/><dir name="Email"><file name="Queue.php" hash="565cf2bee7c364027bd853ccac13a0c8"/><file name="Template.php" hash="e34560b42fad5c838a58655fb2d1e7c4"/></dir><dir name="Mysql4"><dir name="Sendmachine"><file name="Collection.php" hash="e9c6c5e6b32f8ce661448528627f44ee"/></dir><file name="Sendmachine.php" hash="70d59dd115baa6d9e6d7f398508eeb95"/></dir><file name="Observer.php" hash="5cd573bc8bc33e94ad145dc385f8d8ef"/><file name="Sendmachine.php" hash="326eed3f7e746c1c2f4cc55e96a0ba4d"/><dir name="Source"><file name="Contactlist.php" hash="399c3de2d3616e98bb97310a34c8ae16"/><file name="ImportExportLimit.php" hash="3bde4faece90495bef39e6c862f09350"/><file name="Smtp.php" hash="a99f6c2795a1a2c479bfcef9e8b4d9de"/><file name="TransactionalCampAreas.php" hash="94ec1556a650739051c5d3d3da38be60"/></dir></dir><dir name="controllers"><file name="SendmachineController.php" hash="ade7bd4f95b46b4044ae07f01c620d6c"/><file name="SubscribeController.php" hash="4beb41648b4efdb530113b6e4cf5d4d7"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1c594f7e2e5d536338405d01db415370"/><file name="config.xml" hash="28d70bc47258baad427a98a02561a088"/></dir><dir name="sql"><dir name="sendmachine_setup"><file name="mysql4-install-1.0.0.php" hash="c7fb051da24f17f073dd0c3fc76a79c1"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="062cab72ea965e951acd43c3f3abc2bb"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sendmachine_Sendmachine.xml" hash="8378d3fff65502b2677cb5439af9a091"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="sendmachine.xml" hash="111176ded682edb4732351af44f2fa66"/></dir><dir name="template"><dir name="sendmachine"><file name="popup.phtml" hash="456a82301ee6d038a4964ab857645d6b"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Sendmachine_Sendmachine.csv" hash="bdfdd5fda92cf52a1e9c07801f7b2a64"/><dir name="template"><dir name="email"><dir name="sendmachine"><file name="sm_send_test_email.html" hash="572e49104e369c140ea691b83e4888c0"/></dir></dir></dir></dir></target><target name="magelib"><dir name="SendmachineApi"><file name="README.md" hash="4f3be41975112c7b0e2d1b420362ca88"/><file name="SendmachineApiClient.php" hash="780707f47e9640ece77dc63dc0b90300"/><file name="composer.json" hash="14472d29d81169ec0865135d75ceda44"/><dir name="library"><file name="Account.php" hash="d385b9bf2c6ab2cfe59224376b6e5ddd"/><file name="Campaigns.php" hash="27eea607162456cb580ae5b468384cdc"/><file name="Lists.php" hash="1e15afc8cb1bb149df1a3ccf85758dd5"/><file name="Sender.php" hash="fb45b76646ed6a5708f5234955fc327f"/><file name="Templates.php" hash="03c967a70588670bc6a7318a3214e0a1"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="sendmachine"><file name="logo.png" hash="3ded087eb9efd7c6bdcaade0fec6f9e5"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="sendmachine"><file name="frontend.css" hash="d02fbf9fe0d145c7a9e8d59a91b7055d"/><file name="frontend.js" hash="ca7ca5de929041908f263f68ade035bf"/><file name="loading.gif" hash="3fce1e41ae8b01675553928349770faa"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="sendmachine"><file name="admin.js" hash="f298fd263175bdf43fe056d159d04a7f"/></dir></dir></target></contents>
40
  <compatible/>
41
  <dependencies><required><php><min>5.3.0</min><max>7.0.0</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
42
  </package>