Fishpigs_iBanners - Version 0.9.1

Version Notes

Added carousel_animate field, which enables/disables animation

Download this release

Release Info

Developer Magento Core Team
Extension Fishpigs_iBanners
Version 0.9.1
Comparing to
See all releases


Code changes from version 0.9.0 to 0.9.1

app/code/community/Fishpig/IBanners/Block/Adminhtml/Form/Renderer/Useconfig.php CHANGED
@@ -20,7 +20,7 @@ class Fishpig_iBanners_Block_Adminhtml_Form_Renderer_Useconfig extends Mage_Admi
20
 
21
  $checkbox = new Varien_Data_Form_Element_Checkbox(array('html_id' => $id, 'name' => $id));
22
  $checkbox->setForm($element->getForm());
23
- $checkbox->setAfterElementHtml(' <label for="' . $id . '">' . $this->helper('adminhtml')->__('Use Config Settings') . '</label>');
24
 
25
  $checkbox->setOnclick(sprintf("if(this.checked){\$('%s').disabled=true;}else{\$('%s').disabled=false;}", $element->getForm()->getHtmlIdPrefix() . $element->getId(), $element->getForm()->getHtmlIdPrefix() . $element->getId()));
26
 
20
 
21
  $checkbox = new Varien_Data_Form_Element_Checkbox(array('html_id' => $id, 'name' => $id));
22
  $checkbox->setForm($element->getForm());
23
+ $checkbox->setAfterElementHtml(' <label for="' . $id . '">' . $this->helper('adminhtml')->__('Use Config Settings') . '</label>' . $this->getElementJs());
24
 
25
  $checkbox->setOnclick(sprintf("if(this.checked){\$('%s').disabled=true;}else{\$('%s').disabled=false;}", $element->getForm()->getHtmlIdPrefix() . $element->getId(), $element->getForm()->getHtmlIdPrefix() . $element->getId()));
26
 
app/code/community/Fishpig/IBanners/Block/Adminhtml/Group/Edit/Tab/Form.php CHANGED
@@ -55,6 +55,14 @@ class Fishpig_iBanners_Block_Adminhtml_Group_Edit_Tab_Form extends Mage_Adminhtm
55
 
56
  $fieldset = $form->addFieldset('group_settings', array('legend'=> $this->__('Carousel Settings')));
57
 
 
 
 
 
 
 
 
 
58
  $fieldset->addField('carousel_duration', 'text', array(
59
  'name' => 'carousel_duration',
60
  'title' => $this->__('Animation Duration'),
@@ -97,11 +105,18 @@ class Fishpig_iBanners_Block_Adminhtml_Group_Edit_Tab_Form extends Mage_Adminhtm
97
  'values' => Mage::getModel('ibanners/system_config_source_carousel_transition')->toOptionArray(),
98
  ));
99
 
 
 
 
 
 
100
  foreach($fieldset->getElements() as $id => $elem) {
101
- if ($element = $form->getElement($elem->getId())) {
102
  $element->setRenderer(
103
  $this->getLayout()->createBlock('ibanners/adminhtml_form_renderer_useconfig')
104
  );
 
 
105
  }
106
  }
107
 
55
 
56
  $fieldset = $form->addFieldset('group_settings', array('legend'=> $this->__('Carousel Settings')));
57
 
58
+ $fieldset->addField('carousel_animate', 'select', array(
59
+ 'name' => 'carousel_animate',
60
+ 'title' => $this->__('Enable Animation'),
61
+ 'label' => $this->__('Enable Animation'),
62
+ 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
63
+ ));
64
+
65
+
66
  $fieldset->addField('carousel_duration', 'text', array(
67
  'name' => 'carousel_duration',
68
  'title' => $this->__('Animation Duration'),
105
  'values' => Mage::getModel('ibanners/system_config_source_carousel_transition')->toOptionArray(),
106
  ));
107
 
