Ma2_Slideshow_Free - Version 1.0.0

Version Notes

Version number: 1.0.0
Stability: Stable
Compatibility: 1.7, 1.8

Download this release

Release Info

Developer Magenmarket.com
Extension Ma2_Slideshow_Free
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (42) hide show
  1. app/code/community/Ma2/Slideshow/Block/Adminhtml/Slideshow.php +33 -0
  2. app/code/community/Ma2/Slideshow/Block/Adminhtml/Slideshow/Edit.php +65 -0
  3. app/code/community/Ma2/Slideshow/Block/Adminhtml/Slideshow/Edit/Form.php +40 -0
  4. app/code/community/Ma2/Slideshow/Block/Adminhtml/Slideshow/Edit/Tab/Form.php +116 -0
  5. app/code/community/Ma2/Slideshow/Block/Adminhtml/Slideshow/Edit/Tabs.php +46 -0
  6. app/code/community/Ma2/Slideshow/Block/Adminhtml/Slideshow/Grid.php +189 -0
  7. app/code/community/Ma2/Slideshow/Block/Slideshow.php +39 -0
  8. app/code/community/Ma2/Slideshow/Helper/Data.php +38 -0
  9. app/code/community/Ma2/Slideshow/Model/Mysql4/Slideshow.php +30 -0
  10. app/code/community/Ma2/Slideshow/Model/Mysql4/Slideshow/Collection.php +35 -0
  11. app/code/community/Ma2/Slideshow/Model/Slideshow.php +45 -0
  12. app/code/community/Ma2/Slideshow/Model/Slideshowselect.php +40 -0
  13. app/code/community/Ma2/Slideshow/Model/Status.php +35 -0
  14. app/code/community/Ma2/Slideshow/Model/Transitiontype.php +32 -0
  15. app/code/community/Ma2/Slideshow/controllers/Adminhtml/SlideshowController.php +301 -0
  16. app/code/community/Ma2/Slideshow/controllers/IndexController.php +30 -0
  17. app/code/community/Ma2/Slideshow/etc/config.xml +188 -0
  18. app/code/community/Ma2/Slideshow/etc/system.xml +143 -0
  19. app/code/community/Ma2/Slideshow/etc/widget.xml +28 -0
  20. app/code/community/Ma2/Slideshow/sql/slideshow_setup/mysql4-install-0.1.0.php +47 -0
  21. app/code/local/Ma2/All/Helper/Data.php +4 -0
  22. app/code/local/Ma2/All/etc/adminhtml.xml +43 -0
  23. app/code/local/Ma2/All/etc/config.xml +56 -0
  24. app/code/local/Ma2/All/etc/system.xml +9 -0
  25. app/design/adminhtml/default/default/layout/ma2_all.xml +7 -0
  26. app/design/adminhtml/default/default/layout/ma2_slideshow.xml +8 -0
  27. app/design/frontend/default/default/layout/ma2_all.xml +9 -0
  28. app/design/frontend/default/default/layout/ma2_slideshow.xml +11 -0
  29. app/design/frontend/default/default/template/ma2_slideshow/slideshow.phtml +67 -0
  30. app/etc/modules/Ma2_All.xml +9 -0
  31. app/etc/modules/Ma2_Slideshow.xml +9 -0
  32. js/ma2_all/ma2all.css +30 -0
  33. js/ma2_all/ma2all.js +41 -0
  34. package.xml +20 -0
  35. skin/frontend/default/default/css/ma2slideshow/images/desc-bg.png +0 -0
  36. skin/frontend/default/default/css/ma2slideshow/images/next-prev.png +0 -0
  37. skin/frontend/default/default/css/ma2slideshow/images/pix.gif +0 -0
  38. skin/frontend/default/default/css/ma2slideshow/images/proto_controls_bg.png +0 -0
  39. skin/frontend/default/default/css/ma2slideshow/images/proto_controls_pause_play_bg.png +0 -0
  40. skin/frontend/default/default/css/ma2slideshow/protoshow.css +305 -0
  41. skin/frontend/default/default/css/ma2slideshow/styles.css +84 -0
  42. skin/frontend/default/default/js/ma2slideshow/protoshow.js +709 -0
