MGS_ResponsiveSlideshow - Version 1.0.0

Version Notes

version 1.0.0

Download this release

Release Info

Developer Mage Solution
Extension MGS_ResponsiveSlideshow
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (82) hide show
  1. app/code/local/MGS/Mgscore/Block/System/Config/About.php +75 -0
  2. app/code/local/MGS/Mgscore/Helper/Data.php +6 -0
  3. app/code/local/MGS/Mgscore/etc/config.xml +75 -0
  4. app/code/local/MGS/Mgscore/etc/system.xml +29 -0
  5. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow.php +63 -0
  6. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Add.php +36 -0
  7. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Add/Form.php +35 -0
  8. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Add/Tab/Category.php +224 -0
  9. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Add/Tab/Form.php +75 -0
  10. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Add/Tab/Image.php +181 -0
  11. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Add/Tab/Page.php +36 -0
  12. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Add/Tabs.php +52 -0
  13. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit.php +49 -0
  14. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Form.php +33 -0
  15. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Ajax/Serializer.php +71 -0
  16. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Category.php +215 -0
  17. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Form.php +460 -0
  18. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Image.php +182 -0
  19. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Page.php +38 -0
  20. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Products.php +181 -0
  21. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Staticblocks.php +199 -0
  22. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tabs.php +78 -0
  23. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Grid.php +141 -0
  24. app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Widget/Chooser.php +154 -0
  25. app/code/local/MGS/ResponsiveSlideshow/Block/Content/Contentbottom.php +21 -0
  26. app/code/local/MGS/ResponsiveSlideshow/Block/Content/Contenttop.php +21 -0
  27. app/code/local/MGS/ResponsiveSlideshow/Block/Content/Headerbottom.php +21 -0
  28. app/code/local/MGS/ResponsiveSlideshow/Block/Content/Headertop.php +21 -0
  29. app/code/local/MGS/ResponsiveSlideshow/Block/Content/Leftbottom.php +21 -0
  30. app/code/local/MGS/ResponsiveSlideshow/Block/Content/Lefttop.php +21 -0
  31. app/code/local/MGS/ResponsiveSlideshow/Block/Content/Rightbottom.php +21 -0
  32. app/code/local/MGS/ResponsiveSlideshow/Block/Content/Righttop.php +21 -0
  33. app/code/local/MGS/ResponsiveSlideshow/Block/Slideshow.php +71 -0
  34. app/code/local/MGS/ResponsiveSlideshow/Block/Widget/Slideshow.php +44 -0
  35. app/code/local/MGS/ResponsiveSlideshow/Helper/Data.php +49 -0
  36. app/code/local/MGS/ResponsiveSlideshow/Helper/Image.php +487 -0
  37. app/code/local/MGS/ResponsiveSlideshow/Media/Uploader.php +21 -0
  38. app/code/local/MGS/ResponsiveSlideshow/Model/Config.php +37 -0
  39. app/code/local/MGS/ResponsiveSlideshow/Model/Config/Source/Page.php +54 -0
  40. app/code/local/MGS/ResponsiveSlideshow/Model/Config/Source/Position.php +84 -0
  41. app/code/local/MGS/ResponsiveSlideshow/Model/Config/Source/Setting.php +136 -0
  42. app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow.php +495 -0
  43. app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow/Collection.php +128 -0
  44. app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow/Image.php +28 -0
  45. app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow/Image/Collection.php +25 -0
  46. app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow/Product.php +28 -0
  47. app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow/Product/Collection.php +25 -0
  48. app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow/Staticblock.php +28 -0
  49. app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow/Staticblock/Collection.php +25 -0
  50. app/code/local/MGS/ResponsiveSlideshow/Model/Slideshow.php +53 -0
  51. app/code/local/MGS/ResponsiveSlideshow/Model/Slideshow/Image.php +685 -0
  52. app/code/local/MGS/ResponsiveSlideshow/controllers/Adminhtml/SlideshowController.php +355 -0
  53. app/code/local/MGS/ResponsiveSlideshow/controllers/Adminhtml/WidgetController.php +32 -0
  54. app/code/local/MGS/ResponsiveSlideshow/etc/config.xml +202 -0
  55. app/code/local/MGS/ResponsiveSlideshow/etc/system.xml +0 -0
  56. app/code/local/MGS/ResponsiveSlideshow/etc/widget.xml +55 -0
  57. app/code/local/MGS/ResponsiveSlideshow/sql/aslideshow_setup/mysql4-install-1.0.0.php +109 -0
  58. app/code/local/MGS/ResponsiveSlideshow/sql/aslideshow_setup/mysql4-upgrade-1.0.0-1.0.1.php +42 -0
  59. app/code/local/MGS/ResponsiveSlideshow/sql/aslideshow_setup/mysql4-upgrade-1.0.1-1.0.2.php +11 -0
  60. app/design/adminhtml/default/default/layout/aslideshow.xml +105 -0
  61. app/design/adminhtml/default/default/template/mgs_responsiveslideshow/edit/serializer.phtml +33 -0
  62. app/design/adminhtml/default/default/template/mgs_responsiveslideshow/edit/tab/category.phtml +202 -0
  63. app/design/adminhtml/default/default/template/mgs_responsiveslideshow/edit/tab/image.phtml +69 -0
  64. app/design/adminhtml/default/default/template/mgs_responsiveslideshow/products.phtml +62 -0
  65. app/design/adminhtml/default/default/template/mgs_responsiveslideshow/script-transition.phtml +32 -0
  66. app/design/adminhtml/default/default/template/mgs_responsiveslideshow/script.phtml +40 -0
  67. app/design/adminhtml/default/default/template/mgs_responsiveslideshow/slideshow.phtml +14 -0
  68. app/design/frontend/default/default/layout/mgs_responsiveslideshow.xml +71 -0
  69. app/design/frontend/default/default/template/mgs_responsiveslideshow/content/responsiveslidehow.phtml +240 -0
  70. app/design/frontend/default/default/template/mgs_responsiveslideshow/widget/responsiveslidehow.phtml +235 -0
  71. app/etc/modules/MGS_Mgscore.xml +9 -0
  72. app/etc/modules/MGS_ResponsiveSlideshow.xml +28 -0
  73. js/mgs_responsiveslideshow/adminhtml/product.js +1056 -0
  74. package.xml +20 -0
  75. skin/frontend/default/default/css/responsiveslideshow/flexslider.css +92 -0
  76. skin/frontend/default/default/images/responsiveslideshow/bg_direction_nav.png +0 -0
  77. skin/frontend/default/default/images/responsiveslideshow/controlls.gif +0 -0
  78. skin/frontend/default/default/images/responsiveslideshow/preload.gif +0 -0
  79. skin/frontend/default/default/js/responsiveslideshow/jquery.flexslider.js +904 -0
  80. skin/frontend/default/default/js/responsiveslideshow/jquery.js +16 -0
  81. skin/frontend/default/default/js/responsiveslideshow/jquery.noconflict.js +1 -0
  82. skin/frontend/default/default/js/responsiveslideshow/modernizr.js +2 -0
app/code/local/MGS/Mgscore/Block/System/Config/About.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MGS_Mgscore_Block_System_Config_About extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
4
+ {
5
+ public function render(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ try {
8
+
9
+ $feed = curl_init('http://magesolution.com/MGS_Feed.xml');
10
+
11
+ if($feed === false){
12
+ throw new Exception('Error loading module info feed.'); }
13
+
14
+ curl_setopt($feed, CURLOPT_RETURNTRANSFER, true);
15
+ curl_setopt($feed, CURLOPT_HEADER, 0);
16
+ $xml = curl_exec($feed);
17
+ curl_close($feed);
18
+
19
+ if($xml === false){
20
+ throw new Exception('Error loading module info XML.'); }
21
+
22
+ $result = new SimpleXMLElement($xml);
23
+
24
+ if (!$result || !$result->channel->item) {
25
+ throw new Exception('No info in module info XML.'); }
26
+
27
+
28
+ $htmlFeed = curl_init('http://magesolution.com/about/index.html');
29
+
30
+ if($htmlFeed === false){
31
+ throw new Exception('Error loading about section HTML.'); }
32
+
33
+ curl_setopt($htmlFeed, CURLOPT_RETURNTRANSFER, true);
34
+ curl_setopt($htmlFeed, CURLOPT_HEADER, 0);
35
+ $html = curl_exec($htmlFeed);
36
+ curl_close($htmlFeed);
37
+
38
+ if($html === false || $html == ''){
39
+ throw new Exception('Error loading about section HTML or there is no content.'); }
40
+
41
+ if(count($result->channel->item)>0){
42
+ $html.='<div class="grid-extension"><ul>';
43
+ $i=0;
44
+ foreach ($result->channel->item as $item) {
45
+ $i++;
46
+ $html.='<li';
47
+ if($i%5==0){
48
+ $html.=' class="last"';
49
+ }
50
+ $html.='>';
51
+ $html.='<div class="product-img">';
52
+ $html.='<a href="'.$item->link.'" title="'.$item->name.'"><img src="'.$item->img.'" alt="'.$item->name.'"/></a>';
53
+ $html.='</div>';
54
+ $html.='<h4>'.$item->name.'</h4>';
55
+ $html.='<div class="price-container">';
56
+ if(isset($item->old_price)){
57
+ $html.='<span class="old-price">'.$item->old_price.'</span>';
58
+ }
59
+ $html.='<span class="final-price">'.$item->price.'</span>';
60
+ $html.='</div>';
61
+ $html.='</li>';
62
+ }
63
+ $html.='</ul></div>';
64
+ }
65
+
66
+ unset($feed, $xml, $result);
67
+
68
+ return $html;
69
+
70
+ } catch (Exception $e) {
71
+
72
+ return $e->getMessage();
73
+ }
74
+ }
75
+ }
app/code/local/MGS/Mgscore/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MGS_Mgscore_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/local/MGS/Mgscore/etc/config.xml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <MGS_Mgscore>
5
+ <version>0.1.0</version>
6
+ </MGS_Mgscore>
7
+ </modules>
8
+
9
+ <adminhtml>
10
+ <menu>
11
+ <mgscore module="mgscore">
12
+ <title>Mage Solutions</title>
13
+ <sort_order>99</sort_order>
14
+ <children>
15
+ <about module="mgscore">
16
+ <title>About Us</title>
17
+ <sort_order>0</sort_order>
18
+ <action>adminhtml/system_config/edit/section/mgscore_about</action>
19
+ </about>
20
+ </children>
21
+ </mgscore>
22
+ </menu>
23
+ <acl>
24
+ <resources>
25
+ <admin>
26
+ <children>
27
+ <mgscore module="mgscore">
28
+ <title>Mage Solutions</title>
29
+ <sort_order>99</sort_order>
30
+ <children>
31
+ <about module="mgscore">
32
+ <title>About Us</title>
33
+ <sort_order>0</sort_order>
34
+ </about>
35
+ </children>
36
+ </mgscore>
37
+ <system>
38
+ <children>
39
+ <config>
40
+ <children>
41
+ <mgscore_about translate="title">
42
+ <title>Mage Solutions</title>
43
+ <sort_order>888</sort_order>
44
+ </mgscore_about>
45
+ </children>
46
+ </config>
47
+ </children>
48
+ </system>
49
+ </children>
50
+ </admin>
51
+ </resources>
52
+ </acl>
53
+ <layout>
54
+ <updates>
55
+ <tabs>
56
+ <file>mgscore.xml</file>
57
+ </tabs>
58
+ </updates>
59
+ </layout>
60
+ </adminhtml>
61
+
62
+ <global>
63
+ <helpers>
64
+ <mgscore>
65
+ <class>MGS_Mgscore_Helper</class>
66
+ </mgscore>
67
+ </helpers>
68
+
69
+ <blocks>
70
+ <mgscore>
71
+ <class>MGS_Mgscore_Block</class>
72
+ </mgscore>
73
+ </blocks>
74
+ </global>
75
+ </config>
app/code/local/MGS/Mgscore/etc/system.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <mgscore translate="label">
5
+ <label>Mage Solutions</label>
6
+ <sort_order>6</sort_order>
7
+ </mgscore>
8
+ </tabs>
9
+ <sections>
10
+ <mgscore_about translate="label">
11
+ <label>About Us</label>
12
+ <tab>mgscore</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>1</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
+ <about translate="label" >
20
+ <frontend_model>mgscore/system_config_about</frontend_model>
21
+ <sort_order>0</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ </about>
26
+ </groups>
27
+ </mgscore_about>
28
+ </sections>
29
+ </config>
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow extends Mage_Adminhtml_Block_Widget_Grid_Container {
20
+ public function __construct() {
21
+ $this->_controller = 'adminhtml_slideshow';
22
+ $this->_blockGroup = 'aslideshow';
23
+ $this->_headerText = Mage::helper('aslideshow')->__('Slideshow Manager');
24
+ parent::__construct();
25
+
26
+ $this->setTemplate('mgs_responsiveslideshow/slideshow.phtml');
27
+ }
28
+
29
+ protected function _prepareLayout() {
30
+ $this->setChild('add_new_button',
31
+ $this->getLayout()->createBlock('adminhtml/widget_button')
32
+ ->setData(array(
33
+ 'label' => Mage::helper('aslideshow')->__('Add Slideshow'),
34
+ 'onclick' => "setLocation('".$this->getUrl('*/*/add')."')",
35
+ 'class' => 'add'
36
+ ))
37
+ );
38
+ /**
39
+ * Display store switcher if system has more one store
40
+ */
41
+ if (!Mage::app()->isSingleStoreMode()) {
42
+ $this->setChild('store_switcher',
43
+ $this->getLayout()->createBlock('adminhtml/store_switcher')
44
+ ->setUseConfirm(false)
45
+ ->setSwitchUrl($this->getUrl('*/*/*', array('store'=>null)))
46
+ );
47
+ }
48
+ $this->setChild('grid', $this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_grid', 'slideshow.grid'));
49
+ return parent::_prepareLayout();
50
+ }
51
+
52
+ public function getAddNewButtonHtml() {
53
+ return $this->getChildHtml('add_new_button');
54
+ }
55
+
56
+ public function getGridHtml() {
57
+ return $this->getChildHtml('grid');
58
+ }
59
+
60
+ public function getStoreSwitcherHtml() {
61
+ return $this->getChildHtml('store_switcher');
62
+ }
63
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Add.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Add extends Mage_Adminhtml_Block_Widget_Form_Container
20
+ {
21
+ public function __construct()
22
+ {
23
+ parent::__construct();
24
+
25
+ $this->_objectId = 'id';
26
+ $this->_blockGroup = 'aslideshow';
27
+ $this->_controller = 'adminhtml_slideshow';
28
+
29
+ $this->_updateButton('save', 'label', Mage::helper('aslideshow')->__('Save Slideshow'));
30
+ }
31
+
32
+ public function getHeaderText()
33
+ {
34
+ Mage::helper('aslideshow')->__("Add Slideshow");
35
+ }
36
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Add/Form.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * MGS_ResponsiveSlideshow Extension
5
+ *
6
+ * @category Local
7
+ * @package MGS_ResponsiveSlideshow
8
+ * @author dungnv (dungnv@arrowhitech.com)
9
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
10
+ *
11
+ */
12
+
13
+ /**
14
+ *
15
+ * @category Local
16
+ * @package MGS_ResponsiveSlideshow
17
+ * @author dungnv <dungnv@arrowhitech.com>
18
+ */
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Add_Form extends Mage_Adminhtml_Block_Widget_Form {
20
+
21
+ protected function _prepareForm() {
22
+ $form = new Varien_Data_Form(
23
+ array(
24
+ 'id' => 'edit_form',
25
+ 'action' => $this->getUrl('*/*/save'),
26
+ 'method' => 'post',
27
+ )
28
+ );
29
+
30
+ $form->setUseContainer(true);
31
+ $this->setForm($form);
32
+ return parent::_prepareForm();
33
+ }
34
+
35
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Add/Tab/Category.php ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Add_Tab_Category extends Mage_Adminhtml_Block_Catalog_Category_Tree
20
+ {
21
+ protected $_categoryIds;
22
+ protected $_selectedNodes = null;
23
+
24
+ public function __construct()
25
+ {
26
+ parent::__construct();
27
+ $this->setTemplate('mgs_responsiveslideshow/edit/tab/category.phtml');
28
+ }
29
+
30
+ /**
31
+ * Retrieve currently edited product
32
+ *
33
+ * @return Mage_Catalog_Model_Product
34
+ */
35
+ public function getSlideshow()
36
+ {
37
+ return Mage::registry('current_slideshow');
38
+ }
39
+
40
+ /**
41
+ * Checks when this block is readonly
42
+ *
43
+ * @return boolean
44
+ */
45
+ public function isReadonly()
46
+ {
47
+ return $this->getSlideshow()->getCategoriesReadonly();
48
+ }
49
+
50
+ protected function getCategoryIds()
51
+ {
52
+ $_categoryList = $this->getSlideshow()->getCategoryId();
53
+ return is_array($_categoryList) ? $_categoryList : array();
54
+ }
55
+
56
+ public function getIdsString()
57
+ {
58
+ return implode(',', $this->getCategoryIds());
59
+ }
60
+
61
+ public function getRootNode()
62
+ {
63
+ // $root = parent::getRoot();
64
+ $root = $this->getRoot();
65
+ if ($root && in_array($root->getId(), $this->getCategoryIds())) {
66
+ $root->setChecked(true);
67
+ }
68
+ return $root;
69
+ }
70
+
71
+ public function getRoot($parentNodeCategory=null, $recursionLevel=3)
72
+ {
73
+ if (!is_null($parentNodeCategory) && $parentNodeCategory->getId()) {
74
+ return $this->getNode($parentNodeCategory, $recursionLevel);
75
+ }
76
+ $root = Mage::registry('root');
77
+ if (is_null($root)) {
78
+ $storeId = (int) $this->getRequest()->getParam('store');
79
+
80
+ if ($storeId) {
81
+ $store = Mage::app()->getStore($storeId);
82
+ $rootId = $store->getRootCategoryId();
83
+ }
84
+ else {
85
+ $rootId = Mage_Catalog_Model_Category::TREE_ROOT_ID;
86
+ }
87
+
88
+ $ids = $this->getSelectedCategoriesPathIds($rootId);
89
+ $tree = Mage::getResourceSingleton('catalog/category_tree')
90
+ ->loadByIds($ids, false, false);
91
+
92
+ if ($this->getCategory()) {
93
+ $tree->loadEnsuredNodes($this->getCategory(), $tree->getNodeById($rootId));
94
+ }
95
+
96
+ $tree->addCollectionData($this->getCategoryCollection());
97
+
98
+ $root = $tree->getNodeById($rootId);
99
+
100
+ if ($root && $rootId != Mage_Catalog_Model_Category::TREE_ROOT_ID) {
101
+ $root->setIsVisible(true);
102
+ if ($this->isReadonly()) {
103
+ $root->setDisabled(true);
104
+ }
105
+ }
106
+ elseif($root && $root->getId() == Mage_Catalog_Model_Category::TREE_ROOT_ID) {
107
+ $root->setName(Mage::helper('catalog')->__('Root'));
108
+ }
109
+
110
+ Mage::register('root', $root);
111
+ }
112
+
113
+ return $root;
114
+ }
115
+
116
+ protected function _getNodeJson($node, $level=1)
117
+ {
118
+ $item = parent::_getNodeJson($node, $level);
119
+
120
+ $isParent = $this->_isParentSelectedCategory($node);
121
+
122
+ if ($isParent) {
123
+ $item['expanded'] = true;
124
+ }
125
+
126
+ // if ($node->getLevel() > 1 && !$isParent && isset($item['children'])) {
127
+ // $item['children'] = array();
128
+ // }
129
+
130
+
131
+ if (in_array($node->getId(), $this->getCategoryIds())) {
132
+ $item['checked'] = true;
133
+ }
134
+
135
+ if ($this->isReadonly()) {
136
+ $item['disabled'] = true;
137
+ }
138
+ return $item;
139
+ }
140
+
141
+ protected function _isParentSelectedCategory($node)
142
+ {
143
+ foreach ($this->_getSelectedNodes() as $selected) {
144
+ if ($selected) {
145
+ $pathIds = explode('/', $selected->getPathId());
146
+ if (in_array($node->getId(), $pathIds)) {
147
+ return true;
148
+ }
149
+ }
150
+ }
151
+
152
+ return false;
153
+ }
154
+
155
+ protected function _getSelectedNodes()
156
+ {
157
+ if ($this->_selectedNodes === null) {
158
+ $this->_selectedNodes = array();
159
+ $root = $this->getRoot();
160
+ foreach ($this->getCategoryIds() as $categoryId) {
161
+ if ($root) {
162
+ $this->_selectedNodes[] = $root->getTree()->getNodeById($categoryId);
163
+ }
164
+ }
165
+ }
166
+
167
+ return $this->_selectedNodes;
168
+ }
169
+
170
+ public function getCategoryChildrenJson($categoryId)
171
+ {
172
+ $category = Mage::getModel('catalog/category')->load($categoryId);
173
+ $node = $this->getRoot($category, 1)->getTree()->getNodeById($categoryId);
174
+
175
+ if (!$node || !$node->hasChildren()) {
176
+ return '[]';
177
+ }
178
+
179
+ $children = array();
180
+ foreach ($node->getChildren() as $child) {
181
+ $children[] = $this->_getNodeJson($child);
182
+ }
183
+
184
+ return Mage::helper('aslideshow')->jsonEncode($children);
185
+ }
186
+
187
+ public function getLoadTreeUrl($expanded=null)
188
+ {
189
+ return $this->getUrl('*/*/categoriesJson', array('_current'=>true));
190
+ }
191
+
192
+ /**
193
+ * Return distinct path ids of selected categories
194
+ *
195
+ * @param int $rootId Root category Id for context
196
+ * @return array
197
+ */
198
+ public function getSelectedCategoriesPathIds($rootId = false)
199
+ {
200
+ $ids = array();
201
+ $collection = Mage::getModel('catalog/category')->getCollection()
202
+ ->addFieldToFilter('entity_id', array('in'=>$this->getCategoryIds()));
203
+ foreach ($collection as $item) {
204
+ if ($rootId && !in_array($rootId, $item->getPathIds())) {
205
+ continue;
206
+ }
207
+ foreach ($item->getPathIds() as $id) {
208
+ if (!in_array($id, $ids)) {
209
+ $ids[] = $id;
210
+ }
211
+ }
212
+ }
213
+ return $ids;
214
+ }
215
+
216
+ public function getProductsJson()
217
+ {
218
+ $products = $this->getSlideshow()->getProductsPosition();
219
+ if (!empty($products)) {
220
+ return Mage::helper('core')->jsonEncode($products);
221
+ }
222
+ return '{}';
223
+ }
224
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Add/Tab/Form.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Add_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
20
+ {
21
+ protected function _prepareForm()
22
+ {
23
+ $form = new Varien_Data_Form();
24
+ $this->setForm($form);
25
+
26
+ $fieldset = $form->addFieldset('aslideshow_form', array('legend'=>Mage::helper('aslideshow')->__('General Information')));
27
+ $fieldset->addField('name', 'text', array(
28
+ 'label' => Mage::helper('aslideshow')->__('Title'),
29
+ 'class' => 'required-entry',
30
+ 'required' => true,
31
+ 'name' => 'name',
32
+ ));
33
+
34
+ $fieldset->addField('position', 'select', array(
35
+ 'label' => Mage::helper('aslideshow')->__('Position'),
36
+ 'name' => 'position',
37
+ 'values' => Mage::getSingleton('aslideshow/config_source_position')->toOptionArray(),
38
+ ));
39
+
40
+ $fieldset->addField('sort_order', 'text', array(
41
+ 'label' => Mage::helper('aslideshow')->__('Sort Order'),
42
+ 'required' => false,
43
+ 'name' => 'sort_order',
44
+ ));
45
+
46
+ $fieldset->addField('is_active', 'select', array(
47
+ 'label' => Mage::helper('aslideshow')->__('Is Active'),
48
+ 'name' => 'is_active',
49
+ 'values' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray(),
50
+ ));
51
+
52
+ if (!Mage::app()->isSingleStoreMode()) {
53
+ $fieldset->addField('stores', 'multiselect', array(
54
+ 'label' => Mage::helper('aslideshow')->__('Visible In'),
55
+ 'required' => true,
56
+ 'name' => 'stores[]',
57
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(),
58
+ ));
59
+ }
60
+ else {
61
+ $fieldset->addField('stores', 'hidden', array(
62
+ 'name' => 'stores[]',
63
+ 'value' => Mage::app()->getStore(true)->getId()
64
+ ));
65
+ }
66
+
67
+
68
+ if( Mage::getSingleton('adminhtml/session')->getSlideshowData() ) {
69
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getSlideshowData());
70
+ Mage::getSingleton('adminhtml/session')->setSlideshowData(null);
71
+ }
72
+
73
+ return parent::_prepareForm();
74
+ }
75
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Add/Tab/Image.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Add_Tab_Image extends Mage_Adminhtml_Block_Widget {
20
+
21
+ protected function _prepareForm() {
22
+ $data = $this->getRequest()->getPost();
23
+ $form = new Varien_Data_Form();
24
+ $form->setValues($data);
25
+ $this->setForm($form);
26
+
27
+ return parent::_prepareForm();
28
+ }
29
+
30
+ public function __construct() {
31
+ parent::__construct();
32
+ $this->setTemplate('mgs_responsiveslideshow/edit/tab/image.phtml');
33
+ $this->setId('media_gallery_content');
34
+ $this->setHtmlId('media_gallery_content');
35
+ }
36
+
37
+ protected function _prepareLayout() {
38
+ $this->setChild('uploader',
39
+ $this->getLayout()->createBlock('adminhtml/media_uploader')
40
+ );
41
+
42
+ $this->getUploader()->getConfig()
43
+ ->setUrl(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/*/image'))
44
+ ->setFileField('image')
45
+ ->setFilters(array(
46
+ 'images' => array(
47
+ 'label' => Mage::helper('adminhtml')->__('Images (.gif, .jpg, .png)'),
48
+ 'files' => array('*.gif', '*.jpg','*.jpeg', '*.png')
49
+ )
50
+ ));
51
+
52
+ $this->setChild(
53
+ 'delete_button',
54
+ $this->getLayout()->createBlock('adminhtml/widget_button')
55
+ ->addData(array(
56
+ 'id' => '{{id}}-delete',
57
+ 'class' => 'delete',
58
+ 'type' => 'button',
59
+ 'label' => Mage::helper('adminhtml')->__('Remove'),
60
+ 'onclick' => $this->getJsObjectName() . '.removeFile(\'{{fileId}}\')'
61
+ ))
62
+ );
63
+
64
+ return parent::_prepareLayout();
65
+ }
66
+
67
+ /**
68
+ * Retrive uploader block
69
+ *
70
+ * @return Mage_Adminhtml_Block_Media_Uploader
71
+ */
72
+ public function getUploader() {
73
+ return $this->getChild('uploader');
74
+ }
75
+
76
+ /**
77
+ * Retrive uploader block html
78
+ *
79
+ * @return string
80
+ */
81
+ public function getUploaderHtml() {
82
+ return $this->getChildHtml('uploader');
83
+ }
84
+
85
+ public function getJsObjectName() {
86
+ return $this->getHtmlId() . 'JsObject';
87
+ }
88
+
89
+ public function getAddImagesButton() {
90
+ return $this->getButtonHtml(
91
+ Mage::helper('catalog')->__('Add New Images'),
92
+ $this->getJsObjectName() . '.showUploader()',
93
+ 'add',
94
+ $this->getHtmlId() . '_add_images_button'
95
+ );
96
+ }
97
+
98
+ public function getImagesJson() {
99
+ $_model = Mage::registry('slideshow_data');
100
+ $_data = $_model->getImage();
101
+ if (is_array($_data) and sizeof($_data) > 0) {
102
+ $_result = array();
103
+ foreach ($_data as &$_item) {
104
+ $_result[] = array(
105
+ 'value_id' => $_item['image_id'],
106
+ 'url' => Mage::getSingleton('aslideshow/config')->getBaseMediaUrl() . $_item['file'],
107
+ 'file' => $_item['file'],
108
+ 'label' => $_item['label'],
109
+ 'position' => $_item['position'],
110
+ 'disabled' => $_item['disabled']);
111
+ }
112
+ return Zend_Json::encode($_result);
113
+ }
114
+ return '[]';
115
+ }
116
+
117
+ public function getImagesValuesJson() {
118
+ $values = array();
119
+
120
+ return Zend_Json::encode($values);
121
+ }
122
+
123
+
124
+ /**
125
+ * Enter description here...
126
+ *
127
+ * @return array
128
+ */
129
+ public function getMediaAttributes() {
130
+
131
+ }
132
+
133
+ public function getImageTypes() {
134
+ $type = array();
135
+ $type['gallery']['label'] = "aslideshow";
136
+ $type['gallery']['field'] = "aslideshow";
137
+
138
+ $imageTypes = array();
139
+
140
+ return $type;
141
+ }
142
+
143
+ public function getImageTypesJson() {
144
+ return Zend_Json::encode($this->getImageTypes());
145
+ }
146
+
147
+ public function getCustomRemove() {
148
+ return $this->setChild(
149
+ 'delete_button',
150
+ $this->getLayout()->createBlock('adminhtml/widget_button')
151
+ ->addData(array(
152
+ 'id' => '{{id}}-delete',
153
+ 'class' => 'delete',
154
+ 'type' => 'button',
155
+ 'label' => Mage::helper('adminhtml')->__('Remove'),
156
+ 'onclick' => $this->getJsObjectName() . '.removeFile(\'{{fileId}}\')'
157
+ ))
158
+ );
159
+ }
160
+
161
+ public function getDeleteButtonHtml() {
162
+ return $this->getChildHtml('delete_button');
163
+ }
164
+
165
+ public function getCustomValueId() {
166
+ return $this->setChild(
167
+ 'value_id',
168
+ $this->getLayout()->createBlock('adminhtml/widget_button')
169
+ ->addData(array(
170
+ 'id' => '{{id}}-value',
171
+ 'class' => 'value_id',
172
+ 'type' => 'text',
173
+ 'label' => Mage::helper('adminhtml')->__('ValueId'),
174
+ ))
175
+ );
176
+ }
177
+
178
+ public function getValueIdHtml() {
179
+ return $this->getChildHtml('value_id');
180
+ }
181
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Add/Tab/Page.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Add_Tab_Page extends Mage_Adminhtml_Block_Widget_Form
20
+ {
21
+ protected function _prepareForm()
22
+ {
23
+ $form = new Varien_Data_Form();
24
+ $this->setForm($form);
25
+
26
+ $fieldset = $form->addFieldset('aslideshow_form', array('legend'=>Mage::helper('aslideshow')->__('Slideshow Pages')));
27
+ $fieldset->addField('pages', 'multiselect', array(
28
+ 'label' => Mage::helper('aslideshow')->__('Visible In'),
29
+ 'required' => true,
30
+ 'name' => 'pages[]',
31
+ 'values' => Mage::getSingleton('aslideshow/config_source_page')->toOptionArray(),
32
+ ));
33
+
34
+ return parent::_prepareForm();
35
+ }
36
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Add/Tabs.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Add_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
20
+ {
21
+
22
+ public function __construct()
23
+ {
24
+ parent::__construct();
25
+ $this->setId('aslideshow_tabs');
26
+ $this->setDestElementId('edit_form');
27
+ $this->setTitle(Mage::helper('aslideshow')->__('Slideshow Information'));
28
+ }
29
+
30
+ protected function _beforeToHtml()
31
+ {
32
+ $this->addTab('general_section', array(
33
+ 'label' => Mage::helper('aslideshow')->__('General Information'),
34
+ 'title' => Mage::helper('aslideshow')->__('General Information'),
35
+ 'content' => $this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_add_tab_form')->toHtml(),
36
+ ))->addTab('image_section', array(
37
+ 'label' => Mage::helper('aslideshow')->__('Slideshow Images'),
38
+ 'title' => Mage::helper('aslideshow')->__('Slideshow Images'),
39
+ 'content' => $this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_add_tab_image')->toHtml(),
40
+ ))->addTab('page_section', array(
41
+ 'label' => Mage::helper('aslideshow')->__('Display on Pages'),
42
+ 'title' => Mage::helper('aslideshow')->__('Display on Pages'),
43
+ 'content' => $this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_add_tab_page')->toHtml(),
44
+ ))->addTab('category_section', array(
45
+ 'label' => Mage::helper('aslideshow')->__('Display on Categories'),
46
+ 'title' => Mage::helper('aslideshow')->__('Display on Categories'),
47
+ 'content' => $this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_add_tab_category')->toHtml(),
48
+ ));
49
+
50
+ return parent::_beforeToHtml();
51
+ }
52
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
20
+ {
21
+ public function __construct()
22
+ {
23
+ parent::__construct();
24
+
25
+ $this->_objectId = 'id';
26
+ $this->_blockGroup = 'aslideshow';
27
+ $this->_controller = 'adminhtml_slideshow';
28
+
29
+ $this->_updateButton('save', 'label', Mage::helper('aslideshow')->__('Save Slideshow'));
30
+ $this->_updateButton('delete', 'label', Mage::helper('aslideshow')->__('Delete Slideshow'));
31
+
32
+ $this->_addButton('saveandcontinue', array(
33
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
34
+ 'onclick' => 'saveAndContinueEdit()',
35
+ 'class' => 'save',
36
+ ), -100);
37
+
38
+ $this->_formScripts[] = "
39
+ function saveAndContinueEdit(){
40
+ editForm.submit($('edit_form').action+'back/edit/');
41
+ }
42
+ ";
43
+ }
44
+
45
+ public function getHeaderText()
46
+ {
47
+ return Mage::helper('aslideshow')->__("Edit Slideshow '%s'", $this->htmlEscape(Mage::registry('slideshow_data')->getName()));
48
+ }
49
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Form.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
20
+ protected function _prepareForm() {
21
+ $form = new Varien_Data_Form(
22
+ array(
23
+ 'id' => 'edit_form',
24
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
25
+ 'method' => 'post',
26
+ )
27
+ );
28
+
29
+ $form->setUseContainer(true);
30
+ $this->setForm($form);
31
+ return parent::_prepareForm();
32
+ }
33
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Ajax/Serializer.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2011 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
+ *
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Edit_Tab_Ajax_Serializer extends Mage_Core_Block_Template
35
+ {
36
+ public function _construct()
37
+ {
38
+ parent::_construct();
39
+ $this->setTemplate('mgs_responsiveslideshow/edit/serializer.phtml');
40
+ return $this;
41
+ }
42
+
43
+ public function getProductsJSON()
44
+ {
45
+ $result = array();
46
+ if ($this->getProducts()) {
47
+ $isEntityId = $this->getIsEntityId();
48
+ foreach ($this->getProducts() as $product) {
49
+ $id = $isEntityId ? $product->getEntityId() : $product->getId();
50
+ $result[$id] = $product->toArray(array('qty', 'position'));
51
+ }
52
+ }
53
+ return $result ? Zend_Json::encode($result) : '{}';
54
+ }
55
+
56
+ /**
57
+ * Initialize grid block under the "Related Products", "Up-sells", "Cross-sells" sections
58
+ *
59
+ * @param string $blockName
60
+ * @param string $getProductFunction
61
+ * @param string $inputName
62
+ */
63
+ public function initSerializerBlock($blockName, $getProductFunction, $inputName)
64
+ {
65
+ if ($block = $this->getLayout()->getBlock($blockName)) {
66
+ $this->setGridBlock($block)
67
+ ->setProducts(Mage::registry('current_slideshow')->$getProductFunction())
68
+ ->setInputElementName($inputName);
69
+ }
70
+ }
71
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Category.php ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Edit_Tab_Category extends Mage_Adminhtml_Block_Catalog_Category_Tree
20
+ {
21
+ protected $_categoryIds;
22
+ protected $_selectedNodes = null;
23
+
24
+ public function __construct()
25
+ {
26
+ parent::__construct();
27
+ $this->setTemplate('mgs_responsiveslideshow/edit/tab/category.phtml');
28
+ }
29
+
30
+ /**
31
+ * Retrieve currently edited product
32
+ *
33
+ * @return Mage_Catalog_Model_Product
34
+ */
35
+ public function getSlideshow()
36
+ {
37
+ return Mage::registry('current_slideshow');
38
+ }
39
+
40
+ /**
41
+ * Checks when this block is readonly
42
+ *
43
+ * @return boolean
44
+ */
45
+ public function isReadonly()
46
+ {
47
+ return $this->getSlideshow()->getCategoriesReadonly();
48
+ }
49
+
50
+ protected function getCategoryIds()
51
+ {
52
+ $_categoryList = $this->getSlideshow()->getCategoryId();
53
+ return is_array($_categoryList) ? $_categoryList : array();
54
+ }
55
+
56
+ public function getIdsString()
57
+ {
58
+ return implode(',', $this->getCategoryIds());
59
+ }
60
+
61
+ public function getRootNode()
62
+ {
63
+ // $root = parent::getRoot();
64
+ $root = $this->getRoot();
65
+ if ($root && in_array($root->getId(), $this->getCategoryIds())) {
66
+ $root->setChecked(true);
67
+ }
68
+ return $root;
69
+ }
70
+
71
+ public function getRoot($parentNodeCategory=null, $recursionLevel=3)
72
+ {
73
+ if (!is_null($parentNodeCategory) && $parentNodeCategory->getId()) {
74
+ return $this->getNode($parentNodeCategory, $recursionLevel);
75
+ }
76
+ $root = Mage::registry('root');
77
+ if (is_null($root)) {
78
+ $storeId = (int) $this->getRequest()->getParam('store');
79
+
80
+ if ($storeId) {
81
+ $store = Mage::app()->getStore($storeId);
82
+ $rootId = $store->getRootCategoryId();
83
+ }
84
+ else {
85
+ $rootId = Mage_Catalog_Model_Category::TREE_ROOT_ID;
86
+ }
87
+
88
+ $ids = $this->getSelectedCategoriesPathIds($rootId);
89
+ $tree = Mage::getResourceSingleton('catalog/category_tree')
90
+ ->loadByIds($ids, false, false);
91
+
92
+ if ($this->getCategory()) {
93
+ $tree->loadEnsuredNodes($this->getCategory(), $tree->getNodeById($rootId));
94
+ }
95
+
96
+ $tree->addCollectionData($this->getCategoryCollection());
97
+
98
+ $root = $tree->getNodeById($rootId);
99
+
100
+ if ($root && $rootId != Mage_Catalog_Model_Category::TREE_ROOT_ID) {
101
+ $root->setIsVisible(true);
102
+ if ($this->isReadonly()) {
103
+ $root->setDisabled(true);
104
+ }
105
+ }
106
+ elseif($root && $root->getId() == Mage_Catalog_Model_Category::TREE_ROOT_ID) {
107
+ $root->setName(Mage::helper('catalog')->__('Root'));
108
+ }
109
+
110
+ Mage::register('root', $root);
111
+ }
112
+
113
+ return $root;
114
+ }
115
+
116
+ protected function _getNodeJson($node, $level=1)
117
+ {
118
+ $item = parent::_getNodeJson($node, $level);
119
+
120
+ $isParent = $this->_isParentSelectedCategory($node);
121
+
122
+ if ($isParent) {
123
+ $item['expanded'] = true;
124
+ }
125
+
126
+ // if ($node->getLevel() > 1 && !$isParent && isset($item['children'])) {
127
+ // $item['children'] = array();
128
+ // }
129
+
130
+
131
+ if (in_array($node->getId(), $this->getCategoryIds())) {
132
+ $item['checked'] = true;
133
+ }
134
+
135
+ if ($this->isReadonly()) {
136
+ $item['disabled'] = true;
137
+ }
138
+ return $item;
139
+ }
140
+
141
+ protected function _isParentSelectedCategory($node)
142
+ {
143
+ foreach ($this->_getSelectedNodes() as $selected) {
144
+ if ($selected) {
145
+ $pathIds = explode('/', $selected->getPathId());
146
+ if (in_array($node->getId(), $pathIds)) {
147
+ return true;
148
+ }
149
+ }
150
+ }
151
+
152
+ return false;
153
+ }
154
+
155
+ protected function _getSelectedNodes()
156
+ {
157
+ if ($this->_selectedNodes === null) {
158
+ $this->_selectedNodes = array();
159
+ $root = $this->getRoot();
160
+ foreach ($this->getCategoryIds() as $categoryId) {
161
+ if ($root) {
162
+ $this->_selectedNodes[] = $root->getTree()->getNodeById($categoryId);
163
+ }
164
+ }
165
+ }
166
+
167
+ return $this->_selectedNodes;
168
+ }
169
+
170
+ public function getCategoryChildrenJson($categoryId)
171
+ {
172
+ $category = Mage::getModel('catalog/category')->load($categoryId);
173
+ $node = $this->getRoot($category, 1)->getTree()->getNodeById($categoryId);
174
+
175
+ if (!$node || !$node->hasChildren()) {
176
+ return '[]';
177
+ }
178
+
179
+ $children = array();
180
+ foreach ($node->getChildren() as $child) {
181
+ $children[] = $this->_getNodeJson($child);
182
+ }
183
+
184
+ return Mage::helper('aslideshow')->jsonEncode($children);
185
+ }
186
+
187
+ public function getLoadTreeUrl($expanded=null)
188
+ {
189
+ return $this->getUrl('*/*/categoriesJson', array('_current'=>true));
190
+ }
191
+
192
+ /**
193
+ * Return distinct path ids of selected categories
194
+ *
195
+ * @param int $rootId Root category Id for context
196
+ * @return array
197
+ */
198
+ public function getSelectedCategoriesPathIds($rootId = false)
199
+ {
200
+ $ids = array();
201
+ $collection = Mage::getModel('catalog/category')->getCollection()
202
+ ->addFieldToFilter('entity_id', array('in'=>$this->getCategoryIds()));
203
+ foreach ($collection as $item) {
204
+ if ($rootId && !in_array($rootId, $item->getPathIds())) {
205
+ continue;
206
+ }
207
+ foreach ($item->getPathIds() as $id) {
208
+ if (!in_array($id, $ids)) {
209
+ $ids[] = $id;
210
+ }
211
+ }
212
+ }
213
+ return $ids;
214
+ }
215
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Form.php ADDED
@@ -0,0 +1,460 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
20
+ {
21
+ protected function _prepareForm()
22
+ {
23
+ $_model = Mage::registry('slideshow_data');
24
+ $form = new Varien_Data_Form();
25
+ $this->setForm($form);
26
+
27
+ //General Information
28
+
29
+ $fieldset = $form->addFieldset('aslideshow_form', array('legend'=>Mage::helper('aslideshow')->__('General Information')));
30
+ $fieldset->addField('name', 'text', array(
31
+ 'label' => Mage::helper('aslideshow')->__('Title'),
32
+ 'class' => 'required-entry',
33
+ 'required' => true,
34
+ 'name' => 'name',
35
+ 'value' => $_model->getName()
36
+ ));
37
+
38
+ $fieldset->addField('slideshow_for', 'select', array(
39
+ 'label' => Mage::helper('aslideshow')->__('Slideshow For'),
40
+ 'name' => 'slideshow_for',
41
+ 'required' => true,
42
+ 'values' => Mage::getSingleton('aslideshow/config_source_position')->toSlideshowForArray(),
43
+ 'value' => $_model->getSlideshowFor()
44
+ ));
45
+
46
+ $fieldset->addField('slideshow_position', 'select', array(
47
+ 'label' => Mage::helper('aslideshow')->__('Position'),
48
+ 'name' => 'slideshow_position',
49
+ 'required' => true,
50
+ 'values' => Mage::getSingleton('aslideshow/config_source_position')->toOptionArray(),
51
+ 'value' => $_model->getSlideshowPosition()
52
+ ));
53
+
54
+ $fieldset->addField('sort_order', 'text', array(
55
+ 'label' => Mage::helper('aslideshow')->__('Sort Order'),
56
+ 'required' => false,
57
+ 'name' => 'sort_order',
58
+ 'value' => $_model->getSortOrder()
59
+ ));
60
+
61
+ $fieldset->addField('is_active', 'select', array(
62
+ 'label' => Mage::helper('aslideshow')->__('Is Active'),
63
+ 'name' => 'is_active',
64
+ 'required' => true,
65
+ 'values' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray(),
66
+ 'value' => $_model->getIsActive()
67
+ ));
68
+
69
+ if (!Mage::app()->isSingleStoreMode()) {
70
+ $fieldset->addField('stores', 'multiselect', array(
71
+ 'label' => Mage::helper('aslideshow')->__('Visible In'),
72
+ 'required' => true,
73
+ 'name' => 'stores[]',
74
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(),
75
+ 'value' => $_model->getStoreId()
76
+ ));
77
+ }
78
+ else {
79
+ $fieldset->addField('stores', 'hidden', array(
80
+ 'name' => 'stores[]',
81
+ 'value' => Mage::app()->getStore(true)->getId()
82
+ ));
83
+ }
84
+
85
+ //Global Slideshow Setting
86
+
87
+ $fieldset = $form->addFieldset('aslideshow_form2', array('legend'=>Mage::helper('aslideshow')->__('Global Slideshow Setting')));
88
+
89
+ $fieldset->addField('show_text', 'select', array(
90
+ 'label' => Mage::helper('aslideshow')->__('Show Text'),
91
+ 'name' => 'show_text',
92
+ 'values' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray(),
93
+ 'value' => $_model->getShowText()
94
+ ));
95
+
96
+ $fieldset->addField('image_width', 'text', array(
97
+ 'label' => Mage::helper('aslideshow')->__('Slideshow Width'),
98
+ 'required' => true,
99
+ 'name' => 'image_width',
100
+ 'value' => $_model->getImageWidth()
101
+ ));
102
+
103
+ $fieldset->addField('image_height', 'text', array(
104
+ 'label' => Mage::helper('aslideshow')->__('Slideshow Height'),
105
+ 'required' => true,
106
+ 'name' => 'image_height',
107
+ 'value' => $_model->getImageHeight()
108
+ ));
109
+
110
+ //FlexSlider: Default Settings
111
+
112
+ $fieldset->addField('transition', 'select', array(
113
+ 'label' => Mage::helper('aslideshow')->__('Transition'),
114
+ 'name' => 'transition',
115
+ 'required' => true,
116
+ 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTransitionArray(),
117
+ 'value' => $_model->getTransition()
118
+ ));
119
+
120
+ $fieldset->addField('animation', 'select', array(
121
+ 'label' => Mage::helper('aslideshow')->__('Animation'),
122
+ 'name' => 'animation',
123
+ 'required' => true,
124
+ 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toAnimationArray(),
125
+ 'value' => $_model->getAnimation()
126
+ ));
127
+
128
+ $fieldset->addField('direction', 'select', array(
129
+ 'label' => Mage::helper('aslideshow')->__('Direction'),
130
+ 'name' => 'direction',
131
+ 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toDirectionArray(),
132
+ 'value' => $_model->getDirection()
133
+ ));
134
+
135
+ $fieldset->addField('animation_loop', 'select', array(
136
+ 'label' => Mage::helper('aslideshow')->__('Animation Loop'),
137
+ 'name' => 'animation_loop',
138
+ 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
139
+ 'value' => $_model->getAnimationLoop()
140
+ ));
141
+
142
+ $fieldset->addField('smooth_height', 'select', array(
143
+ 'label' => Mage::helper('aslideshow')->__('Smooth Height'),
144
+ 'name' => 'smooth_height',
145
+ 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
146
+ 'value' => $_model->getSmoothHeight()
147
+ ));
148
+
149
+ $fieldset->addField('start_at', 'text', array(
150
+ 'label' => Mage::helper('aslideshow')->__('Start At'),
151
+ 'required' => true,
152
+ 'name' => 'start_at',
153
+ 'value' => $_model->getStartAt()
154
+ ));
155
+
156
+ $fieldset->addField('slideshow', 'select', array(
157
+ 'label' => Mage::helper('aslideshow')->__('Auto Play'),
158
+ 'name' => 'slideshow',
159
+ 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
160
+ 'value' => $_model->getSlideshow()
161
+ ));
162
+
163
+ $fieldset->addField('slideshow_speed', 'text', array(
164
+ 'label' => Mage::helper('aslideshow')->__('Slideshow Speed'),
165
+ 'required' => true,
166
+ 'name' => 'slideshow_speed',
167
+ 'value' => $_model->getSlideshowSpeed()
168
+ ));
169
+
170
+ $fieldset->addField('animation_speed', 'text', array(
171
+ 'label' => Mage::helper('aslideshow')->__('Animation Speed'),
172
+ 'required' => true,
173
+ 'name' => 'animation_speed',
174
+ 'value' => $_model->getAnimationSpeed()
175
+ ));
176
+
177
+ $fieldset->addField('init_delay', 'text', array(
178
+ 'label' => Mage::helper('aslideshow')->__('Init Delay'),
179
+ 'required' => true,
180
+ 'name' => 'init_delay',
181
+ 'value' => $_model->getInitDelay()
182
+ ));
183
+
184
+ $fieldset->addField('randomize', 'select', array(
185
+ 'label' => Mage::helper('aslideshow')->__('Randomize'),
186
+ 'name' => 'randomize',
187
+ 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
188
+ 'value' => $_model->getRandomize()
189
+ ));
190
+
191
+ $fieldset->addField('background_opacity', 'select', array(
192
+ 'label' => Mage::helper('aslideshow')->__('Background Opacity'),
193
+ 'name' => 'background_opacity',
194
+ 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toOpacityArray(),
195
+ 'value' => $_model->getBackgroundOpacity()
196
+ ));
197
+
198
+ $fieldset->addField('control_nav', 'select', array(
199
+ 'label' => Mage::helper('aslideshow')->__('Control Nav'),
200
+ 'name' => 'control_nav',
201
+ 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toControlNavArray(),
202
+ 'value' => $_model->getControlNav()
203
+ ));
204
+
205
+ //FlexSlider: Width & Margin for carousel Settings
206
+
207
+ $fieldset = $form->addFieldset('aslideshow_form5', array('legend'=>Mage::helper('aslideshow')->__('')));
208
+
209
+ $fieldset->addField('item_width', 'text', array(
210
+ 'label' => Mage::helper('aslideshow')->__('Item (thumbnails) Width'),
211
+ 'name' => 'item_width',
212
+ 'value' => $_model->getItemWidth()
213
+ ));
214
+
215
+ $fieldset->addField('item_margin', 'text', array(
216
+ 'label' => Mage::helper('aslideshow')->__('Item (thumbnails) Margin'),
217
+ 'name' => 'item_margin',
218
+ 'value' => $_model->getItemMargin()
219
+ ));
220
+
221
+ //FlexSlider: Min & Max items for M-M carousel Settings
222
+
223
+ $fieldset = $form->addFieldset('aslideshow_form6', array('legend'=>Mage::helper('aslideshow')->__('')));
224
+
225
+ $fieldset->addField('min_items', 'text', array(
226
+ 'label' => Mage::helper('aslideshow')->__('Min Items'),
227
+ 'name' => 'min_items',
228
+ 'value' => $_model->getMinItems()
229
+ ));
230
+
231
+ $fieldset->addField('max_items', 'text', array(
232
+ 'label' => Mage::helper('aslideshow')->__('Max Items'),
233
+ 'name' => 'max_items',
234
+ 'value' => $_model->getMaxItems()
235
+ ));
236
+
237
+ //FlexSlider: Video Settings
238
+
239
+ //$fieldset = $form->addFieldset('aslideshow_form7', array('legend'=>Mage::helper('aslideshow')->__('')));
240
+ //
241
+ //$fieldset->addField('use_css', 'select', array(
242
+ // 'label' => Mage::helper('aslideshow')->__('Use CSS'),
243
+ // 'name' => 'use_css',
244
+ // 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
245
+ // 'value' => $_model->getUseCss()
246
+ //));
247
+
248
+ // $fieldset->addField('between_block_delay', 'text', array(
249
+ // 'label' => Mage::helper('aslideshow')->__('Delay'),
250
+ // 'required' => true,
251
+ // 'name' => 'between_block_delay',
252
+ // 'value' => $_model->getBetweenBlockDelay()
253
+ // ));
254
+
255
+ // $fieldset->addField('auto_rotation', 'select', array(
256
+ // 'label' => Mage::helper('aslideshow')->__('Auto Repeat'),
257
+ // 'name' => 'auto_rotation',
258
+ // 'required' => true,
259
+ // 'values' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray(),
260
+ // 'value' => $_model->getAutoRotation()
261
+ // ));
262
+
263
+ // $fieldset->addField('auto_rotation_speed', 'text', array(
264
+ // 'label' => Mage::helper('aslideshow')->__('Auto Rotation Speed'),
265
+ // 'required' => true,
266
+ // 'name' => 'auto_rotation_speed',
267
+ // 'value' => $_model->getAutoRotationSpeed()
268
+ // ));
269
+
270
+ // $fieldset->addField('slide_controlls', 'select', array(
271
+ // 'label' => Mage::helper('aslideshow')->__('Slide Controllers'),
272
+ // 'name' => 'slide_controlls',
273
+ // 'required' => true,
274
+ // 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toSlideControllsArray(),
275
+ // 'value' => $_model->getSlideControlls()
276
+ // ));
277
+
278
+ // $fieldset->addField('slider_automatically', 'select', array(
279
+ // 'label' => Mage::helper('aslideshow')->__('Auto Play'),
280
+ // 'name' => 'slider_automatically',
281
+ // 'required' => true,
282
+ // 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
283
+ // 'value' => $_model->getSliderAutomatically()
284
+ // ));
285
+
286
+ // $fieldset->addField('touch_enabled', 'select', array(
287
+ // 'label' => Mage::helper('aslideshow')->__('Touch Enabled'),
288
+ // 'name' => 'touch_enabled',
289
+ // 'required' => true,
290
+ // 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
291
+ // 'value' => $_model->getTouchEnabled()
292
+ // ));
293
+
294
+ // $this->setChild('form_aft',$this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
295
+ // ->addFieldMap($transition->getHtmlId(),$transition->getName())
296
+ // ->addFieldMap($animation_speed->getHtmlId(),$animation_speed->getName())
297
+ // ->addFieldDependence($animation_speed->getName(),$transition->getName(),'index'));
298
+
299
+
300
+
301
+ // $fieldset->addField('display', 'text', array(
302
+ // 'label' => Mage::helper('aslideshow')->__('Start At'),
303
+ // 'required' => true,
304
+ // 'name' => 'display',
305
+ // 'value' => $_model->getDisplay()
306
+ // ));
307
+
308
+
309
+
310
+ //$fieldset->addField('pause_on_action', 'select', array(
311
+ // 'label' => Mage::helper('aslideshow')->__('Pause on Action'),
312
+ // 'name' => 'pause_on_action',
313
+ // 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
314
+ // 'value' => $_model->getPauseOnAction()
315
+ //));
316
+ //
317
+ //$fieldset->addField('pause_on_hover', 'select', array(
318
+ // 'label' => Mage::helper('aslideshow')->__('Pause on Hover'),
319
+ // 'name' => 'pause_on_hover',
320
+ // 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
321
+ // 'value' => $_model->getPauseOnHover()
322
+ //));
323
+ //
324
+ //
325
+ //
326
+ //$fieldset->addField('touch', 'select', array(
327
+ // 'label' => Mage::helper('aslideshow')->__('Touch'),
328
+ // 'name' => 'touch',
329
+ // 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
330
+ // 'value' => $_model->getTouch()
331
+ //));
332
+ //
333
+ //$fieldset->addField('video', 'select', array(
334
+ // 'label' => Mage::helper('aslideshow')->__('Video'),
335
+ // 'name' => 'video',
336
+ // 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
337
+ // 'value' => $_model->getVideo()
338
+ //));
339
+ //
340
+ //$fieldset->addField('direction_nav', 'select', array(
341
+ // 'label' => Mage::helper('aslideshow')->__('Direction Button'),
342
+ // 'name' => 'direction_nav',
343
+ // 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
344
+ // 'value' => $_model->getDirectionNav()
345
+ //));
346
+ //
347
+ //$fieldset->addField('keyboard', 'select', array(
348
+ // 'label' => Mage::helper('aslideshow')->__('Allow Keyboard'),
349
+ // 'name' => 'keyboard',
350
+ // 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
351
+ // 'value' => $_model->getKeyboard()
352
+ //));
353
+ //
354
+ //$fieldset->addField('multiple_keyboard', 'select', array(
355
+ // 'label' => Mage::helper('aslideshow')->__('Multiple Keyboard'),
356
+ // 'name' => 'multiple_keyboard',
357
+ // 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
358
+ // 'value' => $_model->getMultipleKeyboard()
359
+ //));
360
+ //
361
+ //$fieldset->addField('mousewheel', 'select', array(
362
+ // 'label' => Mage::helper('aslideshow')->__('Mousewheel'),
363
+ // 'name' => 'mousewheel',
364
+ // 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
365
+ // 'value' => $_model->getMousewheel()
366
+ //));
367
+ //
368
+ //$fieldset->addField('pause_play', 'select', array(
369
+ // 'label' => Mage::helper('aslideshow')->__('Pause & Play'),
370
+ // 'name' => 'pause_play',
371
+ // 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toTrueFalseArray(),
372
+ // 'value' => $_model->getPausePlay()
373
+ //));
374
+
375
+ //setting for product
376
+
377
+ $fieldset = $form->addFieldset('aslideshow_form3', array('legend'=>Mage::helper('aslideshow')->__('')));
378
+
379
+ $fieldset->addField('product_image_width', 'text', array(
380
+ 'label' => Mage::helper('aslideshow')->__('Product Image Width'),
381
+ 'name' => 'product_image_width',
382
+ 'value' => $_model->getProductImageWidth()
383
+ ));
384
+
385
+ $fieldset->addField('product_image_height', 'text', array(
386
+ 'label' => Mage::helper('aslideshow')->__('Product Image Height'),
387
+ 'name' => 'product_image_height',
388
+ 'value' => $_model->getProductImageHeight()
389
+ ));
390
+
391
+ $fieldset->addField('show_price', 'select', array(
392
+ 'label' => Mage::helper('aslideshow')->__('Show Price'),
393
+ 'name' => 'show_price',
394
+ 'values' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray(),
395
+ 'value' => $_model->getShowPrice()
396
+ ));
397
+
398
+ $fieldset->addField('show_title', 'select', array(
399
+ 'label' => Mage::helper('aslideshow')->__('Show Product Title'),
400
+ 'name' => 'show_title',
401
+ 'values' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray(),
402
+ 'value' => $_model->getShowTitle()
403
+ ));
404
+
405
+ $fieldset->addField('show_description', 'select', array(
406
+ 'label' => Mage::helper('aslideshow')->__('Show Description'),
407
+ 'name' => 'show_description',
408
+ 'values' => Mage::getSingleton('aslideshow/config_source_setting')->toShowDescriptionArray(),
409
+ 'value' => $_model->getShowDescription()
410
+ ));
411
+
412
+ //setting for product (Dont need)
413
+ //$fieldset = $form->addFieldset('aslideshow_form4', array('legend'=>Mage::helper('aslideshow')->__('Slideshow Static Block Setting')));
414
+ //
415
+ //$fieldset->addField('staticblock_image_width', 'text', array(
416
+ // 'label' => Mage::helper('aslideshow')->__('Image Width'),
417
+ // 'name' => 'staticblock_image_width',
418
+ // 'value' => $_model->getStaticblockImageWidth()
419
+ //));
420
+ //
421
+ //$fieldset->addField('staticblock_image_height', 'text', array(
422
+ // 'label' => Mage::helper('aslideshow')->__('Image Height'),
423
+ // 'name' => 'staticblock_image_height',
424
+ // 'value' => $_model->getStaticblockImageHeight()
425
+ //));
426
+
427
+ //Example: (Adding Field Dependency In Magento Admin)
428
+
429
+ //$transition2 = $fieldset->addField('transition2','select',array(
430
+ // 'label' => Mage::helper('aslideshow')->__('Transition 2'),
431
+ // 'name' => 'transition2',
432
+ // 'values' => array(
433
+ // 0 => 'Index',
434
+ // 1 => 'Carousel',
435
+ // 2 => 'Video'
436
+ // ),
437
+ // 'required' => true
438
+ //));
439
+ //
440
+ //$animation_speed2 = $fieldset->addField('animation_speed2','text',array(
441
+ // 'label' => Mage::helper('aslideshow')->__('Animation Speed 2'),
442
+ // 'name' => 'animation_speed2',
443
+ // 'required'=>true,
444
+ //));
445
+
446
+ //$this->setChild('form_after',$this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
447
+ // ->addFieldMap($transition2->getHtmlId(),$transition2->getName())
448
+ // ->addFieldMap($animation_speed2->getHtmlId(),$animation_speed2->getName())
449
+ // ->addFieldDependence($animation_speed2->getName(),$transition2->getName(),1));
450
+
451
+ //End
452
+
453
+ if( Mage::getSingleton('adminhtml/session')->getSlideshowData() ) {
454
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getSlideshowData());
455
+ Mage::getSingleton('adminhtml/session')->setSlideshowData(null);
456
+ }
457
+
458
+ return parent::_prepareForm();
459
+ }
460
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Image.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Edit_Tab_Image extends Mage_Adminhtml_Block_Widget {
20
+
21
+ protected function _prepareForm() {
22
+ $data = $this->getRequest()->getPost();
23
+ $form = new Varien_Data_Form();
24
+ $form->setValues($data);
25
+ $this->setForm($form);
26
+
27
+ return parent::_prepareForm();
28
+ }
29
+
30
+ public function __construct() {
31
+ parent::__construct();
32
+ $this->setTemplate('mgs_responsiveslideshow/edit/tab/image.phtml');
33
+ $this->setId('media_gallery_content');
34
+ $this->setHtmlId('media_gallery_content');
35
+ }
36
+
37
+ protected function _prepareLayout() {
38
+ $this->setChild('uploader',
39
+ $this->getLayout()->createBlock('adminhtml/media_uploader')
40
+ );
41
+
42
+ $this->getUploader()->getConfig()
43
+ ->setUrl(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/*/image'))
44
+ ->setFileField('image')
45
+ ->setFilters(array(
46
+ 'images' => array(
47
+ 'label' => Mage::helper('adminhtml')->__('Images (.gif, .jpg, .png)'),
48
+ 'files' => array('*.gif', '*.jpg','*.jpeg', '*.png')
49
+ )
50
+ ));
51
+
52
+ $this->setChild(
53
+ 'delete_button',
54
+ $this->getLayout()->createBlock('adminhtml/widget_button')
55
+ ->addData(array(
56
+ 'id' => '{{id}}-delete',
57
+ 'class' => 'delete',
58
+ 'type' => 'button',
59
+ 'label' => Mage::helper('adminhtml')->__('Remove'),
60
+ 'onclick' => $this->getJsObjectName() . '.removeFile(\'{{fileId}}\')'
61
+ ))
62
+ );
63
+
64
+ return parent::_prepareLayout();
65
+ }
66
+
67
+ /**
68
+ * Retrive uploader block
69
+ *
70
+ * @return Mage_Adminhtml_Block_Media_Uploader
71
+ */
72
+ public function getUploader() {
73
+ return $this->getChild('uploader');
74
+ }
75
+
76
+ /**
77
+ * Retrive uploader block html
78
+ *
79
+ * @return string
80
+ */
81
+ public function getUploaderHtml() {
82
+ return $this->getChildHtml('uploader');
83
+ }
84
+
85
+ public function getJsObjectName() {
86
+ return $this->getHtmlId() . 'JsObject';
87
+ }
88
+
89
+ public function getAddImagesButton() {
90
+ return $this->getButtonHtml(
91
+ Mage::helper('catalog')->__('Add New Images'),
92
+ $this->getJsObjectName() . '.showUploader()',
93
+ 'add',
94
+ $this->getHtmlId() . '_add_images_button'
95
+ );
96
+ }
97
+
98
+ public function getImagesJson() {
99
+ $_model = Mage::registry('slideshow_data');
100
+ $_data = $_model->getImage();
101
+ if (is_array($_data) and sizeof($_data) > 0) {
102
+ $_result = array();
103
+ foreach ($_data as &$_item) {
104
+ $_result[] = array(
105
+ 'value_id' => $_item['image_id'],
106
+ 'url' => Mage::getSingleton('aslideshow/config')->getBaseMediaUrl() . $_item['file'],
107
+ 'file' => $_item['file'],
108
+ 'label' => $_item['label'],
109
+ 'caption' => $_item['caption'],
110
+ 'position' => $_item['position'],
111
+ 'disabled' => $_item['disabled']);
112
+ }
113
+ return Zend_Json::encode($_result);
114
+ }
115
+ return '[]';
116
+ }
117
+
118
+ public function getImagesValuesJson() {
119
+ $values = array();
120
+
121
+ return Zend_Json::encode($values);
122
+ }
123
+
124
+
125
+ /**
126
+ * Enter description here...
127
+ *
128
+ * @return array
129
+ */
130
+ public function getMediaAttributes() {
131
+
132
+ }
133
+
134
+ public function getImageTypes() {
135
+ $type = array();
136
+ $type['gallery']['label'] = "aslideshow";
137
+ $type['gallery']['field'] = "aslideshow";
138
+
139
+ $imageTypes = array();
140
+
141
+ return $type;
142
+ }
143
+
144
+ public function getImageTypesJson() {
145
+ return Zend_Json::encode($this->getImageTypes());
146
+ }
147
+
148
+ public function getCustomRemove() {
149
+ return $this->setChild(
150
+ 'delete_button',
151
+ $this->getLayout()->createBlock('adminhtml/widget_button')
152
+ ->addData(array(
153
+ 'id' => '{{id}}-delete',
154
+ 'class' => 'delete',
155
+ 'type' => 'button',
156
+ 'label' => Mage::helper('adminhtml')->__('Remove'),
157
+ 'onclick' => $this->getJsObjectName() . '.removeFile(\'{{fileId}}\')'
158
+ ))
159
+ );
160
+ }
161
+
162
+ public function getDeleteButtonHtml() {
163
+ return $this->getChildHtml('delete_button');
164
+ }
165
+
166
+ public function getCustomValueId() {
167
+ return $this->setChild(
168
+ 'value_id',
169
+ $this->getLayout()->createBlock('adminhtml/widget_button')
170
+ ->addData(array(
171
+ 'id' => '{{id}}-value',
172
+ 'class' => 'value_id',
173
+ 'type' => 'text',
174
+ 'label' => Mage::helper('adminhtml')->__('ValueId'),
175
+ ))
176
+ );
177
+ }
178
+
179
+ public function getValueIdHtml() {
180
+ return $this->getChildHtml('value_id');
181
+ }
182
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Page.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Edit_Tab_Page extends Mage_Adminhtml_Block_Widget_Form
20
+ {
21
+ protected function _prepareForm()
22
+ {
23
+ $_model = Mage::registry('slideshow_data');
24
+ $form = new Varien_Data_Form();
25
+ $this->setForm($form);
26
+
27
+ $fieldset = $form->addFieldset('aslideshow_form', array('legend'=>Mage::helper('aslideshow')->__('Slideshow Pages')));
28
+ $fieldset->addField('pages', 'multiselect', array(
29
+ 'label' => Mage::helper('aslideshow')->__('Visible In'),
30
+ 'required' => true,
31
+ 'name' => 'pages[]',
32
+ 'values' => Mage::getSingleton('aslideshow/config_source_page')->toOptionArray(),
33
+ 'value' => $_model->getPageId()
34
+ ));
35
+
36
+ return parent::_prepareForm();
37
+ }
38
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Products.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Edit_Tab_Products extends Mage_Adminhtml_Block_Widget_Grid
19
+ {
20
+ public function __construct()
21
+ {
22
+ parent::__construct();
23
+ $this->setId('slideshow_product_grid');
24
+ $this->setDefaultSort('entity_id');
25
+ $this->setTitle(Mage::helper('aslideshow')->__('Product Information'));
26
+ $this->setUseAjax(true);
27
+ }
28
+
29
+ protected function _getSlideshow()
30
+ {
31
+ return Mage::registry('current_slideshow');
32
+ }
33
+
34
+ protected function _addColumnFilterToCollection($column)
35
+ {
36
+ $id = $column->getId();
37
+ $value = $column->getFilter()->getValue();
38
+ //echo '<pre>'; print_r($value);
39
+ //$select = $this->getCollection()->getSelect();
40
+
41
+ // Set custom filter for in category flag
42
+ if ($column->getId() == 'in_slideshows') {
43
+ $productIds = $this->_getSelectedProducts();
44
+ if (empty($productIds)) {
45
+ $productIds = 0;
46
+ }
47
+ if ($column->getFilter()->getValue()) {
48
+ $this->getCollection()->addFieldToFilter('entity_id', array('in'=>$productIds));
49
+ }
50
+ elseif(!empty($productIds)) {
51
+ $this->getCollection()->addFieldToFilter('entity_id', array('nin'=>$productIds));
52
+ }
53
+ }
54
+ else {
55
+ parent::_addColumnFilterToCollection($column);
56
+ }
57
+ return $this;
58
+ }
59
+
60
+
61
+
62
+ protected function _prepareCollection()
63
+ {
64
+ if ($this->_getSlideshow()->getSlideshowId()) {
65
+ $this->setDefaultFilter(array('in_slideshows'=>1));
66
+ }
67
+ $collection = Mage::getModel('catalog/product')->getCollection()
68
+ ->addAttributeToSelect('*')
69
+ // ->addAttributeToSelect('sku')
70
+ // ->addAttributeToSelect('price')
71
+ ->addStoreFilter($this->getRequest()->getParam('store'))
72
+ // ->addAttributeToFilter('aslideshow_slideshow', $this->_getSlideshow()->getId());
73
+ // ->addAttributeToFilter('type_id', array('in'=>array('simple')))
74
+ ;
75
+ $res = Mage::getSingleton('core/resource');
76
+ $conn = $collection->getConnection();
77
+ $collection->getSelect()->joinLeft(
78
+ array('sproduct' => $res->getTableName('aslideshow/slideshow_product')),
79
+ $conn->quoteInto('sproduct.product_id=e.entity_id AND sproduct.slideshow_id=?', $this->_getSlideshow()->getSlideshowId()),
80
+ array()
81
+ );
82
+ //echo '<pre>'; print_r($collection->getSelect());
83
+ //if ($this->isReadonly()) {
84
+ $productIds = $this->_getSelectedProducts();
85
+ //echo '<pre>'; print_r($productIds);
86
+ if (empty($productIds)) {
87
+ $productIds = array(0);
88
+ }
89
+ //$collection->addFieldToFilter('entity_id', array('in' => $productIds));
90
+ //}
91
+ $this->setCollection($collection);
92
+
93
+ return parent::_prepareCollection();
94
+ }
95
+
96
+ protected function _prepareColumns()
97
+ {
98
+ $this->addColumn('in_slideshows', array(
99
+ 'header_css_class' => 'a-center',
100
+ 'type' => 'checkbox',
101
+ 'name' => 'in_slideshows',
102
+ 'values' => $this->_getSelectedProducts(),
103
+ 'align' => 'center',
104
+ 'index' => 'entity_id'
105
+ ));
106
+ $this->addColumn('entity_id', array(
107
+ 'header' => Mage::helper('catalog')->__('ID'),
108
+ 'sortable' => true,
109
+ 'width' => '60',
110
+ 'index' => 'entity_id'
111
+ ));
112
+ $this->addColumn('name_product', array(
113
+ 'header' => Mage::helper('catalog')->__('Name'),
114
+ 'index' => 'name'
115
+ ));
116
+ $this->addColumn('sku', array(
117
+ 'header' => Mage::helper('catalog')->__('SKU'),
118
+ 'width' => '80',
119
+ 'index' => 'sku'
120
+ ));
121
+ $this->addColumn('price', array(
122
+ 'header' => Mage::helper('catalog')->__('Price'),
123
+ 'type' => 'currency',
124
+ 'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
125
+ 'index' => 'price'
126
+ ));
127
+
128
+ $this->addColumn('position', array(
129
+ 'header' => Mage::helper('catalog')->__('Position'),
130
+ 'name' => 'position',
131
+ 'type' => 'number',
132
+ 'validate_class' => 'validate-number',
133
+ 'index' => 'position',
134
+ 'width' => 60,
135
+ 'editable' => true,//!$this->_getProduct()->getRelatedReadonly(),
136
+ 'edit_only' => true//!$this->_getProduct()->getId()
137
+ ));
138
+
139
+
140
+ return parent::_prepareColumns();
141
+ }
142
+
143
+ public function getGridUrl()
144
+ {
145
+ return $this->getUrl('*/*/productGrid', array('_current'=>true));
146
+ }
147
+
148
+ protected function _getSelectedProducts()
149
+ {
150
+ $json = $this->getRequest()->getPost('products_slideshow');
151
+ //echo '<pre>'; print_r($json);
152
+ if (!is_null($json)) {
153
+ //$products = array_keys((array)Zend_Json::decode($json));
154
+ $products = $json;
155
+ } else {
156
+ //echo '<pre>'; print_r($this->_getSlideshow()->getProductId());
157
+ //$products = array_keys($this->_getSlideshow()->getProductId());
158
+ $products = $this->_getSlideshow()->getProductId();
159
+ }
160
+ return $products;
161
+ }
162
+
163
+ /**
164
+ * Retrieve related products
165
+ *
166
+ * @return array
167
+ */
168
+ public function getSelectedSlideshowProducts()
169
+ {
170
+ $id = $this->getRequest()->getParam('id');
171
+ $_slideshow = Mage::getModel('aslideshow/slideshow')->load($id);
172
+ $products = array();
173
+ $productArrs = $_slideshow->getProduct();
174
+ if($productArrs) {
175
+ foreach($productArrs as $productObj) {
176
+ $products[$productObj['product_id']] = array('position' => $productObj['position']);
177
+ }
178
+ }
179
+ return $products;
180
+ }
181
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Staticblocks.php ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Edit_Tab_Staticblocks extends Mage_Adminhtml_Block_Widget_Grid
19
+ {
20
+ public function __construct()
21
+ {
22
+ parent::__construct();
23
+ $this->setId('slideshow_staticblock_grid');
24
+ $this->setDefaultSort('block_identifier');
25
+ $this->setTitle(Mage::helper('aslideshow')->__('Staticblock Information'));
26
+ $this->setUseAjax(true);
27
+ }
28
+
29
+ protected function _getSlideshow()
30
+ {
31
+ return Mage::registry('current_slideshow');
32
+ }
33
+
34
+ protected function _addColumnFilterToCollection($column)
35
+ {
36
+ $id = $column->getId();
37
+ $value = $column->getFilter()->getValue();
38
+
39
+ // Set custom filter for in category flag
40
+ if ($column->getId() == 'in_slideshows') {
41
+ $staticblockIds = $this->_getSelectedStaticblocks();
42
+ if (empty($staticblockIds)) {
43
+ $staticblockIds = 0;
44
+ }
45
+ if ($column->getFilter()->getValue()) {
46
+ $this->getCollection()->addFieldToFilter('block_id', array('in'=>$staticblockIds));
47
+ }
48
+ elseif(!empty($staticblockIds)) {
49
+ $this->getCollection()->addFieldToFilter('block_id', array('nin'=>$staticblockIds));
50
+ }
51
+ }
52
+ else {
53
+ parent::_addColumnFilterToCollection($column);
54
+ }
55
+ return $this;
56
+ }
57
+
58
+
59
+
60
+ protected function _prepareCollection()
61
+ {
62
+ if ($this->_getSlideshow()->getSlideshowId()) {
63
+ $this->setDefaultFilter(array('in_slideshows'=>1));
64
+ }
65
+
66
+ $collection = Mage::getModel('cms/block')->getCollection();
67
+ /* @var $collection Mage_Cms_Model_Mysql4_Block_Collection */
68
+
69
+ $res = Mage::getSingleton('core/resource');
70
+ $conn = $collection->getConnection();
71
+ $collection->getSelect()->joinLeft(
72
+ array('staticblock' => $res->getTableName('aslideshow/slideshow_staticblock')),
73
+ $conn->quoteInto('staticblock.staticblock_id=main_table.block_id AND staticblock.slideshow_id=?', $this->_getSlideshow()->getSlideshowId()),
74
+ array()
75
+ );
76
+ $staticblockIds = $this->_getSelectedStaticblocks();
77
+
78
+ if (empty($staticblockIds)) {
79
+ $staticblockIds = array(0);
80
+ }
81
+ $this->setCollection($collection);
82
+
83
+ return parent::_prepareCollection();
84
+ }
85
+
86
+ protected function _prepareColumns()
87
+ {
88
+ $baseUrl = $this->getUrl();
89
+ $this->addColumn('in_slideshows', array(
90
+ 'header_css_class' => 'a-center',
91
+ 'type' => 'checkbox',
92
+ 'name' => 'in_slideshows',
93
+ 'values' => $this->_getSelectedStaticblocks(),
94
+ 'align' => 'center',
95
+ 'index' => 'block_id'
96
+ ));
97
+ $this->addColumn('block_id', array(
98
+ 'header' => Mage::helper('catalog')->__('ID'),
99
+ 'sortable' => true,
100
+ 'width' => '60',
101
+ 'index' => 'block_id'
102
+ ));
103
+
104
+ $this->addColumn('title', array(
105
+ 'header' => Mage::helper('cms')->__('Title'),
106
+ 'align' => 'left',
107
+ 'index' => 'title',
108
+ ));
109
+
110
+ $this->addColumn('identifier', array(
111
+ 'header' => Mage::helper('cms')->__('Identifier'),
112
+ 'align' => 'left',
113
+ 'index' => 'identifier'
114
+ ));
115
+
116
+ if (!Mage::app()->isSingleStoreMode()) {
117
+ $this->addColumn('store_id', array(
118
+ 'header' => Mage::helper('cms')->__('Store View'),
119
+ 'index' => 'store_id',
120
+ 'type' => 'store',
121
+ 'store_all' => true,
122
+ 'store_view' => true,
123
+ 'sortable' => false,
124
+ 'filter_condition_callback'
125
+ => array($this, '_filterStoreCondition'),
126
+ ));
127
+ }
128
+
129
+ $this->addColumn('is_active', array(
130
+ 'header' => Mage::helper('cms')->__('Status'),
131
+ 'index' => 'is_active',
132
+ 'type' => 'options',
133
+ 'options' => array(
134
+ 0 => Mage::helper('cms')->__('Disabled'),
135
+ 1 => Mage::helper('cms')->__('Enabled')
136
+ ),
137
+ ));
138
+
139
+ $this->addColumn('creation_time', array(
140
+ 'header' => Mage::helper('cms')->__('Date Created'),
141
+ 'index' => 'creation_time',
142
+ 'type' => 'datetime',
143
+ ));
144
+
145
+ $this->addColumn('update_time', array(
146
+ 'header' => Mage::helper('cms')->__('Last Modified'),
147
+ 'index' => 'update_time',
148
+ 'type' => 'datetime',
149
+ ));
150
+
151
+ $this->addColumn('position', array(
152
+ 'header' => Mage::helper('cms')->__('Position'),
153
+ 'name' => 'position',
154
+ 'type' => 'number',
155
+ 'validate_class' => 'validate-number',
156
+ 'index' => 'position',
157
+ 'width' => 60,
158
+ 'editable' => true,//!$this->_getProduct()->getRelatedReadonly(),
159
+ 'edit_only' => true//!$this->_getProduct()->getId()
160
+ ));
161
+
162
+ return parent::_prepareColumns();
163
+ }
164
+
165
+ public function getGridUrl()
166
+ {
167
+ return $this->getUrl('*/*/staticblockGrid', array('_current'=>true));
168
+ }
169
+
170
+ protected function _getSelectedStaticblocks()
171
+ {
172
+ $json = $this->getRequest()->getPost('staticblocks_slideshow');
173
+ if (!is_null($json)) {
174
+ $staticblocks = $json;
175
+ } else {
176
+ $staticblocks = $this->_getSlideshow()->getStaticblockId();
177
+ }
178
+ return $staticblocks;
179
+ }
180
+
181
+ /**
182
+ * Retrieve related staticblocks
183
+ *
184
+ * @return array
185
+ */
186
+ public function getSelectedSlideshowStaticblocks()
187
+ {
188
+ $id = $this->getRequest()->getParam('id');
189
+ $_slideshow = Mage::getModel('aslideshow/slideshow')->load($id);
190
+ $staticblocks = array();
191
+ $staticblockArrs = $_slideshow->getStaticblock();
192
+ if($staticblockArrs) {
193
+ foreach($staticblockArrs as $staticblockObj) {
194
+ $staticblocks[$staticblockObj['staticblock_id']] = array('position' => $staticblockObj['position']);
195
+ }
196
+ }
197
+ return $staticblocks;
198
+ }
199
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Edit/Tabs.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
20
+ {
21
+
22
+ public function __construct()
23
+ {
24
+ parent::__construct();
25
+ $this->setId('aslideshow_tabs');
26
+ $this->setDestElementId('edit_form');
27
+ $this->setTitle(Mage::helper('aslideshow')->__('Slideshow Information'));
28
+ }
29
+
30
+ protected function _beforeToHtml()
31
+ {
32
+ $this->addTab('general_section', array(
33
+ 'label' => Mage::helper('aslideshow')->__('General Information'),
34
+ 'title' => Mage::helper('aslideshow')->__('General Information'),
35
+ 'content' => $this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_edit_tab_form')->toHtml(),
36
+ ));
37
+
38
+ $this->addTab('image_section', array(
39
+ 'label' => Mage::helper('aslideshow')->__('Slideshow Images'),
40
+ 'title' => Mage::helper('aslideshow')->__('Slideshow Images'),
41
+ 'content' => $this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_edit_tab_image')->toHtml(),
42
+ ));
43
+
44
+ /*$this->addTab('products', array(
45
+ 'label' => Mage::helper('aslideshow')->__('Product Information'),
46
+ 'title' => Mage::helper('aslideshow')->__('Product Information'),
47
+ 'content' => $this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_edit_tab_gridproduct')->toHtml(),
48
+ ));*/
49
+
50
+ $this->addTab('products_section', array(
51
+ 'label' => Mage::helper('aslideshow')->__('Products'),
52
+ 'title' => Mage::helper('aslideshow')->__('Products'),
53
+ 'url' => $this->getUrl('*/*/product', array('_current' => true)),
54
+ 'class' => 'ajax',
55
+ ));
56
+
57
+ $this->addTab('staticblocks_section', array(
58
+ 'label' => Mage::helper('aslideshow')->__('Static blocks'),
59
+ 'title' => Mage::helper('aslideshow')->__('Static blocks'),
60
+ 'url' => $this->getUrl('*/*/staticblock', array('_current' => true)),
61
+ 'class' => 'ajax',
62
+ ));
63
+
64
+ $this->addTab('page_section', array(
65
+ 'label' => Mage::helper('aslideshow')->__('Display on Pages'),
66
+ 'title' => Mage::helper('aslideshow')->__('Display on Pages'),
67
+ 'content' => $this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_edit_tab_page')->toHtml(),
68
+ ));
69
+
70
+ $this->addTab('category_section', array(
71
+ 'label' => Mage::helper('aslideshow')->__('Display on Categories'),
72
+ 'title' => Mage::helper('aslideshow')->__('Display on Categories'),
73
+ 'content' => $this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_edit_tab_category')->toHtml(),
74
+ ));
75
+
76
+ return parent::_beforeToHtml();
77
+ }
78
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Grid.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Grid extends Mage_Adminhtml_Block_Widget_Grid {
20
+ public function __construct() {
21
+ parent::__construct();
22
+ $this->setId('slideshowGrid');
23
+ $this->setDefaultSort('date_from');
24
+ $this->setDefaultDir('DESC');
25
+ $this->setSaveParametersInSession(true);
26
+ }
27
+
28
+ protected function _getStore() {
29
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
30
+ return Mage::app()->getStore($storeId);
31
+ }
32
+
33
+ protected function _prepareCollection() {
34
+ $collection = Mage::getModel('aslideshow/slideshow')->getCollection();
35
+ $store = $this->_getStore();
36
+ if ($store->getId()) {
37
+ $collection->addStoreFilter($store);
38
+ }
39
+
40
+ $this->setCollection($collection);
41
+ return parent::_prepareCollection();
42
+ }
43
+
44
+ protected function _prepareColumns() {
45
+ $this->addColumn('slideshow_id', array(
46
+ 'header' => Mage::helper('aslideshow')->__('ID'),
47
+ 'align' =>'right',
48
+ 'width' => '50px',
49
+ 'index' => 'slideshow_id',
50
+ ));
51
+
52
+ $this->addColumn('name', array(
53
+ 'header' => Mage::helper('aslideshow')->__('Title'),
54
+ 'align' =>'left',
55
+ 'index' => 'name',
56
+ ));
57
+
58
+ $this->addColumn('slideshow_position', array(
59
+ 'header' => Mage::helper('aslideshow')->__('Position'),
60
+ 'align' => 'left',
61
+ 'width' => '80px',
62
+ 'index' => 'slideshow_position',
63
+ 'type' => 'options',
64
+ 'options' => Mage::getSingleton('aslideshow/config_source_position')->toGridOptionArray(),
65
+ ));
66
+
67
+ $this->addColumn('is_active', array(
68
+ 'header' => Mage::helper('aslideshow')->__('Status'),
69
+ 'align' => 'left',
70
+ 'width' => '80px',
71
+ 'index' => 'is_active',
72
+ 'type' => 'options',
73
+ 'options' => array(
74
+ 1 => Mage::helper('aslideshow')->__('Enabled'),
75
+ 0 => Mage::helper('aslideshow')->__('Disabled'),
76
+ //3 => Mage::helper('aslideshow')->__('Hidden'),
77
+ ),
78
+ ));
79
+
80
+ $this->addColumn('action',
81
+ array(
82
+ 'header' => Mage::helper('aslideshow')->__('Action'),
83
+ 'width' => '100',
84
+ 'type' => 'action',
85
+ 'getter' => 'getId',
86
+ 'actions' => array(
87
+ array(
88
+ 'caption' => Mage::helper('aslideshow')->__('Edit'),
89
+ 'url' => array('base'=> '*/*/edit'),
90
+ 'field' => 'id'
91
+ ),
92
+ array(
93
+ 'caption' => Mage::helper('aslideshow')->__('Delete'),
94
+ 'url' => array('base'=> '*/*/delete'),
95
+ 'field' => 'id'
96
+ )
97
+ ),
98
+ 'filter' => false,
99
+ 'sortable' => false,
100
+ 'index' => 'stores',
101
+ 'is_system' => true,
102
+ ));
103
+
104
+ return parent::_prepareColumns();
105
+ }
106
+
107
+ protected function _prepareMassaction() {
108
+ $this->setMassactionIdField('slideshow_id');
109
+ $this->getMassactionBlock()->setFormFieldName('slideshow');
110
+
111
+ $this->getMassactionBlock()->addItem('delete', array(
112
+ 'label' => Mage::helper('aslideshow')->__('Delete'),
113
+ 'url' => $this->getUrl('*/*/massDelete'),
114
+ 'confirm' => Mage::helper('aslideshow')->__('Are you sure?')
115
+ ));
116
+
117
+ $statuses = array(
118
+ 1 => Mage::helper('aslideshow')->__('Enabled'),
119
+ 2 => Mage::helper('aslideshow')->__('Disabled'));
120
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
121
+ $this->getMassactionBlock()->addItem('status', array(
122
+ 'label'=> Mage::helper('aslideshow')->__('Change status'),
123
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
124
+ 'additional' => array(
125
+ 'visibility' => array(
126
+ 'name' => 'status',
127
+ 'type' => 'select',
128
+ 'class' => 'required-entry',
129
+ 'label' => Mage::helper('aslideshow')->__('Status'),
130
+ 'values' => $statuses
131
+ )
132
+ )
133
+ ));
134
+ return $this;
135
+ }
136
+
137
+ public function getRowUrl($row) {
138
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
139
+ }
140
+
141
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Adminhtml/Slideshow/Widget/Chooser.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /** MGS_ResponsiveSlideshow Extension
3
+ *
4
+ * @category Local
5
+ * @package MGS_ResponsiveSlideshow
6
+ * @author dungnv (dungnv@arrowhitech.com)
7
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
8
+ *
9
+ */
10
+
11
+ /**
12
+ *
13
+ * @category Local
14
+ * @package MGS_ResponsiveSlideshow
15
+ * @author dungnv <dungnv@arrowhitech.com>
16
+ */
17
+ class MGS_ResponsiveSlideshow_Block_Adminhtml_Slideshow_Widget_Chooser extends Mage_Adminhtml_Block_Widget_Grid
18
+ {
19
+ /**
20
+ * Block construction, prepare grid params
21
+ *
22
+ * @param array $arguments Object data
23
+ */
24
+ public function __construct($arguments=array())
25
+ {
26
+ parent::__construct($arguments);
27
+ //$this->setDefaultSort('name');
28
+ $this->setUseAjax(true);
29
+ // $this->setDefaultFilter(array('is_active' => '1'));
30
+ }
31
+
32
+ /**
33
+ * Prepare chooser element HTML
34
+ *
35
+ * @param Varien_Data_Form_Element_Abstract $element Form Element
36
+ * @return Varien_Data_Form_Element_Abstract
37
+ */
38
+ public function prepareElementHtml(Varien_Data_Form_Element_Abstract $element)
39
+ {
40
+ $uniqId = Mage::helper('core')->uniqHash($element->getId());
41
+ $sourceUrl = $this->getUrl('aslideshow/adminhtml_widget/chooser', array('uniq_id' => $uniqId));
42
+
43
+ $chooser = $this->getLayout()->createBlock('widget/adminhtml_widget_chooser')
44
+ ->setElement($element)
45
+ ->setTranslationHelper($this->getTranslationHelper())
46
+ ->setConfig($this->getConfig())
47
+ ->setFieldsetId($this->getFieldsetId())
48
+ ->setSourceUrl($sourceUrl)
49
+ ->setUniqId($uniqId);
50
+
51
+ if ($element->getValue()) {
52
+ $aslideshow = Mage::getModel('aslideshow/slideshow')->load((int)$element->getValue());
53
+ if ($aslideshow->getId()) {
54
+ $chooser->setLabel($aslideshow->getName());
55
+ }
56
+ }
57
+ $element->setData('after_element_html', $chooser->toHtml());
58
+ return $element;
59
+ }
60
+
61
+ /**
62
+ * Grid Row JS Callback
63
+ *
64
+ * @return string
65
+ */
66
+ public function getRowClickCallback()
67
+ {
68
+ $chooserJsObject = $this->getId();
69
+ $js = '
70
+ function (grid, event) {
71
+ var trElement = Event.findElement(event, "tr");
72
+ var aslideshowName = trElement.down("td").next().innerHTML;
73
+ var aslideshowId = trElement.down("td").innerHTML.replace(/^\s+|\s+$/g,"");
74
+ '.$chooserJsObject.'.setElementValue(aslideshowId);
75
+ '.$chooserJsObject.'.setElementLabel(aslideshowName);
76
+ '.$chooserJsObject.'.close();
77
+ }
78
+ ';
79
+ return $js;
80
+ }
81
+
82
+
83
+ protected function _getStore() {
84
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
85
+ return Mage::app()->getStore($storeId);
86
+ }
87
+
88
+ /**
89
+ * Prepare pages collection
90
+ *
91
+ * @return Mage_Adminhtml_Block_Widget_Grid
92
+ */
93
+ protected function _prepareCollection()
94
+ {
95
+ $collection = Mage::getModel('aslideshow/slideshow')->getCollection();
96
+ $store = $this->_getStore();
97
+ if ($store->getId()) {
98
+ $collection->addStoreFilter($store);
99
+ }
100
+
101
+ $this->setCollection($collection);
102
+ return parent::_prepareCollection();
103
+ }
104
+
105
+ /**
106
+ * Prepare columns for pages grid
107
+ *
108
+ * @return Mage_Adminhtml_Block_Widget_Grid
109
+ */
110
+ protected function _prepareColumns()
111
+ {
112
+ $this->addColumn('slideshow_id', array(
113
+ 'header' => Mage::helper('aslideshow')->__('ID'),
114
+ 'align' =>'right',
115
+ 'width' => '50px',
116
+ 'index' => 'slideshow_id',
117
+ ));
118
+
119
+ $this->addColumn('name', array(
120
+ 'header' => Mage::helper('aslideshow')->__('Title'),
121
+ 'align' =>'left',
122
+ 'index' => 'name',
123
+ ));
124
+
125
+ $this->addColumn('slideshow_position', array(
126
+ 'header' => Mage::helper('aslideshow')->__('Position'),
127
+ 'align' => 'left',
128
+ 'width' => '80px',
129
+ 'index' => 'slideshow_position',
130
+ 'type' => 'options',
131
+ 'options' => Mage::getSingleton('aslideshow/config_source_position')->toGridOptionArray(),
132
+ ));
133
+
134
+ $this->addColumn('is_active', array(
135
+ 'header' => Mage::helper('aslideshow')->__('Status'),
136
+ 'align' => 'left',
137
+ 'width' => '80px',
138
+ 'index' => 'is_active',
139
+ 'type' => 'options',
140
+ 'options' => array(
141
+ 1 => Mage::helper('aslideshow')->__('Enabled'),
142
+ 0 => Mage::helper('aslideshow')->__('Disabled'),
143
+ //3 => Mage::helper('aslideshow')->__('Hidden'),
144
+ ),
145
+ ));
146
+
147
+ return parent::_prepareColumns();
148
+ }
149
+
150
+ public function getGridUrl()
151
+ {
152
+ return $this->getUrl('aslideshow/adminhtml_widget/chooser', array('_current' => true));
153
+ }
154
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Content/Contentbottom.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Content_Contentbottom extends MGS_ResponsiveSlideshow_Block_Slideshow {
20
+ protected $_position = 'CONTENT_BOTTOM';
21
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Content/Contenttop.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Content_Contenttop extends MGS_ResponsiveSlideshow_Block_Slideshow {
20
+ protected $_position = 'CONTENT_TOP';
21
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Content/Headerbottom.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Content_Top extends MGS_ResponsiveSlideshow_Block_Slideshow {
20
+ protected $_position = 'CONTENT_TOP';
21
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Content/Headertop.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Content_Top extends MGS_ResponsiveSlideshow_Block_Slideshow {
20
+ protected $_position = 'CONTENT_TOP';
21
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Content/Leftbottom.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Content_Leftbottom extends MGS_ResponsiveSlideshow_Block_Slideshow {
20
+ protected $_position = 'LEFT_BOTTOM';
21
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Content/Lefttop.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Content_Lefttop extends MGS_ResponsiveSlideshow_Block_Slideshow {
20
+ protected $_position = 'LEFT_TOP';
21
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Content/Rightbottom.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Content_Rightbottom extends MGS_ResponsiveSlideshow_Block_Slideshow {
20
+ protected $_position = 'RIGHT_BOTTOM';
21
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Content/Righttop.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Content_Righttop extends MGS_ResponsiveSlideshow_Block_Slideshow {
20
+ protected $_position = 'RIGHT_TOP';
21
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Slideshow.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+ class MGS_ResponsiveSlideshow_Block_Slideshow extends Mage_Catalog_Block_Product_Abstract {//Mage_Core_Block_Template {
19
+ protected $_position = null;
20
+ protected $_isActive = 1;
21
+ protected $_collection;
22
+ protected $_collectionwidget;
23
+ protected $_aslideshowId = null;
24
+
25
+ protected function _getCollection($position = null) {
26
+ if ($this->_collection) {
27
+ return $this->_collection;
28
+ }
29
+
30
+ $storeId = Mage::app()->getStore()->getId();
31
+ $this->_collection = Mage::getModel('aslideshow/slideshow')->getCollection()
32
+ ->addEnableFilter($this->_isActive);
33
+ if (!Mage::app()->isSingleStoreMode()) {
34
+ $this->_collection->addStoreFilter($storeId);
35
+ }
36
+
37
+ if (Mage::registry('current_category')) {
38
+ $_categoryId = Mage::registry('current_category')->getId();
39
+ $this->_collection->addCategoryFilter($_categoryId);
40
+ } elseif (Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms') {
41
+ $_pageId = Mage::getBlockSingleton('cms/page')->getPage()->getPageId();
42
+ $this->_collection->addPageFilter($_pageId);
43
+ }echo $position;
44
+ if ($position) {
45
+ $this->_collection->addPositionFilter($position);
46
+ } elseif ($this->_position) {
47
+ $this->_collection->addPositionFilter($this->_position);
48
+ }
49
+ return $this->_collection;
50
+ }
51
+
52
+ protected function _getCollectionWidget($aslideshowId = null) {
53
+ if ($this->_collectionwidget) {
54
+ return $this->_collectionwidget;
55
+ }
56
+ if($aslideshowId != null) {
57
+ $storeId = Mage::app()->getStore()->getId();
58
+ $this->_collectionwidget = Mage::getModel('aslideshow/slideshow')->load($aslideshowId);
59
+ return $this->_collectionwidget;
60
+ }
61
+ else {
62
+ return false;
63
+ }
64
+ }
65
+
66
+ public function setAslideshowId($aslideshowId)
67
+ {
68
+ $this->_aslideshowId = $aslideshowId;
69
+ return $this;
70
+ }
71
+ }
app/code/local/MGS/ResponsiveSlideshow/Block/Widget/Slideshow.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Block_Widget_Slideshow
20
+ extends MGS_ResponsiveSlideshow_Block_Slideshow
21
+ implements Mage_Widget_Block_Interface
22
+ {
23
+ /**
24
+ * Internal contructor
25
+ *
26
+ */
27
+ protected function _construct()
28
+ {
29
+ parent::_construct();
30
+ }
31
+
32
+ /**
33
+ * Retrieve how much products should be displayed.
34
+ *
35
+ * @return int
36
+ */
37
+ public function getAslideshowId()
38
+ {
39
+ if (!$this->hasData('aslideshow_id')) {
40
+ return false;
41
+ }
42
+ return $this->_getData('aslideshow_id');
43
+ }
44
+ }
app/code/local/MGS/ResponsiveSlideshow/Helper/Data.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Helper_Data extends Mage_Core_Helper_Abstract
20
+ {
21
+ /*
22
+ * Get image url of a slideshow
23
+ */
24
+ public function getImageUrl($url = null) {
25
+ return Mage::getSingleton('aslideshow/config')->getBaseMediaUrl() . $url;
26
+ }
27
+
28
+ /**
29
+ * Encode the mixed $valueToEncode into the JSON format
30
+ *
31
+ * @param mixed $valueToEncode
32
+ * @param boolean $cycleCheck Optional; whether or not to check for object recursion; off by default
33
+ * @param array $options Additional options used during encoding
34
+ * @return string
35
+ */
36
+ public function jsonEncode($valueToEncode, $cycleCheck = false, $options = array())
37
+ {
38
+ $json = Zend_Json::encode($valueToEncode, $cycleCheck, $options);
39
+ /* @var $inline Mage_Core_Model_Translate_Inline */
40
+ $inline = Mage::getSingleton('core/translate_inline');
41
+ if ($inline->isAllowed()) {
42
+ $inline->setIsJson(true);
43
+ $inline->processResponseBody($json);
44
+ $inline->setIsJson(false);
45
+ }
46
+
47
+ return $json;
48
+ }
49
+ }
app/code/local/MGS/ResponsiveSlideshow/Helper/Image.php ADDED
@@ -0,0 +1,487 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Helper_Image extends Mage_Core_Helper_Abstract
20
+ {
21
+ protected $_model;
22
+ protected $_scheduleResize = false;
23
+ protected $_scheduleRotate = false;
24
+ protected $_angle;
25
+
26
+ protected $_watermark;
27
+ protected $_watermarkPosition;
28
+ protected $_watermarkSize;
29
+ protected $_watermarkImageOpacity;
30
+
31
+ protected $_slideshow;
32
+ protected $_imageFile;
33
+ protected $_placeholder;
34
+
35
+ /**
36
+ * Reset all previos data
37
+ */
38
+ protected function _reset()
39
+ {
40
+ $this->_model = null;
41
+ $this->_scheduleResize = false;
42
+ $this->_scheduleRotate = false;
43
+ $this->_angle = null;
44
+ $this->_watermark = null;
45
+ $this->_watermarkPosition = null;
46
+ $this->_watermarkSize = null;
47
+ $this->_watermarkImageOpacity = null;
48
+ $this->_slideshow = null;
49
+ $this->_imageFile = null;
50
+ return $this;
51
+ }
52
+
53
+ public function init($imageFile=null)
54
+ {
55
+ $this->_reset();
56
+ $this->_setModel(Mage::getModel('aslideshow/slideshow_image'));
57
+ #$this->_getModel()->setDestinationSubdir($attributeName);
58
+
59
+ $this->setWatermark(Mage::getStoreConfig("design/watermark/{$this->_getModel()->getDestinationSubdir()}_image"));
60
+ $this->setWatermarkImageOpacity(Mage::getStoreConfig("design/watermark/{$this->_getModel()->getDestinationSubdir()}_imageOpacity"));
61
+ $this->setWatermarkPosition(Mage::getStoreConfig("design/watermark/{$this->_getModel()->getDestinationSubdir()}_position"));
62
+ $this->setWatermarkSize(Mage::getStoreConfig("design/watermark/{$this->_getModel()->getDestinationSubdir()}_size"));
63
+
64
+ if ($imageFile) {
65
+ $this->setImageFile($imageFile);
66
+ }
67
+ else {
68
+ // add for work original size
69
+ #$this->_getModel()->setBaseFile( $this->getSlideshow()->getData($this->_getModel()->getDestinationSubdir()) );
70
+ }
71
+ return $this;
72
+ }
73
+
74
+ /**
75
+ * Schedule resize of the image
76
+ * $width *or* $height can be null - in this case, lacking dimension will be calculated.
77
+ *
78
+ * @see MGS_ResponsiveSlideshow_Model_Slideshow_Image
79
+ * @param int $width
80
+ * @param int $height
81
+ * @return MGS_ResponsiveSlideshow_Helper_Image
82
+ */
83
+ public function resize($width, $height = null)
84
+ {
85
+ $this->_getModel()->setWidth($width)->setHeight($height);
86
+ $this->_scheduleResize = true;
87
+ return $this;
88
+ }
89
+
90
+ /**
91
+ * Set image quality, values in percentage from 0 to 100
92
+ *
93
+ * @param int $quality
94
+ * @return MGS_ResponsiveSlideshow_Helper_Image
95
+ */
96
+ public function setQuality($quality)
97
+ {
98
+ $this->_getModel()->setQuality($quality);
99
+ return $this;
100
+ }
101
+
102
+ /**
103
+ * Guarantee, that image picture width/height will not be distorted.
104
+ * Applicable before calling resize()
105
+ * It is true by default.
106
+ *
107
+ * @see MGS_ResponsiveSlideshow_Model_Slideshow_Image
108
+ * @param bool $flag
109
+ * @return MGS_ResponsiveSlideshow_Helper_Image
110
+ */
111
+ public function keepAspectRatio($flag)
112
+ {
113
+ $this->_getModel()->setKeepAspectRatio($flag);
114
+ return $this;
115
+ }
116
+
117
+ /**
118
+ * Guarantee, that image will have dimensions, set in $width/$height
119
+ * Applicable before calling resize()
120
+ * Not applicable, if keepAspectRatio(false)
121
+ *
122
+ * $position - TODO, not used for now - picture position inside the frame.
123
+ *
124
+ * @see MGS_ResponsiveSlideshow_Model_Slideshow_Image
125
+ * @param bool $flag
126
+ * @param array $position
127
+ * @return MGS_ResponsiveSlideshow_Helper_Image
128
+ */
129
+ public function keepFrame($flag, $position = array('center', 'middle'))
130
+ {
131
+ $this->_getModel()->setKeepFrame($flag);
132
+ return $this;
133
+ }
134
+
135
+ /**
136
+ * Guarantee, that image will not lose transparency if any.
137
+ * Applicable before calling resize()
138
+ * It is true by default.
139
+ *
140
+ * $alphaOpacity - TODO, not used for now
141
+ *
142
+ * @see MGS_ResponsiveSlideshow_Model_Slideshow_Image
143
+ * @param bool $flag
144
+ * @param int $alphaOpacity
145
+ * @return MGS_ResponsiveSlideshow_Helper_Image
146
+ */
147
+ public function keepTransparency($flag, $alphaOpacity = null)
148
+ {
149
+ $this->_getModel()->setKeepTransparency($flag);
150
+ return $this;
151
+ }
152
+
153
+ /**
154
+ * Guarantee, that image picture will not be bigger, than it was.
155
+ * Applicable before calling resize()
156
+ * It is false by default
157
+ *
158
+ * @param bool $flag
159
+ * @return MGS_ResponsiveSlideshow_Helper_Image
160
+ */
161
+ public function constrainOnly($flag)
162
+ {
163
+ $this->_getModel()->setConstrainOnly($flag);
164
+ return $this;
165
+ }
166
+
167
+ /**
168
+ * Set color to fill image frame with.
169
+ * Applicable before calling resize()
170
+ * The keepTransparency(true) overrides this (if image has transparent color)
171
+ * It is white by default.
172
+ *
173
+ * @see MGS_ResponsiveSlideshow_Model_Slideshow_Image
174
+ * @param array $colorRGB
175
+ * @return MGS_ResponsiveSlideshow_Helper_Image
176
+ */
177
+ public function backgroundColor($colorRGB)
178
+ {
179
+ // assume that 3 params were given instead of array
180
+ if (!is_array($colorRGB)) {
181
+ $colorRGB = func_get_args();
182
+ }
183
+ $this->_getModel()->setBackgroundColor($colorRGB);
184
+ return $this;
185
+ }
186
+
187
+ public function rotate($angle)
188
+ {
189
+ $this->setAngle($angle);
190
+ $this->_getModel()->setAngle($angle);
191
+ $this->_scheduleRotate = true;
192
+ return $this;
193
+ }
194
+
195
+ /**
196
+ * Add watermark to image
197
+ * size param in format 100x200
198
+ *
199
+ * @param string $fileName
200
+ * @param string $position
201
+ * @param string $size
202
+ * @param int $imageOpacity
203
+ * @return MGS_ResponsiveSlideshow_Helper_Image
204
+ */
205
+ public function watermark($fileName, $position, $size=null, $imageOpacity=null)
206
+ {
207
+ $this->setWatermark($fileName)
208
+ ->setWatermarkPosition($position)
209
+ ->setWatermarkSize($size)
210
+ ->setWatermarkImageOpacity($imageOpacity);
211
+ return $this;
212
+ }
213
+
214
+ public function placeholder($fileName)
215
+ {
216
+ $this->_placeholder = $fileName;
217
+ }
218
+
219
+ public function getPlaceholder()
220
+ {
221
+ if (!$this->_placeholder) {
222
+ $attr = $this->_getModel()->getDestinationSubdir();
223
+ $this->_placeholder = 'images/catalog/product/placeholder/'.$attr.'.jpg';
224
+ }
225
+ return $this->_placeholder;
226
+ }
227
+
228
+ public function __toString()
229
+ {
230
+ try {
231
+ if( $this->getImageFile() ) {
232
+ $this->_getModel()->setBaseFile( $this->getImageFile() );
233
+ } else {
234
+ $this->_getModel()->setBaseFile( $this->getSlideshow()->getData($this->_getModel()->getDestinationSubdir()) );
235
+ }
236
+
237
+ if( $this->_getModel()->isCached() ) {
238
+ return $this->_getModel()->getUrl();
239
+ } else {
240
+ if( $this->_scheduleRotate ) {
241
+ $this->_getModel()->rotate( $this->getAngle() );
242
+ }
243
+
244
+ if ($this->_scheduleResize) {
245
+ $this->_getModel()->resize();
246
+ }
247
+
248
+ if( $this->getWatermark() ) {
249
+ $this->_getModel()->setWatermark($this->getWatermark());
250
+ }
251
+
252
+ $url = $this->_getModel()->saveFile()->getUrl();
253
+ }
254
+ } catch( Exception $e ) {
255
+ $url = Mage::getDesign()->getSkinUrl($this->getPlaceholder());
256
+ }
257
+ return $url;
258
+ }
259
+
260
+ /**
261
+ * Enter description here...
262
+ *
263
+ * @return MGS_ResponsiveSlideshow_Helper_Image
264
+ */
265
+ protected function _setModel($model)
266
+ {
267
+ $this->_model = $model;
268
+ return $this;
269
+ }
270
+
271
+ /**
272
+ * Enter description here...
273
+ *
274
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
275
+ */
276
+ protected function _getModel()
277
+ {
278
+ return $this->_model;
279
+ }
280
+
281
+ protected function setAngle($angle)
282
+ {
283
+ $this->_angle = $angle;
284
+ return $this;
285
+ }
286
+
287
+ protected function getAngle()
288
+ {
289
+ return $this->_angle;
290
+ }
291
+
292
+ /**
293
+ * Set watermark file name
294
+ *
295
+ * @param string $watermark
296
+ * @return MGS_ResponsiveSlideshow_Helper_Image
297
+ */
298
+ protected function setWatermark($watermark)
299
+ {
300
+ $this->_watermark = $watermark;
301
+ $this->_getModel()->setWatermarkFile($watermark);
302
+ return $this;
303
+ }
304
+
305
+ /**
306
+ * Get watermark file name
307
+ *
308
+ * @return string
309
+ */
310
+ protected function getWatermark()
311
+ {
312
+ return $this->_watermark;
313
+ }
314
+
315
+ /**
316
+ * Set watermark position
317
+ *
318
+ * @param string $position
319
+ * @return MGS_ResponsiveSlideshow_Helper_Image
320
+ */
321
+ protected function setWatermarkPosition($position)
322
+ {
323
+ $this->_watermarkPosition = $position;
324
+ $this->_getModel()->setWatermarkPosition($position);
325
+ return $this;
326
+ }
327
+
328
+ /**
329
+ * Get watermark position
330
+ *
331
+ * @return string
332
+ */
333
+ protected function getWatermarkPosition()
334
+ {
335
+ return $this->_watermarkPosition;
336
+ }
337
+
338
+ /**
339
+ * Set watermark size
340
+ * param size in format 100x200
341
+ *
342
+ * @param string $size
343
+ * @return MGS_ResponsiveSlideshow_Helper_Image
344
+ */
345
+ public function setWatermarkSize($size)
346
+ {
347
+ $this->_watermarkSize = $size;
348
+ $this->_getModel()->setWatermarkSize($this->parseSize($size));
349
+ return $this;
350
+ }
351
+
352
+ /**
353
+ * Get watermark size
354
+ *
355
+ * @return string
356
+ */
357
+ protected function getWatermarkSize()
358
+ {
359
+ return $this->_watermarkSize;
360
+ }
361
+
362
+ /**
363
+ * Set watermark image opacity
364
+ *
365
+ * @param int $imageOpacity
366
+ * @return MGS_ResponsiveSlideshow_Helper_Image
367
+ */
368
+ public function setWatermarkImageOpacity($imageOpacity)
369
+ {
370
+ $this->_watermarkImageOpacity = $imageOpacity;
371
+ $this->_getModel()->setWatermarkImageOpacity($imageOpacity);
372
+ return $this;
373
+ }
374
+
375
+ /**
376
+ * Get watermark image opacity
377
+ *
378
+ * @return int
379
+ */
380
+ protected function getWatermarkImageOpacity()
381
+ {
382
+ if( $this->_watermarkImageOpacity ) {
383
+ return $this->_watermarkImageOpacity;
384
+ }
385
+
386
+ return $this->_getModel()->getWatermarkImageOpacity();
387
+ }
388
+
389
+ protected function setSlideshow($slideshow)
390
+ {
391
+ $this->_slideshow = $slideshow;
392
+ return $this;
393
+ }
394
+
395
+ protected function getSlideshow()
396
+ {
397
+ return $this->_slideshow;
398
+ }
399
+
400
+ protected function setImageFile($file)
401
+ {
402
+ $this->_imageFile = $file;
403
+ return $this;
404
+ }
405
+
406
+ protected function getImageFile()
407
+ {
408
+ return $this->_imageFile;
409
+ }
410
+
411
+ /**
412
+ * Enter description here...
413
+ *
414
+ * @return array
415
+ */
416
+ protected function parseSize($string)
417
+ {
418
+ $size = explode('x', strtolower($string));
419
+ if( sizeof($size) == 2 ) {
420
+ return array(
421
+ 'width' => ($size[0] > 0) ? $size[0] : null,
422
+ 'heigth' => ($size[1] > 0) ? $size[1] : null,
423
+ );
424
+ }
425
+ return false;
426
+ }
427
+
428
+ /**
429
+ * Retrieve original image width
430
+ *
431
+ * @return int|null
432
+ */
433
+ public function getOriginalWidth()
434
+ {
435
+ return $this->_getModel()->getImageProcessor()->getOriginalWidth();
436
+ }
437
+
438
+ /**
439
+ * Retrieve original image height
440
+ *
441
+ * @deprecated
442
+ * @return int|null
443
+ */
444
+ public function getOriginalHeigh()
445
+ {
446
+ return $this->getOriginalHeight();
447
+ }
448
+
449
+ /**
450
+ * Retrieve original image height
451
+ *
452
+ * @return int|null
453
+ */
454
+ public function getOriginalHeight()
455
+ {
456
+ return $this->_getModel()->getImageProcessor()->getOriginalHeight();
457
+ }
458
+
459
+ /**
460
+ * Retrieve Original image size as array
461
+ * 0 - width, 1 - height
462
+ *
463
+ * @return array
464
+ */
465
+ public function getOriginalSizeArray()
466
+ {
467
+ return array(
468
+ $this->getOriginalWidth(),
469
+ $this->getOriginalHeight()
470
+ );
471
+ }
472
+
473
+ /**
474
+ * Check - is this file an image
475
+ *
476
+ * @param string $filePath
477
+ * @return bool
478
+ * @throw Mage_Core_Exception
479
+ */
480
+ public function validateUploadFile($filePath) {
481
+ if (!getimagesize($filePath)) {
482
+ Mage::throwException($this->__('Disallowed file type.'));
483
+ }
484
+ return true;
485
+ }
486
+
487
+ }
app/code/local/MGS/ResponsiveSlideshow/Media/Uploader.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Media_Uploader extends Varien_File_Uploader
20
+ {
21
+ }
app/code/local/MGS/ResponsiveSlideshow/Model/Config.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Model_Config extends Mage_Catalog_Model_Product_Media_Config {
20
+
21
+ public function getBaseMediaPath() {
22
+ return Mage::getBaseDir('media') .DS. 'aslideshow';
23
+ }
24
+
25
+ public function getBaseMediaUrl() {
26
+ return Mage::getBaseUrl('media') . 'aslideshow';
27
+ }
28
+
29
+ public function getBaseTmpMediaPath() {
30
+ return Mage::getBaseDir('media') .DS. 'tmp' .DS. 'aslideshow';
31
+ }
32
+
33
+ public function getBaseTmpMediaUrl() {
34
+ return Mage::getBaseUrl('media') . 'tmp/aslideshow';
35
+ }
36
+
37
+ }
app/code/local/MGS/ResponsiveSlideshow/Model/Config/Source/Page.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Model_Config_Source_Page
20
+ {
21
+ /**
22
+ * Options getter
23
+ *
24
+ * @return array
25
+ */
26
+ public function toOptionArray()
27
+ {
28
+ $_collection = Mage::getSingleton('cms/page')->getCollection()
29
+ ->addFieldToFilter('is_active', 1);
30
+
31
+ $_result = array();
32
+
33
+ $data = array(
34
+ 'value' => -1,
35
+ 'label' => Mage::helper('adminhtml')->__('No Page')
36
+ );
37
+ $_result[] = $data;
38
+ $data = array(
39
+ 'value' => 0,
40
+ 'label' => Mage::helper('adminhtml')->__('All Page')
41
+ );
42
+ $_result[] = $data;
43
+
44
+ foreach ($_collection as $item) {
45
+ $data = array(
46
+ 'value' => $item->getData('page_id'),
47
+ 'label' => $item->getData('title'));
48
+ $_result[] = $data;
49
+ }
50
+
51
+ $_result[] = $data;
52
+ return $_result;
53
+ }
54
+ }
app/code/local/MGS/ResponsiveSlideshow/Model/Config/Source/Position.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Model_Config_Source_Position
20
+ {
21
+ const CONTENT_TOP = 'CONTENT_TOP';
22
+ const CONTENT_BOTTOM = 'CONTENT_BOTTOM';
23
+ const LEFT_TOP = 'LEFT_TOP';
24
+ const LEFT_BOTTOM = 'LEFT_BOTTOM';
25
+ const RIGHT_TOP = 'RIGHT_TOP';
26
+ const RIGHT_BOTTOM = 'RIGHT_BOTTOM';
27
+
28
+ const SLIDESHOW_IMAGE = 'SLIDESHOW_IMAGE';
29
+ const SLIDESHOW_PRODUCT = 'SLIDESHOW_PRODUCT';
30
+ const SLIDESHOW_STATIC_BLOCK = 'SLIDESHOW_STATIC_BLOCK';
31
+
32
+ /**
33
+ * Options getter
34
+ *
35
+ * @return array
36
+ */
37
+ public function toOptionArray()
38
+ {
39
+ return array(
40
+ array('value' => self::CONTENT_TOP, 'label'=>Mage::helper('adminhtml')->__('Content Top')),
41
+ array('value' => self::CONTENT_BOTTOM, 'label'=>Mage::helper('adminhtml')->__('Content Bottom')),
42
+ array('value' => self::LEFT_TOP, 'label'=>Mage::helper('adminhtml')->__('Left Top')),
43
+ array('value' => self::LEFT_BOTTOM, 'label'=>Mage::helper('adminhtml')->__('Left Bottom')),
44
+ array('value' => self::RIGHT_TOP, 'label'=>Mage::helper('adminhtml')->__('Right Top')),
45
+ array('value' => self::RIGHT_BOTTOM, 'label'=>Mage::helper('adminhtml')->__('Right Bottom'))
46
+ );
47
+ }
48
+
49
+ /**
50
+ * Options getter
51
+ *
52
+ * @return array
53
+ */
54
+ public function toGridOptionArray()
55
+ {
56
+ return array(
57
+ self::CONTENT_TOP => Mage::helper('adminhtml')->__('Content Top'),
58
+ self::CONTENT_BOTTOM => Mage::helper('adminhtml')->__('Content Bottom'),
59
+ self::LEFT_TOP => Mage::helper('adminhtml')->__('Left Top'),
60
+ self::LEFT_BOTTOM => Mage::helper('adminhtml')->__('Left Bottom'),
61
+ self::RIGHT_TOP => Mage::helper('adminhtml')->__('Right Top'),
62
+ self::RIGHT_BOTTOM => Mage::helper('adminhtml')->__('Right Bottom')
63
+ );
64
+ }
65
+
66
+ public function toSlideshowForArray()
67
+ {
68
+ return array(
69
+ array('value' => self::SLIDESHOW_IMAGE, 'label'=>Mage::helper('adminhtml')->__('Image')),
70
+ array('value' => self::SLIDESHOW_PRODUCT, 'label'=>Mage::helper('adminhtml')->__('Product')),
71
+ array('value' => self::SLIDESHOW_STATIC_BLOCK, 'label'=>Mage::helper('adminhtml')->__('Static Block'))
72
+ );
73
+ }
74
+
75
+ public function toGridSlideshowForArray()
76
+ {
77
+ return array(
78
+ self::SLIDESHOW_IMAGE => Mage::helper('adminhtml')->__('Image'),
79
+ self::SLIDESHOW_PRODUCT => Mage::helper('adminhtml')->__('Product'),
80
+ self::SLIDESHOW_STATIC_BLOCK => Mage::helper('adminhtml')->__('Static Block')
81
+ );
82
+ }
83
+
84
+ }
app/code/local/MGS/ResponsiveSlideshow/Model/Config/Source/Setting.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Model_Config_Source_Setting
20
+ {
21
+
22
+ /**
23
+ * Options getter
24
+ *
25
+ * @return array
26
+ */
27
+ public function toTransitionArray()
28
+ {
29
+ return array(
30
+ array('value' => 'index', 'label'=>Mage::helper('adminhtml')->__('Index')),
31
+ array('value' => 'basic_carousel', 'label'=>Mage::helper('adminhtml')->__('Basic Carousel')),
32
+ //array('value' => 'carousel_min_max', 'label'=>Mage::helper('adminhtml')->__('Carousel Min Max')),
33
+ array('value' => 'thumbnail_controlnav', 'label'=>Mage::helper('adminhtml')->__('Thumbnail Controlnav')),
34
+ array('value' => 'thumbnail_slider', 'label'=>Mage::helper('adminhtml')->__('Thumbnail Slider')),
35
+ //array('value' => 'video', 'label'=>Mage::helper('adminhtml')->__('Video')),
36
+ );
37
+ }
38
+
39
+ public function toAnimationArray()
40
+ {
41
+ return array(
42
+ array('value' => 'fade', 'label'=>Mage::helper('adminhtml')->__('Fade')),
43
+ array('value' => 'slide', 'label'=>Mage::helper('adminhtml')->__('Slide')),
44
+ );
45
+ }
46
+
47
+ public function toDirectionArray()
48
+ {
49
+ return array(
50
+ array('value' => 'horizontal', 'label'=>Mage::helper('adminhtml')->__('Horizontal')),
51
+ array('value' => 'vertical', 'label'=>Mage::helper('adminhtml')->__('Vertical')),
52
+ );
53
+ }
54
+
55
+ public function toControlNavArray()
56
+ {
57
+ return array(
58
+ array('value' => 'true', 'label'=>Mage::helper('adminhtml')->__('Yes')),
59
+ array('value' => 'false', 'label'=>Mage::helper('adminhtml')->__('No')),
60
+ //array('value' => 'thumbnails', 'label'=>Mage::helper('adminhtml')->__('Thumbnails')),
61
+ );
62
+ }
63
+
64
+ public function toSlideControllsArray()
65
+ {
66
+ return array(
67
+ array('value' => 'true', 'label'=>Mage::helper('adminhtml')->__('Yes')),
68
+ array('value' => 'false', 'label'=>Mage::helper('adminhtml')->__('No'))
69
+ );
70
+ }
71
+
72
+ public function toTrueFalseArray()
73
+ {
74
+ return array(
75
+ array('value' => 'true', 'label'=>Mage::helper('adminhtml')->__('Yes')),
76
+ array('value' => 'false', 'label'=>Mage::helper('adminhtml')->__('No'))
77
+ );
78
+ }
79
+
80
+ public function toDisplayArray()
81
+ {
82
+ return array(
83
+ array('value' => 'diagonaltop', 'label'=>Mage::helper('adminhtml')->__('Diagonal Top')),
84
+ array('value' => 'diagonalbottom', 'label'=>Mage::helper('adminhtml')->__('Diagonal Bottom')),
85
+ array('value' => 'topleft', 'label'=>Mage::helper('adminhtml')->__('Top Left')),
86
+ array('value' => 'bottomright', 'label'=>Mage::helper('adminhtml')->__('Bottom Right')),
87
+ array('value' => 'random', 'label'=>Mage::helper('adminhtml')->__('Random')),
88
+ array('value' => 'all', 'label'=>Mage::helper('adminhtml')->__('All'))
89
+ );
90
+ }
91
+
92
+ public function toShowDescriptionArray()
93
+ {
94
+ return array(
95
+ array('value' => 'description', 'label'=>Mage::helper('adminhtml')->__('Description')),
96
+ array('value' => 'short_description', 'label'=>Mage::helper('adminhtml')->__('Short Description')),
97
+ array('value' => 'no', 'label'=>Mage::helper('adminhtml')->__('No'))
98
+ );
99
+ }
100
+
101
+ public function toBlocksizeArray()
102
+ {
103
+ return array(
104
+ array('value' => '3', 'label'=>Mage::helper('adminhtml')->__('3px')),
105
+ array('value' => '5', 'label'=>Mage::helper('adminhtml')->__('5px')),
106
+ array('value' => '7', 'label'=>Mage::helper('adminhtml')->__('7px')),
107
+ array('value' => '10', 'label'=>Mage::helper('adminhtml')->__('10px')),
108
+ array('value' => '20', 'label'=>Mage::helper('adminhtml')->__('20px')),
109
+ array('value' => '30', 'label'=>Mage::helper('adminhtml')->__('30px')),
110
+ array('value' => '40', 'label'=>Mage::helper('adminhtml')->__('40px')),
111
+ array('value' => '50', 'label'=>Mage::helper('adminhtml')->__('50px')),
112
+ array('value' => '60', 'label'=>Mage::helper('adminhtml')->__('60px')),
113
+ array('value' => '70', 'label'=>Mage::helper('adminhtml')->__('70px')),
114
+ array('value' => '80', 'label'=>Mage::helper('adminhtml')->__('80px')),
115
+ array('value' => '90', 'label'=>Mage::helper('adminhtml')->__('90px')),
116
+ array('value' => '100', 'label'=>Mage::helper('adminhtml')->__('100px')),
117
+ array('value' => 'full', 'label'=>Mage::helper('adminhtml')->__('Full'))
118
+ );
119
+ }
120
+
121
+ public function toOpacityArray()
122
+ {
123
+ return array(
124
+ array('value' => '0.1', 'label'=>Mage::helper('adminhtml')->__('0.1')),
125
+ array('value' => '0.2', 'label'=>Mage::helper('adminhtml')->__('0.2')),
126
+ array('value' => '0.3', 'label'=>Mage::helper('adminhtml')->__('0.3')),
127
+ array('value' => '0.4', 'label'=>Mage::helper('adminhtml')->__('0.4')),
128
+ array('value' => '0.5', 'label'=>Mage::helper('adminhtml')->__('0.5')),
129
+ array('value' => '0.6', 'label'=>Mage::helper('adminhtml')->__('0.6')),
130
+ array('value' => '0.7', 'label'=>Mage::helper('adminhtml')->__('0.7')),
131
+ array('value' => '0.8', 'label'=>Mage::helper('adminhtml')->__('0.8')),
132
+ array('value' => '0.9', 'label'=>Mage::helper('adminhtml')->__('0.9')),
133
+ array('value' => '1', 'label'=>Mage::helper('adminhtml')->__('1'))
134
+ );
135
+ }
136
+ }
app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow.php ADDED
@@ -0,0 +1,495 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Model_Mysql4_Slideshow extends Mage_Core_Model_Mysql4_Abstract {
20
+ /**
21
+ * Initialize resource model
22
+ */
23
+ protected function _construct() {
24
+ $this->_init('aslideshow/slideshow', 'slideshow_id');
25
+ }
26
+
27
+ /**
28
+ * Load images
29
+ */
30
+ public function loadImage(Mage_Core_Model_Abstract $object) {
31
+ return $this->__loadImage($object);
32
+ }
33
+
34
+ /**
35
+ * Load images
36
+ */
37
+ public function loadProduct(Mage_Core_Model_Abstract $object) {
38
+ return $this->__loadProduct($object);
39
+ }
40
+
41
+ /**
42
+ * Load images
43
+ */
44
+ public function loadStaticblock(Mage_Core_Model_Abstract $object) {
45
+ return $this->__loadStaticblock($object);
46
+ }
47
+
48
+
49
+ /**
50
+ *
51
+ * @param Mage_Core_Model_Abstract $object
52
+ */
53
+ protected function _afterLoad(Mage_Core_Model_Abstract $object) {
54
+ if (!$object->getIsMassDelete()) {
55
+ $object = $this->__loadStore($object);
56
+ $object = $this->__loadPage($object);
57
+ $object = $this->__loadCategory($object);
58
+ $object = $this->__loadProduct($object);
59
+ $object = $this->__loadStaticblock($object);
60
+ $object = $this->__loadImage($object);
61
+ }
62
+
63
+ return parent::_afterLoad($object);
64
+ }
65
+
66
+ /**
67
+ * Retrieve select object for load object data
68
+ *
69
+ * @param string $field
70
+ * @param mixed $value
71
+ * @return Zend_Db_Select
72
+ */
73
+ protected function _getLoadSelect($field, $value, $object) {
74
+ $select = parent::_getLoadSelect($field, $value, $object);
75
+
76
+ if ($data = $object->getStoreId()) {
77
+ $select->join(
78
+ array('store' => $this->getTable('aslideshow/slideshow_store')), $this->getMainTable().'.slideshow_id = `store`.slideshow_id')
79
+ ->where('`store`.store_id in (0, ?) ', $data);
80
+ }
81
+ if ($data = $object->getPageId()) {
82
+ $select->join(
83
+ array('page' => $this->getTable('aslideshow/slideshow_page')), $this->getMainTable().'.slideshow_id = `page`.slideshow_id')
84
+ ->where('`page`.page_id in (?) ', $data);
85
+ }
86
+ if ($data = $object->getCategoryId()) {
87
+ $select->join(
88
+ array('category' => $this->getTable('aslideshow/slideshow_category')), $this->getMainTable().'.slideshow_id = `category`.slideshow_id')
89
+ ->where('`category`.category_id in (?) ', $data);
90
+ }
91
+ if ($data = $object->getProductId()) {
92
+ $select->join(
93
+ array('product' => $this->getTable('aslideshow/slideshow_product')), $this->getMainTable().'.slideshow_id = `product`.slideshow_id')
94
+ ->where('`product`.product_id in (?) ', $data);
95
+ }
96
+ if ($data = $object->getStaticblockId()) {
97
+ $select->join(
98
+ array('staticblock' => $this->getTable('aslideshow/slideshow_staticblock')), $this->getMainTable().'.slideshow_id = `staticblock`.slideshow_id')
99
+ ->where('`staticblock`.product_id in (?) ', $data);
100
+ }
101
+ $select->order('name DESC')->limit(1);
102
+
103
+ return $select;
104
+ }
105
+
106
+ /**
107
+ * Call-back function
108
+ */
109
+ protected function _afterSave(Mage_Core_Model_Abstract $object) {
110
+ if (!$object->getIsMassStatus()) {
111
+ $this->__saveToStoreTable($object);
112
+ $this->__saveToPageTable($object);
113
+ $this->__saveToCategoryTable($object);
114
+ $this->__saveToProductTable($object);
115
+ $this->__saveToStaticblockTable($object);
116
+ $this->__saveToImageTable($object);
117
+ }
118
+
119
+ return parent::_afterSave($object);
120
+ }
121
+
122
+ /**
123
+ * Call-back function
124
+ */
125
+ protected function _beforeDelete(Mage_Core_Model_Abstract $object) {
126
+ // Cleanup stats on blog delete
127
+ $adapter = $this->_getReadAdapter();
128
+ // 1. Delete blog/store
129
+ $adapter->delete($this->getTable('aslideshow/slideshow_store'), 'slideshow_id='.$object->getId());
130
+ // 2. Delete blog/post_cat
131
+ $adapter->delete($this->getTable('aslideshow/slideshow_page'), 'slideshow_id='.$object->getId());
132
+ // 3. Delete blog/post_comment
133
+ $adapter->delete($this->getTable('aslideshow/slideshow_category'), 'slideshow_id='.$object->getId());
134
+ // 4. Delete blog/post_comment
135
+ $adapter->delete($this->getTable('aslideshow/slideshow_product'), 'product_id='.$object->getId());
136
+ // 5. Delete blog/post_comment
137
+ $adapter->delete($this->getTable('aslideshow/slideshow_staticblock'), 'staticblock_id='.$object->getId());
138
+ // Update tags
139
+
140
+ return parent::_beforeDelete($object);
141
+ }
142
+
143
+ /**
144
+ * Load stores
145
+ */
146
+ private function __loadStore(Mage_Core_Model_Abstract $object) {
147
+ $select = $this->_getReadAdapter()->select()
148
+ ->from($this->getTable('aslideshow/slideshow_store'))
149
+ ->where('slideshow_id = ?', $object->getId());
150
+
151
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
152
+ $array = array();
153
+ foreach ($data as $row) {
154
+ $array[] = $row['store_id'];
155
+ }
156
+ $object->setData('store_id', $array);
157
+ }
158
+ return $object;
159
+ }
160
+
161
+ /**
162
+ * Load pages
163
+ */
164
+ private function __loadPage(Mage_Core_Model_Abstract $object) {
165
+ $select = $this->_getReadAdapter()->select()
166
+ ->from($this->getTable('aslideshow/slideshow_page'))
167
+ ->where('slideshow_id = ?', $object->getId());
168
+
169
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
170
+ $array = array();
171
+ foreach ($data as $row) {
172
+ $array[] = $row['page_id'];
173
+ }
174
+ $object->setData('page_id', $array);
175
+ }
176
+ return $object;
177
+ }
178
+
179
+ /**
180
+ * Load categories
181
+ */
182
+ private function __loadCategory(Mage_Core_Model_Abstract $object) {
183
+ $select = $this->_getReadAdapter()->select()
184
+ ->from($this->getTable('aslideshow/slideshow_category'))
185
+ ->where('slideshow_id = ?', $object->getId());
186
+
187
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
188
+ $array = array();
189
+ foreach ($data as $row) {
190
+ $array[] = $row['category_id'];
191
+ }
192
+ $object->setData('category_id', $array);
193
+ }
194
+ return $object;
195
+ }
196
+
197
+ /**
198
+ * Load categories
199
+ */
200
+ private function __loadProduct(Mage_Core_Model_Abstract $object) {
201
+ $select = $this->_getReadAdapter()->select()
202
+ ->from($this->getTable('aslideshow/slideshow_product'))
203
+ ->where('slideshow_id = ?', $object->getId())
204
+ ->order(array('position ASC', 'product_id'));
205
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
206
+ $array = array();
207
+ foreach ($data as $row) {
208
+ $array[] = $row['product_id'];
209
+ }
210
+ $object->setData('product_id', $array);
211
+ $object->setData('product', $data);
212
+ }
213
+
214
+ return $object;
215
+ }
216
+
217
+ /**
218
+ * Load categories
219
+ */
220
+ private function __loadStaticblock(Mage_Core_Model_Abstract $object) {
221
+ $select = $this->_getReadAdapter()->select()
222
+ ->from($this->getTable('aslideshow/slideshow_staticblock'))
223
+ ->where('slideshow_id = ?', $object->getId())
224
+ ->order(array('position ASC', 'staticblock_id'));
225
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
226
+ $array = array();
227
+ foreach ($data as $row) {
228
+ $array[] = $row['staticblock_id'];
229
+ }
230
+ $object->setData('staticblock_id', $array);
231
+ $object->setData('staticblock', $data);
232
+ }
233
+
234
+ return $object;
235
+ }
236
+
237
+ /**
238
+ * Load images
239
+ */
240
+ private function __loadImage(Mage_Core_Model_Abstract $object) {
241
+ $select = $this->_getReadAdapter()->select()
242
+ ->from($this->getTable('aslideshow/slideshow_image'))
243
+ ->where('slideshow_id = ?', $object->getId())
244
+ ->order(array('position ASC', 'image_id'));
245
+
246
+ $object->setData('image', $this->_getReadAdapter()->fetchAll($select));
247
+ return $object;
248
+ }
249
+
250
+ /**
251
+ * Save stores
252
+ */
253
+ private function __saveToStoreTable(Mage_Core_Model_Abstract $object) {
254
+ if (!$object->getData('stores')) {
255
+ $condition = $this->_getWriteAdapter()->quoteInto('slideshow_id = ?', $object->getId());
256
+ $this->_getWriteAdapter()->delete($this->getTable('aslideshow/slideshow_store'), $condition);
257
+
258
+ $storeArray = array(
259
+ 'slideshow_id' => $object->getId(),
260
+ 'store_id' => '0');
261
+ $this->_getWriteAdapter()->insert(
262
+ $this->getTable('aslideshow/slideshow_store'), $storeArray);
263
+ return true;
264
+ }
265
+
266
+ /*$object = $this->__loadStore($object);
267
+ if ($storeList = $object->getStoreId()) {
268
+ $first = implode('|',asort($storeList));
269
+ $second = implode('|',asort($object->getData('stores')));
270
+ if (strcmp($first,$second) == 0) {
271
+ return true;
272
+ }
273
+ }*/
274
+
275
+ $condition = $this->_getWriteAdapter()->quoteInto('slideshow_id = ?', $object->getId());
276
+ $this->_getWriteAdapter()->delete($this->getTable('aslideshow/slideshow_store'), $condition);
277
+ foreach ((array)$object->getData('stores') as $store) {
278
+ $storeArray = array();
279
+ $storeArray['slideshow_id'] = $object->getId();
280
+ $storeArray['store_id'] = $store;
281
+ $this->_getWriteAdapter()->insert(
282
+ $this->getTable('aslideshow/slideshow_store'), $storeArray);
283
+ }
284
+ }
285
+
286
+ /**
287
+ * Save stores
288
+ */
289
+ private function __saveToPageTable(Mage_Core_Model_Abstract $object) {
290
+ if ($data = $object->getData('pages')) {
291
+ /*$object = $this->__loadPage($object);
292
+ if ($IDList = $object->getPageId()) {
293
+ $first = implode('|',asort($IDList));
294
+ $second = implode('|',asort($data));
295
+ if (strcmp($first,$second) == 0) {
296
+ return true;
297
+ }
298
+ }*/
299
+
300
+ $this->_getWriteAdapter()->beginTransaction();
301
+ try {
302
+ $condition = $this->_getWriteAdapter()->quoteInto('slideshow_id = ?', $object->getId());
303
+ $this->_getWriteAdapter()->delete($this->getTable('aslideshow/slideshow_page'), $condition);
304
+
305
+ foreach ((array)$data as $page) {
306
+ $pageArray = array();
307
+ $pageArray['slideshow_id'] = $object->getId();
308
+ $pageArray['page_id'] = $page;
309
+ $this->_getWriteAdapter()->insert(
310
+ $this->getTable('aslideshow/slideshow_page'), $pageArray);
311
+ }
312
+ $this->_getWriteAdapter()->commit();
313
+ } catch (Exception $e) {
314
+ $this->_getWriteAdapter()->rollBack();
315
+ echo $e->getMessage();
316
+ }
317
+ return true;
318
+ }
319
+
320
+ $condition = $this->_getWriteAdapter()->quoteInto('slideshow_id = ?', $object->getId());
321
+ $this->_getWriteAdapter()->delete($this->getTable('aslideshow/slideshow_page'), $condition);
322
+ }
323
+
324
+ /**
325
+ * Save categories
326
+ */
327
+ private function __saveToCategoryTable(Mage_Core_Model_Abstract $object) {
328
+ if ($data = $object->getData('categories')) {
329
+ /*$object = $this->__loadCategory($object);
330
+ if ($IDList = $object->getCategoryId()) {
331
+ $first = implode('|',asort($IDList));
332
+ $second = implode('|',asort($data));
333
+ if (strcmp($first,$second) == 0) {
334
+ return true;
335
+ }
336
+ }*/
337
+
338
+ $this->_getWriteAdapter()->beginTransaction();
339
+ try {
340
+ $condition = $this->_getWriteAdapter()->quoteInto('slideshow_id = ?', $object->getId());
341
+ $this->_getWriteAdapter()->delete($this->getTable('aslideshow/slideshow_category'), $condition);
342
+
343
+ $data = array_unique($data);
344
+ foreach ((array)$data as $category) {
345
+ $categoryArray = array();
346
+ $categoryArray['slideshow_id'] = $object->getId();
347
+ $categoryArray['category_id'] = $category;
348
+ $this->_getWriteAdapter()->insert(
349
+ $this->getTable('aslideshow/slideshow_category'), $categoryArray);
350
+ }
351
+ $this->_getWriteAdapter()->commit();
352
+ } catch (Exception $e) {
353
+ $this->_getWriteAdapter()->rollBack();
354
+ echo $e->getMessage();
355
+ }
356
+ return true;
357
+ }
358
+
359
+ $condition = $this->_getWriteAdapter()->quoteInto('slideshow_id = ?', $object->getId());
360
+ $this->_getWriteAdapter()->delete($this->getTable('aslideshow/slideshow_category'), $condition);
361
+ }
362
+
363
+ /**
364
+ * Save product
365
+ */
366
+ private function __saveToProductTable(Mage_Core_Model_Abstract $object) {
367
+
368
+ if ($data = $object->getData('products')) {
369
+ /*$object = $this->__loadCategory($object);
370
+ if ($IDList = $object->getCategoryId()) {
371
+ $first = implode('|',asort($IDList));
372
+ $second = implode('|',asort($data));
373
+ if (strcmp($first,$second) == 0) {
374
+ return true;
375
+ }
376
+ }*/
377
+
378
+ $this->_getWriteAdapter()->beginTransaction();
379
+ try {
380
+ $condition = $this->_getWriteAdapter()->quoteInto('slideshow_id = ?', $object->getId());
381
+ $this->_getWriteAdapter()->delete($this->getTable('aslideshow/slideshow_product'), $condition);
382
+ //$data = array_unique($data['slideshow']);
383
+ foreach ($data['slideshow'] as $product => $position) {
384
+ $productArray = array();
385
+ $productArray['slideshow_id'] = $object->getId();
386
+ $productArray['product_id'] = $product;
387
+ $productArray['position'] = $position['position'];
388
+ $this->_getWriteAdapter()->insert(
389
+ $this->getTable('aslideshow/slideshow_product'), $productArray);
390
+ }
391
+ $this->_getWriteAdapter()->commit();
392
+ } catch (Exception $e) {
393
+ $this->_getWriteAdapter()->rollBack();
394
+ echo $e->getMessage();
395
+ }
396
+ return true;
397
+ }
398
+
399
+ //$condition = $this->_getWriteAdapter()->quoteInto('slideshow_id = ?', $object->getId());
400
+ //$this->_getWriteAdapter()->delete($this->getTable('aslideshow/slideshow_product'), $condition);
401
+ }
402
+
403
+ /**
404
+ * Save Staticblock
405
+ */
406
+ private function __saveToStaticblockTable(Mage_Core_Model_Abstract $object) {
407
+
408
+ if ($data = $object->getData('staticblocks')) {
409
+ /*$object = $this->__loadCategory($object);
410
+ if ($IDList = $object->getCategoryId()) {
411
+ $first = implode('|',asort($IDList));
412
+ $second = implode('|',asort($data));
413
+ if (strcmp($first,$second) == 0) {
414
+ return true;
415
+ }
416
+ }*/
417
+
418
+ $this->_getWriteAdapter()->beginTransaction();
419
+ try {
420
+ $condition = $this->_getWriteAdapter()->quoteInto('slideshow_id = ?', $object->getId());
421
+ $this->_getWriteAdapter()->delete($this->getTable('aslideshow/slideshow_staticblock'), $condition);
422
+ //$data = array_unique($data['slideshow']);
423
+ foreach ($data['slideshow'] as $staticblock => $position) {
424
+ $_cmsObj = Mage::getModel('cms/block')->load($staticblock);
425
+ $_identifier = $_cmsObj->getIdentifier();
426
+ $staticblockArray = array();
427
+ $staticblockArray['slideshow_id'] = $object->getId();
428
+ $staticblockArray['staticblock_id'] = $staticblock;
429
+ $staticblockArray['staticblock_identifier'] = $_identifier;
430
+ $staticblockArray['position'] = $position['position'];
431
+ $this->_getWriteAdapter()->insert(
432
+ $this->getTable('aslideshow/slideshow_staticblock'), $staticblockArray);
433
+ }
434
+ $this->_getWriteAdapter()->commit();
435
+ } catch (Exception $e) {
436
+ $this->_getWriteAdapter()->rollBack();
437
+ echo $e->getMessage();
438
+ }
439
+ return true;
440
+ }
441
+
442
+ }
443
+
444
+ /**
445
+ * Save stores
446
+ */
447
+ private function __saveToImageTable(Mage_Core_Model_Abstract $object) {
448
+ if ($_imageList = $object->getData('images')) {
449
+ $_imageList = Zend_Json::decode($_imageList);
450
+ if (is_array($_imageList) and sizeof($_imageList) > 0) {
451
+ $_imageTable = $this->getTable('aslideshow/slideshow_image');
452
+ $_adapter = $this->_getWriteAdapter();
453
+ $_adapter->beginTransaction();
454
+ try {
455
+ $condition = $this->_getWriteAdapter()->quoteInto('slideshow_id = ?', $object->getId());
456
+ $this->_getWriteAdapter()->delete($this->getTable('aslideshow/slideshow_image'), $condition);
457
+
458
+ foreach ($_imageList as &$_item) {
459
+ if (isset($_item['removed']) and $_item['removed'] == '1') {
460
+ $_adapter->delete($_imageTable, $_adapter->quoteInto('image_id = ?', $_item['value_id'], 'INTEGER'));
461
+ } else {
462
+ $_data = array(
463
+ 'label' => $_item['label'],
464
+ 'caption' => $_item['caption'],
465
+ 'file' => $_item['file'],
466
+ 'position' => $_item['position'],
467
+ 'disabled' => $_item['disabled'],
468
+ 'slideshow_id' => $object->getId());
469
+ $_adapter->insert($_imageTable, $_data);
470
+ }
471
+ }
472
+ $_adapter->commit();
473
+ } catch (Exception $e) {
474
+ $_adapter->rollBack();
475
+ echo $e->getMessage();
476
+ }
477
+ }
478
+ }
479
+ }
480
+
481
+ public function updateIsActive($status, $slideshowId) {
482
+ $write = $this->_getWriteAdapter();
483
+ $dataTable = $this->getTable('aslideshow/slideshow');
484
+ try {
485
+ $condition = array();
486
+ $condition[] = $write->quoteInto('slideshow_id=?', $slideshowId);
487
+ $data = array(
488
+ 'is_active' => $status,
489
+ );
490
+ $write->update($dataTable, $data, $condition);
491
+ } catch (Exception $e) {
492
+ echo $e->getMessage();
493
+ }
494
+ }
495
+ }
app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow/Collection.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Model_Mysql4_Slideshow_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
20
+ /**
21
+ * Constructor method
22
+ */
23
+ protected function _construct() {
24
+ $this->_init('aslideshow/slideshow');
25
+ }
26
+
27
+ /**
28
+ * Add Filter by position
29
+ *
30
+ * @param string $position
31
+ * @return MGS_ResponsiveSlideshow_Model_Mysql4_Slideshow_Collection
32
+ */
33
+ public function addPositionFilter($position) {
34
+ $this->getSelect()->where('main_table.slideshow_position = ?', $position);
35
+ return $this;
36
+ }
37
+
38
+ /**
39
+ * Add Filter by category
40
+ *
41
+ * @param int $category
42
+ * @return MGS_ResponsiveSlideshow_Model_Mysql4_Slideshow_Collection
43
+ */
44
+ public function addCategoryFilter($category) {
45
+ $this->getSelect()->join(
46
+ array('category_table' => $this->getTable('aslideshow/slideshow_category')),
47
+ 'main_table.slideshow_id = category_table.slideshow_id',
48
+ array()
49
+ )
50
+ ->where('category_table.category_id = ?', $category);
51
+ return $this;
52
+ }
53
+
54
+ public function addProductFilter($product) {
55
+ $this->getSelect()->join(
56
+ array('product_table' => $this->getTable('aslideshow/slideshow_product')),
57
+ 'main_table.slideshow_id = product_table.slideshow_id',
58
+ array()
59
+ )
60
+ ->where('product_table.product_id = ?', $product);
61
+ return $this;
62
+ }
63
+
64
+ public function addStaticblockFilter($staticblock) {
65
+ $this->getSelect()->join(
66
+ array('staticblock_table' => $this->getTable('aslideshow/slideshow_staticblock')),
67
+ 'main_table.slideshow_id = staticblock_table.slideshow_id',
68
+ array()
69
+ )
70
+ ->where('staticblock_table.staticblock_id = ?', $staticblock);
71
+ return $this;
72
+ }
73
+
74
+ /**
75
+ * Add Filter by page
76
+ *
77
+ * @param int $page
78
+ * @return MGS_ResponsiveSlideshow_Model_Mysql4_Slideshow_Collection
79
+ */
80
+ public function addPageFilter($page) {
81
+ $this->getSelect()->join(
82
+ array('page_table' => $this->getTable('aslideshow/slideshow_page')),
83
+ 'main_table.slideshow_id = page_table.slideshow_id',
84
+ array()
85
+ )
86
+ ->where('page_table.page_id = ?', $page);
87
+ return $this;
88
+ }
89
+
90
+ /**
91
+ * Add Filter by store
92
+ *
93
+ * @param int|Mage_Core_Model_Store $store
94
+ * @return MGS_ResponsiveSlideshow_Model_Mysql4_Slideshow_Collection
95
+ */
96
+ public function addStoreFilter($store) {
97
+ if (!Mage::app()->isSingleStoreMode()) {
98
+ if ($store instanceof Mage_Core_Model_Store) {
99
+ $store = array($store->getId());
100
+ }
101
+
102
+ $this->getSelect()->join(
103
+ array('store_table' => $this->getTable('aslideshow/slideshow_store')),
104
+ 'main_table.slideshow_id = store_table.slideshow_id',
105
+ array()
106
+ )
107
+ ->where('store_table.store_id in (?)', array(0, $store));
108
+ return $this;
109
+ }
110
+ return $this;
111
+ }
112
+
113
+ /**
114
+ * Add Filter by status
115
+ *
116
+ * @param int $status
117
+ * @return MGS_ResponsiveSlideshow_Model_Mysql4_Slideshow_Collection
118
+ */
119
+ public function addEnableFilter($status = 1) {
120
+ $this->getSelect()->where('main_table.is_active = ?', $status);
121
+ return $this;
122
+ }
123
+
124
+ public function addSlideshowForFilter($slideshow_for) {
125
+ $this->getSelect()->where('main_table.slideshow_for = ?', $slideshow_for);
126
+ return $this;
127
+ }
128
+ }
app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow/Image.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Model_Mysql4_Slideshow_Image extends Mage_Core_Model_Mysql4_Abstract
20
+ {
21
+ /**
22
+ * Initialize resource model
23
+ */
24
+ protected function _construct()
25
+ {
26
+ $this->_init('aslideshow/slideshow_image', 'slideshow_image_id');
27
+ }
28
+ }
app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow/Image/Collection.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Model_Mysql4_Slideshow_Image_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
20
+ {
21
+ protected function _construct()
22
+ {
23
+ $this->_init('aslideshow/slideshow_image');
24
+ }
25
+ }
app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow/Product.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Model_Mysql4_Slideshow_Product extends Mage_Core_Model_Mysql4_Abstract
20
+ {
21
+ /**
22
+ * Initialize resource model
23
+ */
24
+ protected function _construct()
25
+ {
26
+ $this->_init('aslideshow/slideshow_product', 'slideshow_product_id');
27
+ }
28
+ }
app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow/Product/Collection.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Model_Mysql4_Slideshow_Product_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
20
+ {
21
+ protected function _construct()
22
+ {
23
+ $this->_init('aslideshow/slideshow_product');
24
+ }
25
+ }
app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow/Staticblock.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Model_Mysql4_Slideshow_Staticblock extends Mage_Core_Model_Mysql4_Abstract
20
+ {
21
+ /**
22
+ * Initialize resource model
23
+ */
24
+ protected function _construct()
25
+ {
26
+ $this->_init('aslideshow/slideshow_staticblock', 'slideshow_staticblock_id');
27
+ }
28
+ }
app/code/local/MGS/ResponsiveSlideshow/Model/Mysql4/Slideshow/Staticblock/Collection.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Model_Mysql4_Slideshow_Staticblock_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
20
+ {
21
+ protected function _construct()
22
+ {
23
+ $this->_init('aslideshow/slideshow_staticblock');
24
+ }
25
+ }
app/code/local/MGS/ResponsiveSlideshow/Model/Slideshow.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Model_Slideshow extends Mage_Core_Model_Abstract
20
+ {
21
+ /**
22
+ * Initialize resource model
23
+ *
24
+ */
25
+ protected function _construct()
26
+ {
27
+ $this->_init('aslideshow/slideshow');
28
+ }
29
+
30
+ /*
31
+ * Load image
32
+ */
33
+ public function getImageList() {
34
+ if (!$this->hasData('image')) {
35
+ $_object = $this->_getResource()->loadImage($this);
36
+ }
37
+ return $this->getData('image');
38
+ }
39
+
40
+ public function getProductList() {
41
+ if (!$this->hasData('product')) {
42
+ $_object = $this->_getResource()->loadProduct($this);
43
+ }
44
+ return $this->getData('product');
45
+ }
46
+
47
+ public function getStaticblockList() {
48
+ if (!$this->hasData('staticblock')) {
49
+ $_object = $this->_getResource()->loadStaticblock($this);
50
+ }
51
+ return $this->getData('staticblock');
52
+ }
53
+ }
app/code/local/MGS/ResponsiveSlideshow/Model/Slideshow/Image.php ADDED
@@ -0,0 +1,685 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Model_Slideshow_Image extends Mage_Core_Model_Abstract
20
+ {
21
+ protected $_width;
22
+ protected $_height;
23
+ protected $_quality = 90;
24
+
25
+ protected $_keepAspectRatio = true;
26
+ protected $_keepFrame = true;
27
+ protected $_keepTransparency = true;
28
+ protected $_constrainOnly = false;
29
+ protected $_backgroundColor = array(255, 255, 255);
30
+
31
+ protected $_baseFile;
32
+ protected $_isBaseFilePlaceholder;
33
+ protected $_newFile;
34
+ protected $_processor;
35
+ protected $_destinationSubdir;
36
+ protected $_angle;
37
+
38
+ protected $_watermarkFile;
39
+ protected $_watermarkPosition;
40
+ protected $_watermarkWidth;
41
+ protected $_watermarkHeigth;
42
+ protected $_watermarkImageOpacity = 70;
43
+
44
+ /**
45
+ * Initialize resource model
46
+ *
47
+ */
48
+ protected function _construct()
49
+ {
50
+ $this->_init('aslideshow/slideshow_image');
51
+ }
52
+
53
+ /**
54
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
55
+ */
56
+ public function setWidth($width)
57
+ {
58
+ $this->_width = $width;
59
+ return $this;
60
+ }
61
+
62
+ public function getWidth()
63
+ {
64
+ return $this->_width;
65
+ }
66
+
67
+ /**
68
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
69
+ */
70
+ public function setHeight($height)
71
+ {
72
+ $this->_height = $height;
73
+ return $this;
74
+ }
75
+
76
+ public function getHeight()
77
+ {
78
+ return $this->_height;
79
+ }
80
+
81
+ /**
82
+ * Set image quality, values in percentage from 0 to 100
83
+ *
84
+ * @param int $quality
85
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
86
+ */
87
+ public function setQuality($quality)
88
+ {
89
+ $this->_quality = $quality;
90
+ return $this;
91
+ }
92
+
93
+ /**
94
+ * Get image quality
95
+ *
96
+ * @return int
97
+ */
98
+ public function getQuality()
99
+ {
100
+ return $this->_quality;
101
+ }
102
+
103
+ /**
104
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
105
+ */
106
+ public function setKeepAspectRatio($keep)
107
+ {
108
+ $this->_keepAspectRatio = (bool)$keep;
109
+ return $this;
110
+ }
111
+
112
+ /**
113
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
114
+ */
115
+ public function setKeepFrame($keep)
116
+ {
117
+ $this->_keepFrame = (bool)$keep;
118
+ return $this;
119
+ }
120
+
121
+ /**
122
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
123
+ */
124
+ public function setKeepTransparency($keep)
125
+ {
126
+ $this->_keepTransparency = (bool)$keep;
127
+ return $this;
128
+ }
129
+
130
+ /**
131
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
132
+ */
133
+ public function setConstrainOnly($flag)
134
+ {
135
+ $this->_constrainOnly = (bool)$flag;
136
+ return $this;
137
+ }
138
+
139
+ /**
140
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
141
+ */
142
+ public function setBackgroundColor(array $rgbArray)
143
+ {
144
+ $this->_backgroundColor = $rgbArray;
145
+ return $this;
146
+ }
147
+
148
+ /**
149
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
150
+ */
151
+ public function setSize($size)
152
+ {
153
+ // determine width and height from string
154
+ list($width, $height) = explode('x', strtolower($size), 2);
155
+ foreach (array('width', 'height') as $wh) {
156
+ $$wh = (int)$$wh;
157
+ if (empty($$wh))
158
+ $$wh = null;
159
+ }
160
+
161
+ // set sizes
162
+ $this->setWidth($width)->setHeight($height);
163
+
164
+ return $this;
165
+ }
166
+
167
+ protected function _checkMemory($file = null)
168
+ {
169
+ // print '$this->_getMemoryLimit() = '.$this->_getMemoryLimit();
170
+ // print '$this->_getMemoryUsage() = '.$this->_getMemoryUsage();
171
+ // print '$this->_getNeedMemoryForBaseFile() = '.$this->_getNeedMemoryForBaseFile();
172
+
173
+ return $this->_getMemoryLimit() > ($this->_getMemoryUsage() + $this->_getNeedMemoryForFile($file)) || $this->_getMemoryLimit() == -1;
174
+ }
175
+
176
+ protected function _getMemoryLimit()
177
+ {
178
+ $memoryLimit = trim(strtoupper(ini_get('memory_limit')));
179
+
180
+ if (!isSet($memoryLimit[0])){
181
+ $memoryLimit = "128M";
182
+ }
183
+
184
+ if (substr($memoryLimit, -1) == 'K') {
185
+ return substr($memoryLimit, 0, -1) * 1024;
186
+ }
187
+ if (substr($memoryLimit, -1) == 'M') {
188
+ return substr($memoryLimit, 0, -1) * 1024 * 1024;
189
+ }
190
+ if (substr($memoryLimit, -1) == 'G') {
191
+ return substr($memoryLimit, 0, -1) * 1024 * 1024 * 1024;
192
+ }
193
+ return $memoryLimit;
194
+ }
195
+
196
+ protected function _getMemoryUsage()
197
+ {
198
+ if (function_exists('memory_get_usage')) {
199
+ return memory_get_usage();
200
+ }
201
+ return 0;
202
+ }
203
+
204
+ protected function _getNeedMemoryForFile($file = null)
205
+ {
206
+ $file = is_null($file) ? $this->getBaseFile() : $file;
207
+ if (!$file) {
208
+ return 0;
209
+ }
210
+
211
+ if (!file_exists($file) || !is_file($file)) {
212
+ return 0;
213
+ }
214
+
215
+ $imageInfo = getimagesize($file);
216
+
217
+ if (!isset($imageInfo[0]) || !isset($imageInfo[1])) {
218
+ return 0;
219
+ }
220
+ if (!isset($imageInfo['channels'])) {
221
+ // if there is no info about this parameter lets set it for maximum
222
+ $imageInfo['channels'] = 4;
223
+ }
224
+ if (!isset($imageInfo['bits'])) {
225
+ // if there is no info about this parameter lets set it for maximum
226
+ $imageInfo['bits'] = 8;
227
+ }
228
+ return round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $imageInfo['channels'] / 8 + Pow(2, 16)) * 1.65);
229
+ }
230
+
231
+ /**
232
+ * Convert array of 3 items (decimal r, g, b) to string of their hex values
233
+ *
234
+ * @param array $rgbArray
235
+ * @return string
236
+ */
237
+ protected function _rgbToString($rgbArray)
238
+ {
239
+ $result = array();
240
+ foreach ($rgbArray as $value) {
241
+ if (null === $value) {
242
+ $result[] = 'null';
243
+ }
244
+ else {
245
+ $result[] = sprintf('%02s', dechex($value));
246
+ }
247
+ }
248
+ return implode($result);
249
+ }
250
+
251
+ /**
252
+ * Set filenames for base file and new file
253
+ *
254
+ * @param string $file
255
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
256
+ */
257
+ public function setBaseFile($file)
258
+ {
259
+ $this->_isBaseFilePlaceholder = false;
260
+
261
+ if (($file) && (0 !== strpos($file, '/', 0))) {
262
+ $file = '/' . $file;
263
+ }
264
+ $baseDir = Mage::getSingleton('aslideshow/config')->getBaseMediaPath();
265
+
266
+ if ('/no_selection' == $file) {
267
+ $file = null;
268
+ }
269
+ if ($file) {
270
+ if ((!file_exists($baseDir . $file)) || !$this->_checkMemory($baseDir . $file)) {
271
+ $file = null;
272
+ }
273
+ }
274
+ if (!$file) {
275
+ // check if placeholder defined in config
276
+ $isConfigPlaceholder = Mage::getStoreConfig("catalog/placeholder/{$this->getDestinationSubdir()}_placeholder");
277
+ $configPlaceholder = '/placeholder/' . $isConfigPlaceholder;
278
+ if ($isConfigPlaceholder && file_exists($baseDir . $configPlaceholder)) {
279
+ $file = $configPlaceholder;
280
+ }
281
+ else {
282
+ // replace file with skin or default skin placeholder
283
+ $skinBaseDir = Mage::getDesign()->getSkinBaseDir();
284
+ $skinPlaceholder = "/images/catalog/product/placeholder/{$this->getDestinationSubdir()}.jpg";
285
+ $file = $skinPlaceholder;
286
+ if (file_exists($skinBaseDir . $file)) {
287
+ $baseDir = $skinBaseDir;
288
+ }
289
+ else {
290
+ $baseDir = Mage::getDesign()->getSkinBaseDir(array('_theme' => 'default'));
291
+ if (!file_exists($baseDir . $file)) {
292
+ $baseDir = Mage::getDesign()->getSkinBaseDir(array('_theme' => 'default', '_package' => 'base'));
293
+ }
294
+ }
295
+ }
296
+ $this->_isBaseFilePlaceholder = true;
297
+ }
298
+
299
+ $baseFile = $baseDir . $file;
300
+
301
+ if ((!$file) || (!file_exists($baseFile))) {
302
+ throw new Exception(Mage::helper('catalog')->__('Image file was not found.'));
303
+ }
304
+
305
+ $this->_baseFile = $baseFile;
306
+
307
+ // build new filename (most important params)
308
+ $path = array(
309
+ Mage::getSingleton('aslideshow/config')->getBaseMediaPath(),
310
+ 'cache',
311
+ Mage::app()->getStore()->getId(),
312
+ #$path[] = $this->getDestinationSubdir()
313
+ );
314
+ if((!empty($this->_width)) || (!empty($this->_height)))
315
+ $path[] = "{$this->_width}x{$this->_height}";
316
+
317
+ // add misk params as a hash
318
+ $miscParams = array(
319
+ ($this->_keepAspectRatio ? '' : 'non') . 'proportional',
320
+ ($this->_keepFrame ? '' : 'no') . 'frame',
321
+ ($this->_keepTransparency ? '' : 'no') . 'transparency',
322
+ ($this->_constrainOnly ? 'do' : 'not') . 'constrainonly',
323
+ $this->_rgbToString($this->_backgroundColor),
324
+ 'angle' . $this->_angle,
325
+ 'quality' . $this->_quality
326
+ );
327
+
328
+ // if has watermark add watermark params to hash
329
+ if ($this->getWatermarkFile()) {
330
+ $miscParams[] = $this->getWatermarkFile();
331
+ $miscParams[] = $this->getWatermarkImageOpacity();
332
+ $miscParams[] = $this->getWatermarkPosition();
333
+ $miscParams[] = $this->getWatermarkWidth();
334
+ $miscParams[] = $this->getWatermarkHeigth();
335
+ }
336
+
337
+ $path[] = md5(implode('_', $miscParams));
338
+
339
+ // append prepared filename
340
+ $this->_newFile = implode('/', $path) . $file; // the $file contains heading slash
341
+
342
+ return $this;
343
+ }
344
+
345
+ public function getBaseFile()
346
+ {
347
+ return $this->_baseFile;
348
+ }
349
+
350
+ public function getNewFile()
351
+ {
352
+ return $this->_newFile;
353
+ }
354
+
355
+ /**
356
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
357
+ */
358
+ public function setImageProcessor($processor)
359
+ {
360
+ $this->_processor = $processor;
361
+ return $this;
362
+ }
363
+
364
+ /**
365
+ * @return Varien_Image
366
+ */
367
+ public function getImageProcessor()
368
+ {
369
+ if( !$this->_processor ) {
370
+ // var_dump($this->_checkMemory());
371
+ // if (!$this->_checkMemory()) {
372
+ // $this->_baseFile = null;
373
+ // }
374
+ $this->_processor = new Varien_Image($this->getBaseFile());
375
+ }
376
+ $this->_processor->keepAspectRatio($this->_keepAspectRatio);
377
+ $this->_processor->keepFrame($this->_keepFrame);
378
+ $this->_processor->keepTransparency($this->_keepTransparency);
379
+ $this->_processor->constrainOnly($this->_constrainOnly);
380
+ $this->_processor->backgroundColor($this->_backgroundColor);
381
+ #$this->_processor->quality($this->_quality);
382
+ return $this->_processor;
383
+ }
384
+
385
+ /**
386
+ * @see Varien_Image_Adapter_Abstract
387
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
388
+ */
389
+ public function resize()
390
+ {
391
+ if (is_null($this->getWidth()) && is_null($this->getHeight())) {
392
+ return $this;
393
+ }
394
+ $this->getImageProcessor()->resize($this->_width, $this->_height);
395
+ return $this;
396
+ }
397
+
398
+ /**
399
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
400
+ */
401
+ public function rotate($angle)
402
+ {
403
+ $angle = intval($angle);
404
+ $this->getImageProcessor()->rotate($angle);
405
+ return $this;
406
+ }
407
+
408
+ /**
409
+ * Set angle for rotating
410
+ *
411
+ * This func actually affects only the cache filename.
412
+ *
413
+ * @param int $angle
414
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
415
+ */
416
+ public function setAngle($angle)
417
+ {
418
+ $this->_angle = $angle;
419
+ return $this;
420
+ }
421
+
422
+ /**
423
+ * Add watermark to image
424
+ * size param in format 100x200
425
+ *
426
+ * @param string $fileName
427
+ * @param string $position
428
+ * @param string $size
429
+ * @param int $width
430
+ * @param int $heigth
431
+ * @param int $imageOpacity
432
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
433
+ */
434
+ public function setWatermark($file, $position=null, $size=null, $width=null, $heigth=null, $imageOpacity=null)
435
+ {
436
+ if ($this->_isBaseFilePlaceholder)
437
+ {
438
+ return $this;
439
+ }
440
+
441
+ if ($file) {
442
+ $this->setWatermarkFile($file);
443
+ } else {
444
+ return $this;
445
+ }
446
+
447
+ if ($position)
448
+ $this->setWatermarkPosition($position);
449
+ if ($size)
450
+ $this->setWatermarkSize($size);
451
+ if ($width)
452
+ $this->setWatermarkWidth($width);
453
+ if ($heigth)
454
+ $this->setWatermarkHeigth($heigth);
455
+ if ($imageOpacity)
456
+ $this->setImageOpacity($imageOpacity);
457
+
458
+ $filePath = $this->_getWatermarkFilePath();
459
+
460
+ if($filePath) {
461
+ $this->getImageProcessor()
462
+ ->setWatermarkPosition( $this->getWatermarkPosition() )
463
+ ->setWatermarkImageOpacity( $this->getWatermarkImageOpacity() )
464
+ ->setWatermarkWidth( $this->getWatermarkWidth() )
465
+ ->setWatermarkHeigth( $this->getWatermarkHeigth() )
466
+ ->watermark($filePath);
467
+ }
468
+
469
+ return $this;
470
+ }
471
+
472
+ /**
473
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
474
+ */
475
+ public function saveFile()
476
+ {
477
+ $this->getImageProcessor()->save($this->getNewFile());
478
+ return $this;
479
+ }
480
+
481
+ /**
482
+ * @return string
483
+ */
484
+ public function getUrl()
485
+ {
486
+ $baseDir = Mage::getBaseDir('media');
487
+ $path = str_replace($baseDir . DS, "", $this->_newFile);
488
+ return Mage::getBaseUrl('media') . str_replace(DS, '/', $path);
489
+ }
490
+
491
+ public function push()
492
+ {
493
+ $this->getImageProcessor()->display();
494
+ }
495
+
496
+ /**
497
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
498
+ */
499
+ public function setDestinationSubdir($dir)
500
+ {
501
+ $this->_destinationSubdir = $dir;
502
+ return $this;
503
+ }
504
+
505
+ /**
506
+ * @return string
507
+ */
508
+ public function getDestinationSubdir()
509
+ {
510
+ return $this->_destinationSubdir;
511
+ }
512
+
513
+ public function isCached()
514
+ {
515
+ return file_exists($this->_newFile);
516
+ }
517
+
518
+ /**
519
+ * Set watermark file name
520
+ *
521
+ * @param string $file
522
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
523
+ */
524
+ public function setWatermarkFile($file)
525
+ {
526
+ $this->_watermarkFile = $file;
527
+ return $this;
528
+ }
529
+
530
+ /**
531
+ * Get watermark file name
532
+ *
533
+ * @return string
534
+ */
535
+ public function getWatermarkFile()
536
+ {
537
+ return $this->_watermarkFile;
538
+ }
539
+
540
+ /**
541
+ * Get relative watermark file path
542
+ * or false if file not found
543
+ *
544
+ * @return string | bool
545
+ */
546
+ protected function _getWatermarkFilePath()
547
+ {
548
+ $filePath = false;
549
+
550
+ if (!$file = $this->getWatermarkFile())
551
+ {
552
+ return $filePath;
553
+ }
554
+
555
+ $baseDir = Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath();
556
+
557
+ if( file_exists($baseDir . '/watermark/stores/' . Mage::app()->getStore()->getId() . $file) ) {
558
+ $filePath = $baseDir . '/watermark/stores/' . Mage::app()->getStore()->getId() . $file;
559
+ } elseif ( file_exists($baseDir . '/watermark/websites/' . Mage::app()->getWebsite()->getId() . $file) ) {
560
+ $filePath = $baseDir . '/watermark/websites/' . Mage::app()->getWebsite()->getId() . $file;
561
+ } elseif ( file_exists($baseDir . '/watermark/default/' . $file) ) {
562
+ $filePath = $baseDir . '/watermark/default/' . $file;
563
+ } elseif ( file_exists($baseDir . '/watermark/' . $file) ) {
564
+ $filePath = $baseDir . '/watermark/' . $file;
565
+ } else {
566
+ $baseDir = Mage::getDesign()->getSkinBaseDir();
567
+ if( file_exists($baseDir . $file) ) {
568
+ $filePath = $baseDir . $file;
569
+ }
570
+ }
571
+
572
+ return $filePath;
573
+ }
574
+
575
+ /**
576
+ * Set watermark position
577
+ *
578
+ * @param string $position
579
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
580
+ */
581
+ public function setWatermarkPosition($position)
582
+ {
583
+ $this->_watermarkPosition = $position;
584
+ return $this;
585
+ }
586
+
587
+ /**
588
+ * Get watermark position
589
+ *
590
+ * @return string
591
+ */
592
+ public function getWatermarkPosition()
593
+ {
594
+ return $this->_watermarkPosition;
595
+ }
596
+
597
+ /**
598
+ * Set watermark image opacity
599
+ *
600
+ * @param int $imageOpacity
601
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
602
+ */
603
+ public function setWatermarkImageOpacity($imageOpacity)
604
+ {
605
+ $this->_watermarkImageOpacity = $imageOpacity;
606
+ return $this;
607
+ }
608
+
609
+ /**
610
+ * Get watermark image opacity
611
+ *
612
+ * @return int
613
+ */
614
+ public function getWatermarkImageOpacity()
615
+ {
616
+ return $this->_watermarkImageOpacity;
617
+ }
618
+
619
+ /**
620
+ * Set watermark size
621
+ *
622
+ * @param array $size
623
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
624
+ */
625
+ public function setWatermarkSize($size)
626
+ {
627
+ if( is_array($size) ) {
628
+ $this->setWatermarkWidth($size['width'])
629
+ ->setWatermarkHeigth($size['heigth']);
630
+ }
631
+ return $this;
632
+ }
633
+
634
+ /**
635
+ * Set watermark width
636
+ *
637
+ * @param int $width
638
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
639
+ */
640
+ public function setWatermarkWidth($width)
641
+ {
642
+ $this->_watermarkWidth = $width;
643
+ return $this;
644
+ }
645
+
646
+ /**
647
+ * Get watermark width
648
+ *
649
+ * @return int
650
+ */
651
+ public function getWatermarkWidth()
652
+ {
653
+ return $this->_watermarkWidth;
654
+ }
655
+
656
+ /**
657
+ * Set watermark heigth
658
+ *
659
+ * @param int $heigth
660
+ * @return MGS_ResponsiveSlideshow_Model_Slideshow_Image
661
+ */
662
+ public function setWatermarkHeigth($heigth)
663
+ {
664
+ $this->_watermarkHeigth = $heigth;
665
+ return $this;
666
+ }
667
+
668
+ /**
669
+ * Get watermark heigth
670
+ *
671
+ * @return string
672
+ */
673
+ public function getWatermarkHeigth()
674
+ {
675
+ return $this->_watermarkHeigth;
676
+ }
677
+
678
+ public function clearCache()
679
+ {
680
+ #$directory = Mage::getBaseDir('media') . DS.'catalog'.DS.'product'.DS.'cache'.DS;
681
+ $directory = Mage::getSingleton('aslideshow/config')->getBaseMediaPath() .DS.'cache'.DS;
682
+ $io = new Varien_Io_File();
683
+ $io->rmdir($directory, true);
684
+ }
685
+ }
app/code/local/MGS/ResponsiveSlideshow/controllers/Adminhtml/SlideshowController.php ADDED
@@ -0,0 +1,355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Adminhtml_SlideshowController extends Mage_Adminhtml_Controller_Action {
20
+ protected function _initAction() {
21
+ $this->loadLayout()
22
+ ->_setActiveMenu('aslideshow');
23
+ $id = $this->getRequest()->getParam('id');
24
+ $_slideshow = Mage::getModel('aslideshow/slideshow')->load($id);
25
+
26
+ if ($_slideshow->getId() || $id == 0) {
27
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
28
+ if (!empty($data)) {
29
+ $_slideshow->setData($data);
30
+ }
31
+ }
32
+ Mage::register('slideshow_data', $_slideshow);
33
+ Mage::register('current_slideshow', $_slideshow);
34
+ return $this;
35
+ }
36
+
37
+ public function indexAction() {
38
+ $this->_title($this->__('Slideshow Manager'));
39
+ $this->_initAction();
40
+ $this->_addContent($this->getLayout()->createBlock('aslideshow/adminhtml_slideshow'));
41
+ $this->renderLayout();
42
+ }
43
+
44
+ public function addAction() {
45
+ $this->_title($this->__('New Slideshow'));
46
+
47
+ $_model = Mage::getModel('aslideshow/slideshow');
48
+ //Mage::register('slideshow_data', $_model);
49
+ //Mage::register('current_slideshow', $_model);
50
+
51
+ $this->_initAction();
52
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Slideshow Manager'), Mage::helper('adminhtml')->__('Slideshow Manager'), $this->getUrl('*/*/'));
53
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Add Slideshow'), Mage::helper('adminhtml')->__('Add Slideshow'));
54
+
55
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
56
+
57
+ /* $this->_addContent($this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_add'))
58
+ ->_addLeft($this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_add_tabs'));*/
59
+ $this->_addContent($this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_edit'))
60
+ ->_addLeft($this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_edit_tabs'));
61
+
62
+ $this->renderLayout();
63
+ }
64
+
65
+ public function editAction() {
66
+ $slideshowId = $this->getRequest()->getParam('id');
67
+ $_model = Mage::getModel('aslideshow/slideshow')->load($slideshowId);
68
+
69
+ if ($_model->getId()) {
70
+ $this->_title($_model->getId() ? $_model->getName() : $this->__('New Slideshow'));
71
+
72
+ //Mage::register('slideshow_data', $_model);
73
+ //Mage::register('current_slideshow', $_model);
74
+
75
+ $this->_initAction();
76
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Slideshow Manager'), Mage::helper('adminhtml')->__('Slideshow Manager'), $this->getUrl('*/*/'));
77
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Edit Slideshow'), Mage::helper('adminhtml')->__('Edit Slideshow'));
78
+
79
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
80
+ $this->_addContent($this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_edit'))
81
+ ->_addLeft($this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_edit_tabs'));
82
+
83
+ $this->renderLayout();
84
+ } else {
85
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('aslideshow')->__('The slideshow does not exist.'));
86
+ $this->_redirect('*/*/');
87
+ }
88
+ }
89
+
90
+ public function saveAction() {
91
+ if ($data = $this->getRequest()->getPost()) {//echo '<pre>'; print_r($data); die();
92
+ if(isset($data['products']['slideshow'])){
93
+ $data['products']['slideshow'] = Mage::helper('adminhtml/js')->decodeGridSerializedInput($data['products']['slideshow']);
94
+ }
95
+ if(isset($data['staticblocks']['slideshow'])){
96
+ $data['staticblocks']['slideshow'] = Mage::helper('adminhtml/js')->decodeGridSerializedInput($data['staticblocks']['slideshow']);
97
+ }
98
+ $_model = Mage::getModel('aslideshow/slideshow');
99
+ if (isset($data['categories'])) {
100
+ $data['categories'] = explode(',',$data['categories']);
101
+ if (is_array($data['categories'])) {
102
+ $data['categories'] = array_unique($data['categories']);
103
+ }
104
+ }
105
+
106
+ $_model->setData($data)
107
+ ->setId($this->getRequest()->getParam('id'));
108
+
109
+ try {
110
+ $_model->save();
111
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('aslideshow')->__('Slideshow was successfully saved'));
112
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
113
+
114
+ if ($this->getRequest()->getParam('back')) {
115
+ $this->_redirect('*/*/edit', array('id' => $_model->getId()));
116
+ return;
117
+ }
118
+ $this->_redirect('*/*/');
119
+ return;
120
+ } catch (Exception $e) {
121
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
122
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
123
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
124
+ return;
125
+ }
126
+ }
127
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('aslideshow')->__('Unable to find slideshow to save'));
128
+ $this->_redirect('*/*/');
129
+ }
130
+
131
+ public function deleteAction() {
132
+ if( $this->getRequest()->getParam('id') > 0 ) {
133
+ try {
134
+ $model = Mage::getModel('aslideshow/slideshow');
135
+
136
+ $model->setId($this->getRequest()->getParam('id'))
137
+ ->delete();
138
+
139
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Slideshow was successfully deleted'));
140
+ $this->_redirect('*/*/');
141
+ } catch (Exception $e) {
142
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
143
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
144
+ }
145
+ }
146
+ $this->_redirect('*/*/');
147
+ }
148
+
149
+ public function massDeleteAction() {
150
+ $IDList = $this->getRequest()->getParam('slideshow');
151
+ if(!is_array($IDList)) {
152
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select slideshow(s)'));
153
+ } else {
154
+ try {
155
+ foreach ($IDList as $itemId) {
156
+ $_model = Mage::getModel('aslideshow/slideshow')
157
+ ->setIsMassDelete(true)->load($itemId);
158
+ $_model->delete();
159
+ }
160
+ Mage::getSingleton('adminhtml/session')->addSuccess(
161
+ Mage::helper('adminhtml')->__(
162
+ 'Total of %d record(s) were successfully deleted', count($IDList)
163
+ )
164
+ );
165
+ } catch (Exception $e) {
166
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
167
+ }
168
+ }
169
+ $this->_redirect('*/*/index');
170
+ }
171
+
172
+ public function massStatusAction() {
173
+ $IDList = $this->getRequest()->getParam('slideshow');
174
+ if(!is_array($IDList)) {
175
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select slideshow(s)'));
176
+ } else {
177
+ try {
178
+ if($this->getRequest()->getParam('status') == 2) {
179
+ $_status = 0;
180
+ } else {
181
+ $_status = 1;
182
+ }
183
+ foreach ($IDList as $itemId) {
184
+ /*$_model = Mage::getSingleton('aslideshow/slideshow')
185
+ ->setIsMassStatus(true)
186
+ ->load($itemId)
187
+ ->setIsActive($_status)
188
+ ->save();*/
189
+ Mage::getResourceModel('aslideshow/slideshow')->updateIsActive($_status, $itemId);
190
+ }
191
+ $this->_getSession()->addSuccess(
192
+ $this->__('Total of %d record(s) were successfully updated', count($IDList))
193
+ );
194
+ } catch (Exception $e) {
195
+ $this->_getSession()->addError($e->getMessage());
196
+ }
197
+ }
198
+ $this->_redirect('*/*/index');
199
+ }
200
+
201
+ public function imageAction() {
202
+ $result = array();
203
+ try {
204
+ $uploader = new MGS_ResponsiveSlideshow_Media_Uploader('image');
205
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
206
+ $uploader->setAllowRenameFiles(true);
207
+ $uploader->setFilesDispersion(true);
208
+ $result = $uploader->save(
209
+ Mage::getSingleton('aslideshow/config')->getBaseMediaPath()
210
+ );
211
+
212
+ $result['url'] = Mage::getSingleton('aslideshow/config')->getMediaUrl($result['file']);
213
+ $result['cookie'] = array(
214
+ 'name' => session_name(),
215
+ 'value' => $this->_getSession()->getSessionId(),
216
+ 'lifetime' => $this->_getSession()->getCookieLifetime(),
217
+ 'path' => $this->_getSession()->getCookiePath(),
218
+ 'domain' => $this->_getSession()->getCookieDomain()
219
+ );
220
+ } catch (Exception $e) {
221
+ $result = array('error'=>$e->getMessage(), 'errorcode'=>$e->getCode());
222
+ }
223
+
224
+ $this->getResponse()->setBody(Zend_Json::encode($result));
225
+ }
226
+
227
+ public function categoriesJsonAction()
228
+ {
229
+ $slideshowId = $this->getRequest()->getParam('id');
230
+ $_model = Mage::getModel('aslideshow/slideshow')->load($slideshowId);
231
+ Mage::register('slideshow_data', $_model);
232
+ Mage::register('current_slideshow', $_model);
233
+
234
+ $this->getResponse()->setBody(
235
+ $this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_edit_tab_category')
236
+ ->getCategoryChildrenJson($this->getRequest()->getParam('category'))
237
+ );
238
+ }
239
+
240
+ public function productAction()
241
+ {
242
+ $this->_initAction();
243
+ $this->loadLayout();
244
+ $this->getLayout()->getBlock('aslideshow.slideshow.edit.tab.products')
245
+ ->setProductsRelated($this->getRequest()->getPost('products_slideshow', null));
246
+ $this->renderLayout();
247
+ }
248
+
249
+ public function productGridAction()
250
+ {
251
+ $this->_initAction();
252
+ $this->loadLayout();
253
+ $this->getLayout()->getBlock('aslideshow.slideshow.edit.tab.products')
254
+ ->setProductsRelated($this->getRequest()->getPost('products_slideshow', null));
255
+ $this->renderLayout();
256
+ /*$id = $this->getRequest()->getParam('id');
257
+ $model = Mage::getModel('aslideshow/slideshow');
258
+
259
+ if ($id) {
260
+ $model->load($id);
261
+ }
262
+ $this->getResponse()->setBody($this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_edit_tab_products')->toHtml());*/
263
+ }
264
+
265
+ public function staticblockAction()
266
+ {
267
+ $this->_initAction();
268
+ $this->loadLayout();
269
+ $this->getLayout()->getBlock('aslideshow.slideshow.edit.tab.staticblocks')
270
+ ->setProductsRelated($this->getRequest()->getPost('staticblocks_slideshow', null));
271
+ $this->renderLayout();
272
+ }
273
+
274
+ public function staticblockGridAction()
275
+ {
276
+ $this->_initAction();
277
+ $this->loadLayout();
278
+ $this->getLayout()->getBlock('aslideshow.slideshow.edit.tab.staticblocks')
279
+ ->setProductsRelated($this->getRequest()->getPost('staticblocks_slideshow', null));
280
+ $this->renderLayout();
281
+ /*$id = $this->getRequest()->getParam('id');
282
+ $model = Mage::getModel('aslideshow/slideshow');
283
+
284
+ if ($id) {
285
+ $model->load($id);
286
+ }
287
+ $this->getResponse()->setBody($this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_edit_tab_products')->toHtml());*/
288
+ }
289
+
290
+ /* public function productsGridAction()
291
+ {
292
+ $this->_initProduct();
293
+ $this->loadLayout();
294
+ $this->getLayout()->getBlock('catalog.product.edit.tab.related')
295
+ ->setProductsRelated($this->getRequest()->getPost('products_related', null));
296
+ $this->renderLayout();
297
+ }*/
298
+
299
+ /**
300
+ * Create serializer block for a grid
301
+ *
302
+ * @param string $inputName
303
+ * @param Mage_Adminhtml_Block_Widget_Grid $gridBlock
304
+ * @param array $productsArray
305
+ * @return Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Ajax_Serializer
306
+ */
307
+ /*protected function _createSerializerBlock($inputName, Mage_Adminhtml_Block_Widget_Grid $gridBlock, $productsArray)
308
+ {
309
+ return $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_ajax_serializer')
310
+ ->setGridBlock($gridBlock)
311
+ ->setProducts($productsArray)
312
+ ->setInputElementName($inputName)
313
+ ;
314
+ }*/
315
+
316
+
317
+ /**
318
+ * Add an extra title to the end or one from the end, or remove all
319
+ *
320
+ * Usage examples:
321
+ * $this->_title('foo')->_title('bar');
322
+ * => bar / foo / <default title>
323
+ *
324
+ * $this->_title()->_title('foo')->_title('bar');
325
+ * => bar / foo
326
+ *
327
+ * $this->_title('foo')->_title(false)->_title('bar');
328
+ * bar / <default title>
329
+ *
330
+ * @see self::_renderTitles()
331
+ * @param string|false|-1|null $text
332
+ * @return Mage_Core_Controller_Varien_Action
333
+ */
334
+ protected function _title($text = null, $resetIfExists = true)
335
+ {
336
+ if (is_string($text)) {
337
+ $this->_titles[] = $text;
338
+ } elseif (-1 === $text) {
339
+ if (empty($this->_titles)) {
340
+ $this->_removeDefaultTitle = true;
341
+ } else {
342
+ array_pop($this->_titles);
343
+ }
344
+ } elseif (empty($this->_titles) || $resetIfExists) {
345
+ if (false === $text) {
346
+ $this->_removeDefaultTitle = false;
347
+ $this->_titles = array();
348
+ } elseif (null === $text) {
349
+ $this->_removeDefaultTitle = true;
350
+ $this->_titles = array();
351
+ }
352
+ }
353
+ return $this;
354
+ }
355
+ }
app/code/local/MGS/ResponsiveSlideshow/controllers/Adminhtml/WidgetController.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ class MGS_ResponsiveSlideshow_Adminhtml_WidgetController extends Mage_Adminhtml_Controller_Action
20
+ {
21
+ /**
22
+ * Chooser Source action
23
+ */
24
+ public function chooserAction()
25
+ {
26
+ $uniqId = $this->getRequest()->getParam('uniq_id');
27
+ $pagesGrid = $this->getLayout()->createBlock('aslideshow/adminhtml_slideshow_widget_chooser', '', array(
28
+ 'id' => $uniqId,
29
+ ));
30
+ $this->getResponse()->setBody($pagesGrid->toHtml());
31
+ }
32
+ }
app/code/local/MGS/ResponsiveSlideshow/etc/config.xml ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * MGS_ResponsiveSlideshow Extension
5
+ *
6
+ * @category Local
7
+ * @package MGS_ResponsiveSlideshow
8
+ * @author dungnv (dungnv@arrowhitech.com)
9
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
10
+ *
11
+ */
12
+
13
+ /**
14
+ *
15
+ * @category Local
16
+ * @package MGS_ResponsiveSlideshow
17
+ * @author dungnv <dungnv@arrowhitech.com>
18
+ */
19
+
20
+ -->
21
+ <config>
22
+ <modules>
23
+ <MGS_ResponsiveSlideshow>
24
+ <version>1.0.2</version>
25
+ </MGS_ResponsiveSlideshow>
26
+ </modules>
27
+ <frontend>
28
+ <routers>
29
+ <aslideshow>
30
+ <use>standard</use>
31
+ <args>
32
+ <module>MGS_ResponsiveSlideshow</module>
33
+ <frontName>aslideshow</frontName>
34
+ </args>
35
+ </aslideshow>
36
+ </routers>
37
+ <layout>
38
+ <updates>
39
+ <aslideshow>
40
+ <file>mgs_responsiveslideshow.xml</file>
41
+ </aslideshow>
42
+ </updates>
43
+ </layout>
44
+ </frontend>
45
+ <admin>
46
+ <routers>
47
+ <aslideshow>
48
+ <use>admin</use>
49
+ <args>
50
+ <module>MGS_ResponsiveSlideshow</module>
51
+ <frontName>aslideshow</frontName>
52
+ </args>
53
+ </aslideshow>
54
+ </routers>
55
+ </admin>
56
+ <adminhtml>
57
+ <acl>
58
+ <resources>
59
+ <admin>
60
+ <children>
61
+ <aslideshow>
62
+ <title>Slideshow</title>
63
+ <sort_order>2</sort_order>
64
+ <children>
65
+ <index>
66
+ <title>Manage Slideshow</title>
67
+ <sort_order>1</sort_order>
68
+ </index>
69
+ <new>
70
+ <title>Add Slideshow</title>
71
+ <sort_order>2</sort_order>
72
+ </new>
73
+ </children>
74
+ </aslideshow>
75
+ <system>
76
+ <children>
77
+ <config>
78
+ <children>
79
+ <aslideshow>
80
+ <title>Slideshow Section</title>
81
+ </aslideshow>
82
+ </children>
83
+ </config>
84
+ </children>
85
+ </system>
86
+ </children>
87
+ </admin>
88
+ </resources>
89
+ </acl>
90
+ <!--<menu>
91
+ <aslideshow module="aslideshow">
92
+ <title>Slideshow</title>
93
+ <sort_order>50</sort_order>
94
+ <children>
95
+ <add module="aslideshow">
96
+ <title>Add Slideshow</title>
97
+ <sort_order>0</sort_order>
98
+ <action>aslideshow/adminhtml_slideshow/add</action>
99
+ </add>
100
+ <index module="aslideshow">
101
+ <title>Manage Slideshow</title>
102
+ <sort_order>1</sort_order>
103
+ <action>aslideshow/adminhtml_slideshow/index</action>
104
+ </index>
105
+ </children>
106
+ </aslideshow>
107
+ </menu>-->
108
+ <menu>
109
+ <mgscore module="mgscore">
110
+ <children>
111
+ <aslideshow>
112
+ <title>Slideshow</title>
113
+ <sort_order>2</sort_order>
114
+ <children>
115
+ <add>
116
+ <title>Add Slideshow</title>
117
+ <sort_order>1</sort_order>
118
+ <action>aslideshow/adminhtml_slideshow/add</action>
119
+ </add>
120
+ <index>
121
+ <title>Manage Slideshow</title>
122
+ <sort_order>2</sort_order>
123
+ <action>aslideshow/adminhtml_slideshow/index</action>
124
+ </index>
125
+ </children>
126
+ </aslideshow>
127
+ </children>
128
+ </mgscore>
129
+ </menu>
130
+ <layout>
131
+ <updates>
132
+ <aslideshow>
133
+ <file>aslideshow.xml</file>
134
+ </aslideshow>
135
+ </updates>
136
+ </layout>
137
+ </adminhtml>
138
+ <global>
139
+ <blocks>
140
+ <aslideshow>
141
+ <class>MGS_ResponsiveSlideshow_Block</class>
142
+ </aslideshow>
143
+ </blocks>
144
+ <models>
145
+ <aslideshow>
146
+ <class>MGS_ResponsiveSlideshow_Model</class>
147
+ <resourceModel>aslideshow_mysql4</resourceModel>
148
+ </aslideshow>
149
+ <aslideshow_mysql4>
150
+ <class>MGS_ResponsiveSlideshow_Model_Mysql4</class>
151
+ <entities>
152
+ <slideshow>
153
+ <table>mgs_reponsiveslideshow_slideshow</table>
154
+ </slideshow>
155
+ <slideshow_image>
156
+ <table>mgs_reponsiveslideshow_slideshow_image</table>
157
+ </slideshow_image>
158
+ <slideshow_category>
159
+ <table>mgs_reponsiveslideshow_slideshow_category</table>
160
+ </slideshow_category>
161
+ <slideshow_product>
162
+ <table>mgs_reponsiveslideshow_slideshow_product</table>
163
+ </slideshow_product>
164
+ <slideshow_staticblock>
165
+ <table>mgs_reponsiveslideshow_slideshow_staticblock</table>
166
+ </slideshow_staticblock>
167
+ <slideshow_page>
168
+ <table>mgs_reponsiveslideshow_slideshow_page</table>
169
+ </slideshow_page>
170
+ <slideshow_store>
171
+ <table>mgs_reponsiveslideshow_slideshow_store</table>
172
+ </slideshow_store>
173
+ </entities>
174
+ </aslideshow_mysql4>
175
+ </models>
176
+ <helpers>
177
+ <aslideshow>
178
+ <class>MGS_ResponsiveSlideshow_Helper</class>
179
+ </aslideshow>
180
+ </helpers>
181
+ <resources>
182
+ <aslideshow_setup>
183
+ <setup>
184
+ <module>MGS_ResponsiveSlideshow</module>
185
+ </setup>
186
+ <connection>
187
+ <use>core_setup</use>
188
+ </connection>
189
+ </aslideshow_setup>
190
+ <aslideshow_write>
191
+ <connection>
192
+ <use>core_write</use>
193
+ </connection>
194
+ </aslideshow_write>
195
+ <aslideshow_read>
196
+ <connection>
197
+ <use>core_read</use>
198
+ </connection>
199
+ </aslideshow_read>
200
+ </resources>
201
+ </global>
202
+ </config>
app/code/local/MGS/ResponsiveSlideshow/etc/system.xml ADDED
File without changes
app/code/local/MGS/ResponsiveSlideshow/etc/widget.xml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /** MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+ -->
19
+ <widgets>
20
+ <aslideshow type="aslideshow/widget_slideshow" translate="name description" module="aslideshow">
21
+ <name>Responsive Slideshow</name>
22
+ <description>List of Slideshows</description>
23
+ <is_email_compatible>1</is_email_compatible>
24
+ <parameters>
25
+ <template>
26
+ <required>1</required>
27
+ <visible>1</visible>
28
+ <label>Template</label>
29
+ <type>select</type>
30
+ <value>mgs_responsiveslideshow/widget/responsiveslidehow.phtml</value>
31
+ <values>
32
+ <default translate="label">
33
+ <value>mgs_responsiveslideshow/widget/responsiveslidehow.phtml</value>
34
+ <label>Responsive Slideshow</label>
35
+ </default>
36
+ </values>
37
+ </template>
38
+ <aslideshow_id type="complex" translate="label">
39
+ <visible>1</visible>
40
+ <required>1</required>
41
+ <label>Slideshow</label>
42
+ <type>label</type>
43
+ <helper_block>
44
+ <type>aslideshow/adminhtml_slideshow_widget_chooser</type>
45
+ <data>
46
+ <button translate="open">
47
+ <open>Select Slideshow...</open>
48
+ </button>
49
+ </data>
50
+ </helper_block>
51
+ <sort_order>10</sort_order>
52
+ </aslideshow_id>
53
+ </parameters>
54
+ </aslideshow>
55
+ </widgets>
app/code/local/MGS/ResponsiveSlideshow/sql/aslideshow_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+
20
+ $installer = $this;
21
+ /* @var $installer Mage_Core_Model_Resource_Setup */
22
+
23
+ $installer->startSetup();
24
+
25
+ $installer->run("
26
+
27
+ -- DROP TABLE IF EXISTS `{$this->getTable('aslideshow/slideshow')}`;
28
+ CREATE TABLE `{$this->getTable('aslideshow/slideshow')}` (
29
+ `slideshow_id` smallint(6) NOT NULL AUTO_INCREMENT,
30
+ `name` varchar(255) DEFAULT '',
31
+ `slideshow_for` varchar(50) DEFAULT NULL,
32
+ `product_ids` text,
33
+ `slideshow_position` varchar(128) DEFAULT NULL,
34
+ `transition` varchar(6) DEFAULT NULL,
35
+ `auto_rotation` tinyint(1) DEFAULT NULL,
36
+ `auto_rotation_speed` varchar(3) DEFAULT NULL,
37
+ `slide_controlls` varchar(6) DEFAULT NULL,
38
+ `animation_speed` int(6) DEFAULT NULL,
39
+ `between_block_delay` varchar(6) DEFAULT NULL,
40
+ `display` varchar(25) DEFAULT NULL,
41
+ `blocksize_width` varchar(4) NOT NULL DEFAULT '80',
42
+ `image_width` int(5) NOT NULL,
43
+ `image_height` varchar(5) NOT NULL,
44
+ `blocksize_height` varchar(4) NOT NULL DEFAULT '80',
45
+ `show_text` tinyint(1) NOT NULL DEFAULT '1',
46
+ `background_opacity` varchar(3) DEFAULT '1',
47
+ `show_price` tinyint(1) NOT NULL DEFAULT '1',
48
+ `show_title` tinyint(1) NOT NULL DEFAULT '1',
49
+ `show_description` varchar(20) NOT NULL,
50
+ `product_image_width` int(5) DEFAULT NULL,
51
+ `product_image_height` int(5) DEFAULT NULL,
52
+ `staticblock_image_width` int(5) DEFAULT NULL,
53
+ `staticblock_image_height` int(5) DEFAULT NULL,
54
+ `sort_order` smallint(5) DEFAULT '0',
55
+ `is_active` tinyint(1) DEFAULT '1',
56
+ PRIMARY KEY (`slideshow_id`)
57
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='My Aslideshow' ;
58
+
59
+ -- DROP TABLE IF EXISTS `{$this->getTable('aslideshow/slideshow_image')}`;
60
+ CREATE TABLE `{$this->getTable('aslideshow/slideshow_image')}` (
61
+ `image_id` smallint(6) NOT NULL AUTO_INCREMENT,
62
+ `label` varchar(255) DEFAULT NULL,
63
+ `caption` varchar(255) DEFAULT NULL,
64
+ `file` varchar(255) DEFAULT NULL,
65
+ `position` smallint(5) DEFAULT '0',
66
+ `disabled` tinyint(1) DEFAULT '1',
67
+ `slideshow_id` smallint(6) DEFAULT '0',
68
+ PRIMARY KEY (`image_id`)
69
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='My Aslideshow Image' ;
70
+
71
+ -- DROP TABLE IF EXISTS `{$this->getTable('aslideshow/slideshow_product')}`;
72
+ CREATE TABLE `{$this->getTable('aslideshow/slideshow_product')}` (
73
+ `slideshow_id` smallint(6) unsigned NOT NULL,
74
+ `product_id` int(10) unsigned NOT NULL,
75
+ `position` int(11) DEFAULT '0'
76
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='My Aslideshow Product' ;
77
+
78
+ -- DROP TABLE IF EXISTS `{$this->getTable('aslideshow/slideshow_staticblock')}`;
79
+ CREATE TABLE `{$this->getTable('aslideshow/slideshow_staticblock')}` (
80
+ `slideshow_id` int(10) unsigned NOT NULL,
81
+ `staticblock_id` int(10) unsigned NOT NULL,
82
+ `staticblock_identifier` varchar(255) DEFAULT NULL,
83
+ `position` int(11) DEFAULT '0'
84
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='My Aslideshow Product' ;
85
+
86
+ -- DROP TABLE IF EXISTS `{$this->getTable('aslideshow/slideshow_category')}`;
87
+ CREATE TABLE `{$this->getTable('aslideshow/slideshow_category')}` (
88
+ `slideshow_id` smallint(6) NOT NULL,
89
+ `category_id` smallint(6) NOT NULL,
90
+ PRIMARY KEY (`slideshow_id`,`category_id`)
91
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='My Aslideshow Category' ;
92
+
93
+ -- DROP TABLE IF EXISTS `{$this->getTable('aslideshow/slideshow_page')}`;
94
+ CREATE TABLE `{$this->getTable('aslideshow/slideshow_page')}` (
95
+ `slideshow_id` smallint(6) NOT NULL,
96
+ `page_id` smallint(6) NOT NULL,
97
+ PRIMARY KEY (`slideshow_id`,`page_id`)
98
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='My Aslideshow Page' ;
99
+
100
+ -- DROP TABLE IF EXISTS `{$this->getTable('aslideshow/slideshow_store')}`;
101
+ CREATE TABLE `{$this->getTable('aslideshow/slideshow_store')}` (
102
+ `slideshow_id` smallint(6) NOT NULL,
103
+ `store_id` smallint(6) NOT NULL,
104
+ PRIMARY KEY (`slideshow_id`,`store_id`)
105
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='My Aslideshow Store' ;
106
+
107
+ ");
108
+
109
+ $installer->endSetup();
app/code/local/MGS/ResponsiveSlideshow/sql/aslideshow_setup/mysql4-upgrade-1.0.0-1.0.1.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+
6
+ $installer->run("
7
+
8
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD animation_loop varchar(20) NOT NULL DEFAULT '1';
9
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD reverse varchar(10) NOT NULL DEFAULT '1';
10
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD slideshow varchar(10) NOT NULL DEFAULT '1';
11
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD direction varchar(20) NOT NULL DEFAULT 'horizontal';
12
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD smooth_height varchar(10) NOT NULL DEFAULT 'false';
13
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD start_at int(5) NOT NULL DEFAULT '0';
14
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD slideshow_speed int(10) NOT NULL DEFAULT '7000';
15
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD init_delay int(10) NOT NULL DEFAULT '0';
16
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD randomize varchar(10) NOT NULL DEFAULT 'true';
17
+
18
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD pause_on_action varchar(10) NOT NULL DEFAULT 'true';
19
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD pause_on_hover varchar(10) NOT NULL DEFAULT 'false';
20
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD use_css varchar(10) NOT NULL DEFAULT 'true';
21
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD touch varchar(10) NOT NULL DEFAULT 'true';
22
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD video varchar(10) NOT NULL DEFAULT 'false';
23
+
24
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD control_nav varchar(10) NOT NULL DEFAULT 'true';
25
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD direction_nav varchar(10) NOT NULL DEFAULT 'true';
26
+
27
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD keyboard varchar(10) NOT NULL DEFAULT 'true';
28
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD multiple_keyboard varchar(10) NOT NULL DEFAULT 'false';
29
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD mousewheel varchar(10) NOT NULL DEFAULT 'false';
30
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD pause_play varchar(10) NOT NULL DEFAULT 'false';
31
+
32
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD item_width int(5) NOT NULL DEFAULT '0';
33
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD item_margin int(5) NOT NULL DEFAULT '0';
34
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD min_items int(5) NOT NULL DEFAULT '0';
35
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD max_items int(5) NOT NULL DEFAULT '0';
36
+
37
+ ALTER TABLE `{$this->getTable('aslideshow/slideshow')}` ADD animation varchar(20) NOT NULL DEFAULT 'fade';
38
+ ALTER TABLE `mgs_reponsiveslideshow_slideshow` CHANGE `transition` `transition` VARCHAR( 40 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'index';
39
+
40
+ ");
41
+
42
+ $installer->endSetup();
app/code/local/MGS/ResponsiveSlideshow/sql/aslideshow_setup/mysql4-upgrade-1.0.1-1.0.2.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+ ALTER TABLE `mgs_reponsiveslideshow_slideshow_image` CHANGE `caption` `caption` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
9
+ ");
10
+
11
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/aslideshow.xml ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category design
23
+ * @package default_default
24
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+
29
+ <layout>
30
+ <aslideshow_adminhtml_slideshow_edit>
31
+ <reference name="head">
32
+ <action method="removeItem"><type>js</type><name>mage/adminhtml/product.js</name></action>
33
+ <action method="addJs"><script>mgs_responsiveslideshow/adminhtml/product.js</script></action>
34
+ </reference>
35
+ <reference name="content">
36
+ <block type="core/template" name="script.aslideshow" template="mgs_responsiveslideshow/script.phtml"/>
37
+ <block type="core/template" name="script.transition.aslideshow" template="mgs_responsiveslideshow/script-transition.phtml"/>
38
+ </reference>
39
+ </aslideshow_adminhtml_slideshow_edit>
40
+ <aslideshow_adminhtml_slideshow_add>
41
+ <reference name="head">
42
+ <action method="removeItem"><type>js</type><name>mage/adminhtml/product.js</name></action>
43
+ <action method="addJs"><script>mgs_responsiveslideshow/adminhtml/product.js</script></action>
44
+ </reference>
45
+ <reference name="content">
46
+ <block type="core/template" name="script.aslideshow" template="mgs_responsiveslideshow/script.phtml"/>
47
+ <block type="core/template" name="script.transition.aslideshow" template="mgs_responsiveslideshow/script-transition.phtml"/>
48
+ </reference>
49
+ </aslideshow_adminhtml_slideshow_add>
50
+ <aslideshow_adminhtml_slideshow_product>
51
+ <block type="core/text_list" name="root" output="toHtml">
52
+ <block type="aslideshow/adminhtml_slideshow_edit_tab_products" name="aslideshow.slideshow.edit.tab.products"/>
53
+ <block type="adminhtml/widget_grid_serializer" name="products_grid_serializer">
54
+ <reference name="products_grid_serializer">
55
+ <action method="initSerializerBlock">
56
+ <grid_block_name>aslideshow.slideshow.edit.tab.products</grid_block_name>
57
+ <data_callback>getSelectedSlideshowProducts</data_callback>
58
+ <hidden_input_name>products[slideshow]</hidden_input_name>
59
+ <reload_param_name>products_slideshow</reload_param_name>
60
+ </action>
61
+ <action method="addColumnInputName">
62
+ <input_name>position</input_name>
63
+ </action>
64
+ </reference>
65
+ </block>
66
+ </block>
67
+ </aslideshow_adminhtml_slideshow_product>
68
+
69
+ <aslideshow_adminhtml_slideshow_productgrid>
70
+ <!--<reference name="head">
71
+ <action method="removeItem"><type>js</type><name>mage/adminhtml/product.js</name></action>
72
+ </reference>-->
73
+ <block type="core/text_list" name="root" output="toHtml">
74
+ <block type="aslideshow/adminhtml_slideshow_edit_tab_products" name="aslideshow.slideshow.edit.tab.products"/>
75
+ </block>
76
+ </aslideshow_adminhtml_slideshow_productgrid>
77
+
78
+ <aslideshow_adminhtml_slideshow_staticblock>
79
+ <block type="core/text_list" name="root" output="toHtml">
80
+ <block type="aslideshow/adminhtml_slideshow_edit_tab_staticblocks" name="aslideshow.slideshow.edit.tab.staticblocks"/>
81
+ <block type="adminhtml/widget_grid_serializer" name="staticblocks_grid_serializer">
82
+ <reference name="staticblocks_grid_serializer">
83
+ <action method="initSerializerBlock">
84
+ <grid_block_name>aslideshow.slideshow.edit.tab.staticblocks</grid_block_name>
85
+ <data_callback>getSelectedSlideshowStaticblocks</data_callback>
86
+ <hidden_input_name>staticblocks[slideshow]</hidden_input_name>
87
+ <reload_param_name>staticblocks_slideshow</reload_param_name>
88
+ </action>
89
+ <action method="addColumnInputName">
90
+ <input_name>position</input_name>
91
+ </action>
92
+ </reference>
93
+ </block>
94
+ </block>
95
+ </aslideshow_adminhtml_slideshow_staticblock>
96
+
97
+ <aslideshow_adminhtml_slideshow_staticblockgrid>
98
+ <!--<reference name="head">
99
+ <action method="removeItem"><type>js</type><name>mage/adminhtml/product.js</name></action>
100
+ </reference>-->
101
+ <block type="core/text_list" name="root" output="toHtml">
102
+ <block type="aslideshow/adminhtml_slideshow_edit_tab_staticblocks" name="aslideshow.slideshow.edit.tab.staticblocks"/>
103
+ </block>
104
+ </aslideshow_adminhtml_slideshow_staticblockgrid>
105
+ </layout>
app/design/adminhtml/default/default/template/mgs_responsiveslideshow/edit/serializer.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2011 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
+
28
+ <?php $_id = 'id_' . md5(microtime()) ?>
29
+ <input type="hidden" name="<?php echo $this->getInputElementName()?>" value="" id="<?php echo $_id?>" />
30
+ <script type="text/javascript">
31
+ // create serializer controller, that will syncronize grid checkboxes with hidden input
32
+ new productLinksController('<?php echo $_id?>', <?php echo $this->getProductsJSON() ?>, <?php echo $this->getGridBlock()->getJsObjectName() ?>);
33
+ </script>
app/design/adminhtml/default/default/template/mgs_responsiveslideshow/edit/tab/category.phtml ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+
19
+ ?>
20
+ <div class="entry-edit">
21
+ <div class="entry-edit-head">
22
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('aslideshow')->__('Banner Categories') ?></h4>
23
+ </div>
24
+ <fieldset id="grop_fields">
25
+ <input type="hidden" name="categories" id="banner_categories" value="<?php echo $this->getIdsString() ?>">
26
+ <div id="banner-categories" class="tree"></div>
27
+ </fieldset>
28
+ </div>
29
+ <input type="hidden" name="category_products" id="in_category_products" value="" />
30
+ <?php if($this->getRootNode() && $this->getRootNode()->hasChildren()): ?>
31
+ <script type="text/javascript">
32
+ Ext.EventManager.onDocumentReady(function() {
33
+ var categoryLoader = new Ext.tree.TreeLoader({
34
+ dataUrl: '<?php echo $this->getLoadTreeUrl()?>'
35
+ });
36
+
37
+ categoryLoader.createNode = function(config) {
38
+ config.uiProvider = Ext.tree.CheckboxNodeUI;
39
+ var node;
40
+ if (config.children && !config.children.length) {
41
+ delete(config.children);
42
+ node = new Ext.tree.AsyncTreeNode(config);
43
+
44
+ } else {
45
+ node = new Ext.tree.TreeNode(config);
46
+ }
47
+ return node;
48
+ };
49
+
50
+ categoryLoader.on("beforeload", function(treeLoader, node) {
51
+ treeLoader.baseParams.category = node.attributes.id;
52
+ });
53
+
54
+ categoryLoader.on("load", function(treeLoader, node, config) {
55
+ varienWindowOnload();
56
+ });
57
+
58
+ var tree = new Ext.tree.TreePanel('banner-categories', {
59
+ animate:true,
60
+ loader: categoryLoader,
61
+ enableDD:false,
62
+ containerScroll: true,
63
+ rootUIProvider: Ext.tree.CheckboxNodeUI,
64
+ selModel: new Ext.tree.CheckNodeMultiSelectionModel(),
65
+ rootVisible: '<?php echo $this->getRootNode()->getIsVisible() ?>'
66
+ });
67
+
68
+ tree.on('check', function(node) {
69
+ if(node.attributes.checked) {
70
+ categoryAdd(node.id);
71
+ } else {
72
+ categoryRemove(node.id);
73
+ }
74
+ varienElementMethods.setHasChanges(node.getUI().checkbox);
75
+ }, tree);
76
+
77
+ // set the root node
78
+ var root = new Ext.tree.TreeNode({
79
+ text: '<?php echo $this->jsQuoteEscape($this->getRootNode()->getName()) ?>',
80
+ draggable:false,
81
+ checked:'<?php echo $this->getRootNode()->getChecked() ?>',
82
+ id:'<?php echo $this->getRootNode()->getId() ?>',
83
+ disabled: <?php echo ($this->getRootNode()->getDisabled() ? 'true' : 'false') ?>,
84
+ uiProvider: Ext.tree.CheckboxNodeUI
85
+ });
86
+
87
+ tree.setRootNode(root);
88
+ bildCategoryTree(root, <?php echo $this->getTreeJson() ?>);
89
+ tree.addListener('click', categoryClick.createDelegate(this));
90
+
91
+ // render the tree
92
+ tree.render();
93
+ root.expand();
94
+ //tree.expandAll();
95
+ });
96
+
97
+ function bildCategoryTree(parent, config){
98
+ if (!config) return null;
99
+
100
+ if (parent && config && config.length){
101
+ for (var i = 0; i < config.length; i++){
102
+ config[i].uiProvider = Ext.tree.CheckboxNodeUI;
103
+ var node;
104
+ var _node = Object.clone(config[i]);
105
+ if (_node.children && !_node.children.length) {
106
+ delete(_node.children);
107
+ node = new Ext.tree.AsyncTreeNode(_node);
108
+
109
+ } else {
110
+ node = new Ext.tree.TreeNode(config[i]);
111
+ }
112
+ parent.appendChild(node);
113
+ node.loader = node.getOwnerTree().loader;
114
+ if(config[i].children){
115
+ bildCategoryTree(node, config[i].children);
116
+ }
117
+ }
118
+ }
119
+ }
120
+
121
+ function categoryClick(node, e){
122
+ if (node.disabled) {
123
+ return;
124
+ }
125
+ node.getUI().check(!node.getUI().checked());
126
+ varienElementMethods.setHasChanges(Event.element(e), e);
127
+ };
128
+ function categoryAdd(id) {
129
+ var ids = $('banner_categories').value.split(',');
130
+ ids.push(id);
131
+ $('banner_categories').value = ids.join(',');
132
+ }
133
+ function categoryRemove(id) {
134
+ var ids = $('banner_categories').value.split(',');
135
+ // bug #7654 fixed
136
+ while (-1 != ids.indexOf(id)) {
137
+ ids.splice(ids.indexOf(id), 1);
138
+ }
139
+ $('banner_categories').value = ids.join(',');
140
+ }
141
+ </script>
142
+ <?php endif; ?>
143
+ <?php if(($block = $this->getLayout()->getBlock('aslideshow.product.grid')) && ($_gridJsObject=$block->getJsObjectName())): ?>
144
+ <script type="text/javascript">
145
+ var categoryProducts = $H(<?php echo $this->getProductsJson() ?>);
146
+ $('in_category_products').value = categoryProducts.toQueryString();
147
+
148
+ function registerCategoryProduct(grid, element, checked){
149
+ if(checked){
150
+ if(element.positionElement){
151
+ element.positionElement.disabled = false;
152
+ categoryProducts.set(element.value, element.positionElement.value);
153
+ }
154
+ }
155
+ else{
156
+ if(element.positionElement){
157
+ element.positionElement.disabled = true;
158
+ }
159
+ categoryProducts.unset(element.value);
160
+ }
161
+ $('in_category_products').value = categoryProducts.toQueryString();
162
+ grid.reloadParams = {'selected_products[]':categoryProducts.keys()};
163
+ }
164
+ function categoryProductRowClick(grid, event){
165
+ var trElement = Event.findElement(event, 'tr');
166
+ var isInput = Event.element(event).tagName == 'INPUT';
167
+ if(trElement){
168
+ var checkbox = Element.getElementsBySelector(trElement, 'input');
169
+ if(checkbox[0]){
170
+ var checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
171
+ <?php echo $_gridJsObject ?>.setCheckboxChecked(checkbox[0], checked);
172
+ }
173
+ }
174
+ }
175
+ function positionChange(event){
176
+ var element = Event.element(event);
177
+ if(element && element.checkboxElement && element.checkboxElement.checked){
178
+ categoryProducts.set(element.checkboxElement.value, element.value);
179
+ $('in_category_products').value = categoryProducts.toQueryString();
180
+ }
181
+ }
182
+
183
+ var tabIndex = 1000;
184
+ function categoryProductRowInit(grid, row){
185
+ var checkbox = $(row).getElementsByClassName('checkbox')[0];
186
+ var position = $(row).getElementsByClassName('input-text')[0];
187
+ if(checkbox && position){
188
+ checkbox.positionElement = position;
189
+ position.checkboxElement = checkbox;
190
+ position.disabled = !checkbox.checked;
191
+ position.tabIndex = tabIndex++;
192
+ Event.observe(position,'keyup',positionChange);
193
+ }
194
+ }
195
+
196
+
197
+ <?php echo $_gridJsObject ?>.rowClickCallback = categoryProductRowClick;
198
+ <?php echo $_gridJsObject ?>.initRowCallback = categoryProductRowInit;
199
+ <?php echo $_gridJsObject ?>.checkboxCheckCallback = registerCategoryProduct;
200
+ <?php echo $_gridJsObject ?>.rows.each(function(row){categoryProductRowInit(<?php echo $_gridJsObject ?>, row)});
201
+ </script>
202
+ <?php endif; ?>
app/design/adminhtml/default/default/template/mgs_responsiveslideshow/edit/tab/image.phtml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_block = $this; ?>
2
+ <div id="<?php echo $_block->getHtmlId() ?>" >
3
+ <div class="grid">
4
+ <table cellspacing="0" class="data border" id="<?php echo $_block->getHtmlId() ?>_grid_aslideshow" width="100%">
5
+ <col width="120" />
6
+ <col />
7
+ <col />
8
+ <col width="60" />
9
+ <?php foreach ($_block->getImageTypes() as $typeId=>$type): ?>
10
+ <?php endforeach; ?>
11
+ <col width="50" />
12
+ <col width="50" />
13
+ <thead>
14
+ <tr class="headings">
15
+ <th><?php echo Mage::helper('aslideshow')->__('Image') ?></th>
16
+ <th><?php echo Mage::helper('aslideshow')->__('Image Link') ?></th>
17
+ <th><?php echo Mage::helper('aslideshow')->__('Caption') ?></th>
18
+ <th><?php echo Mage::helper('aslideshow')->__('Sort Order') ?></th>
19
+ <?php foreach ($_block->getImageTypes() as $typeId=>$type): ?>
20
+ <?php endforeach; ?>
21
+ <th><?php echo Mage::helper('aslideshow')->__('Disable') ?></th>
22
+ <th class="last"><?php echo Mage::helper('aslideshow')->__('Remove') ?></th>
23
+ </tr>
24
+ </thead>
25
+ <tbody id="<?php echo $_block->getHtmlId() ?>_list">
26
+ <tr id="<?php echo $_block->getHtmlId() ?>_template" class="template no-display">
27
+ <td class="cell-image"><div class="place-holder" onmouseover="<?php echo $_block->getJsObjectName(); ?>.loadImage('__file__')"><span><?php echo Mage::helper('aslideshow')->__('Roll Over for preview') ?></span></div><img src="<?php echo $this->getSkinUrl('images/spacer.gif')?>" width="100" style="display:none;" alt="" /></td>
28
+ <td class="cell-label"><input type="text" class="input-text" onkeyup="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" onchange="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>
29
+ <td class="cell-caption"><input type="text" class="input-text" onkeyup="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" onchange="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>
30
+ <td class="cell-position"><input type="text" class="input-text validate-number" onkeyup="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" onchange="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>
31
+ <?php foreach ($_block->getImageTypes() as $typeId=>$type): ?>
32
+ <td class="cell-<?php echo $typeId ?> a-center" style="display:none;">
33
+ <input type="hidden" name="<?php echo $type['field'] ?>" onclick="<?php echo $_block->getJsObjectName(); ?>.setProductImages('__file__')" value="__file__" /></td>
34
+ <?php endforeach; ?>
35
+ <td class="cell-disable a-center"><input type="checkbox" onclick="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>
36
+ <td class="cell-remove a-center last"><input type="checkbox" onclick="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>
37
+ </tr>
38
+
39
+ <tr id="<?php echo $_block->getHtmlId() ?>-image-0">
40
+ <td class="cell-image"><?php echo Mage::helper('catalog')->__('No image') ?></td>
41
+ <td class="cell-label"><input type="hidden" />&nbsp;</td>
42
+ <td class="cell-caption"><input type="hidden" />&nbsp;</td>
43
+ <td class="cell-position"><input type="hidden" />&nbsp;</td>
44
+ <?php foreach ($_block->getImageTypes() as $typeId=>$type): ?>
45
+ <td class="cell-<?php echo $typeId ?> a-center" style="display:none;">
46
+ <input type="hidden" disabled="disabled" name="<?php echo $type['field'] ?>" onclick="<?php echo $_block->getJsObjectName(); ?>.setProductImages('no_selection')" value="no_selection" /></td>
47
+ <?php endforeach; ?>
48
+ <td class="cell-disable"><input type="hidden" />&nbsp;</td>
49
+ <td class="cell-remove"><input type="hidden" />&nbsp;</td>
50
+ </tr>
51
+ </tbody>
52
+ <tfoot>
53
+ <tr>
54
+ <td colspan="100" class="last" style="padding:8px">
55
+ <?php echo $_block->getUploaderHtml() ?>
56
+ </td>
57
+ </tr>
58
+ </tfoot>
59
+ </table>
60
+ </div>
61
+ </div>
62
+ <input type="hidden" id="<?php echo $_block->getHtmlId() ?>_save" name="images" value="<?php echo $_block->htmlEscape($_block->getImagesJson()) ?>" />
63
+ <input type="hidden" id="smece_save" name="[smece]" value="smece" />
64
+ <input type="hidden" id="<?php echo $_block->getHtmlId() ?>_save_image" name="[values]" value="<?php echo $_block->htmlEscape($_block->getImagesValuesJson()) ?>" />
65
+ <script type="text/javascript">
66
+ //<![CDATA[
67
+ var <?php echo $_block->getJsObjectName(); ?> = new Product.Gallery('<?php echo $_block->getHtmlId() ?>', <?php echo $_block->getUploader()->getJsObjectName() ?>, <?php echo $_block->getImageTypesJson() ?>);
68
+ //]]>
69
+ </script>
app/design/adminhtml/default/default/template/mgs_responsiveslideshow/products.phtml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Fileuploader
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ -->
10
+ <?php /*if( !$this->isSingleStoreMode() ): ?>
11
+ <?php echo $this->getChildHtml('store_switcher');?>
12
+ <?php endif;*/?>
13
+ <?php echo $this->getTabsHtml() ?>
14
+ <script type="text/javascript">
15
+ //<![CDATA[
16
+ function load_product_funcs(){
17
+ <?php if (($block = $this->getLayout()->getBlock('slideshow.grid.products')) && ($_gridJsObject = $block->getJsObjectName())): ?>
18
+ if(!$('in_aslideshow_products')){
19
+ setTimeout('load_product_funcs()',500);
20
+ return false;
21
+ }
22
+ var selectedProducts=$H(<?php echo $this->getProductsJson(); ?>);
23
+ $('in_aslideshow_products').value = selectedProducts.toQueryString();
24
+
25
+ function registerSelectedProduct(grid, element, checked){
26
+ if(checked){
27
+ selectedProducts.set(element.value, element.value);
28
+ }
29
+ else{
30
+ selectedProducts.unset(element.value);
31
+ }
32
+ $('in_aslideshow_products').value = selectedProducts.toQueryString();
33
+ grid.reloadParams = {'selected_products[]':selectedProducts.keys()};
34
+ }
35
+ function selectedProductRowClick(grid, event){
36
+ var trElement = Event.findElement(event, 'tr');
37
+ var isInput = Event.element(event).tagName == 'INPUT';
38
+ if(trElement){
39
+ var checkbox = Element.getElementsBySelector(trElement, 'input');
40
+ if(checkbox[0]){
41
+ var checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
42
+ <?php echo $_gridJsObject ?>.setCheckboxChecked(checkbox[0], checked);
43
+ }
44
+ }
45
+ }
46
+
47
+ var tabIndex = 1000;
48
+ function selectedProductRowInit(grid, row){
49
+ var checkbox = $(row).getElementsByClassName('checkbox')[0];
50
+ }
51
+
52
+
53
+ <?php echo $_gridJsObject ?>.rowClickCallback = selectedProductRowClick;
54
+ <?php echo $_gridJsObject ?>.initRowCallback = selectedProductRowInit;
55
+ <?php echo $_gridJsObject ?>.checkboxCheckCallback = registerSelectedProduct;
56
+ <?php echo $_gridJsObject ?>.rows.each(function(row){selectedProductRowInit(<?php echo $_gridJsObject ?>, row)});
57
+
58
+ <?php endif; ?>
59
+ }
60
+ load_product_funcs();
61
+ //]]>
62
+ </script>
app/design/adminhtml/default/default/template/mgs_responsiveslideshow/script-transition.phtml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ document.observe("dom:loaded", function() {
3
+ setMainSetting();
4
+ Event.observe($("transition"),'change', function(){
5
+ setMainSetting();
6
+ });
7
+ });
8
+
9
+ function setMainSetting(){
10
+ var transition = $("transition").value;
11
+ if(transition=='basic_carousel' || transition == 'thumbnail_slider'){
12
+ $('aslideshow_form5').show();
13
+ $('aslideshow_form6').hide();
14
+ //$('aslideshow_form7').hide();
15
+ }
16
+ //else if(transition == 'carousel_min_max'){
17
+ // $('aslideshow_form5').show();
18
+ // $('aslideshow_form6').show();
19
+ //$('aslideshow_form7').hide();
20
+ //}
21
+ // else if(transition=='video'){
22
+ // $('aslideshow_form7').show();
23
+ // $('aslideshow_form5').hide();
24
+ // $('aslideshow_form6').hide();
25
+ // }
26
+ else{
27
+ $('aslideshow_form5').hide();
28
+ $('aslideshow_form6').hide();
29
+ //$('aslideshow_form7').hide();
30
+ }
31
+ }
32
+ </script>
app/design/adminhtml/default/default/template/mgs_responsiveslideshow/script.phtml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ document.observe("dom:loaded", function() {
3
+ setMainGereral();
4
+ Event.observe($("slideshow_for"),'change', function(){
5
+ setMainGereral();
6
+ });
7
+ });
8
+
9
+ function setMainGereral(){
10
+ var slideshowFor = $("slideshow_for").value;
11
+ if(slideshowFor=='SLIDESHOW_PRODUCT'){
12
+ $('aslideshow_tabs_products_section').setStyle({'display': 'block'});
13
+ $('aslideshow_tabs_image_section').hide();
14
+ $('aslideshow_tabs_staticblocks_section').hide();
15
+ $('aslideshow_form3').show();
16
+ //$('aslideshow_form4').hide();
17
+ //$('use_thumbnail').up('tr').hide();
18
+ //$('max_level').up('tr').hide();
19
+ //$('megamenu_tabs_static').setStyle({'display': 'block'});
20
+ //$('url_note').hide();
21
+ }
22
+ else if(slideshowFor=='SLIDESHOW_STATIC_BLOCK'){
23
+ $('aslideshow_tabs_staticblocks_section').setStyle({'display': 'block'});
24
+ $('aslideshow_tabs_image_section').hide();
25
+ $('aslideshow_tabs_products_section').hide();
26
+ //$('aslideshow_form4').show();
27
+ $('aslideshow_form3').hide();
28
+ }
29
+ else{
30
+ $('aslideshow_tabs_image_section').setStyle({'display': 'block'});
31
+ $('aslideshow_tabs_staticblocks_section').hide();
32
+ $('aslideshow_tabs_products_section').hide();
33
+ //$('use_thumbnail').up('tr').show();
34
+ //$('max_level').up('tr').show();
35
+ $('aslideshow_form3').hide();
36
+ //$('aslideshow_form4').hide();
37
+ //$('url_note').show();
38
+ }
39
+ }
40
+ </script>
app/design/adminhtml/default/default/template/mgs_responsiveslideshow/slideshow.phtml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <table cellspacing="0">
3
+ <tr>
4
+ <td style="width:50%;"><h3 class="icon-head head-blog"><?php echo Mage::helper('aslideshow')->__('Slideshow Manager') ?></h3></td>
5
+ <td class="a-right">
6
+ <?php echo $this->getAddNewButtonHtml() ?>
7
+ </td>
8
+ </tr>
9
+ </table>
10
+ </div>
11
+ <?php echo $this->getStoreSwitcherHtml() ?>
12
+ <div>
13
+ <?php echo $this->getGridHtml() ?>
14
+ </div>
app/design/frontend/default/default/layout/mgs_responsiveslideshow.xml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ /**
3
+ * MGS_ResponsiveSlideshow Extension
4
+ *
5
+ * @category Local
6
+ * @package MGS_ResponsiveSlideshow
7
+ * @author dungnv (dungnv@arrowhitech.com)
8
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
9
+ *
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @category Local
15
+ * @package MGS_ResponsiveSlideshow
16
+ * @author dungnv <dungnv@arrowhitech.com>
17
+ */
18
+ -->
19
+ <layout version="0.1.0">
20
+ <default>
21
+ <reference name="head">
22
+ <action method="addItem"><type>skin_js</type><script>js/responsiveslideshow/jquery.js</script></action>
23
+ <action method="addItem"><type>skin_js</type><script>js/responsiveslideshow/jquery.noconflict.js</script></action>
24
+ <action method="addCss"><stylesheet>css/responsiveslideshow/flexslider.css</stylesheet></action>
25
+ <action method="addItem"><type>skin_js</type><script>js/responsiveslideshow/modernizr.js</script></action>
26
+ <action method="addItem"><type>skin_js</type><script>js/responsiveslideshow/jquery.flexslider.js</script></action>
27
+ </reference>
28
+ </default>
29
+ <cms_page>
30
+ <reference name="left">
31
+ <block type="aslideshow/content_lefttop" name="aslideshow_left_top" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" before="-"/>
32
+ <block type="aslideshow/content_rightbottom" name="aslideshow_left_bottom" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" after="-"/>
33
+ </reference>
34
+ <reference name="right">
35
+ <block type="aslideshow/content_righttop" name="aslideshow_right_top" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" before="-"/>
36
+ <block type="aslideshow/content_rightbottom" name="aslideshow_right_bottom" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" after="-"/>
37
+ </reference>
38
+ <reference name="content">
39
+ <block type="aslideshow/content_contenttop" name="aslideshow_content_top" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" before="-"/>
40
+ <block type="aslideshow/content_contentbottom" name="aslideshow_content_bottom" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" after="-"/>
41
+ </reference>
42
+ </cms_page>
43
+ <catalog_category_default>
44
+ <reference name="left">
45
+ <block type="aslideshow/content_lefttop" name="aslideshow_left_top" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" before="-"/>
46
+ <block type="aslideshow/content_rightbottom" name="aslideshow_left_bottom" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" after="-"/>
47
+ </reference>
48
+ <reference name="right">
49
+ <block type="aslideshow/content_righttop" name="aslideshow_right_top" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" before="-"/>
50
+ <block type="aslideshow/content_rightbottom" name="aslideshow_right_bottom" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" after="-"/>
51
+ </reference>
52
+ <reference name="content">
53
+ <block type="aslideshow/content_contenttop" name="aslideshow_content_top" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" before="-"/>
54
+ <block type="aslideshow/content_contentbottom" name="aslideshow_content_bottom" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" after="-"/>
55
+ </reference>
56
+ </catalog_category_default>
57
+ <catalog_category_layered>
58
+ <reference name="left">
59
+ <block type="aslideshow/content_lefttop" name="aslideshow_left_top" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" before="-"/>
60
+ <block type="aslideshow/content_rightbottom" name="aslideshow_left_bottom" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" after="-"/>
61
+ </reference>
62
+ <reference name="right">
63
+ <block type="aslideshow/content_righttop" name="aslideshow_right_top" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" before="-"/>
64
+ <block type="aslideshow/content_rightbottom" name="aslideshow_right_bottom" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" after="-"/>
65
+ </reference>
66
+ <reference name="content">
67
+ <block type="aslideshow/content_contenttop" name="aslideshow_content_top" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" before="-"/>
68
+ <block type="aslideshow/content_contentbottom" name="aslideshow_content_bottom" template="mgs_responsiveslideshow/content/responsiveslidehow.phtml" after="-"/>
69
+ </reference>
70
+ </catalog_category_layered>
71
+ </layout>
app/design/frontend/default/default/template/mgs_responsiveslideshow/content/responsiveslidehow.phtml ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $collection = $this->_getCollection(); ?>
2
+ <?php $_helper = $this->helper('catalog/output'); ?>
3
+ <?php if (count($collection) > 0) : ?>
4
+ <div class="slider">
5
+ <div id="slider" class="flexslider">
6
+ <?php foreach ($collection as $item) : ?>
7
+ <!--if slideshow type is SLIDESHOW_IMAGE-->
8
+ <?php
9
+ $_imageWidth = $item->getImageWidth();
10
+ $_imageHeight = $item->getImageHeight();
11
+ ?>
12
+ <?php if($item->getSlideshowFor() == 'SLIDESHOW_IMAGE'): ?>
13
+ <?php $_imageList = $item->getImageList(); ?>
14
+ <?php if (is_array($_imageList) and sizeof($_imageList) > 0) : ?>
15
+ <ul class="slides">
16
+ <?php foreach ($_imageList as &$_item) : ?>
17
+ <li data-thumb="<?php echo $this->helper('aslideshow/image')->init($_item['file'])?>" style="width: <?php echo $_imageWidth?>; height: <?php echo $_imageHeight?>; <?php if($item->getTransition() == 'basic_carousel' || $item->getTransition() == 'carousel_min_max') : ?> margin: 0 <?php echo $item->getItemMargin() . 'px' ?><?php else : ?><?php endif; ?>">
18
+ <?php if($_item['label'] == null) :?>
19
+ <img src="<?php echo $this->helper('aslideshow/image')->init($_item['file'])->resize($_imageWidth,$_imageHeight); ?>" alt="<?php echo $_item['caption']; ?>" />
20
+ <?php else : ?>
21
+ <a href="<?php echo $_item['label']; ?>" title="" ><img src="<?php echo $this->helper('aslideshow/image')->init($_item['file'])->resize($_imageWidth,$_imageHeight); ?>" alt="<?php echo $_item['caption']; ?>" /></a>
22
+ <?php endif; ?>
23
+ <?php if($item->getShowText() == 1 && $_item['caption'] != null) :?>
24
+ <div style="opacity: <?php echo $item->getBackgroundOpacity(); ?>;" class="feature_excerpt"><?php echo $_item['caption']; ?></div>
25
+ <?php endif; ?>
26
+ </li>
27
+ <?php endforeach; ?>
28
+ </ul>
29
+ <?php endif; ?>
30
+
31
+ <!--if slideshow type is SLIDESHOW_PRODUCT-->
32
+ <?php elseif($item->getSlideshowFor() == 'SLIDESHOW_PRODUCT'): ?>
33
+ <?php
34
+ $_productImageWidth = $item->getProductImageWidth();
35
+ $_productImageHeight = $item->getProductImageHeight();
36
+ ?>
37
+ <?php $_productIds = $item->getProductList(); ?>
38
+ <?php if (is_array($_productIds) and sizeof($_productIds) > 0) : ?>
39
+ <ul class="slides">
40
+ <?php foreach ($_productIds as &$_item) : ?>
41
+ <?php $_product = Mage::getModel('catalog/product')->load($_item['product_id']); ?>
42
+ <li data-thumb="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')?>" style="<?php if($item->getTransition() == 'basic_carousel' || $item->getTransition() == 'carousel_min_max') : ?> margin: 0 <?php echo $item->getItemMargin() . 'px' ?><?php else : ?><?php endif; ?>">
43
+ <a href="<?php echo $_product->getProductUrl() ?>" title="" >
44
+ <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($_productImageWidth,$_productImageHeight); ?>"/>
45
+ <?php if($item->getShowText() == 1) :?>
46
+ <div style="opacity: <?php echo $item->getBackgroundOpacity(); ?>;" class="feature_excerpt">
47
+ <div id="product-name" style="color: violet; font-family: Trebuchet MS; font-size: medium; font-weight: 500;">
48
+ <?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?>
49
+ </div>
50
+ <div id="product-detail" style="font-size: smaller"><i>
51
+ <?php if($item->getShowPrice()): ?>
52
+ <?php echo $this->getPriceHtml($_product, true) ?>
53
+ <?php endif; ?>
54
+ <?php if($item->getShowDescription() == 'description'): ?>
55
+ Description: <?php echo $this->helper('core/string')->truncate($_helper->productAttribute($_product, $_product->getDescription(), 'description'), 100); ?>
56
+ <?php elseif($item->getShowDescription() == 'short_description'): ?>
57
+ Short Description: <?php echo $this->helper('core/string')->truncate($_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description'), 100); ?>
58
+ <?php else: ?>
59
+ <?php endif; ?>
60
+ </i></div>
61
+ </div>
62
+ <?php endif; ?>
63
+ </a>
64
+ </li>
65
+ <?php endforeach; ?>
66
+ </ul>
67
+ <?php endif; ?>
68
+ <!--if slideshow type is SLIDESHOW_STATIC_BLOCK-->
69
+ <?php else: ?>
70
+ <?php $_staticblocks = $item->getStaticblockList(); ?>
71
+ <?php if (is_array($_staticblocks) and sizeof($_staticblocks) > 0) : ?>
72
+ <?php
73
+ $staticImageWidth = $item->getStaticblockImageWidth();
74
+ $staticImageHeight = $item->getStaticblockImageHeight();
75
+
76
+ //$strStyle = "<style type='text/css'>";
77
+ //$strStyle .= ".aviaslider-static li a img { width: ".$staticImageWidth."px; height: ".$staticImageHeight."px; }";
78
+ //$strStyle .= "</style>";
79
+ //echo $strStyle;
80
+ ?>
81
+ <ul class="slides">
82
+ <?php foreach ($_staticblocks as &$_item) : ?>
83
+ <li <?php if($item->getTransition() == 'basic_carousel' || $item->getTransition() == 'carousel_min_max') : ?> margin: 0 <?php echo $item->getItemMargin() . 'px' ?><?php else : ?><?php endif; ?>>
84
+ <a href="#" title="">
85
+ <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId($_item['staticblock_identifier'])->toHtml(); ?>
86
+ </a>
87
+ </li>
88
+ <?php endforeach; ?>
89
+ </ul>
90
+ <?php endif; ?>
91
+ <?php endif; ?>
92
+
93
+ <?php endforeach; ?>
94
+ </div>
95
+
96
+ <?php if($item->getTransition() == 'thumbnail_slider') : ?>
97
+ <div id="carousel" class="flexslider">
98
+ <?php foreach ($collection as $item) : ?>
99
+ <!--if slideshow type is SLIDESHOW_IMAGE-->
100
+ <?php
101
+ $_imageWidth = $item->getImageWidth();
102
+ $_imageHeight = $item->getImageHeight();
103
+ ?>
104
+ <?php if($item->getSlideshowFor() == 'SLIDESHOW_IMAGE'): ?>
105
+ <?php $_imageList = $item->getImageList(); ?>
106
+ <?php if (is_array($_imageList) and sizeof($_imageList) > 0) : ?>
107
+ <ul class="slides">
108
+ <?php foreach ($_imageList as &$_item) : ?>
109
+ <li style="margin: 0 <?php echo $item->getItemMargin() . 'px' ?>">
110
+ <img src="<?php echo $this->helper('aslideshow/image')->init($_item['file'])->resize($_imageWidth,$_imageHeight); ?>" alt="<?php echo $_item['caption']; ?>" />
111
+ </li>
112
+ <?php endforeach; ?>
113
+ </ul>
114
+ <?php endif; ?>
115
+
116
+ <!--if slideshow type is SLIDESHOW_PRODUCT-->
117
+ <?php elseif($item->getSlideshowFor() == 'SLIDESHOW_PRODUCT'): ?>
118
+ <?php
119
+ $_productImageWidth = $item->getProductImageWidth();
120
+ $_productImageHeight = $item->getProductImageHeight();
121
+ ?>
122
+ <?php $_productIds = $item->getProductList(); ?>
123
+ <?php if (is_array($_productIds) and sizeof($_productIds) > 0) : ?>
124
+ <ul class="slides">
125
+ <?php foreach ($_productIds as &$_item) : ?>
126
+ <?php $_product = Mage::getModel('catalog/product')->load($_item['product_id']); ?>
127
+ <li style="margin: 0 <?php echo $item->getItemMargin() . 'px' ?>">
128
+ <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($_productImageWidth,$_productImageHeight); ?>"/>
129
+ </li>
130
+ <?php endforeach; ?>
131
+ </ul>
132
+ <?php endif; ?>
133
+
134
+ <!--if slideshow type is SLIDESHOW_STATIC_BLOCK-->
135
+ <?php else : ?>
136
+ <?php $_staticblocks = $item->getStaticblockList(); ?>
137
+ <?php if (is_array($_staticblocks) and sizeof($_staticblocks) > 0) : ?>
138
+ <?php
139
+ $staticImageWidth = $item->getStaticblockImageWidth();
140
+ $staticImageHeight = $item->getStaticblockImageHeight();
141
+ ?>
142
+ <ul class="slides">
143
+ <?php foreach ($_staticblocks as &$_item) : ?>
144
+ <li style="margin: 0 <?php echo $item->getItemMargin() . 'px' ?>">
145
+ <a href="#" title="">
146
+ <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId($_item['staticblock_identifier'])->toHtml(); ?>
147
+ </a>
148
+ </li>
149
+ <?php endforeach; ?>
150
+ </ul>
151
+ <?php endif; ?>
152
+ <?php endif; ?>
153
+ <?php endforeach;?>
154
+ </div>
155
+ <?php endif; ?>
156
+ <script type="text/javascript">
157
+ jQuery(window).load(function(){
158
+ <?php if($item->getTransition() == 'thumbnail_slider') : ?>
159
+ jQuery('#carousel').flexslider({
160
+ animation: "slide",
161
+ controlNav: false,
162
+ animationLoop: false,
163
+ slideshow: <?php echo $item->getSlideshow() ?>,
164
+ itemWidth: <?php echo $item->getItemWidth() ?>,
165
+ itemMargin: <?php echo $item->getItemMargin() ?>,
166
+ asNavFor: '#slider'
167
+ });
168
+
169
+ jQuery('#slider').flexslider({
170
+ animation: '<?php echo $item->getAnimation() ?>',
171
+ controlNav: false,
172
+ animationLoop: <?php echo $item->getAnimationLoop() ?>,
173
+ direction: '<?php echo $item->getDirection() ?>',
174
+ smoothHeight: <?php echo $item->getSmoothHeight() ?>,
175
+ startAt: <?php echo $item->getStartAt() ?>,
176
+ slideshowSpeed: <?php echo $item->getSlideshowSpeed(); ?>,
177
+ animationSpeed: <?php echo $item->getAnimationSpeed() ?>,
178
+ initDelay: <?php echo $item->getInitDelay() ?>,
179
+ randomize: false,
180
+ sync: "#carousel",
181
+ start: function(slider){
182
+ jQuery('body').removeClass('loading');
183
+ }
184
+ });
185
+ <?php else : ?>
186
+
187
+ jQuery('.flexslider').flexslider({
188
+
189
+ <?php if($item->getTransition() == 'index') : ?>
190
+ animation: '<?php echo $item->getAnimation() ?>',
191
+ controlNav: <?php echo $item->getControlNav()?>,
192
+ <?php elseif($item->getTransition() == 'basic_carousel') : ?>
193
+ animation: 'slide',
194
+ animationLoop: <?php echo $item->getAnimationLoop() ?>,
195
+ itemWidth: <?php echo $item->getItemWidth() ?>,
196
+ itemMargin: <?php echo $item->getItemMargin() ?>,
197
+ controlNav: <?php echo $item->getControlNav()?>,
198
+ <?php elseif($item->getTransition() == 'carousel_min_max') : ?>
199
+ animation: 'slide',
200
+ animationLoop: <?php echo $item->getAnimationLoop() ?>,
201
+ itemWidth: <?php echo $item->getItemWidth() ?>,
202
+ itemMargin: <?php echo $item->getItemMargin() ?>,
203
+ minItems: <?php echo $item->getMinItems() ?>,
204
+ maxItems: <?php echo $item->getMaxItems() ?>,
205
+ controlNav: <?php echo $item->getControlNav()?>,
206
+ <?php elseif($item->getTransition() == 'thumbnail_controlnav') : ?>
207
+ animation: '<?php echo $item->getAnimation() ?>',
208
+ controlNav: 'thumbnails',
209
+ <?php elseif($item->getTransition() == 'video') : ?>
210
+ animation: '<?php echo $item->getAnimation() ?>',
211
+ useCss: <?php echo $item->getUseCss() ?>,
212
+ animationLoop: <?php echo $item->getAnimationLoop() ?>,
213
+ smoothHeight: <?php echo $item->getSmoothHeight() ?>,
214
+ controlNav: <?php echo $item->getControlNav()?>,
215
+ <?php else : ?>
216
+ <?php endif; ?>
217
+ //FlexSlider: Default Settings
218
+ direction: '<?php echo $item->getDirection() ?>',
219
+ animationLoop: <?php echo $item->getAnimationLoop() ?>,
220
+ smoothHeight: <?php echo $item->getSmoothHeight() ?>,
221
+ startAt: <?php echo $item->getStartAt() ?>,
222
+ slideshow: <?php echo $item->getSlideshow() ?>,
223
+ slideshowSpeed: <?php echo $item->getSlideshowSpeed(); ?>,
224
+ animationSpeed: <?php echo $item->getAnimationSpeed() ?>,
225
+ initDelay: <?php echo $item->getInitDelay() ?>,
226
+ randomize: <?php echo $item->getRandomize() ?>,
227
+
228
+ start: function(slider){
229
+ jQuery('body').removeClass('loading');
230
+ }
231
+ });
232
+ <?php endif; ?>
233
+ });
234
+ </script>
235
+ </div>
236
+
237
+ <div style="clear:both;"></div>
238
+ <!-- Copyright -->
239
+ <div style="position:absolute;top:-8888px;">Copyright &copy;2013&nbsp;<a href="http://www.magesolution.com/">Magesolution.com</a>&nbsp;|&nbsp;<a href="http://www.magesolution.com/magento-responsive-slideshow.html">Responsive Slideshow</a></div>
240
+ <?php endif; ?>
app/design/frontend/default/default/template/mgs_responsiveslideshow/widget/responsiveslidehow.phtml ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $item = $this->_getCollectionWidget($this->getAslideshowId()); ?>
2
+ <?php $_helper = $this->helper('catalog/output'); ?>
3
+ <?php if ($item) : ?>
4
+ <?php //foreach ($collection as $item) : ?><?php //echo '<pre>'; print_r($item->getProductList()); die('sdfsd'); ?>
5
+
6
+ <div class="slider">
7
+ <div id="slider" class="flexslider">
8
+ <!--if slideshow type is SLIDESHOW_IMAGE-->
9
+ <?php
10
+ $_imageWidth = $item->getImageWidth();
11
+ $_imageHeight = $item->getImageHeight();
12
+ ?>
13
+ <?php if($item->getSlideshowFor() == 'SLIDESHOW_IMAGE'): ?>
14
+
15
+ <?php $_imageList = $item->getImageList(); ?>
16
+ <?php if (is_array($_imageList) and sizeof($_imageList) > 0) : ?>
17
+ <ul class="slides">
18
+ <?php foreach ($_imageList as &$_item) : ?>
19
+ <li data-thumb="<?php echo $this->helper('aslideshow/image')->init($_item['file'])?>" style="width: <?php echo $_imageWidth?>; height: <?php echo $_imageHeight?>; <?php if($item->getTransition() == 'basic_carousel' || $item->getTransition() == 'carousel_min_max') : ?> margin: 0 <?php echo $item->getItemMargin() . 'px' ?><?php else : ?><?php endif; ?>">
20
+ <?php if($_item['label'] == null) :?>
21
+ <img src="<?php echo $this->helper('aslideshow/image')->init($_item['file'])->resize($_imageWidth,$_imageHeight); ?>" alt="<?php echo $_item['caption']; ?>" />
22
+ <?php else : ?>
23
+ <a href="<?php echo $_item['label']; ?>" title="" ><img src="<?php echo $this->helper('aslideshow/image')->init($_item['file'])->resize($_imageWidth,$_imageHeight); ?>" alt="<?php echo $_item['caption']; ?>" /></a>
24
+ <?php endif; ?>
25
+ <?php if($item->getShowText() == 1 && $_item['caption'] != null) :?>
26
+ <div style="opacity: <?php echo $item->getBackgroundOpacity(); ?>;" class="feature_excerpt"><?php echo $_item['caption']; ?></div>
27
+ <?php endif; ?>
28
+ </li>
29
+ <?php endforeach; ?>
30
+ </ul>
31
+ <?php endif; ?>
32
+
33
+ <?php elseif($item->getSlideshowFor() == 'SLIDESHOW_PRODUCT'): ?>
34
+
35
+ <?php
36
+ $_productImageWidth = $item->getProductImageWidth();
37
+ $_productImageHeight = $item->getProductImageHeight();
38
+ ?>
39
+ <?php $_productIds = $item->getProductList(); ?>
40
+ <?php if (is_array($_productIds) and sizeof($_productIds) > 0) : ?>
41
+ <ul class="slides">
42
+ <?php foreach ($_productIds as &$_item) : ?>
43
+ <?php $_product = Mage::getModel('catalog/product')->load($_item['product_id']); ?>
44
+ <li data-thumb="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')?>" style="<?php if($item->getTransition() == 'basic_carousel' || $item->getTransition() == 'carousel_min_max') : ?> margin: 0 <?php echo $item->getItemMargin() . 'px' ?><?php else : ?><?php endif; ?>">
45
+ <a href="<?php echo $_product->getProductUrl() ?>" title="" >
46
+ <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($_productImageWidth,$_productImageHeight); ?>"/>
47
+ <?php if($item->getShowText() == 1) :?>
48
+ <div style="opacity: <?php echo $item->getBackgroundOpacity(); ?>;" class="feature_excerpt">
49
+ <div id="product-name" style="color: violet; font-family: Trebuchet MS; font-size: medium; font-weight: 500;">
50
+ <?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?>
51
+ </div>
52
+ <div id="product-detail" style="font-size: smaller"><i>
53
+ <?php if($item->getShowPrice()): ?>
54
+ <?php echo $this->getPriceHtml($_product, true) ?>
55
+ <?php endif; ?>
56
+ <?php if($item->getShowDescription() == 'description'): ?>
57
+ Description: <?php echo $this->helper('core/string')->truncate($_helper->productAttribute($_product, $_product->getDescription(), 'description'), 100); ?>
58
+ <?php elseif($item->getShowDescription() == 'short_description'): ?>
59
+ Short Description: <?php echo $this->helper('core/string')->truncate($_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description'), 100); ?>
60
+ <?php else: ?>
61
+ <?php endif; ?>
62
+ </i></div>
63
+ </div>
64
+ <?php endif; ?>
65
+ </a>
66
+ </li>
67
+ <?php endforeach; ?>
68
+ </ul>
69
+ <?php endif; ?>
70
+
71
+ <?php else: ?>
72
+
73
+ <?php $_staticblocks = $item->getStaticblockList(); ?>
74
+ <?php if (is_array($_staticblocks) and sizeof($_staticblocks) > 0) : ?>
75
+ <?php
76
+ $staticImageWidth = $item->getStaticblockImageWidth();
77
+ $staticImageHeight = $item->getStaticblockImageHeight();
78
+ ?>
79
+ <ul class="slides">
80
+ <?php foreach ($_staticblocks as &$_item) : ?>
81
+ <li <?php if($item->getTransition() == 'basic_carousel' || $item->getTransition() == 'carousel_min_max') : ?> margin: 0 <?php echo $item->getItemMargin() . 'px' ?><?php else : ?><?php endif; ?>>
82
+ <a href="#" title="">
83
+ <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId($_item['staticblock_identifier'])->toHtml(); ?>
84
+ </a>
85
+ </li>
86
+ <?php endforeach; ?>
87
+ </ul>
88
+ <?php endif; ?>
89
+
90
+ <?php endif; ?>
91
+ </div>
92
+
93
+ <?php if($item->getTransition() == 'thumbnail_slider') : ?>
94
+ <div id="carousel" class="flexslider">
95
+ <?php
96
+ $_imageWidth = $item->getImageWidth();
97
+ $_imageHeight = $item->getImageHeight();
98
+ ?>
99
+ <?php if($item->getSlideshowFor() == 'SLIDESHOW_IMAGE'): ?>
100
+ <?php $_imageList = $item->getImageList(); ?>
101
+ <?php if (is_array($_imageList) and sizeof($_imageList) > 0) : ?>
102
+ <ul class="slides">
103
+ <?php foreach ($_imageList as &$_item) : ?>
104
+ <li style="margin: 0 <?php echo $item->getItemMargin() . 'px' ?>">
105
+ <img src="<?php echo $this->helper('aslideshow/image')->init($_item['file'])->resize($_imageWidth,$_imageHeight); ?>" alt="<?php echo $_item['caption']; ?>" />
106
+ </li>
107
+ <?php endforeach; ?>
108
+ </ul>
109
+ <?php endif; ?>
110
+
111
+ <!--if slideshow type is SLIDESHOW_PRODUCT-->
112
+ <?php elseif($item->getSlideshowFor() == 'SLIDESHOW_PRODUCT'): ?>
113
+ <?php
114
+ $_productImageWidth = $item->getProductImageWidth();
115
+ $_productImageHeight = $item->getProductImageHeight();
116
+ ?>
117
+ <?php $_productIds = $item->getProductList(); ?>
118
+ <?php if (is_array($_productIds) and sizeof($_productIds) > 0) : ?>
119
+ <ul class="slides">
120
+ <?php foreach ($_productIds as &$_item) : ?>
121
+ <?php $_product = Mage::getModel('catalog/product')->load($_item['product_id']); ?>
122
+ <li style="margin: 0 <?php echo $item->getItemMargin() . 'px' ?>">
123
+ <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($_productImageWidth,$_productImageHeight); ?>"/>
124
+ </li>
125
+ <?php endforeach; ?>
126
+ </ul>
127
+ <?php endif; ?>
128
+
129
+ <!--if slideshow type is SLIDESHOW_STATIC_BLOCK-->
130
+ <?php else : ?>
131
+ <?php $_staticblocks = $item->getStaticblockList(); ?>
132
+ <?php if (is_array($_staticblocks) and sizeof($_staticblocks) > 0) : ?>
133
+ <?php
134
+ $staticImageWidth = $item->getStaticblockImageWidth();
135
+ $staticImageHeight = $item->getStaticblockImageHeight();
136
+ ?>
137
+ <ul class="slides">
138
+ <?php foreach ($_staticblocks as &$_item) : ?>
139
+ <li style="margin: 0 <?php echo $item->getItemMargin() . 'px' ?>">
140
+ <a href="#" title="">
141
+ <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId($_item['staticblock_identifier'])->toHtml(); ?>
142
+ </a>
143
+ </li>
144
+ <?php endforeach; ?>
145
+ </ul>
146
+ <?php endif; ?>
147
+ <?php endif; ?>
148
+ </div>
149
+ <?php endif; ?>
150
+
151
+ <script type="text/javascript">
152
+ jQuery(window).load(function(){
153
+ <?php if($item->getTransition() == 'thumbnail_slider') : ?>
154
+ jQuery('#carousel').flexslider({
155
+ animation: "slide",
156
+ controlNav: false,
157
+ animationLoop: false,
158
+ slideshow: <?php echo $item->getSlideshow() ?>,
159
+ itemWidth: <?php echo $item->getItemWidth() ?>,
160
+ itemMargin: <?php echo $item->getItemMargin() ?>,
161
+ asNavFor: '#slider'
162
+ });
163
+
164
+ jQuery('#slider').flexslider({
165
+ animation: '<?php echo $item->getAnimation() ?>',
166
+ controlNav: false,
167
+ animationLoop: <?php echo $item->getAnimationLoop() ?>,
168
+ direction: '<?php echo $item->getDirection() ?>',
169
+ smoothHeight: <?php echo $item->getSmoothHeight() ?>,
170
+ startAt: <?php echo $item->getStartAt() ?>,
171
+ slideshowSpeed: <?php echo $item->getSlideshowSpeed(); ?>,
172
+ animationSpeed: <?php echo $item->getAnimationSpeed() ?>,
173
+ initDelay: <?php echo $item->getInitDelay() ?>,
174
+ randomize: false,
175
+ sync: "#carousel",
176
+ start: function(slider){
177
+ jQuery('body').removeClass('loading');
178
+ }
179
+ });
180
+ <?php else : ?>
181
+
182
+ jQuery('.flexslider').flexslider({
183
+
184
+ <?php if($item->getTransition() == 'index') : ?>
185
+ animation: '<?php echo $item->getAnimation() ?>',
186
+ controlNav: <?php echo $item->getControlNav()?>,
187
+ <?php elseif($item->getTransition() == 'basic_carousel') : ?>
188
+ animation: 'slide',
189
+ animationLoop: <?php echo $item->getAnimationLoop() ?>,
190
+ itemWidth: <?php echo $item->getItemWidth() ?>,
191
+ itemMargin: <?php echo $item->getItemMargin() ?>,
192
+ controlNav: <?php echo $item->getControlNav()?>,
193
+ <?php elseif($item->getTransition() == 'carousel_min_max') : ?>
194
+ animation: 'slide',
195
+ animationLoop: <?php echo $item->getAnimationLoop() ?>,
196
+ itemWidth: <?php echo $item->getItemWidth() ?>,
197
+ itemMargin: <?php echo $item->getItemMargin() ?>,
198
+ minItems: <?php echo $item->getMinItems() ?>,
199
+ maxItems: <?php echo $item->getMaxItems() ?>,
200
+ controlNav: <?php echo $item->getControlNav()?>,
201
+ <?php elseif($item->getTransition() == 'thumbnail_controlnav') : ?>
202
+ animation: '<?php echo $item->getAnimation() ?>',
203
+ controlNav: 'thumbnails',
204
+ <?php elseif($item->getTransition() == 'video') : ?>
205
+ animation: '<?php echo $item->getAnimation() ?>',
206
+ useCss: <?php echo $item->getUseCss() ?>,
207
+ animationLoop: <?php echo $item->getAnimationLoop() ?>,
208
+ smoothHeight: <?php echo $item->getSmoothHeight() ?>,
209
+ controlNav: <?php echo $item->getControlNav()?>,
210
+ <?php else : ?>
211
+ <?php endif; ?>
212
+ //FlexSlider: Default Settings
213
+ direction: '<?php echo $item->getDirection() ?>',
214
+ animationLoop: <?php echo $item->getAnimationLoop() ?>,
215
+ smoothHeight: <?php echo $item->getSmoothHeight() ?>,
216
+ startAt: <?php echo $item->getStartAt() ?>,
217
+ slideshow: <?php echo $item->getSlideshow() ?>,
218
+ slideshowSpeed: <?php echo $item->getSlideshowSpeed(); ?>,
219
+ animationSpeed: <?php echo $item->getAnimationSpeed() ?>,
220
+ initDelay: <?php echo $item->getInitDelay() ?>,
221
+ randomize: <?php echo $item->getRandomize() ?>,
222
+
223
+ start: function(slider){
224
+ jQuery('body').removeClass('loading');
225
+ }
226
+ });
227
+ <?php endif; ?>
228
+ });
229
+ </script>
230
+ </div>
231
+
232
+ <div style="clear:both;"></div>
233
+ <!-- Copyright -->
234
+ <div style="position:absolute;top:-8888px;">Copyright &copy;2013&nbsp;<a href="http://www.magesolution.com/">Magesolution.com</a>&nbsp;|&nbsp;<a href="http://www.magesolution.com/magento-responsive-slideshow.html">Responsive Slideshow</a></div>
235
+ <?php endif; ?>
app/etc/modules/MGS_Mgscore.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <MGS_Mgscore>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </MGS_Mgscore>
8
+ </modules>
9
+ </config>
app/etc/modules/MGS_ResponsiveSlideshow.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * MGS_Aslideshow Extension
5
+ *
6
+ * @category Local
7
+ * @package MGS_Aslideshow
8
+ * @author dungnv (dungnv@arrowhitech.com)
9
+ * @copyright Copyright(c) 2011 Arrowhitech Inc. (http://www.arrowhitech.com)
10
+ *
11
+ */
12
+
13
+ /**
14
+ *
15
+ * @category Local
16
+ * @package MGS_Aslideshow
17
+ * @author dungnv <dungnv@arrowhitech.com>
18
+ */
19
+
20
+ -->
21
+ <config>
22
+ <modules>
23
+ <MGS_ResponsiveSlideshow>
24
+ <active>true</active>
25
+ <codePool>local</codePool>
26
+ </MGS_ResponsiveSlideshow>
27
+ </modules>
28
+ </config>
js/mgs_responsiveslideshow/adminhtml/product.js ADDED
@@ -0,0 +1,1056 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magentocommerce.com for more information.
19
+ *
20
+ * @category Mage
21
+ * @package Mage_Adminhtml
22
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+
26
+ var Product = {};
27
+
28
+ Product.Gallery = Class.create();
29
+ Product.Gallery.prototype = {
30
+ images : [],
31
+ file2id : {
32
+ 'no_selection' :0
33
+ },
34
+ idIncrement :1,
35
+ containerId :'',
36
+ container :null,
37
+ uploader :null,
38
+ imageTypes : {},
39
+ initialize : function(containerId, uploader, imageTypes) {
40
+ this.containerId = containerId, this.container = $(this.containerId);
41
+ this.uploader = uploader;
42
+ this.imageTypes = imageTypes;
43
+ if (this.uploader) {
44
+ this.uploader.onFilesComplete = this.handleUploadComplete
45
+ .bind(this);
46
+ }
47
+ // this.uploader.onFileProgress = this.handleUploadProgress.bind(this);
48
+ // this.uploader.onFileError = this.handleUploadError.bind(this);
49
+ this.images = this.getElement('save').value.evalJSON();
50
+ this.imagesValues = this.getElement('save_image').value.evalJSON();
51
+ this.template = new Template('<tr id="__id__" class="preview">' + this
52
+ .getElement('template').innerHTML + '</tr>', new RegExp(
53
+ '(^|.|\\r|\\n)(__([a-zA-Z0-9_]+)__)', ''));
54
+ this.fixParentTable();
55
+ this.updateImages();
56
+ varienGlobalEvents.attachEventHandler('moveTab', this.onImageTabMove
57
+ .bind(this));
58
+ },
59
+ onImageTabMove : function(event) {
60
+ var imagesTab = false;
61
+ this.container.ancestors().each( function(parentItem) {
62
+ if (parentItem.tabObject) {
63
+ imagesTab = parentItem.tabObject;
64
+ throw $break;
65
+ }
66
+ }.bind(this));
67
+
68
+ if (imagesTab && event.tab && event.tab.name && imagesTab.name == event.tab.name) {
69
+ this.container.select('input[type="radio"]').each(function(radio) {
70
+ radio.observe('change', this.onChangeRadio);
71
+ }.bind(this));
72
+ this.updateImages();
73
+ }
74
+
75
+ },
76
+ fixParentTable : function() {
77
+ this.container.ancestors().each( function(parentItem) {
78
+ if (parentItem.tagName.toLowerCase() == 'td') {
79
+ parentItem.style.width = '100%';
80
+ }
81
+ if (parentItem.tagName.toLowerCase() == 'table') {
82
+ parentItem.style.width = '100%';
83
+ throw $break;
84
+ }
85
+ });
86
+ },
87
+ getElement : function(name) {
88
+ return $(this.containerId + '_' + name);
89
+ },
90
+ showUploader : function() {
91
+ this.getElement('add_images_button').hide();
92
+ this.getElement('uploader').show();
93
+ },
94
+ handleUploadComplete : function(files) {
95
+ files.each( function(item) {
96
+ if (!item.response.isJSON()) {
97
+ try {
98
+ console.log(item.response);
99
+ } catch (e2) {
100
+ alert(item.response);
101
+ }
102
+ return;
103
+ }
104
+ var response = item.response.evalJSON();
105
+ if (response.error) {
106
+ return;
107
+ }
108
+ var newImage = {};
109
+ newImage.url = response.url;
110
+ newImage.file = response.file;
111
+ newImage.label = '';
112
+ newImage.caption = '';
113
+ newImage.position = this.getNextPosition();
114
+ newImage.disabled = 0;
115
+ newImage.removed = 0;
116
+ this.images.push(newImage);
117
+ this.uploader.removeFile(item.id);
118
+ }.bind(this));
119
+ this.container.setHasChanges();
120
+ this.updateImages();
121
+ },
122
+ updateImages : function() {
123
+ this.getElement('save').value = Object.toJSON(this.images);
124
+ $H(this.imageTypes).each(
125
+ function(pair) {
126
+ this.getFileElement('no_selection',
127
+ 'cell-' + pair.key + ' input').checked = true;
128
+ }.bind(this));
129
+ this.images.each( function(row) {
130
+ if (!$(this.prepareId(row.file))) {
131
+ this.createImageRow(row);
132
+ }
133
+ this.updateVisualisation(row.file);
134
+ }.bind(this));
135
+ this.updateUseDefault(false);
136
+ },
137
+ onChangeRadio: function (evt) {
138
+ var element = Event.element(evt);
139
+ element.setHasChanges();
140
+ },
141
+ createImageRow : function(image) {
142
+ var vars = Object.clone(image);
143
+ vars.id = this.prepareId(image.file);
144
+ var html = this.template.evaluate(vars);
145
+ Element.insert(this.getElement('list'), {
146
+ bottom :html
147
+ });
148
+
149
+ $(vars.id).select('input[type="radio"]').each(function(radio) {
150
+ radio.observe('change', this.onChangeRadio);
151
+ }.bind(this));
152
+ },
153
+ prepareId : function(file) {
154
+ if (typeof this.file2id[file] == 'undefined') {
155
+ this.file2id[file] = this.idIncrement++;
156
+ }
157
+ return this.containerId + '-image-' + this.file2id[file];
158
+ },
159
+ getNextPosition : function() {
160
+ var maxPosition = 0;
161
+ this.images.each( function(item) {
162
+ if (parseInt(item.position) > maxPosition) {
163
+ maxPosition = parseInt(item.position);
164
+ }
165
+ });
166
+ return maxPosition + 1;
167
+ },
168
+ updateImage : function(file) {
169
+ var index = this.getIndexByFile(file);
170
+ this.images[index].label = this
171
+ .getFileElement(file, 'cell-label input').value;
172
+ this.images[index].caption = this
173
+ .getFileElement(file, 'cell-caption input').value;
174
+ this.images[index].position = this.getFileElement(file,
175
+ 'cell-position input').value;
176
+ this.images[index].removed = (this.getFileElement(file,
177
+ 'cell-remove input').checked ? 1 : 0);
178
+ this.images[index].disabled = (this.getFileElement(file,
179
+ 'cell-disable input').checked ? 1 : 0);
180
+ this.getElement('save').value = Object.toJSON(this.images);
181
+ this.updateState(file);
182
+ this.container.setHasChanges();
183
+ },
184
+ loadImage : function(file) {
185
+ var image = this.getImageByFile(file);
186
+ this.getFileElement(file, 'cell-image img').src = image.url;
187
+ this.getFileElement(file, 'cell-image img').show();
188
+ this.getFileElement(file, 'cell-image .place-holder').hide();
189
+ },
190
+ setProductImages : function(file) {
191
+ $H(this.imageTypes)
192
+ .each(
193
+ function(pair) {
194
+ if (this.getFileElement(file,
195
+ 'cell-' + pair.key + ' input').checked) {
196
+ this.imagesValues[pair.key] = (file == 'no_selection' ? null
197
+ : file);
198
+ }
199
+ }.bind(this));
200
+
201
+ this.getElement('save_image').value = Object.toJSON($H(this.imagesValues));
202
+ },
203
+ updateVisualisation : function(file) {
204
+ var image = this.getImageByFile(file);
205
+ this.getFileElement(file, 'cell-label input').value = image.label;
206
+ this.getFileElement(file, 'cell-caption input').value = image.caption;
207
+ this.getFileElement(file, 'cell-position input').value = image.position;
208
+ this.getFileElement(file, 'cell-remove input').checked = (image.removed == 1);
209
+ this.getFileElement(file, 'cell-disable input').checked = (image.disabled == 1);
210
+ $H(this.imageTypes)
211
+ .each(
212
+ function(pair) {
213
+ if (this.imagesValues[pair.key] == file) {
214
+ this.getFileElement(file,
215
+ 'cell-' + pair.key + ' input').checked = true;
216
+ }
217
+ }.bind(this));
218
+ this.updateState(file);
219
+ },
220
+ updateState : function(file) {
221
+ if (this.getFileElement(file, 'cell-disable input').checked) {
222
+ this.getFileElement(file, 'cell-position input').disabled = true;
223
+ } else {
224
+ this.getFileElement(file, 'cell-position input').disabled = false;
225
+ }
226
+ },
227
+ getFileElement : function(file, element) {
228
+ var selector = '#' + this.prepareId(file) + ' .' + element;
229
+ var elems = $$(selector);
230
+ if (!elems[0]) {
231
+ try {
232
+ console.log(selector);
233
+ } catch (e2) {
234
+ alert(selector);
235
+ }
236
+ }
237
+
238
+ return $$('#' + this.prepareId(file) + ' .' + element)[0];
239
+ },
240
+ getImageByFile : function(file) {
241
+ if (this.getIndexByFile(file) === null) {
242
+ return false;
243
+ }
244
+
245
+ return this.images[this.getIndexByFile(file)];
246
+ },
247
+ getIndexByFile : function(file) {
248
+ var index;
249
+ this.images.each( function(item, i) {
250
+ if (item.file == file) {
251
+ index = i;
252
+ }
253
+ });
254
+ return index;
255
+ },
256
+ updateUseDefault : function() {
257
+ if (this.getElement('default')) {
258
+ this.getElement('default').select('input').each(
259
+ function(input) {
260
+ $(this.containerId).select(
261
+ '.cell-' + input.value + ' input').each(
262
+ function(radio) {
263
+ radio.disabled = input.checked;
264
+ });
265
+ }.bind(this));
266
+ }
267
+
268
+ if (arguments.length == 0) {
269
+ this.container.setHasChanges();
270
+ }
271
+ },
272
+ handleUploadProgress : function(file) {
273
+
274
+ },
275
+ handleUploadError : function(fileId) {
276
+
277
+ }
278
+ };
279
+
280
+ Product.AttributesBridge = {
281
+ tabsObject :false,
282
+ bindTabs2Attributes : {},
283
+ bind : function(tabId, attributesObject) {
284
+ this.bindTabs2Attributes[tabId] = attributesObject;
285
+ },
286
+ getAttributes : function(tabId) {
287
+ return this.bindTabs2Attributes[tabId];
288
+ },
289
+ setTabsObject : function(tabs) {
290
+ this.tabsObject = tabs;
291
+ },
292
+ getTabsObject : function() {
293
+ return this.tabsObject;
294
+ },
295
+ addAttributeRow : function(data) {
296
+ $H(data).each( function(item) {
297
+ if (this.getTabsObject().activeTab.name != item.key) {
298
+ this.getTabsObject().showTabContent($(item.key));
299
+ }
300
+ this.getAttributes(item.key).addRow(item.value);
301
+ }.bind(this));
302
+ }
303
+ };
304
+
305
+ Product.Attributes = Class.create();
306
+ Product.Attributes.prototype = {
307
+ config : {},
308
+ containerId :null,
309
+ initialize : function(containerId) {
310
+ this.containerId = containerId;
311
+ },
312
+ setConfig : function(config) {
313
+ this.config = config;
314
+ Product.AttributesBridge.bind(this.getConfig().tab_id, this);
315
+ },
316
+ getConfig : function() {
317
+ return this.config;
318
+ },
319
+ create : function() {
320
+ var win = window.open(this.getConfig().url, 'new_attribute',
321
+ 'width=900,height=600,resizable=1,scrollbars=1');
322
+ win.focus();
323
+ },
324
+ addRow : function(html) {
325
+ var attributesContainer = $$('#group_fields' + this.getConfig().group_id + ' .form-list tbody')[0];
326
+ Element.insert(attributesContainer, {
327
+ bottom :html
328
+ });
329
+
330
+ var childs = attributesContainer.childElements();
331
+ var element = childs[childs.size() - 1].select('input', 'select',
332
+ 'textarea')[0];
333
+ if (element) {
334
+ window.scrollTo(0, Position.cumulativeOffset(element)[1]
335
+ + element.offsetHeight);
336
+ }
337
+ }
338
+ };
339
+
340
+ Product.Configurable = Class.create();
341
+ Product.Configurable.prototype = {
342
+ initialize : function(attributes, links, idPrefix, grid, readonly) {
343
+ this.templatesSyntax = new RegExp(
344
+ '(^|.|\\r|\\n)(\'{{\\s*(\\w+)\\s*}}\')', "");
345
+ this.attributes = attributes; // Attributes
346
+ this.idPrefix = idPrefix; // Container id prefix
347
+ this.links = $H(links); // Associated products
348
+ this.newProducts = []; // For product that's created through Create
349
+ // Empty and Copy from Configurable
350
+ this.readonly = readonly;
351
+
352
+ /* Generation templates */
353
+ this.addAttributeTemplate = new Template(
354
+ $(idPrefix + 'attribute_template').innerHTML.replace(/__id__/g,
355
+ "'{{html_id}}'").replace(/ template no-display/g, ''),
356
+ this.templatesSyntax);
357
+ this.addValueTemplate = new Template(
358
+ $(idPrefix + 'value_template').innerHTML.replace(/__id__/g,
359
+ "'{{html_id}}'").replace(/ template no-display/g, ''),
360
+ this.templatesSyntax);
361
+ this.pricingValueTemplate = new Template(
362
+ $(idPrefix + 'simple_pricing').innerHTML, this.templatesSyntax);
363
+ this.pricingValueViewTemplate = new Template(
364
+ $(idPrefix + 'simple_pricing_view').innerHTML,
365
+ this.templatesSyntax);
366
+
367
+ this.container = $(idPrefix + 'attributes');
368
+
369
+ /* Listeners */
370
+ this.onLabelUpdate = this.updateLabel.bindAsEventListener(this); // Update
371
+ // attribute
372
+ // label
373
+ this.onValuePriceUpdate = this.updateValuePrice
374
+ .bindAsEventListener(this); // Update pricing value
375
+ this.onValueTypeUpdate = this.updateValueType.bindAsEventListener(this); // Update
376
+ // pricing
377
+ // type
378
+ this.onValueDefaultUpdate = this.updateValueUseDefault
379
+ .bindAsEventListener(this);
380
+
381
+ /* Grid initialization and attributes initialization */
382
+ this.createAttributes(); // Creation of default attributes
383
+
384
+ this.grid = grid;
385
+ this.grid.rowClickCallback = this.rowClick.bind(this);
386
+ this.grid.initRowCallback = this.rowInit.bind(this);
387
+ this.grid.checkboxCheckCallback = this.registerProduct.bind(this); // Associate/Unassociate
388
+ // simple
389
+ // product
390
+
391
+ this.grid.rows.each( function(row) {
392
+ this.rowInit(this.grid, row);
393
+ }.bind(this));
394
+ },
395
+ createAttributes : function() {
396
+ this.attributes.each( function(attribute, index) {
397
+ // var li = Builder.node('li', {className:'attribute'});
398
+ var li = $(document.createElement('LI'));
399
+ li.className = 'attribute';
400
+
401
+ li.id = this.idPrefix + '_attribute_' + index;
402
+ attribute.html_id = li.id;
403
+ if (attribute && attribute.label && attribute.label.blank()) {
404
+ attribute.label = '&nbsp;'
405
+ }
406
+ var label_readonly = '';
407
+ var use_default_checked = '';
408
+ if (attribute.use_default == '1') {
409
+ use_default_checked = ' checked="checked"';
410
+ label_readonly = ' readonly="readonly"';
411
+ }
412
+
413
+ var template = this.addAttributeTemplate.evaluate(attribute);
414
+ template = template.replace(
415
+ new RegExp(' readonly="label"', 'ig'), label_readonly);
416
+ template = template.replace(new RegExp(
417
+ ' checked="use_default"', 'ig'), use_default_checked);
418
+ li.update(template);
419
+ li.attributeObject = attribute;
420
+
421
+ this.container.appendChild(li);
422
+ li.attributeValues = li.down('.attribute-values');
423
+
424
+ if (attribute.values) {
425
+ attribute.values.each( function(value) {
426
+ this.createValueRow(li, value); // Add pricing values
427
+ }.bind(this));
428
+ }
429
+
430
+ /* Observe label change */
431
+ Event.observe(li.down('.attribute-label'), 'change',
432
+ this.onLabelUpdate);
433
+ Event.observe(li.down('.attribute-label'), 'keyup',
434
+ this.onLabelUpdate);
435
+ Event.observe(li.down('.attribute-use-default-label'),
436
+ 'change', this.onLabelUpdate);
437
+ }.bind(this));
438
+ if (!this.readonly) {
439
+ // Creation of sortable for attributes sorting
440
+ Sortable.create(this.container, {
441
+ handle :'attribute-name-container',
442
+ onUpdate :this.updatePositions.bind(this)
443
+ });
444
+ }
445
+ this.updateSaveInput();
446
+ },
447
+
448
+ updateLabel : function(event) {
449
+ var li = Event.findElement(event, 'LI');
450
+ var labelEl = li.down('.attribute-label');
451
+ var defEl = li.down('.attribute-use-default-label');
452
+
453
+ li.attributeObject.label = labelEl.value;
454
+ if (defEl.checked) {
455
+ labelEl.readOnly = true;
456
+ li.attributeObject.use_default = 1;
457
+ } else {
458
+ labelEl.readOnly = false;
459
+ li.attributeObject.use_default = 0;
460
+ }
461
+
462
+ this.updateSaveInput();
463
+ },
464
+ updatePositions : function(param) {
465
+ this.container.childElements().each( function(row, index) {
466
+ row.attributeObject.position = index;
467
+ });
468
+ this.updateSaveInput();
469
+ },
470
+ addNewProduct : function(productId, attributes) {
471
+ if (this.checkAttributes(attributes)) {
472
+ this.links.set(productId, this.cloneAttributes(attributes));
473
+ } else {
474
+ this.newProducts.push(productId);
475
+ }
476
+
477
+ this.updateGrid();
478
+ this.updateValues();
479
+ this.grid.reload(null);
480
+ },
481
+ createEmptyProduct : function() {
482
+ this.createPopup(this.createEmptyUrl)
483
+ },
484
+ createNewProduct : function() {
485
+ this.createPopup(this.createNormalUrl);
486
+ },
487
+ createPopup : function(url) {
488
+ if (this.win && !this.win.closed) {
489
+ this.win.close();
490
+ }
491
+
492
+ this.win = window.open(url, '',
493
+ 'width=1000,height=700,resizable=1,scrollbars=1');
494
+ this.win.focus();
495
+ },
496
+ registerProduct : function(grid, element, checked) {
497
+ if (checked) {
498
+ if (element.linkAttributes) {
499
+ this.links.set(element.value, element.linkAttributes);
500
+ }
501
+ } else {
502
+ this.links.unset(element.value);
503
+ }
504
+ this.updateGrid();
505
+ this.grid.rows.each( function(row) {
506
+ this.revalidateRow(this.grid, row);
507
+ }.bind(this));
508
+ this.updateValues();
509
+ },
510
+ updateProduct : function(productId, attributes) {
511
+ var isAssociated = false;
512
+
513
+ if (typeof this.links.get(productId) != 'undefined') {
514
+ isAssociated = true;
515
+ this.links.unset(productId);
516
+ }
517
+
518
+ if (isAssociated && this.checkAttributes(attributes)) {
519
+ this.links.set(productId, this.cloneAttributes(attributes));
520
+ } else if (isAssociated) {
521
+ this.newProducts.push(productId);
522
+ }
523
+
524
+ this.updateGrid();
525
+ this.updateValues();
526
+ this.grid.reload(null);
527
+ },
528
+ cloneAttributes : function(attributes) {
529
+ var newObj = [];
530
+ for ( var i = 0, length = attributes.length; i < length; i++) {
531
+ newObj[i] = Object.clone(attributes[i]);
532
+ }
533
+ return newObj;
534
+ },
535
+ rowClick : function(grid, event) {
536
+ var trElement = Event.findElement(event, 'tr');
537
+ var isInput = Event.element(event).tagName.toUpperCase() == 'INPUT';
538
+
539
+ if ($(Event.findElement(event, 'td')).down('a')) {
540
+ return;
541
+ }
542
+
543
+ if (trElement) {
544
+ var checkbox = $(trElement).down('input');
545
+ if (checkbox && !checkbox.disabled) {
546
+ var checked = isInput ? checkbox.checked : !checkbox.checked;
547
+ grid.setCheckboxChecked(checkbox, checked);
548
+ }
549
+ }
550
+ },
551
+ rowInit : function(grid, row) {
552
+ var checkbox = $(row).down('.checkbox');
553
+ var input = $(row).down('.value-json');
554
+ if (checkbox && input) {
555
+ checkbox.linkAttributes = input.value.evalJSON();
556
+ if (!checkbox.checked) {
557
+ if (!this.checkAttributes(checkbox.linkAttributes)) {
558
+ $(row).addClassName('invalid');
559
+ checkbox.disable();
560
+ } else {
561
+ $(row).removeClassName('invalid');
562
+ checkbox.enable();
563
+ }
564
+ }
565
+ }
566
+ },
567
+ revalidateRow : function(grid, row) {
568
+ var checkbox = $(row).down('.checkbox');
569
+ if (checkbox) {
570
+ if (!checkbox.checked) {
571
+ if (!this.checkAttributes(checkbox.linkAttributes)) {
572
+ $(row).addClassName('invalid');
573
+ checkbox.disable();
574
+ } else {
575
+ $(row).removeClassName('invalid');
576
+ checkbox.enable();
577
+ }
578
+ }
579
+ }
580
+ },
581
+ checkAttributes : function(attributes) {
582
+ var result = true;
583
+ this.links
584
+ .each( function(pair) {
585
+ var fail = false;
586
+ for ( var i = 0; i < pair.value.length && !fail; i++) {
587
+ for ( var j = 0; j < attributes.length && !fail; j++) {
588
+ if (pair.value[i].attribute_id == attributes[j].attribute_id
589
+ && pair.value[i].value_index != attributes[j].value_index) {
590
+ fail = true;
591
+ }
592
+ }
593
+ }
594
+ if (!fail) {
595
+ result = false;
596
+ }
597
+ });
598
+ return result;
599
+ },
600
+ updateGrid : function() {
601
+ this.grid.reloadParams = {
602
+ 'products[]' :this.links.keys().size() ? this.links.keys() : [ 0 ],
603
+ 'new_products[]' :this.newProducts
604
+ };
605
+ },
606
+ updateValues : function() {
607
+ var uniqueAttributeValues = $H( {});
608
+ /* Collect unique attributes */
609
+ this.links.each( function(pair) {
610
+ for ( var i = 0, length = pair.value.length; i < length; i++) {
611
+ var attribute = pair.value[i];
612
+ if (uniqueAttributeValues.keys()
613
+ .indexOf(attribute.attribute_id) == -1) {
614
+ uniqueAttributeValues.set(attribute.attribute_id, $H( {}));
615
+ }
616
+ uniqueAttributeValues.get(attribute.attribute_id).set(
617
+ attribute.value_index, attribute);
618
+ }
619
+ });
620
+ /* Updating attributes value container */
621
+ this.container
622
+ .childElements()
623
+ .each(
624
+ function(row) {
625
+ var attribute = row.attributeObject;
626
+ for ( var i = 0, length = attribute.values.length; i < length; i++) {
627
+ if (uniqueAttributeValues.keys().indexOf(
628
+ attribute.attribute_id) == -1
629
+ || uniqueAttributeValues
630
+ .get(attribute.attribute_id)
631
+ .keys()
632
+ .indexOf(
633
+ attribute.values[i].value_index) == -1) {
634
+ row.attributeValues
635
+ .childElements()
636
+ .each(
637
+ function(elem) {
638
+ if (elem.valueObject.value_index == attribute.values[i].value_index) {
639
+ elem.remove();
640
+ }
641
+ });
642
+ attribute.values[i] = undefined;
643
+
644
+ } else {
645
+ uniqueAttributeValues.get(
646
+ attribute.attribute_id).unset(
647
+ attribute.values[i].value_index);
648
+ }
649
+ }
650
+ attribute.values = attribute.values.compact();
651
+ if (uniqueAttributeValues
652
+ .get(attribute.attribute_id)) {
653
+ uniqueAttributeValues.get(
654
+ attribute.attribute_id).each(
655
+ function(pair) {
656
+ attribute.values.push(pair.value);
657
+ this
658
+ .createValueRow(row,
659
+ pair.value);
660
+ }.bind(this));
661
+ }
662
+ }.bind(this));
663
+ this.updateSaveInput();
664
+ this.updateSimpleForm();
665
+ },
666
+ createValueRow : function(container, value) {
667
+ var templateVariables = $H( {});
668
+ if (!this.valueAutoIndex) {
669
+ this.valueAutoIndex = 1;
670
+ }
671
+ templateVariables.set('html_id', container.id + '_'
672
+ + this.valueAutoIndex);
673
+ templateVariables.update(value);
674
+ var pricingValue = parseFloat(templateVariables.get('pricing_value'));
675
+ if (!isNaN(pricingValue)) {
676
+ templateVariables.set('pricing_value', pricingValue);
677
+ } else {
678
+ templateVariables.unset('pricing_value');
679
+ }
680
+ this.valueAutoIndex++;
681
+
682
+ // var li = $(Builder.node('li', {className:'attribute-value'}));
683
+ var li = $(document.createElement('LI'));
684
+ li.className = 'attribute-value';
685
+ li.id = templateVariables.get('html_id');
686
+ li.update(this.addValueTemplate.evaluate(templateVariables));
687
+ li.valueObject = value;
688
+ if (typeof li.valueObject.is_percent == 'undefined') {
689
+ li.valueObject.is_percent = 0;
690
+ }
691
+
692
+ if (typeof li.valueObject.pricing_value == 'undefined') {
693
+ li.valueObject.pricing_value = '';
694
+ }
695
+
696
+ container.attributeValues.appendChild(li);
697
+
698
+ var priceField = li.down('.attribute-price');
699
+ var priceTypeField = li.down('.attribute-price-type');
700
+
701
+ if (priceTypeField != undefined && priceTypeField.options != undefined) {
702
+ if (parseInt(value.is_percent)) {
703
+ priceTypeField.options[1].selected = !(priceTypeField.options[0].selected = false);
704
+ } else {
705
+ priceTypeField.options[1].selected = !(priceTypeField.options[0].selected = true);
706
+ }
707
+ }
708
+
709
+ Event.observe(priceField, 'keyup', this.onValuePriceUpdate);
710
+ Event.observe(priceField, 'change', this.onValuePriceUpdate);
711
+ Event.observe(priceTypeField, 'change', this.onValueTypeUpdate);
712
+ var useDefaultEl = li.down('.attribute-use-default-value');
713
+ if (useDefaultEl) {
714
+ if (li.valueObject.use_default_value) {
715
+ useDefaultEl.checked = true;
716
+ this.updateUseDefaultRow(useDefaultEl, li);
717
+ }
718
+ Event.observe(useDefaultEl, 'change', this.onValueDefaultUpdate);
719
+ }
720
+ },
721
+ updateValuePrice : function(event) {
722
+ var li = Event.findElement(event, 'LI');
723
+ li.valueObject.pricing_value = (Event.element(event).value.blank() ? null
724
+ : Event.element(event).value);
725
+ this.updateSimpleForm();
726
+ this.updateSaveInput();
727
+ },
728
+ updateValueType : function(event) {
729
+ var li = Event.findElement(event, 'LI');
730
+ li.valueObject.is_percent = (Event.element(event).value.blank() ? null
731
+ : Event.element(event).value);
732
+ this.updateSimpleForm();
733
+ this.updateSaveInput();
734
+ },
735
+ updateValueUseDefault : function(event) {
736
+ var li = Event.findElement(event, 'LI');
737
+ var useDefaultEl = Event.element(event);
738
+ li.valueObject.use_default_value = useDefaultEl.checked;
739
+ this.updateUseDefaultRow(useDefaultEl, li);
740
+ },
741
+ updateUseDefaultRow : function(useDefaultEl, li) {
742
+ var priceField = li.down('.attribute-price');
743
+ var priceTypeField = li.down('.attribute-price-type');
744
+ if (useDefaultEl.checked) {
745
+ priceField.disabled = true;
746
+ priceTypeField.disabled = true;
747
+ } else {
748
+ priceField.disabled = false;
749
+ priceTypeField.disabled = false;
750
+ }
751
+ this.updateSimpleForm();
752
+ this.updateSaveInput();
753
+ },
754
+ updateSaveInput : function() {
755
+ $(this.idPrefix + 'save_attributes').value = Object.toJSON(this.attributes);
756
+ $(this.idPrefix + 'save_links').value = Object.toJSON(this.links);
757
+ },
758
+ initializeAdvicesForSimpleForm : function() {
759
+ if ($(this.idPrefix + 'simple_form').advicesInited) {
760
+ return;
761
+ }
762
+
763
+ $(this.idPrefix + 'simple_form').select('td.value').each( function(td) {
764
+ var adviceContainer = $(Builder.node('div'));
765
+ td.appendChild(adviceContainer);
766
+ td.select('input', 'select').each( function(element) {
767
+ element.advaiceContainer = adviceContainer;
768
+ });
769
+ });
770
+ $(this.idPrefix + 'simple_form').advicesInited = true;
771
+ },
772
+ quickCreateNewProduct : function() {
773
+ this.initializeAdvicesForSimpleForm();
774
+ $(this.idPrefix + 'simple_form').removeClassName('ignore-validate');
775
+ var validationResult = $(this.idPrefix + 'simple_form').select('input',
776
+ 'select', 'textarea').collect( function(elm) {
777
+ return Validation.validate(elm, {
778
+ useTitle :false,
779
+ onElementValidate : function() {
780
+ }
781
+ });
782
+ }).all();
783
+ $(this.idPrefix + 'simple_form').addClassName('ignore-validate');
784
+
785
+ if (!validationResult) {
786
+ return;
787
+ }
788
+
789
+ var params = Form.serializeElements($(this.idPrefix + 'simple_form')
790
+ .select('input', 'select', 'textarea'), true);
791
+ params.form_key = FORM_KEY;
792
+ $('messages').update();
793
+ new Ajax.Request(this.createQuickUrl, {
794
+ parameters :params,
795
+ method :'post',
796
+ area :$(this.idPrefix + 'simple_form'),
797
+ onComplete :this.quickCreateNewProductComplete.bind(this)
798
+ });
799
+ },
800
+ quickCreateNewProductComplete : function(transport) {
801
+ var result = transport.responseText.evalJSON();
802
+
803
+ if (result.error) {
804
+ if (result.error.fields) {
805
+ $(this.idPrefix + 'simple_form').removeClassName(
806
+ 'ignore-validate');
807
+ $H(result.error.fields)
808
+ .each(
809
+ function(pair) {
810
+ $('simple_product_' + pair.key).value = pair.value;
811
+ $('simple_product_' + pair.key + '_autogenerate').checked = false;
812
+ toggleValueElements(
813
+ $('simple_product_' + pair.key + '_autogenerate'),
814
+ $('simple_product_' + pair.key + '_autogenerate').parentNode);
815
+ Validation.ajaxError(
816
+ $('simple_product_' + pair.key),
817
+ result.error.message);
818
+ });
819
+ $(this.idPrefix + 'simple_form')
820
+ .addClassName('ignore-validate');
821
+ } else {
822
+ if (result.error.message) {
823
+ alert(result.error.message);
824
+ } else {
825
+ alert(result.error);
826
+ }
827
+ }
828
+ return;
829
+ } else if (result.messages) {
830
+ $('messages').update(result.messages);
831
+ }
832
+
833
+ result.attributes
834
+ .each( function(attribute) {
835
+ var attr = this.getAttributeById(attribute.attribute_id);
836
+ if (!this.getValueByIndex(attr, attribute.value_index)
837
+ && result.pricing
838
+ && result.pricing[attr.attribute_code]) {
839
+
840
+ attribute.is_percent = result.pricing[attr.attribute_code].is_percent;
841
+ attribute.pricing_value = (result.pricing[attr.attribute_code].value == null ? ''
842
+ : result.pricing[attr.attribute_code].value);
843
+ }
844
+ }.bind(this));
845
+
846
+ this.attributes.each( function(attribute) {
847
+ if ($('simple_product_' + attribute.attribute_code)) {
848
+ $('simple_product_' + attribute.attribute_code).value = '';
849
+ }
850
+ }.bind(this));
851
+
852
+ this.links.set(result.product_id, result.attributes);
853
+ this.updateGrid();
854
+ this.updateValues();
855
+ this.grid.reload();
856
+ },
857
+ checkCreationUniqueAttributes : function() {
858
+ var attributes = [];
859
+ this.attributes
860
+ .each( function(attribute) {
861
+ attributes
862
+ .push( {
863
+ attribute_id :attribute.attribute_id,
864
+ value_index :$('simple_product_' + attribute.attribute_code).value
865
+ });
866
+ }.bind(this));
867
+
868
+ return this.checkAttributes(attributes);
869
+ },
870
+ getAttributeByCode : function(attributeCode) {
871
+ var attribute = null;
872
+ this.attributes.each( function(item) {
873
+ if (item.attribute_code == attributeCode) {
874
+ attribute = item;
875
+ throw $break;
876
+ }
877
+ });
878
+ return attribute;
879
+ },
880
+ getAttributeById : function(attributeId) {
881
+ var attribute = null;
882
+ this.attributes.each( function(item) {
883
+ if (item.attribute_id == attributeId) {
884
+ attribute = item;
885
+ throw $break;
886
+ }
887
+ });
888
+ return attribute;
889
+ },
890
+ getValueByIndex : function(attribute, valueIndex) {
891
+ var result = null;
892
+ attribute.values.each( function(value) {
893
+ if (value.value_index == valueIndex) {
894
+ result = value;
895
+ throw $break;
896
+ }
897
+ });
898
+ return result;
899
+ },
900
+ showPricing : function(select, attributeCode) {
901
+ var attribute = this.getAttributeByCode(attributeCode);
902
+ if (!attribute) {
903
+ return;
904
+ }
905
+
906
+ select = $(select);
907
+ if (select.value
908
+ && !$('simple_product_' + attributeCode + '_pricing_container')) {
909
+ Element
910
+ .insert(
911
+ select,
912
+ {
913
+ after :'<div class="left"></div> <div id="simple_product_' + attributeCode + '_pricing_container" class="left"></div>'
914
+ });
915
+ var newContainer = select.next('div');
916
+ select.parentNode.removeChild(select);
917
+ newContainer.appendChild(select);
918
+ // Fix visualization bug
919
+ $(this.idPrefix + 'simple_form').down('.form-list').style.width = '100%';
920
+ }
921
+
922
+ var container = $('simple_product_' + attributeCode + '_pricing_container');
923
+
924
+ if (select.value) {
925
+ var value = this.getValueByIndex(attribute, select.value);
926
+ if (!value) {
927
+ if (!container.down('.attribute-price')) {
928
+ if (value == null) {
929
+ value = {};
930
+ }
931
+ container.update(this.pricingValueTemplate.evaluate(value));
932
+ var priceValueField = container.down('.attribute-price');
933
+ var priceTypeField = container
934
+ .down('.attribute-price-type');
935
+
936
+ priceValueField.attributeCode = attributeCode;
937
+ priceValueField.priceField = priceValueField;
938
+ priceValueField.typeField = priceTypeField;
939
+
940
+ priceTypeField.attributeCode = attributeCode;
941
+ priceTypeField.priceField = priceValueField;
942
+ priceTypeField.typeField = priceTypeField;
943
+
944
+ Event.observe(priceValueField, 'change',
945
+ this.updateSimplePricing.bindAsEventListener(this));
946
+ Event.observe(priceValueField, 'keyup',
947
+ this.updateSimplePricing.bindAsEventListener(this));
948
+ Event.observe(priceTypeField, 'change',
949
+ this.updateSimplePricing.bindAsEventListener(this));
950
+
951
+ $('simple_product_' + attributeCode + '_pricing_value').value = null;
952
+ $('simple_product_' + attributeCode + '_pricing_type').value = null;
953
+ }
954
+ } else if (!isNaN(parseFloat(value.pricing_value))) {
955
+ container.update(this.pricingValueViewTemplate.evaluate( {
956
+ 'value' :(parseFloat(value.pricing_value) > 0 ? '+' : '')
957
+ + parseFloat(value.pricing_value)
958
+ + (parseInt(value.is_percent) > 0 ? '%' : '')
959
+ }));
960
+ $('simple_product_' + attributeCode + '_pricing_value').value = value.pricing_value;
961
+ $('simple_product_' + attributeCode + '_pricing_type').value = value.is_percent;
962
+ } else {
963
+ container.update('');
964
+ $('simple_product_' + attributeCode + '_pricing_value').value = null;
965
+ $('simple_product_' + attributeCode + '_pricing_type').value = null;
966
+ }
967
+ } else if (container) {
968
+ container.update('');
969
+ $('simple_product_' + attributeCode + '_pricing_value').value = null;
970
+ $('simple_product_' + attributeCode + '_pricing_type').value = null;
971
+ }
972
+ },
973
+ updateSimplePricing : function(evt) {
974
+ var element = Event.element(evt);
975
+ if (!element.priceField.value.blank()) {
976
+ $('simple_product_' + element.attributeCode + '_pricing_value').value = element.priceField.value;
977
+ $('simple_product_' + element.attributeCode + '_pricing_type').value = element.typeField.value;
978
+ } else {
979
+ $('simple_product_' + element.attributeCode + '_pricing_value').value = null;
980
+ $('simple_product_' + element.attributeCode + '_pricing_type').value = null;
981
+ }
982
+ },
983
+ updateSimpleForm : function() {
984
+ this.attributes.each( function(attribute) {
985
+ if ($('simple_product_' + attribute.attribute_code)) {
986
+ this.showPricing(
987
+ $('simple_product_' + attribute.attribute_code),
988
+ attribute.attribute_code);
989
+ }
990
+ }.bind(this));
991
+ },
992
+ showNoticeMessage : function() {
993
+ $('assign_product_warrning').show();
994
+ }
995
+ }
996
+
997
+ var onInitDisableFieldsList = [];
998
+
999
+ function toogleFieldEditMode(toogleIdentifier, fieldContainer) {
1000
+ if ($(toogleIdentifier).checked) {
1001
+ enableFieldEditMode(fieldContainer);
1002
+ } else {
1003
+ disableFieldEditMode(fieldContainer);
1004
+ }
1005
+ }
1006
+
1007
+ function disableFieldEditMode(fieldContainer) {
1008
+ $(fieldContainer).disabled = true;
1009
+ if ($(fieldContainer + '_hidden')) {
1010
+ $(fieldContainer + '_hidden').disabled = true;
1011
+ }
1012
+ }
1013
+
1014
+ function enableFieldEditMode(fieldContainer) {
1015
+ $(fieldContainer).disabled = false;
1016
+ if ($(fieldContainer + '_hidden')) {
1017
+ $(fieldContainer + '_hidden').disabled = false;
1018
+ }
1019
+ }
1020
+
1021
+ function initDisableFields(fieldContainer) {
1022
+ onInitDisableFieldsList.push(fieldContainer);
1023
+ }
1024
+
1025
+ function onCompleteDisableInited() {
1026
+ onInitDisableFieldsList.each( function(item) {
1027
+ disableFieldEditMode(item);
1028
+ });
1029
+ }
1030
+
1031
+ function onUrlkeyChanged(urlKey) {
1032
+ urlKey = $(urlKey);
1033
+ var hidden = urlKey.next('input[type=hidden]');
1034
+ var chbx = urlKey.next('input[type=checkbox]');
1035
+ var oldValue = chbx.value;
1036
+ chbx.disabled = (oldValue == urlKey.value);
1037
+ hidden.disabled = chbx.disabled;
1038
+ }
1039
+
1040
+ function onCustomUseParentChanged(element) {
1041
+ var useParent = (element.value == 1) ? true : false;
1042
+ element.up(2).select('input', 'select', 'textarea').each(function(el){
1043
+ if (element.id != el.id) {
1044
+ el.disabled = useParent;
1045
+ }
1046
+ });
1047
+ element.up(2).select('img').each(function(el){
1048
+ if (useParent) {
1049
+ el.hide();
1050
+ } else {
1051
+ el.show();
1052
+ }
1053
+ });
1054
+ }
1055
+
1056
+ Event.observe(window, 'load', onCompleteDisableInited);
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>MGS_ResponsiveSlideshow</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Slideshow homepage is usually paid highest attention by visitors. So, it's one of the most important in your website. Responsive Slideshow extension allows you to easy making the beautiful slideshow in your website.</summary>
10
+ <description>Slideshow is a important component for an emcommerce website. With image, animation and text you can present products, marketing, discounts,... It is not only highlights of website, also it&#x2019;s a most place where customer focus on.&#xD;
11
+ &#xD;
12
+ Responsive Slideshow is believed to be practically useful Magento Extensions for any websites based on Magento platform. It's designed and developed with responsive design to meet all screen size and all devices. It's also designed with many advanced features which facilitate administrator to manage Slideshow from back end panel. At front end, our Magento Slideshow can be viewed smoothly with various effects. You can check and see its features as follows:</description>
13
+ <notes>version 1.0.0</notes>
14
+ <authors><author><name>Mage Solution</name><user>mage_solution</user><email>info@magesolution.com</email></author></authors>
15
+ <date>2014-02-25</date>
16
+ <time>07:09:01</time>
17
+ <contents><target name="mageetc"><dir name="modules"><file name="MGS_Mgscore.xml" hash="f8ac0e98f4c28786cd4b615090676e1f"/><file name="MGS_ResponsiveSlideshow.xml" hash="360ebf9140f3bfb6c3c2fc180b80aa02"/></dir></target><target name="magelocal"><dir name="MGS"><dir name="Mgscore"><dir name="Block"><dir name="System"><dir name="Config"><file name="About.php" hash="e3a6ea60f46dcc1e9f961d60d1eaca1f"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="e8940e23620e28ed20fe8bb799526230"/></dir><dir name="etc"><file name="config.xml" hash="f15f20b1d2b4ff90c9c289ae273c01ff"/><file name="system.xml" hash="231f2cc3b2d424833cb4ea328bac70f6"/></dir></dir><dir name="ResponsiveSlideshow"><dir name="Block"><dir name="Adminhtml"><dir name="Slideshow"><dir name="Add"><file name="Form.php" hash="95a8825f5a083b2a7026f3198c7cf540"/><dir name="Tab"><file name="Category.php" hash="443c70f7d646816020910ffca4ac655d"/><file name="Form.php" hash="6ca63ee2cb4cd2e197f0a7f74832c062"/><file name="Image.php" hash="e6bb7d5595cd1570aca1c0d91d826389"/><file name="Page.php" hash="fe7158d3fb27789fe17533b4769b1bd5"/></dir><file name="Tabs.php" hash="348c6a56f28313857dfe87bd8277d679"/></dir><file name="Add.php" hash="a105733299c0c7d47eff5a28b5b7574d"/><dir name="Edit"><file name="Form.php" hash="c4cda5d17262e8192a7f38c38634ba9d"/><dir name="Tab"><dir name="Ajax"><file name="Serializer.php" hash="967d972bde556e0e0617334dbb08a4a0"/></dir><file name="Category.php" hash="26b15814fe332283555302485b702bfb"/><file name="Form.php" hash="a2e86b202e0f2814f6482d5d1074c877"/><file name="Image.php" hash="9fd9a3daa357175ccba4d64c10c2a24e"/><file name="Page.php" hash="b53035667f80c9a7f3c0034dcae8ad92"/><file name="Products.php" hash="7dadb59fadc52fdd238f9997e17d52f0"/><file name="Staticblocks.php" hash="c11776f7f29211cf215a145b14cdbab8"/></dir><file name="Tabs.php" hash="3201e1265f7e2b0a8028cd597a9b847c"/></dir><file name="Edit.php" hash="a39f9d4de851558ed0bed5b8c0605f42"/><file name="Grid.php" hash="b0c3fce971d106621caab7fd9e2fc749"/><dir name="Widget"><file name="Chooser.php" hash="500e6d221ef14be198bf33547faafec2"/></dir></dir><file name="Slideshow.php" hash="1dc61d53811745438dfbe28d0aae56b4"/></dir><dir name="Content"><file name="Contentbottom.php" hash="52fefe6837692300a553beb0631038c1"/><file name="Contenttop.php" hash="95ed1596695150ea19e2c63ab640abd0"/><file name="Headerbottom.php" hash="34afc965ee7a59c33ddc75819f5e438c"/><file name="Headertop.php" hash="34afc965ee7a59c33ddc75819f5e438c"/><file name="Leftbottom.php" hash="8bb20ce232cb6bb35997ab12f66ed029"/><file name="Lefttop.php" hash="4428a73bde9088b67ee2a7bcf4cf97b9"/><file name="Rightbottom.php" hash="045c7879ca24fdc908aac54a2fb4acf6"/><file name="Righttop.php" hash="4bbea1f90305054aa268f7112115dcb6"/></dir><file name="Slideshow.php" hash="b1f0c525f146b91a2e514858a8a07890"/><dir name="Widget"><file name="Slideshow.php" hash="189f9791d4410d0b9a023497a773e166"/></dir></dir><dir name="Helper"><file name="Data.php" hash="d905a4229bcb22a605713382d42de1ef"/><file name="Image.php" hash="21be5d93694058b9ff2f1a615ba07330"/></dir><dir name="Media"><file name="Uploader.php" hash="2dd7a6bb3707131f1776eac356c987bc"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Page.php" hash="64e05b0db4cfcc7ddc7586b08dd1f7e0"/><file name="Position.php" hash="4e1a91c3c2fbb501b7d09082a0d5ce98"/><file name="Setting.php" hash="f76857dbee7e347d76d0195bed7b0913"/></dir></dir><file name="Config.php" hash="3b77909e4667379320c53af7d32b29ce"/><dir name="Mysql4"><dir name="Slideshow"><file name="Collection.php" hash="3cc058a2758a600d6e5e79609d36e242"/><dir name="Image"><file name="Collection.php" hash="96d53e9b5b803d9730eabe830734bc0a"/></dir><file name="Image.php" hash="410c12d9649665da5d0264839a8b10f0"/><dir name="Product"><file name="Collection.php" hash="1fda0385e0fc478444326ec7c13fc148"/></dir><file name="Product.php" hash="52bbf903abd6eceb96b04ba53e2b9fcc"/><dir name="Staticblock"><file name="Collection.php" hash="3de962051d931103e3d86bd9e881d250"/></dir><file name="Staticblock.php" hash="d45bbe92f51c6fe21f9856205683e9c3"/></dir><file name="Slideshow.php" hash="1f34461304a8510cba4ec83ed04084ce"/></dir><dir name="Slideshow"><file name="Image.php" hash="032b3aa740957b6d6ef6abc23459ab18"/></dir><file name="Slideshow.php" hash="57c8f967ac0b6333776a2d49431674e3"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SlideshowController.php" hash="5dd4ebd4d9dcc364f5dd353fbd8a4ac9"/><file name="WidgetController.php" hash="70cec02bedc3c57098ef093ca611eb15"/></dir></dir><dir name="etc"><file name="config.xml" hash="d219a9713ff8c08e89ed0325654b1c14"/><file name="system.xml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="widget.xml" hash="61e70237240b686b094a50e518f8f62c"/></dir><dir name="sql"><dir name="aslideshow_setup"><file name="mysql4-install-1.0.0.php" hash="ced8df6fcb45c8794c894402ae439947"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="5ac0a4c3b928562d8287ccb890ed22e2"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="f2dfc86c49419f862705dc9d466f6ee4"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="mgs_responsiveslideshow.xml" hash="1d79c9d63ecbfa5545606d6ba18b24fc"/></dir><dir name="template"><dir name="mgs_responsiveslideshow"><dir name="content"><file name="responsiveslidehow.phtml" hash="2bc299b9ec3c96e7d3858a447d7361eb"/></dir><dir name="widget"><file name="responsiveslidehow.phtml" hash="83bbbf3ffe5501d4cb9fc67989b31104"/></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="mgs_responsiveslideshow"><dir name="adminhtml"><file name="product.js" hash="40878f3e8abf993c29964e5a80dabe04"/></dir></dir></dir><dir name="app"><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="aslideshow.xml" hash="53fb3a7be1b8771d691e5f0d3d829568"/></dir><dir name="template"><dir name="mgs_responsiveslideshow"><dir name="edit"><file name="serializer.phtml" hash="1e58dedca6c141ff82d81c7fe792a472"/><dir name="tab"><file name="category.phtml" hash="69c44302a8b93318d48c4f068fb8d3f6"/><file name="image.phtml" hash="f2eb9226b2eeaafc1ad962c4f6ff370b"/></dir></dir><file name="products.phtml" hash="ad942b65bbe41e0f714f21faf83394b6"/><file name="script-transition.phtml" hash="2cfb2639dd6ba1b4242325319f8df936"/><file name="script.phtml" hash="f4faa0b4e57bec8f06e2d0a9441953b5"/><file name="slideshow.phtml" hash="3eebd9e81bd81ede7870ec1a77a16bf7"/></dir></dir></dir></dir></dir></dir></dir><dir name="skin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="responsiveslideshow"><file name="flexslider.css" hash="e3e854009cf73ea414373e7fa2d5ad53"/></dir></dir><dir name="images"><dir name="responsiveslideshow"><file name="bg_direction_nav.png" hash="f595730bbfc9b24daa4c834f8c8660b9"/><file name="controlls.gif" hash="0e96da6d0706c5f7f749a233415551e5"/><file name="preload.gif" hash="8f6c7d5d6a2a249d88eeb14d0a31a784"/></dir></dir><dir name="js"><dir name="responsiveslideshow"><file name="jquery.flexslider.js" hash="4b8e19f3dc3a22572352e6abc41762b3"/><file name="jquery.js" hash="38251a5074065e46fea974a460ea7a00"/><file name="jquery.noconflict.js" hash="3179f2255b046d5f2e9a71e365287bef"/><file name="modernizr.js" hash="45b8019544658adc80276650404767bf"/></dir></dir></dir></dir></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
20
+ </package>
skin/frontend/default/default/css/responsiveslideshow/flexslider.css ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery FlexSlider v2.0
3
+ * http://www.woothemes.com/flexslider/
4
+ *
5
+ * Copyright 2012 WooThemes
6
+ * Free to use under the GPLv2 license.
7
+ * http://www.gnu.org/licenses/gpl-2.0.html
8
+ *
9
+ * Contributing author: Tyler Smith (@mbmufffin)
10
+ */
11
+
12
+
13
+ /* Browser Resets */
14
+ .slider {/*margin: 0 15px;*/}
15
+ .flex-container a:active,
16
+ .flexslider a:active,
17
+ .flex-container a:focus,
18
+ .flexslider a:focus {outline: none;}
19
+ .slides,
20
+ .flex-control-nav,
21
+ .flex-direction-nav {margin: 0; padding: 0; list-style: none;}
22
+
23
+ /* FlexSlider Necessary Styles
24
+ *********************************/
25
+ .flexslider {margin: 0; padding: 0;}
26
+ .flexslider .slides > li {display: none; -webkit-backface-visibility: hidden; position: relative;} /* Hide the slides before the JS is loaded. Avoids image jumping */
27
+ .flexslider .slides img {width: 100%; display: block;}
28
+ .flex-pauseplay span {text-transform: capitalize;}
29
+
30
+ /* Clearfix for the .slides element */
31
+ .slides:after {content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0;}
32
+ html[xmlns] .slides {display: block;}
33
+ * html .slides {height: 1%;}
34
+
35
+ /* No JavaScript Fallback */
36
+ /* If you are not using another script, such as Modernizr, make sure you
37
+ * include js that eliminates this class on page load */
38
+ .no-js .slides > li:first-child {display: block;}
39
+
40
+
41
+ /* FlexSlider Default Theme
42
+ *********************************/
43
+ .flexslider {width:100%;margin: 0 0 30px; background: #fff; border: 4px solid #fff; position: relative; -webkit-border-radius: 4px; -moz-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.2); -webkit-box-shadow: 0 1px 4px rgba(0,0,0,.2); -moz-box-shadow: 0 1px 4px rgba(0,0,0,.2); -o-box-shadow: 0 1px 4px rgba(0,0,0,.2); zoom: 1;}
44
+ .flex-viewport {max-height: 2000px; -webkit-transition: all 1s ease; -moz-transition: all 1s ease; transition: all 1s ease;}
45
+ .loading .flex-viewport {max-height: 300px;}
46
+ .flexslider .slides {zoom: 1;}
47
+
48
+ .carousel li {margin-right: 5px}
49
+
50
+
51
+ /* Direction Nav */
52
+ .flex-direction-nav {*height: 0;}
53
+ .flex-direction-nav a {width: 30px; height: 30px; margin: -20px 0 0; display: block; background: url(../../images/responsiveslideshow/bg_direction_nav.png) no-repeat 0 0; position: absolute; top: 50%; z-index: 10; cursor: pointer; text-indent: -9999px; opacity: 0; -webkit-transition: all .3s ease;}
54
+ .flex-direction-nav .flex-next {background-position: 100% 0; right: 5px; }
55
+ .flex-direction-nav .flex-prev {left: 5px;}
56
+ .flexslider:hover .flex-next {opacity: 0.8; right: 5px;}
57
+ .flexslider:hover .flex-prev {opacity: 0.8; left: 5px;}
58
+ .flexslider:hover .flex-next:hover, .flexslider:hover .flex-prev:hover {opacity: 1;}
59
+ .flex-direction-nav .flex-disabled {/*opacity: .3!important;*/ filter:alpha(opacity=30); cursor: default;}
60
+
61
+ /* Control Nav */
62
+ .flex-control-nav {width: 100%; position: absolute; bottom: -40px; /*text-align: center;*/ /*display: none;*/}
63
+ .flex-control-nav li {margin: 0 6px; display: inline-block; zoom: 1; *display: inline;}
64
+ .flex-control-paging li a {width: 11px; height: 11px; display: block; background: #666; background: rgba(0,0,0,0.5); cursor: pointer; text-indent: -9999px; -webkit-border-radius: 20px; -moz-border-radius: 20px; -o-border-radius: 20px; border-radius: 20px; box-shadow: inset 0 0 3px rgba(0,0,0,0.3);}
65
+ .flex-control-paging li a:hover { background: #333; background: rgba(0,0,0,0.7); }
66
+ .flex-control-paging li a.flex-active { background: #000; background: rgba(0,0,0,0.9); cursor: default; }
67
+
68
+ .flex-control-thumbs {margin: 5px 0 0; position: static; overflow: hidden;}
69
+ .flex-control-thumbs li {width: 25%; float: left; margin: 0;}
70
+ .flex-control-thumbs img {width: 100%; display: block; opacity: .7; cursor: pointer;}
71
+ .flex-control-thumbs img:hover {opacity: 1;}
72
+ .flex-control-thumbs .flex-active {opacity: 1; cursor: default;}
73
+
74
+ .feature_excerpt {
75
+ background: none repeat scroll 0 0 #000000;
76
+ bottom: 0;
77
+ color: #FFFFFF;
78
+ cursor: pointer;
79
+ display: block;
80
+ font-size: 11.5px;
81
+ left: 0;
82
+ line-height: 1.5em;
83
+ padding: 10px 2%;
84
+ position: absolute;
85
+ width: 96%;
86
+ z-index: 2;
87
+ }
88
+
89
+ @media screen and (max-width: 860px) {
90
+ .flex-direction-nav .flex-prev {opacity: 1; left: 0;}
91
+ .flex-direction-nav .flex-next {opacity: 1; right: 0;}
92
+ }
skin/frontend/default/default/images/responsiveslideshow/bg_direction_nav.png ADDED
Binary file
skin/frontend/default/default/images/responsiveslideshow/controlls.gif ADDED
Binary file
skin/frontend/default/default/images/responsiveslideshow/preload.gif ADDED
Binary file
skin/frontend/default/default/js/responsiveslideshow/jquery.flexslider.js ADDED
@@ -0,0 +1,904 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery FlexSlider v2.1
3
+ * http://www.woothemes.com/flexslider/
4
+ *
5
+ * Copyright 2012 WooThemes
6
+ * Free to use under the GPLv2 license.
7
+ * http://www.gnu.org/licenses/gpl-2.0.html
8
+ *
9
+ * Contributing author: Tyler Smith (@mbmufffin)
10
+ */
11
+
12
+ ;(function ($) {
13
+
14
+ //FlexSlider: Object Instance
15
+ $.flexslider = function(el, options) {
16
+ var slider = $(el),
17
+ vars = $.extend({}, $.flexslider.defaults, options),
18
+ namespace = vars.namespace,
19
+ touch = ("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch,
20
+ eventType = (touch) ? "touchend" : "click",
21
+ vertical = vars.direction === "vertical",
22
+ reverse = vars.reverse,
23
+ carousel = (vars.itemWidth > 0),
24
+ fade = vars.animation === "fade",
25
+ asNav = vars.asNavFor !== "",
26
+ methods = {};
27
+
28
+ // Store a reference to the slider object
29
+ $.data(el, "flexslider", slider);
30
+
31
+ // Privat slider methods
32
+ methods = {
33
+ init: function() {
34
+ slider.animating = false;
35
+ slider.currentSlide = vars.startAt;
36
+ slider.animatingTo = slider.currentSlide;
37
+ slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
38
+ slider.containerSelector = vars.selector.substr(0,vars.selector.search(' '));
39
+ slider.slides = $(vars.selector, slider);
40
+ slider.container = $(slider.containerSelector, slider);
41
+ slider.count = slider.slides.length;
42
+ // SYNC:
43
+ slider.syncExists = $(vars.sync).length > 0;
44
+ // SLIDE:
45
+ if (vars.animation === "slide") vars.animation = "swing";
46
+ slider.prop = (vertical) ? "top" : "marginLeft";
47
+ slider.args = {};
48
+ // SLIDESHOW:
49
+ slider.manualPause = false;
50
+ // TOUCH/USECSS:
51
+ slider.transitions = !vars.video && !fade && vars.useCSS && (function() {
52
+ var obj = document.createElement('div'),
53
+ props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
54
+ for (var i in props) {
55
+ if ( obj.style[ props[i] ] !== undefined ) {
56
+ slider.pfx = props[i].replace('Perspective','').toLowerCase();
57
+ slider.prop = "-" + slider.pfx + "-transform";
58
+ return true;
59
+ }
60
+ }
61
+ return false;
62
+ }());
63
+ // CONTROLSCONTAINER:
64
+ if (vars.controlsContainer !== "") slider.controlsContainer = $(vars.controlsContainer).length > 0 && $(vars.controlsContainer);
65
+ // MANUAL:
66
+ if (vars.manualControls !== "") slider.manualControls = $(vars.manualControls).length > 0 && $(vars.manualControls);
67
+
68
+ // RANDOMIZE:
69
+ if (vars.randomize) {
70
+ slider.slides.sort(function() { return (Math.round(Math.random())-0.5); });
71
+ slider.container.empty().append(slider.slides);
72
+ }
73
+
74
+ slider.doMath();
75
+
76
+ // ASNAV:
77
+ if (asNav) methods.asNav.setup();
78
+
79
+ // INIT
80
+ slider.setup("init");
81
+
82
+ // CONTROLNAV:
83
+ if (vars.controlNav) methods.controlNav.setup();
84
+
85
+ // DIRECTIONNAV:
86
+ if (vars.directionNav) methods.directionNav.setup();
87
+
88
+ // KEYBOARD:
89
+ if (vars.keyboard && ($(slider.containerSelector).length === 1 || vars.multipleKeyboard)) {
90
+ $(document).bind('keyup', function(event) {
91
+ var keycode = event.keyCode;
92
+ if (!slider.animating && (keycode === 39 || keycode === 37)) {
93
+ var target = (keycode === 39) ? slider.getTarget('next') :
94
+ (keycode === 37) ? slider.getTarget('prev') : false;
95
+ slider.flexAnimate(target, vars.pauseOnAction);
96
+ }
97
+ });
98
+ }
99
+ // MOUSEWHEEL:
100
+ if (vars.mousewheel) {
101
+ slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
102
+ event.preventDefault();
103
+ var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
104
+ slider.flexAnimate(target, vars.pauseOnAction);
105
+ });
106
+ }
107
+
108
+ // PAUSEPLAY
109
+ if (vars.pausePlay) methods.pausePlay.setup();
110
+
111
+ // SLIDSESHOW
112
+ if (vars.slideshow) {
113
+ if (vars.pauseOnHover) {
114
+ slider.hover(function() {
115
+ if (!slider.manualPlay && !slider.manualPause) slider.pause();
116
+ }, function() {
117
+ if (!slider.manualPause && !slider.manualPlay) slider.play();
118
+ });
119
+ }
120
+ // initialize animation
121
+ (vars.initDelay > 0) ? setTimeout(slider.play, vars.initDelay) : slider.play();
122
+ }
123
+
124
+ // TOUCH
125
+ if (touch && vars.touch) methods.touch();
126
+
127
+ // FADE&&SMOOTHHEIGHT || SLIDE:
128
+ if (!fade || (fade && vars.smoothHeight)) $(window).bind("resize focus", methods.resize);
129
+
130
+
131
+ // API: start() Callback
132
+ setTimeout(function(){
133
+ vars.start(slider);
134
+ }, 200);
135
+ },
136
+ asNav: {
137
+ setup: function() {
138
+ slider.asNav = true;
139
+ slider.animatingTo = Math.floor(slider.currentSlide/slider.move);
140
+ slider.currentItem = slider.currentSlide;
141
+ slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
142
+ slider.slides.click(function(e){
143
+ e.preventDefault();
144
+ var $slide = $(this),
145
+ target = $slide.index();
146
+ if (!$(vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
147
+ slider.direction = (slider.currentItem < target) ? "next" : "prev";
148
+ slider.flexAnimate(target, vars.pauseOnAction, false, true, true);
149
+ }
150
+ });
151
+ }
152
+ },
153
+ controlNav: {
154
+ setup: function() {
155
+ if (!slider.manualControls) {
156
+ methods.controlNav.setupPaging();
157
+ } else { // MANUALCONTROLS:
158
+ methods.controlNav.setupManual();
159
+ }
160
+ },
161
+ setupPaging: function() {
162
+ var type = (vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
163
+ j = 1,
164
+ item;
165
+
166
+ slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>');
167
+
168
+ if (slider.pagingCount > 1) {
169
+ for (var i = 0; i < slider.pagingCount; i++) {
170
+ item = (vars.controlNav === "thumbnails") ? '<img src="' + slider.slides.eq(i).attr("data-thumb") + '"/>' : '<a>' + j + '</a>';
171
+ slider.controlNavScaffold.append('<li>' + item + '</li>');
172
+ j++;
173
+ }
174
+ }
175
+
176
+ // CONTROLSCONTAINER:
177
+ (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);
178
+ methods.controlNav.set();
179
+
180
+ methods.controlNav.active();
181
+
182
+ slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
183
+ event.preventDefault();
184
+ var $this = $(this),
185
+ target = slider.controlNav.index($this);
186
+
187
+ if (!$this.hasClass(namespace + 'active')) {
188
+ slider.direction = (target > slider.currentSlide) ? "next" : "prev";
189
+ slider.flexAnimate(target, vars.pauseOnAction);
190
+ }
191
+ });
192
+ // Prevent iOS click event bug
193
+ if (touch) {
194
+ slider.controlNavScaffold.delegate('a', "click touchstart", function(event) {
195
+ event.preventDefault();
196
+ });
197
+ }
198
+ },
199
+ setupManual: function() {
200
+ slider.controlNav = slider.manualControls;
201
+ methods.controlNav.active();
202
+
203
+ slider.controlNav.live(eventType, function(event) {
204
+ event.preventDefault();
205
+ var $this = $(this),
206
+ target = slider.controlNav.index($this);
207
+
208
+ if (!$this.hasClass(namespace + 'active')) {
209
+ (target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev";
210
+ slider.flexAnimate(target, vars.pauseOnAction);
211
+ }
212
+ });
213
+ // Prevent iOS click event bug
214
+ if (touch) {
215
+ slider.controlNav.live("click touchstart", function(event) {
216
+ event.preventDefault();
217
+ });
218
+ }
219
+ },
220
+ set: function() {
221
+ var selector = (vars.controlNav === "thumbnails") ? 'img' : 'a';
222
+ slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
223
+ },
224
+ active: function() {
225
+ slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
226
+ },
227
+ update: function(action, pos) {
228
+ if (slider.pagingCount > 1 && action === "add") {
229
+ slider.controlNavScaffold.append($('<li><a>' + slider.count + '</a></li>'));
230
+ } else if (slider.pagingCount === 1) {
231
+ slider.controlNavScaffold.find('li').remove();
232
+ } else {
233
+ slider.controlNav.eq(pos).closest('li').remove();
234
+ }
235
+ methods.controlNav.set();
236
+ (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
237
+ }
238
+ },
239
+ directionNav: {
240
+ setup: function() {
241
+ var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li><a class="' + namespace + 'prev" href="#">' + vars.prevText + '</a></li><li><a class="' + namespace + 'next" href="#">' + vars.nextText + '</a></li></ul>');
242
+
243
+ // CONTROLSCONTAINER:
244
+ if (slider.controlsContainer) {
245
+ $(slider.controlsContainer).append(directionNavScaffold);
246
+ slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
247
+ } else {
248
+ slider.append(directionNavScaffold);
249
+ slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
250
+ }
251
+
252
+ methods.directionNav.update();
253
+
254
+ slider.directionNav.bind(eventType, function(event) {
255
+ event.preventDefault();
256
+ var target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
257
+ slider.flexAnimate(target, vars.pauseOnAction);
258
+ });
259
+ // Prevent iOS click event bug
260
+ if (touch) {
261
+ slider.directionNav.bind("click touchstart", function(event) {
262
+ event.preventDefault();
263
+ });
264
+ }
265
+ },
266
+ update: function() {
267
+ var disabledClass = namespace + 'disabled';
268
+ if (slider.pagingCount === 1) {
269
+ slider.directionNav.addClass(disabledClass);
270
+ } else if (!vars.animationLoop) {
271
+ if (slider.animatingTo === 0) {
272
+ slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass);
273
+ } else if (slider.animatingTo === slider.last) {
274
+ slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass);
275
+ } else {
276
+ slider.directionNav.removeClass(disabledClass);
277
+ }
278
+ } else {
279
+ slider.directionNav.removeClass(disabledClass);
280
+ }
281
+ }
282
+ },
283
+ pausePlay: {
284
+ setup: function() {
285
+ var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a></a></div>');
286
+
287
+ // CONTROLSCONTAINER:
288
+ if (slider.controlsContainer) {
289
+ slider.controlsContainer.append(pausePlayScaffold);
290
+ slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);
291
+ } else {
292
+ slider.append(pausePlayScaffold);
293
+ slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);
294
+ }
295
+
296
+ methods.pausePlay.update((vars.slideshow) ? namespace + 'pause' : namespace + 'play');
297
+
298
+ slider.pausePlay.bind(eventType, function(event) {
299
+ event.preventDefault();
300
+ if ($(this).hasClass(namespace + 'pause')) {
301
+ slider.manualPause = true;
302
+ slider.manualPlay = false;
303
+ slider.pause();
304
+ } else {
305
+ slider.manualPause = false;
306
+ slider.manualPlay = true;
307
+ slider.play();
308
+ }
309
+ });
310
+ // Prevent iOS click event bug
311
+ if (touch) {
312
+ slider.pausePlay.bind("click touchstart", function(event) {
313
+ event.preventDefault();
314
+ });
315
+ }
316
+ },
317
+ update: function(state) {
318
+ (state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').text(vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').text(vars.pauseText);
319
+ }
320
+ },
321
+ touch: function() {
322
+ var startX,
323
+ startY,
324
+ offset,
325
+ cwidth,
326
+ dx,
327
+ startT,
328
+ scrolling = false;
329
+
330
+ el.addEventListener('touchstart', onTouchStart, false);
331
+ function onTouchStart(e) {
332
+ if (slider.animating) {
333
+ e.preventDefault();
334
+ } else if (e.touches.length === 1) {
335
+ slider.pause();
336
+ // CAROUSEL:
337
+ cwidth = (vertical) ? slider.h : slider. w;
338
+ startT = Number(new Date());
339
+ // CAROUSEL:
340
+ offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
341
+ (carousel && reverse) ? slider.limit - (((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo) :
342
+ (carousel && slider.currentSlide === slider.last) ? slider.limit :
343
+ (carousel) ? ((slider.itemW + vars.itemMargin) * slider.move) * slider.currentSlide :
344
+ (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
345
+ startX = (vertical) ? e.touches[0].pageY : e.touches[0].pageX;
346
+ startY = (vertical) ? e.touches[0].pageX : e.touches[0].pageY;
347
+
348
+ el.addEventListener('touchmove', onTouchMove, false);
349
+ el.addEventListener('touchend', onTouchEnd, false);
350
+ }
351
+ }
352
+
353
+ function onTouchMove(e) {
354
+ dx = (vertical) ? startX - e.touches[0].pageY : startX - e.touches[0].pageX;
355
+ scrolling = (vertical) ? (Math.abs(dx) < Math.abs(e.touches[0].pageX - startY)) : (Math.abs(dx) < Math.abs(e.touches[0].pageY - startY));
356
+
357
+ if (!scrolling || Number(new Date()) - startT > 500) {
358
+ e.preventDefault();
359
+ if (!fade && slider.transitions) {
360
+ if (!vars.animationLoop) {
361
+ dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1);
362
+ }
363
+ slider.setProps(offset + dx, "setTouch");
364
+ }
365
+ }
366
+ }
367
+
368
+ function onTouchEnd(e) {
369
+ // finish the touch by undoing the touch session
370
+ el.removeEventListener('touchmove', onTouchMove, false);
371
+
372
+ if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
373
+ var updateDx = (reverse) ? -dx : dx,
374
+ target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
375
+
376
+ if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
377
+ slider.flexAnimate(target, vars.pauseOnAction);
378
+ } else {
379
+ if (!fade) slider.flexAnimate(slider.currentSlide, vars.pauseOnAction, true);
380
+ }
381
+ }
382
+ el.removeEventListener('touchend', onTouchEnd, false);
383
+ startX = null;
384
+ startY = null;
385
+ dx = null;
386
+ offset = null;
387
+ }
388
+ },
389
+ resize: function() {
390
+ if (!slider.animating && slider.is(':visible')) {
391
+ if (!carousel) slider.doMath();
392
+
393
+ if (fade) {
394
+ // SMOOTH HEIGHT:
395
+ methods.smoothHeight();
396
+ } else if (carousel) { //CAROUSEL:
397
+ slider.slides.width(slider.computedW);
398
+ slider.update(slider.pagingCount);
399
+ slider.setProps();
400
+ }
401
+ else if (vertical) { //VERTICAL:
402
+ slider.viewport.height(slider.h);
403
+ slider.setProps(slider.h, "setTotal");
404
+ } else {
405
+ // SMOOTH HEIGHT:
406
+ if (vars.smoothHeight) methods.smoothHeight();
407
+ slider.newSlides.width(slider.computedW);
408
+ slider.setProps(slider.computedW, "setTotal");
409
+ }
410
+ }
411
+ },
412
+ smoothHeight: function(dur) {
413
+ if (!vertical || fade) {
414
+ var $obj = (fade) ? slider : slider.viewport;
415
+ (dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).height()}, dur) : $obj.height(slider.slides.eq(slider.animatingTo).height());
416
+ }
417
+ },
418
+ sync: function(action) {
419
+ var $obj = $(vars.sync).data("flexslider"),
420
+ target = slider.animatingTo;
421
+
422
+ switch (action) {
423
+ case "animate": $obj.flexAnimate(target, vars.pauseOnAction, false, true); break;
424
+ case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
425
+ case "pause": $obj.pause(); break;
426
+ }
427
+ }
428
+ }
429
+
430
+ // public methods
431
+ slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
432
+
433
+ if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev";
434
+
435
+ if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(":visible")) {
436
+ if (asNav && withSync) {
437
+ var master = $(vars.asNavFor).data('flexslider');
438
+ slider.atEnd = target === 0 || target === slider.count - 1;
439
+ master.flexAnimate(target, true, false, true, fromNav);
440
+ slider.direction = (slider.currentItem < target) ? "next" : "prev";
441
+ master.direction = slider.direction;
442
+
443
+ if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) {
444
+ slider.currentItem = target;
445
+ slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
446
+ target = Math.floor(target/slider.visible);
447
+ } else {
448
+ slider.currentItem = target;
449
+ slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
450
+ return false;
451
+ }
452
+ }
453
+
454
+ slider.animating = true;
455
+ slider.animatingTo = target;
456
+ // API: before() animation Callback
457
+ vars.before(slider);
458
+
459
+ // SLIDESHOW:
460
+ if (pause) slider.pause();
461
+
462
+ // SYNC:
463
+ if (slider.syncExists && !fromNav) methods.sync("animate");
464
+
465
+ // CONTROLNAV
466
+ if (vars.controlNav) methods.controlNav.active();
467
+
468
+ // !CAROUSEL:
469
+ // CANDIDATE: slide active class (for add/remove slide)
470
+ if (!carousel) slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide');
471
+
472
+ // INFINITE LOOP:
473
+ // CANDIDATE: atEnd
474
+ slider.atEnd = target === 0 || target === slider.last;
475
+
476
+ // DIRECTIONNAV:
477
+ if (vars.directionNav) methods.directionNav.update();
478
+
479
+ if (target === slider.last) {
480
+ // API: end() of cycle Callback
481
+ vars.end(slider);
482
+ // SLIDESHOW && !INFINITE LOOP:
483
+ if (!vars.animationLoop) slider.pause();
484
+ }
485
+
486
+ // SLIDE:
487
+ if (!fade) {
488
+ var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
489
+ margin, slideString, calcNext;
490
+
491
+ // INFINITE LOOP / REVERSE:
492
+ if (carousel) {
493
+ margin = (vars.itemWidth > slider.w) ? vars.itemMargin * 2 : vars.itemMargin;
494
+ calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;
495
+ slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;
496
+ } else if (slider.currentSlide === 0 && target === slider.count - 1 && vars.animationLoop && slider.direction !== "next") {
497
+ slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;
498
+ } else if (slider.currentSlide === slider.last && target === 0 && vars.animationLoop && slider.direction !== "prev") {
499
+ slideString = (reverse) ? 0 : (slider.count + 1) * dimension;
500
+ } else {
501
+ slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;
502
+ }
503
+ slider.setProps(slideString, "", vars.animationSpeed);
504
+ if (slider.transitions) {
505
+ if (!vars.animationLoop || !slider.atEnd) {
506
+ slider.animating = false;
507
+ slider.currentSlide = slider.animatingTo;
508
+ }
509
+ slider.container.unbind("webkitTransitionEnd transitionend");
510
+ slider.container.bind("webkitTransitionEnd transitionend", function() {
511
+ slider.wrapup(dimension);
512
+ });
513
+ } else {
514
+ slider.container.animate(slider.args, vars.animationSpeed, vars.easing, function(){
515
+ slider.wrapup(dimension);
516
+ });
517
+ }
518
+ } else { // FADE:
519
+ if (!touch) {
520
+ slider.slides.eq(slider.currentSlide).fadeOut(vars.animationSpeed, vars.easing);
521
+ slider.slides.eq(target).fadeIn(vars.animationSpeed, vars.easing, slider.wrapup);
522
+ } else {
523
+ slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 });
524
+ slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 });
525
+
526
+ slider.slides.unbind("webkitTransitionEnd transitionend");
527
+ slider.slides.eq(slider.currentSlide).bind("webkitTransitionEnd transitionend", function() {
528
+ // API: after() animation Callback
529
+ vars.after(slider);
530
+ });
531
+
532
+ slider.animating = false;
533
+ slider.currentSlide = slider.animatingTo;
534
+ }
535
+ }
536
+ // SMOOTH HEIGHT:
537
+ if (vars.smoothHeight) methods.smoothHeight(vars.animationSpeed);
538
+ }
539
+ }
540
+ slider.wrapup = function(dimension) {
541
+ // SLIDE:
542
+ if (!fade && !carousel) {
543
+ if (slider.currentSlide === 0 && slider.animatingTo === slider.last && vars.animationLoop) {
544
+ slider.setProps(dimension, "jumpEnd");
545
+ } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && vars.animationLoop) {
546
+ slider.setProps(dimension, "jumpStart");
547
+ }
548
+ }
549
+ slider.animating = false;
550
+ slider.currentSlide = slider.animatingTo;
551
+ // API: after() animation Callback
552
+ vars.after(slider);
553
+ }
554
+
555
+ // SLIDESHOW:
556
+ slider.animateSlides = function() {
557
+ if (!slider.animating) slider.flexAnimate(slider.getTarget("next"));
558
+ }
559
+ // SLIDESHOW:
560
+ slider.pause = function() {
561
+ clearInterval(slider.animatedSlides);
562
+ slider.playing = false;
563
+ // PAUSEPLAY:
564
+ if (vars.pausePlay) methods.pausePlay.update("play");
565
+ // SYNC:
566
+ if (slider.syncExists) methods.sync("pause");
567
+ }
568
+ // SLIDESHOW:
569
+ slider.play = function() {
570
+ slider.animatedSlides = setInterval(slider.animateSlides, vars.slideshowSpeed);
571
+ slider.playing = true;
572
+ // PAUSEPLAY:
573
+ if (vars.pausePlay) methods.pausePlay.update("pause");
574
+ // SYNC:
575
+ if (slider.syncExists) methods.sync("play");
576
+ }
577
+ slider.canAdvance = function(target, fromNav) {
578
+ // ASNAV:
579
+ var last = (asNav) ? slider.pagingCount - 1 : slider.last;
580
+ return (fromNav) ? true :
581
+ (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true :
582
+ (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
583
+ (target === slider.currentSlide && !asNav) ? false :
584
+ (vars.animationLoop) ? true :
585
+ (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
586
+ (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
587
+ true;
588
+ }
589
+ slider.getTarget = function(dir) {
590
+ slider.direction = dir;
591
+ if (dir === "next") {
592
+ return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
593
+ } else {
594
+ return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
595
+ }
596
+ }
597
+
598
+ // SLIDE:
599
+ slider.setProps = function(pos, special, dur) {
600
+ var target = (function() {
601
+ var posCheck = (pos) ? pos : ((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo,
602
+ posCalc = (function() {
603
+ if (carousel) {
604
+ return (special === "setTouch") ? pos :
605
+ (reverse && slider.animatingTo === slider.last) ? 0 :
606
+ (reverse) ? slider.limit - (((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo) :
607
+ (slider.animatingTo === slider.last) ? slider.limit : posCheck;
608
+ } else {
609
+ switch (special) {
610
+ case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
611
+ case "setTouch": return (reverse) ? pos : pos;
612
+ case "jumpEnd": return (reverse) ? pos : slider.count * pos;
613
+ case "jumpStart": return (reverse) ? slider.count * pos : pos;
614
+ default: return pos;
615
+ }
616
+ }
617
+ }());
618
+ return (posCalc * -1) + "px";
619
+ }());
620
+
621
+ if (slider.transitions) {
622
+ target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
623
+ dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
624
+ slider.container.css("-" + slider.pfx + "-transition-duration", dur);
625
+ }
626
+
627
+ slider.args[slider.prop] = target;
628
+ if (slider.transitions || dur === undefined) slider.container.css(slider.args);
629
+ }
630
+
631
+ slider.setup = function(type) {
632
+ // SLIDE:
633
+ if (!fade) {
634
+ var sliderOffset, arr;
635
+
636
+ if (type === "init") {
637
+ slider.viewport = $('<div class="' + namespace + 'viewport"></div>').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container);
638
+ // INFINITE LOOP:
639
+ slider.cloneCount = 0;
640
+ slider.cloneOffset = 0;
641
+ // REVERSE:
642
+ if (reverse) {
643
+ arr = $.makeArray(slider.slides).reverse();
644
+ slider.slides = $(arr);
645
+ slider.container.empty().append(slider.slides);
646
+ }
647
+ }
648
+ // INFINITE LOOP && !CAROUSEL:
649
+ if (vars.animationLoop && !carousel) {
650
+ slider.cloneCount = 2;
651
+ slider.cloneOffset = 1;
652
+ // clear out old clones
653
+ if (type !== "init") slider.container.find('.clone').remove();
654
+ slider.container.append(slider.slides.first().clone().addClass('clone')).prepend(slider.slides.last().clone().addClass('clone'));
655
+ }
656
+ slider.newSlides = $(vars.selector, slider);
657
+
658
+ sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
659
+ // VERTICAL:
660
+ if (vertical && !carousel) {
661
+ slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
662
+ setTimeout(function(){
663
+ slider.newSlides.css({"display": "block"});
664
+ slider.doMath();
665
+ slider.viewport.height(slider.h);
666
+ slider.setProps(sliderOffset * slider.h, "init");
667
+ }, (type === "init") ? 100 : 0);
668
+ } else {
669
+ slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
670
+ slider.setProps(sliderOffset * slider.computedW, "init");
671
+ setTimeout(function(){
672
+ slider.doMath();
673
+ slider.newSlides.css({"width": slider.computedW, "float": "left", "display": "block"});
674
+ // SMOOTH HEIGHT:
675
+ if (vars.smoothHeight) methods.smoothHeight();
676
+ }, (type === "init") ? 100 : 0);
677
+ }
678
+ } else { // FADE:
679
+ slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
680
+ if (type === "init") {
681
+ if (!touch) {
682
+ slider.slides.eq(slider.currentSlide).fadeIn(vars.animationSpeed, vars.easing);
683
+ } else {
684
+ slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2});
685
+ }
686
+ }
687
+ // SMOOTH HEIGHT:
688
+ if (vars.smoothHeight) methods.smoothHeight();
689
+ }
690
+ // !CAROUSEL:
691
+ // CANDIDATE: active slide
692
+ if (!carousel) slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide");
693
+ }
694
+
695
+ slider.doMath = function() {
696
+ var slide = slider.slides.first(),
697
+ slideMargin = vars.itemMargin,
698
+ minItems = vars.minItems,
699
+ maxItems = vars.maxItems;
700
+
701
+ slider.w = slider.width();
702
+ slider.h = slide.height();
703
+ slider.boxPadding = slide.outerWidth() - slide.width();
704
+
705
+ // CAROUSEL:
706
+ if (carousel) {
707
+ slider.itemT = vars.itemWidth + slideMargin;
708
+ slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
709
+ slider.maxW = (maxItems) ? maxItems * slider.itemT : slider.w;
710
+ slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * minItems))/minItems :
711
+ (slider.maxW < slider.w) ? (slider.w - (slideMargin * maxItems))/maxItems :
712
+ (vars.itemWidth > slider.w) ? slider.w : vars.itemWidth;
713
+ slider.visible = Math.floor(slider.w/(slider.itemW + slideMargin));
714
+ slider.move = (vars.move > 0 && vars.move < slider.visible ) ? vars.move : slider.visible;
715
+ slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1);
716
+ slider.last = slider.pagingCount - 1;
717
+ slider.limit = (slider.pagingCount === 1) ? 0 :
718
+ (vars.itemWidth > slider.w) ? ((slider.itemW + (slideMargin * 2)) * slider.count) - slider.w - slideMargin : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
719
+ } else {
720
+ slider.itemW = slider.w;
721
+ slider.pagingCount = slider.count;
722
+ slider.last = slider.count - 1;
723
+ }
724
+ slider.computedW = slider.itemW - slider.boxPadding;
725
+ }
726
+
727
+ slider.update = function(pos, action) {
728
+ slider.doMath();
729
+
730
+ // update currentSlide and slider.animatingTo if necessary
731
+ if (!carousel) {
732
+ if (pos < slider.currentSlide) {
733
+ slider.currentSlide += 1;
734
+ } else if (pos <= slider.currentSlide && pos !== 0) {
735
+ slider.currentSlide -= 1;
736
+ }
737
+ slider.animatingTo = slider.currentSlide;
738
+ }
739
+
740
+ // update controlNav
741
+ if (vars.controlNav && !slider.manualControls) {
742
+ if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) {
743
+ methods.controlNav.update("add");
744
+ } else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) {
745
+ if (carousel && slider.currentSlide > slider.last) {
746
+ slider.currentSlide -= 1;
747
+ slider.animatingTo -= 1;
748
+ }
749
+ methods.controlNav.update("remove", slider.last);
750
+ }
751
+ }
752
+ // update directionNav
753
+ if (vars.directionNav) methods.directionNav.update();
754
+
755
+ }
756
+
757
+ slider.addSlide = function(obj, pos) {
758
+ var $obj = $(obj);
759
+
760
+ slider.count += 1;
761
+ slider.last = slider.count - 1;
762
+
763
+ // append new slide
764
+ if (vertical && reverse) {
765
+ (pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);
766
+ } else {
767
+ (pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);
768
+ }
769
+
770
+ // update currentSlide, animatingTo, controlNav, and directionNav
771
+ slider.update(pos, "add");
772
+
773
+ // update slider.slides
774
+ slider.slides = $(vars.selector + ':not(.clone)', slider);
775
+ // re-setup the slider to accomdate new slide
776
+ slider.setup();
777
+
778
+ //FlexSlider: added() Callback
779
+ vars.added(slider);
780
+ }
781
+ slider.removeSlide = function(obj) {
782
+ var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;
783
+
784
+ // update count
785
+ slider.count -= 1;
786
+ slider.last = slider.count - 1;
787
+
788
+ // remove slide
789
+ if (isNaN(obj)) {
790
+ $(obj, slider.slides).remove();
791
+ } else {
792
+ (vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();
793
+ }
794
+
795
+ // update currentSlide, animatingTo, controlNav, and directionNav
796
+ slider.doMath();
797
+ slider.update(pos, "remove");
798
+
799
+ // update slider.slides
800
+ slider.slides = $(vars.selector + ':not(.clone)', slider);
801
+ // re-setup the slider to accomdate new slide
802
+ slider.setup();
803
+
804
+ // FlexSlider: removed() Callback
805
+ vars.removed(slider);
806
+ }
807
+
808
+ //FlexSlider: Initialize
809
+ methods.init();
810
+ }
811
+
812
+ //FlexSlider: Default Settings
813
+ $.flexslider.defaults = {
814
+ namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin
815
+ selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
816
+ animation: "fade", //String: Select your animation type, "fade" or "slide"
817
+ easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
818
+ direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical"
819
+ reverse: false, //{NEW} Boolean: Reverse the animation direction
820
+ animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
821
+ smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
822
+ startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
823
+ slideshow: true, //Boolean: Animate slider automatically
824
+ slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds
825
+ animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds
826
+ initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds
827
+ randomize: false, //Boolean: Randomize slide order
828
+
829
+ // Usability features
830
+ pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
831
+ pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
832
+ useCSS: true, //{NEW} Boolean: Slider will use CSS3 transitions if available
833
+ touch: true, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
834
+ video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
835
+
836
+ // Primary Controls
837
+ controlNav: true, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
838
+ directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false)
839
+ prevText: "Previous", //String: Set the text for the "previous" directionNav item
840
+ nextText: "Next", //String: Set the text for the "next" directionNav item
841
+
842
+ // Secondary Navigation
843
+ keyboard: true, //Boolean: Allow slider navigating via keyboard left/right keys
844
+ multipleKeyboard: false, //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
845
+ mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
846
+ pausePlay: false, //Boolean: Create pause/play dynamic element
847
+ pauseText: "Pause", //String: Set the text for the "pause" pausePlay item
848
+ playText: "Play", //String: Set the text for the "play" pausePlay item
849
+
850
+ // Special properties
851
+ controlsContainer: "", //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(".flexslider-container"). Property is ignored if given element is not found.
852
+ manualControls: "", //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
853
+ sync: "", //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
854
+ asNavFor: "", //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
855
+
856
+ // Carousel Options
857
+ itemWidth: 0, //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
858
+ itemMargin: 0, //{NEW} Integer: Margin between carousel items.
859
+ minItems: 0, //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
860
+ maxItems: 0, //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
861
+ move: 0, //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
862
+
863
+ // Callback API
864
+ start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide
865
+ before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation
866
+ after: function(){}, //Callback: function(slider) - Fires after each slider animation completes
867
+ end: function(){}, //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
868
+ added: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is added
869
+ removed: function(){} //{NEW} Callback: function(slider) - Fires after a slide is removed
870
+ }
871
+
872
+
873
+ //FlexSlider: Plugin Function
874
+ $.fn.flexslider = function(options) {
875
+ if (options === undefined) options = {};
876
+
877
+ if (typeof options === "object") {
878
+ return this.each(function() {
879
+ var $this = $(this),
880
+ selector = (options.selector) ? options.selector : ".slides > li",
881
+ $slides = $this.find(selector);
882
+
883
+ if ($slides.length === 1) {
884
+ $slides.fadeIn(400);
885
+ if (options.start) options.start($this);
886
+ } else if ($this.data('flexslider') == undefined) {
887
+ new $.flexslider(this, options);
888
+ }
889
+ });
890
+ } else {
891
+ // Helper strings to quickly perform functions on the slider
892
+ var $slider = $(this).data('flexslider');
893
+ switch (options) {
894
+ case "play": $slider.play(); break;
895
+ case "pause": $slider.pause(); break;
896
+ case "next": $slider.flexAnimate($slider.getTarget("next"), true); break;
897
+ case "prev":
898
+ case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break;
899
+ default: if (typeof options === "number") $slider.flexAnimate(options, true);
900
+ }
901
+ }
902
+ }
903
+
904
+ })(jQuery);
skin/frontend/default/default/js/responsiveslideshow/jquery.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery JavaScript Library v1.5.1
3
+ * http://jquery.com/
4
+ *
5
+ * Copyright 2011, John Resig
6
+ * Dual licensed under the MIT or GPL Version 2 licenses.
7
+ * http://jquery.org/license
8
+ *
9
+ * Includes Sizzle.js
10
+ * http://sizzlejs.com/
11
+ * Copyright 2011, The Dojo Foundation
12
+ * Released under the MIT, BSD, and GPL Licenses.
13
+ *
14
+ * Date: Wed Feb 23 13:55:29 2011 -0500
15
+ */
16
+ (function(a,b){function cg(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cd(a){if(!bZ[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";bZ[a]=c}return bZ[a]}function cc(a,b){var c={};d.each(cb.concat.apply([],cb.slice(0,b)),function(){c[this]=a});return c}function bY(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bX(){try{return new a.XMLHttpRequest}catch(b){}}function bW(){d(a).unload(function(){for(var a in bU)bU[a](0,1)})}function bQ(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h==="string"&&(f[h.toLowerCase()]=a.converters[h]);l=k,k=e[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=f[m]||f["* "+k];if(!n){p=b;for(o in f){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=f[j[1]+" "+k];if(p){o=f[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&d.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bP(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bO(a,b,c,e){if(d.isArray(b)&&b.length)d.each(b,function(b,f){c||bq.test(a)?e(a,f):bO(a+"["+(typeof f==="object"||d.isArray(f)?b:"")+"]",f,c,e)});else if(c||b==null||typeof b!=="object")e(a,b);else if(d.isArray(b)||d.isEmptyObject(b))e(a,"");else for(var f in b)bO(a+"["+f+"]",b[f],c,e)}function bN(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bH,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l==="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bN(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bN(a,c,d,e,"*",g));return l}function bM(a){return function(b,c){typeof b!=="string"&&(c=b,b="*");if(d.isFunction(c)){var e=b.toLowerCase().split(bB),f=0,g=e.length,h,i,j;for(;f<g;f++)h=e[f],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bo(a,b,c){var e=b==="width"?bi:bj,f=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return f;d.each(e,function(){c||(f-=parseFloat(d.css(a,"padding"+this))||0),c==="margin"?f+=parseFloat(d.css(a,"margin"+this))||0:f-=parseFloat(d.css(a,"border"+this+"Width"))||0});return f}function ba(a,b){b.src?d.ajax({url:b.src,async:!1,dataType:"script"}):d.globalEval(b.text||b.textContent||b.innerHTML||""),b.parentNode&&b.parentNode.removeChild(b)}function _(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function $(a,b){if(b.nodeType===1){var c=b.nodeName.toLowerCase();b.clearAttributes(),b.mergeAttributes(a);if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(d.expando)}}function Z(a,b){if(b.nodeType===1&&d.hasData(a)){var c=d.expando,e=d.data(a),f=d.data(b,e);if(e=e[c]){var g=e.events;f=f[c]=d.extend({},e);if(g){delete f.handle,f.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)d.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function Y(a,b){return d.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function O(a,b,c){if(d.isFunction(b))return d.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return d.grep(a,function(a,d){return a===b===c});if(typeof b==="string"){var e=d.grep(a,function(a){return a.nodeType===1});if(J.test(b))return d.filter(b,e,!c);b=d.filter(b,e)}return d.grep(a,function(a,e){return d.inArray(a,b)>=0===c})}function N(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function F(a,b){return(a&&a!=="*"?a+".":"")+b.replace(r,"`").replace(s,"&")}function E(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,q=[],r=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;i<t.length;i++)g=t[i],g.origType.replace(p,"")===a.type?r.push(g.selector):t.splice(i--,1);f=d(a.target).closest(r,a.currentTarget);for(j=0,k=f.length;j<k;j++){m=f[j];for(i=0;i<t.length;i++){g=t[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,e=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,e=d(a.relatedTarget).closest(g.selector)[0];(!e||e!==h)&&q.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=q.length;j<k;j++){f=q[j];if(c&&f.level>c)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function C(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function w(){return!0}function v(){return!1}function g(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function f(a,c,f){if(f===b&&a.nodeType===1){f=a.getAttribute("data-"+c);if(typeof f==="string"){try{f=f==="true"?!0:f==="false"?!1:f==="null"?null:d.isNaN(f)?e.test(f)?d.parseJSON(f):f:parseFloat(f)}catch(g){}d.data(a,c,f)}else f=b}return f}var c=a.document,d=function(){function I(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(I,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x=!1,y,z="then done fail isResolved isRejected promise".split(" "),A,B=Object.prototype.toString,C=Object.prototype.hasOwnProperty,D=Array.prototype.push,E=Array.prototype.slice,F=String.prototype.trim,G=Array.prototype.indexOf,H={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.1",length:0,size:function(){return this.length},toArray:function(){return E.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?D.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(E.apply(this,arguments),"slice",E.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:D,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){e=i[c],f=a[c];if(i===f)continue;l&&f&&(d.isPlainObject(f)||(g=d.isArray(f)))?(g?(g=!1,h=e&&d.isArray(e)?e:[]):h=e&&d.isPlainObject(e)?e:{},i[c]=d.extend(l,h,f)):f!==b&&(i[c]=f)}return i},d.extend({noConflict:function(b){a.$=f,b&&(a.jQuery=e);return d},isReady:!1,readyWait:1,ready:function(a){a===!0&&d.readyWait--;if(!d.readyWait||a!==!0&&!d.isReady){if(!c.body)return setTimeout(d.ready,1);d.isReady=!0;if(a!==!0&&--d.readyWait>0)return;y.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=!0;if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",A,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",A),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&I()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):H[B.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!C.call(a,"constructor")&&!C.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||C.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g<h;)if(c.apply(a[g++],e)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(var j=a[0];g<h&&c.call(j,g,j)!==!1;j=a[++g]){}return a},trim:F?function(a){return a==null?"":F.call(a)}:function(a){return a==null?"":(a+"").replace(j,"").replace(k,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var e=d.type(a);a.length==null||e==="string"||e==="function"||e==="regexp"||d.isWindow(a)?D.call(c,a):d.merge(c,a)}return c},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length==="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,b,c){var d=[],e;for(var f=0,g=a.length;f<g;f++)e=b(a[f],f,c),e!=null&&(d[d.length]=e);return d.concat.apply([],d)},guid:1,proxy:function(a,c,e){arguments.length===2&&(typeof c==="string"?(e=a,a=e[c],c=b):c&&!d.isFunction(c)&&(e=c,c=b)),!c&&a&&(c=function(){return a.apply(e||this,arguments)}),a&&(c.guid=a.guid=a.guid||c.guid||d.guid++);return c},access:function(a,c,e,f,g,h){var i=a.length;if(typeof c==="object"){for(var j in c)d.access(a,j,c[j],f,g,e);return a}if(e!==b){f=!h&&f&&d.isFunction(e);for(var k=0;k<i;k++)g(a[k],c,f?e.call(a[k],k,g(a[k],c)):e,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},_Deferred:function(){var a=[],b,c,e,f={done:function(){if(!e){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=d.type(i),j==="array"?f.done.apply(f,i):j==="function"&&a.push(i);k&&f.resolveWith(k[0],k[1])}return this},resolveWith:function(d,f){if(!e&&!b&&!c){c=1;try{while(a[0])a.shift().apply(d,f)}catch(g){throw g}finally{b=[d,f],c=0}}return this},resolve:function(){f.resolveWith(d.isFunction(this.promise)?this.promise():this,arguments);return this},isResolved:function(){return c||b},cancel:function(){e=1,a=[];return this}};return f},Deferred:function(a){var b=d._Deferred(),c=d._Deferred(),e;d.extend(b,{then:function(a,c){b.done(a).fail(c);return this},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,promise:function(a){if(a==null){if(e)return e;e=a={}}var c=z.length;while(c--)a[z[c]]=b[z[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){var b=arguments.length,c=b<=1&&a&&d.isFunction(a.promise)?a:d.Deferred(),e=c.promise();if(b>1){var f=E.call(arguments,0),g=b,h=function(a){return function(b){f[a]=arguments.length>1?E.call(arguments,0):b,--g||c.resolveWith(e,f)}};while(b--)a=f[b],a&&d.isFunction(a.promise)?a.promise().then(h(b),c.reject):--g;g||c.resolveWith(e,f)}else c!==a&&c.resolve(a);return e},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),y=d._Deferred(),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){H["[object "+b+"]"]=b.toLowerCase()}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),G&&(d.inArray=function(a,b){return G.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?A=function(){c.removeEventListener("DOMContentLoaded",A,!1),d.ready()}:c.attachEvent&&(A=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",A),d.ready())});return d}();(function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e),b=e=f=null}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",b.removeChild(a).style.display="none",a=e=null}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function"),b=null;return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null}})();var e=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!g(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));if(typeof c==="object"||typeof c==="function")f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c);i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,h=b.nodeType,i=h?d.cache:b,j=h?b[d.expando]:d.expando;if(!i[j])return;if(c){var k=e?i[j][f]:i[j];if(k){delete k[c];if(!g(k))return}}if(e){delete i[j][f];if(!g(i[j]))return}var l=i[j][f];d.support.deleteExpando||i!=a?delete i[j]:i[j]=null,l?(i[j]={},h||(i[j].toJSON=d.noop),i[j][f]=l):h&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var g=this[0].attributes,h;for(var i=0,j=g.length;i<j;i++)h=g[i].name,h.indexOf("data-")===0&&(h=h.substr(5),f(this[0],h,e[h]))}}return e}if(typeof a==="object")return this.each(function(){d.data(this,a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(c===b){e=this.triggerHandler("getData"+k[1]+"!",[k[0]]),e===b&&this.length&&(e=d.data(this[0],a),e=f(this[0],a,e));return e===b&&k[1]?this.data(k[0]):e}return this.each(function(){var b=d(this),e=[k[0],c];b.triggerHandler("setData"+k[1]+"!",e),d.data(this,a,c),b.triggerHandler("changeData"+k[1]+"!",e)})},removeData:function(a){return this.each(function(){d.removeData(this,a)})}}),d.extend({queue:function(a,b,c){if(a){b=(b||"fx")+"queue";var e=d._data(a,b);if(!c)return e||[];!e||d.isArray(c)?e=d._data(a,b,d.makeArray(c)):e.push(c);return e}},dequeue:function(a,b){b=b||"fx";var c=d.queue(a,b),e=c.shift();e==="inprogress"&&(e=c.shift()),e&&(b==="fx"&&c.unshift("inprogress"),e.call(a,function(){d.dequeue(a,b)})),c.length||d.removeData(a,b+"queue",!0)}}),d.fn.extend({queue:function(a,c){typeof a!=="string"&&(c=a,a="fx");if(c===b)return d.queue(this[0],a);return this.each(function(b){var e=d.queue(this,a,c);a==="fx"&&e[0]!=="inprogress"&&d.dequeue(this,a)})},dequeue:function(a){return this.each(function(){d.dequeue(this,a)})},delay:function(a,b){a=d.fx?d.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){d.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var h=/[\n\t\r]/g,i=/\s+/,j=/\r/g,k=/^(?:href|src|style)$/,l=/^(?:button|input)$/i,m=/^(?:button|input|object|select|textarea)$/i,n=/^a(?:rea)?$/i,o=/^(?:radio|checkbox)$/i;d.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"},d.fn.extend({attr:function(a,b){return d.access(this,a,b,!0,d.attr)},removeAttr:function(a,b){return this.each(function(){d.attr(this,a,""),this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.addClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"){var b=(a||"").split(i);for(var c=0,e=this.length;c<e;c++){var f=this[c];if(f.nodeType===1)if(f.className){var g=" "+f.className+" ",h=f.className;for(var j=0,k=b.length;j<k;j++)g.indexOf(" "+b[j]+" ")<0&&(h+=" "+b[j]);f.className=d.trim(h)}else f.className=a}}return this},removeClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.removeClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"||a===b){var c=(a||"").split(i);for(var e=0,f=this.length;e<f;e++){var g=this[e];if(g.nodeType===1&&g.className)if(a){var j=(" "+g.className+" ").replace(h," ");for(var k=0,l=c.length;k<l;k++)j=j.replace(" "+c[k]+" "," ");g.className=d.trim(j)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,e=typeof b==="boolean";if(d.isFunction(a))return this.each(function(c){var e=d(this);e.toggleClass(a.call(this,c,e.attr("class"),b),b)});return this.each(function(){if(c==="string"){var f,g=0,h=d(this),j=b,k=a.split(i);while(f=k[g++])j=e?j:!h.hasClass(f),h[j?"addClass":"removeClass"](f)}else if(c==="undefined"||c==="boolean")this.className&&d._data(this,"__className__",this.className),this.className=this.className||a===!1?"":d._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(h," ").indexOf(b)>-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0)return null;for(var k=i?f:0,l=i?f+1:h.length;k<l;k++){var m=h[k];if(m.selected&&(d.support.optDisabled?!m.disabled:m.getAttribute("disabled")===null)&&(!m.parentNode.disabled||!d.nodeName(m.parentNode,"optgroup"))){a=d(m).val();if(i)return a;g.push(a)}}if(i&&!g.length&&h.length)return d(h[f]).val();return g}if(o.test(c.type)&&!d.support.checkOn)return c.getAttribute("value")===null?"on":c.value;return(c.value||"").replace(j,"")}return b}var n=d.isFunction(a);return this.each(function(b){var c=d(this),e=a;if(this.nodeType===1){n&&(e=a.call(this,b,c.val())),e==null?e="":typeof e==="number"?e+="":d.isArray(e)&&(e=d.map(e,function(a){return a==null?"":a+""}));if(d.isArray(e)&&o.test(this.type))this.checked=d.inArray(c.val(),e)>=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=k.test(c);if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&l.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var o=a.getAttributeNode("tabIndex");return o&&o.specified?o.value:m.test(a.nodeName)||n.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var p=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return p===null?b:p}h&&(a[c]=e);return a[c]}});var p=/\.(.*)$/,q=/^(?:textarea|input|select)$/i,r=/\./g,s=/ /g,t=/[^\w\s.|`]/g,u=function(a){return a.replace(t,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)}catch(h){}if(f===!1)f=v;else if(!f)return;var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k)return;var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(){return typeof d!=="undefined"&&!d.event.triggered?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1)c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=v);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in t)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),u).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!e){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))d.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=d.event.special[h]||{};for(j=f||0;j<p.length;j++){q=p[j];if(e.guid===q.guid){if(l||n.test(q.namespace))f==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(f!=null)break}}if(p.length===0||f!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&d.removeEvent(a,h,s.handle),g=null,delete t[h]}if(d.isEmptyObject(t)){var w=s.handle;w&&(w.elem=null),delete s.events,delete s.handle,d.isEmptyObject(s)&&d.removeData(a,b,!0)}}},trigger:function(a,c,e){var f=a.type||a,g=arguments[3];if(!g){a=typeof a==="object"?a[d.expando]?a:d.extend(d.Event(f),a):d.Event(f),f.indexOf("!")>=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(p,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=!0,l[m]())}catch(q){}k&&(l["on"+m]=k),d.event.triggered=!1}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l<m;l++){var n=f[l];if(e||h.test(n.namespace)){c.handler=n.handler,c.data=n.data,c.handleObj=n;var o=n.handler.apply(this,k);o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[d.expando])return a;var e=a;a=d.Event(e);for(var f=this.props.length,g;f;)g=this.props[--f],a[g]=e[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=c.documentElement,i=c.body;a.pageX=a.clientX+(h&&h.scrollLeft||i&&i.scrollLeft||0)-(h&&h.clientLeft||i&&i.clientLeft||0),a.pageY=a.clientY+(h&&h.scrollTop||i&&i.scrollTop||0)-(h&&h.clientTop||i&&i.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:d.proxy,special:{ready:{setup:d.bindReady,teardown:d.noop},live:{add:function(a){d.event.add(this,F(a.origType,a.selector),d.extend({},a,{handler:E,guid:a.handler.guid}))},remove:function(a){d.event.remove(this,F(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){d.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},d.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},d.Event=function(a){if(!this.preventDefault)return new d.Event(a);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?w:v):this.type=a,this.timeStamp=d.now(),this[d.expando]=!0},d.Event.prototype={preventDefault:function(){this.isDefaultPrevented=w;var a=this.originalEvent;a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=w;var a=this.originalEvent;a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=w,this.stopPropagation()},isDefaultPrevented:v,isPropagationStopped:v,isImmediatePropagationStopped:v};var x=function(a){var b=a.relatedTarget;try{if(b!==c&&!b.parentNode)return;while(b&&b!==this)b=b.parentNode;b!==this&&(a.type=a.data,d.event.handle.apply(this,arguments))}catch(e){}},y=function(a){a.type=a.data,d.event.handle.apply(this,arguments)};d.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){d.event.special[a]={setup:function(c){d.event.add(this,b,c&&c.selector?y:x,a)},teardown:function(a){d.event.remove(this,b,a&&a.selector?y:x)}}}),d.support.submitBubbles||(d.event.special.submit={setup:function(a,b){if(this.nodeName&&this.nodeName.toLowerCase()!=="form")d.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&d(b).closest("form").length&&C("submit",this,arguments)}),d.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&d(b).closest("form").length&&a.keyCode===13&&C("submit",this,arguments)});else return!1},teardown:function(a){d.event.remove(this,".specialSubmit")}});if(!d.support.changeBubbles){var z,A=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},B=function B(a){var c=a.target,e,f;if(q.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=A(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f)a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}};d.event.special.change={filters:{focusout:B,beforedeactivate:B,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&B.call(this,a)},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&B.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",A(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in z)d.event.add(this,c+".specialChange",z[c]);return q.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return q.test(this.nodeName)}},z=d.event.special.change.filters,z.focus=z.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function c(a){a=d.event.fix(a),a.type=b;return d.event.handle.call(this,a)}d.event.special[b]={setup:function(){this.addEventListener(a,c,!0)},teardown:function(){this.removeEventListener(a,c,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i<j;i++)d.event.add(this[i],a,h,e);return this}}),d.fn.extend({unbind:function(a,b){if(typeof a!=="object"||a.preventDefault)for(var e=0,f=this.length;e<f;e++)d.event.remove(this[e],a,b);else for(var c in a)this.unbind(c,a[c]);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){d.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var c=d.Event(a);c.preventDefault(),c.stopPropagation(),d.event.trigger(c,b,this[0]);return c.result}},toggle:function(a){var b=arguments,c=1;while(c<b.length)d.proxy(a,b[c++]);return this.click(d.proxy(a,function(e){var f=(d._data(this,"lastToggle"+a.guid)||0)%c;d._data(this,"lastToggle"+a.guid,f+1),e.preventDefault();return b[f].apply(this,arguments)||!1}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var D={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};d.each(["live","die"],function(a,c){d.fn[c]=function(a,e,f,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:d(this.context);if(typeof a==="object"&&!a.preventDefault){for(var o in a)n[c](o,e,a[o],m);return this}d.isFunction(e)&&(f=e,e=b),a=(a||"").split(" ");while((h=a[i++])!=null){j=p.exec(h),k="",j&&(k=j[0],h=h.replace(p,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,h==="focus"||h==="blur"?(a.push(D[h]+k),h=h+k):h=(D[h]||h)+k;if(c==="live")for(var q=0,r=n.length;q<r;q++)d.event.add(n[q],"live."+F(h,m),{data:e,selector:m,handler:f,origType:h,origHandler:f,preType:l});else n.unbind("live."+F(h,m),f)}return this}}),d.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){d.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!=="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]")if(u)if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&e.push(j[t]);else e.push.apply(e,n);else p(n,e);o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!=="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(f){if(f===!0)continue}else g=o=!0}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b==="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1){}a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!=="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!=="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!=="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){return"text"===a.getAttribute("type")},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(a===b){g=!0;return 0}if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector,d=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(e){d=!0}b&&(k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(d||!l.match.PSEUDO.test(c)&&!/!=/.test(c))return b.call(a,c)}catch(e){}return k(c,null,null,[a]).length>0})}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};d.find=k,d.expr=k.selectors,d.expr[":"]=d.expr.filters,d.unique=k.uniqueSort,d.text=k.getText,d.isXMLDoc=k.isXML,d.contains=k.contains}();var G=/Until$/,H=/^(?:parents|prevUntil|prevAll)/,I=/,/,J=/^.[^:#\[\.,]*$/,K=Array.prototype.slice,L=d.expr.match.POS,M={children:!0,contents:!0,next:!0,prev:!0};d.fn.extend({find:function(a){var b=this.pushStack("","find",a),c=0;for(var e=0,f=this.length;e<f;e++){c=b.length,d.find(a,this[e],b);if(e>0)for(var g=c;g<b.length;g++)for(var h=0;h<c;h++)if(b[h]===b[g]){b.splice(g--,1);break}}return b},has:function(a){var b=d(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(d.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(O(this,a,!1),"not",a)},filter:function(a){return this.pushStack(O(this,a,!0),"filter",a)},is:function(a){return!!a&&d.filter(a,this).length>0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e<f;e++)i=a[e],j[i]||(j[i]=d.expr.match.POS.test(i)?d(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=L.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e<f;e++){g=this[e];while(g){if(l?l.index(g)>-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(N(c[0])||N(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=K.call(arguments);G.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!M[a]?d.unique(f):f,(this.length>1||I.test(e))&&H.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var P=/ jQuery\d+="(?:\d+|null)"/g,Q=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,S=/<([\w:]+)/,T=/<tbody/i,U=/<|&#?\w+;/,V=/<(?:script|object|embed|option|style)/i,W=/checked\s*(?:[^=]|=\s*.checked.)/i,X={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};X.optgroup=X.option,X.tbody=X.tfoot=X.colgroup=X.caption=X.thead,X.th=X.td,d.support.htmlSerialize||(X._default=[1,"div<div>","</div>"]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(P,""):null;if(typeof a!=="string"||V.test(a)||!d.support.leadingWhitespace&&Q.test(a)||X[(S.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(R,"<$1></$2>");try{for(var c=0,e=this.length;c<e;c++)this[c].nodeType===1&&(d.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(f){this.empty().append(a)}}return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(d.isFunction(a))return this.each(function(b){var c=d(this),e=c.html();c.replaceWith(a.call(this,b,e))});typeof a!=="string"&&(a=d(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;d(this).remove(),b?d(b).before(a):d(c).append(a)})}return this.pushStack(d(d.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,e){var f,g,h,i,j=a[0],k=[];if(!d.support.checkClone&&arguments.length===3&&typeof j==="string"&&W.test(j))return this.each(function(){d(this).domManip(a,c,e,!0)});if(d.isFunction(j))return this.each(function(f){var g=d(this);a[0]=j.call(this,f,c?g.html():b),g.domManip(a,c,e)});if(this[0]){i=j&&j.parentNode,d.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?f={fragment:i}:f=d.buildFragment(a,this,k),h=f.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&d.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)e.call(c?Y(this[l],g):this[l],f.cacheable||m>1&&l<n?d.clone(h,!0,!0):h)}k.length&&d.each(k,ba)}return this}}),d.buildFragment=function(a,b,e){var f,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]==="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!V.test(a[0])&&(d.support.checkClone||!W.test(a[0]))&&(g=!0,h=d.fragments[a[0]],h&&(h!==1&&(f=h))),f||(f=i.createDocumentFragment(),d.clean(a,i,f,e)),g&&(d.fragments[a[0]]=h?f:1);return{fragment:f,cacheable:g}},d.fragments={},d.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){d.fn[a]=function(c){var e=[],f=d(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&f.length===1){f[b](this[0]);return this}for(var h=0,i=f.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){$(a,e),f=_(a),g=_(e);for(h=0;f[h];++h)$(f[h],g[h])}if(b){Z(a,e);if(c){f=_(a),g=_(e);for(h=0;f[h];++h)Z(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||U.test(i)){if(typeof i==="string"){i=i.replace(R,"<$1></$2>");var j=(S.exec(i)||["",""])[1].toLowerCase(),k=X[j]||X._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=T.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]==="<table>"&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&Q.test(i)&&m.insertBefore(b.createTextNode(Q.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bb=/alpha\([^)]*\)/i,bc=/opacity=([^)]*)/,bd=/-([a-z])/ig,be=/([A-Z])/g,bf=/^-?\d+(?:px)?$/i,bg=/^-?\d/,bh={position:"absolute",visibility:"hidden",display:"block"},bi=["Left","Right"],bj=["Top","Bottom"],bk,bl,bm,bn=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bk(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.set(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bk)return bk(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bd,bn)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bo(a,b,e):d.swap(a,bh,function(){f=bo(a,b,e)});if(f<=0){f=bk(a,b,b),f==="0px"&&bm&&(f=bm(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bf.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return bc.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bb.test(f)?f.replace(bb,e):c.filter+" "+e}}),c.defaultView&&c.defaultView.getComputedStyle&&(bl=function(a,c,e){var f,g,h;e=e.replace(be,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bm=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bf.test(d)&&bg.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bk=bl||bm,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var bp=/%20/g,bq=/\[\]$/,br=/\r?\n/g,bs=/#.*$/,bt=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bu=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bv=/(?:^file|^widget|\-extension):$/,bw=/^(?:GET|HEAD)$/,bx=/^\/\//,by=/\?/,bz=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bA=/^(?:select|textarea)/i,bB=/\s+/,bC=/([?&])_=[^&]*/,bD=/(^|\-)([a-z])/g,bE=function(a,b,c){return b+c.toUpperCase()},bF=/^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,bG=d.fn.load,bH={},bI={},bJ,bK;try{bJ=c.location.href}catch(bL){bJ=c.createElement("a"),bJ.href="",bJ=bJ.href}bK=bF.exec(bJ.toLowerCase()),d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bG)return bG.apply(this,arguments);if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("<div>").append(c.replace(bz,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bA.test(this.nodeName)||bu.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(br,"\r\n")}}):{name:b.name,value:c.replace(br,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1})c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c]);return a},ajaxSettings:{url:bJ,isLocal:bv.test(bK[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bM(bH),ajaxTransport:bM(bI),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;var q,t,v,w=l?bP(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified"))d.lastModified[k]=x;if(y=u.getResponseHeader("Etag"))d.etag[k]=y}if(a===304)c="notmodified",q=!0;else try{t=bQ(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}else{v=c;if(!c||a)c="error",a<0&&(a=0)}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase().replace(bD,bE)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bt.exec(m))n[c[1].toLowerCase()]=c[2]}c=n[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2)for(b in a)j[b]=[j[b],a[b]];else b=a[u.status],u.then(b,b)}return this},e.url=((a||e.url)+"").replace(bs,"").replace(bx,bK[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bB),e.crossDomain||(q=bF.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bK[1]||q[2]!=bK[2]||(q[3]||(q[1]==="http:"?80:443))!=(bK[3]||(bK[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bN(bH,e,c,u);if(r===2)return!1;s=e.global,e.type=e.type.toUpperCase(),e.hasContent=!bw.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(by.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bC,"$1_="+w);e.url=x+(x===e.url?(by.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)l["Content-Type"]=e.contentType;e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];for(t in e.headers)u.setRequestHeader(t,e.headers[t]);if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return!1}for(t in {success:1,error:1,complete:1})u[t](e[t]);o=bN(bI,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}else v(-1,"No Transport");return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a))d.each(a,function(){f(this.name,this.value)});else for(var g in a)bO(g,a[g],c,f);return e.join("&").replace(bp,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bR=d.now(),bS=/(\=)\?(&|$)|()\?\?()/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bR++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bS.test(b.url)||f&&bS.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])};b.jsonp!==!1&&(j=j.replace(bS,l),b.url===j&&(f&&(k=k.replace(bS,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bT=d.now(),bU,bV;d.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&bX()||bY()}:bX,bV=d.ajaxSettings.xhr(),d.support.ajax=!!bV,d.support.cors=bV&&"withCredentials"in bV,bV=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields)for(i in a.xhrFields)g[i]=a.xhrFields[i];a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),(!a.crossDomain||a.hasContent)&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bU[h]);if(i)g.readyState!==4&&g.abort();else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&&(m.xml=n),m.text=g.responseText;try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bU||(bU={},bW()),h=bT++,g.onreadystatechange=bU[h]=c):c()},abort:function(){c&&c(0,1)}}}});var bZ={},b$=/^(?:toggle|show|hide)$/,b_=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,ca,cb=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(cc("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)e=this[g],f=e.style.display,!d._data(e,"olddisplay")&&f==="none"&&(f=e.style.display=""),f===""&&d.css(e,"display")==="none"&&d._data(e,"olddisplay",cd(e.nodeName));for(g=0;g<h;g++){e=this[g],f=e.style.display;if(f===""||f==="none")e.style.display=d._data(e,"olddisplay")||""}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cc("hide",3),a,b,c);for(var e=0,f=this.length;e<f;e++){var g=d.css(this[e],"display");g!=="none"&&!d._data(this[e],"olddisplay")&&d._data(this[e],"olddisplay",g)}for(e=0;e<f;e++)this[e].style.display="none";return this},_toggle:d.fn.toggle,toggle:function(a,b,c){var e=typeof a==="boolean";d.isFunction(a)&&d.isFunction(b)?this._toggle.apply(this,arguments):a==null||e?this.each(function(){var b=e?a:d(this).is(":hidden");d(this)[b?"show":"hide"]()}):this.animate(cc("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,e){var f=d.speed(b,c,e);if(d.isEmptyObject(a))return this.each(f.complete);return this[f.queue===!1?"each":"queue"](function(){var b=d.extend({},f),c,e=this.nodeType===1,g=e&&d(this).is(":hidden"),h=this;for(c in a){var i=d.camelCase(c);c!==i&&(a[i]=a[c],delete a[c],c=i);if(a[c]==="hide"&&g||a[c]==="show"&&!g)return b.complete.call(this);if(e&&(c==="height"||c==="width")){b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(d.css(this,"display")==="inline"&&d.css(this,"float")==="none")if(d.support.inlineBlockNeedsLayout){var j=cd(this.nodeName);j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)}else this.style.display="inline-block"}d.isArray(a[c])&&((b.specialEasing=b.specialEasing||{})[c]=a[c][1],a[c]=a[c][0])}b.overflow!=null&&(this.style.overflow="hidden"),b.curAnim=d.extend({},a),d.each(a,function(c,e){var f=new d.fx(h,b,c);if(b$.test(e))f[e==="toggle"?g?"show":"hide":e](a);else{var i=b_.exec(e),j=f.cur();if(i){var k=parseFloat(i[2]),l=i[3]||(d.cssNumber[c]?"":"px");l!=="px"&&(d.style(h,c,(k||1)+l),j=(k||1)/f.cur()*j,d.style(h,c,j+l)),i[1]&&(k=(i[1]==="-="?-1:1)*k+j),f.custom(j,k,l)}else f.custom(j,e,"")}});return!0})},stop:function(a,b){var c=d.timers;a&&this.queue([]),this.each(function(){for(var a=c.length-1;a>=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.dequeue();return this}}),d.each({slideDown:cc("show",1),slideUp:cc("hide",1),slideToggle:cc("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!ca&&(ca=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||d.fx.stop()},interval:13,stop:function(){clearInterval(ca),ca=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){d.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),d.expr&&d.expr.filters&&(d.expr.filters.animated=function(a){return d.grep(d.timers,function(b){return a===b.elem}).length});var ce=/^t(?:able|d|h)$/i,cf=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?d.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,g=f.documentElement;if(!c||!d.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=f.body,i=cg(f),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||d.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||d.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:d.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);d.offset.initialize();var c,e=b.offsetParent,f=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(d.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===e&&(l+=b.offsetTop,m+=b.offsetLeft,d.offset.doesNotAddBorder&&(!d.offset.doesAddBorderForTableAndCells||!ce.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),f=e,e=b.offsetParent),d.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;d.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},d.offset={initialize:function(){var a=c.body,b=c.createElement("div"),e,f,g,h,i=parseFloat(d.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),a=b=e=f=g=h=null,d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=e==="absolute"&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=cf.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!cf.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=cg(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=cg(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window);
skin/frontend/default/default/js/responsiveslideshow/jquery.noconflict.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery.noConflict();
skin/frontend/default/default/js/responsiveslideshow/modernizr.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /* Modernizr 2.0.6 (Custom Build) | MIT & BSD */
2
+ ;window.Modernizr=function(a,b,c){function D(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1),d=(a+" "+o.join(c+" ")+c).split(" ");return C(d,b)}function C(a,b){for(var d in a)if(k[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function B(a,b){return!!~(""+a).indexOf(b)}function A(a,b){return typeof a===b}function z(a,b){return y(n.join(a+";")+(b||""))}function y(a){k.cssText=a}var d="2.0.6",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l,m=Object.prototype.toString,n=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),o="Webkit Moz O ms Khtml".split(" "),p={},q={},r={},s=[],t=function(a,c,d,e){var f,h,j,k=b.createElement("div");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:i+(d+1),k.appendChild(j);f=["&shy;","<style>",a,"</style>"].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},u=function(b){if(a.matchMedia)return matchMedia(b).matches;var c;t("@media "+b+" { #"+i+" { position: absolute; } }",function(b){c=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle).position=="absolute"});return c},v,w={}.hasOwnProperty,x;!A(w,c)&&!A(w.call,c)?x=function(a,b){return w.call(a,b)}:x=function(a,b){return b in a&&A(a.constructor.prototype[b],c)},p.rgba=function(){y("background-color:rgba(150,255,150,.5)");return B(k.backgroundColor,"rgba")},p.boxshadow=function(){return D("boxShadow")},p.csstransitions=function(){return D("transitionProperty")};for(var E in p)x(p,E)&&(v=E.toLowerCase(),e[v]=p[E](),s.push((e[v]?"":"no-")+v));e.addTest=function(a,b){if(typeof a=="object")for(var d in a)x(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return;b=typeof b=="boolean"?b:!!b(),g.className+=" "+(b?"":"no-")+a,e[a]=b}return e},y(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b<g)a.createElement(f[b])}a.iepp=a.iepp||{};var d=a.iepp,e=d.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",f=e.split("|"),g=f.length,h=new RegExp("(^|\\s)("+e+")","gi"),i=new RegExp("<(/*)("+e+")","gi"),j=/^\s*[\{\}]\s*$/,k=new RegExp("(^|[^\\n]*?\\s)("+e+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),l=b.createDocumentFragment(),m=b.documentElement,n=m.firstChild,o=b.createElement("body"),p=b.createElement("style"),q=/print|all/,r;d.getCSS=function(a,b){if(a+""===c)return"";var e=-1,f=a.length,g,h=[];while(++e<f){g=a[e];if(g.disabled)continue;b=g.media||b,q.test(b)&&h.push(d.getCSS(g.imports,b),g.cssText),b="all"}return h.join("")},d.parseCSS=function(a){var b=[],c;while((c=k.exec(a))!=null)b.push(((j.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(h,"$1.iepp_$2")+c[4]);return b.join("\n")},d.writeHTML=function(){var a=-1;r=r||b.body;while(++a<g){var c=b.getElementsByTagName(f[a]),d=c.length,e=-1;while(++e<d)c[e].className.indexOf("iepp_")<0&&(c[e].className+=" iepp_"+f[a])}l.appendChild(r),m.appendChild(o),o.className=r.className,o.id=r.id,o.innerHTML=r.innerHTML.replace(i,"<$1font")},d._beforePrint=function(){p.styleSheet.cssText=d.parseCSS(d.getCSS(b.styleSheets,"all")),d.writeHTML()},d.restoreHTML=function(){o.innerHTML="",m.removeChild(o),m.appendChild(r)},d._afterPrint=function(){d.restoreHTML(),p.styleSheet.cssText=""},s(b),s(l);d.disablePP||(n.insertBefore(p,n.firstChild),p.media="print",p.className="iepp-printshim",a.attachEvent("onbeforeprint",d._beforePrint),a.attachEvent("onafterprint",d._afterPrint))}(a,b),e._version=d,e._prefixes=n,e._domPrefixes=o,e.mq=u,e.testProp=function(a){return C([a])},e.testAllProps=D,e.testStyles=t,g.className=g.className.replace(/\bno-js\b/,"")+(f?" js "+s.join(" "):"");return e}(this,this.document),function(a,b){function u(){r(!0)}a.respond={},respond.update=function(){},respond.mediaQueriesSupported=b;if(!b){var c=a.document,d=c.documentElement,e=[],f=[],g=[],h={},i=30,j=c.getElementsByTagName("head")[0]||d,k=j.getElementsByTagName("link"),l=[],m=function(){var b=k,c=b.length,d=0,e,f,g,i;for(;d<c;d++)e=b[d],f=e.href,g=e.media,i=e.rel&&e.rel.toLowerCase()==="stylesheet",!!f&&i&&!h[f]&&(!/^([a-zA-Z]+?:(\/\/)?(www\.)?)/.test(f)||f.replace(RegExp.$1,"").split("/")[0]===a.location.host?l.push({href:f,media:g}):h[f]=!0);n()},n=function(){if(l.length){var a=l.shift();s(a.href,function(b){o(b,a.href,a.media),h[a.href]=!0,n()})}},o=function(a,b,c){var d=a.match(/@media[^\{]+\{([^\{\}]+\{[^\}\{]+\})+/gi),g=d&&d.length||0,b=b.substring(0,b.lastIndexOf("/")),h=function(a){return a.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+b+"$2$3")},i=!g&&c,j=0,k,l,m,n,o;b.length&&(b+="/"),i&&(g=1);for(;j<g;j++){k=0,i?(l=c,f.push(h(a))):(l=d[j].match(/@media ([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1,f.push(RegExp.$2&&h(RegExp.$2))),n=l.split(","),o=n.length;for(;k<o;k++)m=n[k],e.push({media:m.match(/(only\s+)?([a-zA-Z]+)(\sand)?/)&&RegExp.$2,rules:f.length-1,minw:m.match(/\(min\-width:[\s]*([\s]*[0-9]+)px[\s]*\)/)&&parseFloat(RegExp.$1),maxw:m.match(/\(max\-width:[\s]*([\s]*[0-9]+)px[\s]*\)/)&&parseFloat(RegExp.$1)})}r()},p,q,r=function(a){var b="clientWidth",h=d[b],l=c.compatMode==="CSS1Compat"&&h||c.body[b]||h,m={},n=c.createDocumentFragment(),o=k[k.length-1],s=(new Date).getTime();if(a&&p&&s-p<i)clearTimeout(q),q=setTimeout(r,i);else{p=s;for(var t in e){var u=e[t];if(!u.minw&&!u.maxw||(!u.minw||u.minw&&l>=u.minw)&&(!u.maxw||u.maxw&&l<=u.maxw))m[u.media]||(m[u.media]=[]),m[u.media].push(f[u.rules])}for(var t in g)g[t]&&g[t].parentNode===j&&j.removeChild(g[t]);for(var t in m){var v=c.createElement("style"),w=m[t].join("\n");v.type="text/css",v.media=t,v.styleSheet?v.styleSheet.cssText=w:v.appendChild(c.createTextNode(w)),n.appendChild(v),g.push(v)}j.insertBefore(n,o.nextSibling)}},s=function(a,b){var c=t();if(!!c){c.open("GET",a,!0),c.onreadystatechange=function(){c.readyState==4&&(c.status==200||c.status==304)&&b(c.responseText)};if(c.readyState==4)return;c.send()}},t=function(){var a=!1,b=[function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new XMLHttpRequest}],c=b.length;while(c--){try{a=b[c]()}catch(d){continue}break}return function(){return a}}();m(),respond.update=m,a.addEventListener?a.addEventListener("resize",u,!1):a.attachEvent&&a.attachEvent("onresize",u)}}(this,Modernizr.mq("only all")),function(a,b,c){function k(a){return!a||a=="loaded"||a=="complete"}function j(){var a=1,b=-1;while(p.length- ++b)if(p[b].s&&!(a=p[b].r))break;a&&g()}function i(a){var c=b.createElement("script"),d;c.src=a.s,c.onreadystatechange=c.onload=function(){!d&&k(c.readyState)&&(d=1,j(),c.onload=c.onreadystatechange=null)},m(function(){d||(d=1,j())},H.errorTimeout),a.e?c.onload():n.parentNode.insertBefore(c,n)}function h(a){var c=b.createElement("link"),d;c.href=a.s,c.rel="stylesheet",c.type="text/css";if(!a.e&&(w||r)){var e=function(a){m(function(){if(!d)try{a.sheet.cssRules.length?(d=1,j()):e(a)}catch(b){b.code==1e3||b.message=="security"||b.message=="denied"?(d=1,m(function(){j()},0)):e(a)}},0)};e(c)}else c.onload=function(){d||(d=1,m(function(){j()},0))},a.e&&c.onload();m(function(){d||(d=1,j())},H.errorTimeout),!a.e&&n.parentNode.insertBefore(c,n)}function g(){var a=p.shift();q=1,a?a.t?m(function(){a.t=="c"?h(a):i(a)},0):(a(),j()):q=0}function f(a,c,d,e,f,h){function i(){!o&&k(l.readyState)&&(r.r=o=1,!q&&j(),l.onload=l.onreadystatechange=null,m(function(){u.removeChild(l)},0))}var l=b.createElement(a),o=0,r={t:d,s:c,e:h};l.src=l.data=c,!s&&(l.style.display="none"),l.width=l.height="0",a!="object"&&(l.type=d),l.onload=l.onreadystatechange=i,a=="img"?l.onerror=i:a=="script"&&(l.onerror=function(){r.e=r.r=1,g()}),p.splice(e,0,r),u.insertBefore(l,s?null:n),m(function(){o||(u.removeChild(l),r.r=r.e=o=1,j())},H.errorTimeout)}function e(a,b,c){var d=b=="c"?z:y;q=0,b=b||"j",C(a)?f(d,a,b,this.i++,l,c):(p.splice(this.i++,0,a),p.length==1&&g());return this}function d(){var a=H;a.loader={load:e,i:0};return a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=r&&!s,u=s?l:n.parentNode,v=a.opera&&o.call(a.opera)=="[object Opera]",w="webkitAppearance"in l.style,x=w&&"async"in b.createElement("script"),y=r?"object":v||x?"img":"script",z=w?"img":y,A=Array.isArray||function(a){return o.call(a)=="[object Array]"},B=function(a){return Object(a)===a},C=function(a){return typeof a=="string"},D=function(a){return o.call(a)=="[object Function]"},E=[],F={},G,H;H=function(a){function f(a){var b=a.split("!"),c=E.length,d=b.pop(),e=b.length,f={url:d,origUrl:d,prefixes:b},g,h;for(h=0;h<e;h++)g=F[b[h]],g&&(f=g(f));for(h=0;h<c;h++)f=E[h](f);return f}function e(a,b,e,g,h){var i=f(a),j=i.autoCallback;if(!i.bypass){b&&(b=D(b)?b:b[a]||b[g]||b[a.split("/").pop().split("?")[0]]);if(i.instead)return i.instead(a,b,e,g,h);e.load(i.url,i.forceCSS||!i.forceJS&&/css$/.test(i.url)?"c":c,i.noexec),(D(b)||D(j))&&e.load(function(){d(),b&&b(i.origUrl,h,g),j&&j(i.origUrl,h,g)})}}function b(a,b){function c(a){if(C(a))e(a,h,b,0,d);else if(B(a))for(i in a)a.hasOwnProperty(i)&&e(a[i],h,b,i,d)}var d=!!a.test,f=d?a.yep:a.nope,g=a.load||a.both,h=a.callback,i;c(f),c(g),a.complete&&b.load(a.complete)}var g,h,i=this.yepnope.loader;if(C(a))e(a,0,i,0);else if(A(a))for(g=0;g<a.length;g++)h=a[g],C(h)?e(h,0,i,0):A(h)?H(h):B(h)&&b(h,i);else B(a)&&b(a,i)},H.addPrefix=function(a,b){F[a]=b},H.addFilter=function(a){E.push(a)},H.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",G=function(){b.removeEventListener("DOMContentLoaded",G,0),b.readyState="complete"},0)),a.yepnope=d()}(this,this.document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};