108
+ $elementJs = "<script type=\"text/javascript\">
109
+ if(\$('" . $form->getHtmlIdPrefix() . "carousel_animate').getValue() == '0') {\$('" . $form->getHtmlIdPrefix() . "%s').up('tr').hide();}\$('" . $form->getHtmlIdPrefix() . "carousel_animate').observe('change', function(event) {var carouselAnimate = Event.element(event);if (carouselAnimate.getValue() == '1') {\$('" . $form->getHtmlIdPrefix() . "%s').up('tr').show();}else {\$('" . $form->getHtmlIdPrefix() . "%s').up('tr').hide();}});
110
+ </script>";
111
+
112
+
113
  foreach($fieldset->getElements() as $id => $elem) {
114
+ if ($elem->getId() != 'carousel_animate' && $element = $form->getElement($elem->getId())) {
115
  $element->setRenderer(
116
  $this->getLayout()->createBlock('ibanners/adminhtml_form_renderer_useconfig')
117
  );
118
+
119
+ $element->getRenderer()->setElementJs(sprintf($elementJs, $element->getId(), $element->getId(), $element->getId()));
120
  }
121
  }
122
 
app/code/community/Fishpig/IBanners/Model/Group.php CHANGED
@@ -52,6 +52,16 @@ class Fishpig_iBanners_Model_Group extends Mage_Core_Model_Abstract
52
  return $this->getData('banner_count');
53
  }
54
 
 
 
 
 
 
 
 
 
 
 
55
  /**
56
  * Retrieve the carousel duration for this group
57
  *
52
  return $this->getData('banner_count');
53
  }
54
 
55
+ /**
56
+ * Determine whether animation is enabled for this group
57
+ *
58
+ * @return bool
59
+ */
60
+ public function isAnimationEnabled()
61
+ {
62
+ return $this->getCarouselAnimation() ? true : false;
63
+ }
64
+
65
  /**
66
  * Retrieve the carousel duration for this group
67
  *
app/code/community/Fishpig/IBanners/Model/Mysql4/Group.php CHANGED
@@ -38,7 +38,7 @@ class Fishpig_iBanners_Model_Mysql4_Group extends Mage_Core_Model_Mysql4_Abstrac
38
  throw new Exception(Mage::helper('ibanners')->__('Banner group must have a unique code'));
39
  }
40
 
41
- $object->setCode(Mage::getSingleton('catalog/product_url')->formatUrlKey($object->getCode()));
42
 
43
  if (Mage::getDesign()->getArea() == 'adminhtml') {
44
  foreach($object->getData() as $field => $value) {
@@ -48,10 +48,23 @@ class Fishpig_iBanners_Model_Mysql4_Group extends Mage_Core_Model_Mysql4_Abstrac
48
  $object->unsetData($field);
49
  }
50
  }
51
-
52
- // echo '<pre>'; print_r($object->getData()); echo '</pre>'; exit;
53
  }
54
 
55
  return parent::_beforeSave($object);
56
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
38
  throw new Exception(Mage::helper('ibanners')->__('Banner group must have a unique code'));
39
  }
40
 
41
+ $object->setCode($this->formatGroupCode($object->getCode()));
42
 
43
  if (Mage::getDesign()->getArea() == 'adminhtml') {
44
  foreach($object->getData() as $field => $value) {
48
  $object->unsetData($field);
49
  }
50
  }
 
 
51
  }
52
 
53
  return parent::_beforeSave($object);
54
  }
55
+
56
+ /**
57
+ * Convert a string into a valid group code
58
+ *
59
+ * @param string $str
60
+ * @return string
61
+ */
62
+ public function formatGroupCode($str)
63
+ {
64
+ $str = preg_replace('#[^0-9a-z]+#i', '_', Mage::helper('catalog/product_url')->format($str));
65
+ $str = strtolower($str);
66
+ $str = trim($str, '_');
67
+
68
+ return $str;
69
+ }
70
  }
app/code/community/Fishpig/IBanners/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Fishpig_iBanners>
5
- <version>0.9.0</version>
6
  </Fishpig_iBanners>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Fishpig_iBanners>
5
+ <version>0.9.1</version>
6
  </Fishpig_iBanners>
7
  </modules>
8
  <global>
app/code/community/Fishpig/IBanners/notes.txt CHANGED
@@ -7,9 +7,15 @@
7
  # Bug Reports: help@fishpig.co.uk
8
  ##
9
 
 
 
 
10
  27/07/2011 - v0.9.0
11
  - Moved extension to stable
12
  - Added configuration options for animation
 
 
 
13
 
14
  27/07/2011 - v0.5.4