app/code/community/Ma2/Slideshow/Block/Adminhtml/Slideshow.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Slideshow.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_Block_Adminhtml_Slideshow extends Mage_Adminhtml_Block_Widget_Grid_Container
24
+ {
25
+ public function __construct()
26
+ {
27
+ $this->_controller = 'adminhtml_slideshow';
28
+ $this->_blockGroup = 'slideshow';
29
+ $this->_headerText = Mage::helper('slideshow')->__('Slideshow Items Manager');
30
+ $this->_addButtonLabel = Mage::helper('slideshow')->__('Add Item');
31
+ parent::__construct();
32
+ }
33
+ }
app/code/community/Ma2/Slideshow/Block/Adminhtml/Slideshow/Edit.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Edit.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_Block_Adminhtml_Slideshow_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
24
+ {
25
+ public function __construct()
26
+ {
27
+ parent::__construct();
28
+
29
+ $this->_objectId = 'id';
30
+ $this->_blockGroup = 'slideshow';
31
+ $this->_controller = 'adminhtml_slideshow';
32
+
33
+ $this->_updateButton('save', 'label', Mage::helper('slideshow')->__('Save Item'));
34
+ $this->_updateButton('delete', 'label', Mage::helper('slideshow')->__('Delete Item'));
35
+
36
+ $this->_addButton('saveandcontinue', array(
37
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
38
+ 'onclick' => 'saveAndContinueEdit()',
39
+ 'class' => 'save',
40
+ ), -100);
41
+
42
+ $this->_formScripts[] = "
43
+ function toggleEditor() {
44
+ if (tinyMCE.getInstanceById('slideshow_content') == null) {
45
+ tinyMCE.execCommand('mceAddControl', false, 'slideshow_content');
46
+ } else {
47
+ tinyMCE.execCommand('mceRemoveControl', false, 'slideshow_content');
48
+ }
49
+ }
50
+
51
+ function saveAndContinueEdit(){
52
+ editForm.submit($('edit_form').action+'back/edit/');
53
+ }
54
+ ";
55
+ }
56
+
57
+ public function getHeaderText()
58
+ {
59
+ if( Mage::registry('slideshow_data') && Mage::registry('slideshow_data')->getId() ) {
60
+ return Mage::helper('slideshow')->__("Edit Slideshow Item '%s'", $this->htmlEscape(Mage::registry('slideshow_data')->getTitle()));
61
+ } else {
62
+ return Mage::helper('slideshow')->__('Add Slideshow Item');
63
+ }
64
+ }
65
+ }
app/code/community/Ma2/Slideshow/Block/Adminhtml/Slideshow/Edit/Form.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Form.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_Block_Adminhtml_Slideshow_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
24
+ {
25
+ protected function _prepareForm()
26
+ {
27
+ $form = new Varien_Data_Form(
28
+ array(
29
+ 'id' => 'edit_form',
30
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
31
+ 'method' => 'post',
32
+ 'enctype' => 'multipart/form-data'
33
+ )
34
+ );
35
+
36
+ $form->setUseContainer(true);
37
+ $this->setForm($form);
38
+ return parent::_prepareForm();
39
+ }
40
+ }
app/code/community/Ma2/Slideshow/Block/Adminhtml/Slideshow/Edit/Tab/Form.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Form.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_Block_Adminhtml_Slideshow_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
24
+ {
25
+ protected function _prepareLayout()
26
+ {
27
+ parent::_prepareLayout();
28
+ if(Mage::getSingleton('cms/wysiwyg_config')->isEnabled())
29
+ {
30
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
31
+ }
32
+ }
33
+
34
+ protected function _prepareForm()
35
+ {
36
+ $form = new Varien_Data_Form();
37
+ $form->setHtmlIdPrefix('slideshow_');
38
+ $this->setForm($form);
39
+ $fieldset = $form->addFieldset('slideshow_form', array('legend'=>Mage::helper('slideshow')->__('Item information')));
40
+
41
+ $slideshow = Mage::getModel('slideshow/slideshow')->load( $this->getRequest()->getParam('id') );
42
+ $after_html = '';
43
+ if( $slideshow->getFilename() )
44
+ {
45
+ $path = Mage::getBaseUrl('media')."ma2slideshow/".$slideshow->getFilename();
46
+ $after_html = '<a onclick="imagePreview(ma2slideshow); return false;" href="'.$path.'">
47
+ <img height="22" width="22" class="small-image-preview v-middle" alt="'.$slideshow->getFilename().'" title="'.$slideshow->getFilename().'" id="ma2slideshow" src="'.$path.'"/>
48
+ </a>';
49
+ }
50
+
51
+ try {
52
+ $config = Mage::getSingleton('cms/wysiwyg_config')->getConfig();
53
+ $config->setData(
54
+ Mage::helper('slideshow')->recursiveReplace('/slideshow/', '/' . (string) Mage::app()->getConfig()->getNode('admin/routers/adminhtml/args/frontName') . '/', $config->getData())
55
+ );
56
+ } catch (Exception $ex) {
57
+ $config = null;
58
+ }
59
+
60
+ $fieldset->addField('title', 'text', array(
61
+ 'label' => Mage::helper('slideshow')->__('Title'),
62
+ 'class' => 'required-entry',
63
+ 'required' => true,
64
+ 'name' => 'title',
65
+ ));
66
+
67
+ $fieldset->addField('slideshow_url', 'text', array(
68
+ 'label' => Mage::helper('slideshow')->__('Click URL'),
69
+ 'name' => 'slideshow_url',
70
+ 'note' => Mage::helper('slideshow')->__('Example: http://www.example.com'),
71
+ ));
72
+
73
+ $fieldset->addField('filename', 'file', array(
74
+ 'label' => Mage::helper('slideshow')->__('Upload image'),
75
+ 'name' => 'filename',
76
+ 'after_element_html' => $after_html,
77
+ 'class' => (($slideshow->getfilename()) ? '' : 'required-entry'),
78
+ 'required' => (($slideshow->getfilename()) ? false : true),
79
+ ));
80
+
81
+ $fieldset->addField('status', 'select', array(
82
+ 'label' => Mage::helper('slideshow')->__('Status'),
83
+ 'name' => 'status',
84
+ 'values' => array(
85
+ 1 => Mage::helper('slideshow')->__('Enabled'),
86
+ 2 => Mage::helper('slideshow')->__('Disabled')
87
+ )
88
+ ));
89
+
90
+ $fieldset->addField('sortorder', 'text', array(
91
+ 'label' => Mage::helper('slideshow')->__('Sort Order'),
92
+ 'class' => 'required-entry validate-digits',
93
+ 'required' => true,
94
+ 'name' => 'sortorder',
95
+ ));
96
+
97
+ $fieldset->addField('content', 'editor', array(
98
+ 'name' => 'content',
99
+ 'label' => Mage::helper('slideshow')->__('Description'),
100
+ 'title' => Mage::helper('slideshow')->__('The slide description'),
101
+ 'style' => 'width:666px; height:255px;',
102
+ 'wysiwyg' => true,
103
+ 'config' => $config,
104
+ 'required' => true,
105
+ ));
106
+
107
+ if ( Mage::getSingleton('adminhtml/session')->getSlideshowData() )
108
+ {
109
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getSlideshowData());
110
+ Mage::getSingleton('adminhtml/session')->setSlideshowData(null);
111
+ } elseif ( Mage::registry('slideshow_data') ) {
112
+ $form->setValues(Mage::registry('slideshow_data')->getData());
113
+ }
114
+ return parent::_prepareForm();
115
+ }
116
+ }
app/code/community/Ma2/Slideshow/Block/Adminhtml/Slideshow/Edit/Tabs.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Tabs.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_Block_Adminhtml_Slideshow_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
24
+ {
25
+
26
+ public function __construct()
27
+ {
28
+ parent::__construct();
29
+ $this->setId('slideshow_tabs');
30
+ $this->setDestElementId('edit_form');
31
+ $this->setTitle(Mage::helper('slideshow')->__('Item Information'));
32
+ }
33
+
34
+ protected function _prepareLayout()
35
+ {
36
+
37
+ $this->addTab('main_section', array(
38
+ 'label' => Mage::helper('slideshow')->__('Item Information'),
39
+ 'title' => Mage::helper('slideshow')->__('Item Information'),
40
+ 'content' => $this->getLayout()->createBlock('slideshow/adminhtml_slideshow_edit_tab_form')->toHtml(),
41
+ 'active' => true,
42
+ ));
43
+
44
+ return parent::_prepareLayout();
45
+ }
46
+ }
app/code/community/Ma2/Slideshow/Block/Adminhtml/Slideshow/Grid.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Grid.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_Block_Adminhtml_Slideshow_Grid extends Mage_Adminhtml_Block_Widget_Grid
24
+ {
25
+ public function __construct()
26
+ {
27
+ parent::__construct();
28
+ $this->setId('slideshowGrid');
29
+ // This is the primary key of the database
30
+ $this->setDefaultSort('slideshow_id');
31
+ $this->setDefaultDir('ASC');
32
+ $this->setSaveParametersInSession(true);
33
+ }
34
+
35
+ protected function _prepareCollection()
36
+ {
37
+ $collection = Mage::getModel('slideshow/slideshow')->getCollection();
38
+ $this->setCollection($collection);
39
+ return parent::_prepareCollection();
40
+ }
41
+
42
+ protected function _prepareColumns()
43
+ {
44
+ $this->addColumn('slideshow_id', array(
45
+ 'header' => Mage::helper('slideshow')->__('ID'),
46
+ 'align' =>'center',
47
+ 'width' => '50px',
48
+ 'index' => 'slideshow_id',
49
+ 'type' => ''
50
+ ));
51
+
52
+ $this->addColumn('title', array(
53
+ 'header' => Mage::helper('slideshow')->__('Title'),
54
+ 'align' =>'left',
55
+ 'index' => 'title',
56
+ ));
57
+
58
+ $this->addColumn('category', array(
59
+ 'header' => Mage::helper('slideshow')->__('Category'),
60
+ 'align' =>'left',
61
+ 'index' => 'category',
62
+ ));
63
+
64
+ $this->addColumn('content', array(
65
+ 'header' => Mage::helper('slideshow')->__('Item Content'),
66
+ 'width' => '355px',
67
+ 'index' => 'content',
68
+ ));
69
+
70
+ $this->addColumn('created_time', array(
71
+ 'header' => Mage::helper('slideshow')->__('Creation Time'),
72
+ 'align' => 'left',
73
+ 'width' => '120px',
74
+ 'type' => 'date',
75
+ 'default' => '--',
76
+ 'index' => 'created_time',
77
+ ));
78
+
79
+ $this->addColumn('update_time', array(
80
+ 'header' => Mage::helper('slideshow')->__('Update Time'),
81
+ 'align' => 'left',
82
+ 'width' => '120px',
83
+ 'type' => 'date',
84
+ 'default' => '--',
85
+ 'index' => 'update_time',
86
+ ));
87
+
88
+ $this->addColumn('status', array(
89
+ 'header' => Mage::helper('slideshow')->__('Status'),
90
+ 'align' => 'left',
91
+ 'width' => '80px',
92
+ 'index' => 'status',
93
+ 'type' => 'options',
94
+ 'options' => array(
95
+ 1 => 'Enabled',
96
+ 2 => 'Disabled',
97
+ ),
98
+ ));
99
+
100
+ $this->addColumn('action',
101
+ array(
102
+ 'header' => Mage::helper('slideshow')->__('Action'),
103
+ 'width' => '100',
104
+ 'type' => 'action',
105
+ 'getter' => 'getId',
106
+ 'actions' => array(
107
+ array(
108
+ 'caption' => Mage::helper('slideshow')->__('Edit'),
109
+ 'url' => array('base'=> '*/*/edit'),
110
+ 'field' => 'id'
111
+ )
112
+ ),
113
+ 'filter' => false,
114
+ 'sortable' => false,
115
+ 'index' => 'stores',
116
+ 'is_system' => true,
117
+ ));
118
+
119
+ $this->addExportType('*/*/exportCsv', Mage::helper('slideshow')->__('CSV'));
120
+ $this->addExportType('*/*/exportXml', Mage::helper('slideshow')->__('XML'));
121
+
122
+ return parent::_prepareColumns();
123
+ }
124
+
125
+ protected function _prepareMassaction()
126
+ {
127
+ $this->setMassactionIdField('slideshow_id');
128
+ $this->getMassactionBlock()->setFormFieldName('slideshow');
129
+
130
+ $this->getMassactionBlock()->addItem('delete', array(
131
+ 'label' => Mage::helper('slideshow')->__('Delete'),
132
+ 'url' => $this->getUrl('*/*/massDelete'),
133
+ 'confirm' => Mage::helper('slideshow')->__('Are you sure?')
134
+ ));
135
+
136
+ $statuses = Mage::getSingleton('slideshow/status')->getOptionArray();
137
+
138
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
139
+ $this->getMassactionBlock()->addItem('status', array(
140
+ 'label'=> Mage::helper('slideshow')->__('Change status'),
141
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
142
+ 'additional' => array(
143
+ 'visibility' => array(
144
+ 'name' => 'status',
145
+ 'type' => 'select',
146
+ 'class' => 'required-entry',
147
+ 'label' => Mage::helper('slideshow')->__('Status'),
148
+ 'values' => $statuses
149
+ )
150
+ )
151
+ ));
152
+ return $this;
153
+ }
154
+
155
+ public function getRowUrl($row)
156
+ {
157
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
158
+ }
159
+
160
+ public function getGridUrl()
161
+ {
162
+ return $this->getUrl('*/*/grid', array('_current'=>true));
163
+ }
164
+
165
+ /**
166
+ * Helper function to do after load modifications
167
+ *
168
+ */
169
+ protected function _afterLoadCollection()
170
+ {
171
+ $this->getCollection()->walk('afterLoad');
172
+ parent::_afterLoadCollection();
173
+ }
174
+
175
+ /**
176
+ * Helper function to add store filter condition
177
+ *
178
+ * @param Mage_Core_Model_Mysql4_Collection_Abstract $collection Data collection
179
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column Column information to be filtered
180
+ */
181
+ protected function _filterStoreCondition($collection, $column)
182
+ {
183
+ if (!$value = $column->getFilter()->getValue()) {
184
+ return;
185
+ }
186
+
187
+ $this->getCollection()->addStoreFilter($value);
188
+ }
189
+ }
app/code/community/Ma2/Slideshow/Block/Slideshow.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Slideshow.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_Block_Slideshow extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
24
+ {
25
+ protected function _toHtml()
26
+ {
27
+ $slideshow_ids = $this->getData('slideshow_ids');
28
+
29
+ $collection = Mage::getModel('slideshow/slideshow')
30
+ ->getCollection()
31
+ ->addFieldToFilter('slideshow_id', array('in' => explode(',', $slideshow_ids)));
32
+
33
+ $this->assign('items', $collection);
34
+ $this->assign('options', json_decode(json_encode(Mage::getStoreConfig('slideshow_options/general'))));
35
+
36
+
37
+ return parent::_toHtml();
38
+ }
39
+ }
app/code/community/Ma2/Slideshow/Helper/Data.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Data.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_Helper_Data extends Mage_Core_Helper_Abstract
24
+ {
25
+ public function recursiveReplace($search, $replace, $subject)
26
+ {
27
+ if (!is_array($subject))
28
+ return $subject;
29
+
30
+ foreach ($subject as $key => $value)
31
+ if (is_string($value))
32
+ $subject[$key] = str_replace($search, $replace, $value);
33
+ elseif (is_array($value))
34
+ $subject[$key] = self::recursiveReplace($search, $replace, $value);
35
+
36
+ return $subject;
37
+ }
38
+ }
app/code/community/Ma2/Slideshow/Model/Mysql4/Slideshow.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Slideshow.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_Model_Mysql4_Slideshow extends Mage_Core_Model_Mysql4_Abstract
24
+ {
25
+ public function _construct()
26
+ {
27
+ // Note that the slideshow_id refers to the key field in your database table.
28
+ $this->_init('slideshow/slideshow', 'slideshow_id');
29
+ }
30
+ }
app/code/community/Ma2/Slideshow/Model/Mysql4/Slideshow/Collection.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Collection.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_Model_Mysql4_Slideshow_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
24
+ {
25
+ public function _construct()
26
+ {
27
+ parent::_construct();
28
+ $this->_init('slideshow/slideshow');
29
+ }
30
+
31
+ public function orderBySort(){
32
+ $this->getSelect()->order('sortorder');
33
+ return $this;
34
+ }
35
+ }
app/code/community/Ma2/Slideshow/Model/Slideshow.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Slideshow.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_Model_Slideshow extends Mage_Core_Model_Abstract
24
+ {
25
+ public function _construct()
26
+ {
27
+ parent::_construct();
28
+ $this->_init('slideshow/slideshow');
29
+ }
30
+
31
+ public function getCollectionSlideshowData() {
32
+
33
+ $collection = $this->getCollection()
34
+ ->addFieldToFilter('status',1)
35
+ ->orderBySort()
36
+ /* ->addStoreFilter(Mage::app()->getStore()) */
37
+ ;
38
+ if(Mage::getStoreConfig('slideshow_options/general/limited'))
39
+ {
40
+ $collection->setPageSize(Mage::getStoreConfig('slideshow_options/general/limited'));
41
+ }
42
+
43
+ return $collection;
44
+ }
45
+ }
app/code/community/Ma2/Slideshow/Model/Slideshowselect.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Slideshowselect.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_Model_Slideshowselect
24
+ {
25
+ public function toOptionArray()
26
+ {
27
+ $options = array();
28
+ $collection = Mage::getModel('slideshow/slideshow')
29
+ ->getCollection()
30
+ ->addFieldToSelect('slideshow_id')
31
+ ->addFieldToSelect('title')
32
+ ->addFieldToFilter('status',1);
33
+
34
+ foreach ($collection as $item){
35
+ $options[] = array('value' => $item->getData('slideshow_id'), 'label' => $item->getData('title'));
36
+ }
37
+ return $options;
38
+ }
39
+ }
40
+
app/code/community/Ma2/Slideshow/Model/Status.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Status.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_Model_Status extends Varien_Object
24
+ {
25
+ const STATUS_ENABLED = 1;
26
+ const STATUS_DISABLED = 2;
27
+
28
+ static public function getOptionArray()
29
+ {
30
+ return array(
31
+ self::STATUS_ENABLED => Mage::helper('slideshow')->__('Enabled'),
32
+ self::STATUS_DISABLED => Mage::helper('slideshow')->__('Disabled')
33
+ );
34
+ }
35
+ }
app/code/community/Ma2/Slideshow/Model/Transitiontype.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Transitiontype.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_Model_Transitiontype
24
+ {
25
+ public function toOptionArray()
26
+ {
27
+ return array(
28
+ array('value' => 'fade', 'label' => Mage::helper('slideshow')->__('Fade')),
29
+ array('value' => 'slide', 'label' => Mage::helper('slideshow')->__('Slide'))
30
+ );
31
+ }
32
+ }
app/code/community/Ma2/Slideshow/controllers/Adminhtml/SlideshowController.php ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: SlideshowController.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_Adminhtml_SlideshowController extends Mage_Adminhtml_Controller_action
24
+ {
25
+
26
+ protected function _initAction() {
27
+ $this->loadLayout()
28
+ ->_setActiveMenu('slideshow/items')
29
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Slideshow Manager'), Mage::helper('adminhtml')->__('Slideshow Manager'));
30
+
31
+ return $this;
32
+ }
33
+
34
+ public function indexAction() {
35
+ $this->_initAction();
36
+ $this->renderLayout();
37
+ }
38
+
39
+ public function editAction() {
40
+ $id = $this->getRequest()->getParam('id');
41
+ $model = Mage::getModel('slideshow/slideshow')->load($id);
42
+
43
+ if ($model->getId() || $id == 0) {
44
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
45
+ if (!empty($data)) {
46
+ $model->setData($data);
47
+ }
48
+
49
+ Mage::register('slideshow_data', $model);
50
+
51
+ $this->loadLayout();
52
+ $this->_setActiveMenu('slideshow/items');
53
+
54
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Slideshow Manager'), Mage::helper('adminhtml')->__('Slideshow Manager'));
55
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Slideshow News'), Mage::helper('adminhtml')->__('Slideshow News'));
56
+
57
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
58
+
59
+ $this->_addContent($this->getLayout()->createBlock('slideshow/adminhtml_slideshow_edit'))
60
+ ->_addLeft($this->getLayout()->createBlock('slideshow/adminhtml_slideshow_edit_tabs'));
61
+
62
+ $this->renderLayout();
63
+ } else {
64
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('slideshow')->__('Slideshow does not exist'));
65
+ $this->_redirect('*/*/');
66
+ }
67
+ }
68
+
69
+ public function newAction() {
70
+ $this->_forward('edit');
71
+ }
72
+
73
+ public function saveAction()
74
+ {
75
+ if ($data = $this->getRequest()->getPost())
76
+ {
77
+ $collection = Mage::getModel('slideshow/slideshow')->getCollection();
78
+ $collection->addFieldToFilter('title',$data['title']);
79
+ $collection->addFieldToFilter('category',$data['category']);
80
+ if($this->getRequest()->getParam('id'))
81
+ {
82
+ $collection->addFieldToFilter('slideshow_id',array('neq' => $this->getRequest()->getParam('id')));
83
+ }
84
+
85
+ if($collection->getData())
86
+ {
87
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('slideshow')->__('Slideshow with same title "%s" already exist.', $data['title']));
88
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
89
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
90
+ return;
91
+ }
92
+
93
+ if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '')
94
+ {
95
+ if( $this->getRequest()->getParam('id') > 0 )
96
+ {
97
+ $model = Mage::getModel('slideshow/slideshow')->load($this->getRequest()->getParam('id'));
98
+ if($model->getfilename() != "")
99
+ {
100
+ // path of the resized image to be saved
101
+ // remove file if it already exist
102
+ $imageUrl = Mage::getBaseDir('media').DS."ma2slideshow".DS.$model->getfilename();
103
+ $imageResized = Mage::getBaseDir('media').DS."ma2slideshow".DS."thumbnail".DS.$model->getfilename();
104
+
105
+ if(file_exists($imageUrl))
106
+ {
107
+ unlink($imageUrl);
108
+ unlink($imageResized);
109
+ }
110
+ }
111
+ }
112
+ try
113
+ {
114
+ $date = date('Ymdhis');
115
+ /* Starting upload */
116
+ $uploader = new Varien_File_Uploader('filename');
117
+
118
+ // Any extention would work
119
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
120
+ $uploader->setAllowRenameFiles(false);
121
+
122
+ // Set the file upload mode
123
+ // false -> get the file directly in the specified folder
124
+ // true -> get the file in the product like folders (file.jpg will go in something like /media/f/i/file.jpg)
125
+ $uploader->setFilesDispersion(false);
126
+
127
+ $filedet = pathinfo($_FILES['filename']['name']);
128
+
129
+ // We set media as the upload dir
130
+ $path = Mage::getBaseDir('media').DS.'ma2slideshow'.DS;
131
+ $uploader->save($path, $filedet['filename'].$date.'.'.$filedet['extension'] );
132
+
133
+ // actual path of image
134
+ $imageUrl = Mage::getBaseDir('media').DS."ma2slideshow".DS.$filedet['filename'].$date.'.'.$filedet['extension'];
135
+
136
+ // path of the resized image to be saved
137
+ // here, the resized image is saved in media/resized folder
138
+ $imageResized = Mage::getBaseDir('media').DS."ma2slideshow".DS."thumbnail".DS.$filedet['filename'].$date.'.'.$filedet['extension'];
139
+
140
+ // resize image only if the image file exists and the resized image file doesn't exist
141
+ // the image is resized proportionally with the width/height 135px
142
+ if (!file_exists($imageResized)&&file_exists($imageUrl))
143
+ {
144
+ $imageObj = new Varien_Image($imageUrl);
145
+ $imageObj->constrainOnly(TRUE);
146
+ $imageObj->keepAspectRatio(TRUE);
147
+ $imageObj->keepFrame(FALSE);
148
+ $imageObj->resize(100, 100);
149
+ $imageObj->save($imageResized);
150
+ }
151
+
152
+ }
153
+ catch (Exception $e){
154
+ }
155
+
156
+ //this way the name is saved in DB
157
+ $data['filename'] = $filedet['filename'].$date.'.'.$filedet['extension'];
158
+ }
159
+
160
+ $model = Mage::getModel('slideshow/slideshow');
161
+ $model->setData($data)->setId($this->getRequest()->getParam('id'));
162
+
163
+ try
164
+ {
165
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
166
+ $model->setCreatedTime(now())
167
+ ->setUpdateTime(now());
168
+ } else {
169
+ $model->setUpdateTime(now());
170
+ }
171
+
172
+ $model->save();
173
+
174
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('slideshow')->__('Item was successfully saved'));
175
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
176
+
177
+ if ($this->getRequest()->getParam('back')) {
178
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
179
+ return;
180
+ }
181
+ $this->_redirect('*/*/');
182
+ return;
183
+ }
184
+ catch (Exception $e)
185
+ {
186
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
187
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
188
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
189
+ return;
190
+ }
191
+ }
192
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('slideshow')->__('Unable to find item to save'));
193
+ $this->_redirect('*/*/');
194
+ }
195
+
196
+ public function deleteAction()
197
+ {
198
+ if( $this->getRequest()->getParam('id') > 0 )
199
+ {
200
+ try
201
+ {
202
+ $model = Mage::getModel('slideshow/slideshow')->load($this->getRequest()->getParam('id'));
203
+ if($model->getfilename() != "")
204
+ {
205
+ $imageUrl = Mage::getBaseDir('media').DS."ma2slideshow".DS.$model->getfilename();
206
+
207
+ // path of the resized image to be saved
208
+ // here, the resized image is saved in media/resized folder
209
+ $imageResized = Mage::getBaseDir('media').DS."ma2slideshow".DS."thumbnail".DS.$model->getfilename();
210
+
211
+ if(file_exists($imageUrl))
212
+ {
213
+ unlink($imageUrl);
214
+ unlink($imageResized);
215
+ }
216
+ }
217
+
218
+ $model->setId($this->getRequest()->getParam('id'))
219
+ ->delete();
220
+
221
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
222
+ $this->_redirect('*/*/');
223
+ }
224
+ catch (Exception $e)
225
+ {
226
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
227
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
228
+ }
229
+ }
230
+ $this->_redirect('*/*/');
231
+ }
232
+
233
+ public function massDeleteAction()
234
+ {
235
+ $slideshowIds = $this->getRequest()->getParam('slideshow');
236
+ if(!is_array($slideshowIds)) {
237
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
238
+ } else {
239
+ try {
240
+ foreach ($slideshowIds as $slideshowId) {
241
+ $slideshow = Mage::getModel('slideshow/slideshow')->load($slideshowId);
242
+ $slideshow->delete();
243
+ }
244
+ Mage::getSingleton('adminhtml/session')->addSuccess(
245
+ Mage::helper('adminhtml')->__(
246
+ 'Total of %d record(s) were successfully deleted', count($slideshowIds)
247
+ )
248
+ );
249
+ } catch (Exception $e) {
250
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
251
+ }
252
+ }
253
+ $this->_redirect('*/*/index');
254
+ }
255
+
256
+ /**
257
+ * Product grid for AJAX request.
258
+ * Sort and filter result for example.
259
+ */
260
+ public function gridAction()
261
+ {
262
+ $this->loadLayout();
263
+ $this->getResponse()->setBody(
264
+ $this->getLayout()->createBlock('slideshow/adminhtml_slideshow_grid')->toHtml()
265
+ );
266
+ }
267
+
268
+ public function exportCsvAction()
269
+ {
270
+ $fileName = 'ma2slideshow.csv';
271
+ $content = $this->getLayout()->createBlock('slideshow/adminhtml_slideshow_grid')
272
+ ->getCsv();
273
+
274
+ $this->_sendUploadResponse($fileName, $content);
275
+ }
276
+
277
+ public function exportXmlAction()
278
+ {
279
+ $fileName = 'ma2slideshow.xml';
280
+ $content = $this->getLayout()->createBlock('slideshow/adminhtml_slideshow_grid')
281
+ ->getXml();
282
+
283
+ $this->_sendUploadResponse($fileName, $content);
284
+ }
285
+
286
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
287
+ {
288
+ $response = $this->getResponse();
289
+ $response->setHeader('HTTP/1.1 200 OK','');
290
+ $response->setHeader('Pragma', 'public', true);
291
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
292
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
293
+ $response->setHeader('Last-Modified', date('r'));
294
+ $response->setHeader('Accept-Ranges', 'bytes');
295
+ $response->setHeader('Content-Length', strlen($content));
296
+ $response->setHeader('Content-type', $contentType);
297
+ $response->setBody($content);
298
+ $response->sendResponse();
299
+ die;
300
+ }
301
+ }
app/code/community/Ma2/Slideshow/controllers/IndexController.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: IndexController.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ class Ma2_Slideshow_IndexController extends Mage_Core_Controller_Front_Action
24
+ {
25
+ public function indexAction()
26
+ {
27
+ $this->loadLayout();
28
+ $this->renderLayout();
29
+ }
30
+ }
app/code/community/Ma2/Slideshow/etc/config.xml ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ma2_Slideshow>
5
+ <version>0.1.0</version>
6
+ </Ma2_Slideshow>
7
+ </modules>
8
+
9
+ <frontend>
10
+ <routers>
11
+ <slideshow>
12
+ <use>standard</use>
13
+ <args>
14
+ <module>Ma2_Slideshow</module>
15
+ <frontName>slideshow</frontName>
16
+ </args>
17
+ </slideshow>
18
+ </routers>
19
+ <layout>
20
+ <updates>
21
+ <slideshow>
22
+ <file>ma2_slideshow.xml</file>
23
+ </slideshow>
24
+ </updates>
25
+ </layout>
26
+ </frontend>
27
+
28
+ <admin>
29
+ <routers>
30
+ <slideshow>
31
+ <use>admin</use>
32
+ <args>
33
+ <module>Ma2_Slideshow</module>
34
+ <frontName>slideshow</frontName>
35
+ </args>
36
+ </slideshow>
37
+
38
+ <adminhtml>
39
+ <args>
40
+ <slideshow>
41
+ <slideshow_options before="Mage_Adminhtml">Ma2_Slideshow_Adminhtml</slideshow_options>
42
+ </slideshow>
43
+ </args>
44
+ </adminhtml>
45
+ </routers>
46
+ </admin>
47
+
48
+ <adminhtml>
49
+ <menu>
50
+ <ma2 translate="title" module="ma2all">
51
+ <title>MA2</title>
52
+ <sort_order>89</sort_order>
53
+ <children>
54
+ <slideshow_manager translate="title" module="slideshow">
55
+ <title>Ma2 Slideshow free</title>
56
+ <sort_order>2</sort_order>
57
+ <children>
58
+ <items translate="title" module="slideshow">
59
+ <title>Manage Items</title>
60
+ <sort_order>1</sort_order>
61
+ <action>slideshow/adminhtml_slideshow</action>
62
+ </items>
63
+ <config translate="title" module="slideshow">
64
+ <title>Slideshow Configuration</title>
65
+ <sort_order>2</sort_order>
66
+ <action>adminhtml/system_config/edit/section/slideshow_options</action>
67
+ </config>
68
+ </children>
69
+ </slideshow_manager>
70
+ </children>
71
+ </ma2>
72
+ </menu>
73
+
74
+ <acl>
75
+ <resources>
76
+ <all>
77
+ <title>Allow Everything</title>
78
+ </all>
79
+ <admin>
80
+ <children>
81
+ <ma2>
82
+ <title>MA2</title>
83
+ <sort_order>89</sort_order>
84
+ <children>
85
+ <slideshow_manager>
86
+ <title>Ma2 Slideshow Module free</title>
87
+ <sort_order>2</sort_order>
88
+ <children>
89
+ <items>
90
+ <title>Manage Items</title>
91
+ <sort_order>1</sort_order>
92
+ </items>
93
+ <config>
94
+ <title>Slideshow Configuration</title>
95
+ <sort_order>2</sort_order>
96
+ </config>
97
+ </children>
98
+ </slideshow_manager>
99
+ </children>
100
+ </ma2>
101
+ <system>
102
+ <children>
103
+ <config>
104
+ <children>
105
+ <slideshow_options translate="title" module="slideshow">
106
+ <title>Ma2 Slideshow free</title>
107
+ </slideshow_options>
108
+ </children>
109
+ </config>
110
+ </children>
111
+ </system>
112
+ </children>
113
+ </admin>
114
+ </resources>
115
+ </acl>
116
+
117
+ <layout>
118
+ <updates>
119
+ <slideshow>
120
+ <file>ma2_slideshow.xml</file>
121
+ </slideshow>
122
+ </updates>
123
+ </layout>
124
+ </adminhtml>
125
+
126
+ <global>
127
+ <models>
128
+ <slideshow>
129
+ <class>Ma2_Slideshow_Model</class>
130
+ <resourceModel>slideshow_mysql4</resourceModel>
131
+ </slideshow>
132
+ <slideshow_mysql4>
133
+ <class>Ma2_Slideshow_Model_Mysql4</class>
134
+ <entities>
135
+ <slideshow>
136
+ <table>ma2_slideshow</table>
137
+ </slideshow>
138
+ </entities>
139
+ </slideshow_mysql4>
140
+ </models>
141
+ <resources>
142
+ <slideshow_setup>
143
+ <setup>
144
+ <module>Ma2_Slideshow</module>
145
+ </setup>
146
+ <connection>
147
+ <use>core_setup</use>
148
+ </connection>
149
+ </slideshow_setup>
150
+ <slideshow_write>
151
+ <connection>
152
+ <use>core_write</use>
153
+ </connection>
154
+ </slideshow_write>
155
+ <slideshow_read>
156
+ <connection>
157
+ <use>core_read</use>
158
+ </connection>
159
+ </slideshow_read>
160
+ </resources>
161
+ <blocks>
162
+ <slideshow>
163
+ <class>Ma2_Slideshow_Block</class>
164
+ </slideshow>
165
+ </blocks>
166
+ <helpers>
167
+ <slideshow>
168
+ <class>Ma2_Slideshow_Helper</class>
169
+ </slideshow>
170
+ </helpers>
171
+ </global>
172
+ <default>
173
+ <slideshow_options>
174
+ <general>
175
+ <slide_height>300</slide_height>
176
+ <display_title>1</display_title>
177
+ <display_content>1</display_content>
178
+ <interval>3000</interval>
179
+ <transitionType>slide</transitionType>
180
+ <transitionTime>1.5</transitionTime>
181
+ <manTransitionTime>0.5</manTransitionTime>
182
+ <navigation>1</navigation>
183
+ <controls>1</controls>
184
+ <pauseOnHover>0</pauseOnHover>
185
+ </general>
186
+ </slideshow_options>
187
+ </default>
188
+ </config>
app/code/community/Ma2/Slideshow/etc/system.xml ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <slideshow_options translate="label" module="slideshow">
5
+ <label>Ma2 Slideshow free</label>
6
+ <class>separator-top</class>
7
+ <tab>ma2</tab>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>10001</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <groups>
14
+ <general translate="label" module="slideshow">
15
+ <label>General</label>
16
+ <frontend_type>text</frontend_type>
17
+ <sort_order>50</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>1</show_in_store>
21
+ <fields>
22
+ <slide_height translate="label" module="slideshow">
23
+ <label>Slider height (px)</label>
24
+ <frontend_type>text</frontend_type>
25
+ <validate>validate-digits validate-greater-than-zero</validate>
26
+ <sort_order>1</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ <comment>Type a number for the height (in pixel) of slider.</comment>
31
+ </slide_height>
32
+
33
+ <display_title translate="label" module="slideshow">
34
+ <label>Display title of slide?</label>
35
+ <frontend_type>radios</frontend_type>
36
+ <source_model>adminhtml/system_config_source_yesno</source_model>
37
+ <sort_order>2</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <show_in_store>1</show_in_store>
41
+ </display_title>
42
+
43
+ <display_content translate="label" module="slideshow">
44
+ <label>Display description text of slide?</label>
45
+ <frontend_type>radios</frontend_type>
46
+ <source_model>adminhtml/system_config_source_yesno</source_model>
47
+ <sort_order>3</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ </display_content>
52
+
53
+ <auto_play translate="label" module="slideshow">
54
+ <label>Auto play?</label>
55
+ <frontend_type>select</frontend_type>
56
+ <source_model>adminhtml/system_config_source_yesno</source_model>
57
+ <comment>Decides whether to start the show automatically</comment>
58
+ <sort_order>5</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </auto_play>
63
+
64
+ <interval translate="label" module="slideshow">
65
+ <label>Interval</label>
66
+ <frontend_type>text</frontend_type>
67
+ <validate>validate-digits validate-greater-than-zero</validate>
68
+ <comment>Time interval between each slide transition. Example: 2000, 3000</comment>
69
+ <sort_order>6</sort_order>
70
+ <show_in_default>1</show_in_default>
71
+ <show_in_website>1</show_in_website>
72
+ <show_in_store>1</show_in_store>
73
+ </interval>
74
+
75
+ <transitionType translate="label" module="slideshow">
76
+ <label>Transition type</label>
77
+ <frontend_type>select</frontend_type>
78
+ <source_model>slideshow/transitiontype</source_model>
79
+ <comment>Type of transition. Either a fading slideshow or a slider.</comment>
80
+ <sort_order>8</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ </transitionType>
85
+
86
+ <transitionTime translate="label" module="slideshow">
87
+ <label>Transition time</label>
88
+ <frontend_type>text</frontend_type>
89
+ <comment>Time taken to animate transition from one slide to the next.</comment>
90
+ <sort_order>9</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ </transitionTime>
95
+
96
+ <manTransitionTime translate="label" module="slideshow">
97
+ <label>Manual Transition time</label>
98
+ <frontend_type>text</frontend_type>
99
+ <comment>Time taken to animate transition from one slide to the next when the user has initiated the transition manually.</comment>
100
+ <sort_order>10</sort_order>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
+ <show_in_store>1</show_in_store>
104
+ </manTransitionTime>
105
+
106
+ <navigation translate="label" module="slideshow">
107
+ <label>Navigation?</label>
108
+ <frontend_type>select</frontend_type>
109
+ <source_model>adminhtml/system_config_source_yesno</source_model>
110
+ <comment>Whether to generate/use navigation elements (eg: 1,2,3,4...etc) for each slide for quick navigation.</comment>
111
+ <sort_order>11</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ </navigation>
116
+
117
+ <controls translate="label" module="slideshow">
118
+ <label>Controls buttons?</label>
119
+ <frontend_type>select</frontend_type>
120
+ <source_model>adminhtml/system_config_source_yesno</source_model>
121
+ <comment>Whether to generate/use control elements for forward,backward and stop/start.</comment>
122
+ <sort_order>12</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>1</show_in_store>
126
+ </controls>
127
+
128
+ <pauseOnHover translate="label" module="slideshow">
129
+ <label>Pause on hover?</label>
130
+ <frontend_type>select</frontend_type>
131
+ <source_model>adminhtml/system_config_source_yesno</source_model>
132
+ <comment>Pause the show when mouse is hovered over the show element.</comment>
133
+ <sort_order>13</sort_order>
134
+ <show_in_default>1</show_in_default>
135
+ <show_in_website>1</show_in_website>
136
+ <show_in_store>1</show_in_store>
137
+ </pauseOnHover>
138
+ </fields>
139
+ </general>
140
+ </groups>
141
+ </slideshow_options>
142
+ </sections>
143
+ </config>
app/code/community/Ma2/Slideshow/etc/widget.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <widgets>
3
+ <slideshow_widget type="slideshow/slideshow" translate="name description" module="slideshow">
4
+ <name>Ma2 Slideshow free</name>
5
+ <description>Slideshow module from MagenMarket.com. Widgets supported.</description>
6
+ <parameters>
7
+ <slideshow_ids>
8
+ <label>Select slide items</label>
9
+ <visible>1</visible>
10
+ <required>1</required>
11
+ <type>multiselect</type>
12
+ <source_model>slideshow/slideshowselect</source_model>
13
+ </slideshow_ids>
14
+ <template translate="label">
15
+ <label>Frontend template</label>
16
+ <visible>1</visible>
17
+ <required>1</required>
18
+ <type>select</type>
19
+ <values>
20
+ <default translate="label">
21
+ <value>ma2_slideshow/slideshow.phtml</value>
22
+ <label>Default template</label>
23
+ </default>
24
+ </values>
25
+ </template>
26
+ </parameters>
27
+ </slideshow_widget>
28
+ </widgets>
app/code/community/Ma2/Slideshow/sql/slideshow_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_Slideshow free
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: mysql4-install-0.1.0.php 15 2013-11-05 07:30:45Z linhnt $ */
22
+
23
+ $installer = $this;
24
+
25
+ $installer->startSetup();
26
+
27
+ $installer->run("
28
+
29
+ DROP TABLE IF EXISTS {$this->getTable('ma2_slideshow')};
30
+ CREATE TABLE {$this->getTable('ma2_slideshow')} (
31
+ `slideshow_id` int(11) unsigned NOT NULL auto_increment,
32
+ `title` varchar(255) NOT NULL default '',
33
+ `category` varchar(255) NOT NULL default '',
34
+ `slideshow_url` varchar(255) NOT NULL default '',
35
+ `filename` varchar(255) NOT NULL default '',
36
+ `sortorder` int(11) NOT NULL default '0',
37
+ `content` text NOT NULL default '',
38
+ `status` smallint(6) NOT NULL default '0',
39
+ `created_time` datetime NULL,
40
+ `update_time` datetime NULL,
41
+ `params` text NULL,
42
+ PRIMARY KEY (`slideshow_id`)
43
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
44
+
45
+ ");
46
+
47
+ $installer->endSetup();
app/code/local/Ma2/All/Helper/Data.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Ma2_All_Helper_Data extends Mage_Core_Helper_Abstract {
3
+
4
+ }
app/code/local/Ma2/All/etc/adminhtml.xml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <layout>
4
+ <updates>
5
+ <ma2all module="Ma2_All">
6
+ <file>ma2_all.xml</file>
7
+ </ma2all>
8
+ </updates>
9
+ </layout>
10
+ <menu>
11
+ <ma2 translate="title" module="ma2all">
12
+ <title>MA2</title>
13
+ <sort_order>89</sort_order>
14
+ </ma2>
15
+ </menu>
16
+
17
+ <acl>
18
+ <resources>
19
+ <all>
20
+ <title>Allow Everything</title>
21
+ </all>
22
+ <admin>
23
+ <children>
24
+ <ma2>
25
+ <title>MA2</title>
26
+ <sort_order>89</sort_order>
27
+ </ma2>
28
+ <system>
29
+ <children>
30
+ <config>
31
+ <children>
32
+ <ma2all>
33
+ <title>MagenMarket Extensions</title>
34
+ </ma2all>
35
+ </children>
36
+ </config>
37
+ </children>
38
+ </system>
39
+ </children>
40
+ </admin>
41
+ </resources>
42
+ </acl>
43
+ </config>
app/code/local/Ma2/All/etc/config.xml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ma2_All>
5
+ <version>0.1.0</version>
6
+ </Ma2_All>
7
+ </modules>
8
+
9
+ <frontend>
10
+ <layout>
11
+ <updates>
12
+ <ma2all>
13
+ <file>ma2_all.xml</file>
14
+ </ma2all>
15
+ </updates>
16
+ </layout>
17
+ </frontend>
18
+
19
+ <global>
20
+ <blocks>
21
+ <ma2all>
22
+ <class>Ma2_All_Block</class>
23
+ </ma2all>
24
+ </blocks>
25
+ <resources>
26
+ <ma2all_setup>
27
+ <setup>
28
+ <module>Ma2_All</module>
29
+ </setup>
30
+ <connection>
31
+ <use>core_setup</use>
32
+ </connection>
33
+ </ma2all_setup>
34
+ <ma2all_write>
35
+ <connection>
36
+ <use>core_write</use>
37
+ </connection>
38
+ </ma2all_write>
39
+ <ma2all_read>
40
+ <connection>
41
+ <use>core_read</use>
42
+ </connection>
43
+ </ma2all_read>
44
+ </resources>
45
+ <models>
46
+ <ma2all>
47
+ <class>Ma2_All_Model</class>
48
+ </ma2all>
49
+ </models>
50
+ <helpers>
51
+ <ma2all>
52
+ <class>Ma2_All_Helper</class>
53
+ </ma2all>
54
+ </helpers>
55
+ </global>
56
+ </config>
app/code/local/Ma2/All/etc/system.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <ma2 translate="label" module="ma2all">
5
+ <label>MagenMarket Extensions</label>
6
+ <sort_order>168</sort_order>
7
+ </ma2>
8
+ </tabs>
9
+ </config>
app/design/adminhtml/default/default/layout/ma2_all.xml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <adminhtml_system_config_edit>
6
+ </adminhtml_system_config_edit>
7
+ </layout>
app/design/adminhtml/default/default/layout/ma2_slideshow.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <slideshow_adminhtml_slideshow_index>
4
+ <reference name="content">
5
+ <block type="slideshow/adminhtml_slideshow" name="slideshow" />
6
+ </reference>
7
+ </slideshow_adminhtml_slideshow_index>
8
+ </layout>
app/design/frontend/default/default/layout/ma2_all.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addItem"><type>js_css</type><css>ma2_all/ma2all.css</css></action>
6
+ <action method="addJs"><script>ma2_all/ma2all.js</script></action>
7
+ </reference>
8
+ </default>
9
+ </layout>
app/design/frontend/default/default/layout/ma2_slideshow.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addItem"><type>skin_css</type><stylesheet>css/ma2slideshow/protoshow.css</stylesheet></action>
6
+ <action method="addItem"><type>skin_css</type><stylesheet>css/ma2slideshow/styles.css</stylesheet></action>
7
+ <action method="addJs"><script>scriptaculous/scriptaculous.js</script></action>
8
+ <action method="addItem"><type>skin_js</type><name>js/ma2slideshow/protoshow.js</name></action>
9
+ </reference>
10
+ </default>
11
+ </layout>
app/design/frontend/default/default/template/ma2_slideshow/slideshow.phtml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $uniqId = Mage::helper('core')->uniqHash('-'); ?>
2
+ <?php if(count($items)) : ?>
3
+ <div id="ma2-slideshow<?php echo $uniqId; ?>" class="ma2-slideshow protoshow" style="height: <?php echo $options->slide_height; ?>px">
4
+ <ul class="show" style="height: <?php echo $options->slide_height; ?>px">
5
+ <?php foreach ($items as $item) : ?>
6
+ <li class="slide">
7
+ <img class="img-slide" src="<?php echo Mage::getBaseUrl('media').'ma2slideshow/'.$item->getFilename(); ?>" alt="<?php echo $this->escapeHtml($item->getTitle()); ?>"/>
8
+ <?php if($options->display_title == 1 && $options->display_content == 1) : ?>
9
+ <div class="item-desc">
10
+ <?php if($options->display_title == 1) : ?>
11
+ <h1 class="title"><a href="<?php echo $item->getSlideshowUrl() ?>" title="<?php echo $this->escapeHtml($item->getTitle()); ?>" target="_blank"><?php echo $item->getTitle(); ?></a></h1>
12
+ <?php endif; ?>
13
+ <?php if($options->display_content == 1) : ?>
14
+ <div class="item-content"><?php echo $item->getContent(); ?></div>
15
+ <?php endif; ?>
16
+ </div>
17
+ <?php endif; ?>
18
+ </li>
19
+ <?php endforeach; ?>
20
+ </ul>
21
+ </div>
22
+ <?php
23
+ $auto_play = ($options->auto_play == 1) ? 'true' : 'false';
24
+ $navigation = ($options->navigation == 1) ? 'true' : 'false';
25
+ $controls = ($options->controls == 1) ? 'true' : 'false';
26
+ $pauseOnHover = ($options->pauseOnHover == 1) ? 'true' : 'false';
27
+ ?>
28
+ <script type="text/javascript">
29
+ <!--
30
+ Event.observe(window, "load", function() {
31
+ //ma2_js
32
+ var slideWidth = $('ma2-slideshow<?php echo $uniqId; ?>').getWidth();
33
+ $$('.show .slide').each(function(element){
34
+ element.setStyle({
35
+ width : slideWidth + 'px'
36
+ });
37
+ });
38
+ //options
39
+ $('ma2-slideshow<?php echo $uniqId; ?>') && $('ma2-slideshow<?php echo $uniqId; ?>').protoShow({
40
+ interval : <?php echo intval($options->interval); ?>,
41
+ autoPlay : <?php echo $auto_play; ?>,
42
+ transitionType : "<?php echo $options->transitionType; ?>",
43
+ transitionTime : <?php echo $options->transitionTime; ?>,
44
+ manTransitionTime : <?php echo $options->manTransitionTime; ?>,
45
+ navigation : <?php echo $navigation; ?>,
46
+ controls : <?php echo $controls; ?>,
47
+ stopText : "||",
48
+ playText : ">",
49
+ pauseOnHover : <?php echo $pauseOnHover; ?>
50
+ });
51
+
52
+ $('ma2-slideshow<?php echo $uniqId; ?>').observe('mouseover', function(e){
53
+ e.stop();
54
+ $$('.proto-controls').invoke('show');
55
+ }).observe('mouseout', function(e){
56
+ e.stop();
57
+ $$('.proto-controls').invoke('hide');
58
+ });
59
+ });
60
+
61
+ -->
62
+ </script>
63
+ <?php endif; ?>
64
+
65
+
66
+
67
+
app/etc/modules/Ma2_All.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ma2_All>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Ma2_All>
8
+ </modules>
9
+ </config>
app/etc/modules/Ma2_Slideshow.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ma2_Slideshow>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Ma2_Slideshow>
8
+ </modules>
9
+ </config>
js/ma2_all/ma2all.css ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /*# TABS - Default pure style #######################################*/
3
+ .tab-list { position:relative; }
4
+ .tab-list .tab { float:left; cursor:pointer; }
5
+ .tab-list .last {}
6
+ .tab-list .active { cursor:default }
7
+ .tab-list .tab-container { position:absolute; left:0; width:100%; }
8
+ .tab-list .tab-content {overflow: hidden;}
9
+
10
+ .tab-list { padding-bottom:15px; margin:0 0 15px; }
11
+ .tab-list .tab { position:relative; z-index:2; margin-right:3px; background:#EEE; border: 1px solid #C4C4C4; color:#888; padding:0 0 0 10px; font-size:14px; }
12
+ .tab-list .tab span { padding:0 10px 0 0; line-height:24px; float:left; font-weight: bold;}
13
+ .tab-list .last {}
14
+ .tab-list .active { color:#000; font-weight:bold; z-index:3; border-bottom:0; background:#fff;
15
+ background-image: -moz-linear-gradient(top, #CDCDCD, #FFFFFF);
16
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#CDCDCD), to(#FFFFFF));
17
+ background-image: -webkit-linear-gradient(top, #CDCDCD, #FFFFFF);
18
+ background-image: -o-linear-gradient(top, #CDCDCD, #FFFFFF);
19
+ background-image: linear-gradient(to bottom, #CDCDCD, #FFFFFF);
20
+
21
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFCDCDCD', endColorstr='#FFFFFFFF', GradientType=0);
22
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
23
+ }
24
+ .tab-list .active span { background-position:100% 0; padding-bottom:1px; }
25
+ .tab-list .tab-container { z-index:1; top:25px; background:#fff; }
26
+ .tab-list .tab-content { padding: 1.2em 1em; background:#fff; border:1px solid #c4c4c4; font-size:12px; }
27
+ .tab-list .tab-content object,
28
+ .tab-list .tab-content embed { width:100% !important; height:auto !important; }
29
+
30
+ /*# #######################################*/
js/ma2_all/ma2all.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ if (!window.Ma2All) {
2
+ window.Ma2All = {};
3
+ }
4
+ Ma2All.templatesPattern = /(^|.|\r|\n)(\{\{(.*?)\}\})/;
5
+
6
+ /* Tabs */
7
+ Ma2All.Tabs = Class.create();
8
+ Object.extend(Ma2All.Tabs.prototype, {
9
+ initialize: function (container) {
10
+ this.container = $(container);
11
+ this.container.addClassName('tab-list');
12
+ this.tabs = this.container.select('dt.tab');
13
+ this.activeTab = this.tabs.first();
14
+ this.tabs.first().addClassName('first');
15
+ this.tabs.last().addClassName('last');
16
+ this.onTabClick = this.handleTabClick.bindAsEventListener(this);
17
+ for (var i = 0, l = this.tabs.length; i < l; i ++) {
18
+ this.tabs[i].observe('click', this.onTabClick);
19
+ }
20
+ this.select();
21
+ },
22
+ handleTabClick: function (evt) {
23
+ this.activeTab = Event.findElement(evt, 'dt');
24
+ this.select();
25
+ },
26
+ select: function () {
27
+ for (var i = 0, l = this.tabs.length; i < l; i ++) {
28
+ if (this.tabs[i] == this.activeTab) {
29
+ this.tabs[i].addClassName('active');
30
+ this.tabs[i].style.zIndex = this.tabs.length + 2;
31
+ /*this.tabs[i].next('dd').show();*/
32
+ new Effect.Appear (this.tabs[i].next('dd'), { duration:0.5 });
33
+ this.tabs[i].parentNode.style.height=this.tabs[i].next('dd').getHeight() + 15 + 'px';
34
+ } else {
35
+ this.tabs[i].removeClassName('active');
36
+ this.tabs[i].style.zIndex = this.tabs.length + 1 - i;
37
+ this.tabs[i].next('dd').hide();
38
+ }
39
+ }
40
+ }
41
+ });
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Ma2_Slideshow_Free</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Ma2 Slideshow helps you create a slideshow and put it at any page to increase visitors' attention on your store</summary>
10
+ <description>Ma2 Slideshow helps you create a slideshow and put it at any page to increase visitors' attention on your store</description>
11
+ <notes>Version number: 1.0.0&#xD;
12
+ Stability: Stable &#xD;
13
+ Compatibility: 1.7, 1.8</notes>
14
+ <authors><author><name>Magenmarket.com</name><user>Magen_Market</user><email>trungdt@omegatheme.com</email></author></authors>
15
+ <date>2013-12-16</date>
16
+ <time>02:19:39</time>
17
+ <contents><target name="magecommunity"><dir name="Ma2"><dir name="Slideshow"><dir name="Block"><dir name="Adminhtml"><dir name="Slideshow"><dir name="Edit"><file name="Form.php" hash="48efe58baedc4b5ad199926319371c07"/><dir name="Tab"><file name="Form.php" hash="4ad8476192edc6d54409505c993ab755"/></dir><file name="Tabs.php" hash="296aaa24916f76d515f6f84b77d4baa0"/></dir><file name="Edit.php" hash="18b7220c936d0af1b9ac7f957e35dcef"/><file name="Grid.php" hash="1024a833339d728c48bae7530a0e2f29"/></dir><file name="Slideshow.php" hash="51008276205ecdd1effeaa006dc3a096"/></dir><file name="Slideshow.php" hash="11e1b8339b2124e6975b49071c1af87d"/></dir><dir name="Helper"><file name="Data.php" hash="d6f056ba406477f0f3fd06db8fbe7bb1"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Slideshow"><file name="Collection.php" hash="23e5387ec52cbc6ddbafbd4a8dcf7912"/></dir><file name="Slideshow.php" hash="7fc0c08f1efc2836e1d9aef8e42949e0"/></dir><file name="Slideshow.php" hash="a64edb9ce39e79891fd09ee523d213ee"/><file name="Slideshowselect.php" hash="d142f4eab50c70a162e65f3ab725da30"/><file name="Status.php" hash="77be19eaa7631125af8ddf7d181f3c15"/><file name="Transitiontype.php" hash="fd7e78def47ccd1f400345232f27bcde"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SlideshowController.php" hash="61812050476fe2cfbf78b4189d238eea"/></dir><file name="IndexController.php" hash="64297a33eaafd7bf79ff1d7a688a830e"/></dir><dir name="etc"><file name="config.xml" hash="579ce2cc02e71dc8011cb730f1fb832e"/><file name="system.xml" hash="6c280a589e3d8989f2a1fd434027bc7b"/><file name="widget.xml" hash="de66b3fa65eadf968c86bf10adeae5e7"/></dir><dir name="sql"><dir name="slideshow_setup"><file name="mysql4-install-0.1.0.php" hash="30af78f191ad28f86c1da9de1eeb3cbf"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="Ma2"><dir name="All"><dir name="Helper"><file name="Data.php" hash="090f4bd5ef8f576332f30e6bfc007c5d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="9e1f55ce0e5915b7b22d87e94d4da9ea"/><file name="config.xml" hash="be5bb5343d9525bb292c8e26d2aa68f7"/><file name="system.xml" hash="e687810f26218933731768f75c28e9d6"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ma2_all.xml" hash="f0f2088fe954efa17abc4c138d1c301a"/><file name="ma2_slideshow.xml" hash="cf67eca7c5ec26d99a6bd9e048b99288"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="ma2_all.xml" hash="60da2a96f1c431e35c409190c269af68"/><file name="ma2_slideshow.xml" hash="ceb7eb5d6deb879bd13e64d2fe43b1a6"/></dir><dir name="template"><dir name="ma2_slideshow"><file name="slideshow.phtml" hash="ba86331b3e22ef5ac6736eb41c211316"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ma2_All.xml" hash="1f6125faeadf108fc81b1a03b4574d59"/><file name="Ma2_Slideshow.xml" hash="71f8ee19c04d18216bbbc0362c780435"/></dir></target><target name="mage"><dir name="js"><dir name="ma2_all"><file name="ma2all.css" hash="9c4db2cea69d0b7e2a03c149dc21749e"/><file name="ma2all.js" hash="a0e4d21d363f5b9cdfc4c6c0731f6b69"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="ma2slideshow"><dir name="images"><file name="desc-bg.png" hash="a8d7cb13b2dc537225c780ad5837c3d0"/><file name="next-prev.png" hash="a462e72c9445fe8c31bfbfde9943df80"/><file name="pix.gif" hash="7ad866406509775de63f33224decc101"/><file name="proto_controls_bg.png" hash="617e2194cfc44442c2fefabc6efe5399"/><file name="proto_controls_pause_play_bg.png" hash="d7b80e3375a34dd657e4b1eddf38b2e0"/></dir><file name="protoshow.css" hash="be581f5f55ea9037fbcd1457ed49ffa3"/><file name="styles.css" hash="74ae877d5d03b92c7bfdd2f85ae1d302"/></dir></dir><dir name="js"><dir name="ma2slideshow"><file name="protoshow.js" hash="4769c205951e10b7a7c8c9ff8bcfc773"/></dir></dir></dir></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
+ </package>
skin/frontend/default/default/css/ma2slideshow/images/desc-bg.png ADDED
Binary file
skin/frontend/default/default/css/ma2slideshow/images/next-prev.png ADDED
Binary file
skin/frontend/default/default/css/ma2slideshow/images/pix.gif ADDED
Binary file
skin/frontend/default/default/css/ma2slideshow/images/proto_controls_bg.png ADDED
Binary file
skin/frontend/default/default/css/ma2slideshow/images/proto_controls_pause_play_bg.png ADDED
Binary file
skin/frontend/default/default/css/ma2slideshow/protoshow.css ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ####################################### */
2
+ /* ########### STANDARD SETUP ############ */
3
+ /* ####################################### */
4
+
5
+ .protoshow,
6
+ .protoshow .show {
7
+ position: relative;
8
+ margin: 0;
9
+ padding: 0;
10
+ list-style: none;
11
+ width: 900px;
12
+ height: 300px;
13
+ }
14
+
15
+ .slide {
16
+ position: absolute;
17
+ top: 0;
18
+ left: 0;
19
+ z-index: 90;
20
+ height: 100%;
21
+ }
22
+
23
+ .active-slide {
24
+ z-index: 100;
25
+ }
26
+
27
+ .protoshow .slide-caption {
28
+ position: absolute;
29
+ left: 0;
30
+ bottom: 0;
31
+ right: 0;
32
+ z-index: 100;
33
+ padding: 1em 10px;
34
+ background-color: #000;
35
+ background-color: rgba(0,0,0,.4);
36
+ color:#fff;
37
+ }
38
+
39
+ .proto-progress-timer {
40
+ position: absolute;
41
+ top: 7px;
42
+ right: 7px;
43
+ z-index: 9999;
44
+ }
45
+
46
+
47
+ /* TRANSITION SLIDE
48
+ ------------------------------------------------*/
49
+
50
+ .transition-slide .show-window {
51
+ overflow: hidden;
52
+ position: relative;
53
+ }
54
+
55
+ .transition-slide .show {
56
+ position: absolute;
57
+ top: 0;
58
+ left: 0;
59
+ width: 999999px;
60
+ }
61
+
62
+ .transition-slide .slide {
63
+ position: static; /*overide*/
64
+ float: left;
65
+ display: block;
66
+ }
67
+
68
+
69
+ /* PROTO CONTROLS
70
+ ------------------------------------------------*/
71
+
72
+ .proto-controls,
73
+ .proto-navigation {
74
+ margin: 0;
75
+ padding: 0;
76
+ list-style: none;
77
+ }
78
+
79
+ .proto-controls a:link,
80
+ .proto-controls a:visited,
81
+ .proto-navigation a:link,
82
+ .proto-navigation a:visited {
83
+ display: block;
84
+ text-indent: -9999px;
85
+ overflow: hidden;
86
+ }
87
+
88
+ .proto-controls li {
89
+ position: absolute;
90
+ top: 50%;
91
+ margin-top: -36px;
92
+ left: 10px;
93
+ width: 10%;
94
+ height: 100%;
95
+ z-index: 110;
96
+ }
97
+
98
+ .proto-controls .forward {
99
+ right: 10px;
100
+ left: auto;
101
+ }
102
+
103
+ .proto-controls a {
104
+ width: 100%;
105
+ height: 61px;
106
+ background: url(images/proto_controls_bg.png) no-repeat 0 0;
107
+ opacity: 0.6;
108
+ -moz-opacity: 0.6;
109
+ filter:alpha(opacity=60);
110
+ }
111
+
112
+ .proto-controls a:hover,
113
+ .proto-controls a:focus {
114
+ opacity: 1;
115
+ -moz-opacity: 1;
116
+ filter:alpha(opacity=100);
117
+ }
118
+
119
+ .proto-controls .forward a {
120
+ background-position: 100% -90px;
121
+ }
122
+
123
+
124
+ /* PROTO NAVIGATION
125
+ ------------------------------------------------*/
126
+
127
+ .proto-navigation {
128
+ position: absolute;
129
+ top: 0;
130
+ right: 50%;
131
+ float: right;
132
+ z-index: 120;
133
+ }
134
+
135
+ .proto-navigation li {
136
+ float: left;
137
+ left: 50%;
138
+ padding: 12px 6px;
139
+ position: relative;
140
+
141
+ }
142
+
143
+ .proto-navigation a {
144
+ background-color: #fff;
145
+ background-color: rgba(0,0,0,.2);
146
+ height: 8px;
147
+ text-decoration: none;
148
+ width: 8px;
149
+ -moz-border-radius:30px;
150
+ -webkit-border-radius:30px;
151
+ border-radius:30px;
152
+ -moz-box-shadow: inset 0 1px 0 1px rgba(0,0,0,.1);
153
+ -webkit-box-shadow: inset 0 1px 0 1px rgba(0,0,0,.1);
154
+ box-shadow: inset 0 1px 0 1px rgba(0,0,0,.1);
155
+ }
156
+
157
+ .proto-navigation a:hover,
158
+ .proto-navigation a:focus {
159
+ background-color: #999;
160
+ }
161
+
162
+ .proto-navigation .current-slide a {
163
+ background-color: #363F4E;
164
+ }
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+ /*
182
+ .proto-navigation {
183
+ margin: 0;
184
+ padding: 0;
185
+ list-style: none;
186
+ position: absolute;
187
+ right: 5px;
188
+ bottom: -25px;
189
+ z-index: 200;
190
+ }
191
+
192
+ .proto-navigation li {
193
+ float: left;
194
+ margin-right: 10px;
195
+ }
196
+
197
+ .proto-navigation li a:link,
198
+ .proto-navigation li a:visited {
199
+ display: block;
200
+ width: 8px;
201
+ height: 8px;
202
+ text-decoration: none;
203
+ background-color: rgba(255,255,255,0.5);
204
+ border: 1px solid #090809;
205
+ color: #666;
206
+ text-indent: -9999px;
207
+ overflow: hidden;
208
+ -moz-border-radius: 30px;
209
+ -webkit-border-radius: 30px;
210
+ border-radius: 30px;
211
+ }
212
+
213
+ .proto-navigation li a:hover,
214
+ .proto-navigation li a:focus {
215
+ background-color: #fff;
216
+ border-color: #000;
217
+ }
218
+
219
+
220
+ .proto-navigation li.current-slide a:link,
221
+ .proto-navigation li.current-slide a:visited {
222
+ background-color: rgba(30,30,30,0.9);
223
+
224
+ }
225
+
226
+
227
+
228
+
229
+
230
+
231
+ .proto-controls {
232
+ margin: 0;
233
+ padding: 0;
234
+ list-style: none;
235
+
236
+ }
237
+
238
+ .proto-controls .forward,
239
+ .proto-controls .backward,
240
+ .proto-controls .start-stop {
241
+ z-index: 200;
242
+ float: left;
243
+ margin: 10px 10px 0 0;
244
+ }
245
+
246
+ .proto-controls .start-stop {
247
+ margin-top: 10px;
248
+
249
+ }
250
+
251
+
252
+
253
+
254
+
255
+ .proto-controls a:link,
256
+ .proto-controls a:visited {
257
+ display: inline-block;
258
+ background-color: #090809;
259
+ background-image: -moz-linear-gradient(
260
+ center top,
261
+ rgb(123,125,130) 2%,
262
+ rgb(75,80,88) 3%,
263
+ rgb(42,45,50) 100%
264
+ );
265
+ color: #fff;
266
+ padding: 5px 10px;
267
+ border: 1px solid #090809;
268
+ -moz-border-radius: 20px;
269
+ -webkit-border-radius: 20px;
270
+ border-radius: 20px;
271
+ text-decoration: none;
272
+ text-align: center;
273
+ width: 60px;
274
+ }
275
+
276
+ .proto-controls a:hover,
277
+ .proto-controls a:focus {
278
+ background-image: -moz-linear-gradient(
279
+ center bottom,
280
+ rgb(42,45,50) 100%,
281
+ rgb(75,80,88) 90%,
282
+ rgb(123,125,130) 20%
283
+ );
284
+ color: #e1e1e1;
285
+ }
286
+
287
+
288
+ .slide-caption {
289
+ position: absolute;
290
+ bottom: 0px;
291
+ left: 0px;
292
+ width: 880px;
293
+ background-color: rgba(0,0,0,.5);
294
+ color: #fff;
295
+ z-index: 200;
296
+ padding: 10px;
297
+ }
298
+
299
+
300
+ .proto-timer {
301
+ position: absolute;
302
+ top: 10px;
303
+ right: 10px;
304
+ z-index: 9999;
305
+ }*/
skin/frontend/default/default/css/ma2slideshow/styles.css ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Document CSS*/
2
+ .ma2-slideshow{
3
+ /* overflow: hidden; */
4
+ position: relative;
5
+ width: 100%;
6
+ height: 400px;
7
+ }
8
+ .transition-slide .show-window {
9
+ overflow: hidden;
10
+ position: relative;
11
+ }
12
+ .ma2-slideshow .show {
13
+ color: #FFFFFF;
14
+ height: 350px;
15
+ margin: 0 auto;
16
+ }
17
+ .transition-slide .show {
18
+ left: 0;
19
+ position: absolute;
20
+ top: 0;
21
+ width: 999999px;
22
+ }
23
+ .protoshow,
24
+ .protoshow .show {
25
+ overflow: hidden;
26
+ height: 300px;
27
+ list-style: none outside none;
28
+ margin: 0;
29
+ padding: 0;
30
+ position: relative;
31
+ min-width: 100%;
32
+ }
33
+ .proto-controls li{
34
+ height: auto;
35
+ width: 5%;
36
+ }
37
+ .proto-controls li.start-stop{
38
+ background: none;
39
+ left: 48%;
40
+ }
41
+ .proto-controls li.start-stop a{
42
+ background: none repeat scroll 0 0 transparent;
43
+ color: #FFFFFF;
44
+ font-size: 75px;
45
+ font-weight: normal;
46
+ line-height: 100%;
47
+ text-decoration: none;
48
+ text-indent: 0;
49
+ }
50
+ .proto-controls a:link,
51
+ .proto-controls a:visited,
52
+ .proto-navigation a:link,
53
+ .proto-navigation a:visited {
54
+ text-align: left;
55
+ }
56
+ .proto-controls,
57
+ .proto-navigation{
58
+ list-style: none outside none !important
59
+ }
60
+ .ma2-slideshow .show .slide{
61
+ width: 980px;
62
+ position: relative;
63
+ }
64
+ .ma2-slideshow .show .slide .img-slide{
65
+ width: 100%;
66
+ }
67
+ .ma2-slideshow .show .slide .item-desc{
68
+ background: url("images/desc-bg.png");
69
+ width: 96%;
70
+ position: absolute;
71
+ padding: 10px 2%;
72
+ bottom: 0;
73
+ left: 0;
74
+ line-height: normal;
75
+ text-align: left;
76
+ }
77
+ .show .slide .item-desc h1.title {
78
+ line-height: normal;
79
+ }
80
+ .show .slide .item-desc h1.title a{
81
+ text-decoration: none;
82
+ font-size: 18px;
83
+ line-height: normal;
84
+ }
skin/frontend/default/default/js/ma2slideshow/protoshow.js ADDED
@@ -0,0 +1,709 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ProtoShow JavaScript slide show,
2
+ * v 0.8 (beta) - 16/09/11
3
+ * Copyright(c) 2011 David Smith (web: http://www.aheadcreative.com; twitter: @get_dave)
4
+ *
5
+ * This work is licenced under the Creative Commons Attribution-No Derivative Works 3.0 Unported License.
6
+ * http://creativecommons.org/licenses/by-nd/3.0/
7
+ *
8
+ * For more information on this project visit:
9
+ * http://www.protoshow.net
10
+ * http://www.deepbluesky.com
11
+ *
12
+ *--------------------------------------------------------------------------*/
13
+
14
+
15
+
16
+ if(typeof Prototype=='undefined' || typeof Scriptaculous =='undefined') {
17
+ throw("Protoshow.js requires the Prototype & Scriptaculous JavaScript framework");
18
+ } else {
19
+
20
+ var protoShow = Class.create({
21
+
22
+ initialize: function(element,options) {
23
+
24
+ // Default options
25
+ this.options = Object.extend({
26
+ selector : ".slide",
27
+ interval : 3000,
28
+ initialSlide : 1,
29
+ mode : "forward",
30
+ autoPlay : true,
31
+ autoRestart : true,
32
+ transitionType : "fade",
33
+ transitionTime : 1.5,
34
+ manTransitionTime : 0.5,
35
+ navigation : true,
36
+ controls : true,
37
+ stopText : "Pause",
38
+ playText : "Play",
39
+ nextText : "Next",
40
+ previousText : "Previous",
41
+ captions : false,
42
+ pauseOnHover : false,
43
+ keyboardControls : true,
44
+ fireEvents : true,
45
+ progressTimer : true
46
+
47
+ }, options || {}); // We use Prototype's Object.extend() to overwrite defaults with user preferences
48
+
49
+
50
+
51
+
52
+ // get/set various options
53
+ this.element = $(element); // DOM element that contains the slideshow
54
+ this.slides = this.element.select(this.options.selector); // Elements that are to be the "Slides"
55
+ this.slidesLength = this.slides.size(); // Total number of Slides
56
+ this.interval = this.options.interval;
57
+ this.transitionType = this.options.transitionType;
58
+ this.transitionTime = this.options.transitionTime;
59
+ this.manTransitionTime = this.options.manTransitionTime;
60
+ this.currentSlideID = this.options.initialSlide - 1;
61
+ this.nextSlideID = this.currentSlideID + 1;
62
+ this.playText = this.options.playText;
63
+ this.nextText = this.options.nextText;
64
+ this.previousText = this.options.previousText;
65
+ this.stopText = this.options.stopText;
66
+ this.mode = this[this.options.mode]; // Get play "mode" (forward, backward, random...etc)
67
+ this.autoPlay = this.options.autoPlay;
68
+ this.progressTimer = this.options.progressTimer;
69
+
70
+
71
+
72
+
73
+
74
+ // define variables before use
75
+ this.running = false;
76
+ this.masterTimer = false;
77
+ this.animating = false; // boolean for "animating" status
78
+ this.loopCount = 0;
79
+ this.slideWidth = 0;
80
+ this.slideHeight = 0;
81
+ this.slideIntervals = [];
82
+ this.currentSlideEle = this.slides[this.currentSlideID];
83
+ this.nextSlideEle = this.slides[this.nextSlideID];
84
+
85
+
86
+ //run some initial setup
87
+ this.setupTransitions(this.options.transitionType);
88
+ this.setupSlides();
89
+ this.setupControls();
90
+ this.setupNavigation();
91
+ this.setupCaptions();
92
+ this.setupKeyboardControls();
93
+ this.stopOnHover();
94
+
95
+ //this.createTimer();
96
+ this.setupTimer();
97
+
98
+ if (this.autoPlay) {
99
+ // let's get things going!
100
+ this.play();
101
+ }
102
+
103
+ },
104
+
105
+
106
+ /* DIRECTIONAL CONTROLS
107
+ ------------------------------------------------*/
108
+
109
+
110
+
111
+ play: function() {
112
+ // Role: Starts the show and initialises master timer
113
+
114
+ var _this = this;
115
+ this.running = true;
116
+ this.toggleMasterTimer(true);
117
+ this.updateControls(true);
118
+
119
+ this.fireCustomEvent("protoShow:started");
120
+ },
121
+
122
+ stop: function() {
123
+ // Completely stops the show and clears the master timer
124
+ var _this = this;
125
+
126
+ this.running = false;
127
+
128
+ this.toggleMasterTimer(false);
129
+ this.updateControls(false);
130
+
131
+ this.fireCustomEvent("protoShow:stopped");
132
+ },
133
+
134
+ toggleMasterTimer: function(bln) {
135
+ var _this = this;
136
+
137
+ if (bln) {
138
+ // Check if custom interval has been defined by user as data attribute in HTML
139
+ var slideInterval = (this.slideIntervals[this.currentSlideID]) ? this.slideIntervals[this.currentSlideID] : this.interval;
140
+ this.runProgressTimer();
141
+
142
+ // Set Master time which controls progress of show
143
+ this.masterTimer = new PeriodicalExecuter(function(pe) {
144
+ _this.mode();
145
+ }, slideInterval/1000);
146
+ this.loopCount++;
147
+ } else {
148
+ this.stopProgressTimer();
149
+ _this.masterTimer && _this.masterTimer.stop();
150
+ _this.masterTimer = null;
151
+ }
152
+
153
+ },
154
+
155
+ forward: function(transTime) {
156
+ // Role: Runs slideshow "forwards"
157
+
158
+ this.goMaster( this.currentSlideID + 1, transTime, "forward");
159
+ },
160
+
161
+ backward: function(transTime) {
162
+ // Role: Runs slideshow "backwards"
163
+
164
+ this.goMaster( this.currentSlideID - 1, transTime, "backward");
165
+ },
166
+
167
+ next: function() {
168
+ this.forward(this.manTransitionTime);
169
+ },
170
+
171
+ previous: function() {
172
+ this.backward(this.manTransitionTime);
173
+ },
174
+
175
+ gotoSlide: function(slide,transTime) {
176
+ if (slide === this.currentSlideID) {
177
+ return false;
178
+ }
179
+ this.goMaster( slide, this.manTransitionTime );
180
+ },
181
+
182
+ goMaster: function(next,transTime, direction) {
183
+ // Role: Master function - controls delegation of slide swapping
184
+
185
+ var _this = this;
186
+
187
+ // First thing's first, we hault the show whatever the circumstances
188
+ this.toggleMasterTimer(false);
189
+
190
+ if(this.isAnimating()) {
191
+ return false;
192
+ }
193
+
194
+ // Set the transistion speed to transTime arg (if set) else fallback to standard transitionTime
195
+ var transTime = (transTime) ? transTime : _this.transitionTime;
196
+
197
+
198
+
199
+ this.toggleAnimating(true);
200
+ this.setNextIndex(next); // set this.nextSlideID correctly
201
+
202
+ this.fireCustomEvent("protoShow:transitionStarted",transTime,direction);
203
+ _this.updateNavigation(_this.currentSlideID, _this.nextSlideID);
204
+
205
+ this.transitionType(this.currentSlideEle,this.nextSlideEle, {
206
+ transitionTime : transTime,
207
+ transitionFinish : function() { // pass a callback to ensure play can't resume until transition has completed
208
+ _this.toggleAnimating(false);
209
+ _this.currentSlideEle.removeClassName('active-slide');
210
+ _this.nextSlideEle.addClassName('active-slide');
211
+
212
+ _this.updateCaptions(_this.nextSlideEle);
213
+ _this.fireCustomEvent("protoShow:transitionFinished");
214
+ _this.currentSlideID = _this.nextSlideID; // update current slide to be the slide we're just moved to
215
+ _this.currentSlideEle = _this.slides[_this.nextSlideID];
216
+
217
+
218
+ if (_this.autoPlay && _this.running ) {
219
+ // if we're autoplaying and we're not explicity stopped
220
+ // otherwise show Master Timer is not permitted to restart itself
221
+ _this.toggleMasterTimer(true);
222
+ }
223
+ }
224
+ });
225
+ },
226
+
227
+
228
+ /* TRANSITION FUNCTIONS
229
+ ------------------------------------------------*/
230
+
231
+ fade: function(current,next,opts) {
232
+ // Role: Transition function
233
+ // Type: Fade - fades slides in and out
234
+
235
+ var _this = this;
236
+
237
+ next.show();
238
+ current.fade({
239
+ duration : opts.transitionTime,
240
+ afterFinish : function() {
241
+ return opts.transitionFinish();
242
+ }
243
+ });
244
+ },
245
+
246
+ slide: function(current,next,opts) {
247
+ // Role: Transition function
248
+ // Type: Slider - slides slides across the screen
249
+ var _this = this;
250
+
251
+ var leftPos = this.slideWidth * this.nextSlideID;
252
+
253
+
254
+ new Effect.Morph(_this.showEle, {
255
+ style: {
256
+ left: -leftPos + 'px'
257
+ },
258
+ duration : opts.transitionTime,
259
+ afterFinish : function() {
260
+ return opts.transitionFinish();
261
+ }
262
+ });
263
+ },
264
+
265
+
266
+
267
+ /* SETUP METHODS
268
+ ------------------------------------------------*/
269
+
270
+ setupSlides: function() {
271
+ var _this = this;
272
+
273
+
274
+
275
+ // Get and set user defined custom intervals
276
+ this.slides.each(function(e, index) {
277
+
278
+
279
+ if (_this.options.transitionType !== "slide") {
280
+ e.hide();
281
+ }
282
+ var slideInt = e.readAttribute('data-slide-interval');
283
+ slideInt = (slideInt && slideInt.blank()) ? undefined : slideInt; // check slideInt is not a blank string
284
+
285
+ _this.slideIntervals.push(slideInt); // push intervals into array for use later
286
+ });
287
+
288
+ // Ensure first slide is visible and has active class
289
+ this.slides[this.currentSlideID].show().addClassName('active-slide');
290
+ },
291
+
292
+ setupTransitions: function(transType) {
293
+ // Role: Setup basics for transitions
294
+ var _this = this;
295
+
296
+ if (typeof(transType) == "function") { // user has defined custom transition function
297
+ // If function then user has passed in custom transition function to be used
298
+ this.transitionType = transType;
299
+ this.element.addClassName('transition-custom');
300
+ } else { // it's a string
301
+ this.transitionType = this[transType];
302
+ this.element.addClassName('transition-' + transType);
303
+
304
+ if (transType === "slide") {
305
+
306
+ this.showWindow = this.element.down('.show').wrap('div', { 'class': 'show-window' });
307
+ this.showEle = this.showWindow.down('.show');
308
+ var slideLayout = this.slides[0].getLayout();
309
+ this.slideWidth = slideLayout.get('width');
310
+ this.slideHeight = slideLayout.get('height');
311
+
312
+
313
+ this.showWindow.setStyle({
314
+ width : _this.slideWidth + "px",
315
+ height : _this.slideHeight + "px"
316
+ });
317
+ }
318
+ }
319
+ },
320
+
321
+ setupControls: function() {
322
+ // Role: Setup controls
323
+
324
+ var _this = this;
325
+
326
+ if (!this.options.controls) {
327
+ return false;
328
+ }
329
+
330
+ this.protoControls = this.element.down('.proto-controls'); // Stop/Forward/Back buttons
331
+
332
+ if (typeof this.protoControls==="undefined" ) {
333
+
334
+ var controlsEle = new Element('ol', { 'class': 'proto-controls'});
335
+ var controlsTemplate = new Template('<li class="#{htmlclass}"><a href="javascript:void(0)" title="#{title}">#{text}</a></li>');
336
+
337
+ var startStop = controlsTemplate.evaluate({
338
+ htmlclass: "proto-control start-stop pause",
339
+ text: this.playText,
340
+ title: "Pause or Play the show"
341
+ });
342
+ var backward = controlsTemplate.evaluate({
343
+ htmlclass: "proto-control backward",
344
+ text: this.previousText,
345
+ title: "Go to Previous slide and play backwards"
346
+ });
347
+ var forward = controlsTemplate.evaluate({
348
+ htmlclass: "proto-control forward",
349
+ text: this.nextText,
350
+ title: "Go to Next slide and play forwards"
351
+ });
352
+
353
+ // Build a DOM fragment from all the above
354
+ controlsEle.insert(startStop,'bottom').insert(backward,'bottom').insert(forward,'bottom');
355
+ this.element.insert(controlsEle,'bottom'); // add into DOM
356
+ this.protoControls = $(controlsEle); // extend the DOM fragment
357
+ }
358
+
359
+ // If the controls already exists in the DOM
360
+ this.controlStartStop = this.protoControls.down('.start-stop');
361
+ this.controlForward = this.protoControls.down('.forward');
362
+ this.controlBackward = this.protoControls.down('.backward');
363
+
364
+
365
+ // define "lock" variable to stop abuse of controls
366
+ var handlingClick = false;
367
+
368
+ this.protoControls.on("click", ".proto-control", function(event, element) {
369
+ event.stop();
370
+
371
+ // make sure we're not processing multiple click events
372
+ if (handlingClick) {
373
+ return false;
374
+ }
375
+
376
+ handlingClick = true;
377
+
378
+
379
+
380
+ if(element === _this.controlForward) {
381
+ _this.next();
382
+ } else if (element === _this.controlBackward) {
383
+ _this.previous();
384
+ } else {
385
+
386
+ if (_this.running) {
387
+ _this.stop(); // if we're "Playing" then stop the show
388
+ } else {
389
+ _this.play(); // else if we're not "Playing" then start the show
390
+ }
391
+ }
392
+ /*remove the "lock" variable*/
393
+ handlingClick = false;
394
+ });
395
+
396
+ },
397
+
398
+
399
+ setupNavigation: function() {
400
+ // Role: Setup Navigation
401
+ var _this = this;
402
+
403
+ if (!this.options.navigation) {
404
+ return false;
405
+ }
406
+
407
+ this.protoNavigation = this.element.down('.proto-navigation');
408
+
409
+ if (typeof this.protoNavigation==="undefined" ) {
410
+ var navEle = new Element('ol', { 'class': 'proto-navigation'});
411
+ var navTemplate = new Template('<li><a href="##{number}" title="Skip to Slide #{number}">#{number}</a></li>');
412
+
413
+ this.slides.each(function(e,index) { // for each slide in the show create a Nav <li> using the Template above
414
+ var li = navTemplate.evaluate({number: index+1});
415
+ navEle.insert(li,'bottom');
416
+ });
417
+
418
+ this.element.insert(navEle,'bottom');
419
+ this.protoNavigation = this.element.down('.proto-navigation');
420
+ }
421
+
422
+ this.protoNavigation.down('li').addClassName('current-slide');
423
+
424
+ // define "lock" variable to stop abuse of controls
425
+ var handlingClick = false;
426
+
427
+ this.protoNavigation.on("click", "a", function(event, element) {
428
+ event.stop();
429
+
430
+ // make sure we're not processing multiple click events
431
+ if (handlingClick) {
432
+ return false;
433
+ }
434
+
435
+ handlingClick = true;
436
+
437
+ var index = element.hash.substr(1,2); // get the slide ID from the href hash (eg: #3)
438
+ _this.gotoSlide(index-1);
439
+
440
+ /*remove the "lock" variable*/
441
+ handlingClick = false;
442
+ });
443
+ },
444
+
445
+ updateNavigation: function(current,next) {
446
+ if (typeof this.protoNavigation !== "undefined" ) {
447
+ this.protoNavigation.select('li')[current].removeClassName('current-slide');
448
+ this.protoNavigation.select('li')[next].addClassName('current-slide');
449
+ }
450
+ },
451
+
452
+ setupCaptions: function() {
453
+ var _this = this;
454
+
455
+ if (this.options.captions) {
456
+ var captionEle = new Element('div', { 'class' : 'slide-caption'});
457
+ captionEle.hide();
458
+ this.element.insert(captionEle,'bottom');
459
+ this.captionsElement = captionEle;
460
+ this.updateCaptions(_this.currentSlideEle);
461
+ }
462
+
463
+ },
464
+
465
+ updateCaptions: function(slide) {
466
+ if (!this.options.captions) {
467
+ return false;
468
+ }
469
+
470
+ var nextCaption = slide.down('img').readAttribute('alt');
471
+ if (nextCaption.replace(/^\s*|\s*$/g,'').length) { // check that the attribute has some content (not just spaces)
472
+ if(!this.captionsElement.visible()) {
473
+ // just check that the element is visible
474
+ this.captionsElement.show();
475
+ }
476
+ this.captionsElement.update(nextCaption);
477
+ } else { // if no caption is found then hide the caption element
478
+ this.captionsElement.hide();
479
+ }
480
+ },
481
+
482
+
483
+ stopOnHover: function() {
484
+ var _this = this;
485
+
486
+ if (this.options.pauseOnHover) {
487
+ this.element.down('.show').observe('mouseenter',function() {
488
+ _this.stop();
489
+ }).observe('mouseleave',function() {
490
+ _this.play();
491
+ });
492
+
493
+
494
+ }
495
+ },
496
+
497
+ setupKeyboardControls: function() {
498
+ // 39 = right arrow
499
+ // 37 = left arrow
500
+
501
+ if (!this.options.keyboardControls) {
502
+ return false;
503
+ }
504
+
505
+ var _this = this;
506
+ document.observe('keydown', function(key) {
507
+
508
+ var keyCode = key.keyCode;
509
+
510
+ // stop arrow keys from working when focused on form items
511
+ if ( (!key.target.tagName.match('TEXTAREA|INPUT|SELECT')) && (keyCode === 37 || keyCode === 39) ) {
512
+ if (keyCode === 37) {
513
+ _this.previous();
514
+ } else if (keyCode === 39) {
515
+ _this.next();
516
+ }
517
+ } else {
518
+ return false;
519
+ }
520
+ });
521
+ },
522
+
523
+ fireCustomEvent: function(event_name,trans_time,direction) {
524
+ if(this.options.fireEvents) {
525
+ var element = this.element;
526
+ element.fire(event_name, {
527
+ transitionTime : trans_time,
528
+ direction : direction
529
+ });
530
+ }
531
+ },
532
+
533
+
534
+ /* UTILITY FUNCTIONS
535
+ ------------------------------------------------*/
536
+
537
+ isPlaying: function() {
538
+ return this.masterTimer != null;
539
+ },
540
+
541
+ isAnimating: function() {
542
+ return this.animating;
543
+ },
544
+
545
+ toggleAnimating: function(bln) {
546
+ // Role: toggles var to say whether animation is in progress and manipulates DOM
547
+ this.animating = bln;
548
+ if (bln) {
549
+ this.element.addClassName("animating");
550
+ } else {
551
+ this.element.removeClassName("animating");
552
+ }
553
+ },
554
+
555
+ setNextIndex: function(next) {
556
+ // Role: Decides on direction and ensures within bounds
557
+
558
+ if(next === undefined) { // Ensure "next" has a value
559
+ next = this.currentSlideID+1;
560
+ }
561
+
562
+ // Ensure we're within bounds
563
+ if (next >= this.slidesLength) {
564
+ next = 0;
565
+ } else if (next < 0 ){
566
+ next = this.slidesLength-1;
567
+ }
568
+
569
+ this.nextSlideID = next;
570
+ this.nextSlideEle = this.slides[this.nextSlideID];
571
+ },
572
+
573
+ updateControls: function(status) {
574
+ // Role: Updates the status of the Play/Pause button
575
+ var _this = this;
576
+
577
+ if (status) { // The show has been started so update the button to "Pause"
578
+ this.controlStartStop.down('a').update(_this.stopText);
579
+ } else {
580
+ // The show has been stopped so update the button to "Play"
581
+ this.controlStartStop.down('a').update(_this.playText);
582
+ }
583
+
584
+ },
585
+
586
+
587
+
588
+ setupTimer: function() {
589
+ // Role: creates the proto-progress-timer <canvas> element, gets 2D Context and inserta into DOM
590
+
591
+ this.progressTimerEle = document.createElement('canvas');
592
+ if (this.progressTimerEle.getContext && this.progressTimerEle.getContext('2d')) { // test for Canvas support
593
+ this.progressTimerEle.writeAttribute('class','proto-progress-timer');
594
+ this.progressTimerEle.width = 30;
595
+ this.progressTimerEle.height = 30;
596
+ this.element.insert(this.progressTimerEle,'bottom');
597
+ this.progressTimerCtx = this.progressTimerEle.getContext('2d');
598
+ } else {
599
+ this.progressTimer = false; // no canvas support
600
+ }
601
+ },
602
+
603
+
604
+ runProgressTimer: function() {
605
+ // Role: runs & controls the animation of the "progress timer"
606
+
607
+ var _this = this;
608
+
609
+
610
+ if (this.progressTimer) { // if user has set to use progress timer and the browser supports <canvas>
611
+
612
+
613
+
614
+ this.progressTimerEle.show();
615
+
616
+ // use Epoch time to ensure code executes in time specified
617
+ // borrowed from Emile JS http://script.aculo.us/downloads/emile.pdf
618
+ var start = (new Date).getTime();
619
+ var duration = this.interval - (this.interval/4);
620
+ var finish = start+duration;
621
+ var angleStart = 0;
622
+
623
+
624
+ this.progressTimerPE = new PeriodicalExecuter(function(pe) {
625
+ _this.resetProgressTimer(); // clear the canvas ready for next segment
626
+ this.drawArc(_this.progressTimerCtx,0,360,'rgba(0,0,0,.2)'); // redraw the black bg circle
627
+
628
+ var time = (new Date).getTime();
629
+ var pos = time>finish ? 1 : (time-start)/duration;
630
+
631
+ // draw the arch passing in the ctx and the degress of the arch
632
+ this.drawArc(_this.progressTimerCtx,-5,Math.floor(( (360) * pos)),'rgba(255,255,255,.8)',true);
633
+
634
+ if( (!this.isPlaying()) || time>finish) { // if we are stopped or we are finished then stop the PE and fade the canvas out
635
+ pe.stop();
636
+ _this.progressTimerEle.fade({
637
+ duration: (_this.interval > 1000) ? (_this.interval/8)/1000 : 0.2,
638
+ afterFinish: function() {
639
+ _this.resetProgressTimer();
640
+ }
641
+ });
642
+ }
643
+ }.bind(this),duration/100000);
644
+ }
645
+ },
646
+
647
+
648
+ resetProgressTimer: function() {
649
+ this.progressTimerEle.width = this.progressTimerEle.width;
650
+ },
651
+
652
+ stopProgressTimer: function() {
653
+ this.resetProgressTimer();
654
+ clearInterval(this.progressTimerPE);
655
+ },
656
+
657
+ drawArc: function(canvasCtx,startAngle,endAngle,strokeStyle) {
658
+ // Role: utility function for drawing archs on <canvas> elements
659
+
660
+ var drawingArc = true;
661
+ var ctx = canvasCtx;
662
+
663
+ ctx.beginPath();
664
+ ctx.strokeStyle = strokeStyle;
665
+ ctx.lineCap = 'butt';
666
+ ctx.lineWidth = 4;
667
+
668
+ ctx.arc(15,15,10, (Math.PI/180)*(startAngle-90),(Math.PI/180)*(endAngle-90), false);
669
+ ctx.stroke();
670
+ var drawingArc = false;
671
+ },
672
+
673
+
674
+
675
+ /* LOGGING FUNCTIONS
676
+ ------------------------------------------------*/
677
+
678
+ /*reportSlides: function() {
679
+ console.log("Current slide: " + this.currentSlideID);
680
+ console.log("Next slide: " + this.nextSlideID);
681
+ },*/
682
+
683
+
684
+
685
+
686
+ cc: function() {
687
+ // catches the comma
688
+ }
689
+
690
+
691
+
692
+
693
+ });
694
+
695
+ Element.addMethods({
696
+ // Make Protoshow available as method of all Prototype extended elements
697
+ // http://www.prototypejs.org/api/element/addmethods
698
+ protoShow: function(element, options) {
699
+ element = $(element);
700
+ var theShow = new protoShow(element,options);
701
+ return theShow;
702
+ }
703
+ });
704
+
705
+ }
706
+
707
+
708
+
709
+