vian_pictograms_free - Version 2.1.3

Version Notes

Added Uninstall support

Download this release

Release Info

Developer Magento Core Team
Extension vian_pictograms_free
Version 2.1.3
Comparing to
See all releases


Code changes from version 2.1.2 to 2.1.3

app/code/local/VIAN/Pictograms/Block/Button.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class VIAN_Pictograms_Block_Button extends Mage_Adminhtml_Block_System_Config_Form_Field {
3
+
4
+ /**
5
+ * @see Mage_Adminhtml_Block_System_Config_Form_Field::_getElementHtml()
6
+ */
7
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
8
+ {
9
+ $this->setElement($element);
10
+ $url = Mage::helper('adminhtml')->getUrl('pictograms/adminhtml_pictograms/uninstall');
11
+
12
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
13
+ ->setType('button')
14
+ ->setClass('scalable')
15
+ ->setLabel(Mage::helper('pictograms')->__('Uninstall'))
16
+ ->setOnClick("setLocation('$url')")
17
+ ->toHtml();
18
+
19
+ return $html;
20
+ }
21
+ }
app/code/local/VIAN/Pictograms/Helper/Uninstall.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Database & Filesystem uninstall methods
4
+ *
5
+ */
6
+ class VIAN_Pictograms_Helper_Uninstall extends Mage_Core_Helper_Abstract {
7
+
8
+ public function processUninstallDB()
9
+ {
10
+
11
+ try {
12
+ // eav_attribute
13
+ $attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product','pictograms');
14
+ if ($attributeId = $attributeModel->getId()){
15
+ $attributeModel->delete();
16
+ }
17
+
18
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
19
+
20
+ // eav_attribute_group
21
+ $condition = array($connection->quoteInto('attribute_group_name=?','Pictograms'));
22
+ $connection->delete('eav_attribute_group', $condition);
23
+
24
+ // core_resource
25
+ $condition = array($connection->quoteInto('code=?','pictograms_setup'));
26
+ $connection->delete('core_resource', $condition);
27
+
28
+ } catch (Exception $e) {
29
+ return FALSE;
30
+ }
31
+
32
+ return TRUE;
33
+ }
34
+
35
+ public function processUninstallPackage()
36
+ {
37
+
38
+ $packageFile = FALSE;
39
+
40
+ // Find the package
41
+ $downloaderFiles = glob(getcwd() . DS . 'var' . DS . 'package' . DS . '*.xml');
42
+
43
+ foreach ($downloaderFiles as $v) {
44
+ $name = explode(DIRECTORY_SEPARATOR, $v);
45
+ $checkName = substr($name[count($name) - 1], 0, -4);
46
+ if (strpos($checkName,'vian_pictograms_free') !== FALSE){
47
+ $packageFile = 'var' . DS . 'package' . DS . $name[count($name) - 1];
48
+ }
49
+ }
50
+
51
+ if ($packageFile){
52
+ $package = new Mage_Connect_Package($packageFile);
53
+ $contents = $package->getContents();
54
+
55
+ $targetPath = rtrim(getcwd(), "\\/");
56
+ foreach($contents as $file) {
57
+ $fileName = basename($file);
58
+ $filePath = dirname($file);
59
+ $dest = $targetPath . DIRECTORY_SEPARATOR . $filePath . DIRECTORY_SEPARATOR . $fileName;
60
+ if(@file_exists($dest)) {
61
+
62
+ @unlink($dest);
63
+ $this->removeEmptyDirectory(dirname($dest));
64
+ }
65
+ }
66
+
67
+ $destDir = $targetPath . DS . 'var' . DS . 'package';
68
+ $destFile = $package->getReleaseFilename() . '.xml';
69
+ @unlink($destDir . DS . $destFile);
70
+
71
+ /* delete .cfg files */
72
+ $destDir = $targetPath . DS . 'downloader';
73
+ @unlink($destDir . DS . 'cache.cfg');
74
+ @unlink($destDir . DS . 'connect.cfg');
75
+ }
76
+
77
+ return $packageFile;
78
+ }
79
+
80
+ /**
81
+ * Remove empty directories recursively up
82
+ * @param string $dir
83
+ * @param Mage_Connect_Ftp $ftp
84
+ */
85
+ protected function removeEmptyDirectory($dir, $ftp = null)
86
+ {
87
+ if ($ftp) {
88
+ if (count($ftp->nlist($dir))==0) {
89
+ if ($ftp->rmdir($dir)) {
90
+ $this->removeEmptyDirectory(dirname($dir), $ftp);
91
+ }
92
+ }
93
+ } else {
94
+ if (@rmdir($dir)) {
95
+ $this->removeEmptyDirectory(dirname($dir), $ftp);
96
+ }
97
+ }
98
+ }
99
+
100
+ }
app/code/local/VIAN/Pictograms/controllers/Adminhtml/PictogramsController.php CHANGED
@@ -187,6 +187,31 @@ class VIAN_Pictograms_Adminhtml_PictogramsController extends Mage_Adminhtml_Cont
187
  $response->setBody($content);
