Version Notes
If you like Wordpress' "Preview Post" button, then this extension is for you.
Download this release
Release Info
Developer | Demac Media |
Extension | Simple_Product_Preview |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/local/Demac/Adminhtml/Block/Catalog/Product/Edit.php +262 -0
- app/code/local/Demac/Adminhtml/etc/config.xml +17 -0
- app/code/local/Demac/All/Block/Notification/Window.php +55 -0
- app/code/local/Demac/All/Block/System/Config/Form/Fieldset/Demacall/Extensions.php +174 -0
- app/code/local/Demac/All/Helper/Config.php +28 -0
- app/code/local/Demac/All/Helper/Data.php +24 -0
- app/code/local/Demac/All/Model/Feed.php +88 -0
- app/code/local/Demac/All/Model/Feed/Abstract.php +67 -0
- app/code/local/Demac/All/Model/Feed/Extensions.php +136 -0
- app/code/local/Demac/All/Model/Feed/Updates.php +93 -0
- app/code/local/Demac/All/Model/Source/Updates/Type.php +74 -0
- app/code/local/Demac/All/etc/adminhtml.xml +49 -0
- app/code/local/Demac/All/etc/config.xml +119 -0
- app/code/local/Demac/All/etc/system.xml +53 -0
- app/design/adminhtml/default/default/template/demac/catalog/product/edit.phtml +134 -0
- app/design/adminhtml/default/default/template/demac_all/notification/window.phtml +75 -0
- app/design/adminhtml/default/default/template/demac_all/notification/window/first-run.phtml +59 -0
- app/etc/modules/Demac_Adminhtml.xml +9 -0
- app/etc/modules/Demac_all.xml +9 -0
- package.xml +18 -0
app/code/local/Demac/Adminhtml/Block/Catalog/Product/Edit.php
ADDED
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* Customer edit block
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Adminhtml
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Demac_Adminhtml_Block_Catalog_Product_Edit extends Mage_Adminhtml_Block_Widget
|
35 |
+
{
|
36 |
+
public function __construct()
|
37 |
+
{
|
38 |
+
parent::__construct();
|
39 |
+
$this->setTemplate('demac/catalog/product/edit.phtml');
|
40 |
+
$this->setId('product_edit');
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Retrieve currently edited product object
|
45 |
+
*
|
46 |
+
* @return Mage_Catalog_Model_Product
|
47 |
+
*/
|
48 |
+
public function getProduct()
|
49 |
+
{
|
50 |
+
return Mage::registry('current_product');
|
51 |
+
}
|
52 |
+
|
53 |
+
protected function _prepareLayout()
|
54 |
+
{
|
55 |
+
$_product = $this->getProduct();
|
56 |
+
if (!$this->getRequest()->getParam('popup')) {
|
57 |
+
$this->setChild('back_button',
|
58 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
59 |
+
->setData(array(
|
60 |
+
'label' => Mage::helper('catalog')->__('Back'),
|
61 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/', array('store'=>$this->getRequest()->getParam('store', 0))).'\')',
|
62 |
+
'class' => 'back'
|
63 |
+
))
|
64 |
+
);
|
65 |
+
$this->setChild('preview_button',
|
66 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
67 |
+
->setData(array(
|
68 |
+
'label' => Mage::helper('catalog')->__('Preview'),
|
69 |
+
'onclick' => 'window.open(\''. Mage::getModel('core/store')->load(0)->getUrl() . $_product->getUrlPath().'\')'
|
70 |
+
))
|
71 |
+
);
|
72 |
+
} else {
|
73 |
+
$this->setChild('back_button',
|
74 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
75 |
+
->setData(array(
|
76 |
+
'label' => Mage::helper('catalog')->__('Close Window'),
|
77 |
+
'onclick' => 'window.close()',
|
78 |
+
'class' => 'cancel'
|
79 |
+
))
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
if (!$this->getProduct()->isReadonly()) {
|
84 |
+
$this->setChild('reset_button',
|
85 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
86 |
+
->setData(array(
|
87 |
+
'label' => Mage::helper('catalog')->__('Reset'),
|
88 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/*', array('_current'=>true)).'\')'
|
89 |
+
))
|
90 |
+
);
|
91 |
+
|
92 |
+
$this->setChild('save_button',
|
93 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
94 |
+
->setData(array(
|
95 |
+
'label' => Mage::helper('catalog')->__('Save'),
|
96 |
+
'onclick' => 'productForm.submit()',
|
97 |
+
'class' => 'save'
|
98 |
+
))
|
99 |
+
);
|
100 |
+
}
|
101 |
+
|
102 |
+
if (!$this->getRequest()->getParam('popup')) {
|
103 |
+
if (!$this->getProduct()->isReadonly()) {
|
104 |
+
$this->setChild('save_and_edit_button',
|
105 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
106 |
+
->setData(array(
|
107 |
+
'label' => Mage::helper('catalog')->__('Save and Continue Edit'),
|
108 |
+
'onclick' => 'saveAndContinueEdit(\''.$this->getSaveAndContinueUrl().'\')',
|
109 |
+
'class' => 'save'
|
110 |
+
))
|
111 |
+
);
|
112 |
+
}
|
113 |
+
if ($this->getProduct()->isDeleteable()) {
|
114 |
+
$this->setChild('delete_button',
|
115 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
116 |
+
->setData(array(
|
117 |
+
'label' => Mage::helper('catalog')->__('Delete'),
|
118 |
+
'onclick' => 'confirmSetLocation(\''.Mage::helper('catalog')->__('Are you sure?').'\', \''.$this->getDeleteUrl().'\')',
|
119 |
+
'class' => 'delete'
|
120 |
+
))
|
121 |
+
);
|
122 |
+
}
|
123 |
+
|
124 |
+
if ($this->getProduct()->isDuplicable()) {
|
125 |
+
$this->setChild('duplicate_button',
|
126 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
127 |
+
->setData(array(
|
128 |
+
'label' => Mage::helper('catalog')->__('Duplicate'),
|
129 |
+
'onclick' => 'setLocation(\'' . $this->getDuplicateUrl() . '\')',
|
130 |
+
'class' => 'add'
|
131 |
+
))
|
132 |
+
);
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
return parent::_prepareLayout();
|
137 |
+
}
|
138 |
+
|
139 |
+
public function getBackButtonHtml()
|
140 |
+
{
|
141 |
+
return $this->getChildHtml('back_button');
|
142 |
+
}
|
143 |
+
|
144 |
+
public function getPreviewButtonHtml()
|
145 |
+
{
|
146 |
+
return $this->getChildHtml('preview_button');
|
147 |
+
}
|
148 |
+
|
149 |
+
public function getCancelButtonHtml()
|
150 |
+
{
|
151 |
+
return $this->getChildHtml('reset_button');
|
152 |
+
}
|
153 |
+
|
154 |
+
public function getSaveButtonHtml()
|
155 |
+
{
|
156 |
+
return $this->getChildHtml('save_button');
|
157 |
+
}
|
158 |
+
|
159 |
+
public function getSaveAndEditButtonHtml()
|
160 |
+
{
|
161 |
+
return $this->getChildHtml('save_and_edit_button');
|
162 |
+
}
|
163 |
+
|
164 |
+
public function getDeleteButtonHtml()
|
165 |
+
{
|
166 |
+
return $this->getChildHtml('delete_button');
|
167 |
+
}
|
168 |
+
|
169 |
+
public function getDuplicateButtonHtml()
|
170 |
+
{
|
171 |
+
return $this->getChildHtml('duplicate_button');
|
172 |
+
}
|
173 |
+
|
174 |
+
public function getValidationUrl()
|
175 |
+
{
|
176 |
+
return $this->getUrl('*/*/validate', array('_current'=>true));
|
177 |
+
}
|
178 |
+
|
179 |
+
public function getSaveUrl()
|
180 |
+
{
|
181 |
+
return $this->getUrl('*/*/save', array('_current'=>true, 'back'=>null));
|
182 |
+
}
|
183 |
+
|
184 |
+
public function getSaveAndContinueUrl()
|
185 |
+
{
|
186 |
+
return $this->getUrl('*/*/save', array(
|
187 |
+
'_current' => true,
|
188 |
+
'back' => 'edit',
|
189 |
+
'tab' => '{{tab_id}}',
|
190 |
+
'active_tab' => null
|
191 |
+
));
|
192 |
+
}
|
193 |
+
|
194 |
+
public function getProductId()
|
195 |
+
{
|
196 |
+
return $this->getProduct()->getId();
|
197 |
+
}
|
198 |
+
|
199 |
+
public function getProductSetId()
|
200 |
+
{
|
201 |
+
$setId = false;
|
202 |
+
if (!($setId = $this->getProduct()->getAttributeSetId()) && $this->getRequest()) {
|
203 |
+
$setId = $this->getRequest()->getParam('set', null);
|
204 |
+
}
|
205 |
+
return $setId;
|
206 |
+
}
|
207 |
+
|
208 |
+
public function getIsGrouped()
|
209 |
+
{
|
210 |
+
return $this->getProduct()->isGrouped();
|
211 |
+
}
|
212 |
+
|
213 |
+
public function getDeleteUrl()
|
214 |
+
{
|
215 |
+
return $this->getUrl('*/*/delete', array('_current'=>true));
|
216 |
+
}
|
217 |
+
|
218 |
+
public function getDuplicateUrl()
|
219 |
+
{
|
220 |
+
return $this->getUrl('*/*/duplicate', array('_current'=>true));
|
221 |
+
}
|
222 |
+
|
223 |
+
public function getHeader()
|
224 |
+
{
|
225 |
+
$header = '';
|
226 |
+
if ($this->getProduct()->getId()) {
|
227 |
+
$header = $this->htmlEscape($this->getProduct()->getName());
|
228 |
+
}
|
229 |
+
else {
|
230 |
+
$header = Mage::helper('catalog')->__('New Product');
|
231 |
+
}
|
232 |
+
if ($setName = $this->getAttributeSetName()) {
|
233 |
+
$header.= ' (' . $setName . ')';
|
234 |
+
}
|
235 |
+
return $header;
|
236 |
+
}
|
237 |
+
|
238 |
+
public function getAttributeSetName()
|
239 |
+
{
|
240 |
+
if ($setId = $this->getProduct()->getAttributeSetId()) {
|
241 |
+
$set = Mage::getModel('eav/entity_attribute_set')
|
242 |
+
->load($setId);
|
243 |
+
return $set->getAttributeSetName();
|
244 |
+
}
|
245 |
+
return '';
|
246 |
+
}
|
247 |
+
|
248 |
+
public function getIsConfigured()
|
249 |
+
{
|
250 |
+
if ($this->getProduct()->isConfigurable()
|
251 |
+
&& !($superAttributes = $this->getProduct()->getTypeInstance(true)->getUsedProductAttributeIds($this->getProduct()))) {
|
252 |
+
$superAttributes = false;
|
253 |
+
}
|
254 |
+
|
255 |
+
return !$this->getProduct()->isConfigurable() || $superAttributes !== false;
|
256 |
+
}
|
257 |
+
|
258 |
+
public function getSelectedTabId()
|
259 |
+
{
|
260 |
+
return addslashes(htmlspecialchars($this->getRequest()->getParam('tab')));
|
261 |
+
}
|
262 |
+
}
|
app/code/local/Demac/Adminhtml/etc/config.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Demac_Adminhtml>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Demac_Adminhtml>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<adminhtml>
|
11 |
+
<rewrite>
|
12 |
+
<catalog_product_edit>Demac_Adminhtml_Block_Catalog_Product_Edit</catalog_product_edit>
|
13 |
+
</rewrite>
|
14 |
+
</adminhtml>
|
15 |
+
</blocks>
|
16 |
+
</global>
|
17 |
+
</config>
|
app/code/local/Demac/All/Block/Notification/Window.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Demac Media Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
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://ecommerce.aheadworks.com/LICENSE-M1.txt
|
11 |
+
*
|
12 |
+
* @category Demac
|
13 |
+
* @package Demac_All
|
14 |
+
* @copyright Copyright (c) 20010-2011 aheadWorks Co. (http://www.demacmedia.com)
|
15 |
+
* @license http://www.demacmedia.com/LICENSE.txt
|
16 |
+
*/
|
17 |
+
|
18 |
+
class Demac_All_Block_Notification_Window extends Mage_Adminhtml_Block_Notification_Window{
|
19 |
+
protected function _construct(){
|
20 |
+
parent::_construct();
|
21 |
+
|
22 |
+
if(!Mage::getStoreConfig('demacall/install/run')){
|
23 |
+
$c = Mage::getModel('core/config_data');
|
24 |
+
$c
|
25 |
+
->setScope('default')
|
26 |
+
->setPath('demacall/install/run')
|
27 |
+
->setValue(time())
|
28 |
+
->save();
|
29 |
+
$this->setHeaderText($this->__("Demac Media Notifications Setup"));
|
30 |
+
$this->setIsFirstRun(1);
|
31 |
+
$this->setIsHtml(1);
|
32 |
+
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
protected function _toHtml(){
|
37 |
+
if($this->getIsHtml()){
|
38 |
+
$this->setTemplate('demac_all/notification/window.phtml');
|
39 |
+
}
|
40 |
+
return parent::_toHtml();
|
41 |
+
}
|
42 |
+
public function presetFirstSetup(){
|
43 |
+
|
44 |
+
}
|
45 |
+
public function getNoticeMessageText(){
|
46 |
+
if($this->getIsFirstRun()){
|
47 |
+
$child = $this->getLayout()->createBlock('core/template')->setTemplate('demac_all/notification/window/first-run.phtml')->toHtml();
|
48 |
+
return $child;
|
49 |
+
}else{
|
50 |
+
return $this->getData('notice_message_text');
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
}
|
app/code/local/Demac/All/Block/System/Config/Form/Fieldset/Demacall/Extensions.php
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Demac Media Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
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://ecommerce.aheadworks.com/LICENSE-M1.txt
|
11 |
+
*
|
12 |
+
* @category Demac
|
13 |
+
* @package Demac_All
|
14 |
+
* @copyright Copyright (c) 20010-2011 aheadWorks Co. (http://www.demacmedia.com)
|
15 |
+
* @license http://www.demacmedia.com/LICENSE.txt
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class Demac_All_Block_System_Config_Form_Fieldset_Demacall_Extensions extends Mage_Adminhtml_Block_System_Config_Form_Fieldset{
|
20 |
+
|
21 |
+
protected $_dummyElement;
|
22 |
+
protected $_fieldRenderer;
|
23 |
+
protected $_values;
|
24 |
+
|
25 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
26 |
+
{
|
27 |
+
$html = $this->_getHeaderHtml($element);
|
28 |
+
$modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
|
29 |
+
sort($modules);
|
30 |
+
|
31 |
+
foreach ($modules as $moduleName) {
|
32 |
+
if (strstr($moduleName,'Demac_') === false) {
|
33 |
+
continue;
|
34 |
+
}
|
35 |
+
|
36 |
+
if($moduleName == 'Demac_Core' || $moduleName == 'Demac_All'){
|
37 |
+
continue;
|
38 |
+
}
|
39 |
+
|
40 |
+
$html.= $this->_getFieldHtml($element, $moduleName);
|
41 |
+
}
|
42 |
+
$html .= $this->_getFooterHtml($element);
|
43 |
+
|
44 |
+
return $html;
|
45 |
+
}
|
46 |
+
|
47 |
+
protected function _getDummyElement()
|
48 |
+
{
|
49 |
+
if (empty($this->_dummyElement)) {
|
50 |
+
$this->_dummyElement = new Varien_Object(array('show_in_default'=>1, 'show_in_website'=>1));
|
51 |
+
}
|
52 |
+
return $this->_dummyElement;
|
53 |
+
}
|
54 |
+
|
55 |
+
protected function _getFieldRenderer()
|
56 |
+
{
|
57 |
+
if (empty($this->_fieldRenderer)) {
|
58 |
+
$this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
|
59 |
+
}
|
60 |
+
return $this->_fieldRenderer;
|
61 |
+
}
|
62 |
+
|
63 |
+
protected function _getFieldHtml($fieldset, $moduleName)
|
64 |
+
{
|
65 |
+
$configData = $this->getConfigData();
|
66 |
+
|
67 |
+
try{
|
68 |
+
if($platform = Mage::getConfig()->getNode("modules/$moduleName/platform")){
|
69 |
+
$platform = strtolower($platform);
|
70 |
+
$ignore_platform = false;
|
71 |
+
}else{
|
72 |
+
throw new Exception();
|
73 |
+
}
|
74 |
+
}catch(Exception $e){
|
75 |
+
$platform="ce";
|
76 |
+
$ignore_platform = true;
|
77 |
+
}
|
78 |
+
|
79 |
+
|
80 |
+
$path = 'advanced/modules_disable_output/'.$moduleName; //TODO: move as property of form
|
81 |
+
$data = isset($configData[$path]) ? $configData[$path] : array();
|
82 |
+
|
83 |
+
$e = $this->_getDummyElement();
|
84 |
+
|
85 |
+
$moduleKey = substr($moduleName, strpos($moduleName,'_')+1);
|
86 |
+
$ver = (Mage::getConfig()->getModuleConfig($moduleName)->version);
|
87 |
+
$id = $moduleName;
|
88 |
+
|
89 |
+
$warning = "";
|
90 |
+
if(!$ignore_platform){
|
91 |
+
$magentoVersion = $this->_convertVersion(Mage::getVersion());
|
92 |
+
|
93 |
+
if($magentoVersion >= $this->_convertVersion(demac_all_Helper_Config::ENTERPRISE_VERSION)){
|
94 |
+
// EE
|
95 |
+
if($platform == 'ce' || $platform=='pe'){
|
96 |
+
$warning = $this->__("This extension can't be run under Magento Enterprise platform. You need Enterprise version of the extension.");
|
97 |
+
}
|
98 |
+
|
99 |
+
}elseif($magentoVersion >= $this->_convertVersion(demac_all_Helper_Config::PROFESSIONAL_EDITION)){
|
100 |
+
// PE
|
101 |
+
if($platform == 'ce' ){
|
102 |
+
$warning = $this->__("This extension can't be run under Magento Professional platform. You need Professional version of the extension.");
|
103 |
+
}
|
104 |
+
}else{
|
105 |
+
// CE
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
|
110 |
+
|
111 |
+
|
112 |
+
$hasUpdate = false;
|
113 |
+
if($displayNames = Mage::app()->loadCache('demac_all_extensions_feed')){
|
114 |
+
if($displayNames = unserialize($displayNames)){
|
115 |
+
if(isset($displayNames[$moduleName])){
|
116 |
+
$url = @$displayNames[$moduleName]['url'];
|
117 |
+
$name = @$displayNames[$moduleName]['display_name'];
|
118 |
+
$version = @$displayNames[$moduleName]['version'];
|
119 |
+
|
120 |
+
$moduleName = '<a href="'.$url.'" target="_blank" title="'.$name.'">'.$name."</a>";
|
121 |
+
|
122 |
+
if($warning){
|
123 |
+
$update = '<a target="_blank"><img src="'.$this->getSkinUrl('demac_all/images/bad.gif').'" title="'.$this->__("Wrong Extension Platform").'"/></a>';
|
124 |
+
$moduleName ="$update $moduleName";
|
125 |
+
}else{
|
126 |
+
|
127 |
+
if($this->_convertVersion($ver) < $this->_convertVersion($version)){
|
128 |
+
$update = '<a href="'.$url.'" target="_blank"><img src="'.$this->getSkinUrl('demac_all/images/update.gif').'" title="'.$this->__("Update available").'"/></a>';
|
129 |
+
$hasUpdate = 1;
|
130 |
+
$moduleName ="$update $moduleName";
|
131 |
+
}
|
132 |
+
}
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
if(!$hasUpdate && !$warning){
|
138 |
+
$update = '<a target="_blank"><img src="'.$this->getSkinUrl('demac_all/images/ok.gif').'" title="'.$this->__("Installed").'"/></a>';
|
139 |
+
$moduleName ="$update $moduleName";
|
140 |
+
}elseif($warning && (!@$displayNames || !@$name)){
|
141 |
+
$update = '<a target="_blank"><img src="'.$this->getSkinUrl('demac_all/images/bad.gif').'" title="'.$this->__("Wrong Extension Platform").'"/></a>';
|
142 |
+
$moduleName ="$update $moduleName";
|
143 |
+
}
|
144 |
+
|
145 |
+
|
146 |
+
|
147 |
+
if($ver){
|
148 |
+
$field = $fieldset->addField($id, 'label',
|
149 |
+
array(
|
150 |
+
'name' => 'ssssss',
|
151 |
+
'label' => $moduleName,
|
152 |
+
'value' => $warning ? $warning : $ver,
|
153 |
+
|
154 |
+
))->setRenderer($this->_getFieldRenderer());
|
155 |
+
return $field->toHtml();
|
156 |
+
}
|
157 |
+
return '';
|
158 |
+
|
159 |
+
}
|
160 |
+
|
161 |
+
|
162 |
+
|
163 |
+
protected function _convertVersion($v){
|
164 |
+
$digits = @explode(".", $v);
|
165 |
+
$version = 0;
|
166 |
+
if(is_array($digits)){
|
167 |
+
foreach($digits as $k=>$v){
|
168 |
+
$version += ($v * pow(10, max(0, (3-$k))));
|
169 |
+
}
|
170 |
+
|
171 |
+
}
|
172 |
+
return $version;
|
173 |
+
}
|
174 |
+
}
|
app/code/local/Demac/All/Helper/Config.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Demac Media Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
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://ecommerce.aheadworks.com/LICENSE-M1.txt
|
11 |
+
*
|
12 |
+
* @category Demac
|
13 |
+
* @package Demac_All
|
14 |
+
* @copyright Copyright (c) 20010-2011 aheadWorks Co. (http://www.demacmedia.com)
|
15 |
+
* @license http://www.demacmedia.com/LICENSE.txt
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class Demac_All_Helper_Config extends Mage_Core_Helper_Abstract{
|
20 |
+
/** Extensions feed path */
|
21 |
+
const EXTENSIONS_FEED_URL = 'http://feeds.feedburner.com/DemacMediaMagentoExtensionsUpdates';
|
22 |
+
/** Updates Feed path */
|
23 |
+
const UPDATES_FEED_URL = 'http://feeds.feedburner.com/DemacMediaMagentoExtensionsUpdates';
|
24 |
+
|
25 |
+
const ENTERPRISE_VERSION = '1.7';
|
26 |
+
|
27 |
+
const PROFESSIONAL_EDITION = '1.6';
|
28 |
+
}
|
app/code/local/Demac/All/Helper/Data.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Demac Media Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
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://ecommerce.aheadworks.com/LICENSE-M1.txt
|
11 |
+
*
|
12 |
+
* @category Demac
|
13 |
+
* @package Demac_All
|
14 |
+
* @copyright Copyright (c) 20010-2011 aheadWorks Co. (http://www.demacmedia.com)
|
15 |
+
* @license http://www.demacmedia.com/LICENSE.txt
|
16 |
+
*/
|
17 |
+
|
18 |
+
class Demac_All_Helper_Data extends Mage_Core_Helper_Abstract{
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
|
app/code/local/Demac/All/Model/Feed.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* aheadWorks Co.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
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://ecommerce.aheadworks.com/LICENSE-M1.txt
|
11 |
+
*
|
12 |
+
* @category AW
|
13 |
+
* @package AW_All
|
14 |
+
* @copyright Copyright (c) 2009-2010 aheadWorks Co. (http://www.aheadworks.com)
|
15 |
+
* @license http://ecommerce.aheadworks.com/LICENSE-M1.txt
|
16 |
+
*/
|
17 |
+
|
18 |
+
class Demac_All_Model_Feed extends Mage_AdminNotification_Model_Feed
|
19 |
+
{
|
20 |
+
const XML_USE_HTTPS_PATH = 'demacall/feed/use_https';
|
21 |
+
const XML_FEED_URL_PATH = 'demacall/feed/url';
|
22 |
+
const XML_FREQUENCY_PATH = 'demacall/feed/check_frequency';
|
23 |
+
const XML_FREQUENCY_ENABLE = 'demacall/feed/enabled';
|
24 |
+
const XML_LAST_UPDATE_PATH = 'demacall/feed/last_update';
|
25 |
+
|
26 |
+
|
27 |
+
public static function check(){
|
28 |
+
if(!Mage::getStoreConfig(self::XML_FREQUENCY_ENABLE)){
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
return Mage::getModel('demacall/feed')->checkUpdate();
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getFrequency(){
|
35 |
+
return Mage::getStoreConfig(self::XML_FREQUENCY_PATH) * 30;
|
36 |
+
}
|
37 |
+
|
38 |
+
public function getLastUpdate(){
|
39 |
+
//return 100;
|
40 |
+
return Mage::app()->loadCache('demacall_notifications_lastcheck');
|
41 |
+
}
|
42 |
+
|
43 |
+
public function setLastUpdate()
|
44 |
+
{
|
45 |
+
Mage::app()->saveCache(time(), 'demacall_notifications_lastcheck');
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
public function getFeedUrl(){
|
49 |
+
if (is_null($this->_feedUrl)) {
|
50 |
+
$this->_feedUrl = (Mage::getStoreConfigFlag(self::XML_USE_HTTPS_PATH) ? 'https://' : 'http://')
|
51 |
+
. Mage::getStoreConfig(self::XML_FEED_URL_PATH);
|
52 |
+
}
|
53 |
+
return $this->_feedUrl;
|
54 |
+
}
|
55 |
+
|
56 |
+
public function checkUpdate(){
|
57 |
+
if (($this->getFrequency() + $this->getLastUpdate()) > time()) {
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
|
61 |
+
$feedData = array();
|
62 |
+
|
63 |
+
$feedXml = $this->getFeedData();
|
64 |
+
Mage::log('Feed xml');
|
65 |
+
Mage::log($feedData);
|
66 |
+
if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
|
67 |
+
foreach ($feedXml->channel->item as $item) {
|
68 |
+
$feedData[] = array(
|
69 |
+
'severity' => (int)$item->severity ? (int)$item->severity : 3,
|
70 |
+
'date_added' => $this->getDate((string)$item->pubDate),
|
71 |
+
'title' => (string)$item->title,
|
72 |
+
'description' => (string)$item->description,
|
73 |
+
'url' => (string)$item->link,
|
74 |
+
);
|
75 |
+
}
|
76 |
+
Mage::log('Feed Data');
|
77 |
+
Mage::log($feedData);
|
78 |
+
if ($feedData) {
|
79 |
+
Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
|
80 |
+
}
|
81 |
+
|
82 |
+
}
|
83 |
+
$this->setLastUpdate();
|
84 |
+
|
85 |
+
return $this;
|
86 |
+
}
|
87 |
+
|
88 |
+
}
|
app/code/local/Demac/All/Model/Feed/Abstract.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Demac Media Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
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://ecommerce.aheadworks.com/LICENSE-M1.txt
|
11 |
+
*
|
12 |
+
* @category Demac
|
13 |
+
* @package Demac_All
|
14 |
+
* @copyright Copyright (c) 20010-2011 aheadWorks Co. (http://www.demacmedia.com)
|
15 |
+
* @license http://www.demacmedia.com/LICENSE.txt
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class Demac_All_Model_Feed_Abstract extends Mage_Core_Model_Abstract{
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Retrieve feed data as XML element
|
23 |
+
*
|
24 |
+
* @return SimpleXMLElement
|
25 |
+
*/
|
26 |
+
public function getFeedData()
|
27 |
+
{
|
28 |
+
$curl = new Varien_Http_Adapter_Curl();
|
29 |
+
$curl->setConfig(array(
|
30 |
+
'timeout' => 1
|
31 |
+
));
|
32 |
+
$curl->write(Zend_Http_Client::GET, $this->getFeedUrl(), '1.0');
|
33 |
+
$data = $curl->read();
|
34 |
+
if ($data === false) {
|
35 |
+
return false;
|
36 |
+
}
|
37 |
+
$data = preg_split('/^\r?$/m', $data, 2);
|
38 |
+
$data = trim($data[1]);
|
39 |
+
$curl->close();
|
40 |
+
|
41 |
+
try {
|
42 |
+
$xml = new SimpleXMLElement($data);
|
43 |
+
}
|
44 |
+
catch (Exception $e) {
|
45 |
+
Mage::log($e);
|
46 |
+
return false;
|
47 |
+
}
|
48 |
+
//Mage::log($this->getFeedUrl());
|
49 |
+
//Mage::log($xml);
|
50 |
+
return $xml;
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Retrieve DB date from RSS date
|
56 |
+
*
|
57 |
+
* @param string $rssDate
|
58 |
+
* @return string YYYY-MM-DD YY:HH:SS
|
59 |
+
*/
|
60 |
+
public function getDate($rssDate)
|
61 |
+
{
|
62 |
+
return gmdate('Y-m-d H:i:s', strtotime($rssDate));
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
+
}
|
app/code/local/Demac/All/Model/Feed/Extensions.php
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Demac Media Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
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://ecommerce.aheadworks.com/LICENSE-M1.txt
|
11 |
+
*
|
12 |
+
* @category Demac
|
13 |
+
* @package Demac_All
|
14 |
+
* @copyright Copyright (c) 20010-2011 aheadWorks Co. (http://www.demacmedia.com)
|
15 |
+
* @license http://www.demacmedia.com/LICENSE.txt
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class Demac_All_Model_Feed_Extensions extends Demac_All_Model_Feed_Abstract{
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Retrieve feed url
|
23 |
+
*
|
24 |
+
* @return string
|
25 |
+
*/
|
26 |
+
public function getFeedUrl(){
|
27 |
+
return Demac_All_Helper_Config::EXTENSIONS_FEED_URL;
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Checks feed
|
33 |
+
* @return
|
34 |
+
*/
|
35 |
+
public function check(){
|
36 |
+
if(!(Mage::app()->loadCache('demac_all_extensions_feed')) || (time()-Mage::app()->loadCache('demac_all_extensions_feed_lastcheck')) > Mage::getStoreConfig('demacall/feed/check_frequency')){
|
37 |
+
$this->refresh();
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
public function refresh(){
|
42 |
+
$exts = array();
|
43 |
+
try{
|
44 |
+
$Node = $this->getFeedData();
|
45 |
+
if(!$Node) return false;
|
46 |
+
foreach($Node->children() as $ext){
|
47 |
+
$exts[(string)$ext->name] = array(
|
48 |
+
'display_name' => (string)$ext->display_name,
|
49 |
+
'version' => (string)$ext->version,
|
50 |
+
'url' => (string)$ext->url
|
51 |
+
);
|
52 |
+
}
|
53 |
+
|
54 |
+
Mage::app()->saveCache(serialize($exts), 'demac_all_extensions_feed');
|
55 |
+
Mage::app()->saveCache(time(), 'demac_all_extensions_feed_lastcheck');
|
56 |
+
return true;
|
57 |
+
}catch(Exception $E){
|
58 |
+
return false;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
public function checkExtensions(){
|
63 |
+
$modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
|
64 |
+
sort($modules);
|
65 |
+
$magentoVersion = $this->_convertVersion(Mage::getVersion());
|
66 |
+
|
67 |
+
foreach ($modules as $extensionName) {
|
68 |
+
if (strstr($extensionName,'Demac_') === false) {
|
69 |
+
continue;
|
70 |
+
}
|
71 |
+
if($extensionName == 'Demac_Core' || $extensionName == 'Demac_All'){
|
72 |
+
continue;
|
73 |
+
}
|
74 |
+
// echo $extensionName; die();
|
75 |
+
|
76 |
+
if($platform = $this->getExtensionPlatform($extensionName)){
|
77 |
+
if($magentoVersion >= $this->_convertVersion(Demac_All_Helper_Config::ENTERPRISE_VERSION)){
|
78 |
+
// EE
|
79 |
+
if($platform == 'ce' || $platform=='pe'){
|
80 |
+
$this->disableExtensionOutput($extensionName);
|
81 |
+
}
|
82 |
+
|
83 |
+
}elseif($magentoVersion >= $this->_convertVersion(Demac_All_Helper_Config::PROFESSIONAL_EDITION)){
|
84 |
+
// PE
|
85 |
+
if($platform == 'ce' ){
|
86 |
+
$this->disableExtensionOutput($extensionName);
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}
|
90 |
+
}
|
91 |
+
return $this;
|
92 |
+
}
|
93 |
+
|
94 |
+
public function getExtensionPlatform($extensionName){
|
95 |
+
try{
|
96 |
+
if($platform = Mage::getConfig()->getNode("modules/$extensionName/platform")){
|
97 |
+
$platform = strtolower($platform);
|
98 |
+
return $platform;
|
99 |
+
}else{
|
100 |
+
throw new Exception();
|
101 |
+
}
|
102 |
+
}catch(Exception $e){
|
103 |
+
return false;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
public function disableExtensionOutput($extensionName){
|
109 |
+
$coll = Mage::getModel('core/config_data')->getCollection();
|
110 |
+
$coll->getSelect()->where("path='advanced/modules_disable_output/$extensionName'");
|
111 |
+
$i=0;
|
112 |
+
foreach($coll as $cd){
|
113 |
+
$i++;
|
114 |
+
$cd->setValue(1)->save();
|
115 |
+
}
|
116 |
+
if($i==0){
|
117 |
+
Mage::getModel('core/config_data')
|
118 |
+
->setPath("advanced/modules_disable_output/$extensionName")
|
119 |
+
->setValue(1)
|
120 |
+
->save();
|
121 |
+
}
|
122 |
+
return $this;
|
123 |
+
}
|
124 |
+
|
125 |
+
protected function _convertVersion($v){
|
126 |
+
$digits = @explode(".", $v);
|
127 |
+
$version = 0;
|
128 |
+
if(is_array($digits)){
|
129 |
+
foreach($digits as $k=>$v){
|
130 |
+
$version += ($v * pow(10, max(0, (3-$k))));
|
131 |
+
}
|
132 |
+
|
133 |
+
}
|
134 |
+
return $version;
|
135 |
+
}
|
136 |
+
}
|
app/code/local/Demac/All/Model/Feed/Updates.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Demac Media Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
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://ecommerce.aheadworks.com/LICENSE-M1.txt
|
11 |
+
*
|
12 |
+
* @category Demac
|
13 |
+
* @package Demac_All
|
14 |
+
* @copyright Copyright (c) 20010-2011 aheadWorks Co. (http://www.demacmedia.com)
|
15 |
+
* @license http://www.demacmedia.com/LICENSE.txt
|
16 |
+
*/
|
17 |
+
|
18 |
+
class Demac_All_Model_Feed_Updates extends Demac_All_Model_Feed_Abstract{
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Retrieve feed url
|
22 |
+
*
|
23 |
+
* @return string
|
24 |
+
*/
|
25 |
+
public function getFeedUrl(){
|
26 |
+
return Demac_All_Helper_Config::UPDATES_FEED_URL;
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Checks feed
|
31 |
+
* @return
|
32 |
+
*/
|
33 |
+
public function check(){
|
34 |
+
if((time()-Mage::app()->loadCache('demac_all_updates_feed_lastcheck')) > Mage::getStoreConfig('demacall/feed/check_frequency')){
|
35 |
+
$this->refresh();
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
public function refresh(){
|
40 |
+
$feedData = array();
|
41 |
+
|
42 |
+
try{
|
43 |
+
|
44 |
+
//$Node = $this->getFeedData();
|
45 |
+
//if(!$Node) return false;
|
46 |
+
//foreach($Node->children() as $item){
|
47 |
+
|
48 |
+
//if($this->isInteresting($item)){
|
49 |
+
$feedXml = $this->getFeedData();
|
50 |
+
Mage::log('Feed xml');
|
51 |
+
Mage::log($feedXml);
|
52 |
+
if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
|
53 |
+
foreach ($feedXml->channel->item as $item) {
|
54 |
+
//$date = strtotime((string)$item->date);
|
55 |
+
//if(!Mage::getStoreConfig('demacall/install/run') || (Mage::getStoreConfig('demacall/install/run') < $date)){
|
56 |
+
Mage::log('item');
|
57 |
+
Mage::log($item);
|
58 |
+
$feedData[] = array(
|
59 |
+
'severity' => 3,
|
60 |
+
'date_added' => $this->getDate((string)$item->pubDate),
|
61 |
+
'title' => (string)$item->title,
|
62 |
+
'description' => (string)$item->description,
|
63 |
+
'url' => (string)$item->link,
|
64 |
+
);
|
65 |
+
//}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
Mage::log('Feed Data');
|
69 |
+
Mage::log($feedData);
|
70 |
+
if ($feedData) {
|
71 |
+
Mage::getModel('adminnotification/inbox')->parse(($feedData));
|
72 |
+
}
|
73 |
+
|
74 |
+
Mage::app()->saveCache(time(), 'demac_all_updates_feed_lastcheck');
|
75 |
+
return true;
|
76 |
+
}catch(Exception $E){
|
77 |
+
return false;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
public function isExtensionInstalled($code){
|
83 |
+
$modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
|
84 |
+
|
85 |
+
foreach ($modules as $moduleName) {
|
86 |
+
if($moduleName == $code){
|
87 |
+
return true;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
return false;
|
91 |
+
}
|
92 |
+
|
93 |
+
}
|
app/code/local/Demac/All/Model/Source/Updates/Type.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Demac Media Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
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://ecommerce.aheadworks.com/LICENSE-M1.txt
|
11 |
+
*
|
12 |
+
* @category Demac
|
13 |
+
* @package Demac_All
|
14 |
+
* @copyright Copyright (c) 20010-2011 aheadWorks Co. (http://www.demacmedia.com)
|
15 |
+
* @license http://www.demacmedia.com/LICENSE.txt
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class Demac_All_Model_Source_Updates_Type extends Mage_Eav_Model_Entity_Attribute_Source_Abstract{
|
20 |
+
|
21 |
+
const TYPE_PROMO = 'PROMO';
|
22 |
+
const TYPE_NEW_RELEASE = 'NEW_RELEASE';
|
23 |
+
const TYPE_UPDATE_RELEASE = 'UPDATE_RELEASE';
|
24 |
+
const TYPE_INFO = 'INFO';
|
25 |
+
const TYPE_INSTALLED_UPDATE = 'INSTALLED_UPDATE';
|
26 |
+
|
27 |
+
|
28 |
+
public function toOptionArray(){
|
29 |
+
return array(
|
30 |
+
array('value' => self::TYPE_UPDATE_RELEASE, 'label' => Mage::helper('demacall')->__('Extensions updates')),
|
31 |
+
array('value' => self::TYPE_NEW_RELEASE, 'label' => Mage::helper('demacall')->__('New Releases')),
|
32 |
+
array('value' => self::TYPE_INFO, 'label' => Mage::helper('demacall')->__('Other information'))
|
33 |
+
);
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Retrive all attribute options
|
38 |
+
*
|
39 |
+
* @return array
|
40 |
+
*/
|
41 |
+
public function getAllOptions()
|
42 |
+
{
|
43 |
+
return $this->toOptionArray();
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Returns label for value
|
49 |
+
* @param string $value
|
50 |
+
* @return string
|
51 |
+
*/
|
52 |
+
public function getLabel($value){
|
53 |
+
$options = $this->toOptionArray();
|
54 |
+
foreach($options as $v){
|
55 |
+
if($v['value'] == $value){
|
56 |
+
return $v['label'];
|
57 |
+
}
|
58 |
+
}
|
59 |
+
return '';
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Returns array ready for use by grid
|
64 |
+
* @return array
|
65 |
+
*/
|
66 |
+
public function getGridOptions(){
|
67 |
+
$items = $this->getAllOptions();
|
68 |
+
$out = array();
|
69 |
+
foreach($items as $item){
|
70 |
+
$out[$item['value']] = $item['label'];
|
71 |
+
}
|
72 |
+
return $out;
|
73 |
+
}
|
74 |
+
}
|
app/code/local/Demac/All/etc/adminhtml.xml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<layout>
|
4 |
+
<updates>
|
5 |
+
<demacall module="Demac_All">
|
6 |
+
<file>demac_all.xml</file>
|
7 |
+
</demacall>
|
8 |
+
</updates>
|
9 |
+
</layout>
|
10 |
+
|
11 |
+
<acl>
|
12 |
+
<resources>
|
13 |
+
<all>
|
14 |
+
<title>Allow Everything</title>
|
15 |
+
</all>
|
16 |
+
<admin>
|
17 |
+
<children>
|
18 |
+
<system>
|
19 |
+
<children>
|
20 |
+
<config>
|
21 |
+
<children>
|
22 |
+
<demacall>
|
23 |
+
<title>Demac - All</title>
|
24 |
+
</demacall>
|
25 |
+
</children>
|
26 |
+
</config>
|
27 |
+
</children>
|
28 |
+
</system>
|
29 |
+
</children>
|
30 |
+
</admin>
|
31 |
+
</resources>
|
32 |
+
</acl>
|
33 |
+
<events>
|
34 |
+
<controller_action_predispatch>
|
35 |
+
<observers>
|
36 |
+
<demacall_exts>
|
37 |
+
<type>singleton</type>
|
38 |
+
<class>demacall/feed_extensions</class>
|
39 |
+
<method>check</method>
|
40 |
+
</demacall_exts>
|
41 |
+
<demacall_upds>
|
42 |
+
<type>singleton</type>
|
43 |
+
<class>demacall/feed_updates</class>
|
44 |
+
<method>check</method>
|
45 |
+
</demacall_upds>
|
46 |
+
</observers>
|
47 |
+
</controller_action_predispatch>
|
48 |
+
</events>
|
49 |
+
</config>
|
app/code/local/Demac/All/etc/config.xml
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
|
4 |
+
<config>
|
5 |
+
<modules>
|
6 |
+
<Demac_All>
|
7 |
+
<version>1.0.0</version><platform>ce</platform>
|
8 |
+
</Demac_All>
|
9 |
+
</modules>
|
10 |
+
|
11 |
+
<global>
|
12 |
+
<blocks>
|
13 |
+
<demacall>
|
14 |
+
<class>Demac_All_Block</class>
|
15 |
+
</demacall>
|
16 |
+
<adminhtml>
|
17 |
+
<rewrite>
|
18 |
+
<notification_window>Demac_All_Block_Notification_Window</notification_window>
|
19 |
+
</rewrite>
|
20 |
+
</adminhtml>
|
21 |
+
</blocks>
|
22 |
+
<resources>
|
23 |
+
<demacall_setup>
|
24 |
+
<setup>
|
25 |
+
<module>Demac_All</module>
|
26 |
+
</setup>
|
27 |
+
<connection>
|
28 |
+
<use>core_setup</use>
|
29 |
+
</connection>
|
30 |
+
</demacall_setup>
|
31 |
+
<demacall_write>
|
32 |
+
<connection>
|
33 |
+
<use>core_write</use>
|
34 |
+
</connection>
|
35 |
+
</demacall_write>
|
36 |
+
<demacall_read>
|
37 |
+
<connection>
|
38 |
+
<use>core_read</use>
|
39 |
+
</connection>
|
40 |
+
</demacall_read>
|
41 |
+
</resources>
|
42 |
+
<models>
|
43 |
+
<demacall>
|
44 |
+
<class>Demac_All_Model</class>
|
45 |
+
</demacall>
|
46 |
+
</models>
|
47 |
+
|
48 |
+
<helpers>
|
49 |
+
<demacall>
|
50 |
+
<class>Demac_All_Helper</class>
|
51 |
+
</demacall>
|
52 |
+
</helpers>
|
53 |
+
</global>
|
54 |
+
|
55 |
+
<adminhtml>
|
56 |
+
<layout>
|
57 |
+
<updates>
|
58 |
+
<demacall module="Demac_All">
|
59 |
+
<file>Demac_All.xml</file>
|
60 |
+
</demacall>
|
61 |
+
</updates>
|
62 |
+
</layout>
|
63 |
+
|
64 |
+
<acl>
|
65 |
+
<resources>
|
66 |
+
<all>
|
67 |
+
<title>Allow Everything</title>
|
68 |
+
</all>
|
69 |
+
<admin>
|
70 |
+
<children>
|
71 |
+
<system>
|
72 |
+
<children>
|
73 |
+
<config>
|
74 |
+
<children>
|
75 |
+
<demacall>
|
76 |
+
<title>Demac - All</title>
|
77 |
+
</demacall>
|
78 |
+
</children>
|
79 |
+
</config>
|
80 |
+
</children>
|
81 |
+
</system>
|
82 |
+
</children>
|
83 |
+
</admin>
|
84 |
+
</resources>
|
85 |
+
</acl>
|
86 |
+
<events>
|
87 |
+
<controller_action_predispatch>
|
88 |
+
<observers>
|
89 |
+
<demacall_exts>
|
90 |
+
<type>singleton</type>
|
91 |
+
<class>demacall/feed_extensions</class>
|
92 |
+
<method>check</method>
|
93 |
+
</demacall_exts>
|
94 |
+
<demacall_check>
|
95 |
+
<type>singleton</type>
|
96 |
+
<class>demacall/feed_extensions</class>
|
97 |
+
<method>checkExtensions</method>
|
98 |
+
</demacall_check>
|
99 |
+
<demacall_upds>
|
100 |
+
<type>singleton</type>
|
101 |
+
<class>demacall/feed_updates</class>
|
102 |
+
<method>check</method>
|
103 |
+
</demacall_upds>
|
104 |
+
</observers>
|
105 |
+
</controller_action_predispatch>
|
106 |
+
</events>
|
107 |
+
</adminhtml>
|
108 |
+
<default>
|
109 |
+
<demacall>
|
110 |
+
<feed>
|
111 |
+
<url>ecommerce.aheadworks.com/blog/feed/?tag=feed&community=1</url>
|
112 |
+
<use_https>0</use_https>
|
113 |
+
<check_frequency>86400</check_frequency>
|
114 |
+
<enabled>1</enabled>
|
115 |
+
<interests>INFO,PROMO,UPDATE_RELEASE,NEW_RELEASE,INSTALLED_UPDATE</interests>
|
116 |
+
</feed>
|
117 |
+
</demacall>
|
118 |
+
</default>
|
119 |
+
</config>
|
app/code/local/Demac/All/etc/system.xml
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<demacall translate="label" module="demacall">
|
5 |
+
<label>Demac Media Extensions</label>
|
6 |
+
<sort_order>300</sort_order>
|
7 |
+
</demacall>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<demacall translate="label" module="demacall">
|
11 |
+
<label>Info</label>
|
12 |
+
<tab>demacall</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>99999</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<extensions translate="label">
|
20 |
+
<label>Installed Demac Media Extensions</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<frontend_model>demacall/system_config_form_fieldset_demacall_extensions</frontend_model>
|
23 |
+
<sort_order>2</sort_order>
|
24 |
+
<show_in_default>1</show_in_default>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>1</show_in_store>
|
27 |
+
</extensions>
|
28 |
+
<feed>
|
29 |
+
<label>Notifications</label>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<sort_order>60</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
<fields>
|
36 |
+
<interests translate="label">
|
37 |
+
<label>I'd like to be informed by Demac Media about:</label>
|
38 |
+
<comment></comment>
|
39 |
+
<frontend_type>multiselect</frontend_type>
|
40 |
+
<sort_order>100</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
<can_be_empty>1</can_be_empty>
|
45 |
+
<source_model>demacall/source_updates_type</source_model>
|
46 |
+
</interests>
|
47 |
+
|
48 |
+
</fields>
|
49 |
+
</feed>
|
50 |
+
</groups>
|
51 |
+
</demacall>
|
52 |
+
</sections>
|
53 |
+
</config>
|
app/design/adminhtml/default/default/template/demac/catalog/product/edit.phtml
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
/**
|
29 |
+
* Template for Mage_Adminhtml_Block_Catalog_Product_Edit
|
30 |
+
*/
|
31 |
+
?>
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
<div class="content-header">
|
36 |
+
<h3 class="icon-head head-products"><?php echo $this->getHeader() ?></h3>
|
37 |
+
<p class="content-buttons form-buttons"><?php echo $this->getBackButtonHtml() ?>
|
38 |
+
<?php echo $this->getCancelButtonHtml() ?>
|
39 |
+
<?php if($this->getProductId()): ?>
|
40 |
+
<?php echo $this->getPreviewButtonHtml() ?>
|
41 |
+
<?php echo $this->getDeleteButtonHtml() ?>
|
42 |
+
<?php if($this->getProductSetId() && $this->getIsConfigured()): ?>
|
43 |
+
<?php echo $this->getDuplicateButtonHtml() ?>
|
44 |
+
<?php endif; ?>
|
45 |
+
<?php endif; ?>
|
46 |
+
<?php if($this->getProductSetId() && $this->getIsConfigured()): ?>
|
47 |
+
<?php echo $this->getSaveButtonHtml() ?>
|
48 |
+
<?php echo $this->getSaveAndEditButtonHtml() ?>
|
49 |
+
<?php endif; ?>
|
50 |
+
</p>
|
51 |
+
</div>
|
52 |
+
<form action="<?php echo $this->getSaveUrl() ?>" method="post" id="product_edit_form" enctype="multipart/form-data">
|
53 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
54 |
+
<div style="display:none"></div>
|
55 |
+
</form>
|
56 |
+
<script type="text/javascript">
|
57 |
+
//<![CDATA[
|
58 |
+
var productTemplateSyntax = /(^|.|\r|\n)({{(\w+)}})/;
|
59 |
+
var productForm = new varienForm('product_edit_form', '<?php echo $this->getValidationUrl() ?>');
|
60 |
+
productForm._processValidationResult = function(transport) {
|
61 |
+
var response = transport.responseText.evalJSON();
|
62 |
+
if (response.error){
|
63 |
+
if (response.attribute && $(response.attribute)) {
|
64 |
+
$(response.attribute).setHasError(true, productForm);
|
65 |
+
Validation.ajaxError($(response.attribute), response.message);
|
66 |
+
if (!Prototype.Browser.IE){
|
67 |
+
$(response.attribute).focus();
|
68 |
+
}
|
69 |
+
}
|
70 |
+
else if ($('messages')) {
|
71 |
+
$('messages').innerHTML = '<ul class="messages"><li class="error-msg"><ul><li>' + response.message + '</li></ul></li></ul>';
|
72 |
+
}
|
73 |
+
}
|
74 |
+
else{
|
75 |
+
productForm._submit();
|
76 |
+
}
|
77 |
+
};
|
78 |
+
function saveAndContinueEdit(urlTemplate) {
|
79 |
+
var template = new Template(urlTemplate, productTemplateSyntax);
|
80 |
+
var url = template.evaluate({tab_id:product_info_tabsJsTabs.activeTab.id});
|
81 |
+
productForm.submit(url);
|
82 |
+
}
|
83 |
+
function setSettings(urlTemplate, setElement, typeElement) {
|
84 |
+
var template = new Template(urlTemplate, productTemplateSyntax);
|
85 |
+
setLocation(template.evaluate({attribute_set:$F(setElement),type:$F(typeElement)}));
|
86 |
+
}
|
87 |
+
|
88 |
+
function setSuperSettings(urlTemplate, attributesClass, validateField) {
|
89 |
+
var attributesFields = $$('.' + attributesClass);
|
90 |
+
var attributes = Form.serializeElements(attributesFields, true).attribute;
|
91 |
+
if(typeof attributes == 'string') {
|
92 |
+
attributes = [attributes];
|
93 |
+
}
|
94 |
+
|
95 |
+
if(!attributes) {
|
96 |
+
$(validateField).value = 'no-attributes';
|
97 |
+
} else {
|
98 |
+
$(validateField).value = 'has-attributes';
|
99 |
+
}
|
100 |
+
|
101 |
+
if (productForm.validator.validate()) {
|
102 |
+
var template = new Template(urlTemplate, productTemplateSyntax);
|
103 |
+
var url = template.evaluate({
|
104 |
+
attributes: encode_base64(attributes.join(',')).replace(new RegExp('/','g'),'%2F').replace(new RegExp('=','g'),'%3D')
|
105 |
+
});
|
106 |
+
setLocation(url);
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
function checkMaxLength(Object, MaxLen)
|
111 |
+
{
|
112 |
+
if (Object.value.length > MaxLen-1) {
|
113 |
+
Object.value = Object.value.substr(0, MaxLen);
|
114 |
+
}
|
115 |
+
return 1;
|
116 |
+
}
|
117 |
+
|
118 |
+
Event.observe(window, 'load', function() {
|
119 |
+
var objName = '<?php echo $this->getSelectedTabId() ?>';
|
120 |
+
if (objName) {
|
121 |
+
obj = $(objName);
|
122 |
+
//IE fix (bubbling event model)
|
123 |
+
product_info_tabsJsTabs.setSkipDisplayFirstTab();
|
124 |
+
product_info_tabsJsTabs.showTabContent(obj);
|
125 |
+
}
|
126 |
+
Product.AttributesBridge.setTabsObject(product_info_tabsJsTabs);
|
127 |
+
});
|
128 |
+
|
129 |
+
Validation.addAllThese([
|
130 |
+
['validate-super-product-attributes', '<?php echo Mage::helper('catalog')->__('Please select one or more attributes.') ?>', function(v) {
|
131 |
+
return (v != "no-attributes");
|
132 |
+
}]]);
|
133 |
+
//]]>
|
134 |
+
</script>
|
app/design/adminhtml/default/default/template/demac_all/notification/window.phtml
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Demac Media Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
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://ecommerce.aheadworks.com/LICENSE-M1.txt
|
11 |
+
*
|
12 |
+
* @category Demac
|
13 |
+
* @package Demac_All
|
14 |
+
* @copyright Copyright (c) 20010-2011 aheadWorks Co. (http://www.demacmedia.com)
|
15 |
+
* @license http://www.demacmedia.com/LICENSE.txt
|
16 |
+
*/
|
17 |
+
|
18 |
+
?>
|
19 |
+
<div id="message-popup-window-mask" style="display:none;"></div>
|
20 |
+
|
21 |
+
<div style="position:relative;margin-left:-390px;">
|
22 |
+
<div id="demac_notif" class="notification" style="display:none;">
|
23 |
+
<div class="head">
|
24 |
+
<h3><?php echo $this->getHeaderText();?></h3>
|
25 |
+
<button type="button" class="close" onclick="closeMessagePopupWindow()"><span ><?php echo $this->getCloseText(); ?></span></button>
|
26 |
+
</div>
|
27 |
+
<div class="content">
|
28 |
+
<?php echo $this->getNoticeMessageText(); ?>
|
29 |
+
</div>
|
30 |
+
</div>
|
31 |
+
</div>
|
32 |
+
<script>
|
33 |
+
function showAwNotificator(){
|
34 |
+
openMessagePopupWindow();
|
35 |
+
Effect.Appear('demac_notif', { duration: 1.0 });
|
36 |
+
}
|
37 |
+
Event.observe(window, 'load', showAwNotificator);
|
38 |
+
|
39 |
+
|
40 |
+
function openMessagePopupWindow(){
|
41 |
+
var height = $('html-body').getHeight();
|
42 |
+
$('message-popup-window-mask').setStyle({'height':height+'px'});
|
43 |
+
toggleSelectsUnderBlock($('message-popup-window-mask'), false);
|
44 |
+
Element.show('message-popup-window-mask');
|
45 |
+
}
|
46 |
+
|
47 |
+
function closeMessagePopupWindow()
|
48 |
+
{
|
49 |
+
toggleSelectsUnderBlock($('message-popup-window-mask'), true);
|
50 |
+
Effect.Fade('demac_notif', { duration: 0.5 });
|
51 |
+
Element.hide('message-popup-window-mask');
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
function saveCloseMessagePopupWindow()
|
56 |
+
{
|
57 |
+
$('aw-save-button-content').innerHTML = '<?php echo $this->__("Saving, please wait...")?>';
|
58 |
+
$('aw-save-button').addClassName('disabled');
|
59 |
+
$('aw_firstrun').request({
|
60 |
+
onComplete: function(){
|
61 |
+
toggleSelectsUnderBlock($('message-popup-window-mask'), true);
|
62 |
+
Effect.Fade('demac_notif', { duration: 0.5 });
|
63 |
+
Element.hide('message-popup-window-mask');
|
64 |
+
}
|
65 |
+
})
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
</script>
|
70 |
+
|
71 |
+
|
72 |
+
<?php /*
|
73 |
+
|
74 |
+
|
75 |
+
*/?>
|
app/design/adminhtml/default/default/template/demac_all/notification/window/first-run.phtml
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Demac Media Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
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://ecommerce.aheadworks.com/LICENSE-M1.txt
|
11 |
+
*
|
12 |
+
* @category Demac
|
13 |
+
* @package Demac_All
|
14 |
+
* @copyright Copyright (c) 20010-2011 aheadWorks Co. (http://www.demacmedia.com)
|
15 |
+
* @license http://www.demacmedia.com/LICENSE.txt
|
16 |
+
*/
|
17 |
+
|
18 |
+
?>
|
19 |
+
<form method="post" action="<?php echo $this->getUrl('adminhtml/system_config/save', array('section'=>'demacall'))?>" id="demac_firstrun">
|
20 |
+
<table class="form-list" cellspacing="0">
|
21 |
+
<colgroup class="label"/>
|
22 |
+
<colgroup class="value"/>
|
23 |
+
<tbody>
|
24 |
+
|
25 |
+
<tr>
|
26 |
+
<td class="label">
|
27 |
+
<label for="general_locale_timezone"><?php echo $this->__('I wish to be informed about')?>:</label>
|
28 |
+
</td>
|
29 |
+
<td class="value">
|
30 |
+
|
31 |
+
|
32 |
+
<select name="groups[feed][fields][interests][value][]" style="width:214px" size="6" multiple="multiple" id="interests">
|
33 |
+
<?php foreach(Mage::getModel('demacall/source_updates_type')->getGridOptions() as $k=>$v):?>
|
34 |
+
<option selected="selected" value="<?php echo $k?>"><?php echo $this->__($v)?></option>
|
35 |
+
<?php endforeach;?>
|
36 |
+
</select><br/>
|
37 |
+
<a href="#" onclick="$$($('interests').options).each(function(el){el.selected=1});return false;"><?php echo $this->__("Select all")?></a>
|
38 |
+
/
|
39 |
+
<a href="#" onclick="$('interests').selectedIndex = -1;return false;"><?php echo $this->__("Deselect all")?></a>
|
40 |
+
</td>
|
41 |
+
</tr>
|
42 |
+
<tr>
|
43 |
+
<td class="label"></td>
|
44 |
+
<td class="value">
|
45 |
+
<button id="demac-save-button" class="scalable save" style="" onclick="saveCloseMessagePopupWindow()" type="button">
|
46 |
+
<span id="demac-save-button-content"> <?php echo $this->__('Save & Close')?></span>
|
47 |
+
</button>
|
48 |
+
</td>
|
49 |
+
</tr>
|
50 |
+
<tr>
|
51 |
+
<td colspan="2" align="right">
|
52 |
+
<div style="width:365px"><small><?php echo $this->__("This message appears only once. At any time you can change these preferences
|
53 |
+
from System > Configuration > Demac Media extensions > Info. <br/><a href=\"%s\">Visit it now</a>", $this->getUrl('adminhtml/system_config/edit', array('section'=>'demacall')))?></small>
|
54 |
+
</div>
|
55 |
+
</td>
|
56 |
+
</tr>
|
57 |
+
</tbody>
|
58 |
+
</table>
|
59 |
+
</form>
|
app/etc/modules/Demac_Adminhtml.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Demac_Adminhtml>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Demac_Adminhtml>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/Demac_all.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Demac_All>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Demac_All>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Simple_Product_Preview</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>If you like Wordpress' "Preview Post" button, then this extension is for you.</summary>
|
10 |
+
<description>This is an extension of convenience. It adds a button to the product edit interface in the backend of Magento so that you can quickly open a product on the front end of your store. Really nice if you are tired of searching for products on the front end while you are editing them.</description>
|
11 |
+
<notes>If you like Wordpress' "Preview Post" button, then this extension is for you.</notes>
|
12 |
+
<authors><author><name>Demac Media</name><user>demacmedia</user><email>support@demacmedia.com</email></author></authors>
|
13 |
+
<date>2011-05-01</date>
|
14 |
+
<time>15:25:38</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Demac_Adminhtml.xml" hash="b3eda708c1ba49ccc0550e8018463b32"/><file name="Demac_all.xml" hash="c2edd8bcc7339d392e443201d93924a2"/></dir></target><target name="magelocal"><dir name="Demac"><dir name="Adminhtml"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="Edit.php" hash="3a899410c7ae28887a4788d553be8a35"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="9fc93194d36959f2cf83ff0cab0555bc"/></dir></dir><dir name="All"><dir name="Block"><dir name="Notification"><file name="Window.php" hash="91cf969480289e345c097f2f2a6fbcaa"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><dir name="Demacall"><file name="Extensions.php" hash="2efe8c461785763c5b6122414e67bd31"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Config.php" hash="94d522c40d67a2929e790ded5673053e"/><file name="Data.php" hash="efd712db99f7f32e8604db84403ce6c9"/></dir><dir name="Model"><dir name="Feed"><file name="Abstract.php" hash="2dbd2497cb307e315146c83e872888ce"/><file name="Extensions.php" hash="a9354e637dec1a6242be13215953d7cc"/><file name="Updates.php" hash="65129954bd8573a135b9638f1f97c7af"/></dir><file name="Feed.php" hash="bdc8872860b91042fe749574f0808f31"/><dir name="Source"><dir name="Updates"><file name="Type.php" hash="8f205a098d78c3a31058f898b685c115"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="210d1c12d354e92141f90779202df5f8"/><file name="config.xml" hash="a75bfd89a84233358d7f969b05dd4a34"/><file name="system.xml" hash="acffd64488ba9e8e74c143a6d7e31767"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="demac_all"><dir name="notification"><dir name="window"><file name="first-run.phtml" hash="361711c60c4598df1057af9c6370d38f"/></dir><file name="window.phtml" hash="366c85ce977892fbeb0ef48174997dff"/></dir></dir><dir name="demac"><dir name="catalog"><dir name="product"><file name="edit.phtml" hash="ba5336b11c6367f5b7edf2cb0fb15526"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>5.3.0</max></php></required></dependencies>
|
18 |
+
</package>
|