Magestore_BannerSlider - Version 0.1.0

Version Notes

Banner slider

Download this release

Release Info

Developer Magento Core Team
Extension Magestore_BannerSlider
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (23) hide show
  1. app/code/community/Magestore/BannerSlider/Block/Adminhtml/BannerSlider.php +12 -0
  2. app/code/community/Magestore/BannerSlider/Block/Adminhtml/BannerSlider/Edit.php +45 -0
  3. app/code/community/Magestore/BannerSlider/Block/Adminhtml/BannerSlider/Edit/Form.php +19 -0
  4. app/code/community/Magestore/BannerSlider/Block/Adminhtml/BannerSlider/Edit/Tab/Form.php +65 -0
  5. app/code/community/Magestore/BannerSlider/Block/Adminhtml/BannerSlider/Edit/Tabs.php +24 -0
  6. app/code/community/Magestore/BannerSlider/Block/Adminhtml/BannerSlider/Grid.php +116 -0
  7. app/code/community/Magestore/BannerSlider/Block/BannerSlider.php +17 -0
  8. app/code/community/Magestore/BannerSlider/Helper/Data.php +6 -0
  9. app/code/community/Magestore/BannerSlider/Model/BannerSlider.php +10 -0
  10. app/code/community/Magestore/BannerSlider/Model/Mysql4/BannerSlider.php +10 -0
  11. app/code/community/Magestore/BannerSlider/Model/Mysql4/BannerSlider/Collection.php +10 -0
  12. app/code/community/Magestore/BannerSlider/Model/Status.php +15 -0
  13. app/code/community/Magestore/BannerSlider/controllers/Adminhtml/BannerSliderController.php +214 -0
  14. app/code/community/Magestore/BannerSlider/controllers/IndexController.php +47 -0
  15. app/code/community/Magestore/BannerSlider/etc/config.xml +132 -0
  16. app/code/community/Magestore/BannerSlider/etc/system.xml +45 -0
  17. app/code/community/Magestore/BannerSlider/sql/bannerslider_setup/mysql4-install-0.1.0.php +24 -0
  18. app/design/adminhtml/default/default/layout/bannerslider.xml +8 -0
  19. app/design/frontend/default/default/layout/bannerslider.xml +10 -0
  20. app/design/frontend/default/default/template/bannerslider/bannerslider.phtml +53 -0
  21. package.xml +18 -0
  22. skin/frontend/default/default/banner/ajaxtabs.js +159 -0
  23. skin/frontend/default/default/banner/banner.css +86 -0