188
  $response->sendResponse();
189
  die;
190
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
 
192
  }
187
  $response->setBody($content);
188
  $response->sendResponse();
189
  die;
190
+ }
191
+
192
+ public function uninstallAction(){
193
+
194
+ $session = Mage::getSingleton('adminhtml/session');
195
+ /* Uninstall Filesystem */
196
+ if (! Mage::helper('pictograms/uninstall')->processUninstallPackage()){
197
+ $session->addError($this->__('Problems while deleting VIAN_Pictograms filesystem content'));
198
+ Mage::app()->getFrontController()->getResponse()->setRedirect($this->getUrl('adminhtml/system_config'));
199
+ return;
200
+ }
201
+ /* Uninstall DB */
202
+ if (! Mage::helper('pictograms/uninstall')->processUninstallDB()){
203
+ $session->addError($this->__('Problems while deleting VIAN_Pictograms database content'));
204
+ } else {
205
+ Mage::app()->cleanCache();
206
+ // reinit configuration
207
+ Mage::getConfig()->reinit();
208
+ Mage::app()->reinitStores();
209
+
210
+ $session = Mage::getSingleton('adminhtml/session');
211
+ $session->addSuccess($this->__('Module VIAN_Pictograms was successfully deleted'));
212
+ }
213
+ Mage::app()->getFrontController()->getResponse()->setRedirect($this->getUrl('adminhtml/system_config'));
214
+ return;
215
+ }
216
 
217
  }
app/code/local/VIAN/Pictograms/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <VIAN_Pictograms>
5
- <version>2.1.2</version>
6
  </VIAN_Pictograms>
7
  </modules>
8
  <frontend>
@@ -83,13 +83,13 @@
83
  </updates>
84
  </layout>
85
  </adminhtml>
86
- <default>
87
- <pictograms>
88
- <frontend_configuration>
89
- <display_in_list>1</display_in_list>
90
- </frontend_configuration>
91
- </pictograms>
92
- </default>
93
  <global>
94
  <!--
95
  <events>
2
  <config>
3
  <modules>
4
  <VIAN_Pictograms>
5
+ <version>2.1.3</version>
6
  </VIAN_Pictograms>
7
  </modules>
8
  <frontend>
83
  </updates>
84
  </layout>
85
  </adminhtml>
86
+ <default>
87
+ <pictograms>
88
+ <configuration>
89
+ <display_in_list>1</display_in_list>
90
+ </configuration>
91
+ </pictograms>
92
+ </default>
93
  <global>
94
  <!--
95
  <events>
app/code/local/VIAN/Pictograms/etc/system.xml CHANGED
@@ -7,8 +7,8 @@
7
  </VIAN>
8
  </tabs>
9
  <sections>
10
- <pictograms translate="label" module="pictograms">
11
- <class>separator-top</class>
12
  <label>Pictograms</label>
13
  <tab>VIAN</tab>
14
  <sort_order>100</sort_order>
@@ -16,25 +16,35 @@
16
  <show_in_website>1</show_in_website>
17
  <show_in_store>1</show_in_store>
18
  <groups>
19
- <frontend_configuration translate="label">
20
- <label>Frontend configuration</label>
21
  <frontend_type>text</frontend_type>
22
  <sort_order>100</sort_order>
23
  <show_in_default>1</show_in_default>
24
- <show_in_website>1</show_in_website>
25
- <show_in_store>1</show_in_store>
26
  <fields>