15
  - Removed custom JS and included Protype Carousel (http://code.google.com/p/prototype-carousel/)
7
  # Bug Reports: help@fishpig.co.uk
8
  ##
9
 
10
+ 28/07/2011 - v0.9.1
11
+ - added carousel_animate field, which enables/disables animation
12
+
13
  27/07/2011 - v0.9.0
14
  - Moved extension to stable
15
  - Added configuration options for animation
16
+ - Improved default template
17
+ - Added support for single images
18
+ - Added full support for HTML slides
19
 
20
  27/07/2011 - v0.5.4
21
  - Removed custom JS and included Protype Carousel (http://code.google.com/p/prototype-carousel/)
app/code/community/Fishpig/IBanners/sql/ibanners_setup/mysql4-upgrade-0.9.0-0.9.1.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Fishpig
4
+ * @package Fishpig_iBanners
5
+ * @license http://fishpig.co.uk/license.txt
6
+ * @author Ben Tideswell <help@fishpig.co.uk>
7
+ */
8
+
9
+ $this->startSetup();
10
+
11
+ $this->getConnection()->addColumn($this->getTable('ibanners_group'), 'carousel_animate', " int(1) NOT NULL default 1");
12
+
13
+ $this->endSetup();
app/design/frontend/base/default/template/ibanners/default.phtml CHANGED
@@ -41,6 +41,7 @@
41
  <?php endforeach; ?>
42
  </ul>
43
  </div>
 
44
  <script type="text/javascript">
45
  //<![CDATA[
46
  new Carousel('<?php echo $this->getWrapperId() ?>', $('<?php echo $this->getWrapperId() ?>').select('li.banner'), $('<?php echo $this->getWrapperId() ?>').select('ibanner-control'), {
@@ -55,5 +56,6 @@
55
  });
56
  //]]>
57
  </script>
 
58
  <?php endif; ?>
59
  <?php endif; ?>
41
  <?php endforeach; ?>
42
  </ul>
43
  </div>
44
+ <?php if ($group->isAnimationEnabled()): ?>
45
  <script type="text/javascript">
46
  //<![CDATA[
47
  new Carousel('<?php echo $this->getWrapperId() ?>', $('<?php echo $this->getWrapperId() ?>').select('li.banner'), $('<?php echo $this->getWrapperId() ?>').select('ibanner-control'), {
56
  });
57
  //]]>
58
  </script>
59
+ <?php endif; ?>
60
  <?php endif; ?>
61
  <?php endif; ?>
package.xml CHANGED
@@ -1,22 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Fishpigs_iBanners</name>
4
- <version>0.9.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://fishpig.co.uk/license.txt">fishpig EULA</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Create grouped banner slideshows to showcase products and special offers.</summary>
10
  <description>This module allows you to create multiple banner slideshows to be placed around your Magento store. By default, the module will add a banner slideshow to your homepage, however you can easily create more banner groups and add them any where you like!</description>
11
- <notes>Moved extension to stable&#xD;
12
- Added configuration options for animation&#xD;
13
- Improved default template&#xD;
14
- Added support for single images&#xD;
15
- Added full support for HTML slides</notes>
16
  <authors><author><name>fishpig</name><user>auto-converted</user><email>ben@fishpig.co.uk</email></author></authors>
17
- <date>2011-07-27</date>
18
- <time>23:04:49</time>
19
- <contents><target name="magecommunity"><dir name="Fishpig"><dir name="IBanners"><dir name="Block"><dir name="Adminhtml"><dir name="Banner"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="bce2db8d35d26fbe9da910852169ff34"/></dir><file name="Form.php" hash="e9cd0d7436d36048706bc474704d2b82"/><file name="Tabs.php" hash="60a82a390e8580594885bceb19a13460"/></dir><dir name="Helper"><file name="Image.php" hash="da1821e82b38af686705efb53f5a1ca9"/></dir><file name="Edit.php" hash="93807e5b677fd064e49c547551507202"/><file name="Grid.php" hash="59ca8a1c3822e37f1e82f464589f6525"/></dir><dir name="Form"><dir name="Renderer"><file name="Useconfig.php" hash="f25ae289cf4ccb4fa2e0150ef6a3fbd6"/></dir></dir><dir name="Group"><dir name="Edit"><dir name="Tab"><file name="Banners.php" hash="f13f72d714e73ba5481fe488b369c879"/><file name="Form.php" hash="1c100da2eec9fe7c7ef32f4be78c5e31"/></dir><file name="Form.php" hash="5b8f4f8649e974f80ea21de7f323788e"/><file name="Tabs.php" hash="d57a68d75dde73b39127dc8a932b858e"/></dir><file name="Edit.php" hash="1f3ca94777f0eb8a3363d245d9c5bc9d"/><file name="Grid.php" hash="2d86e326cb6825c8e7738e5c73abaf67"/></dir><file name="Banner.php" hash="181c9778d624e104ab3f8e729c58b3f7"/><file name="Group.php" hash="6a6ea8ad3f9e1e25dcf0411fa5347b9c"/></dir><file name="View.php" hash="6ee6a72caf09867c230edd82346f43b6"/></dir><dir name="Helper"><file name="Data.php" hash="22b6c9355bb8eeb8bab400a824109e24"/><file name="Image.php" hash="fcd4bfceafe21c0b484a1fd8b0bdd530"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Banner"><file name="Collection.php" hash="a739feb75f33c1b18cff143df4945bd4"/></dir><dir name="Group"><file name="Collection.php" hash="ab6a49e01708c118052a696a0e09184c"/></dir><file name="Banner.php" hash="81752a0ab34bde996d9472ac67272472"/><file name="Group.php" hash="a6169366faa02cda8b57751ed2a3b98d"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Carousel"><file name="Effect.php" hash="b615ef28aa59aed914dd95a0242cfc9e"/><file name="Transition.php" hash="290f6abe41d0d44f72f8188a77f8e475"/></dir></dir></dir></dir><file name="Banner.php" hash="c013618422ba7dd2920312e989024166"/><file name="Group.php" hash="2a6066f654908437ebd8180db3873ba0"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="BannerController.php" hash="ab4015467f0f37f0cedbb344d3021e8f"/><file name="GroupController.php" hash="f58f269a86c211095314b1f41f212ffa"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="4e6ded4671403e01776cf9361c59d33d"/><file name="config.xml" hash="51298337cf4fa150565781b065986f56"/><file name="system.xml" hash="cc01ba370a7fe9946a3d761a9e7975f3"/></dir><dir name="sql"><dir name="ibanners_setup"><file name="mysql4-install-0.1.0.php" hash="62e4961272f2d697595002b006e72731"/><file name="mysql4-upgrade-0.5.2-0.5.3.php" hash="2e85887fb121d988357a45785d9f06df"/><file name="mysql4-upgrade-0.5.4-0.5.5.php" hash="a16fd4c674ed65eed1c7cee851960d28"/><file name="mysql4-upgrade-0.5.5-0.5.6.php" hash="ddecfdcbffc46880ece44ccacccd1813"/></dir></dir><file name="license.txt" hash="257eae92a36bdaaf9584fbf8ba76d1c6"/><file name="notes.txt" hash="bc9b1ed01d2d101a50835c9f7725c66d"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ibanners.xml" hash="daa28ce83b6f288108c87bc352475ca8"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ibanners.xml" hash="b8ae18bef6d375f5b54f1f115d4da68e"/></dir><dir name="template"><dir name="ibanners"><file name="default.phtml" hash="c8d0aa98f6b8e6ff3e704dd21eb367ec"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Fishpig_iBanners.xml" hash="d3476db8a3f950a7bf249b5382b5c42e"/></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="fishpig"><file name="carousel.min.js" hash="cfd7a8d08a6dca87e4211a400877716e"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="ibanners.css" hash="b38e065cb6cbcaa5fbda366db21291ff"/></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies/>
22
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Fishpigs_iBanners</name>
4
+ <version>0.9.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://fishpig.co.uk/license.txt">fishpig EULA</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Create grouped banner slideshows to showcase products and special offers.</summary>
10
  <description>This module allows you to create multiple banner slideshows to be placed around your Magento store. By default, the module will add a banner slideshow to your homepage, however you can easily create more banner groups and add them any where you like!</description>
11
+ <notes>Added carousel_animate field, which enables/disables animation</notes>
 
 
 
 
12
  <authors><author><name>fishpig</name><user>auto-converted</user><email>ben@fishpig.co.uk</email></author></authors>
13
+ <date>2011-07-28</date>
14
+ <time>10:58:18</time>
15
+ <contents><target name="magecommunity"><dir name="Fishpig"><dir name="IBanners"><dir name="Block"><dir name="Adminhtml"><dir name="Banner"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="bce2db8d35d26fbe9da910852169ff34"/></dir><file name="Form.php" hash="e9cd0d7436d36048706bc474704d2b82"/><file name="Tabs.php" hash="60a82a390e8580594885bceb19a13460"/></dir><dir name="Helper"><file name="Image.php" hash="da1821e82b38af686705efb53f5a1ca9"/></dir><file name="Edit.php" hash="93807e5b677fd064e49c547551507202"/><file name="Grid.php" hash="59ca8a1c3822e37f1e82f464589f6525"/></dir><dir name="Form"><dir name="Renderer"><file name="Useconfig.php" hash="df579ff6a4a783ed17d6c5bc6118e171"/></dir></dir><dir name="Group"><dir name="Edit"><dir name="Tab"><file name="Banners.php" hash="f13f72d714e73ba5481fe488b369c879"/><file name="Form.php" hash="4628175e44bf22b9846257c2576bfeda"/></dir><file name="Form.php" hash="5b8f4f8649e974f80ea21de7f323788e"/><file name="Tabs.php" hash="d57a68d75dde73b39127dc8a932b858e"/></dir><file name="Edit.php" hash="1f3ca94777f0eb8a3363d245d9c5bc9d"/><file name="Grid.php" hash="2d86e326cb6825c8e7738e5c73abaf67"/></dir><file name="Banner.php" hash="181c9778d624e104ab3f8e729c58b3f7"/><file name="Group.php" hash="6a6ea8ad3f9e1e25dcf0411fa5347b9c"/></dir><file name="View.php" hash="6ee6a72caf09867c230edd82346f43b6"/></dir><dir name="Helper"><file name="Data.php" hash="22b6c9355bb8eeb8bab400a824109e24"/><file name="Image.php" hash="fcd4bfceafe21c0b484a1fd8b0bdd530"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Banner"><file name="Collection.php" hash="a739feb75f33c1b18cff143df4945bd4"/></dir><dir name="Group"><file name="Collection.php" hash="ab6a49e01708c118052a696a0e09184c"/></dir><file name="Banner.php" hash="81752a0ab34bde996d9472ac67272472"/><file name="Group.php" hash="334492cc6e6f5ec3d48b982cc2be4248"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Carousel"><file name="Effect.php" hash="b615ef28aa59aed914dd95a0242cfc9e"/><file name="Transition.php" hash="290f6abe41d0d44f72f8188a77f8e475"/></dir></dir></dir></dir><file name="Banner.php" hash="c013618422ba7dd2920312e989024166"/><file name="Group.php" hash="1078f67df0e0b70ae1c89bb81ff68619"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="BannerController.php" hash="ab4015467f0f37f0cedbb344d3021e8f"/><file name="GroupController.php" hash="f58f269a86c211095314b1f41f212ffa"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="4e6ded4671403e01776cf9361c59d33d"/><file name="config.xml" hash="ef3a7a1124baa551ab8141a9674fa63b"/><file name="system.xml" hash="cc01ba370a7fe9946a3d761a9e7975f3"/></dir><dir name="sql"><dir name="ibanners_setup"><file name="mysql4-install-0.1.0.php" hash="62e4961272f2d697595002b006e72731"/><file name="mysql4-upgrade-0.5.2-0.5.3.php" hash="2e85887fb121d988357a45785d9f06df"/><file name="mysql4-upgrade-0.5.4-0.5.5.php" hash="a16fd4c674ed65eed1c7cee851960d28"/><file name="mysql4-upgrade-0.5.5-0.5.6.php" hash="ddecfdcbffc46880ece44ccacccd1813"/><file name="mysql4-upgrade-0.9.0-0.9.1.php" hash="e50564e938a5995075fe67fca55328b0"/></dir></dir><file name="license.txt" hash="257eae92a36bdaaf9584fbf8ba76d1c6"/><file name="notes.txt" hash="8398fc9498d7c9bf7c46c86f26cb9b7f"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ibanners.xml" hash="daa28ce83b6f288108c87bc352475ca8"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ibanners.xml" hash="b8ae18bef6d375f5b54f1f115d4da68e"/></dir><dir name="template"><dir name="ibanners"><file name="default.phtml" hash="1ac4869c8d39ff2a3cf1130819859eeb"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Fishpig_iBanners.xml" hash="d3476db8a3f950a7bf249b5382b5c42e"/></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="fishpig"><file name="carousel.min.js" hash="cfd7a8d08a6dca87e4211a400877716e"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="ibanners.css" hash="b38e065cb6cbcaa5fbda366db21291ff"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>