app/code/community/Magestore/BannerSlider/Block/Adminhtml/BannerSlider.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_BannerSlider_Block_Adminhtml_BannerSlider extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_bannerslider';
7
+ $this->_blockGroup = 'bannerslider';
8
+ $this->_headerText = Mage::helper('bannerslider')->__('Item Manager');
9
+ $this->_addButtonLabel = Mage::helper('bannerslider')->__('Add Item');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/community/Magestore/BannerSlider/Block/Adminhtml/BannerSlider/Edit.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_BannerSlider_Block_Adminhtml_BannerSlider_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'bannerslider';
11
+ $this->_controller = 'adminhtml_bannerslider';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('bannerslider')->__('Save Item'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('bannerslider')->__('Delete Item'));
15
+
16
+ $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);
21
+
22
+ $this->_formScripts[] = "
23
+ function toggleEditor() {
24
+ if (tinyMCE.getInstanceById('bannerslider_content') == null) {
25
+ tinyMCE.execCommand('mceAddControl', false, 'bannerslider_content');
26
+ } else {
27
+ tinyMCE.execCommand('mceRemoveControl', false, 'bannerslider_content');
28
+ }
29
+ }
30
+
31
+ function saveAndContinueEdit(){
32
+ editForm.submit($('edit_form').action+'back/edit/');
33
+ }
34
+ ";
35
+ }
36
+
37
+ public function getHeaderText()
38
+ {
39
+ if( Mage::registry('bannerslider_data') && Mage::registry('bannerslider_data')->getId() ) {
40
+ return Mage::helper('bannerslider')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('bannerslider_data')->getTitle()));
41
+ } else {
42
+ return Mage::helper('bannerslider')->__('Add Item');
43
+ }
44
+ }
45
+ }
app/code/community/Magestore/BannerSlider/Block/Adminhtml/BannerSlider/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_BannerSlider_Block_Adminhtml_BannerSlider_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/community/Magestore/BannerSlider/Block/Adminhtml/BannerSlider/Edit/Tab/Form.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_BannerSlider_Block_Adminhtml_BannerSlider_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('bannerslider_form', array('legend'=>Mage::helper('bannerslider')->__('Item information')));
10
+
11
+ $fieldset->addField('title', 'text', array(
12
+ 'label' => Mage::helper('bannerslider')->__('Title'),
13
+ 'class' => 'required-entry',
14
+ 'required' => true,
15
+ 'name' => 'title',
16
+ ));
17
+
18
+ $fieldset->addField('filename', 'file', array(
19
+ 'label' => Mage::helper('bannerslider')->__('Image File'),
20
+ 'required' => false,
21
+ 'name' => 'filename',
22
+ ));
23
+
24
+ $fieldset->addField('status', 'select', array(
25
+ 'label' => Mage::helper('bannerslider')->__('Status'),
26
+ 'name' => 'status',
27
+ 'values' => array(
28
+ array(
29
+ 'value' => 1,
30
+ 'label' => Mage::helper('bannerslider')->__('Enabled'),
31
+ ),
32
+
33
+ array(
34
+ 'value' => 2,
35
+ 'label' => Mage::helper('bannerslider')->__('Disabled'),
36
+ ),
37
+ ),
38
+ ));
39
+
40
+ $fieldset->addField('weblink', 'text', array(
41
+ 'label' => Mage::helper('bannerslider')->__('Web Url'),
42
+ 'required' => false,
43
+ 'name' => 'weblink',
44
+ ));
45
+
46
+ $fieldset->addField('content', 'editor', array(
47
+ 'name' => 'content',
48
+ 'label' => Mage::helper('bannerslider')->__('Content'),
49
+ 'title' => Mage::helper('bannerslider')->__('Content'),
50
+ 'style' => 'width:700px; height:500px;',
51
+ 'wysiwyg' => false,
52
+ 'required' => false,
53
+ ));
54
+
55
+
56
+ if ( Mage::getSingleton('adminhtml/session')->getBannerSliderData() )
57
+ {
58
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getBannerSliderData());
59
+ Mage::getSingleton('adminhtml/session')->setBannerSliderData(null);
60
+ } elseif ( Mage::registry('bannerslider_data') ) {
61
+ $form->setValues(Mage::registry('bannerslider_data')->getData());
62
+ }
63
+ return parent::_prepareForm();
64
+ }
65
+ }
app/code/community/Magestore/BannerSlider/Block/Adminhtml/BannerSlider/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_BannerSlider_Block_Adminhtml_BannerSlider_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('bannerslider_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('bannerslider')->__('Item Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('bannerslider')->__('Item Information'),
18
+ 'title' => Mage::helper('bannerslider')->__('Item Information'),
19
+ 'content' => $this->getLayout()->createBlock('bannerslider/adminhtml_bannerslider_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/community/Magestore/BannerSlider/Block/Adminhtml/BannerSlider/Grid.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_BannerSlider_Block_Adminhtml_BannerSlider_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('bannersliderGrid');
9
+ $this->setDefaultSort('bannerslider_id');
10
+ $this->setDefaultDir('ASC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('bannerslider/bannerslider')->getCollection();
17
+ $this->setCollection($collection);
18
+ return parent::_prepareCollection();
19
+ }
20
+
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn('bannerslider_id', array(
24
+ 'header' => Mage::helper('bannerslider')->__('ID'),
25
+ 'align' =>'right',
26
+ 'width' => '50px',
27
+ 'index' => 'bannerslider_id',
28
+ ));
29
+
30
+ $this->addColumn('title', array(
31
+ 'header' => Mage::helper('bannerslider')->__('Title'),
32
+ 'align' =>'left',
33
+ 'index' => 'title',
34
+ ));
35
+
36
+ /*
37
+ $this->addColumn('content', array(
38
+ 'header' => Mage::helper('bannerslider')->__('Item Content'),
39
+ 'width' => '150px',
40
+ 'index' => 'content',
41
+ ));
42
+ */
43
+
44
+ $this->addColumn('status', array(
45
+ 'header' => Mage::helper('bannerslider')->__('Status'),
46
+ 'align' => 'left',
47
+ 'width' => '80px',
48
+ 'index' => 'status',
49
+ 'type' => 'options',
50
+ 'options' => array(
51
+ 1 => 'Enabled',
52
+ 2 => 'Disabled',
53
+ ),
54
+ ));
55
+
56
+ $this->addColumn('action',
57
+ array(
58
+ 'header' => Mage::helper('bannerslider')->__('Action'),
59
+ 'width' => '100',
60
+ 'type' => 'action',
61
+ 'getter' => 'getId',
62
+ 'actions' => array(
63
+ array(
64
+ 'caption' => Mage::helper('bannerslider')->__('Edit'),
65
+ 'url' => array('base'=> '*/*/edit'),
66
+ 'field' => 'id'
67
+ )
68
+ ),
69
+ 'filter' => false,
70
+ 'sortable' => false,
71
+ 'index' => 'stores',
72
+ 'is_system' => true,
73
+ ));
74
+
75
+ $this->addExportType('*/*/exportCsv', Mage::helper('bannerslider')->__('CSV'));
76
+ $this->addExportType('*/*/exportXml', Mage::helper('bannerslider')->__('XML'));
77
+
78
+ return parent::_prepareColumns();
79
+ }
80
+
81
+ protected function _prepareMassaction()
82
+ {
83
+ $this->setMassactionIdField('bannerslider_id');
84
+ $this->getMassactionBlock()->setFormFieldName('bannerslider');
85
+
86
+ $this->getMassactionBlock()->addItem('delete', array(
87
+ 'label' => Mage::helper('bannerslider')->__('Delete'),
88
+ 'url' => $this->getUrl('*/*/massDelete'),
89
+ 'confirm' => Mage::helper('bannerslider')->__('Are you sure?')
90
+ ));
91
+
92
+ $statuses = Mage::getSingleton('bannerslider/status')->getOptionArray();
93
+
94
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
95
+ $this->getMassactionBlock()->addItem('status', array(
96
+ 'label'=> Mage::helper('bannerslider')->__('Change status'),
97
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
98
+ 'additional' => array(
99
+ 'visibility' => array(
100
+ 'name' => 'status',
101
+ 'type' => 'select',
102
+ 'class' => 'required-entry',
103
+ 'label' => Mage::helper('bannerslider')->__('Status'),
104
+ 'values' => $statuses
105
+ )
106
+ )
107
+ ));
108
+ return $this;
109
+ }
110
+
111
+ public function getRowUrl($row)
112
+ {
113
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
114
+ }
115
+
116
+ }
app/code/community/Magestore/BannerSlider/Block/BannerSlider.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_BannerSlider_Block_BannerSlider extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function getBannerSlider()
10
+ {
11
+ if (!$this->hasData('bannerslider')) {
12
+ $this->setData('bannerslider', Mage::registry('bannerslider'));
13
+ }
14
+ return $this->getData('bannerslider');
15
+
16
+ }
17
+ }
app/code/community/Magestore/BannerSlider/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_BannerSlider_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/Magestore/BannerSlider/Model/BannerSlider.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_BannerSlider_Model_BannerSlider extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('bannerslider/bannerslider');
9
+ }
10
+ }
app/code/community/Magestore/BannerSlider/Model/Mysql4/BannerSlider.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_BannerSlider_Model_Mysql4_BannerSlider extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the bannerslider_id refers to the key field in your database table.
8
+ $this->_init('bannerslider/bannerslider', 'bannerslider_id');
9
+ }
10
+ }
app/code/community/Magestore/BannerSlider/Model/Mysql4/BannerSlider/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_BannerSlider_Model_Mysql4_BannerSlider_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('bannerslider/bannerslider');
9
+ }
10
+ }
app/code/community/Magestore/BannerSlider/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_BannerSlider_Model_Status extends Varien_Object
4
+ {
5
+ const STATUS_ENABLED = 1;
6
+ const STATUS_DISABLED = 2;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_ENABLED => Mage::helper('bannerslider')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('bannerslider')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/community/Magestore/BannerSlider/controllers/Adminhtml/BannerSliderController.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_BannerSlider_Adminhtml_BannerSliderController extends Mage_Adminhtml_Controller_action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('bannerslider/items')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+ }
18
+
19
+ public function editAction() {
20
+ $id = $this->getRequest()->getParam('id');
21
+ $model = Mage::getModel('bannerslider/bannerslider')->load($id);
22
+
23
+ if ($model->getId() || $id == 0) {
24
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
25
+ if (!empty($data)) {
26
+ $model->setData($data);
27
+ }
28
+
29
+ Mage::register('bannerslider_data', $model);
30
+
31
+ $this->loadLayout();
32
+ $this->_setActiveMenu('bannerslider/items');
33
+
34
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
35
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
36
+
37
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
38
+
39
+ $this->_addContent($this->getLayout()->createBlock('bannerslider/adminhtml_bannerslider_edit'))
40
+ ->_addLeft($this->getLayout()->createBlock('bannerslider/adminhtml_bannerslider_edit_tabs'));
41
+
42
+ $this->renderLayout();
43
+ } else {
44
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('bannerslider')->__('Item does not exist'));
45
+ $this->_redirect('*/*/');
46
+ }
47
+ }
48
+
49
+ public function newAction() {
50
+ $this->_forward('edit');
51
+ }
52
+
53
+ public function saveAction() {
54
+ if ($data = $this->getRequest()->getPost()) {
55
+
56
+ if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
57
+ try {
58
+ /* Starting upload */
59
+ $uploader = new Varien_File_Uploader('filename');
60
+
61
+ // Any extention would work
62
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
63
+ $uploader->setAllowRenameFiles(false);
64
+
65
+ // Set the file upload mode
66
+ // false -> get the file directly in the specified folder
67
+ // true -> get the file in the product like folders
68
+ // (file.jpg will go in something like /media/f/i/file.jpg)
69
+ $uploader->setFilesDispersion(false);
70
+
71
+ // We set media as the upload dir
72
+ $path = Mage::getBaseDir('media') . DS ;
73
+ $uploader->save($path, $_FILES['filename']['name'] );
74
+
75
+ } catch (Exception $e) {
76
+
77
+ }
78
+
79
+ //this way the name is saved in DB
80
+ $data['filename'] = $_FILES['filename']['name'];
81
+ }
82
+
83
+
84
+ $model = Mage::getModel('bannerslider/bannerslider');
85
+ $model->setData($data)
86
+ ->setId($this->getRequest()->getParam('id'));
87
+
88
+ try {
89
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
90
+ $model->setCreatedTime(now())
91
+ ->setUpdateTime(now());
92
+ } else {
93
+ $model->setUpdateTime(now());
94
+ }
95
+
96
+ $model->save();
97
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('bannerslider')->__('Item was successfully saved'));
98
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
99
+
100
+ if ($this->getRequest()->getParam('back')) {
101
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
102
+ return;
103
+ }
104
+ $this->_redirect('*/*/');
105
+ return;
106
+ } catch (Exception $e) {
107
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
108
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
109
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
110
+ return;
111
+ }
112
+ }
113
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('bannerslider')->__('Unable to find item to save'));
114
+ $this->_redirect('*/*/');
115
+ }
116
+
117
+ public function deleteAction() {
118
+ if( $this->getRequest()->getParam('id') > 0 ) {
119
+ try {
120
+ $model = Mage::getModel('bannerslider/bannerslider');
121
+
122
+ $model->setId($this->getRequest()->getParam('id'))
123
+ ->delete();
124
+
125
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
126
+ $this->_redirect('*/*/');
127
+ } catch (Exception $e) {
128
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
129
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
130
+ }
131
+ }
132
+ $this->_redirect('*/*/');
133
+ }
134
+
135
+ public function massDeleteAction() {
136
+ $bannersliderIds = $this->getRequest()->getParam('bannerslider');
137
+ if(!is_array($bannersliderIds)) {
138
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
139
+ } else {
140
+ try {
141
+ foreach ($bannersliderIds as $bannersliderId) {
142
+ $bannerslider = Mage::getModel('bannerslider/bannerslider')->load($bannersliderId);
143
+ $bannerslider->delete();
144
+ }
145
+ Mage::getSingleton('adminhtml/session')->addSuccess(
146
+ Mage::helper('adminhtml')->__(
147
+ 'Total of %d record(s) were successfully deleted', count($bannersliderIds)
148
+ )
149
+ );
150
+ } catch (Exception $e) {
151
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
152
+ }
153
+ }
154
+ $this->_redirect('*/*/index');
155
+ }
156
+
157
+ public function massStatusAction()
158
+ {
159
+ $bannersliderIds = $this->getRequest()->getParam('bannerslider');
160
+ if(!is_array($bannersliderIds)) {
161
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
162
+ } else {
163
+ try {
164
+ foreach ($bannersliderIds as $bannersliderId) {
165
+ $bannerslider = Mage::getSingleton('bannerslider/bannerslider')
166
+ ->load($bannersliderId)
167
+ ->setStatus($this->getRequest()->getParam('status'))
168
+ ->setIsMassupdate(true)
169
+ ->save();
170
+ }
171
+ $this->_getSession()->addSuccess(
172
+ $this->__('Total of %d record(s) were successfully updated', count($bannersliderIds))
173
+ );
174
+ } catch (Exception $e) {
175
+ $this->_getSession()->addError($e->getMessage());
176
+ }
177
+ }
178
+ $this->_redirect('*/*/index');
179
+ }
180
+
181
+ public function exportCsvAction()
182
+ {
183
+ $fileName = 'bannerslider.csv';
184
+ $content = $this->getLayout()->createBlock('bannerslider/adminhtml_bannerslider_grid')
185
+ ->getCsv();
186
+
187
+ $this->_sendUploadResponse($fileName, $content);
188
+ }
189
+
190
+ public function exportXmlAction()
191
+ {
192
+ $fileName = 'bannerslider.xml';
193
+ $content = $this->getLayout()->createBlock('bannerslider/adminhtml_bannerslider_grid')
194
+ ->getXml();
195
+
196
+ $this->_sendUploadResponse($fileName, $content);
197
+ }
198
+
199
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
200
+ {
201
+ $response = $this->getResponse();
202
+ $response->setHeader('HTTP/1.1 200 OK','');
203
+ $response->setHeader('Pragma', 'public', true);
204
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
205
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
206
+ $response->setHeader('Last-Modified', date('r'));
207
+ $response->setHeader('Accept-Ranges', 'bytes');
208
+ $response->setHeader('Content-Length', strlen($content));
209
+ $response->setHeader('Content-type', $contentType);
210
+ $response->setBody($content);
211
+ $response->sendResponse();
212
+ die;
213
+ }
214
+ }
app/code/community/Magestore/BannerSlider/controllers/IndexController.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_BannerSlider_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+
7
+ /*
8
+ * Load an object by id
9
+ * Request looking like:
10
+ * http://site.com/bannerslider?id=15
11
+ * or
12
+ * http://site.com/bannerslider/id/15
13
+ */
14
+ /*
15
+ $bannerslider_id = $this->getRequest()->getParam('id');
16
+
17
+ if($bannerslider_id != null && $bannerslider_id != '') {
18
+ $bannerslider = Mage::getModel('bannerslider/bannerslider')->load($bannerslider_id)->getData();
19
+ } else {
20
+ $bannerslider = null;
21
+ }
22
+ */
23
+
24
+ /*
25
+ * If no param we load a the last created item
26
+ */
27
+ /*
28
+ if($bannerslider == null) {
29
+ $resource = Mage::getSingleton('core/resource');
30
+ $read= $resource->getConnection('core_read');
31
+ $bannersliderTable = $resource->getTableName('bannerslider');
32
+
33
+ $select = $read->select()
34
+ ->from($bannersliderTable,array('bannerslider_id','title','content','status'))
35
+ ->where('status',1)
36
+ ->order('created_time DESC') ;
37
+
38
+ $bannerslider = $read->fetchRow($select);
39
+ }
40
+ Mage::register('bannerslider', $bannerslider);
41
+ */
42
+
43
+
44
+ $this->loadLayout();
45
+ $this->renderLayout();
46
+ }
47
+ }
app/code/community/Magestore/BannerSlider/etc/config.xml ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magestore_BannerSlider>
5
+ <version>0.1.0</version>
6
+ </Magestore_BannerSlider>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <bannerslider>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Magestore_BannerSlider</module>
14
+ <frontName>bannerslider</frontName>
15
+ </args>
16
+ </bannerslider>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <bannerslider>
21
+ <file>bannerslider.xml</file>
22
+ </bannerslider>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <bannerslider>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>Magestore_BannerSlider</module>
32
+ <frontName>bannerslider</frontName>
33
+ </args>
34
+ </bannerslider>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+ <menu>
39
+ <bannerslider module="bannerslider">
40
+ <title>BannerSlider</title>
41
+ <sort_order>71</sort_order>
42
+ <children>
43
+ <items module="bannerslider">
44
+ <title>Manage Items</title>
45
+ <sort_order>0</sort_order>
46
+ <action>bannerslider/adminhtml_bannerslider</action>
47
+ </items>
48
+ </children>
49
+ </bannerslider>
50
+ </menu>
51
+ <acl>
52
+ <resources>
53
+ <all>
54
+ <title>Allow Everything</title>
55
+ </all>
56
+ <admin>
57
+ <children>
58
+ <Magestore_BannerSlider>
59
+ <title>BannerSlider Module</title>
60
+ <sort_order>10</sort_order>
61
+ </Magestore_BannerSlider>
62
+ <system>
63
+ <children>
64
+ <config>
65
+ <children>
66
+ <bannerslider translate="title" module="bannerslider">
67
+ <title>Banner Slider Settings</title>
68
+ <sort_order>50</sort_order>
69
+ </bannerslider>
70
+ </children>
71
+ </config>
72
+ </children>
73
+ </system>
74
+ </children>
75
+ </admin>
76
+ </resources>
77
+ </acl>
78
+ <layout>
79
+ <updates>
80
+ <bannerslider>
81
+ <file>bannerslider.xml</file>
82
+ </bannerslider>
83
+ </updates>
84
+ </layout>
85
+ </adminhtml>
86
+ <global>
87
+ <models>
88
+ <bannerslider>
89
+ <class>Magestore_BannerSlider_Model</class>
90
+ <resourceModel>bannerslider_mysql4</resourceModel>
91
+ </bannerslider>
92
+ <bannerslider_mysql4>
93
+ <class>Magestore_BannerSlider_Model_Mysql4</class>
94
+ <entities>
95
+ <bannerslider>
96
+ <table>bannerslider</table>
97
+ </bannerslider>
98
+ </entities>
99
+ </bannerslider_mysql4>
100
+ </models>
101
+ <resources>
102
+ <bannerslider_setup>
103
+ <setup>
104
+ <module>Magestore_BannerSlider</module>
105
+ </setup>
106
+ <connection>
107
+ <use>core_setup</use>
108
+ </connection>
109
+ </bannerslider_setup>
110
+ <bannerslider_write>
111
+ <connection>
112
+ <use>core_write</use>
113
+ </connection>
114
+ </bannerslider_write>
115
+ <bannerslider_read>
116
+ <connection>
117
+ <use>core_read</use>
118
+ </connection>
119
+ </bannerslider_read>
120
+ </resources>
121
+ <blocks>
122
+ <bannerslider>
123
+ <class>Magestore_BannerSlider_Block</class>
124
+ </bannerslider>
125
+ </blocks>
126
+ <helpers>
127
+ <bannerslider>
128
+ <class>Magestore_BannerSlider_Helper</class>
129
+ </bannerslider>
130
+ </helpers>
131
+ </global>
132
+ </config>
app/code/community/Magestore/BannerSlider/etc/system.xml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <bannerslider translate="label" module="bannerslider">
5
+ <label>Banner Slider</label>
6
+ <tab>general</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>999</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>0</show_in_website>
11
+ <show_in_store>0</show_in_store>
12
+ <groups>
13
+ <settings translate="label">
14
+ <label>Banner Slider Settings</label>
15
+ <frontend_type>text</frontend_type>
16
+ <sort_order>1</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>0</show_in_website>
19
+ <show_in_store>0</show_in_store>
20
+ <fields>
21
+ <time_delay translate="label, comment">
22
+ <label>Time Display per Image</label>
23
+ <comment><![CDATA[in second]]></comment>
24
+ <frontend_type>text</frontend_type>
25
+ <sort_order>1</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>0</show_in_website>
28
+ <show_in_store>0</show_in_store>
29
+ </time_delay>
30
+ <show_description translate="label, comment">
31
+ <label>Show description</label>
32
+ <comment><![CDATA[show description in front of image]]></comment>
33
+ <frontend_type>select</frontend_type>
34
+ <source_model>adminhtml/system_config_source_yesno</source_model>
35
+ <sort_order>2</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ </show_description>
40
+ </fields>
41
+ </settings>
42
+ </groups>
43
+ </bannerslider>
44
+ </sections>
45
+ </config>
app/code/community/Magestore/BannerSlider/sql/bannerslider_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ -- DROP TABLE IF EXISTS {$this->getTable('bannerslider')};
10
+ CREATE TABLE {$this->getTable('bannerslider')} (
11
+ `bannerslider_id` int(11) unsigned NOT NULL auto_increment,
12
+ `title` varchar(255) NOT NULL default '',
13
+ `filename` varchar(255) NOT NULL default '',
14
+ `content` text NULL,
15
+ `status` smallint(6) NOT NULL default '0',
16
+ `weblink` varchar(255) NULL,
17
+ `created_time` datetime NULL,
18
+ `update_time` datetime NULL,
19
+ PRIMARY KEY (`bannerslider_id`)
20
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
21
+
22
+ ");
23
+
24
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/bannerslider.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <bannerslider_adminhtml_bannerslider_index>
4
+ <reference name="content">
5
+ <block type="bannerslider/adminhtml_bannerslider" name="bannerslider" />
6
+ </reference>
7
+ </bannerslider_adminhtml_bannerslider_index>
8
+ </layout>
app/design/frontend/default/default/layout/bannerslider.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <bannerslider_index_index>
6
+ <reference name="content">
7
+ <block type="bannerslider/bannerslider" name="bannerslider" template="bannerslider/bannerslider.phtml" />
8
+ </reference>
9
+ </bannerslider_index_index>
10
+ </layout>
app/design/frontend/default/default/template/bannerslider/bannerslider.phtml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript" src="<?php echo $this->getSkinUrl('banner/ajaxtabs.js') ?>"></script>
2
+ <link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('banner/banner.css');?>" media="all" />
3
+ <?php
4
+ $bannerCollection = Mage::getModel('bannerslider/bannerslider')->getCollection();
5
+ $configData = Mage::getStoreConfig('bannerslider');
6
+ $i = 0;
7
+ ?>
8
+ <div class="slide-container">
9
+ <div class="slide-show" id="slide-images">
10
+ <div id="pettabs" class="indentmenu">
11
+ <ul>
12
+ <?php
13
+ foreach($bannerCollection as $banner):
14
+ $i++;
15
+ ?>
16
+ <li><a href="#" rel="tab<?php echo $i;?>" <?php if ($i == 1) { echo 'class="selected"'; }?>><?php echo $i;?></a></li>
17
+ <?php
18
+ endforeach;
19
+ ?>
20
+ </ul>
21
+ </div>
22
+ <div style="width:240px;text-align:justify;padding: 5px; margin-bottom:1em">
23
+ <?php
24
+ $i = 0;
25
+ foreach ($bannerCollection as $banner):
26
+ $i++;
27
+ ?>
28
+ <div id="tab<?php echo $i;?>" class="tabcontent">
29
+ <a href="<?php echo $banner['weblink'];?>">
30
+ <img title="<?php echo $banner['title']?>" alt="<?php echo $banner['title']?>" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . $banner['filename']?>" alt="" style="width:442px; height:232px;"/>
31
+ <?php if ($configData['settings']['show_description'] == '1'):?>
32
+ <div class="banner_content"><p><?php echo $banner['content']; ?></p></div>
33
+ <?php endif;?>
34
+ </a>
35
+ </div>
36
+ <?php
37
+ endforeach;
38
+ ?>
39
+ </div>
40
+ </div>
41
+ </div>
42
+ <?php
43
+ $timeDelay = $configData['settings']['time_delay'] * 1000;
44
+ ?>
45
+ <script type="text/javascript">
46
+ <?php
47
+ echo 'var delay = ' . $timeDelay . ';';
48
+ ?>
49
+ var mypets=new ddtabcontent("pettabs");
50
+ mypets.setpersist(true);
51
+ mypets.setselectedClassTarget("link");
52
+ mypets.init(delay);
53
+ </script>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>magestore_bannerslider</name>
4
+ <version>0.1.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>Banner slider</summary>
10
+ <description>banner slider</description>
11
+ <notes>Banner slider</notes>
12
+ <authors><author><name>Magestore</name><user>auto-converted</user><email>magestore@gmail.com</email></author></authors>
13
+ <date>2009-08-27</date>
14
+ <time>08:15:48</time>
15
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="bannerslider.xml" hash="821d565ea6febc6639cf1e45cb35d73c"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="bannerslider.xml" hash="d5ca32a732abc33650c2134bd2bd9317"/></dir><dir name="template"><dir name="bannerslider"><file name="bannerslider.phtml" hash="f5bffe8b9fb8f0cf4480105d094f334b"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="banner"><file name="ajaxtabs.js" hash="d8f9c4444580d285972803eed7392b8f"/><file name="banner.css" hash="e4186a5d5d445f618dec0fbbf913ad4b"/></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Magestore"><dir name="BannerSlider"><dir name="Block"><file name="BannerSlider.php" hash="f3bf48266d8f25d953a6348450a6c5b0"/><dir name="Adminhtml"><file name="BannerSlider.php" hash="e86be47915b2c5c783d4f8dd76053731"/><dir name="BannerSlider"><file name="Edit.php" hash="27a03b7d9edb304bb252161010ad42fc"/><file name="Grid.php" hash="2371fcc3c951f85963e8d566ff1e2c1b"/><dir name="Edit"><file name="Form.php" hash="fc27dd66ff454e7bec3230f6330bf312"/><file name="Tabs.php" hash="d482e9de0cbcff022e32100f046cf6a3"/><dir name="Tab"><file name="Form.php" hash="89226c11bd7924bec072e197305914eb"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="2701fd2d647d293e88c053875e8f62b3"/><dir name="Adminhtml"><file name="BannerSliderController.php" hash="546c4568affb2261ca474839f18601b2"/></dir></dir><dir name="etc"><file name="config.xml" hash="33e9642a5ea95cc6b6dc994fccfce1c0"/><file name="system.xml" hash="6304214d37e0aabd07858cc6be2a497c"/></dir><dir name="Helper"><file name="Data.php" hash="b8c6363b2e92df2a9c6675d93d14121f"/></dir><dir name="Model"><file name="BannerSlider.php" hash="b18b5aa6549e5ff16dcb1c3cff2e8aa6"/><file name="Status.php" hash="db55a762e08db515c8b1d371c54ceb23"/><dir name="Mysql4"><file name="BannerSlider.php" hash="1438dab305a87c9849be64043cdbf905"/><dir name="BannerSlider"><file name="Collection.php" hash="6a527b1b22c92802bacfe432ec265d65"/></dir></dir></dir><dir name="sql"><dir name="bannerslider_setup"><file name="mysql4-install-0.1.0.php" hash="5ac865813c0301833363f20a9dcf59c9"/></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>
skin/frontend/default/default/banner/ajaxtabs.js ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //** Tab Content script v2.0- � Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
2
+ //** Updated Oct 7th, 07 to version 2.0. Contains numerous improvements:
3
+ // -Added Auto Mode: Script auto rotates the tabs based on an interval, until a tab is explicitly selected
4
+ // -Ability to expand/contract arbitrary DIVs on the page as the tabbed content is expanded/ contracted
5
+ // -Ability to dynamically select a tab either based on its position within its peers, or its ID attribute (give the target tab one 1st)
6
+ // -Ability to set where the CSS classname "selected" get assigned- either to the target tab's link ("A"), or its parent container
7
+ //** Updated Feb 18th, 08 to version 2.1: Adds a "tabinstance.cycleit(dir)" method to cycle forward or backward between tabs dynamically
8
+ //** Updated April 8th, 08 to version 2.2: Adds support for expanding a tab using a URL parameter (ie: http://mysite.com/tabcontent.htm?tabinterfaceid=0)
9
+
10
+ ////NO NEED TO EDIT BELOW////////////////////////
11
+
12
+ function ddtabcontent(tabinterfaceid){
13
+ this.tabinterfaceid=tabinterfaceid //ID of Tab Menu main container
14
+ this.tabs=document.getElementById(tabinterfaceid).getElementsByTagName("a") //Get all tab links within container
15
+ this.enabletabpersistence=true
16
+ this.hottabspositions=[] //Array to store position of tabs that have a "rel" attr defined, relative to all tab links, within container
17
+ this.currentTabIndex=0 //Index of currently selected hot tab (tab with sub content) within hottabspositions[] array
18
+ this.subcontentids=[] //Array to store ids of the sub contents ("rel" attr values)
19
+ this.revcontentids=[] //Array to store ids of arbitrary contents to expand/contact as well ("rev" attr values)
20
+ this.selectedClassTarget="link" //keyword to indicate which target element to assign "selected" CSS class ("linkparent" or "link")
21
+ }
22
+
23
+ ddtabcontent.getCookie=function(Name){
24
+ var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
25
+ if (document.cookie.match(re)) //if cookie found
26
+ return document.cookie.match(re)[0].split("=")[1] //return its value
27
+ return ""
28
+ }
29
+
30
+ ddtabcontent.setCookie=function(name, value){
31
+ document.cookie = name+"="+value+";path=/" //cookie value is domain wide (path=/)
32
+ }
33
+
34
+ ddtabcontent.prototype={
35
+
36
+ expandit:function(tabid_or_position){ //PUBLIC function to select a tab either by its ID or position(int) within its peers
37
+ this.cancelautorun() //stop auto cycling of tabs (if running)
38
+ var tabref=""
39
+ try{
40
+ if (typeof tabid_or_position=="string" && document.getElementById(tabid_or_position).getAttribute("rel")) //if specified tab contains "rel" attr
41
+ tabref=document.getElementById(tabid_or_position)
42
+ else if (parseInt(tabid_or_position)!=NaN && this.tabs[tabid_or_position].getAttribute("rel")) //if specified tab contains "rel" attr
43
+ tabref=this.tabs[tabid_or_position]
44
+ }
45
+ catch(err){alert("Invalid Tab ID or position entered!")}
46
+ if (tabref!="") //if a valid tab is found based on function parameter
47
+ this.expandtab(tabref) //expand this tab
48
+ },
49
+
50
+ cycleit:function(dir, autorun){ //PUBLIC function to move foward or backwards through each hot tab (tabinstance.cycleit('foward/back') )
51
+ if (dir=="next"){
52
+ var currentTabIndex=(this.currentTabIndex<this.hottabspositions.length-1)? this.currentTabIndex+1 : 0
53
+ }
54
+ else if (dir=="prev"){
55
+ var currentTabIndex=(this.currentTabIndex>0)? this.currentTabIndex-1 : this.hottabspositions.length-1
56
+ }
57
+ if (typeof autorun=="undefined") //if cycleit() is being called by user, versus autorun() function
58
+ this.cancelautorun() //stop auto cycling of tabs (if running)
59
+ this.expandtab(this.tabs[this.hottabspositions[currentTabIndex]])
60
+ },
61
+
62
+ setpersist:function(bool){ //PUBLIC function to toggle persistence feature
63
+ this.enabletabpersistence=bool
64
+ },
65
+
66
+ setselectedClassTarget:function(objstr){ //PUBLIC function to set which target element to assign "selected" CSS class ("linkparent" or "link")
67
+ this.selectedClassTarget=objstr || "link"
68
+ },
69
+
70
+ getselectedClassTarget:function(tabref){ //Returns target element to assign "selected" CSS class to
71
+ return (this.selectedClassTarget==("linkparent".toLowerCase()))? tabref.parentNode : tabref
72
+ },
73
+
74
+ urlparamselect:function(tabinterfaceid){
75
+ var result=window.location.search.match(new RegExp(tabinterfaceid+"=(\\d+)", "i")) //check for "?tabinterfaceid=2" in URL
76
+ return (result==null)? null : parseInt(RegExp.$1) //returns null or index, where index (int) is the selected tab's index
77
+ },
78
+
79
+ expandtab:function(tabref){
80
+ var subcontentid=tabref.getAttribute("rel") //Get id of subcontent to expand
81
+ //Get "rev" attr as a string of IDs in the format ",john,george,trey,etc," to easily search through
82
+ var associatedrevids=(tabref.getAttribute("rev"))? ","+tabref.getAttribute("rev").replace(/\s+/, "")+"," : ""
83
+ this.expandsubcontent(subcontentid)
84
+ this.expandrevcontent(associatedrevids)
85
+ for (var i=0; i<this.tabs.length; i++){ //Loop through all tabs, and assign only the selected tab the CSS class "selected"
86
+ this.getselectedClassTarget(this.tabs[i]).className=(this.tabs[i].getAttribute("rel")==subcontentid)? "selected" : ""
87
+ }
88
+ if (this.enabletabpersistence) //if persistence enabled, save selected tab position(int) relative to its peers
89
+ ddtabcontent.setCookie(this.tabinterfaceid, tabref.tabposition)
90
+ this.setcurrenttabindex(tabref.tabposition) //remember position of selected tab within hottabspositions[] array
91
+ },
92
+
93
+ expandsubcontent:function(subcontentid){
94
+ for (var i=0; i<this.subcontentids.length; i++){
95
+ var subcontent=document.getElementById(this.subcontentids[i]) //cache current subcontent obj (in for loop)
96
+ subcontent.style.display=(subcontent.id==subcontentid)? "block" : "none" //"show" or hide sub content based on matching id attr value
97
+ }
98
+ },
99
+
100
+ expandrevcontent:function(associatedrevids){
101
+ var allrevids=this.revcontentids
102
+ for (var i=0; i<allrevids.length; i++){ //Loop through rev attributes for all tabs in this tab interface
103
+ //if any values stored within associatedrevids matches one within allrevids, expand that DIV, otherwise, contract it
104
+ document.getElementById(allrevids[i]).style.display=(associatedrevids.indexOf(","+allrevids[i]+",")!=-1)? "block" : "none"
105
+ }
106
+ },
107
+
108
+ setcurrenttabindex:function(tabposition){ //store current position of tab (within hottabspositions[] array)
109
+ for (var i=0; i<this.hottabspositions.length; i++){
110
+ if (tabposition==this.hottabspositions[i]){
111
+ this.currentTabIndex=i
112
+ break
113
+ }
114
+ }
115
+ },
116
+
117
+ autorun:function(){ //function to auto cycle through and select tabs based on a set interval
118
+ this.cycleit('next', true)
119
+ },
120
+
121
+ cancelautorun:function(){
122
+ if (typeof this.autoruntimer!="undefined")
123
+ clearInterval(this.autoruntimer)
124
+ },
125
+
126
+ init:function(automodeperiod){
127
+ var persistedtab=ddtabcontent.getCookie(this.tabinterfaceid) //get position of persisted tab (applicable if persistence is enabled)
128
+ var selectedtab=-1 //Currently selected tab index (-1 meaning none)
129
+ var selectedtabfromurl=this.urlparamselect(this.tabinterfaceid) //returns null or index from: tabcontent.htm?tabinterfaceid=index
130
+ this.automodeperiod=automodeperiod || 0
131
+ for (var i=0; i<this.tabs.length; i++){
132
+ this.tabs[i].tabposition=i //remember position of tab relative to its peers
133
+ if (this.tabs[i].getAttribute("rel")){
134
+ var tabinstance=this
135
+ this.hottabspositions[this.hottabspositions.length]=i //store position of "hot" tab ("rel" attr defined) relative to its peers
136
+ this.subcontentids[this.subcontentids.length]=this.tabs[i].getAttribute("rel") //store id of sub content ("rel" attr value)
137
+ this.tabs[i].onclick=function(){
138
+ tabinstance.expandtab(this)
139
+ tabinstance.cancelautorun() //stop auto cycling of tabs (if running)
140
+ return false
141
+ }
142
+ if (this.tabs[i].getAttribute("rev")){ //if "rev" attr defined, store each value within "rev" as an array element
143
+ this.revcontentids=this.revcontentids.concat(this.tabs[i].getAttribute("rev").split(/\s*,\s*/))
144
+ }
145
+ if (selectedtabfromurl==i || this.enabletabpersistence && selectedtab==-1 && parseInt(persistedtab)==i || !this.enabletabpersistence && selectedtab==-1 && this.getselectedClassTarget(this.tabs[i]).className=="selected"){
146
+ selectedtab=i //Selected tab index, if found
147
+ }
148
+ }
149
+ } //END for loop
150
+ if (selectedtab!=-1) //if a valid default selected tab index is found
151
+ this.expandtab(this.tabs[selectedtab]) //expand selected tab (either from URL parameter, persistent feature, or class="selected" class)
152
+ else //if no valid default selected index found
153
+ this.expandtab(this.tabs[this.hottabspositions[0]]) //Just select first tab that contains a "rel" attr
154
+ if (parseInt(this.automodeperiod)>500 && this.hottabspositions.length>1){
155
+ this.autoruntimer=setInterval(function(){tabinstance.autorun()}, this.automodeperiod)
156
+ }
157
+ } //END int() function
158
+
159
+ } //END Prototype assignment
skin/frontend/default/default/banner/banner.css ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .slide-container {
2
+ position:relative;
3
+ width:520px;
4
+
5
+ height:auto;
6
+ text-align:center;
7
+ margin:0px 0px 40px 0px;
8
+ padding-top:10px;
9
+ }
10
+
11
+ .slide-show{
12
+ background-position:center center;
13
+ background-repeat:no-repeat;
14
+ text-align:center;
15
+ height:260px;
16
+ width:520px;
17
+ position:relative;
18
+ left:10px;
19
+ }
20
+
21
+ .indentmenu{
22
+ font: bold 11px Arial;
23
+ width: 100%; /*leave this value as is in most cases*/
24
+ }
25
+
26
+ .indentmenu ul{
27
+ margin: 2px;
28
+ padding: 0;
29
+ float: left;
30
+ /* width: 80%; width of menu*/
31
+ background: transparent;
32
+ }
33
+
34
+ .indentmenu ul li{
35
+ display: inline;
36
+ }
37
+
38
+ .indentmenu ul li a{
39
+ float: left;
40
+ margin: 2px;
41
+ color: #000; /*text color*/
42
+ padding: 5px 11px;
43
+ text-decoration: none;
44
+ border: 1px solid #ccc;
45
+ }
46
+
47
+ .indentmenu ul li a:hover{
48
+ background:#ddd;
49
+ }
50
+
51
+ .indentmenu ul li a:visited{
52
+ color: #000;
53
+ }
54
+
55
+ .indentmenu ul li a.selected{
56
+ color: white !important;
57
+ padding-top: 6px; /*shift text down 1px*/
58
+ padding-bottom: 4px;
59
+ border: 1px solid #F85601;
60
+ background:#F85601;
61
+ }
62
+
63
+ .tabcontentstyle{ /*style of tab content container*/
64
+ border: 1px solid gray;
65
+ width: 450px;
66
+ margin-bottom: 1em;
67
+ padding: 10px;
68
+ }
69
+
70
+ .tabcontent{
71
+ display:none;
72
+ }
73
+
74
+ @media print {
75
+ .tabcontent {
76
+ display:block !important;
77
+ }
78
+ }
79
+
80
+ .banner_content {
81
+ width:430px;
82
+ left:10px;
83
+ top:220px;
84
+ position:absolute;
85
+ color:#A7C6DD;
86
+ }