27
  <display_in_list translate="label">
28
- <label>Display in Grid/List</label>
29
  <frontend_type>select</frontend_type>
30
  <source_model>adminhtml/system_config_source_yesno</source_model>
31
  <sort_order>100</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
- </display_in_list>
 
 
 
 
 
 
 
 
 
 
36
  </fields>
37
- </frontend_configuration>
38
  </groups>
39
  </pictograms>
40
  </sections>
7
  </VIAN>
8
  </tabs>
9
  <sections>
10
+ <pictograms translate="label" module="pictograms">
11
+ <class>separator-top</class>
12
  <label>Pictograms</label>
13
  <tab>VIAN</tab>
14
  <sort_order>100</sort_order>
16
  <show_in_website>1</show_in_website>
17
  <show_in_store>1</show_in_store>
18
  <groups>
19
+ <configuration translate="label">
20
+ <label>Module configuration</label>
21
  <frontend_type>text</frontend_type>
22
  <sort_order>100</sort_order>
23
  <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
  <fields>
27
  <display_in_list translate="label">
28
+ <label>Frontend: Display in Grid/List</label>
29
  <frontend_type>select</frontend_type>
30
  <source_model>adminhtml/system_config_source_yesno</source_model>
31
  <sort_order>100</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
+ </display_in_list>
36
+ <secure_uninstall translate="label comment">
37
+ <label>Secure Uninstall</label>
38
+ <comment>Please, disable Magento cache before clicking here</comment>
39
+ <frontend_type>button</frontend_type>
40
+ <frontend_model>pictograms/button</frontend_model>
41
+ <sort_order>150</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ </secure_uninstall>
46
  </fields>
47
+ </configuration>
48
  </groups>
49
  </pictograms>
50
  </sections>
app/design/adminhtml/default/default/layout/pictograms.xml CHANGED
@@ -1,10 +1,12 @@
1
  <?xml version="1.0"?>
2
  <layout version="0.1.0">
 
3
  <default>
4
  <reference name="head">
5
  <action method="addCss"><name>vian/css/skin.css</name></action>
6
  </reference>
7
  </default>
 
8
  <pictograms_adminhtml_pictograms_index>
9
  <reference name="content">
10
  <block type="pictograms/adminhtml_pictograms" name="pictograms" />
1
  <?xml version="1.0"?>
2
  <layout version="0.1.0">
3
+ <!--
4
  <default>
5
  <reference name="head">
6
  <action method="addCss"><name>vian/css/skin.css</name></action>
7
  </reference>
8
  </default>
9
+ -->
10
  <pictograms_adminhtml_pictograms_index>
11
  <reference name="content">
12
  <block type="pictograms/adminhtml_pictograms" name="pictograms" />
app/locale/es_ES/VIAN_Pictograms.csv CHANGED
@@ -22,5 +22,9 @@
22
  "Disabled","Deshabilitado"
23
  "Manage Pictograms","Gestionar Pictogramas"
24
  "Delete Image","Eliminar Imagen"
25
- "Frontend configuration","Configuración de Frontend"
26
- "Display in Grid/List","Mostrar en Grid/Listado de productos"
 
 
 
 
22
  "Disabled","Deshabilitado"
23
  "Manage Pictograms","Gestionar Pictogramas"
24
  "Delete Image","Eliminar Imagen"
25
+ "Configuration","Configuración"
26
+ "Module configuration","Configuración del módulo"
27
+ "Frontend: Display in Grid/List","Frontend: Mostrar en Grid/Listado de productos"
28
+ "Secure Uninstall","Desinstalar de manera segura"
29
+ "Uninstall","Desinstalar"
30
+ "Please, disable Magento cache before clicking here","Por favor, deshabilita la cache de Magento antes de hacer click aquí"
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>vian_pictograms_free</name>
4
- <version>2.1.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL-3.0</license>
7
  <channel>community</channel>
@@ -15,11 +15,11 @@
15
  &lt;li&gt;Pictograms can be easily reordered at any time&lt;/li&gt;&#xD;
16
  &lt;li&gt;Pictograms can have up to 2 associated images: standard images are used for product view pages, while small images are used for product listing pages (optional)&lt;/li&gt;&#xD;
17
  &lt;li&gt;The extension&#x2019;s functionality code is 100% Open Source&lt;/li&gt;</description>
18
- <notes>Stable version, compatible with Magento 1.6</notes>
19
  <authors><author><name>viansolutions</name><user>auto-converted</user><email>joan.puche@viansolutions.com</email></author></authors>
20
- <date>2011-12-29</date>
21
- <time>10:34:13</time>
22
- <contents><target name="magelocal"><dir name="VIAN"><dir name="Pictograms"><dir name="Block"><dir name="Adminhtml"><dir name="Pictograms"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="1a0bf7f170a00816bdfc9e01fbaae6a9"/></dir><file name="Form.php" hash="df28ce655944d002a9f03aad48c44037"/><file name="Tabs.php" hash="d483d18d02536d47be4894d5d80842c1"/></dir><file name="Edit.php" hash="df3bae4ece28160b469bc1c5914be853"/><file name="Grid.php" hash="732e7ddcdabe36ea975f16bd30208399"/></dir><file name="Pictograms.php" hash="1edc5fbbc32a33ee8f141eacce372bca"/></dir><dir name="Catalog"><dir name="Product"><file name="List.php" hash="ec58a7a41afd3b2ba9dcc977399a7b29"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Pictogram.php" hash="23814b056cb4284d9c581d2f5129ba23"/></dir></dir><file name="Column.php" hash="710be7b87647b04103bd702f2f09f60e"/></dir></dir><file name="Pictograms.php" hash="3e168c1c954e77ed4bfcbcc336dfd85e"/></dir><dir name="Helper"><file name="Data.php" hash="6d1a03e4d18f29f3adce7389fd619107"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Pictograms"><file name="Collection.php" hash="b175d464ee87c4771a3accc28181bf62"/></dir><file name="Pictograms.php" hash="1a068cf73e27409ed993be2d59f9d1e9"/></dir><dir name="Product"><dir name="Attribute"><dir name="Source"><file name="Unit.php" hash="3f51c4138a924afd28acdbc9604ba0a8"/></dir></dir></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="b0a8b5265e4c1e561624c976af0ed82e"/></dir></dir></dir><dir name="Rewrite"><file name="Action.php" hash="7e6e016228566baf868aadee2c937323"/></dir><file name="Observer.php" hash="0300fa278a9d358d3c4fa28bb78b9f7a"/><file name="Pictograms.php" hash="55dd17eb750676740c95ca2458fa9ff9"/><file name="Status.php" hash="55bb8eb5aeb77d4cc4c524699fce45ac"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PictogramsController.php" hash="6b9dceb61fee8c5be7b9ec4dc187ab9d"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="9c528937b6de1e34b1200af70cdb2aea"/><file name="config.xml" hash="d1267ee207796a5afdb476fcca5bbebd"/><file name="system.xml" hash="ccf1e0b03b3cb9877cb1cfcee7d9921f"/></dir><dir name="sql"><dir name="pictograms_setup"><file name="mysql4-install-2.0.0.php" hash="f6bd4ea418567b02f8e04f7cc216abf6"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="pictograms.xml" hash="9bf24d4be7b30614bf34e0610880cd89"/></dir><dir name="template"><dir name="pictograms"><dir name="catalog"><dir name="product"><dir name="view"><file name="pictograms.phtml" hash="d7833bc062a163ebb3f14fa725e7908e"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="pictograms.xml" hash="6852e31b2f3d5e08d7d2b860627a1798"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VIAN_Pictograms.xml" hash="6b20f96c93bd0c2264d374ce5574c143"/></dir></target><target name="magelocale"><dir name="es_ES"><file name="VIAN_Pictograms.csv" hash="2d760becd8fc4dd456192f9d45409fd6"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="pictograms"><dir name="css"><file name="skin.css" hash="95fbb9389f55be01d1b06c1552d5d26b"/></dir></dir></dir></dir></dir></target></contents>
23
  <compatible/>
24
  <dependencies/>
25
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>vian_pictograms_free</name>
4
+ <version>2.1.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL-3.0</license>
7
  <channel>community</channel>
15
  &lt;li&gt;Pictograms can be easily reordered at any time&lt;/li&gt;&#xD;
16
  &lt;li&gt;Pictograms can have up to 2 associated images: standard images are used for product view pages, while small images are used for product listing pages (optional)&lt;/li&gt;&#xD;
17
  &lt;li&gt;The extension&#x2019;s functionality code is 100% Open Source&lt;/li&gt;</description>
18
+ <notes>Added Uninstall support</notes>
19
  <authors><author><name>viansolutions</name><user>auto-converted</user><email>joan.puche@viansolutions.com</email></author></authors>
20
+ <date>2012-01-24</date>
21
+ <time>10:59:37</time>
22
+ <contents><target name="magelocal"><dir name="VIAN"><dir name="Pictograms"><dir name="Block"><dir name="Adminhtml"><dir name="Pictograms"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="1a0bf7f170a00816bdfc9e01fbaae6a9"/></dir><file name="Form.php" hash="df28ce655944d002a9f03aad48c44037"/><file name="Tabs.php" hash="d483d18d02536d47be4894d5d80842c1"/></dir><file name="Edit.php" hash="df3bae4ece28160b469bc1c5914be853"/><file name="Grid.php" hash="732e7ddcdabe36ea975f16bd30208399"/></dir><file name="Pictograms.php" hash="1edc5fbbc32a33ee8f141eacce372bca"/></dir><dir name="Catalog"><dir name="Product"><file name="List.php" hash="ec58a7a41afd3b2ba9dcc977399a7b29"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Pictogram.php" hash="23814b056cb4284d9c581d2f5129ba23"/></dir></dir><file name="Column.php" hash="710be7b87647b04103bd702f2f09f60e"/></dir></dir><file name="Button.php" hash="c93a07de834bb81ae7d43706d9344a50"/><file name="Pictograms.php" hash="3e168c1c954e77ed4bfcbcc336dfd85e"/></dir><dir name="Helper"><file name="Data.php" hash="6d1a03e4d18f29f3adce7389fd619107"/><file name="Uninstall.php" hash="d5fff0db0597746f0443b22eda36e3bc"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Pictograms"><file name="Collection.php" hash="b175d464ee87c4771a3accc28181bf62"/></dir><file name="Pictograms.php" hash="1a068cf73e27409ed993be2d59f9d1e9"/></dir><dir name="Product"><dir name="Attribute"><dir name="Source"><file name="Unit.php" hash="3f51c4138a924afd28acdbc9604ba0a8"/></dir></dir></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="b0a8b5265e4c1e561624c976af0ed82e"/></dir></dir></dir><dir name="Rewrite"><file name="Action.php" hash="7e6e016228566baf868aadee2c937323"/></dir><file name="Observer.php" hash="0300fa278a9d358d3c4fa28bb78b9f7a"/><file name="Pictograms.php" hash="55dd17eb750676740c95ca2458fa9ff9"/><file name="Status.php" hash="55bb8eb5aeb77d4cc4c524699fce45ac"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PictogramsController.php" hash="99c81f9503f389f08273b0e070547a17"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="9c528937b6de1e34b1200af70cdb2aea"/><file name="config.xml" hash="5b9d2e548e88e282cf5482c9e86da4e9"/><file name="system.xml" hash="550088f7bb4a52b19b8242f30e7a0c47"/></dir><dir name="sql"><dir name="pictograms_setup"><file name="mysql4-install-2.0.0.php" hash="f6bd4ea418567b02f8e04f7cc216abf6"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="pictograms.xml" hash="9bf24d4be7b30614bf34e0610880cd89"/></dir><dir name="template"><dir name="pictograms"><dir name="catalog"><dir name="product"><dir name="view"><file name="pictograms.phtml" hash="d7833bc062a163ebb3f14fa725e7908e"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="pictograms.xml" hash="6f99b22a2ebb7dc22f7111273a0a985a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VIAN_Pictograms.xml" hash="6b20f96c93bd0c2264d374ce5574c143"/></dir></target><target name="magelocale"><dir name="es_ES"><file name="VIAN_Pictograms.csv" hash="97cf4ae4c796715bfa1e39932c9d4a5e"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="pictograms"><dir name="css"><file name="skin.css" hash="95fbb9389f55be01d1b06c1552d5d26b"/></dir></dir></dir></dir></dir></target></contents>
23
  <compatible/>
24
  <dependencies/>
25
  </package>