MultiBanner_Module - Version 0.1.0

Version Notes

MultiBanner with Multiple Effects for Images and Html

Download this release

Release Info

Developer Unicode Systems
Extension MultiBanner_Module
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (90) hide show
  1. app/code/community/Uni/Banner/Block/Adminhtml/Banner.php +18 -0
  2. app/code/community/Uni/Banner/Block/Adminhtml/Banner/Edit.php +76 -0
  3. app/code/community/Uni/Banner/Block/Adminhtml/Banner/Edit/Form.php +26 -0
  4. app/code/community/Uni/Banner/Block/Adminhtml/Banner/Edit/Tab/Form.php +103 -0
  5. app/code/community/Uni/Banner/Block/Adminhtml/Banner/Edit/Tabs.php +27 -0
  6. app/code/community/Uni/Banner/Block/Adminhtml/Banner/Grid.php +143 -0
  7. app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup.php +19 -0
  8. app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup/Edit.php +67 -0
  9. app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup/Edit/Form.php +29 -0
  10. app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup/Edit/Tab/Banner.php +102 -0
  11. app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup/Edit/Tab/Form.php +161 -0
  12. app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup/Edit/Tab/Gridbanner.php +48 -0
  13. app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup/Edit/Tabs.php +34 -0
  14. app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup/Grid.php +177 -0
  15. app/code/community/Uni/Banner/Block/Adminhtml/Widget/Grid/Column.php +37 -0
  16. app/code/community/Uni/Banner/Block/Adminhtml/Widget/Grid/Column/Filter/Image.php +14 -0
  17. app/code/community/Uni/Banner/Block/Adminhtml/Widget/Grid/Column/Renderer/Action.php +45 -0
  18. app/code/community/Uni/Banner/Block/Adminhtml/Widget/Grid/Column/Renderer/Image.php +35 -0
  19. app/code/community/Uni/Banner/Block/Banner.php +65 -0
  20. app/code/community/Uni/Banner/Helper/Data.php +61 -0
  21. app/code/community/Uni/Banner/Model/Banner.php +41 -0
  22. app/code/community/Uni/Banner/Model/Bannergroup.php +31 -0
  23. app/code/community/Uni/Banner/Model/Bannerresize.php +239 -0
  24. app/code/community/Uni/Banner/Model/Mysql4/Banner.php +16 -0
  25. app/code/community/Uni/Banner/Model/Mysql4/Banner/Collection.php +16 -0
  26. app/code/community/Uni/Banner/Model/Mysql4/Bannergroup.php +35 -0
  27. app/code/community/Uni/Banner/Model/Mysql4/Bannergroup/Collection.php +24 -0
  28. app/code/community/Uni/Banner/Model/Status.php +116 -0
  29. app/code/community/Uni/Banner/Model/Wysiwyg/Config.php +45 -0
  30. app/code/community/Uni/Banner/controllers/Adminhtml/BannerController.php +238 -0
  31. app/code/community/Uni/Banner/controllers/Adminhtml/BannergroupController.php +223 -0
  32. app/code/community/Uni/Banner/controllers/IndexController.php +16 -0
  33. app/code/community/Uni/Banner/etc/config.xml +168 -0
  34. app/code/community/Uni/Banner/etc/system.xml +57 -0
  35. app/code/community/Uni/Banner/sql/banner_setup/mysql4-install-0.1.0.php +61 -0
  36. app/design/adminhtml/default/default/layout/unibanner.xml +25 -0
  37. app/design/adminhtml/default/default/template/unibanner/banners.phtml +59 -0
  38. app/design/frontend/default/default/layout/unibanner.xml +35 -0
  39. app/design/frontend/default/default/template/unibanner/banner.phtml +54 -0
  40. app/design/frontend/default/default/template/unibanner/effects/custom.phtml +66 -0
  41. app/design/frontend/default/default/template/unibanner/effects/horslider.phtml +82 -0
  42. app/design/frontend/default/default/template/unibanner/effects/numbered.phtml +87 -0
  43. app/design/frontend/default/default/template/unibanner/effects/playpause.phtml +90 -0
  44. app/design/frontend/default/default/template/unibanner/effects/slideshow.phtml +71 -0
  45. app/design/frontend/default/default/template/unibanner/effects/springslider.phtml +89 -0
  46. app/design/frontend/default/default/template/unibanner/effects/strans.phtml +73 -0
  47. app/design/frontend/default/default/template/unibanner/effects/textfade.phtml +64 -0
  48. app/design/frontend/default/default/template/unibanner/effects/verslider.phtml +85 -0
  49. app/etc/modules/Uni_Banner.xml +19 -0
  50. app/locale/en_US/Uni_Banner.csv +0 -0
  51. media/custom/banners/File-1300256573.jpg +0 -0
  52. media/custom/banners/File-1300256584.jpg +0 -0
  53. media/custom/banners/File-1300256596.jpg +0 -0
  54. media/custom/banners/File-1300256608.jpg +0 -0
  55. media/custom/banners/resize/home_banner/File-1300256573.jpg +0 -0
  56. media/custom/banners/resize/home_banner/File-1300256584.jpg +0 -0
  57. media/custom/banners/resize/home_banner/File-1300256596.jpg +0 -0
  58. media/custom/banners/resize/home_banner/File-1300256608.jpg +0 -0
  59. media/custom/banners/resize/left_banner/File-1300256584.jpg +0 -0
  60. media/custom/banners/resize/left_banner/File-1300256596.jpg +0 -0
  61. media/custom/banners/resize/left_banner/File-1300256608.jpg +0 -0
  62. package.xml +18 -0
  63. skin/frontend/default/default/unibanner/css/carousel.css +0 -0
  64. skin/frontend/default/default/unibanner/css/custom.css +22 -0
  65. skin/frontend/default/default/unibanner/css/glider.css +28 -0
  66. skin/frontend/default/default/unibanner/css/images/down.gif +0 -0
  67. skin/frontend/default/default/unibanner/css/images/next.gif +0 -0
  68. skin/frontend/default/default/unibanner/css/images/next.png +0 -0
  69. skin/frontend/default/default/unibanner/css/images/next1.gif +0 -0
  70. skin/frontend/default/default/unibanner/css/images/next1.png +0 -0
  71. skin/frontend/default/default/unibanner/css/images/play.gif +0 -0
  72. skin/frontend/default/default/unibanner/css/images/play.png +0 -0
  73. skin/frontend/default/default/unibanner/css/images/prev.gif +0 -0
  74. skin/frontend/default/default/unibanner/css/images/prev.png +0 -0
  75. skin/frontend/default/default/unibanner/css/images/stop.gif +0 -0
  76. skin/frontend/default/default/unibanner/css/images/stop.png +0 -0
  77. skin/frontend/default/default/unibanner/css/images/top.gif +0 -0
  78. skin/frontend/default/default/unibanner/css/noieopacity.css +22 -0
  79. skin/frontend/default/default/unibanner/css/opacityother.css +8 -0
  80. skin/frontend/default/default/unibanner/css/protoFlow.css +7 -0
  81. skin/frontend/default/default/unibanner/css/stylesban.css +20 -0
  82. skin/frontend/default/default/unibanner/js/ajaxtabs.js +160 -0
  83. skin/frontend/default/default/unibanner/js/carousel.js +327 -0
  84. skin/frontend/default/default/unibanner/js/crossfade.js +282 -0
  85. skin/frontend/default/default/unibanner/js/custom.js +31 -0
  86. skin/frontend/default/default/unibanner/js/glider.js +156 -0
  87. skin/frontend/default/default/unibanner/js/numbered.js +24 -0
  88. skin/frontend/default/default/unibanner/js/prettify.js +18 -0
  89. skin/frontend/default/default/unibanner/js/protoFlow.js +663 -0
  90. skin/frontend/default/default/unibanner/js/protofade.js +206 -0
app/code/community/Uni/Banner/Block/Adminhtml/Banner.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Block_Adminhtml_Banner extends Mage_Adminhtml_Block_Widget_Grid_Container {
10
+
11
+ public function __construct() {
12
+ $this->_controller = 'adminhtml_banner';
13
+ $this->_blockGroup = 'banner';
14
+ $this->_headerText = Mage::helper('banner')->__('Banner Manager');
15
+ $this->_addButtonLabel = Mage::helper('banner')->__('Add Banner Item');
16
+ parent::__construct();
17
+ }
18
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Banner/Edit.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Block_Adminhtml_Banner_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+
14
+ $this->_objectId = 'id';
15
+ $this->_blockGroup = 'banner';
16
+ $this->_controller = 'adminhtml_banner';
17
+
18
+ $this->_updateButton('save', 'label', Mage::helper('banner')->__('Save Item'));
19
+ $this->_updateButton('delete', 'label', Mage::helper('banner')->__('Delete Item'));
20
+
21
+ $this->_addButton('saveandcontinue', array(
22
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
23
+ 'onclick' => 'saveAndContinueEdit()',
24
+ 'class' => 'save',
25
+ ), -100);
26
+
27
+ $this->_formScripts[] = "
28
+ function toggleEditor() {
29
+ if (tinyMCE.getInstanceById('banner_content') == null) {
30
+ tinyMCE.execCommand('mceAddControl', false, 'banner_content');
31
+ } else {
32
+ tinyMCE.execCommand('mceRemoveControl', false, 'banner_content');
33
+ }
34
+ }
35
+
36
+ function saveAndContinueEdit(){
37
+ editForm.submit($('edit_form').action+'back/edit/');
38
+ }
39
+
40
+ function showTypeContents(){
41
+ var typeId=$('banner_type').value;
42
+ var show = ((typeId==0)?'block':'none');
43
+ var hide = ((typeId==0)?'none':'block');
44
+ $('filename').setStyle({display:show});
45
+ $('filename_delete').setStyle({display:show});
46
+ $('banner_content').setStyle({display:hide});
47
+ setTimeout('bannerContentType()',1000);
48
+ alert($('filename').getStyle('display'))
49
+ }
50
+
51
+ function bannerContentType(){
52
+ var typeId=$('banner_type').value;
53
+ var hide = ((typeId==0)?'none':'block');
54
+ $('buttonsbanner_content').setStyle({display:hide});
55
+ $('banner_content_parent').setStyle({display:hide});
56
+ }
57
+
58
+
59
+ /* Event.observe('banner_type', 'change', function(){
60
+ showTypeContents();
61
+ });
62
+ Event.observe(window, 'load', function(){
63
+ showTypeContents();
64
+ }); */
65
+ ";
66
+ }
67
+
68
+ public function getHeaderText() {
69
+ if (Mage::registry('banner_data') && Mage::registry('banner_data')->getId()) {
70
+ return Mage::helper('banner')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('banner_data')->getTitle()));
71
+ } else {
72
+ return Mage::helper('banner')->__('Add Item');
73
+ }
74
+ }
75
+
76
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Banner/Edit/Form.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Block_Adminhtml_Banner_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
10
+ {
11
+ protected function _prepareForm()
12
+ {
13
+ $form = new Varien_Data_Form(array(
14
+ 'id' => 'edit_form',
15
+
16
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
17
+ 'method' => 'post',
18
+ 'enctype' => 'multipart/form-data'
19
+ )
20
+ );
21
+
22
+ $form->setUseContainer(true);
23
+ $this->setForm($form);
24
+ return parent::_prepareForm();
25
+ }
26
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Banner/Edit/Tab/Form.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Banner
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ class Uni_Banner_Block_Adminhtml_Banner_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
11
+
12
+ protected function _prepareForm() {
13
+ $form = new Varien_Data_Form();
14
+ $this->setForm($form);
15
+ $fieldset = $form->addFieldset('banner_form', array('legend' => Mage::helper('banner')->__('Item information')));
16
+ $version = substr(Mage::getVersion(), 0, 3);
17
+ //$config = (($version == '1.4' || $version == '1.5') ? "'config' => Mage::getSingleton('banner/wysiwyg_config')->getConfig()" : "'class'=>''");
18
+
19
+ $fieldset->addField('title', 'text', array(
20
+ 'label' => Mage::helper('banner')->__('Title'),
21
+ 'class' => 'required-entry',
22
+ 'required' => true,
23
+ 'name' => 'title',
24
+ ));
25
+
26
+ $fieldset->addField('link', 'text', array(
27
+ 'label' => Mage::helper('banner')->__('Web Url'),
28
+ 'name' => 'link',
29
+ ));
30
+
31
+ $fieldset->addField('banner_type', 'select', array(
32
+ 'label' => Mage::helper('banner')->__('Type'),
33
+ 'name' => 'banner_type',
34
+ 'values' => array(
35
+ array(
36
+ 'value' => 0,
37
+ 'label' => Mage::helper('banner')->__('Image'),
38
+ ),
39
+ array(
40
+ 'value' => 1,
41
+ 'label' => Mage::helper('banner')->__('Html'),
42
+ ),
43
+ ),
44
+ ));
45
+
46
+ $fieldset->addField('filename', 'image', array(
47
+ 'label' => Mage::helper('banner')->__('Image'),
48
+ 'required' => false,
49
+ 'name' => 'filename',
50
+ ));
51
+
52
+ if ($version == '1.4' || $version == '1.5') {
53
+ $fieldset->addField('banner_content', 'editor', array(
54
+ 'name' => 'banner_content',
55
+ 'label' => Mage::helper('banner')->__('Content'),
56
+ 'title' => Mage::helper('banner')->__('Content'),
57
+ 'style' => 'width:600px; height:250px;',
58
+ 'config' => Mage::getSingleton('banner/wysiwyg_config')->getConfig(),
59
+ 'wysiwyg' => true,
60
+ 'required' => false,
61
+ ));
62
+ } else {
63
+ $fieldset->addField('banner_content', 'editor', array(
64
+ 'name' => 'banner_content',
65
+ 'label' => Mage::helper('cms')->__('Content'),
66
+ 'title' => Mage::helper('cms')->__('Content'),
67
+ 'style' => 'width:600px; height:250px;',
68
+ 'wysiwyg' => false,
69
+ 'required' => false,
70
+ ));
71
+ }
72
+
73
+ $fieldset->addField('sort_order', 'text', array(
74
+ 'label' => Mage::helper('banner')->__('Sort Order'),
75
+ 'name' => 'sort_order',
76
+ ));
77
+
78
+ $fieldset->addField('status', 'select', array(
79
+ 'label' => Mage::helper('banner')->__('Status'),
80
+ 'class' => 'required-entry',
81
+ 'name' => 'status',
82
+ 'values' => array(
83
+ array(
84
+ 'value' => 1,
85
+ 'label' => Mage::helper('banner')->__('Enabled'),
86
+ ),
87
+ array(
88
+ 'value' => 2,
89
+ 'label' => Mage::helper('banner')->__('Disabled'),
90
+ ),
91
+ ),
92
+ ));
93
+
94
+ if (Mage::getSingleton('adminhtml/session')->getBannerData()) {
95
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getBannerData());
96
+ Mage::getSingleton('adminhtml/session')->setBannerData(null);
97
+ } elseif (Mage::registry('banner_data')) {
98
+ $form->setValues(Mage::registry('banner_data')->getData());
99
+ }
100
+ return parent::_prepareForm();
101
+ }
102
+
103
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Banner/Edit/Tabs.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Block_Adminhtml_Banner_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+ $this->setId('banner_tabs');
14
+ $this->setDestElementId('edit_form');
15
+ $this->setTitle(Mage::helper('banner')->__('Item Information'));
16
+ }
17
+
18
+ protected function _beforeToHtml() {
19
+ $this->addTab('form_section', array(
20
+ 'label' => Mage::helper('banner')->__('Banner Information'),
21
+ 'alt' => Mage::helper('banner')->__('Banner information'),
22
+ 'content' => $this->getLayout()->createBlock('banner/adminhtml_banner_edit_tab_form')->toHtml(),
23
+ ));
24
+ return parent::_beforeToHtml();
25
+ }
26
+
27
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Banner/Grid.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Block_Adminhtml_Banner_Grid extends Mage_Adminhtml_Block_Widget_Grid {
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+ $this->setId('bannerGrid');
14
+ $this->setDefaultSort('banner_id');
15
+ $this->setDefaultDir('ASC');
16
+ $this->setSaveParametersInSession(true);
17
+ }
18
+
19
+ protected function _prepareCollection() {
20
+ $collection = Mage::getModel('banner/banner')->getCollection();
21
+ $this->setCollection($collection);
22
+ return parent::_prepareCollection();
23
+ }
24
+
25
+ protected function _prepareColumns() {
26
+ $this->addColumn('banner_id', array(
27
+ 'header' => Mage::helper('banner')->__('ID'),
28
+ 'align' => 'center',
29
+ 'width' => '30px',
30
+ 'index' => 'banner_id',
31
+ ));
32
+
33
+ $this->addColumn('filename', array(
34
+ 'header' => Mage::helper('banner')->__('Image'),
35
+ 'align' => 'center',
36
+ 'index' => 'filename',
37
+ 'type' => 'image',
38
+ 'escape' => true,
39
+ 'sortable' => false,
40
+ 'width' => '150px',
41
+ ));
42
+
43
+ $this->addColumn('title', array(
44
+ 'header' => Mage::helper('banner')->__('Title'),
45
+ 'index' => 'title',
46
+ ));
47
+
48
+ $this->addColumn('link', array(
49
+ 'header' => Mage::helper('banner')->__('Web Url'),
50
+ 'width' => '150px',
51
+ 'index' => 'link',
52
+ ));
53
+
54
+ $this->addColumn('banner_type', array(
55
+ 'header' => Mage::helper('banner')->__('Type'),
56
+ 'width' => '80px',
57
+ 'index' => 'banner_type',
58
+ 'type' => 'options',
59
+ 'options' => array(
60
+ 0 => 'Image',
61
+ 1 => 'Html',
62
+ ),
63
+ ));
64
+
65
+ $this->addColumn('sort_order', array(
66
+ 'header' => Mage::helper('banner')->__('Sort Order'),
67
+ 'width' => '80px',
68
+ 'index' => 'sort_order',
69
+ 'align' => 'center',
70
+ ));
71
+
72
+
73
+ $this->addColumn('status', array(
74
+ 'header' => Mage::helper('banner')->__('Status'),
75
+ 'align' => 'left',
76
+ 'width' => '80px',
77
+ 'index' => 'status',
78
+ 'type' => 'options',
79
+ 'options' => array(
80
+ 1 => 'Enabled',
81
+ 2 => 'Disabled',
82
+ ),
83
+ ));
84
+
85
+ $this->addColumn('action',
86
+ array(
87
+ 'header' => Mage::helper('banner')->__('Action'),
88
+ 'width' => '80',
89
+ 'type' => 'action',
90
+ 'getter' => 'getId',
91
+ 'actions' => array(
92
+ array(
93
+ 'caption' => Mage::helper('banner')->__('Edit'),
94
+ 'url' => array('base' => '*/*/edit'),
95
+ 'field' => 'id'
96
+ )
97
+ ),
98
+ 'filter' => false,
99
+ 'sortable' => false,
100
+ 'index' => 'stores',
101
+ 'is_system' => true,
102
+ ));
103
+
104
+ $this->addExportType('*/*/exportCsv', Mage::helper('banner')->__('CSV'));
105
+ $this->addExportType('*/*/exportXml', Mage::helper('banner')->__('XML'));
106
+
107
+ return parent::_prepareColumns();
108
+ }
109
+
110
+ protected function _prepareMassaction() {
111
+ $this->setMassactionIdField('banner_id');
112
+ $this->getMassactionBlock()->setFormFieldName('banner');
113
+
114
+ $this->getMassactionBlock()->addItem('delete', array(
115
+ 'label' => Mage::helper('banner')->__('Delete'),
116
+ 'url' => $this->getUrl('*/*/massDelete'),
117
+ 'confirm' => Mage::helper('banner')->__('Are you sure?')
118
+ ));
119
+
120
+ $statuses = Mage::getSingleton('banner/status')->getOptionArray();
121
+
122
+ array_unshift($statuses, array('label' => '', 'value' => ''));
123
+ $this->getMassactionBlock()->addItem('status', array(
124
+ 'label' => Mage::helper('banner')->__('Change status'),
125
+ 'url' => $this->getUrl('*/*/massStatus', array('_current' => true)),
126
+ 'additional' => array(
127
+ 'visibility' => array(
128
+ 'name' => 'status',
129
+ 'type' => 'select',
130
+ 'class' => 'required-entry',
131
+ 'label' => Mage::helper('banner')->__('Status'),
132
+ 'values' => $statuses
133
+ )
134
+ )
135
+ ));
136
+ return $this;
137
+ }
138
+
139
+ public function getRowUrl($row) {
140
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
141
+ }
142
+
143
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Block_Adminhtml_Bannergroup extends Mage_Adminhtml_Block_Widget_Grid_Container {
10
+
11
+ public function __construct() {
12
+ $this->_controller = 'adminhtml_bannergroup';
13
+ $this->_blockGroup = 'banner';
14
+ $this->_headerText = Mage::helper('banner')->__('Banner Group Manager');
15
+ $this->_addButtonLabel = Mage::helper('banner')->__('Add Banner Group');
16
+ parent::__construct();
17
+ }
18
+
19
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup/Edit.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Block_Adminhtml_Bannergroup_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+
14
+ $this->_objectId = 'id';
15
+ $this->_blockGroup = 'banner';
16
+ $this->_controller = 'adminhtml_bannergroup';
17
+
18
+ $this->_updateButton('save', 'label', Mage::helper('banner')->__('Save Item'));
19
+ $this->_updateButton('delete', 'label', Mage::helper('banner')->__('Delete Item'));
20
+
21
+ $this->_addButton('saveandcontinue', array(
22
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
23
+ 'onclick' => 'saveAndContinueEdit()',
24
+ 'class' => 'save',
25
+ ), -100);
26
+
27
+ $this->_formScripts[] = "
28
+ function toggleEditor() {
29
+ if (tinyMCE.getInstanceById('banner_content') == null) {
30
+ tinyMCE.execCommand('mceAddControl', false, 'banner_content');
31
+ } else {
32
+ tinyMCE.execCommand('mceRemoveControl', false, 'banner_content');
33
+ }
34
+ }
35
+
36
+ function saveAndContinueEdit(){
37
+ editForm.submit($('edit_form').action+'back/edit/');
38
+ }
39
+
40
+ function showBannerEfects(){
41
+ var typeId=$('animation_type').value;
42
+ var reqClass = ((typeId==1)?'required-entry':'');
43
+ var preReqClass = ((typeId==1)?'':'required-entry');
44
+ $('banner_effects').disabled = ((typeId==1)?false:true);
45
+ $('pre_banner_effects').disabled = ((typeId==1)?true:false);
46
+ $('banner_effects').addClassName(reqClass);
47
+ $('pre_banner_effects').addClassName(preReqClass);
48
+ }
49
+
50
+ Event.observe('animation_type', 'change', function(){
51
+ showBannerEfects();
52
+ });
53
+ Event.observe(window, 'load', function(){
54
+ showBannerEfects();
55
+ });
56
+ ";
57
+ }
58
+
59
+ public function getHeaderText() {
60
+ if (Mage::registry('bannergroup_data') && Mage::registry('bannergroup_data')->getId()) {
61
+ return Mage::helper('banner')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('bannergroup_data')->getGroupName()));
62
+ } else {
63
+ return Mage::helper('banner')->__('Add Item');
64
+ }
65
+ }
66
+
67
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup/Edit/Form.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Block_Adminhtml_Bannergroup_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
10
+
11
+ protected function _prepareForm() {
12
+ $form = new Varien_Data_Form(array(
13
+ 'id' => 'edit_form',
14
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
15
+ 'method' => 'post',
16
+ 'enctype' => 'multipart/form-data'
17
+ )
18
+ );
19
+
20
+ $form->setUseContainer(true);
21
+ $this->setForm($form);
22
+ $form->addField('in_bannergroup_banners', 'hidden', array(
23
+ 'name' => 'bannergroup_banners',
24
+ 'required' => false,
25
+ ));
26
+ return parent::_prepareForm();
27
+ }
28
+
29
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup/Edit/Tab/Banner.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Block_Adminhtml_Bannergroup_Edit_Tab_Banner extends Mage_Adminhtml_Block_Widget_Grid {
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+ $this->setId('bannerLeftGrid');
14
+ $this->setDefaultSort('banner_id');
15
+ $this->setUseAjax(true);
16
+ }
17
+
18
+ public function getBannergroupData() {
19
+ return Mage::registry('bannergroup_data');
20
+ }
21
+
22
+ protected function _prepareCollection() {
23
+ $collection = Mage::getModel('banner/banner')->getCollection();
24
+ $collection->getSelect()->order('banner_id');
25
+ $this->setCollection($collection);
26
+ return parent::_prepareCollection();
27
+ }
28
+
29
+ protected function _prepareColumns() {
30
+ $this->addColumn('banner_triggers', array(
31
+ 'header_css_class' => 'a-center',
32
+ 'type' => 'checkbox',
33
+ 'values' => $this->_getSelectedBanners(),
34
+ 'align' => 'center',
35
+ 'index' => 'banner_id'
36
+ ));
37
+ $this->addColumn('banner_id', array(
38
+ 'header' => Mage::helper('catalog')->__('ID'),
39
+ 'sortable' => true,
40
+ 'width' => '50',
41
+ 'align' => 'center',
42
+ 'index' => 'banner_id'
43
+ ));
44
+
45
+ $this->addColumn('filename', array(
46
+ 'header' => Mage::helper('banner')->__('Image'),
47
+ 'align' => 'center',
48
+ 'index' => 'filename',
49
+ 'type' => 'image',
50
+ 'escape' => true,
51
+ 'sortable' => false,
52
+ 'width' => '150px',
53
+ ));
54
+
55
+ $this->addColumn('title', array(
56
+ 'header' => Mage::helper('catalog')->__('Title'),
57
+ 'index' => 'title',
58
+ 'align' => 'left',
59
+ ));
60
+
61
+ $this->addColumn('link', array(
62
+ 'header' => Mage::helper('banner')->__('Link'),
63
+ 'width' => '200px',
64
+ 'index' => 'link',
65
+ ));
66
+
67
+ $this->addColumn('banner_type', array(
68
+ 'header' => Mage::helper('banner')->__('Type'),
69
+ 'width' => '100px',
70
+ 'index' => 'banner_type',
71
+ 'type' => 'options',
72
+ 'options' => array(
73
+ 0 => 'Image',
74
+ 1 => 'Html',
75
+ ),
76
+ ));
77
+
78
+ $this->addColumn('sort_order', array(
79
+ 'header' => Mage::helper('banner')->__('Sort Order'),
80
+ 'width' => '80px',
81
+ 'index' => 'sort_order',
82
+ 'align' => 'center',
83
+ ));
84
+ return parent::_prepareColumns();
85
+ }
86
+
87
+ public function getGridUrl() {
88
+ return $this->getUrl('*/*/bannergrid', array('_current' => true));
89
+ }
90
+
91
+ protected function _getSelectedBanners() {
92
+ $banners = $this->getRequest()->getPost('selected_banners');
93
+ if (is_null($banners)) {
94
+ $banners = explode(',', $this->getBannergroupData()->getBannerIds());
95
+ return (sizeof($banners) > 0 ? $banners : 0);
96
+ }
97
+ return $banners;
98
+ }
99
+
100
+ }
101
+
102
+ ?>
app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup/Edit/Tab/Form.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Block_Adminhtml_Bannergroup_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
10
+
11
+ protected function _prepareForm() {
12
+ $form = new Varien_Data_Form();
13
+ $this->setForm($form);
14
+ $fieldset = $form->addFieldset('bannergroup_form', array('legend' => Mage::helper('banner')->__('Item information')));
15
+ $animations = Mage::getSingleton('banner/status')->getAnimationArray();
16
+ $preAnimations = Mage::getSingleton('banner/status')->getPreAnimationArray();
17
+
18
+
19
+ $fieldset->addField('group_name', 'text', array(
20
+ 'label' => Mage::helper('banner')->__('Banner Group Name'),
21
+ 'class' => 'required-entry',
22
+ 'required' => true,
23
+ 'name' => 'group_name',
24
+ ));
25
+
26
+ if (Mage::registry('bannergroup_data')->getId() == null) {
27
+ $fieldset->addField('group_code', 'text', array(
28
+ 'label' => Mage::helper('banner')->__('Banner Group Code'),
29
+ 'class' => 'required-entry',
30
+ 'name' => 'group_code',
31
+ 'required' => true,
32
+ ));
33
+ }
34
+
35
+ $fieldset->addField('banner_width', 'text', array(
36
+ 'label' => Mage::helper('banner')->__('Banner Width [in px]'),
37
+ 'class' => 'required-entry',
38
+ 'required' => true,
39
+ 'name' => 'banner_width',
40
+ ));
41
+
42
+ $fieldset->addField('banner_height', 'text', array(
43
+ 'label' => Mage::helper('banner')->__('Banner Height [in px]'),
44
+ 'class' => 'required-entry',
45
+ 'required' => true,
46
+ 'name' => 'banner_height',
47
+ ));
48
+
49
+ $fieldset->addField('animation_type', 'select', array(
50
+ 'label' => Mage::helper('banner')->__('Banner Animation'),
51
+ 'name' => 'animation_type',
52
+ 'required' => false,
53
+ 'values' => array(
54
+ array(
55
+ 'value' => 0,
56
+ 'label' => Mage::helper('banner')->__('Pre-defined Animation'),
57
+ ),
58
+ array(
59
+ 'value' => 1,
60
+ 'label' => Mage::helper('banner')->__('Custom Animation'),
61
+ ),
62
+ ),
63
+ ));
64
+
65
+ $fieldset->addField('pre_banner_effects', 'select', array(
66
+ 'label' => Mage::helper('banner')->__('Pre-Defined Banner Effects'),
67
+ 'name' => 'pre_banner_effects',
68
+ 'required' => true,
69
+ 'values' => $preAnimations
70
+ ));
71
+
72
+ $fieldset->addField('banner_effects', 'select', array(
73
+ 'label' => Mage::helper('banner')->__('Custom Banner Effects'),
74
+ 'name' => 'banner_effects',
75
+ 'required' => true,
76
+ 'values' => $animations
77
+ ));
78
+
79
+
80
+ $fieldset->addField('show_title', 'select', array(
81
+ 'label' => Mage::helper('banner')->__('Display Title'),
82
+ 'class' => 'required-entry',
83
+ 'name' => 'show_title',
84
+ 'values' => array(
85
+ array(
86
+ 'value' => 1,
87
+ 'label' => Mage::helper('banner')->__('Yes'),
88
+ ),
89
+ array(
90
+ 'value' => 0,
91
+ 'label' => Mage::helper('banner')->__('No'),
92
+ ),
93
+ ),
94
+ ));
95
+
96
+ $fieldset->addField('show_content', 'select', array(
97
+ 'label' => Mage::helper('banner')->__('Display Content'),
98
+ 'class' => 'required-entry',
99
+ 'name' => 'show_content',
100
+ 'values' => array(
101
+ array(
102
+ 'value' => 1,
103
+ 'label' => Mage::helper('banner')->__('Yes'),
104
+ ),
105
+ array(
106
+ 'value' => 0,
107
+ 'label' => Mage::helper('banner')->__('No'),
108
+ ),
109
+ ),
110
+ ));
111
+
112
+ $fieldset->addField('link_target', 'select', array(
113
+ 'label' => Mage::helper('banner')->__('Target'),
114
+ 'name' => 'link_target',
115
+ 'values' => array(
116
+ array(
117
+ 'value' => 0,
118
+ 'label' => Mage::helper('banner')->__('New Window'),
119
+ ),
120
+ array(
121
+ 'value' => 1,
122
+ 'label' => Mage::helper('banner')->__('Same Window'),
123
+ ),
124
+ ),
125
+ ));
126
+
127
+ $fieldset->addField('status', 'select', array(
128
+ 'label' => Mage::helper('banner')->__('Status'),
129
+ 'class' => 'required-entry',
130
+ 'name' => 'status',
131
+ 'values' => array(
132
+ array(
133
+ 'value' => 1,
134
+ 'label' => Mage::helper('banner')->__('Enabled'),
135
+ ),
136
+ array(
137
+ 'value' => 2,
138
+ 'label' => Mage::helper('banner')->__('Disabled'),
139
+ ),
140
+ ),
141
+ ));
142
+
143
+ // $fieldset->addField('banner_ids', 'multiselect', array(
144
+ // 'label' => Mage::helper('banner')->__('Banner Images'),
145
+ // 'class' => 'required-entry',
146
+ // 'required' => true,
147
+ // 'name' => 'banner_ids[]',
148
+ // 'values' => $bannerData,
149
+ // ));
150
+
151
+
152
+ if (Mage::getSingleton('adminhtml/session')->getBannergroupData()) {
153
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getBannergroupData());
154
+ Mage::getSingleton('adminhtml/session')->setBannergroupData(null);
155
+ } elseif (Mage::registry('bannergroup_data')) {
156
+ $form->setValues(Mage::registry('bannergroup_data')->getData());
157
+ }
158
+ return parent::_prepareForm();
159
+ }
160
+
161
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup/Edit/Tab/Gridbanner.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Block_Adminhtml_Bannergroup_Edit_Tab_Gridbanner extends Mage_Adminhtml_Block_Widget_Container {
10
+
11
+ /**
12
+ * Set template
13
+ */
14
+ public function __construct() {
15
+ parent::__construct();
16
+ $this->setTemplate('unibanner/banners.phtml');
17
+ }
18
+
19
+ public function getTabsHtml() {
20
+ return $this->getChildHtml('tabs');
21
+ }
22
+
23
+ /**
24
+ * Prepare button and grid
25
+ *
26
+ */
27
+ protected function _prepareLayout() {
28
+ $this->setChild('tabs', $this->getLayout()->createBlock('banner/adminhtml_bannergroup_edit_tab_banner', 'bannergroup.grid.banner'));
29
+ return parent::_prepareLayout();
30
+ }
31
+
32
+ public function getBannergroupData() {
33
+ return Mage::registry('bannergroup_data');
34
+ }
35
+
36
+ public function getBannersJson() {
37
+ $banners = explode(',', $this->getBannergroupData()->getBannerIds());
38
+ if (!empty($banners) && isset($banners[0]) && $banners[0] != '') {
39
+ $data = array();
40
+ foreach ($banners as $element) {
41
+ $data[$element] = $element;
42
+ }
43
+ return Zend_Json::encode($data);
44
+ }
45
+ return '{}';
46
+ }
47
+
48
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup/Edit/Tabs.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Block_Adminhtml_Bannergroup_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+ $this->setId('bannergroup_tabs');
14
+ $this->setDestElementId('edit_form');
15
+ $this->setTitle(Mage::helper('banner')->__('Banner Group Information'));
16
+ }
17
+
18
+ protected function _beforeToHtml() {
19
+ $this->addTab('form_section', array(
20
+ 'label' => Mage::helper('banner')->__('Banner Group'),
21
+ 'alt' => Mage::helper('banner')->__('Banner Group'),
22
+ 'content' => $this->getLayout()->createBlock('banner/adminhtml_bannergroup_edit_tab_form')->toHtml(),
23
+ ));
24
+
25
+ $this->addTab('grid_section', array(
26
+ 'label' => Mage::helper('banner')->__('Banners'),
27
+ 'alt' => Mage::helper('banner')->__('Banners'),
28
+ 'content' => $this->getLayout()->createBlock('banner/adminhtml_bannergroup_edit_tab_gridbanner')->toHtml(),
29
+ ));
30
+
31
+ return parent::_beforeToHtml();
32
+ }
33
+
34
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Bannergroup/Grid.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Block_Adminhtml_Bannergroup_Grid extends Mage_Adminhtml_Block_Widget_Grid {
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+ $this->setId('bannergroupGrid');
14
+ $this->setDefaultSort('group_id');
15
+ $this->setDefaultDir('ASC');
16
+ $this->setSaveParametersInSession(true);
17
+ }
18
+
19
+ protected function _prepareCollection() {
20
+ $collection = Mage::getModel('banner/bannergroup')->getCollection();
21
+ $collection->getSelect()->columns(array('banner_effect' => 'if((animation_type=0),pre_banner_effects,banner_effects)'));
22
+ $this->setCollection($collection);
23
+ return parent::_prepareCollection();
24
+ }
25
+
26
+ protected function _prepareColumns() {
27
+ $this->addColumn('group_id', array(
28
+ 'header' => Mage::helper('banner')->__('ID'),
29
+ 'align' => 'right',
30
+ 'width' => '50px',
31
+ 'index' => 'group_id',
32
+ ));
33
+
34
+ $this->addColumn('group_name', array(
35
+ 'header' => Mage::helper('banner')->__('Banner Group name'),
36
+ 'index' => 'group_name',
37
+ ));
38
+
39
+ $this->addColumn('group_code', array(
40
+ 'header' => Mage::helper('banner')->__('Group code'),
41
+ 'width' => '100px',
42
+ 'index' => 'group_code',
43
+ ));
44
+
45
+ $this->addColumn('banner_width', array(
46
+ 'header' => Mage::helper('banner')->__('Banner Width'),
47
+ 'width' => '100px',
48
+ 'align' => 'center',
49
+ 'index' => 'banner_width',
50
+ ));
51
+
52
+ $this->addColumn('banner_height', array(
53
+ 'header' => Mage::helper('banner')->__('Banner Height'),
54
+ 'width' => '100px',
55
+ 'align' => 'center',
56
+ 'index' => 'banner_height',
57
+ ));
58
+
59
+ $this->addColumn('animation_type', array(
60
+ 'header' => Mage::helper('banner')->__('Banner Animation'),
61
+ 'width' => '100px',
62
+ 'align' => 'center',
63
+ 'index' => 'animation_type',
64
+ 'type' => 'options',
65
+ 'options' => array(
66
+ 0 => 'Pre-defined',
67
+ 1 => 'Custom',
68
+ ),
69
+ ));
70
+
71
+ $this->addColumn('banner_effect', array(
72
+ 'header' => Mage::helper('banner')->__('Banner Effect'),
73
+ 'width' => '150px',
74
+ 'align' => 'left',
75
+ 'index' => 'banner_effect',
76
+ ));
77
+
78
+ $this->addColumn('banner_ids', array(
79
+ 'header' => Mage::helper('banner')->__('Banners'),
80
+ 'width' => '50px',
81
+ 'index' => 'banner_ids',
82
+ ));
83
+
84
+ $this->addColumn('show_title', array(
85
+ 'header' => Mage::helper('banner')->__('Show Title'),
86
+ 'align' => 'center',
87
+ 'width' => '80px',
88
+ 'index' => 'show_title',
89
+ 'type' => 'options',
90
+ 'options' => array(
91
+ 1 => 'Yes',
92
+ 0 => 'No',
93
+ ),
94
+ ));
95
+ $this->addColumn('show_content', array(
96
+ 'header' => Mage::helper('banner')->__('Show Content'),
97
+ 'align' => 'center',
98
+ 'width' => '80px',
99
+ 'index' => 'show_content',
100
+ 'type' => 'options',
101
+ 'options' => array(
102
+ 1 => 'Yes',
103
+ 0 => 'No',
104
+ ),
105
+ ));
106
+
107
+ $this->addColumn('status', array(
108
+ 'header' => Mage::helper('banner')->__('Status'),
109
+ 'align' => 'left',
110
+ 'width' => '80px',
111
+ 'index' => 'status',
112
+ 'type' => 'options',
113
+ 'options' => array(
114
+ 1 => 'Enabled',
115
+ 2 => 'Disabled',
116
+ ),
117
+ ));
118
+
119
+ $this->addColumn('action',
120
+ array(
121
+ 'header' => Mage::helper('banner')->__('Action'),
122
+ 'width' => '50',
123
+ 'type' => 'action',
124
+ 'getter' => 'getId',
125
+ 'actions' => array(
126
+ array(
127
+ 'caption' => Mage::helper('banner')->__('Edit'),
128
+ 'url' => array('base' => '*/*/edit'),
129
+ 'field' => 'id'
130
+ )
131
+ ),
132
+ 'filter' => false,
133
+ 'sortable' => false,
134
+ 'index' => 'stores',
135
+ 'is_system' => true,
136
+ ));
137
+
138
+ $this->addExportType('*/*/exportCsv', Mage::helper('banner')->__('CSV'));
139
+ $this->addExportType('*/*/exportXml', Mage::helper('banner')->__('XML'));
140
+
141
+ return parent::_prepareColumns();
142
+ }
143
+
144
+ protected function _prepareMassaction() {
145
+ $this->setMassactionIdField('group_id');
146
+ $this->getMassactionBlock()->setFormFieldName('banner');
147
+
148
+ $this->getMassactionBlock()->addItem('delete', array(
149
+ 'label' => Mage::helper('banner')->__('Delete'),
150
+ 'url' => $this->getUrl('*/*/massDelete'),
151
+ 'confirm' => Mage::helper('banner')->__('Are you sure?')
152
+ ));
153
+
154
+ $statuses = Mage::getSingleton('banner/status')->getOptionArray();
155
+
156
+ array_unshift($statuses, array('label' => '', 'value' => ''));
157
+ $this->getMassactionBlock()->addItem('status', array(
158
+ 'label' => Mage::helper('banner')->__('Change status'),
159
+ 'url' => $this->getUrl('*/*/massStatus', array('_current' => true)),
160
+ 'additional' => array(
161
+ 'visibility' => array(
162
+ 'name' => 'status',
163
+ 'type' => 'select',
164
+ 'class' => 'required-entry',
165
+ 'label' => Mage::helper('banner')->__('Status'),
166
+ 'values' => $statuses
167
+ )
168
+ )
169
+ ));
170
+ return $this;
171
+ }
172
+
173
+ public function getRowUrl($row) {
174
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
175
+ }
176
+
177
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Widget/Grid/Column.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ require_once 'Mage/Adminhtml/Block/Widget/Grid/Column.php';
10
+
11
+ class Uni_Banner_Block_Adminhtml_Widget_Grid_Column extends Mage_Adminhtml_Block_Widget_Grid_Column {
12
+
13
+ protected function _getRendererByType() {
14
+ switch (strtolower($this->getType())) {
15
+ case 'image':
16
+ $rendererClass = 'banner/adminhtml_widget_grid_column_renderer_image';
17
+ break;
18
+ default:
19
+ $rendererClass = parent::_getRendererByType();
20
+ break;
21
+ }
22
+ return $rendererClass;
23
+ }
24
+
25
+ protected function _getFilterByType() {
26
+ switch (strtolower($this->getType())) {
27
+ case 'image':
28
+ $filterClass = 'banner/adminhtml_widget_grid_column_filter_image';
29
+ break;
30
+ default:
31
+ $filterClass = parent::_getFilterByType();
32
+ break;
33
+ }
34
+ return $filterClass;
35
+ }
36
+
37
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Widget/Grid/Column/Filter/Image.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Banner
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ require_once 'Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Text.php';
11
+
12
+ class Uni_Banner_Block_Adminhtml_Widget_Grid_Column_Filter_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Text {
13
+
14
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Widget/Grid/Column/Renderer/Action.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ require_once 'Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php';
10
+ class Uni_Banner_Block_Adminhtml_Widget_Grid_Column_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action {
11
+
12
+ protected function _transformActionData(&$action, &$actionCaption, Varien_Object $row) {
13
+ foreach ($action as $attibute => $value) {
14
+ if (isset($action[$attibute]) && !is_array($action[$attibute])) {
15
+ $this->getColumn()->setFormat($action[$attibute]);
16
+ $action[$attibute] = parent::render($row);
17
+ } else {
18
+ $this->getColumn()->setFormat(null);
19
+ }
20
+ switch ($attibute) {
21
+ case 'caption':
22
+ $actionCaption = $action['caption'];
23
+ unset($action['caption']);
24
+ break;
25
+ case 'url':
26
+ if (is_array($action['url'])) {
27
+ $params = array($action['field'] => $this->_getValue($row));
28
+ if (isset($action['url']['params'])) {
29
+ $params = array_merge($action['url']['params'], $params);
30
+ }
31
+ $action['href'] = $this->getUrl($action['url']['base'], $params);
32
+ unset($action['field']);
33
+ } else {
34
+ $action['href'] = $action['url'];
35
+ }
36
+ unset($action['url']);
37
+ break;
38
+ case 'popup':
39
+ $action['onclick'] = 'popWin(this.href, \'windth=800,height=700,resizable=1,scrollbars=1\');return false;';
40
+ break;
41
+ }
42
+ }
43
+ return $this;
44
+ }
45
+ }
app/code/community/Uni/Banner/Block/Adminhtml/Widget/Grid/Column/Renderer/Image.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ require_once 'Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php';
10
+ class Uni_Banner_Block_Adminhtml_Widget_Grid_Column_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
11
+
12
+ public function __construct() {
13
+
14
+ }
15
+
16
+ public function render(Varien_Object $row) {
17
+ return $this->_getValue($row);
18
+ }
19
+
20
+ protected function _getValue(Varien_Object $row) {
21
+ $dored = false;
22
+ $out = '';
23
+ if ($getter = $this->getColumn()->getGetter()) {
24
+ $val = $row->$getter();
25
+ }
26
+ $val = $row->getData($this->getColumn()->getIndex());
27
+ $url = Mage::helper('banner')->getImageUrl($val);
28
+ $size = Mage::helper('banner')->getImageThumbSize($val);
29
+ $file_extis = Mage::helper('banner')->getFileExists($val);
30
+ $popLink = "popWin('$url','image','width=800,height=600,resizable=yes,scrollbars=yes')";
31
+ if (is_array($size) && $file_extis)
32
+ $out = '<a href="javascript:;" onclick="'.$popLink.'"><img src="'.$url.'" width="'.$size['width'].'" height="'.$size['height'].'" style="border: 2px solid #CCCCCC;"/></a>';
33
+ return $out;
34
+ }
35
+ }
app/code/community/Uni/Banner/Block/Banner.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Block_Banner extends Mage_Core_Block_Template {
10
+
11
+ public function _prepareLayout() {
12
+ return parent::_prepareLayout();
13
+ }
14
+
15
+ public function getBanner() {
16
+ if (!$this->hasData('banner')) {
17
+ $this->setData('banner', Mage::registry('banner'));
18
+ }
19
+ return $this->getData('banner');
20
+ }
21
+
22
+ public function getDataByGroupCode($groupCode){
23
+ return Mage::getModel('banner/bannergroup')->getDataByGroupCode($groupCode);
24
+ }
25
+
26
+ public function getResizeImage($bannerPath, $groupName, $w = 0, $h = 0) {
27
+ $name = '';
28
+ $_helper = Mage::helper('banner');
29
+ $bannerDirPath = $_helper->updateDirSepereator($bannerPath);
30
+ $baseDir = Mage::getBaseDir();
31
+ $mediaDir = Mage::getBaseDir('media');
32
+ $mediaUrl = Mage::getBaseUrl('media');
33
+ $resizeDir = $mediaDir . DS . 'custom' . DS . 'banners' . DS . 'resize' . DS;
34
+ $resizeUrl = $mediaUrl.'custom/banners/resize/';
35
+ $imageName = basename($bannerDirPath);
36
+
37
+ if (@file_exists($mediaDir . DS . $bannerDirPath)) {
38
+ $name = $mediaDir . DS . $bannerPath;
39
+ $this->checkDir($resizeDir . $groupName);
40
+ $smallImgPath = $resizeDir . $groupName . DS . $imageName;
41
+ $smallImg = $resizeUrl . $groupName .'/'. $imageName;
42
+ }
43
+
44
+ if ($name != '') {
45
+ $resizeObject = Mage::getModel('banner/bannerresize');
46
+ $resizeObject->setImage($name);
47
+ if ($resizeObject->resizeLimitwh($w, $h, $smallImgPath) === false) {
48
+ return $resizeObject->error();
49
+ } else {
50
+ return $smallImg;
51
+ }
52
+ } else {
53
+ return '';
54
+ }
55
+ }
56
+
57
+ protected function checkDir($directory) {
58
+ if (!is_dir($directory)) {
59
+ umask(0);
60
+ mkdir($directory, 0777,true);
61
+ return true;
62
+ }
63
+ }
64
+
65
+ }
app/code/community/Uni/Banner/Helper/Data.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Helper_Data extends Mage_Core_Helper_Abstract {
10
+
11
+ protected static $egridImgDir = null;
12
+ protected static $egridImgURL = null;
13
+ protected static $egridImgThumb = null;
14
+ protected static $egridImgThumbWidth = null;
15
+ protected $_allowedExtensions = Array();
16
+
17
+ public function __construct() {
18
+ self::$egridImgDir = Mage::getBaseDir('media') . DS;
19
+ self::$egridImgURL = Mage::getBaseUrl('media');
20
+ self::$egridImgThumb = "thumb/";
21
+ self::$egridImgThumbWidth = 100;
22
+ }
23
+
24
+ public function updateDirSepereator($path){
25
+ return str_replace('\\', DS, $path);
26
+ }
27
+
28
+ public function getImageUrl($image_file) {
29
+ $url = false;
30
+ if (file_exists(self::$egridImgDir . self::$egridImgThumb . $this->updateDirSepereator($image_file)))
31
+ $url = self::$egridImgURL . self::$egridImgThumb . $image_file;
32
+ else
33
+ $url = self::$egridImgURL . $image_file;
34
+ return $url;
35
+ }
36
+
37
+ public function getFileExists($image_file) {
38
+ $file_exists = false;
39
+ $file_exists = file_exists(self::$egridImgDir . $this->updateDirSepereator($image_file));
40
+ return $file_exists;
41
+ }
42
+
43
+ public function getImageThumbSize($image_file) {
44
+ $img_file = $this->updateDirSepereator(self::$egridImgDir . $image_file);
45
+ if ($image_file == '' || !file_exists($img_file))
46
+ return false;
47
+ list($width, $height, $type, $attr) = getimagesize($img_file);
48
+ $a_height = (int) ((self::$egridImgThumbWidth / $width) * $height);
49
+ return Array('width' => self::$egridImgThumbWidth, 'height' => $a_height);
50
+ }
51
+
52
+ function deleteFiles($image_file) {
53
+ $pass = true;
54
+ if (!unlink(self::$egridImgDir . $image_file))
55
+ $pass = false;
56
+ if (!unlink(self::$egridImgDir . self::$egridImgThumb . $image_file))
57
+ $pass = false;
58
+ return $pass;
59
+ }
60
+
61
+ }
app/code/community/Uni/Banner/Model/Banner.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Model_Banner extends Mage_Core_Model_Abstract {
10
+
11
+ public function _construct() {
12
+ parent::_construct();
13
+ $this->_init('banner/banner');
14
+ }
15
+
16
+ public function getAllBanners() {
17
+ $collection = Mage::getResourceModel('banner/banner_collection');
18
+ $collection->getSelect()->where('status = ?', 1);
19
+ $data = array();
20
+ foreach ($collection as $record) {
21
+ $data[$record->getId()] = array('value' => $record->getId(), 'label' => $record->getfilename());
22
+ }
23
+ return $data;
24
+ }
25
+
26
+ public function getDataByBannerIds($bannerIds) {
27
+ $data = array();
28
+ if ($bannerIds != '') {
29
+ $collection = Mage::getResourceModel('banner/banner_collection');
30
+ $collection->getSelect()->where('banner_id IN (' . $bannerIds . ')')->order('sort_order');
31
+ foreach ($collection as $record) {
32
+ $status = $record->getStatus();
33
+ if ($status == 1) {
34
+ $data[] = $record;
35
+ }
36
+ }
37
+ }
38
+ return $data;
39
+ }
40
+
41
+ }
app/code/community/Uni/Banner/Model/Bannergroup.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Model_Bannergroup extends Mage_Core_Model_Abstract {
10
+
11
+ public function _construct() {
12
+ parent::_construct();
13
+ $this->_init('banner/bannergroup');
14
+ }
15
+
16
+ public function getDataByGroupCode($groupCode) {
17
+ $groupData = array();
18
+ $bannerData = array();
19
+ $result = array('group_data'=>$groupData,'banner_data'=>$bannerData);
20
+ $collection = Mage::getResourceModel('banner/bannergroup_collection');
21
+ $collection->getSelect()->where('group_code = ?', $groupCode)->where('status = 1');
22
+ foreach ($collection as $record) {
23
+ $bannerIds = $record->getBannerIds();
24
+ $bannerModel = Mage::getModel('banner/banner');
25
+ $bannerData = $bannerModel->getDataByBannerIds($bannerIds);
26
+ $result = array('group_data' => $record, 'banner_data' => $bannerData);
27
+ }
28
+ return $result;
29
+ }
30
+
31
+ }
app/code/community/Uni/Banner/Model/Bannerresize.php ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ define("UNI_AUTO_NAME", 1);
10
+
11
+ class Uni_Banner_Model_Bannerresize {
12
+
13
+ var $imgFile = "";
14
+ var $imgWidth = 0;
15
+ var $imgHeight = 0;
16
+ var $imgType = "";
17
+ var $imgAttr = "";
18
+ var $type = NULL;
19
+ var $_img = NULL;
20
+ var $_error = "";
21
+
22
+ /**
23
+ * Constructor
24
+ *
25
+ * @param [String $imgFile] Image File Name
26
+ * @return RESIZEIMAGE (Class Object)
27
+ */
28
+ function Uni_Banner_Model_Bannerresize($imgFile="") {
29
+ if (!function_exists("imagecreate")) {
30
+ $this->_error = "Error: GD Library is not available.";
31
+ return false;
32
+ }
33
+
34
+ $this->type = Array(1 => 'GIF', 2 => 'JPG', 3 => 'PNG', 4 => 'SWF', 5 => 'PSD', 6 => 'BMP', 7 => 'TIFF', 8 => 'TIFF', 9 => 'JPC', 10 => 'JP2', 11 => 'JPX', 12 => 'JB2', 13 => 'SWC', 14 => 'IFF', 15 => 'WBMP', 16 => 'XBM');
35
+ if (!empty($imgFile))
36
+ $this->setImage($imgFile);
37
+ }
38
+
39
+ /**
40
+ * Error occured while resizing the image.
41
+ *
42
+ * @return String
43
+ */
44
+ function error() {
45
+ return $this->_error;
46
+ }
47
+
48
+ /**
49
+ * Set image file name
50
+ *
51
+ * @param String $imgFile
52
+ * @return void
53
+ */
54
+ function setImage($imgFile) {
55
+ $this->imgFile = $imgFile;
56
+ return $this->_createImage();
57
+ }
58
+
59
+ /**
60
+ *
61
+ * @return void
62
+ */
63
+ function close() {
64
+ return @imagedestroy($this->_img);
65
+ }
66
+
67
+ /**
68
+ * Resize a image to given width and height and keep it's current width and height ratio
69
+ *
70
+ * @param Number $imgwidth
71
+ * @param Numnber $imgheight
72
+ * @param String $newfile
73
+ */
74
+ function resizeLimitwh($imgwidth, $imgheight, $newfile=NULL) {
75
+ $image_per = 100;
76
+ list($width, $height, $type, $attr) = @getimagesize($this->imgFile);
77
+ if ($width > $imgwidth && $imgwidth > 0)
78
+ $image_per = (double) (($imgwidth * 100) / $width);
79
+
80
+ if (floor(($height * $image_per) / 100) > $imgheight && $imgheight > 0)
81
+ $image_per = (double) (($imgheight * 100) / $height);
82
+
83
+ $this->resizePercentage($image_per, $newfile);
84
+ }
85
+
86
+ /**
87
+ * Resize an image to given percentage.
88
+ *
89
+ * @param Number $percent
90
+ * @param String $newfile
91
+ * @return Boolean
92
+ */
93
+ function resizePercentage($percent=100, $newfile=NULL) {
94
+ $newWidth = ($this->imgWidth * $percent) / 100;
95
+ $newHeight = ($this->imgHeight * $percent) / 100;
96
+ return $this->resize($newWidth, $newHeight, $newfile);
97
+ }
98
+
99
+ /**
100
+ * Resize an image to given X and Y percentage.
101
+ *
102
+ * @param Number $xpercent
103
+ * @param Number $ypercent
104
+ * @param String $newfile
105
+ * @return Boolean
106
+ */
107
+ function resizeXYpercentage($xpercent=100, $ypercent=100, $newfile=NULL) {
108
+ $newWidth = ($this->imgWidth * $xpercent) / 100;
109
+ $newHeight = ($this->imgHeight * $ypercent) / 100;
110
+ return $this->resize($newWidth, $newHeight, $newfile);
111
+ }
112
+
113
+ /**
114
+ * Resize an image to given width and height
115
+ *
116
+ * @param Number $width
117
+ * @param Number $height
118
+ * @param String $newfile
119
+ * @return Boolean
120
+ */
121
+ function resize($width, $height, $newfile=NULL) {
122
+ if (empty($this->imgFile)) {
123
+ $this->_error = "File name is not initialised.";
124
+ return false;
125
+ }
126
+ if ($this->imgWidth <= 0 || $this->imgHeight <= 0) {
127
+ $this->_error = "Could not resize given image";
128
+ return false;
129
+ }
130
+ if ($width <= 0)
131
+ $width = $this->imgWidth;
132
+ if ($height <= 0)
133
+ $height = $this->imgHeight;
134
+ return $this->_resize($width, $height, $newfile);
135
+ }
136
+
137
+ /**
138
+ * Get the image attributes
139
+ * @access Private
140
+ *
141
+ */
142
+ function _getImageInfo() {
143
+ @list($this->imgWidth, $this->imgHeight, $type, $this->imgAttr) = @getimagesize($this->imgFile);
144
+ $this->imgType = $this->type[$type];
145
+ }
146
+
147
+ /**
148
+ * Create the image resource
149
+ * @access Private
150
+ * @return Boolean
151
+ */
152
+ function _createImage() {
153
+ $this->_getImageInfo($this->imgFile);
154
+ if ($this->imgType == 'GIF') {
155
+ $this->_img = @imagecreatefromgif($this->imgFile);
156
+ } elseif ($this->imgType == 'JPG') {
157
+ $this->_img = @imagecreatefromjpeg($this->imgFile);
158
+ } elseif ($this->imgType == 'PNG') {
159
+ $this->_img = @imagecreatefrompng($this->imgFile);
160
+ }
161
+ if (!$this->_img || !@is_resource($this->_img)) {
162
+ $this->_error = "Error loading " . $this->imgFile;
163
+ return false;
164
+ }
165
+ return true;
166
+ }
167
+
168
+ /**
169
+ * Function is used to resize the image
170
+ *
171
+ * @access Private
172
+ * @param Number $width
173
+ * @param Number $height
174
+ * @param String $newfile
175
+ * @return Boolean
176
+ */
177
+ function _resize($width, $height, $newfile=NULL) {
178
+ if (!function_exists("imagecreate")) {
179
+ $this->_error = "Error: GD Library is not available.";
180
+ return false;
181
+ }
182
+
183
+ $newimg = @imagecreatetruecolor($width, $height);
184
+ //imagecolortransparent( $newimg, imagecolorat( $newimg, 0, 0 ) );
185
+
186
+ if ($this->imgType == 'GIF' || $this->imgType == 'PNG') {
187
+ /** Code to keep transparency of image * */
188
+ $colorcount = imagecolorstotal($this->_img);
189
+ if ($colorcount == 0)
190
+ $colorcount = 256;
191
+ imagetruecolortopalette($newimg, true, $colorcount);
192
+ imagepalettecopy($newimg, $this->_img);
193
+ $transparentcolor = imagecolortransparent($this->_img);
194
+ imagefill($newimg, 0, 0, $transparentcolor);
195
+ imagecolortransparent($newimg, $transparentcolor);
196
+ }
197
+
198
+ @imagecopyresampled($newimg, $this->_img, 0, 0, 0, 0, $width, $height, $this->imgWidth, $this->imgHeight);
199
+
200
+
201
+
202
+ if ($newfile === UNI_AUTO_NAME) {
203
+ if (@preg_match("/\..*+$/", @basename($this->imgFile), $matches))
204
+ $newfile = @substr_replace($this->imgFile, "_har", -@strlen($matches[0]), 0);
205
+ }
206
+ elseif (!empty($newfile)) {
207
+ if (!@preg_match("/\..*+$/", @basename($newfile))) {
208
+ if (@preg_match("/\..*+$/", @basename($this->imgFile), $matches))
209
+ $newfile = $newfile . $matches[0];
210
+ }
211
+ }
212
+ if ($this->imgType == 'GIF') {
213
+ if (!empty($newfile))
214
+ @imagegif($newimg, $newfile);
215
+ else {
216
+ @header("Content-type: image/gif");
217
+ @imagegif($newimg);
218
+ }
219
+ } elseif ($this->imgType == 'JPG') {
220
+ if (!empty($newfile)) {
221
+ @imagejpeg($newimg, $newfile);
222
+ } else {
223
+ @header("Content-type: image/jpeg");
224
+ @imagejpeg($newimg);
225
+ }
226
+ } elseif ($this->imgType == 'PNG') {
227
+ if (!empty($newfile))
228
+ @imagepng($newimg, $newfile);
229
+ else {
230
+ @header("Content-type: image/png");
231
+ @imagepng($newimg);
232
+ }
233
+ }
234
+ @imagedestroy($newimg);
235
+ }
236
+
237
+ }
238
+
239
+ ?>
app/code/community/Uni/Banner/Model/Mysql4/Banner.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Model_Mysql4_Banner extends Mage_Core_Model_Mysql4_Abstract {
10
+
11
+ public function _construct() {
12
+ // Note that the banner_id refers to the key field in your database table.
13
+ $this->_init('banner/banner', 'banner_id');
14
+ }
15
+
16
+ }
app/code/community/Uni/Banner/Model/Mysql4/Banner/Collection.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Model_Mysql4_Banner_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
10
+
11
+ public function _construct() {
12
+ parent::_construct();
13
+ $this->_init('banner/banner');
14
+ }
15
+
16
+ }
app/code/community/Uni/Banner/Model/Mysql4/Bannergroup.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Model_Mysql4_Bannergroup extends Mage_Core_Model_Mysql4_Abstract {
10
+
11
+ public function _construct() {
12
+ $this->_init('banner/bannergroup', 'group_id');
13
+ }
14
+
15
+ public function _beforeSave(Mage_Core_Model_Abstract $object) {
16
+ $isDataValid = true;
17
+ $id = $object->getId();
18
+ $groupCode = $object->getGroupCode();
19
+ $groupCollection = Mage::getModel('banner/bannergroup')->getCollection();
20
+ if ($id == '' || $id == 0) {
21
+ if ($groupCode == '') {
22
+ throw new Exception('Banner Group code can\'t be blank !!');
23
+ } else {
24
+ $groupInfo = $groupCollection->getDuplicateGroupCode($groupCode);
25
+ if ($groupInfo->count() > 0) {
26
+ $isDataValid = false;
27
+ }
28
+ if ($isDataValid === false) {
29
+ throw new Exception("Banner Group Code already exists !!");
30
+ }
31
+ }
32
+ }
33
+ }
34
+
35
+ }
app/code/community/Uni/Banner/Model/Mysql4/Bannergroup/Collection.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Model_Mysql4_Bannergroup_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
10
+
11
+ public function _construct() {
12
+ parent::_construct();
13
+ $this->_init('banner/bannergroup');
14
+ }
15
+
16
+ public function getDuplicateGroupCode($groupCode) {
17
+ $this->setConnection($this->getResource()->getReadConnection());
18
+ $table = $this->getTable('banner/bannergroup');
19
+ $select = $this->getSelect();
20
+ $select->from(array('main_table' => $table), 'group_id')
21
+ ->where('group_code = ?', $groupCode);
22
+ return $this;
23
+ }
24
+ }
app/code/community/Uni/Banner/Model/Status.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Model_Status extends Varien_Object {
10
+ const STATUS_ENABLED = 1;
11
+ const STATUS_DISABLED = 2;
12
+
13
+ static public function getOptionArray() {
14
+ return array(
15
+ self::STATUS_ENABLED => Mage::helper('banner')->__('Enabled'),
16
+ self::STATUS_DISABLED => Mage::helper('banner')->__('Disabled')
17
+ );
18
+ }
19
+
20
+ static public function getAnimationArray() {
21
+ $animations = array();
22
+ $animations = array(
23
+ array(
24
+ 'value' => 'Fade/Appear',
25
+ 'label' => Mage::helper('banner')->__('Fade / Appear'),
26
+ ),
27
+ array(
28
+ 'value' => 'Shake',
29
+ 'label' => Mage::helper('banner')->__('Shake'),
30
+ ),
31
+
32
+ array(
33
+ 'value' => 'Pulsate',
34
+ 'label' => Mage::helper('banner')->__('Pulsate'),
35
+ ),
36
+ array(
37
+ 'value' => 'Puff',
38
+ 'label' => Mage::helper('banner')->__('Puff'),
39
+ ),
40
+ array(
41
+ 'value' => 'Grow',
42
+ 'label' => Mage::helper('banner')->__('Grow'),
43
+ ),
44
+ array(
45
+ 'value' => 'Shrink',
46
+ 'label' => Mage::helper('banner')->__('Shrink'),
47
+ ),
48
+ array(
49
+ 'value' => 'Fold',
50
+ 'label' => Mage::helper('banner')->__('Fold'),
51
+ ),
52
+ array(
53
+ 'value' => 'Squish',
54
+ 'label' => Mage::helper('banner')->__('Squish'),
55
+ ),
56
+
57
+ array(
58
+ 'value' => 'BlindUp',
59
+ 'label' => Mage::helper('banner')->__('Blindup'),
60
+ ),
61
+ array(
62
+ 'value' => 'BlindDown',
63
+ 'label' => Mage::helper('banner')->__('BlindDown'),
64
+ ),
65
+ array(
66
+ 'value' => 'DropOut',
67
+ 'label' => Mage::helper('banner')->__('DropOut'),
68
+ ),
69
+ );
70
+ array_unshift($animations, array('label' => '--Select--', 'value' => ''));
71
+ return $animations;
72
+ }
73
+
74
+ static public function getPreAnimationArray() {
75
+ $animations = array();
76
+ $animations = array(
77
+
78
+ array(
79
+ 'value' => 'Image Slide Show',
80
+ 'label' => Mage::helper('banner')->__('Image Slide Show'),
81
+ ),
82
+ array(
83
+ 'value' => 'Text Fade Banner',
84
+ 'label' => Mage::helper('banner')->__('Text Fade Banner'),
85
+ ),
86
+ array(
87
+ 'value' => 'Square Transition Banner',
88
+ 'label' => Mage::helper('banner')->__('Square Transition Banner'),
89
+ ),
90
+ array(
91
+ 'value' => 'Play And Pause Slide Show',
92
+ 'label' => Mage::helper('banner')->__('Play And Pause Slide Show'),
93
+ ),
94
+ array(
95
+ 'value' => 'Numbered Banner',
96
+ 'label' => Mage::helper('banner')->__('Numbered Banner'),
97
+ ),
98
+ array(
99
+ 'value' => 'image glider',
100
+ 'label' => Mage::helper('banner')->__('Image Slider'),
101
+ ),
102
+ array(
103
+ 'value' => 'image vertical slider',
104
+ 'label' => Mage::helper('banner')->__('Image Vertical Slider'),
105
+ ),
106
+
107
+ /*array(
108
+ 'value' => 'image spring slider',
109
+ 'label' => Mage::helper('banner')->__('Image Spring Slider'),
110
+ ),*/
111
+ );
112
+ array_unshift($animations, array('label' => '--Select--', 'value' => ''));
113
+ return $animations;
114
+ }
115
+
116
+ }
app/code/community/Uni/Banner/Model/Wysiwyg/Config.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ require_once 'Mage/Cms/Model/Wysiwyg/Config.php';
10
+ class Uni_Banner_Model_Wysiwyg_Config extends Mage_Cms_Model_Wysiwyg_Config
11
+ {
12
+ public function getConfig($data = array())
13
+ {
14
+ $config = new Varien_Object();
15
+
16
+ $config->setData(array(
17
+ 'enabled' => $this->isEnabled(),
18
+ 'hidden' => $this->isHidden(),
19
+ 'use_container' => false,
20
+ 'add_variables' => true,
21
+ 'add_widgets' => true,
22
+ 'no_display' => false,
23
+ 'translator' => Mage::helper('banner'),
24
+ 'files_browser_window_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index'),
25
+ 'files_browser_window_width' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width'),
26
+ 'files_browser_window_height' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height'),
27
+ 'encode_directives' => true,
28
+ 'directives_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive'),
29
+ 'popup_css' => Mage::getBaseUrl('js').'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css',
30
+ 'content_css' => Mage::getBaseUrl('js').'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css',
31
+ 'width' => '100%',
32
+ 'plugins' => array()
33
+ ));
34
+
35
+ $config->setData('directives_url_quoted', preg_quote($config->getData('directives_url')));
36
+
37
+ if (is_array($data)) {
38
+ $config->addData($data);
39
+ }
40
+
41
+ Mage::dispatchEvent('cms_wysiwyg_config_prepare', array('config' => $config));
42
+
43
+ return $config;
44
+ }
45
+ }
app/code/community/Uni/Banner/controllers/Adminhtml/BannerController.php ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Adminhtml_BannerController extends Mage_Adminhtml_Controller_action {
10
+
11
+ protected function _initAction() {
12
+ $this->loadLayout()
13
+ ->_setActiveMenu('banner/items')
14
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
15
+
16
+ return $this;
17
+ }
18
+
19
+ public function indexAction() {
20
+ $this->_initAction()
21
+ ->renderLayout();
22
+ }
23
+
24
+ public function editAction() {
25
+ $id = $this->getRequest()->getParam('id');
26
+ $model = Mage::getModel('banner/banner')->load($id);
27
+
28
+ if ($model->getId() || $id == 0) {
29
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
30
+ if (!empty($data)) {
31
+ $model->setData($data);
32
+ }
33
+
34
+ Mage::register('banner_data', $model);
35
+
36
+ $this->loadLayout();
37
+ $this->_setActiveMenu('banner/items');
38
+
39
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
40
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
41
+
42
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
43
+
44
+ $this->_addContent($this->getLayout()->createBlock('banner/adminhtml_banner_edit'))
45
+ ->_addLeft($this->getLayout()->createBlock('banner/adminhtml_banner_edit_tabs'));
46
+ $version = substr(Mage::getVersion(), 0, 3);
47
+ if (($version=='1.4' || $version=='1.5') && Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
48
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
49
+ }
50
+ $this->renderLayout();
51
+ } else {
52
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('banner')->__('Item does not exist'));
53
+ $this->_redirect('*/*/');
54
+ }
55
+ }
56
+
57
+ public function newAction() {
58
+ $this->_forward('edit');
59
+ }
60
+
61
+ public function saveAction() {
62
+ $imagedata = array();
63
+ if (!empty($_FILES['filename']['name'])) {
64
+ try {
65
+ $ext = substr($_FILES['filename']['name'], strrpos($_FILES['filename']['name'], '.') + 1);
66
+ $fname = 'File-' . time() . '.' . $ext;
67
+ $uploader = new Varien_File_Uploader('filename');
68
+ $uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png')); // or pdf or anything
69
+
70
+ $uploader->setAllowRenameFiles(true);
71
+ $uploader->setFilesDispersion(false);
72
+
73
+ $path = Mage::getBaseDir('media').DS.'custom'.DS.'banners';
74
+
75
+ $uploader->save($path, $fname);
76
+
77
+ $imagedata['filename'] = 'custom/banners/'.$fname;
78
+ } catch (Exception $e) {
79
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
80
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
81
+ return;
82
+ }
83
+ }
84
+ if ($data = $this->getRequest()->getPost()) {
85
+ if (!empty($imagedata['filename'])) {
86
+ $data['filename'] = $imagedata['filename'];
87
+ } else {
88
+ if (isset($data['filename']['delete']) && $data['filename']['delete'] == 1) {
89
+ if ($data['filename']['value'] != '') {
90
+ $_helper = Mage::helper('banner');
91
+ $this->removeFile(Mage::getBaseDir('media').DS.$_helper->updateDirSepereator($data['filename']['value']));
92
+ }
93
+ $data['filename'] = '';
94
+ } else {
95
+ unset($data['filename']);
96
+ }
97
+ }
98
+ $model = Mage::getModel('banner/banner');
99
+ $model->setData($data)
100
+ ->setId($this->getRequest()->getParam('id'));
101
+
102
+ try {
103
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
104
+ $model->setCreatedTime(now())
105
+ ->setUpdateTime(now());
106
+ } else {
107
+ $model->setUpdateTime(now());
108
+ }
109
+
110
+ $model->save();
111
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('banner')->__('Item was successfully saved'));
112
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
113
+
114
+ if ($this->getRequest()->getParam('back')) {
115
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
116
+ return;
117
+ }
118
+ $this->_redirect('*/*/');
119
+ return;
120
+ } catch (Exception $e) {
121
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
122
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
123
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
124
+ return;
125
+ }
126
+ }
127
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('banner')->__('Unable to find item to save'));
128
+ $this->_redirect('*/*/');
129
+ }
130
+
131
+ public function deleteAction() {
132
+ if ($this->getRequest()->getParam('id') > 0) {
133
+ try {
134
+ $model = Mage::getModel('banner/banner')->load($this->getRequest()->getParam('id'));
135
+ $_helper = Mage::helper('banner');
136
+ $filePath = Mage::getBaseDir('media').DS.$_helper->updateDirSepereator($model->getFilename());
137
+ $model->delete();
138
+ $this->removeFile($filePath);
139
+
140
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
141
+ $this->_redirect('*/*/');
142
+ } catch (Exception $e) {
143
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
144
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
145
+ }
146
+ }
147
+ $this->_redirect('*/*/');
148
+ }
149
+
150
+ public function massDeleteAction() {
151
+ $bannerIds = $this->getRequest()->getParam('banner');
152
+ if (!is_array($bannerIds)) {
153
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
154
+ } else {
155
+ try {
156
+ foreach ($bannerIds as $bannerId) {
157
+ $model = Mage::getModel('banner/banner')->load($bannerId);
158
+ $_helper = Mage::helper('banner');
159
+ $filePath = Mage::getBaseDir('media').DS.$_helper->updateDirSepereator($model->getFilename());
160
+ $model->delete();
161
+ $this->removeFile($filePath);
162
+ }
163
+ Mage::getSingleton('adminhtml/session')->addSuccess(
164
+ Mage::helper('adminhtml')->__(
165
+ 'Total of %d record(s) were successfully deleted', count($bannerIds)
166
+ )
167
+ );
168
+ } catch (Exception $e) {
169
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
170
+ }
171
+ }
172
+ $this->_redirect('*/*/index');
173
+ }
174
+
175
+ public function massStatusAction() {
176
+ $bannerIds = $this->getRequest()->getParam('banner');
177
+ if (!is_array($bannerIds)) {
178
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
179
+ } else {
180
+ try {
181
+ foreach ($bannerIds as $bannerId) {
182
+ $banner = Mage::getSingleton('banner/banner')
183
+ ->load($bannerId)
184
+ ->setStatus($this->getRequest()->getParam('status'))
185
+ ->setIsMassupdate(true)
186
+ ->save();
187
+ }
188
+ $this->_getSession()->addSuccess(
189
+ $this->__('Total of %d record(s) were successfully updated', count($bannerIds))
190
+ );
191
+ } catch (Exception $e) {
192
+ $this->_getSession()->addError($e->getMessage());
193
+ }
194
+ }
195
+ $this->_redirect('*/*/index');
196
+ }
197
+
198
+ public function exportCsvAction() {
199
+ $fileName = 'banner.csv';
200
+ $content = $this->getLayout()->createBlock('banner/adminhtml_banner_grid')
201
+ ->getCsv();
202
+
203
+ $this->_sendUploadResponse($fileName, $content);
204
+ }
205
+
206
+ public function exportXmlAction() {
207
+ $fileName = 'banner.xml';
208
+ $content = $this->getLayout()->createBlock('banner/adminhtml_banner_grid')
209
+ ->getXml();
210
+
211
+ $this->_sendUploadResponse($fileName, $content);
212
+ }
213
+
214
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream') {
215
+ $response = $this->getResponse();
216
+ $response->setHeader('HTTP/1.1 200 OK', '');
217
+ $response->setHeader('Pragma', 'public', true);
218
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
219
+ $response->setHeader('Content-Disposition', 'attachment; filename=' . $fileName);
220
+ $response->setHeader('Last-Modified', date('r'));
221
+ $response->setHeader('Accept-Ranges', 'bytes');
222
+ $response->setHeader('Content-Length', strlen($content));
223
+ $response->setHeader('Content-type', $contentType);
224
+ $response->setBody($content);
225
+ $response->sendResponse();
226
+ die;
227
+ }
228
+
229
+ protected function removeFile($file) {
230
+ try {
231
+ $io = new Varien_Io_File();
232
+ $result = $io->rmdir($file, true);
233
+ } catch (Exception $e) {
234
+
235
+ }
236
+ }
237
+
238
+ }
app/code/community/Uni/Banner/controllers/Adminhtml/BannergroupController.php ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_Adminhtml_BannergroupController extends Mage_Adminhtml_Controller_action {
10
+
11
+ protected function _initAction() {
12
+ $this->loadLayout()
13
+ ->_setActiveMenu('banner/items')
14
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
15
+ $id = $this->getRequest()->getParam('id');
16
+ $model = Mage::getModel('banner/bannergroup')->load($id);
17
+ if ($model->getId() || $id == 0) {
18
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
19
+ if (!empty($data)) {
20
+ $model->setData($data);
21
+ }
22
+ }
23
+ Mage::register('bannergroup_data', $model);
24
+ return $this;
25
+ }
26
+
27
+ public function indexAction() {
28
+ $this->_initAction()
29
+ ->renderLayout();
30
+ }
31
+
32
+ public function bannergridAction() {
33
+ $this->_initAction();
34
+ $this->getResponse()->setBody(
35
+ $this->getLayout()->createBlock('banner/adminhtml_bannergroup_edit_tab_banner')->toHtml()
36
+ );
37
+ }
38
+
39
+ public function editAction() {
40
+ $id = $this->getRequest()->getParam('id');
41
+ $model = Mage::getModel('banner/bannergroup')->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
+ Mage::register('bannergroup_data', $model);
49
+
50
+ $this->loadLayout();
51
+ $this->_setActiveMenu('banner/items');
52
+
53
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
54
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
55
+
56
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
57
+
58
+ $this->_addContent($this->getLayout()->createBlock('banner/adminhtml_bannergroup_edit'))
59
+ ->_addLeft($this->getLayout()->createBlock('banner/adminhtml_bannergroup_edit_tabs'));
60
+
61
+ $this->renderLayout();
62
+ } else {
63
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('banner')->__('Item does not exist'));
64
+ $this->_redirect('*/*/');
65
+ }
66
+ }
67
+
68
+ public function newAction() {
69
+ $this->_forward('edit');
70
+ }
71
+
72
+ public function saveAction() {
73
+ if ($data = $this->getRequest()->getPost()) {
74
+ $banners = array();
75
+ parse_str($data['bannergroup_banners'], $banners);
76
+ foreach ($banners as $k => $v) {
77
+ if (preg_match('/[^0-9]+/', $k) || preg_match('/[^0-9]+/', $v)) {
78
+ unset($banners[$k]);
79
+ }
80
+ }
81
+ $data['banner_ids'] = implode(',', $banners);
82
+ $data['banner_effects'] = (($data['animation_type'] == 0) ? '' : $data['banner_effects']);
83
+ $data['pre_banner_effects'] = (($data['animation_type'] == 0) ? $data['pre_banner_effects'] : '');
84
+ $model = Mage::getModel('banner/bannergroup');
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
+
98
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('banner')->__('Item was successfully saved'));
99
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
100
+
101
+ if ($this->getRequest()->getParam('back')) {
102
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
103
+ return;
104
+ }
105
+ $this->_redirect('*/*/');
106
+ return;
107
+ } catch (Exception $e) {
108
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
109
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
110
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
111
+ return;
112
+ }
113
+ }
114
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('banner')->__('Unable to find item to save'));
115
+ $this->_redirect('*/*/');
116
+ }
117
+
118
+ public function deleteAction() {
119
+ if ($this->getRequest()->getParam('id') > 0) {
120
+ try {
121
+ $model = Mage::getModel('banner/bannergroup')->load($this->getRequest()->getParam('id'));
122
+ $filePath = Mage::getBaseDir('media') . DS . 'custom' . DS . 'banners' . DS . 'resize' . DS . $model->getGroupCode();
123
+ $model->delete();
124
+ $this->removeFile($filePath);
125
+
126
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
127
+ $this->_redirect('*/*/');
128
+ } catch (Exception $e) {
129
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
130
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
131
+ }
132
+ }
133
+ $this->_redirect('*/*/');
134
+ }
135
+
136
+ public function massDeleteAction() {
137
+ $bannerIds = $this->getRequest()->getParam('banner');
138
+ if (!is_array($bannerIds)) {
139
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
140
+ } else {
141
+ try {
142
+ foreach ($bannerIds as $bannerId) {
143
+ $banner = Mage::getModel('banner/bannergroup')->load($bannerId);
144
+ $filePath = Mage::getBaseDir('media') . DS . 'custom' . DS . 'banners' . DS . 'resize' . DS . $banner->getGroupCode();
145
+ $banner->delete();
146
+ $this->removeFile($filePath);
147
+ }
148
+ Mage::getSingleton('adminhtml/session')->addSuccess(
149
+ Mage::helper('adminhtml')->__(
150
+ 'Total of %d record(s) were successfully deleted', count($bannerIds)
151
+ )
152
+ );
153
+ } catch (Exception $e) {
154
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
155
+ }
156
+ }
157
+ $this->_redirect('*/*/index');
158
+ }
159
+
160
+ public function massStatusAction() {
161
+ $bannerIds = $this->getRequest()->getParam('banner');
162
+ if (!is_array($bannerIds)) {
163
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
164
+ } else {
165
+ try {
166
+ foreach ($bannerIds as $bannerId) {
167
+ $banner = Mage::getSingleton('banner/bannergroup')
168
+ ->load($bannerId)
169
+ ->setStatus($this->getRequest()->getParam('status'))
170
+ ->setIsMassupdate(true)
171
+ ->save();
172
+ }
173
+ $this->_getSession()->addSuccess(
174
+ $this->__('Total of %d record(s) were successfully updated', count($bannerIds))
175
+ );
176
+ } catch (Exception $e) {
177
+ $this->_getSession()->addError($e->getMessage());
178
+ }
179
+ }
180
+ $this->_redirect('*/*/index');
181
+ }
182
+
183
+ public function exportCsvAction() {
184
+ $fileName = 'banner.csv';
185
+ $content = $this->getLayout()->createBlock('banner/adminhtml_banner_grid')
186
+ ->getCsv();
187
+
188
+ $this->_sendUploadResponse($fileName, $content);
189
+ }
190
+
191
+ public function exportXmlAction() {
192
+ $fileName = 'banner.xml';
193
+ $content = $this->getLayout()->createBlock('banner/adminhtml_banner_grid')
194
+ ->getXml();
195
+
196
+ $this->_sendUploadResponse($fileName, $content);
197
+ }
198
+
199
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream') {
200
+ $response = $this->getResponse();
201
+ $response->setHeader('HTTP/1.1 200 OK', '');
202
+ $response->setHeader('Pragma', 'public', true);
203
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
204
+ $response->setHeader('Content-Disposition', 'attachment; filename=' . $fileName);
205
+ $response->setHeader('Last-Modified', date('r'));
206
+ $response->setHeader('Accept-Ranges', 'bytes');
207
+ $response->setHeader('Content-Length', strlen($content));
208
+ $response->setHeader('Content-type', $contentType);
209
+ $response->setBody($content);
210
+ $response->sendResponse();
211
+ die;
212
+ }
213
+
214
+ protected function removeFile($file) {
215
+ try {
216
+ $io = new Varien_Io_File();
217
+ $result = $io->rmdir($file, true);
218
+ } catch (Exception $e) {
219
+
220
+ }
221
+ }
222
+
223
+ }
app/code/community/Uni/Banner/controllers/IndexController.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Uni_Banner_IndexController extends Mage_Core_Controller_Front_Action {
10
+
11
+ public function indexAction() {
12
+ $this->loadLayout();
13
+ $this->renderLayout();
14
+ }
15
+
16
+ }
app/code/community/Uni/Banner/etc/config.xml ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Banner
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ -->
11
+ <config>
12
+ <modules>
13
+ <Uni_Banner>
14
+ <version>0.1.0</version>
15
+ </Uni_Banner>
16
+ </modules>
17
+ <frontend>
18
+ <routers>
19
+ <banner>
20
+ <use>standard</use>
21
+ <args>
22
+ <module>Uni_Banner</module>
23
+ <frontName>banner</frontName>
24
+ </args>
25
+ </banner>
26
+ </routers>
27
+ <layout>
28
+ <updates>
29
+ <banner>
30
+ <file>unibanner.xml</file>
31
+ </banner>
32
+ </updates>
33
+ </layout>
34
+ </frontend>
35
+
36
+ <admin>
37
+ <routers>
38
+ <banner>
39
+ <use>admin</use>
40
+ <args>
41
+ <module>Uni_Banner</module>
42
+ <frontName>banner</frontName>
43
+ </args>
44
+ </banner>
45
+ </routers>
46
+ </admin>
47
+
48
+ <adminhtml>
49
+ <menu>
50
+ <banner module="banner">
51
+ <title>Banner</title>
52
+ <sort_order>75</sort_order>
53
+ <children>
54
+ <banner module="banner">
55
+ <title>Manage Banners</title>
56
+ <sort_order>0</sort_order>
57
+ <action>banner/adminhtml_banner</action>
58
+ </banner>
59
+ <bannergroup module="banner">
60
+ <title>Manage Banner Groups</title>
61
+ <sort_order>1</sort_order>
62
+ <action>banner/adminhtml_bannergroup</action>
63
+ </bannergroup>
64
+ <bannersetting module="banner">
65
+ <title>Settings</title>
66
+ <sort_order>2</sort_order>
67
+ <action>adminhtml/system_config/edit/section/banner</action>
68
+ </bannersetting>
69
+ </children>
70
+ </banner>
71
+ </menu>
72
+ <acl>
73
+ <resources>
74
+ <all>
75
+ <title>Allow Everything</title>
76
+ </all>
77
+ <admin>
78
+ <children>
79
+ <Uni_Banner>
80
+ <title>Banner Module</title>
81
+ <sort_order>11</sort_order>
82
+ </Uni_Banner>
83
+ <system>
84
+ <children>
85
+ <config>
86
+ <children>
87
+ <banner>
88
+ <title>Banner Settings</title>
89
+ </banner>
90
+ </children>
91
+ </config>
92
+ </children>
93
+ </system>
94
+ </children>
95
+ </admin>
96
+ </resources>
97
+ </acl>
98
+ <layout>
99
+ <updates>
100
+ <banner>
101
+ <file>unibanner.xml</file>
102
+ </banner>
103
+ </updates>
104
+ </layout>
105
+ </adminhtml>
106
+ <global>
107
+ <models>
108
+ <banner>
109
+ <class>Uni_Banner_Model</class>
110
+ <resourceModel>banner_mysql4</resourceModel>
111
+ </banner>
112
+ <banner_mysql4>
113
+ <class>Uni_Banner_Model_Mysql4</class>
114
+ <entities>
115
+ <banner>
116
+ <table>uni_banner</table>
117
+ </banner>
118
+ <bannergroup>
119
+ <table>uni_bannergroup</table>
120
+ </bannergroup>
121
+ </entities>
122
+ </banner_mysql4>
123
+ </models>
124
+ <blocks>
125
+ <banner>
126
+ <class>Uni_Banner_Block</class>
127
+ </banner>
128
+ <adminhtml>
129
+ <rewrite>
130
+ <widget_grid_column>Uni_Banner_Block_Adminhtml_Widget_Grid_Column</widget_grid_column>
131
+ </rewrite>
132
+ </adminhtml>
133
+ </blocks>
134
+ <helpers>
135
+ <banner>
136
+ <class>Uni_Banner_Helper</class>
137
+ </banner>
138
+ </helpers>
139
+ <resources>
140
+ <banner_setup>
141
+ <setup>
142
+ <module>Uni_Banner</module>
143
+ </setup>
144
+ <connection>
145
+ <use>core_setup</use>
146
+ </connection>
147
+ </banner_setup>
148
+ <banner_write>
149
+ <connection>
150
+ <use>core_write</use>
151
+ </connection>
152
+ </banner_write>
153
+ <banner_read>
154
+ <connection>
155
+ <use>core_read</use>
156
+ </connection>
157
+ </banner_read>
158
+ </resources>
159
+ </global>
160
+ <default>
161
+ <banner>
162
+ <banner>
163
+ <banner_time_delay>3000</banner_time_delay>
164
+ <banner_autoplay>1</banner_autoplay>
165
+ </banner>
166
+ </banner>
167
+ </default>
168
+ </config>
app/code/community/Uni/Banner/etc/system.xml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Banner
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ -->
11
+ <config>
12
+ <tabs>
13
+ <banner translate="label" module="banner">
14
+ <label>Banner</label>
15
+ <sort_order>220</sort_order>
16
+ </banner>
17
+ </tabs>
18
+ <sections>
19
+ <banner translate="label" module="banner">
20
+ <label>Banner Settings</label>
21
+ <tab>banner</tab>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>0</show_in_store>
25
+ <sort_order>0</sort_order>
26
+ <groups>
27
+ <banner translate="label">
28
+ <label>Banner Settings</label>
29
+ <frontend_type>text</frontend_type>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>0</show_in_store>
33
+ <fields>
34
+ <banner_time_delay translate="label">
35
+ <label>Time Delay</label>
36
+ <comment>In Milliseconds [eg: 1 Second = 1000 Millisecond] .</comment>
37
+ <frontend_type>text</frontend_type>
38
+ <sort_order>0</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>0</show_in_store>
42
+ </banner_time_delay>
43
+ <banner_autoplay translate="label">
44
+ <label>Auto Play</label>
45
+ <frontend_type>select</frontend_type>
46
+ <source_model>adminhtml/system_config_source_yesno</source_model>
47
+ <sort_order>1</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>0</show_in_store>
51
+ </banner_autoplay>
52
+ </fields>
53
+ </banner>
54
+ </groups>
55
+ </banner>
56
+ </sections>
57
+ </config>
app/code/community/Uni/Banner/sql/banner_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ $installer = $this;
10
+
11
+ $installer->startSetup();
12
+
13
+ $installer->run("
14
+
15
+ -- DROP TABLE IF EXISTS {$this->getTable('uni_banner')};
16
+ CREATE TABLE {$this->getTable('uni_banner')} (
17
+ `banner_id` int(11) unsigned NOT NULL auto_increment,
18
+ `title` varchar(255) NOT NULL default '',
19
+ `filename` varchar(255) NOT NULL default '',
20
+ `link` varchar(255) NOT NULL default '',
21
+ `banner_content` text NOT NULL default '',
22
+ `status` smallint(6) NOT NULL default '0',
23
+ `sort_order` int(11) NOT NULL default '0',
24
+ `banner_type` TINYINT( 4 ) NOT NULL DEFAULT '0' COMMENT '0=>Image, 1=>HTML',
25
+ `created_time` DATETIME NULL,
26
+ `update_time` DATETIME NULL,
27
+ PRIMARY KEY (`banner_id`)
28
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
29
+
30
+ INSERT INTO {$this->getTable('uni_banner')} (`banner_id`, `title`, `filename`, `link`, `banner_content`, `status`, `sort_order`, `banner_type`, `created_time`, `update_time`) VALUES
31
+ (1, 'Banner 1', 'custom/banners/File-1300256573.jpg', '', '', 1, 0, 0, '2011-03-16 06:22:53', '2011-03-16 06:22:53'),
32
+ (2, 'Banner 2', 'custom/banners/File-1300256584.jpg', '', '', 1, 0, 0, '2011-03-16 06:23:04', '2011-03-16 06:23:04'),
33
+ (3, 'Banner 3', 'custom/banners/File-1300256596.jpg', '', '', 1, 0, 0, '2011-03-16 06:23:16', '2011-03-16 06:23:16'),
34
+ (4, 'Banner 4', 'custom/banners/File-1300256608.jpg', '', '', 1, 0, 0, '2011-03-16 06:23:28', '2011-03-16 06:23:28');
35
+
36
+
37
+ -- DROP TABLE IF EXISTS {$this->getTable('uni_bannergroup')};
38
+ CREATE TABLE {$this->getTable('uni_bannergroup')} (
39
+ `group_id` int(11) unsigned NOT NULL auto_increment,
40
+ `group_name` varchar(255) NOT NULL default '',
41
+ `group_code` varchar(255) NOT NULL default '',
42
+ `banner_width` SMALLINT( 4 ) NOT NULL DEFAULT '0',
43
+ `banner_height` SMALLINT( 4 ) NOT NULL DEFAULT '0',
44
+ `animation_type` TINYINT( 4 ) NOT NULL DEFAULT '0' COMMENT '0=>Pre-defined, 1=> Custom Animation',
45
+ `banner_effects` varchar(255) NOT NULL default '',
46
+ `pre_banner_effects` varchar(255) NOT NULL default '',
47
+ `banner_ids` varchar(255) NOT NULL default '',
48
+ `show_title` TINYINT(4) NOT NULL default '0',
49
+ `show_content` TINYINT(4) NOT NULL default '0',
50
+ `link_target` TINYINT( 4 ) NOT NULL DEFAULT '0' COMMENT '0=>New Window, 1=> Self',
51
+ `status` smallint(6) NOT NULL default '0',
52
+ `created_time` DATETIME NULL,
53
+ `update_time` DATETIME NULL,
54
+ PRIMARY KEY (`group_id`)
55
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
56
+
57
+ INSERT INTO {$this->getTable('uni_bannergroup')} (`group_id`, `group_name`, `group_code`, `banner_width`, `banner_height`, `animation_type`, `banner_effects`, `pre_banner_effects`, `banner_ids`, `show_title`, `show_content`, `link_target`, `status`, `created_time`, `update_time`) VALUES
58
+ (1, 'Home Banner', 'home_banner', 480, 400, 0, '', 'Numbered Banner', '1,2,3,4', 0, 0, 0, 1, '2011-03-16 06:25:57', '2011-03-16 06:25:57')
59
+ (2, 'Left Banner', 'left_banner', 195, 200, 0, '', 'Square Transition Banner', '2,3,4', 0, 0, 0, 1, '2011-03-16 07:11:12', '2011-03-16 07:11:12');
60
+ ");
61
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/unibanner.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Banner
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ -->
11
+ <layout version="0.1.0">
12
+ <banner_adminhtml_banner_index>
13
+ <reference name="content">
14
+ <block type="banner/adminhtml_banner" name="banner" />
15
+ </reference>
16
+ </banner_adminhtml_banner_index>
17
+ <banner_adminhtml_bannergroup_index>
18
+ <reference name="content">
19
+ <block type="banner/adminhtml_bannergroup" name="bannergroup" />
20
+ </reference>
21
+ </banner_adminhtml_bannergroup_index>
22
+ <banner_adminhtml_banner_edit>
23
+ <update handle="editor"/>
24
+ </banner_adminhtml_banner_edit>
25
+ </layout>
app/design/adminhtml/default/default/template/unibanner/banners.phtml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ -->
10
+ <?php echo $this->getTabsHtml() ?>
11
+ <script type="text/javascript">
12
+ //<![CDATA[
13
+ function load_banner_funcs(){
14
+ <?php if (($block = $this->getLayout()->getBlock('bannergroup.grid.banner')) && ($_gridJsObject = $block->getJsObjectName())): ?>
15
+ if(!$('in_bannergroup_banners')){
16
+ setTimeout('load_banner_funcs()',500);
17
+ return false;
18
+ }
19
+ var selectedBanners=$H(<?php echo $this->getBannersJson(); ?>);
20
+ $('in_bannergroup_banners').value = selectedBanners.toQueryString();
21
+
22
+ function registerSelectedBanner(grid, element, checked){
23
+ if(checked){
24
+ selectedBanners.set(element.value, element.value);
25
+ }
26
+ else{
27
+ selectedBanners.unset(element.value);
28
+ }
29
+ $('in_bannergroup_banners').value = selectedBanners.toQueryString();
30
+ grid.reloadParams = {'selected_banners[]':selectedBanners.keys()};
31
+ }
32
+ function selectedBannerRowClick(grid, event){
33
+ var trElement = Event.findElement(event, 'tr');
34
+ var isInput = Event.element(event).tagName == 'INPUT';
35
+ if(trElement){
36
+ var checkbox = Element.getElementsBySelector(trElement, 'input');
37
+ if(checkbox[0]){
38
+ var checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
39
+ <?php echo $_gridJsObject ?>.setCheckboxChecked(checkbox[0], checked);
40
+ }
41
+ }
42
+ }
43
+
44
+ var tabIndex = 1000;
45
+ function selectedBannerRowInit(grid, row){
46
+ var checkbox = $(row).getElementsByClassName('checkbox')[0];
47
+ }
48
+
49
+
50
+ <?php echo $_gridJsObject ?>.rowClickCallback = selectedBannerRowClick;
51
+ <?php echo $_gridJsObject ?>.initRowCallback = selectedBannerRowInit;
52
+ <?php echo $_gridJsObject ?>.checkboxCheckCallback = registerSelectedBanner;
53
+ <?php echo $_gridJsObject ?>.rows.each(function(row){selectedBannerRowInit(<?php echo $_gridJsObject ?>, row)});
54
+
55
+ <?php endif; ?>
56
+ }
57
+ load_banner_funcs();
58
+ //]]>
59
+ </script>
app/design/frontend/default/default/layout/unibanner.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Banner
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ -->
11
+ <layout version="0.1.0">
12
+ <default>
13
+ <reference name="top.links">
14
+ <action method="addLink" translate="label title" module="banner"><label>Banner</label><url>banner</url><title>Banner</title><prepare>true</prepare></action>
15
+ </reference>
16
+ </default>
17
+ <banner_index_index>
18
+ <reference name="left">
19
+ <block type="banner/banner" name="banner.left" template="unibanner/banner.phtml">
20
+ <action method="setData">
21
+ <name>banner_group_code</name>
22
+ <value>left_banner</value>
23
+ </action>
24
+ </block>
25
+ </reference>
26
+ <reference name="content">
27
+ <block type="banner/banner" name="banner.home" template="unibanner/banner.phtml">
28
+ <action method="setData">
29
+ <name>banner_group_code</name>
30
+ <value>home_banner</value>
31
+ </action>
32
+ </block>
33
+ </reference>
34
+ </banner_index_index>
35
+ </layout>
app/design/frontend/default/default/template/unibanner/banner.phtml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Banner
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ ?>
11
+ <?php
12
+
13
+ $bannerGroupCode = $this->getBannerGroupCode();
14
+ $data = $this->getDataByGroupCode($bannerGroupCode);
15
+ $bannerGroupData = $data['group_data'];
16
+ $template = '';
17
+ if (count($bannerGroupData) > 0):
18
+ $prebaneff = $bannerGroupData->getPreBannerEffects();
19
+ $bannerType = $bannerGroupData->getAnimationType();
20
+ ?>
21
+ <?php
22
+ if ($bannerType == 1):
23
+ $template = $this->getLayout()->createBlock('banner/banner', 'custom.banner')->setBannerGroupCode($bannerGroupCode)->setTemplate('unibanner/effects/custom.phtml')->toHtml();
24
+ else:
25
+ switch ($prebaneff) {
26
+ case 'Image Slide Show':
27
+ $template = $this->getLayout()->createBlock('banner/banner', 'slideshow.banner')->setBannerGroupCode($bannerGroupCode)->setTemplate('unibanner/effects/slideshow.phtml')->toHtml();
28
+ break;
29
+ case 'Square Transition Banner':
30
+ $template = $this->getLayout()->createBlock('banner/banner', 'strans.banner')->setBannerGroupCode($bannerGroupCode)->setTemplate('unibanner/effects/strans.phtml')->toHtml();
31
+ break;
32
+ case 'Text Fade Banner':
33
+ $template = $this->getLayout()->createBlock('banner/banner', 'textfade.banner')->setBannerGroupCode($bannerGroupCode)->setTemplate('unibanner/effects/textfade.phtml')->toHtml();
34
+ break;
35
+ case 'Play And Pause Slide Show':
36
+ $template = $this->getLayout()->createBlock('banner/banner', 'playpause.banner')->setBannerGroupCode($bannerGroupCode)->setTemplate('unibanner/effects/playpause.phtml')->toHtml();
37
+ break;
38
+ case 'Numbered Banner':
39
+ $template = $this->getLayout()->createBlock('banner/banner', 'numbered.banner')->setBannerGroupCode($bannerGroupCode)->setTemplate('unibanner/effects/numbered.phtml')->toHtml();
40
+ break;
41
+ case 'image spring slider':
42
+ $template = $this->getLayout()->createBlock('banner/banner', 'springslider.banner')->setBannerGroupCode($bannerGroupCode)->setTemplate('unibanner/effects/springslider.phtml')->toHtml();
43
+ break;
44
+ case 'image vertical slider':
45
+ $template = $this->getLayout()->createBlock('banner/banner', 'verslider.banner')->setBannerGroupCode($bannerGroupCode)->setTemplate('unibanner/effects/verslider.phtml')->toHtml();
46
+ break;
47
+ case 'image glider':
48
+ $template = $this->getLayout()->createBlock('banner/banner', 'glider.banner')->setBannerGroupCode($bannerGroupCode)->setTemplate('unibanner/effects/horslider.phtml')->toHtml();
49
+ break;
50
+ }
51
+ endif;
52
+ echo $template;
53
+ endif;
54
+ ?>
app/design/frontend/default/default/template/unibanner/effects/custom.phtml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ ?>
10
+ <script type="text/javascript" src="<?php echo $this->getSkinUrl('unibanner/js/custom.js') ?>"></script>
11
+ <link rel="stylesheet" type="text/css" media="all" href="<?php echo $this->getSkinUrl('unibanner/css/custom.css') ?>" />
12
+ <?php
13
+ $bannerGroupCode = $this->getBannerGroupCode();
14
+ $data = $this->getDataByGroupCode($bannerGroupCode);
15
+ $bannerGroupData = $data['group_data'];
16
+ $mediaDir = Mage::getBaseDir('media');
17
+ $bannerData = $data['banner_data'];
18
+ $baneff = $bannerGroupData->getBannerEffects();
19
+ $bannerdest = (($bannerGroupData->getLinkTarget() == 0) ? '_blank' : '_self');
20
+ $bannerType = $bannerGroupData->getAnimationType();
21
+ $bannerWidth = $bannerGroupData->getBannerWidth();
22
+ $bannerHeight = $bannerGroupData->getBannerHeight();
23
+ $imageWidth = ((int) $bannerWidth - 3);
24
+ $imageHeight = ((int) $bannerHeight - 3);
25
+ $styleBWH = 'width: ' . $bannerWidth . 'px; height: ' . $bannerHeight . 'px;';
26
+ $styleWH = 'width: ' . $imageWidth . 'px; height: ' . $imageHeight . 'px;';
27
+ $duration = Mage::getStoreConfig('banner/banner/banner_time_delay');
28
+ ?>
29
+ <style type="text/css">
30
+ .custom-banner{<?php echo $styleBWH; ?>;}
31
+ .custom-banner img.custom-banner-img{<?php echo $styleWH; ?>;}
32
+ .custom-banner div.custom-banner-txt{<?php echo $styleWH; ?>}
33
+ </style>
34
+ <div class="custom-banner">
35
+ <?php
36
+ $i = 0;
37
+ foreach ($bannerData as $banner):
38
+ $i++;
39
+ $bannerType = $banner->getBannerType();
40
+ $bannerTitle = $banner->getTitle();
41
+ $bannerContent = $banner->getBannerContent();
42
+ $bannerLink = $banner->getLink();
43
+ $v = "img" . $i;
44
+ if ($bannerType == 0) :
45
+ $bannerPath = $banner->getFilename();
46
+ $bannerImage = '';
47
+ if ($bannerPath != '' && @file_exists($mediaDir . DS . $bannerPath)):
48
+ $bannerImage = $this->getResizeImage($bannerPath, $bannerGroupCode, $imageWidth, $imageHeight);
49
+ endif;
50
+ if ($bannerImage != '') :
51
+ ?>
52
+ <a href="<?php echo (($bannerLink) ? $bannerLink : 'javascript:'); ?>" <?php echo (($bannerLink)?'target="'.$bannerdest.'"':''); ?> title="<?php echo $bannerTitle; ?>"><img id="<?php echo $v; ?>" class="custom-banner-img" style="display: none;" src="<?php echo $bannerImage; ?>" alt="<?php echo $bannerTitle; ?>" /></a>
53
+ <?php
54
+ endif;
55
+ else:
56
+ ?><div id="<?php echo $v; ?>" style="display: none;" class="custom-banner-txt"><a href="<?php echo (($bannerLink) ? $bannerLink : 'javascript:'); ?>" title="<?php echo $bannerTitle; ?>" <?php echo (($bannerLink)?'target="'.$bannerdest.'"':''); ?>><?php echo $bannerContent; ?></a></div>
57
+ <?php endif;
58
+ endforeach; ?>
59
+ </div>
60
+ <script type="text/javascript">
61
+ <?php if ($baneff == 'Fade/Appear') { ?>
62
+ slideshowdefault(1,<?php echo $i; ?>,<?php echo $duration; ?>);
63
+ <?php } else { ?>
64
+ slideshow(1,<?php echo $i; ?>,<?php echo $duration; ?>,Effect.<?php echo $baneff; ?>);
65
+ <?php } ?>
66
+ </script>
app/design/frontend/default/default/template/unibanner/effects/horslider.phtml ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ ?>
10
+ <link rel="stylesheet" type="text/css" media="all" href="<?php echo $this->getSkinUrl('unibanner/css/glider.css') ?>" />
11
+ <!--[if IE ]>
12
+ <link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('unibanner/css/opacityother.css') ?>" " media="all" />
13
+ <![endif]-->
14
+ <link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('unibanner/css/noieopacity.css') ?>" media="all" />
15
+ <script type="text/javascript" src="<?php echo $this->getSkinUrl('unibanner/js/glider.js') ?>"></script>
16
+ <?php
17
+ $bannerGroupCode = $this->getBannerGroupCode();
18
+ $data = $this->getDataByGroupCode($bannerGroupCode);
19
+ $bannerGroupData = $data['group_data'];
20
+ $mediaDir = Mage::getBaseDir('media');
21
+ $bannerData = $data['banner_data'];
22
+ $bannerdest = (($bannerGroupData->getLinkTarget() == 0) ? '_blank' : '_self');
23
+ $bannerType = $bannerGroupData->getAnimationType();
24
+ $bannerWidth = $bannerGroupData->getBannerWidth();
25
+ $bannerHeight = $bannerGroupData->getBannerHeight();
26
+
27
+ $styleBWH = 'width: ' . $bannerWidth . 'px; height: ' . $bannerHeight . 'px;';
28
+ $duration = Mage::getStoreConfig('banner/banner/banner_time_delay');
29
+ $autoplay = Mage::getStoreConfig('banner/banner/banner_autoplay');
30
+ $durat = $duration / 1000;
31
+ $imageWidth = ((int) $bannerWidth - 2);
32
+ $imageHeight = ((int) $bannerHeight - 2);
33
+ $styleWH = 'width: ' . $imageWidth . 'px; height: ' . $imageHeight . 'px;';
34
+ ?>
35
+ <style type="text/css">
36
+ div#sliderhori{<?php echo $styleBWH; ?>;}
37
+ div.scrollerhori{<?php echo $styleWH; ?>;}
38
+ div.scrollerhori div.sectionhori{<?php echo $styleWH; ?>;}
39
+ div.scrollerhori div.contenthori{<?php echo $styleWH; ?>;}
40
+ div.scrollerhori div.sectionhori img{<?php echo $styleWH; ?>;}
41
+ .bannerlinergliderhori{width:<?php echo ($imageWidth . "px"); ?>;}
42
+ </style>
43
+ <div id="sliderhori">
44
+ <div class="scrollerhori">
45
+ <div class="contenthori">
46
+ <?php
47
+ $i = 0;
48
+ foreach ($bannerData as $banner):
49
+ $i++;
50
+ $v = "imgglid" . $i;
51
+ $bannerPath = $banner->getFilename();
52
+ $bannerCon = $banner->getBannerContent();
53
+ $bannerTitle = $banner->getTitle();
54
+ $bannerType = $banner->getBannerType();
55
+ $bannerLink = $banner->getLink();
56
+ if ($bannerType == 0):
57
+ $bannerImage = '';
58
+ if ($bannerPath != '' && @file_exists($mediaDir . DS . $bannerPath)):
59
+ $bannerImage = $this->getResizeImage($bannerPath, $bannerGroupCode, $imageWidth, $imageHeight);
60
+ endif;
61
+ $bannerLink = $banner->getLink();
62
+ if ($bannerImage != '') :
63
+ ?>
64
+ <div class="sectionhori" id="sectionhori<?php echo $i; ?>"><a href="<?php echo (($bannerLink) ? $bannerLink : 'javascript:'); ?>" <?php echo (($bannerLink)?'target="'.$bannerdest.'"':''); ?>><img id="<?php echo $v; ?>" src="<?php echo $bannerImage; ?>" alt="<?php echo $bannerTitle; ?>"/></a></div>
65
+ <?php endif;
66
+ else: ?>
67
+ <div class="sectionhori" id="sectionhori<?php echo $i; ?>"><a href="<?php echo (($bannerLink) ? $bannerLink : 'javascript:'); ?>" <?php echo (($bannerLink)?'target="'.$bannerdest.'"':''); ?> title="<?php echo $bannerTitle; ?>"><?php echo $bannerCon; ?></a></div>
68
+ <?php endif;
69
+ endforeach; ?>
70
+ </div>
71
+ <script type="text/javascript">
72
+ var my_gliderhori = new Glider('sliderhori', {scroller: 'div.scrollerhori', sections: 'div.sectionhori', duration:<?php echo $durat; ?>, autoGlide: <?php echo (($autoplay == 1) ? 'true' : 'false'); ?>, frequency:<?php echo (int)$durat*2; ?>, initialSection: 'sectionhori1'});
73
+ </script>
74
+ </div>
75
+ <div class="bannerlinergliderhori"></div>
76
+ <div class="slidercontrolhori">
77
+ <a href="javascript:" class="aprev" title="<?php echo $this->__('Previous') ?>" onclick="my_gliderhori.previous();return false;"><?php echo $this->__('Previous') ?></a>
78
+ <a href="javascript:" class="astop" title="<?php echo $this->__('Stop') ?>" onclick="my_gliderhori.stop();return false"><?php echo $this->__('Stop') ?></a>
79
+ <a href="javascript:" class="aplay" title="<?php echo $this->__('Play') ?>" onclick="my_gliderhori.start();return false"><?php echo $this->__('Start') ?></a>
80
+ <a href="javascript:" class="anext" title="<?php echo $this->__('Next') ?>" onclick="my_gliderhori.next();return false"><?php echo $this->__('Next') ?></a>
81
+ </div>
82
+ </div>
app/design/frontend/default/default/template/unibanner/effects/numbered.phtml ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ ?>
10
+ <link rel="stylesheet" type="text/css" media="all" href="<?php echo $this->getSkinUrl('unibanner/css/custom.css') ?>" />
11
+ <script type="text/javascript" src="<?php echo $this->getSkinUrl('unibanner/js/ajaxtabs.js') ?>"></script>
12
+ <?php
13
+ $bannerGroupCode = $this->getBannerGroupCode();
14
+ $data = $this->getDataByGroupCode($bannerGroupCode);
15
+ $bannerGroupData = $data['group_data'];
16
+ $mediaDir = Mage::getBaseDir('media');
17
+ $bannerData = $data['banner_data'];
18
+ $bannerdest = (($bannerGroupData->getLinkTarget() == 0) ? '_blank' : '_self');
19
+ $bannerType = $bannerGroupData->getAnimationType();
20
+ $bannerWidth = $bannerGroupData->getBannerWidth();
21
+ $bannerHeight = $bannerGroupData->getBannerHeight();
22
+ $duration = Mage::getStoreConfig('banner/banner/banner_time_delay');
23
+ $autoplay = Mage::getStoreConfig('banner/banner/banner_autoplay');
24
+ $imageWidth = ((int) $bannerWidth);
25
+ $imageHeight = ((int) $bannerHeight);
26
+ $styleNWH = 'width: ' . ((int) $bannerWidth + 5) . 'px; height: ' . ((int) $bannerHeight + 5) . 'px;';
27
+ $styleWH = 'width: ' . $imageWidth . 'px; height: ' . $imageHeight . 'px;';
28
+ ?>
29
+ <style type="text/css">
30
+ .bannerline{width:<?php echo ($imageWidth . "px"); ?>;}
31
+ .slider{<?php echo $styleNWH; ?>; }
32
+ .slider .slide-show{<?php echo $styleNWH; ?>; }
33
+ .slider .slide-show .slider-images{<?php echo $styleNWH; ?>; }
34
+ .slider .tabcontent{<?php echo $styleWH; ?>;}
35
+ .slider .tabcontent img{<?php echo $styleWH; ?>}
36
+ </style>
37
+ <div class="slider">
38
+ <div class="slide-show" id="slide-images">
39
+ <div class="slider-images">
40
+ <?php
41
+ $i = 0;
42
+ foreach ($bannerData as $banner):
43
+ $i++;
44
+ $disp = (($i == 1) ? 'inline' : 'none');
45
+ $v = "imgnumber" . $i;
46
+ $bannerPath = $banner->getFilename();
47
+ $bannerType = $banner->getBannerType();
48
+ $bannerTitle = $banner->getTitle();
49
+ $bannerLink = $banner->getLink();
50
+ $bannerContent = $banner->getBannerContent();
51
+ if ($bannerType == 0) :
52
+ $bannerImage = '';
53
+ if ($bannerPath != '' && @file_exists($mediaDir . DS . $bannerPath)) :
54
+ $bannerImage = $this->getResizeImage($bannerPath, $bannerGroupCode, $imageWidth, $imageHeight);
55
+ endif;
56
+ if ($bannerImage != '') :
57
+ ?>
58
+ <div id="<?php echo "tab" . $i; ?>" class="tabcontent">
59
+ <a href="<?php echo (($bannerLink) ? $bannerLink : 'javascript:'); ?>" title="<?php echo $bannerTitle; ?>" <?php echo (($bannerLink)?'target="'.$bannerdest.'"':''); ?>><img src="<?php echo $bannerImage; ?>" style="<?php echo $styleWH; ?>" alt="<?php echo $bannerTitle; ?>"/></a>
60
+ </div>
61
+ <?php endif;
62
+ else: ?>
63
+ <div id="<?php echo "tab" . $i; ?>" class="tabcontent">
64
+ <a href="<?php echo (($bannerLink) ? $bannerLink : 'javascript:'); ?>" title="<?php echo $bannerTitle; ?>" <?php echo (($bannerLink)?'target="'.$bannerdest.'"':''); ?>><?php echo $bannerContent; ?></a>
65
+ </div>
66
+ <?php
67
+ endif;
68
+ endforeach;
69
+ ?>
70
+ </div>
71
+ <div class="bannerline"><div id="pettabs" class="indentmenu">
72
+ <ul>
73
+ <?php for ($w = 1; $w <= $i; $w++) :
74
+ $uvb123 = (($w == 1) ? "selected" : ""); ?>
75
+ <li><a rel="tab<?php echo $w; ?>" href="javascript:" class="<?php echo $uvb123; ?>"><?php echo $w; ?></a></li>
76
+ <?php endfor; ?>
77
+ </ul>
78
+ </div></div>
79
+ </div>
80
+ </div>
81
+ <script type="text/javascript">
82
+ <?php echo 'var delay = ' . (($autoplay == 1) ? $duration : '""') . ';'; ?>
83
+ var mypets=new ddtabcontent("pettabs");
84
+ mypets.setpersist(true);
85
+ mypets.setselectedClassTarget("link");
86
+ mypets.init(delay);
87
+ </script>
app/design/frontend/default/default/template/unibanner/effects/playpause.phtml ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ ?>
10
+ <link rel="stylesheet" type="text/css" media="all" href="<?php echo $this->getSkinUrl('unibanner/css/stylesban.css') ?>" />
11
+ <script type="text/javascript" src="<?php echo $this->getSkinUrl('unibanner/js/protofade.js') ?>"></script>
12
+ <!--[if IE ]>
13
+ <link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('unibanner/css/opacityother.css') ?>" media="all" />
14
+ <![endif]-->
15
+ <link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('unibanner/css/noieopacity.css') ?>" media="all" />
16
+ <?php
17
+ $bannerGroupCode = $this->getBannerGroupCode();
18
+ $data = $this->getDataByGroupCode($bannerGroupCode);
19
+ $bannerGroupData = $data['group_data'];
20
+ $mediaDir = Mage::getBaseDir('media');
21
+ $bannerData = $data['banner_data'];
22
+ $bannerdest = (($bannerGroupData->getLinkTarget() == 0) ? '_blank' : '_self');
23
+ $bannerType = $bannerGroupData->getAnimationType();
24
+ $bannerWidth = $bannerGroupData->getBannerWidth();
25
+ $bannerHeight = $bannerGroupData->getBannerHeight();
26
+ $imageWidth = ((int) $bannerWidth - 3);
27
+ $imageHeight = ((int) $bannerHeight - 3);
28
+ $styleWH = 'width: ' . $imageWidth . 'px; height: ' . $imageHeight . 'px;';
29
+ $duration = Mage::getStoreConfig('banner/banner/banner_time_delay');
30
+ $autoplay = Mage::getStoreConfig('banner/banner/banner_autoplay');
31
+ $durat = $duration / 1000;
32
+ $styleMBWH = 'width: ' . $bannerWidth . 'px; height: ' . ((int) $bannerHeight + 20) . 'px;';
33
+ ?>
34
+ <script type="text/javascript">
35
+ function StartUp() {
36
+ new Protofade('protofade3', { duration: 0.5, delay:<?php echo $durat; ?>, controls: true, autostart:<?php echo (($autoplay == 1) ? 'true' : 'false'); ?> });
37
+ }
38
+ document.observe ('dom:loaded', StartUp);
39
+ </script>
40
+ <style type="text/css">
41
+ #slider-container3{<?php echo $styleMBWH;?>;}
42
+ .bannerlinerpau{ margin-top:-33px; background:none repeat scroll 0 0 #618499;display:inline;
43
+ height:28px;
44
+ margin-left:0px;
45
+ position:absolute;
46
+ width:<?php echo ($bannerWidth . "px"); ?>;
47
+ z-index:999;}
48
+ #slider-container3 .controls{position:relative;margin-top:10px; width:96%; z-index:1000;color:#000}
49
+ </style>
50
+ <!--[if lt IE 7]>
51
+ <style type="text/css">
52
+ #protofade3{width:0px; height:0px;}</style>
53
+ <![endif]-->
54
+ <style type="text/css">
55
+ #protofade3{<?php echo $styleWH; ?>}
56
+ #protofade3 .fade-banner-title{font-size:<?php echo ((int) $bannerHeight / 15) . 'px'; ?>; <?php echo ((((int) $bannerHeight / 15) < 18) ? 'font-weight:bold;' : 'font-weight:normal;'); ?>}
57
+ #protofade3 .slide-banner-img{<?php echo $styleWH; ?>}
58
+ #protofade3 .slide-banner-txt{<?php echo $styleWH; ?>}
59
+ </style>
60
+ <div id="slider-container3">
61
+ <ul id="protofade3">
62
+ <?php
63
+ $i = 0;
64
+ foreach ($bannerData as $banner):
65
+ $bannerPath = $banner->getFilename();
66
+ $bannerLink = $banner->getLink();
67
+ $bannerContent = $banner->getBannerContent();
68
+ $bannerTitle = $banner->getTitle();
69
+ $i++;
70
+ $bannerType = $banner->getBannerType();
71
+ if ($bannerType == 0) :
72
+ $bannerImage = '';
73
+ if ($bannerPath != '' && @file_exists($mediaDir . DS . $bannerPath)) :
74
+ $bannerImage = $this->getResizeImage($bannerPath, $bannerGroupCode, $imageWidth, $imageHeight);
75
+ endif;
76
+ if ($bannerImage != '') :
77
+ $i++;
78
+ $v = "imgpps" . $i;
79
+ ?>
80
+ <li><a href="<?php echo (($bannerLink) ? $bannerLink : 'javascript:'); ?>" <?php echo (($bannerLink)?'target="'.$bannerdest.'"':''); ?> title="<?php echo $bannerTitle; ?>"><img id="<?php echo $v; ?>" class="slide-banner-img" src="<?php echo $bannerImage; ?>" alt="<?php echo $bannerTitle; ?>" /></a></li>
81
+ <?php
82
+ endif;
83
+ else:
84
+ ?>
85
+ <li class="slide-banner-txt"><a href="<?php echo (($bannerLink) ? $bannerLink : 'javascript:'); ?>" title="<?php echo $bannerTitle; ?>" <?php echo (($bannerLink)?'target="'.$bannerdest.'"':''); ?>><?php echo $bannerContent; ?></a></li>
86
+ <?php endif;
87
+ endforeach; ?>
88
+ </ul>
89
+ <div class="bannerlinerpau"></div>
90
+ </div>
app/design/frontend/default/default/template/unibanner/effects/slideshow.phtml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ ?>
10
+ <?php
11
+ $bannerGroupCode = $this->getBannerGroupCode();
12
+ $data = $this->getDataByGroupCode($bannerGroupCode);
13
+ $bannerGroupData = $data['group_data'];
14
+ $mediaDir = Mage::getBaseDir('media');
15
+ $bannerData = $data['banner_data'];
16
+ $bannerdest = (($bannerGroupData->getLinkTarget() == 0) ? '_blank' : '_self');
17
+ $bannerType = $bannerGroupData->getAnimationType();
18
+ $bannerWidth = $bannerGroupData->getBannerWidth();
19
+ $bannerHeight = $bannerGroupData->getBannerHeight();
20
+ $duration = Mage::getStoreConfig('banner/banner/banner_time_delay');
21
+ $autoplay = Mage::getStoreConfig('banner/banner/banner_autoplay');
22
+
23
+ $imageWidth = ((int) $bannerWidth / 1.8);
24
+ $imageHeight = ((int) $bannerHeight / 1.8);
25
+ $styleWH = 'width: ' . $imageWidth . 'px; height: ' . $imageHeight . 'px;';
26
+ $styleBWH = 'width: ' . $bannerWidth . 'px; height: ' . $bannerHeight . 'px;';
27
+ ?>
28
+ <link rel="stylesheet" type="text/css" media="all" href="<?php echo $this->getSkinUrl('unibanner/css/protoFlow.css') ?>"/>
29
+ <script type="text/javascript" src="<?php echo $this->getSkinUrl('unibanner/js/protoFlow.js') ?>"></script>
30
+ <script type="text/javascript" src="<?php echo $this->getSkinUrl('unibanner/js/prettify.js') ?>"></script>
31
+ <script type="text/javascript" language="javascript">
32
+ Event.observe(window, 'load', function() {
33
+ prettyPrint();
34
+ cf = new ProtoFlow($("protoflow"), {
35
+ startIndex: 2,
36
+ interval: 60,
37
+ captions: true,
38
+ useReflection: true,
39
+ enableOnClickScroll: true,
40
+ autoplay: <?php echo (($autoplay == 1) ? 'true' : 'false'); ?>
41
+ });
42
+ });
43
+ </script>
44
+ <style type="text/css">
45
+ #protoflow{<?php echo $styleBWH; ?>}
46
+ #protoflow .captionHolder{font-size:<?php echo ((int) $bannerHeight / 15) . 'px'; ?>; <?php echo ((((int) $bannerHeight / 15) < 18) ? 'font-weight:bold;' : 'font-weight:normal;'); ?>;}
47
+ </style>
48
+ <div id="protoflow">
49
+ <?php
50
+ $i = 0;
51
+ foreach ($bannerData as $banner):
52
+ $bannerType = $banner->getBannerType();
53
+ $bannerPath = $banner->getFilename();
54
+ $bannerTitle = $banner->getTitle();
55
+ $bannerContent = $banner->getBannerContent();
56
+ $bannerLink = $banner->getLink();
57
+ if ($bannerType == 0):
58
+ $i++;
59
+ $v = "imgslid" . $i;
60
+ $bannerImage = '';
61
+ if ($bannerPath != '' && @file_exists($mediaDir . DS . $bannerPath)):
62
+ $bannerImage = $this->getResizeImage($bannerPath, $bannerGroupCode, $imageWidth, $imageHeight);
63
+ endif;
64
+ if ($bannerImage != '') : ?>
65
+ <a href="<?php echo (($bannerLink) ? $bannerLink : 'javascript:'); ?>" <?php echo (($bannerLink)?'target="'.$bannerdest.'"':''); ?> title="<?php echo $bannerTitle; ?>"><img id="<?php echo $v; ?>" class="slider-banner-img" src="<?php echo $bannerImage; ?>" alt="<?php echo $bannerTitle; ?>" /></a>
66
+ <?php
67
+ endif;
68
+ endif;
69
+ endforeach;
70
+ ?>
71
+ </div>
app/design/frontend/default/default/template/unibanner/effects/springslider.phtml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ ?>
10
+ <link rel="stylesheet" type="text/css" media="all" href="<?php echo $this->getSkinUrl('unibanner/css/carousel.css') ?>" />
11
+ <script type="text/javascript" src="<?php echo $this->getSkinUrl('unibanner/js/carousel.js') ?>"></script>
12
+ <?php
13
+ $bannerGroupCode = $this->getBannerGroupCode();
14
+ $data = $this->getDataByGroupCode($bannerGroupCode);
15
+ $bannerGroupData = $data['group_data'];
16
+ $mediaDir = Mage::getBaseDir('media');
17
+ $bannerData = $data['banner_data'];
18
+ $baneff = $bannerGroupData->getBannerEffects();
19
+ $prebaneff = $bannerGroupData->getPreBannerEffects();
20
+ $bannerdest = (($bannerGroupData->getLinkTarget() == 0) ? '_blank' : '_self');
21
+ $bannerType = $bannerGroupData->getAnimationType();
22
+ $bannerWidth = $bannerGroupData->getBannerWidth();
23
+ $bannerHeight = $bannerGroupData->getBannerHeight();
24
+
25
+ $styleBWH = 'width: ' . $bannerWidth . 'px; height: ' . $bannerHeight . 'px;';
26
+ $duration = Mage::getStoreConfig('banner/banner/banner_time_delay');
27
+ $autoplay = Mage::getStoreConfig('banner/banner/banner_autoplay');
28
+ $durat = $duration / 1000;
29
+ $imageWidth = ((int) $bannerWidth - 1);
30
+ $imageHeight = ((int) $bannerHeight - 2);
31
+ $styleWH = 'width: ' . $imageWidth . 'px; height: ' . $imageHeight . 'px;';
32
+ ?>
33
+ <style type="text/css">
34
+ .carousel{
35
+ border: 1px solid #ccc;
36
+ <?php echo $styleBWH;?>;
37
+ }
38
+ .carousel .carousel-middle {
39
+ float: left;
40
+ <?php echo $styleWH;?>;
41
+ overflow: hidden;
42
+ }
43
+ .carousel .carousel-inner{width: 1000000px; height: <?php echo (int)$bannerHeight.'px';?>;}
44
+ .carousel .carousel-inner .slide{float:left; height: <?php echo (int)$imageHeight.'px';?>; width: <?php echo (int)$bannerWidth.'px';?>; padding: 1px;}
45
+ </style>
46
+ <div id="<?php echo $bannerGroupCode; ?>" class="carousel">
47
+ <div class="carousel-middle">
48
+ <div class="carousel-inner">
49
+ <?php
50
+ $i = 0;
51
+ foreach ($bannerData as $banner):
52
+ $i++;
53
+ $v = "imgspring" . $i;
54
+ $bannerPath = $banner->getFilename();
55
+ $bannerCon = $banner->getBannerContent();
56
+ $bannerTitle = $banner->getTitle();
57
+ $bannerType = $banner->getBannerType();
58
+ $bannerLink = $banner->getLink();
59
+ if ($bannerType == 0):
60
+ $bannerImage = '';
61
+ if ($bannerPath != '' && @file_exists($mediaDir . DS . $bannerPath)) :
62
+ $bannerImage = $this->getResizeImage($bannerPath, $bannerGroupCode, $imageWidth, $imageHeight);
63
+ endif;
64
+ if ($bannerImage != '') :
65
+ ?>
66
+ <div class="slide">
67
+ <div class="section" id="section<?php echo $i; ?>"><a href="<?php echo (($bannerLink) ? $bannerLink : 'javascript:'); ?>" <?php echo (($bannerLink)?'target="'.$bannerdest.'"':''); ?> title="<?php echo $bannerTitle; ?>"><img id="<?php echo $v; ?>" src="<?php echo $bannerImage; ?>" alt="<?php echo $bannerTitle; ?>" /></a></div>
68
+ </div>
69
+ <?php endif;
70
+ else: ?>
71
+ <div class="slide">
72
+ <div class="section" id="section<?php echo $i; ?>"><a href="<?php echo (($bannerLink) ? $bannerLink : 'javascript:'); ?>" <?php echo (($bannerLink)?'target="'.$bannerdest.'"':''); ?> title="<?php echo $bannerTitle; ?>"><?php echo $bannerCon; ?></a></div>
73
+ </div>
74
+ <?php endif;
75
+ endforeach; ?>
76
+ </div>
77
+ </div>
78
+ </div>
79
+ <ul class="tabs">
80
+ <li><a href="javascript:" class="carousel-control prev" title="<?php echo $this->__('Previous') ?>" rel="prev"><?php echo $this->__('Previous') ?></a></li>
81
+ <li><a href="javascript:" class="carousel-control stop" title="<?php echo $this->__('Stop') ?>" rel="pause"><?php echo $this->__('Stop') ?></a></li>
82
+ <li><a href="javascript:" class="carousel-control start" title="<?php echo $this->__('Start') ?>" rel="resume"><?php echo $this->__('Start') ?></a></li>
83
+ <li><a href="javascript:" class="carousel-control next" title="<?php echo $this->__('Next') ?>" rel="next"><?php echo $this->__('Next') ?></a></li>
84
+ </ul>
85
+ <script type="text/javascript">
86
+ //new Carousel($('example-1').down('.middle'), $('example-1').select('.slide'), $('tab-1').select('.controls a'), {duration: 0.4, circular: true, transition: 'spring'});
87
+ //new Carousel($$('.middle-tabs').first(), $$('.section'), $$('ul.tabs a'), {duration: 0.5, wheel: true})
88
+ new Carousel($('<?php echo $bannerGroupCode; ?>').down('.carousel-middle'), $('<?php echo $bannerGroupCode; ?>').down('.carousel-inner').select('div.slide'), $$('ul.tabs a'), {duration: 0.5, effect: 'spring', visibleSlides: 1, circular: true});
89
+ </script>
app/design/frontend/default/default/template/unibanner/effects/strans.phtml ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ ?>
10
+
11
+ <link rel="stylesheet" type="text/css" media="all" href="<?php echo $this->getSkinUrl('unibanner/css/stylesban.css') ?>" />
12
+ <script type="text/javascript" src="<?php echo $this->getSkinUrl('unibanner/js/protofade.js') ?>"></script>
13
+ <?php
14
+ $bannerGroupCode = $this->getBannerGroupCode();
15
+ $data = $this->getDataByGroupCode($bannerGroupCode);
16
+ $bannerGroupData = $data['group_data'];
17
+ $mediaDir = Mage::getBaseDir('media');
18
+ $bannerData = $data['banner_data'];
19
+ $bannerdest = (($bannerGroupData->getLinkTarget() == 0) ? '_blank' : '_self');
20
+ $bannerType = $bannerGroupData->getAnimationType();
21
+ $bannerWidth = $bannerGroupData->getBannerWidth();
22
+ $bannerHeight = $bannerGroupData->getBannerHeight();
23
+ $imageWidth = ((int) $bannerWidth - 3);
24
+ $imageHeight = ((int) $bannerHeight - 3);
25
+ $styleBWH = 'width: ' . $bannerWidth . 'px; height: ' . $bannerHeight . 'px;';
26
+ $duration = Mage::getStoreConfig('banner/banner/banner_time_delay');
27
+ $durat = $duration / 1000;
28
+ ?>
29
+ <script type="text/javascript">
30
+ function StartUp() {
31
+ new Protofade('protofade2', {
32
+ eSquare:true,
33
+ eColor: '#000000',
34
+ delay:<?php echo $durat; ?>,
35
+ autostart:true,
36
+ controls:false,
37
+ eCols: <?php echo ((round((int) $imageWidth / 60) > 3) ? (round((int) $imageWidth / 60)) : 3); ?>,
38
+ eRows: <?php echo ((round((int) $imageHeight / 60) > 3) ? (round((int) $imageHeight / 60)) : 3); ?>
39
+ });
40
+ }
41
+ document.observe ('dom:loaded', StartUp);
42
+ </script>
43
+ <style type="text/css">
44
+ #slider-container2{<?php echo $styleBWH; ?>}
45
+ #protofade2{<?php echo $styleBWH; ?>}
46
+ #protofade2 img.trans-banner-img{<?php echo $styleBWH; ?>}
47
+ </style>
48
+ <div id="slider-container2">
49
+ <ul id="protofade2">
50
+ <?php
51
+ $i = 0;
52
+ foreach ($bannerData as $banner):
53
+ $bannerPath = $banner->getFilename();
54
+ $bannerType = $banner->getBannerType();
55
+ if ($bannerType == 0) :
56
+ $bannerImage = '';
57
+ if ($bannerPath != '' && @file_exists($mediaDir . DS . $bannerPath)) :
58
+ $bannerImage = $this->getResizeImage($bannerPath, $bannerGroupCode, $imageWidth, $imageHeight);
59
+ endif;
60
+ $bannerTitle = $banner->getTitle();
61
+ $bannerContent = $banner->getBannerContent();
62
+ $bannerLink = $banner->getLink();
63
+ if ($bannerImage != '') :
64
+ $i++;
65
+ $v = "imgsqtran" . $i;
66
+ ?>
67
+ <li><a href="<?php echo (($bannerLink) ? $bannerLink : 'javascript:'); ?>" <?php echo (($bannerLink)?'target="'.$bannerdest.'"':''); ?> title="<?php echo $bannerTitle; ?>"><img id="<?php echo $v; ?>" class="trans-banner-img" src="<?php echo $bannerImage; ?>" alt="<?php echo $bannerTitle; ?>" /></a></li>
68
+ <?php
69
+ endif;
70
+ endif;
71
+ endforeach; ?>
72
+ </ul>
73
+ </div>
app/design/frontend/default/default/template/unibanner/effects/textfade.phtml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ ?>
10
+ <link rel="stylesheet" type="text/css" media="all" href="<?php echo $this->getSkinUrl('unibanner/css/stylesban.css') ?>" />
11
+ <script type="text/javascript" src="<?php echo $this->getSkinUrl('unibanner/js/protofade.js') ?>"></script>
12
+ <?php
13
+ $bannerGroupCode = $this->getBannerGroupCode();
14
+ $data = $this->getDataByGroupCode($bannerGroupCode);
15
+ $bannerGroupData = $data['group_data'];
16
+ $mediaDir = Mage::getBaseDir('media');
17
+ $bannerData = $data['banner_data'];
18
+ $bannerdest = (($bannerGroupData->getLinkTarget() == 0) ? '_blank' : '_self');
19
+ $bannerWidth = $bannerGroupData->getBannerWidth();
20
+ $bannerHeight = $bannerGroupData->getBannerHeight();
21
+ $styleBWH = 'width: ' . $bannerWidth . 'px; height: ' . $bannerHeight . 'px;';
22
+ $duration = Mage::getStoreConfig('banner/banner/banner_time_delay');
23
+ $durat = $duration / 1000;
24
+
25
+ $imageWidth = ((int) $bannerWidth - 8);
26
+ $imageHeight = ((int) $bannerHeight - 8);
27
+ $styleWH = 'width: ' . $imageWidth . 'px; height: ' . $imageHeight . 'px;';
28
+ ?>
29
+ <script type="text/javascript">
30
+ function StartUp() {
31
+ new Protofade('protofade4',{delay:<?php echo $durat; ?>});
32
+ }
33
+ document.observe ('dom:loaded', StartUp);
34
+ </script>
35
+ <style type="text/css">
36
+ #slider-container4{<?php echo $styleBWH; ?>;}
37
+ #protofade4{<?php echo $styleWH; ?>;}
38
+ #protofade4 .fade-banner-title{font-size:<?php echo ((int) $bannerHeight / 15) . 'px'; ?>; <?php echo ((((int) $bannerHeight / 15) < 18) ? 'font-weight:bold;' : 'font-weight:normal;'); ?>}
39
+ </style>
40
+ <div id="slider-container4">
41
+ <div id="protofade4">
42
+ <?php
43
+ $i = 0;
44
+ foreach ($bannerData as $banner):
45
+ $bannerType = $banner->getBannerType();
46
+ $bannerPath = $banner->getFilename();
47
+ $bannerCon = $banner->getbannerContent();
48
+ $bannerTit = $banner->gettitle();
49
+ $bannerImage = '';
50
+ if ($bannerPath != '' && @file_exists($mediaDir . DS . $bannerPath)) :
51
+ $bannerImage = $this->getResizeImage($bannerPath, $bannerGroupCode, $imageWidth, $imageHeight);
52
+ endif;
53
+ $bannerTitle = $banner->getTitle();
54
+ $bannerContent = $banner->getBannerContent();
55
+ $bannerLink = $banner->getLink();
56
+ if ($bannerImage != '') :
57
+ $i++;
58
+ $v = "imgtextfade" . $i;
59
+ ?>
60
+ <div><h3 class="fade-banner-title"><a href="<?php echo (($bannerLink) ? $bannerLink : 'javascript:'); ?>" <?php echo (($bannerLink)?'target="'.$bannerdest.'"':''); ?> title="<?php echo $bannerTitle; ?>"><?php echo $bannerTit; ?></a></h3><?php echo $bannerCon; ?></div>
61
+ <?php endif;
62
+ endforeach; ?>
63
+ </div>
64
+ </div>
app/design/frontend/default/default/template/unibanner/effects/verslider.phtml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Unicode Systems
4
+ * @category Uni
5
+ * @package Uni_Banner
6
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ ?>
10
+ <link rel="stylesheet" type="text/css" media="all" href="<?php echo $this->getSkinUrl('unibanner/css/glider.css') ?>" />
11
+ <!--[if IE ]>
12
+ <link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('unibanner/css/opacityother.css') ?>" media="all" />
13
+ <![endif]-->
14
+ <link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('unibanner/css/noieopacity.css') ?>" media="all" />
15
+ <script type="text/javascript" src="<?php echo $this->getSkinUrl('unibanner/js/glider.js') ?>"></script>
16
+ <div id="slider" >
17
+ <?php
18
+ $bannerGroupCode = $this->getBannerGroupCode();
19
+ $data = $this->getDataByGroupCode($bannerGroupCode);
20
+ $bannerGroupData = $data['group_data'];
21
+ $mediaDir = Mage::getBaseDir('media');
22
+ $bannerData = $data['banner_data'];
23
+ $baneff = $bannerGroupData->getBannerEffects();
24
+ $prebaneff = $bannerGroupData->getPreBannerEffects();
25
+ $bannerdest = (($bannerGroupData->getLinkTarget() == 0) ? '_blank' : '_self');
26
+ $bannerType = $bannerGroupData->getAnimationType();
27
+ $bannerWidth = $bannerGroupData->getBannerWidth();
28
+ $bannerHeight = $bannerGroupData->getBannerHeight();
29
+ $styleBWH = 'width: ' . $bannerWidth . 'px; height: ' . $bannerHeight . 'px;';
30
+ $duration = Mage::getStoreConfig('banner/banner/banner_time_delay');
31
+ $autoplay = Mage::getStoreConfig('banner/banner/banner_autoplay');
32
+ $durat = $duration / 1000;
33
+
34
+ $imageWidth = ((int) $bannerWidth - 1);
35
+ $imageHeight = ((int) $bannerHeight - 2);
36
+ $styleWH = 'width: ' . $imageWidth . 'px; height: ' . $imageHeight . 'px;';
37
+ ?>
38
+ <style type="text/css">
39
+ div#slider{<?php echo $styleBWH; ?>;}
40
+ div.scroller{<?php echo $styleBWH; ?>;}
41
+ div.scroller div.section{<?php echo $styleWH; ?>;}
42
+ div.scroller span.content{<?php echo $styleWH; ?>;}
43
+ div.scroller div.section img{<?php echo $styleWH; ?>;}
44
+ .bannerlinerglider{width:<?php echo ($imageWidth . "px"); ?>;}
45
+
46
+ </style>
47
+ <div class="scroller">
48
+ <span class="content">
49
+ <?php
50
+ $i = 0;
51
+ foreach ($bannerData as $banner):
52
+ $i++;
53
+ $v = "imgglid" . $i;
54
+ $bannerPath = $banner->getFilename();
55
+ $bannerCon = $banner->getBannerContent();
56
+ $bannerTitle = $banner->getTitle();
57
+ $bannerType = $banner->getBannerType();
58
+ $bannerLink = $banner->getLink();
59
+ if ($bannerType == 0):
60
+ $bannerImage = '';
61
+ if ($bannerPath != '' && @file_exists($mediaDir . DS . $bannerPath)):
62
+ $bannerImage = $this->getResizeImage($bannerPath, $bannerGroupCode, $imageWidth, $imageHeight);
63
+ endif;
64
+ $bannerLink = $banner->getLink();
65
+ if ($bannerImage != '') :
66
+ ?>
67
+ <div class="section" id="section<?php echo $i; ?>"><a href="<?php echo (($bannerLink) ? $bannerLink : 'javascript:'); ?>" <?php echo (($bannerLink)?'target="'.$bannerdest.'"':''); ?>><img id="<?php echo $v; ?>" src="<?php echo $bannerImage; ?>" alt="<?php echo $bannerTitle; ?>"/></a></div>
68
+ <?php endif;
69
+ else: ?>
70
+ <div class="section" id="section<?php echo $i; ?>"><a href="<?php echo (($bannerLink) ? $bannerLink : 'javascript:'); ?>" <?php echo (($bannerLink)?'target="'.$bannerdest.'"':''); ?> title="<?php echo $bannerTitle; ?>"><?php echo $bannerCon; ?></a></div>
71
+ <?php endif;
72
+ endforeach; ?>
73
+ </span>
74
+ <script type="text/javascript">
75
+ var my_glider = new Glider('slider', {scroller: 'div.scroller', sections: 'div.section',duration:1.0, autoGlide: <?php echo (($autoplay == 1) ? 'true' : 'false'); ?>, frequency:<?php echo (int)$durat*2; ?>, initialSection: 'section1'});
76
+ </script>
77
+ </div>
78
+ <div class="bannerlinerglider"></div>
79
+ <div class="slidercontrol">
80
+ <a href="javascript:" class="aprev" title="<?php echo $this->__('Previous') ?>" onclick="my_glider.previous();return false;"><?php echo $this->__('Previous') ?></a>
81
+ <a href="javascript:" class="astop" title="<?php echo $this->__('Stop') ?>" onclick="my_glider.stop();return false"><?php echo $this->__('Stop') ?></a>
82
+ <a href="javascript:" class="aplay" title="<?php echo $this->__('Start') ?>" onclick="my_glider.start();return false"><?php echo $this->__('Start') ?></a>
83
+ <a href="javascript:" class="anext" title="<?php echo $this->__('Next') ?>" onclick="my_glider.next();return false"><?php echo $this->__('Next') ?></a>
84
+ </div>
85
+ </div>
app/etc/modules/Uni_Banner.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Banner
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ -->
11
+ <config>
12
+ <modules>
13
+ <Uni_Banner>
14
+ <active>true</active>
15
+ <codePool>community</codePool>
16
+ </Uni_Banner>
17
+ <version>0.1.0</version>
18
+ </modules>
19
+ </config>
app/locale/en_US/Uni_Banner.csv ADDED
File without changes
media/custom/banners/File-1300256573.jpg ADDED
Binary file
media/custom/banners/File-1300256584.jpg ADDED
Binary file
media/custom/banners/File-1300256596.jpg ADDED
Binary file
media/custom/banners/File-1300256608.jpg ADDED
Binary file
media/custom/banners/resize/home_banner/File-1300256573.jpg ADDED
Binary file
media/custom/banners/resize/home_banner/File-1300256584.jpg ADDED
Binary file
media/custom/banners/resize/home_banner/File-1300256596.jpg ADDED
Binary file
media/custom/banners/resize/home_banner/File-1300256608.jpg ADDED
Binary file
media/custom/banners/resize/left_banner/File-1300256584.jpg ADDED
Binary file
media/custom/banners/resize/left_banner/File-1300256596.jpg ADDED
Binary file
media/custom/banners/resize/left_banner/File-1300256608.jpg ADDED
Binary file
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>MultiBanner_Module</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>MultiBanner with Multiple Effects for Images and Html (Slideshow, TextFade, Square Transition, Play Pause, Numbered banners, Horizontal Slider, Vertical Slider and Many more custom effects)</summary>
10
+ <description>MultiBanner with Multiple Effects for Images and Html (Slideshow, TextFade, Square Transition, Play Pause, Numbered banners, Horizontal Slider, Vertical Slider and Many more custom effects) on Prototype.</description>
11
+ <notes>MultiBanner with Multiple Effects for Images and Html</notes>
12
+ <authors><author><name>Unicode Systems</name><user>Unicode</user><email>magento@unicodesystems.in</email></author></authors>
13
+ <date>2011-03-16</date>
14
+ <time>08:50:47</time>
15
+ <contents><target name="magecommunity"><dir name="Uni"><dir name="Banner"><dir name="Block"><dir name="Adminhtml"><dir name="Banner"><dir name="Edit"><file name="Form.php" hash="38b2452ae924dc909fc868ce0472152b"/><dir name="Tab"><file name="Form.php" hash="9a5c5e5a7cb369d0a38f9aa540dd22d3"/></dir><file name="Tabs.php" hash="0bb21d21185c9bb37ad77ac412b2d0b0"/></dir><file name="Edit.php" hash="42ae82bd53c72a23cf2a8bce7e34904c"/><file name="Grid.php" hash="be12f57ef4f29601399873de0bae3a8d"/></dir><file name="Banner.php" hash="0bbadbe6e27115c88dd020039b330544"/><dir name="Bannergroup"><dir name="Edit"><file name="Form.php" hash="ebff6e0a1b34cc3a804051e42c096195"/><dir name="Tab"><file name="Banner.php" hash="9a5c0764294613d5a27a4d64dbb633c7"/><file name="Form.php" hash="10bf17d806a2a7ac40225591926c1d0a"/><file name="Gridbanner.php" hash="dcce73bb370d8a8408ec632b041ba1e7"/></dir><file name="Tabs.php" hash="0995e31427f190134672cd6f1742f491"/></dir><file name="Edit.php" hash="24eb10494857b4e1bcbca9e610a6c9c9"/><file name="Grid.php" hash="d95f657091c73c5f54719f26be57107f"/></dir><file name="Bannergroup.php" hash="b8a5f39315a1167516a50c97e34bec73"/><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Filter"><file name="Image.php" hash="00a951d4a42c98148eddb0cbd27af8a1"/></dir><dir name="Renderer"><file name="Action.php" hash="d51643ac76989bb768ad07e0c66c0b78"/><file name="Image.php" hash="5125a4f57e65a0e579de578e3fd9f77b"/></dir></dir><file name="Column.php" hash="5f7a3f4ab657b4b9422c35bead4e23a5"/></dir></dir></dir><file name="Banner.php" hash="b9860becdebe13854f57608562654133"/></dir><dir name="Helper"><file name="Data.php" hash="12d0bb9eb35061bde449c5e14bcb4170"/></dir><dir name="Model"><file name="Banner.php" hash="b6c2623a40609c0c9d5f6fce5364e0be"/><file name="Bannergroup.php" hash="c52253efaec0899b6c401c50a7b71879"/><file name="Bannerresize.php" hash="f21a1b4869a47e31696e98ffd7278d59"/><dir name="Mysql4"><dir name="Banner"><file name="Collection.php" hash="dcb31efab496c62f2ca41b52d0626582"/></dir><file name="Banner.php" hash="f61362105f685f9af1b415c48b9dfe20"/><dir name="Bannergroup"><file name="Collection.php" hash="85aa604e2ad4f650d74eaaec83e5e051"/></dir><file name="Bannergroup.php" hash="15b618d32df18e0109ffd0c9a10c3e1c"/></dir><file name="Status.php" hash="303c3ceb1045506f3101442c53a757ef"/><dir name="Wysiwyg"><file name="Config.php" hash="bf895dffe902636c10316b225517222b"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="BannerController.php" hash="a848e54cc6bb133f8635e89e96114a82"/><file name="BannergroupController.php" hash="f379c5548e0f59f31326188c4cddf971"/></dir><file name="IndexController.php" hash="1e4174335f518ad77d77da41b9b9033a"/></dir><dir name="etc"><file name="config.xml" hash="ad999e988b29415b730f218b4f528a25"/><file name="system.xml" hash="a81c1b50fa0671f85404729195d7ee93"/></dir><dir name="sql"><dir name="banner_setup"><file name="mysql4-install-0.1.0.php" hash="3798fcf6d1ea811ed46f3fb1eeb7658e"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Uni_Banner.xml" hash="d7f7be27e89a16937ebab3aad08c5e03"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="unibanner.xml" hash="4270f8e8589231fc8c3b77a467c03da4"/></dir><dir name="template"><dir name="unibanner"><file name="banners.phtml" hash="471181ee55f34624a798aaf818c08aa6"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="unibanner.xml" hash="b60c7daa417fcc4b4fd5093d1ca0bafb"/></dir><dir name="template"><dir name="unibanner"><file name="banner.phtml" hash="f2fe0e221e936e611fd82aa79074b593"/><dir name="effects"><file name="custom.phtml" hash="4c033807a86f911a03d05fe582bf1607"/><file name="horslider.phtml" hash="ed9c892f9c1830fb2775daff7725738a"/><file name="numbered.phtml" hash="9a451afbe80cae9d9b3163d85a16c793"/><file name="playpause.phtml" hash="4a663af1b50541e9a8a011377a460fbf"/><file name="slideshow.phtml" hash="f5d375d75dd141310b6e75609d20f84e"/><file name="springslider.phtml" hash="d4302f2b9adbce074b516b3853fb8f67"/><file name="strans.phtml" hash="62b04dffc9e6cb23080a657757fdb718"/><file name="textfade.phtml" hash="096c8ad4e08e8310f76721dba90f4049"/><file name="verslider.phtml" hash="63228992237861761671560d8dccad85"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Uni_Banner.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></target><target name="magemedia"><dir name="custom"><dir name="banners"><file name="File-1300256573.jpg" hash="6fb2a38dc107eacb41cf1656e899cf70"/><file name="File-1300256584.jpg" hash="1bc5b77f3e50b7fbe12c792ee438da45"/><file name="File-1300256596.jpg" hash="070cf6787aa56fbdaa1b2fd98708c34c"/><file name="File-1300256608.jpg" hash="b44a59383b3123a747d139bd0e71d2df"/><dir name="resize"><dir name="home_banner"><file name="File-1300256573.jpg" hash="2839ae13352ee22c8feab6fdb0302b68"/><file name="File-1300256584.jpg" hash="73ee800f4a7432add9de7f048823245a"/><file name="File-1300256596.jpg" hash="354ea638044668783b279536e486cf29"/><file name="File-1300256608.jpg" hash="e3934877cfce389ddafed8580c5755b8"/></dir><dir name="left_banner"><file name="File-1300256584.jpg" hash="be9deb97102d41f43c6acd289cae9384"/><file name="File-1300256596.jpg" hash="f43e279cabef79beed4c7d0d30581720"/><file name="File-1300256608.jpg" hash="91a4caca0022551d57ef37f0b204073b"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="unibanner"><dir name="css"><file name="carousel.css" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="custom.css" hash="e3b6e91906b016c4a4670a589332be41"/><file name="glider.css" hash="d28ead2c96afee6d2f0eb4aea9167661"/><dir name="images"><file name="down.gif" hash="d698c4f511816268545a63c77d6ce0fd"/><file name="next.gif" hash="5fc5d48d907ddac9863b9b0bc85d745e"/><file name="next.png" hash="59726e7ca92e062bcc90029094787e02"/><file name="next1.gif" hash="d2af7472a66cfda1c8d7ba2ebda0368a"/><file name="next1.png" hash="db3c55bb0b783c19f59066b7e4939cd7"/><file name="play.gif" hash="9819ff371d7e15eef8ff79795e4585e5"/><file name="play.png" hash="e73837c01109bdb234ac8e1e8076a637"/><file name="prev.gif" hash="7f9a78a60372aa33ebbc72f53157c48b"/><file name="prev.png" hash="9f878dcd6b60c471136f31724e0e10ed"/><file name="stop.gif" hash="e3eccc001802f253a39ef050d1716aff"/><file name="stop.png" hash="8dcb2264b104a25098d3cd2528aac712"/><file name="top.gif" hash="7090dab68f24cb227a897ef77741e9fb"/></dir><file name="noieopacity.css" hash="14d8b9192f25abeb406caeb733b90c4e"/><file name="opacityother.css" hash="6ccce3a136027b9077d90a88623e2c63"/><file name="protoFlow.css" hash="3b885897663d1bb12351165a6aff5d23"/><file name="stylesban.css" hash="827917e0440350b696d97229c9569281"/></dir><dir name="js"><file name="ajaxtabs.js" hash="2131471ffe269a8feeb0cfff90c4c64e"/><file name="carousel.js" hash="35fc7ec591e4a1a8ecb3a664276e9f55"/><file name="crossfade.js" hash="ee37e8f8c9177e1ec6bf40b61e972d03"/><file name="custom.js" hash="37d46c9ccd5af57af1cd5b0f647ddb5b"/><file name="glider.js" hash="e8e1e39b6b6cb3dc7a3896bffad3e4d3"/><file name="numbered.js" hash="db1ca9b5de07bc6bbf7db70fd53b9b7b"/><file name="prettify.js" hash="947de7ec867cc555f04387f3d602bb20"/><file name="protoFlow.js" hash="fc0aea31d5605d96ef0d09be6ec96929"/><file name="protofade.js" hash="809e245be83bfea72409264ce7904b0f"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/frontend/default/default/unibanner/css/carousel.css ADDED
File without changes
skin/frontend/default/default/unibanner/css/custom.css ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .custom-banner{border:1px solid #CCCCCC; padding:2px;}
2
+ .custom-banner img.custom-banner-img{border: 1px solid #CCCCCC; cursor: pointer;}
3
+ .custom-banner div.custom-banner-txt{border: 1px solid #CCCCCC; padding: 3px; overflow: hidden; text-decoration: none; cursor: pointer;}
4
+ /*********************Numbered Banner**************************/
5
+ .banner {margin-top:-50px;margin-left:4px; text-align: right;}
6
+ .banner a:link, .banner a:visited { font-family:"Times New Roman", Times, serif; font-size:11px; background:#000000; border:1px solid #000000; color:#FFFFFF; padding:2px 6px; text-decoration:none; }
7
+ .banner a.selected:link, .banner a.selected:visited, .banner a:hover { background:#015289; border:1px solid #000000; }
8
+ .slider div img{border:2px solid #CCCCCC;}
9
+ .slider .number-div{border:2px solid #CCCCCC; float:left;}
10
+ .slider .number-div a{text-decoration:none;}
11
+
12
+ /*************************New**************************/
13
+ .slider{position:relative; text-align:center;}
14
+ .bannerline{ margin-top:-30px; background:none repeat scroll 0 0 #618499;display:inline; height:28px; margin-left:2px; position:relative; float: left; opacity:0.7; z-index:999; filter:alpha(opacity=67.41349464779863); ZOOM: 1;}
15
+ .slide-show{float: left; background-position:center center; background-repeat:no-repeat; text-align:center; position:relative;}
16
+ .indentmenu{z-index:1000; color:#000; font-size: 11px; float: right; margin: 4px 10px 0 0;}
17
+ .indentmenu ul{margin: 2px; padding: 0; float: left; background: transparent;}
18
+ .indentmenu ul li{display: inline;}
19
+ .indentmenu ul li a{background: none repeat scroll 0 0 #000000; border: 1px solid #000000; color: #FFFFFF; font-family: "Times New Roman",Times,serif; font-size: 11px; padding: 2px 6px; text-decoration: none;}
20
+ .indentmenu ul li a:hover{background:#015289; border:1px solid #000000;}
21
+ .indentmenu ul li a.selected{background:#015289; border:1px solid #000000;}
22
+ .tabcontent{display:none;}
skin/frontend/default/default/unibanner/css/glider.css ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*#slider{margin: 0 auto; overflow: hidden; margin-bottom: 13px; border: 1px solid #ccc;}*/
2
+ div.scroller .content {padding: 0;}
3
+ div.scroller img{border: none;}
4
+ .content .sliderdescription{background: url(images/grid.gif) repeat left top; color: #222; font: 12px bold ; left: 15px; opacity: 0.5; padding: 10px; position: relative; top: -100px; width: 650px;}
5
+ div.sliderdescription:hover, .sliderdescription.active{background-color: #fff !important;}
6
+ .content a{font: 12px bold; text-decoration: none;}
7
+ .aprev{background: url(images/prev.gif) no-repeat 3px 3px;}
8
+ .anext{background: url(images/next.gif) no-repeat 3px 3px;}
9
+ .astop{background: url(images/stop.gif) no-repeat 3px 3px;}
10
+ .aplay{background: url(images/play.gif) no-repeat 6px 3px;}
11
+
12
+ /*********************Vertical************************/
13
+ #slider{margin: 0 auto; overflow: hidden; border: 1px solid #ccc;}
14
+ div.scroller{overflow: hidden; border: 1px solid #ccc; position: relative;}
15
+ div.scroller div.section{float: left; overflow: hidden; }
16
+ div.scroller span.content{float:none;}
17
+ div#slider .bannerlinerglider{background: none repeat scroll 0 0 #618499; display: inline; height: 28px; margin-left: 2px; margin-top: -28px; opacity: 0.45; position: absolute; z-index: 999;}
18
+ div#slider .slidercontrol{margin: -28px 0 0; position: relative; z-index: 1000; color: #000000; float: right;}
19
+ div#slider .slidercontrol a{color: #FFFFFF; padding: 4px; text-indent: -1000px; float: left; height: 14px; margin: 5px 2px 0; opacity: 0.6; width: 14px;}
20
+ div#slider .slidercontrol a:hover{opacity: 1;}
21
+ /*********************Horizontal************************/
22
+ div#sliderhori .bannerlinergliderhori{background: none repeat scroll 0 0 #618499; display: inline; height: 28px; margin-left: 2px; margin-top: -28px; opacity: 0.45; position: absolute; z-index: 999;}
23
+ div#sliderhori div.scrollerhori{overflow: hidden; border: 1px solid #ccc; padding:1px; position: relative;}
24
+ div#sliderhori div.scrollerhori .contenthori{width: 1000000px;}
25
+ div#sliderhori div.scrollerhori div.sectionhori{float: left; overflow: hidden; padding-left: 1px;}
26
+ div#sliderhori .slidercontrolhori{margin: -28px 0 0; position: relative; z-index: 1000; color: #000000; float: right;}
27
+ div#sliderhori .slidercontrolhori a{color: #FFFFFF; padding: 4px; text-indent: -1000px; float: left; height: 14px; margin: 5px 2px 0; opacity: 0.6; width: 14px;}
28
+ div#sliderhori .slidercontrolhori a:hover{opacity: 1;}
skin/frontend/default/default/unibanner/css/images/down.gif ADDED
Binary file
skin/frontend/default/default/unibanner/css/images/next.gif ADDED
Binary file
skin/frontend/default/default/unibanner/css/images/next.png ADDED
Binary file
skin/frontend/default/default/unibanner/css/images/next1.gif ADDED
Binary file
skin/frontend/default/default/unibanner/css/images/next1.png ADDED
Binary file
skin/frontend/default/default/unibanner/css/images/play.gif ADDED
Binary file
skin/frontend/default/default/unibanner/css/images/play.png ADDED
Binary file
skin/frontend/default/default/unibanner/css/images/prev.gif ADDED
Binary file
skin/frontend/default/default/unibanner/css/images/prev.png ADDED
Binary file
skin/frontend/default/default/unibanner/css/images/stop.gif ADDED
Binary file
skin/frontend/default/default/unibanner/css/images/stop.png ADDED
Binary file
skin/frontend/default/default/unibanner/css/images/top.gif ADDED
Binary file
skin/frontend/default/default/unibanner/css/noieopacity.css ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Document : noieopacity
3
+ Created on : Oct 16, 2010, 11:12:41 PM
4
+ Author : Administrator
5
+ Description:
6
+ Purpose of the stylesheet follows.
7
+ */
8
+
9
+ /*
10
+ TODO customize this sample style
11
+ Syntax recommendation http://www.w3.org/TR/REC-CSS2/
12
+ */
13
+
14
+ .bannerlinerpau{
15
+ opacity:.45;}
16
+
17
+ .bannerline{
18
+ opacity:.45;}
19
+ .bannerlinerglider{
20
+ opacity:.45;}
21
+ .bannerlinergliderhori{
22
+ opacity:.45;}
skin/frontend/default/default/unibanner/css/opacityother.css ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ .bannerlinerpau{
2
+ filter:alpha(opacity=46.41349464779863); ZOOM: 1;}
3
+ .bannerline{
4
+ filter:alpha(opacity=46.41349464779863); ZOOM: 1;}
5
+ .bannerlinerglider{
6
+ filter:alpha(opacity=46.41349464779863); ZOOM: 1;}
7
+ .bannerlinergliderhori{
8
+ filter:alpha(opacity=46.41349464779863); ZOOM: 1;}
skin/frontend/default/default/unibanner/css/protoFlow.css ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ /*********************Image Slider Show**************************/
2
+ .sliderTrack {background:transparent url('../../images/resources/track_fill_left.png') no-repeat scroll left top; height:15px; position:relative; text-align:left; width:137px;}
3
+ .sliderHandle {background:transparent url('../../images/resources/knob.png') no-repeat scroll left top; cursor:pointer; height:16px; margin-left:-2px; position:absolute; top:-5px; width:16px;}
4
+ .captionHolder {font-size: 34px; color: black;}
5
+ #protoflow {width: auto; height: 400px; border: 1px solid #cccccc;}
6
+ #protoflow .captionHolder{z-index:10; color:#FFF;}
7
+ #protoflow div.slider-banner-img img{border: 1px solid #CCCCCC; cursor: pointer;}
skin/frontend/default/default/unibanner/css/stylesban.css ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* protofade */
2
+ #protofade, #protofade2, #protofade3, #protofade4 { position:relative; margin:0; padding:0px; overflow:hidden; }
3
+ #slider-container, #slider-container2 { border: 1px solid #CCCCCC; padding: 1px;}
4
+ #protofade3, #protofade4 { border: 1px solid #CCCCCC; }
5
+ #slider-container4, #protofade4 { height:190px; }
6
+ #protofade li, #protofade2 li, #protofade3 li { position:absolute; top:0; left:0; margin:0; padding:0; background:none;}
7
+ #protofade4 div { position:absolute; top:0; left:0; margin:0; padding:10px; background:none; text-align:left}
8
+ /*********************Square Transition Banner**************************/
9
+ #protofade2 img.trans-banner-img{cursor: pointer;}
10
+ /*********************Text Fade Banner**************************/
11
+ #slider-container4{border:1px solid #DDDDDD;}
12
+ #protofade4{margin:3px;}
13
+ #protofade4 .fade-banner-title{cursor: pointer; text-align:left; padding:0 0 2px;}
14
+ /*********************Play And Pause Slide Show**************************/
15
+ #protofade3 .slide-banner-txt{padding:3px;}
16
+
17
+ .next{ padding:4px;color: #ffffff;background:url(bullet.gif) }
18
+ .previous { padding:4px;color: #ffffff;background:url(bullet.gif) }
19
+ .start{ padding:4px;color: #ffffff;background:url(bullet.gif) }
20
+ .stop { padding:4px;color: #ffffff;background:url(bullet.gif) }
skin/frontend/default/default/unibanner/js/ajaxtabs.js ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ //Effect.Fade(subcontent.id, { duration: .9, from: 0.5, to: 1 });
98
+ }
99
+ },
100
+
101
+ expandrevcontent:function(associatedrevids){
102
+ var allrevids=this.revcontentids
103
+ for (var i=0; i<allrevids.length; i++){ //Loop through rev attributes for all tabs in this tab interface
104
+ //if any values stored within associatedrevids matches one within allrevids, expand that DIV, otherwise, contract it
105
+ document.getElementById(allrevids[i]).style.display=(associatedrevids.indexOf(","+allrevids[i]+",")!=-1)? "block" : "none"
106
+ }
107
+ },
108
+
109
+ setcurrenttabindex:function(tabposition){ //store current position of tab (within hottabspositions[] array)
110
+ for (var i=0; i<this.hottabspositions.length; i++){
111
+ if (tabposition==this.hottabspositions[i]){
112
+ this.currentTabIndex=i
113
+ break
114
+ }
115
+ }
116
+ },
117
+
118
+ autorun:function(){ //function to auto cycle through and select tabs based on a set interval
119
+ this.cycleit('next', true)
120
+ },
121
+
122
+ cancelautorun:function(){
123
+ if (typeof this.autoruntimer!="undefined")
124
+ clearInterval(this.autoruntimer)
125
+ },
126
+
127
+ init:function(automodeperiod){
128
+ var persistedtab=ddtabcontent.getCookie(this.tabinterfaceid) //get position of persisted tab (applicable if persistence is enabled)
129
+ var selectedtab=-1 //Currently selected tab index (-1 meaning none)
130
+ var selectedtabfromurl=this.urlparamselect(this.tabinterfaceid) //returns null or index from: tabcontent.htm?tabinterfaceid=index
131
+ this.automodeperiod=automodeperiod || 0
132
+ for (var i=0; i<this.tabs.length; i++){
133
+ this.tabs[i].tabposition=i //remember position of tab relative to its peers
134
+ if (this.tabs[i].getAttribute("rel")){
135
+ var tabinstance=this
136
+ this.hottabspositions[this.hottabspositions.length]=i //store position of "hot" tab ("rel" attr defined) relative to its peers
137
+ this.subcontentids[this.subcontentids.length]=this.tabs[i].getAttribute("rel") //store id of sub content ("rel" attr value)
138
+ this.tabs[i].onclick=function(){
139
+ tabinstance.expandtab(this)
140
+ tabinstance.cancelautorun() //stop auto cycling of tabs (if running)
141
+ return false
142
+ }
143
+ if (this.tabs[i].getAttribute("rev")){ //if "rev" attr defined, store each value within "rev" as an array element
144
+ this.revcontentids=this.revcontentids.concat(this.tabs[i].getAttribute("rev").split(/\s*,\s*/))
145
+ }
146
+ if (selectedtabfromurl==i || this.enabletabpersistence && selectedtab==-1 && parseInt(persistedtab)==i || !this.enabletabpersistence && selectedtab==-1 && this.getselectedClassTarget(this.tabs[i]).className=="selected"){
147
+ selectedtab=i //Selected tab index, if found
148
+ }
149
+ }
150
+ } //END for loop
151
+ if (selectedtab!=-1) //if a valid default selected tab index is found
152
+ this.expandtab(this.tabs[selectedtab]) //expand selected tab (either from URL parameter, persistent feature, or class="selected" class)
153
+ else //if no valid default selected index found
154
+ this.expandtab(this.tabs[this.hottabspositions[0]]) //Just select first tab that contains a "rel" attr
155
+ if (parseInt(this.automodeperiod)>500 && this.hottabspositions.length>1){
156
+ this.autoruntimer=setInterval(function(){tabinstance.autorun()}, this.automodeperiod)
157
+ }
158
+ } //END int() function
159
+
160
+ } //END Prototype assignment
skin/frontend/default/default/unibanner/js/carousel.js ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2009 Victor Stanciu - http://www.victorstanciu.ro
3
+
4
+ Permission is hereby granted, free of charge, to any person
5
+ obtaining a copy of this software and associated documentation
6
+ files (the "Software"), to deal in the Software without
7
+ restriction, including without limitation the rights to use,
8
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the
10
+ Software is furnished to do so, subject to the following
11
+ conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
+ OTHER DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+ Carousel = Class.create(Abstract, {
27
+ initialize: function (scroller, slides, controls, options) {
28
+ this.scrolling = false;
29
+ this.scroller = $(scroller);
30
+ this.slides = slides;
31
+ this.controls = controls;
32
+
33
+ this.options = Object.extend({
34
+ duration: 1,
35
+ auto: false,
36
+ frequency: 3,
37
+ visibleSlides: 1,
38
+ controlClassName: 'carousel-control',
39
+ jumperClassName: 'carousel-jumper',
40
+ disabledClassName: 'carousel-disabled',
41
+ selectedClassName: 'carousel-selected',
42
+ circular: false,
43
+ wheel: true,
44
+ effect: 'scroll',
45
+ transition: 'sinoidal'
46
+ }, options || {});
47
+
48
+ if (this.options.effect == 'fade') {
49
+ this.options.circular = true;
50
+ }
51
+
52
+ this.slides.each(function(slide, index) {
53
+ slide._index = index;
54
+ });
55
+
56
+ if (this.controls) {
57
+ this.controls.invoke('observe', 'click', this.click.bind(this));
58
+ }
59
+
60
+ if (this.options.wheel) {
61
+ this.scroller.observe('mousewheel', this.wheel.bindAsEventListener(this)).observe('DOMMouseScroll', this.wheel.bindAsEventListener(this));;
62
+ }
63
+
64
+ if (this.options.auto) {
65
+ this.start();
66
+ }
67
+
68
+ if (this.options.initial) {
69
+ var initialIndex = this.slides.indexOf($(this.options.initial));
70
+ if (initialIndex > (this.options.visibleSlides - 1) && this.options.visibleSlides > 1) {
71
+ if (initialIndex > this.slides.length - (this.options.visibleSlides + 1)) {
72
+ initialIndex = this.slides.length - this.options.visibleSlides;
73
+ }
74
+ }
75
+ this.moveTo(this.slides[initialIndex]);
76
+ }
77
+ },
78
+
79
+ click: function (event) {
80
+ this.stop();
81
+
82
+ var element = event.findElement('a');
83
+
84
+ if (!element.hasClassName(this.options.disabledClassName)) {
85
+ if (element.hasClassName(this.options.controlClassName)) {
86
+ eval("this." + element.rel + "()");
87
+ } else if (element.hasClassName(this.options.jumperClassName)) {
88
+ this.moveTo(element.rel);
89
+ if (this.options.selectedClassName) {
90
+ this.controls.invoke('removeClassName', this.options.selectedClassName);
91
+ element.addClassName(this.options.selectedClassName);
92
+ }
93
+ }
94
+ }
95
+
96
+ this.deactivateControls();
97
+
98
+ event.stop();
99
+ },
100
+
101
+ moveTo: function (element) {
102
+ if (this.options.beforeMove && (typeof this.options.beforeMove == 'function')) {
103
+ this.options.beforeMove();
104
+ }
105
+
106
+ this.previous = this.current ? this.current : this.slides[0];
107
+ this.current = $(element);
108
+
109
+ var scrollerOffset = this.scroller.cumulativeOffset();
110
+ var elementOffset = this.current.cumulativeOffset();
111
+
112
+ if (this.scrolling) {
113
+ this.scrolling.cancel();
114
+ }
115
+
116
+ switch (this.options.effect) {
117
+ case 'fade':
118
+ this.scrolling = new Effect.Opacity(this.scroller, {
119
+ from: 1.0,
120
+ to: 0,
121
+ duration: this.options.duration,
122
+ afterFinish: (function () {
123
+ this.scroller.scrollLeft = elementOffset[0] - scrollerOffset[0];
124
+ this.scroller.scrollTop = elementOffset[1] - scrollerOffset[1];
125
+
126
+ new Effect.Opacity(this.scroller, {
127
+ from: 0,
128
+ to: 1.0,
129
+ duration: this.options.duration,
130
+ afterFinish: (function () {
131
+ if (this.controls) {
132
+ this.activateControls();
133
+ }
134
+ if (this.options.afterMove && (typeof this.options.afterMove == 'function')) {
135
+ this.options.afterMove();
136
+ }
137
+ }).bind(this)
138
+ });
139
+ }
140
+ ).bind(this)});
141
+ break;
142
+ case 'scroll':
143
+ default:
144
+ var transition;
145
+ switch (this.options.transition) {
146
+ case 'spring':
147
+ transition = Effect.Transitions.spring;
148
+ break;
149
+ case 'sinoidal':
150
+ default:
151
+ transition = Effect.Transitions.sinoidal;
152
+ break;
153
+ }
154
+
155
+ this.scrolling = new Effect.SmoothScroll(this.scroller, {
156
+ duration: this.options.duration,
157
+ x: (elementOffset[0] - scrollerOffset[0]),
158
+ y: (elementOffset[1] - scrollerOffset[1]),
159
+ transition: transition,
160
+ afterFinish: (function () {
161
+ if (this.controls) {
162
+ this.activateControls();
163
+ }
164
+ if (this.options.afterMove && (typeof this.options.afterMove == 'function')) {
165
+ this.options.afterMove();
166
+ }
167
+ this.scrolling = false;
168
+ }).bind(this)});
169
+ break;
170
+ }
171
+
172
+ return false;
173
+ },
174
+
175
+ prev: function () {
176
+ if (this.current) {
177
+ var currentIndex = this.current._index;
178
+ var prevIndex = (currentIndex == 0) ? (this.options.circular ? this.slides.length - 1 : 0) : currentIndex - 1;
179
+ } else {
180
+ var prevIndex = (this.options.circular ? this.slides.length - 1 : 0);
181
+ }
182
+
183
+ if (prevIndex == (this.slides.length - 1) && this.options.circular && this.options.effect != 'fade') {
184
+ this.scroller.scrollLeft = (this.slides.length - 1) * this.slides.first().getWidth();
185
+ this.scroller.scrollTop = (this.slides.length - 1) * this.slides.first().getHeight();
186
+ prevIndex = this.slides.length - 2;
187
+ }
188
+
189
+ this.moveTo(this.slides[prevIndex]);
190
+ },
191
+
192
+ next: function () {
193
+ if (this.current) {
194
+ var currentIndex = this.current._index;
195
+ var nextIndex = (this.slides.length - 1 == currentIndex) ? (this.options.circular ? 0 : currentIndex) : currentIndex + 1;
196
+ } else {
197
+ var nextIndex = 1;
198
+ }
199
+
200
+ if (nextIndex == 0 && this.options.circular && this.options.effect != 'fade') {
201
+ this.scroller.scrollLeft = 0;
202
+ this.scroller.scrollTop = 0;
203
+ nextIndex = 1;
204
+ }
205
+
206
+ if (nextIndex > this.slides.length - (this.options.visibleSlides + 1)) {
207
+ nextIndex = this.slides.length - this.options.visibleSlides;
208
+ }
209
+
210
+ this.moveTo(this.slides[nextIndex]);
211
+ },
212
+
213
+ first: function () {
214
+ this.moveTo(this.slides[0]);
215
+ },
216
+
217
+ last: function () {
218
+ this.moveTo(this.slides[this.slides.length - 1]);
219
+ },
220
+
221
+ toggle: function () {
222
+ if (this.previous) {
223
+ this.moveTo(this.slides[this.previous._index]);
224
+ } else {
225
+ return false;
226
+ }
227
+ },
228
+
229
+ stop: function () {
230
+ if (this.timer) {
231
+ clearTimeout(this.timer);
232
+ }
233
+ },
234
+
235
+ start: function () {
236
+ this.periodicallyUpdate();
237
+ },
238
+
239
+ pause: function () {
240
+ this.stop();
241
+ this.activateControls();
242
+ },
243
+
244
+ resume: function (event) {
245
+ if (event) {
246
+ var related = event.relatedTarget || event.toElement;
247
+ if (!related || (!this.slides.include(related) && !this.slides.any(function (slide) { return related.descendantOf(slide); }))) {
248
+ this.start();
249
+ }
250
+ } else {
251
+ this.start();
252
+ }
253
+ },
254
+
255
+ periodicallyUpdate: function () {
256
+ if (this.timer != null) {
257
+ clearTimeout(this.timer);
258
+ this.next();
259
+ }
260
+ this.timer = setTimeout(this.periodicallyUpdate.bind(this), this.options.frequency * 1000);
261
+ },
262
+
263
+ wheel: function (event) {
264
+ event.cancelBubble = true;
265
+ event.stop();
266
+
267
+ var delta = 0;
268
+ if (!event) {
269
+ event = window.event;
270
+ }
271
+ if (event.wheelDelta) {
272
+ delta = event.wheelDelta / 120;
273
+ } else if (event.detail) {
274
+ delta = -event.detail / 3;
275
+ }
276
+
277
+ if (!this.scrolling) {
278
+ this.deactivateControls();
279
+ if (delta > 0) {
280
+ this.prev();
281
+ } else {
282
+ this.next();
283
+ }
284
+ }
285
+
286
+ return Math.round(delta); //Safari Round
287
+ },
288
+
289
+ deactivateControls: function () {
290
+ this.controls.invoke('addClassName', this.options.disabledClassName);
291
+ },
292
+
293
+ activateControls: function () {
294
+ this.controls.invoke('removeClassName', this.options.disabledClassName);
295
+ }
296
+ });
297
+
298
+
299
+ Effect.SmoothScroll = Class.create();
300
+ Object.extend(Object.extend(Effect.SmoothScroll.prototype, Effect.Base.prototype), {
301
+ initialize: function (element) {
302
+ this.element = $(element);
303
+ var options = Object.extend({ x: 0, y: 0, mode: 'absolute' } , arguments[1] || {});
304
+ this.start(options);
305
+ },
306
+
307
+ setup: function () {
308
+ if (this.options.continuous && !this.element._ext) {
309
+ this.element.cleanWhitespace();
310
+ this.element._ext = true;
311
+ this.element.appendChild(this.element.firstChild);
312
+ }
313
+
314
+ this.originalLeft = this.element.scrollLeft;
315
+ this.originalTop = this.element.scrollTop;
316
+
317
+ if (this.options.mode == 'absolute') {
318
+ this.options.x -= this.originalLeft;
319
+ this.options.y -= this.originalTop;
320
+ }
321
+ },
322
+
323
+ update: function (position) {
324
+ this.element.scrollLeft = this.options.x * position + this.originalLeft;
325
+ this.element.scrollTop = this.options.y * position + this.originalTop;
326
+ }
327
+ });
skin/frontend/default/default/unibanner/js/crossfade.js ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Crossfade
3
+ * Version 4.1 30/03/2007
4
+ *
5
+ * Copyright (c) 2007 Millstream Web Software http://www.millstream.com.au
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person
8
+ * obtaining a copy of this software and associated documentation
9
+ * files (the "Software"), to deal in the Software without
10
+ * restriction, including without limitation the rights to use, copy,
11
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
12
+ * of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be
16
+ * included in all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
22
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ * SOFTWARE.
26
+ * *
27
+ */
28
+
29
+ var Crossfade = Class.create();
30
+
31
+ Crossfade.prototype = {
32
+ loaded : false,
33
+ initialize : function(elm, options) {
34
+ var me = this, next, prev;
35
+ this.elm = $(elm);
36
+ this.counter = 0;
37
+ this.prevSlide = null;
38
+ var t_opt = {};
39
+ for(t in Crossfade.Transition) {
40
+ var trans = Crossfade.Transition[t];
41
+ if(trans.className && this.elm.hasClassName(trans.className)) {
42
+ t_opt = {transition:trans};
43
+ break;
44
+ }
45
+ }
46
+ this.options = Object.extend(Object.clone(Crossfade.defaults),Object.extend(options || {},t_opt));
47
+ this.options.interval = Math.max(2,this.options.interval);
48
+ this.elm.makePositioned();
49
+ this.slides = this.elm.immediateDescendants();
50
+ if(this.options.random || this.elm.hasClassName(this.options.randomClassName)){
51
+ this.slides.sort(function(a,b){
52
+ return me.rndm(-1,1);
53
+ });
54
+ }
55
+ if(this.elm.id) {
56
+ next = $(this.elm.id + '-next');
57
+ prev = $(this.elm.id + '-previous');
58
+ if(next) { Event.observe(next, 'click', this.next.bind(this)); }
59
+ if(prev) { Event.observe(prev, 'click', this.previous.bind(this)); }
60
+ }
61
+
62
+ this.loadSlide(this.slides[0],function() {
63
+ me.options.transition.prepare(me);
64
+ });
65
+ this.loadSlide(this.slides[1]);
66
+
67
+ if(this.options.autoStart) { setTimeout(this.start.bind(this),this.rndm((this.options.interval-1)*1000,(this.options.interval+1)*1000)); }
68
+ },
69
+ start : function() {
70
+ this.ready = true;
71
+ this.cycle()
72
+ return this.timer = new PeriodicalExecuter(this.cycle.bind(this), this.options.interval);
73
+ },
74
+ stop : function() {
75
+ this.options.transition.cancel(this);
76
+ this.timer.stop();
77
+ },
78
+ next : function(){
79
+ this.options.transition.cancel(this);
80
+ this.cycle();
81
+ },
82
+ previous : function() {
83
+ this.options.transition.cancel(this);
84
+ this.cycle(-1);
85
+ },
86
+ cycle : function(dir) {
87
+ if(!this.ready) { return; }
88
+ this.ready = false;
89
+ dir = (dir === -1) ? dir : 1;
90
+ var me = this, prevSlide, nextSlide, opt, fade;
91
+ prevSlide = this.slides[this.counter];
92
+ this.counter = this.loopCount(this.counter + dir);
93
+ if(this.counter == 0){
94
+ this.loaded = true;
95
+ }
96
+ nextSlide = this.slides[this.counter];
97
+ this.loadSlide(nextSlide, me.options.transition.cycle(prevSlide, nextSlide, me));
98
+ if(!this.loaded) {
99
+ this.loadSlide(this.slides[this.loopCount(this.counter+1)]);
100
+ }
101
+ },
102
+ loadSlide : function(slide, onload){
103
+ var loaders = [], me = this, img, pnode, onloadFunction;
104
+ onload = typeof onload === 'function' ? onload : function(){};
105
+ onloadFunction = function() {
106
+ onload();
107
+ me.ready = true;
108
+ };
109
+ slide = $(slide);
110
+ loaders = Selector.findChildElements(slide,[this.options.imageLoadSelector]);
111
+ if(loaders.length && loaders[0].href !== ''){
112
+ img = document.createElement('img');
113
+ img.className = 'loadimage';
114
+ img.onload = onloadFunction;
115
+ img.src = loaders[0].href;
116
+ loaders[0].parentNode.replaceChild(img,loaders[0]);
117
+ } else {
118
+ loaders = [];
119
+ loaders = Selector.findChildElements(slide, [this.options.ajaxLoadSelector]);
120
+ if(loaders.length && loaders[0].href !== ''){
121
+ new Ajax.Updater(slide, loaders[0].href, {method:'get',onComplete:onloadFunction});
122
+ } else {
123
+ onloadFunction();
124
+ }
125
+ }
126
+ },
127
+ loopCount : function(c){
128
+ if(c >= this.slides.length){
129
+ c = 0;
130
+ } else if (c < 0) {
131
+ c = this.slides.length - 1
132
+ }
133
+ return c;
134
+ },
135
+ rndm : function(min, max){
136
+ return Math.floor(Math.random() * (max - min + 1) + min);
137
+ },
138
+ timer : null,effect : null,ready : false
139
+ };
140
+ Crossfade.Transition = {};
141
+ Crossfade.Transition.Switch = {
142
+ className : 'transition-switch',
143
+ cycle : function(prev, next, show) {
144
+ show.slides.without(next).each(function(s){
145
+ $(s).hide();
146
+ })
147
+ $(next).show();
148
+ },
149
+ cancel : function(show){},
150
+ prepare : function(show){
151
+ show.slides.each(function(s,i){
152
+ $(s).setStyle({display:(i === 0 ? 'block' : 'none')});
153
+ });
154
+ }
155
+ };
156
+ Crossfade.Transition.Crossfade = {
157
+ className : 'transition-crossfade',
158
+ cycle : function(prev, next, show) {
159
+ var opt = show.options;
160
+ show.effect = new Effect.Parallel([new Effect.Fade(prev ,{sync:true}),
161
+ new Effect.Appear(next,{sync:true})],
162
+ {duration: opt.duration, queue : 'Crossfade', afterFinish:function(){
163
+ show.slides.without(next).each(function(s){
164
+ $(s).setStyle({opacity:0});
165
+ })
166
+ }}
167
+ );
168
+ },
169
+ cancel : function(show){
170
+ if(show.effect) { show.effect.cancel(); }
171
+ },
172
+ prepare : function(show){
173
+ show.slides.each(function(s,i){
174
+ $(s).setStyle({opacity:(i === 0 ? 1 : 0),visibility:'visible'});
175
+ });
176
+ }
177
+ };
178
+ Crossfade.Transition.FadeOutFadeIn = {
179
+ className : 'transition-fadeoutfadein',
180
+ cycle : function(prev, next, show) {
181
+ var opt = show.options;
182
+ show.effect = new Effect.Fade(prev ,{
183
+ duration: opt.duration/2,
184
+ afterFinish: function(){
185
+ show.effect = new Effect.Appear(next,{duration: opt.duration/2});
186
+ show.slides.without(next).each(function(s){
187
+ $(s).setStyle({opacity:0});
188
+ })
189
+ }
190
+ });
191
+ },
192
+ cancel : function(show){
193
+ if(show.effect) { show.effect.cancel(); }
194
+ },
195
+ prepare : function(show){
196
+ show.slides.each(function(s,i){
197
+ $(s).setStyle({opacity:(i === 0 ? 1 : 0),visibility:'visible'});
198
+ });
199
+ }
200
+ };
201
+
202
+ Effect.DoNothing = Class.create();
203
+ Object.extend(Object.extend(Effect.DoNothing.prototype, Effect.Base.prototype), {
204
+ initialize: function() {
205
+ this.start({duration: 0});
206
+ },
207
+ update: Prototype.emptyFunction
208
+ });
209
+ Crossfade.Transition.FadeOutResizeFadeIn = {
210
+ className : 'transition-fadeoutresizefadein',
211
+ cycle : function(prev, next, show) {
212
+ var opt = show.options;
213
+ show.effect = new Effect.Fade(prev ,{
214
+ duration: (opt.duration-1)/2,
215
+ afterFinish: function(){
216
+ show.slides.without(next).each(function(s){
217
+ $(s).setStyle({opacity:0});
218
+ })
219
+ var slideDims = [next.getWidth(),next.getHeight()];
220
+ var loadimg = Selector.findChildElements(next,['img.loadimage']);
221
+ if(loadimg.length && loadimg[0].offsetWidth && loadimg[0].offsetHeight){
222
+ slideDims[0] += slideDims[0] < loadimg[0].offsetWidth ? loadimg[0].offsetWidth : 0;
223
+ slideDims[1] += slideDims[1] < loadimg[0].offsetHeight ? loadimg[0].offsetHeight : 0;
224
+ }
225
+ var showDims = [show.elm.getWidth(),show.elm.getHeight()];
226
+ var scale = [(showDims[0] > 0 && slideDims[0] > 0 ? slideDims[0]/showDims[0] : 1)*100,(showDims[1] > 0 && slideDims[1] > 0 ? slideDims[1]/showDims[1] : 1)*100];
227
+ show.effect = new Effect.Parallel([
228
+ (scale[0] === 100 ? new Effect.DoNothing() : new Effect.Scale(show.elm,scale[0],{sync:true,scaleY:false,scaleContent:false})),
229
+ (scale[1] === 100 ? new Effect.DoNothing() : new Effect.Scale(show.elm,scale[1],{sync:true,scaleX:false,scaleContent:false}))
230
+ ],
231
+ {
232
+ duration: 1,
233
+ queue : 'FadeOutResizeFadeIn',
234
+ afterFinish: function(){
235
+ show.effect = new Effect.Appear(next,{duration: (opt.duration-1)/2});
236
+ }
237
+ }
238
+ );
239
+ }
240
+ });
241
+ },
242
+ cancel : function(show){
243
+ if(show.effect) { show.effect.cancel(); }
244
+ },
245
+ prepare : function(show){
246
+ var slideDims = [$(show.slides[0]).getWidth(),$(show.slides[0]).getHeight()];
247
+ show.elm.setStyle({width:slideDims[0]+'px', height:slideDims[1]+'px'});
248
+ show.slides.each(function(s,i){
249
+ $(s).setStyle({opacity:(i === 0 ? 1 : 0),visibility:'visible'});
250
+ });
251
+ }
252
+ };
253
+ Crossfade.defaults = {
254
+ autoLoad : true,
255
+ autoStart : true,
256
+ random : false,
257
+ randomClassName : 'random',
258
+ selectors : ['.crossfade'],
259
+ imageLoadSelector : 'a.loadimage',
260
+ ajaxLoadSelector : 'a.load',
261
+ interval : 5,
262
+ duration : 2,
263
+ transition : Crossfade.Transition.Crossfade
264
+ };
265
+ Crossfade.setup = function(options) {
266
+ Object.extend(Crossfade.defaults,options);
267
+ };
268
+ Crossfade.load = function() {
269
+ if(Crossfade.defaults.autoLoad) {
270
+ Crossfade.defaults.selectors.each(function(s){
271
+ $$(s).each(function(c){
272
+ return new Crossfade(c);
273
+ });
274
+ });
275
+ }
276
+ };
277
+
278
+ if(window.FastInit) {
279
+ FastInit.addOnLoad(Crossfade.load);
280
+ } else {
281
+ Event.observe(window, 'load', Crossfade.load);
282
+ }
skin/frontend/default/default/unibanner/js/custom.js ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function slideshow(start,last,interval,eff1) {
2
+ var frame = start;
3
+ var nextframe = start+1;
4
+ Effect.Appear('img1',{duration:.1,from:0.0,to:1.0});
5
+ eff1('img1');
6
+ setInterval(function() {
7
+ Effect.Fade('img'+frame,{duration:.1,from:1.0,to:0.0,afterFinish:function(){
8
+ $('img'+frame).hide();
9
+ Effect.Appear('img'+nextframe,{duration:.1,from:0.0,to:1.0});
10
+ eff1('img'+nextframe);
11
+ frame = nextframe;
12
+ nextframe = (frame == last) ? start : nextframe+1;
13
+ }});
14
+ },interval);
15
+ return;
16
+ };
17
+
18
+ function slideshowdefault(start,last,interval) {
19
+ var frame = start;
20
+ var nextframe = start+1;
21
+ Effect.Appear('img1',{duration:.5,from:0.0,to:1.0});
22
+ setInterval(function() {
23
+ Effect.Fade('img'+frame,{duration:.5,from:1.0,to:0.0,afterFinish:function(){
24
+ $('img'+frame).hide();
25
+ Effect.Appear('img'+nextframe,{duration:.5,from:0.0,to:1.0});
26
+ frame = nextframe;
27
+ nextframe = (frame == last) ? start : nextframe+1;
28
+ }});
29
+ },interval);
30
+ return;
31
+ };
skin/frontend/default/default/unibanner/js/glider.js ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author Bruno Bornsztein <bruno@missingmethod.com>
3
+ * @copyright 2007 Curbly LLC
4
+ * @package Glider
5
+ * @license MIT
6
+ * @url http://www.missingmethod.com/projects/glider/
7
+ * @version 0.0.4
8
+ * @dependencies prototype.js 1.5.1+, effects.js
9
+ */
10
+
11
+ /* Thanks to Andrew Dupont for refactoring help and code cleanup - http://andrewdupont.net/ */
12
+
13
+ Glider = Class.create();
14
+ Object.extend(Object.extend(Glider.prototype, Abstract.prototype), {
15
+ initialize: function(wrapper, options){
16
+ this.scrolling = false;
17
+ this.wrapper = $(wrapper);
18
+ this.scroller = this.wrapper.down(options.scroller);
19
+ this.sections = this.wrapper.getElementsBySelector(options.sections);
20
+ this.options = Object.extend({
21
+ controlsEvent:'click',
22
+ duration: 1.0,
23
+ frequency: 3
24
+ }, options || {});
25
+
26
+ this.sections.each( function(section, index) {
27
+ section._index = index;
28
+ });
29
+
30
+ this.events = {
31
+ click: this.click.bind(this)
32
+ };
33
+
34
+ this.addObservers();
35
+ if(this.options.initialSection) this.moveTo(this.options.initialSection, this.scroller, {
36
+ duration:this.options.duration
37
+ }); // initialSection should be the id of the section you want to show up on load
38
+ if(this.options.autoGlide) this.start();
39
+ },
40
+
41
+ addObservers: function() {
42
+ this.controls = this.wrapper.getElementsBySelector('.controls a');
43
+ this.controls.invoke('observe', this.options.controlsEvent, this.events.click);
44
+ },
45
+
46
+ click: function(event) {
47
+ this.stop();
48
+ var element = Event.findElement(event, 'a');
49
+ if (this.scrolling) this.scrolling.cancel();
50
+
51
+ moveTo = this.wrapper.down('#'+element.href.split("#")[1])
52
+ this.moveTo(moveTo, this.scroller, {
53
+ duration:this.options.duration
54
+ });
55
+ Event.stop(event);
56
+
57
+ this.controls.each(function(control){
58
+ if (control == element) {
59
+ control.addClassName("active")
60
+ }else{
61
+ control.removeClassName("active")
62
+ }
63
+ });
64
+ },
65
+
66
+ moveTo: function(element, container, options){
67
+ this.current = $(element);
68
+
69
+ Position.prepare();
70
+ var containerOffset = Position.cumulativeOffset(container),
71
+ elementOffset = Position.cumulativeOffset($(element));
72
+
73
+ this.scrolling = new Effect.SmoothScroll(container,
74
+ {
75
+ duration:options.duration,
76
+ x:(elementOffset[0]-containerOffset[0]),
77
+ y:(elementOffset[1]-containerOffset[1])
78
+ });
79
+ return false;
80
+ },
81
+
82
+ next: function(){
83
+ if (this.current) {
84
+ var currentIndex = this.current._index;
85
+ var nextIndex = (this.sections.length - 1 == currentIndex) ? 0 : currentIndex + 1;
86
+ } else var nextIndex = 1;
87
+
88
+ this.moveTo(this.sections[nextIndex], this.scroller, {
89
+ duration: this.options.duration
90
+ });
91
+ },
92
+
93
+ previous: function(){
94
+ if (this.current) {
95
+ var currentIndex = this.current._index;
96
+ var prevIndex = (currentIndex == 0) ? this.sections.length - 1 :
97
+ currentIndex - 1;
98
+ } else var prevIndex = this.sections.length - 1;
99
+
100
+ this.moveTo(this.sections[prevIndex], this.scroller, {
101
+ duration: this.options.duration
102
+ });
103
+ },
104
+
105
+ stop: function()
106
+ {
107
+ clearTimeout(this.timer);
108
+ },
109
+
110
+ start: function()
111
+ {
112
+ this.periodicallyUpdate();
113
+ },
114
+
115
+ periodicallyUpdate: function()
116
+ {
117
+ if (this.timer != null) {
118
+ clearTimeout(this.timer);
119
+ this.next();
120
+ }
121
+ this.timer = setTimeout(this.periodicallyUpdate.bind(this), this.options.frequency*1000);
122
+ }
123
+
124
+ });
125
+
126
+ Effect.SmoothScroll = Class.create();
127
+ Object.extend(Object.extend(Effect.SmoothScroll.prototype, Effect.Base.prototype), {
128
+ initialize: function(element) {
129
+ this.element = $(element);
130
+ var options = Object.extend({
131
+ x: 0,
132
+ y: 0,
133
+ mode: 'absolute'
134
+ } , arguments[1] || {} );
135
+ this.start(options);
136
+ },
137
+ setup: function() {
138
+ if (this.options.continuous && !this.element._ext ) {
139
+ this.element.cleanWhitespace();
140
+ this.element._ext=true;
141
+ this.element.appendChild(this.element.firstChild);
142
+ }
143
+
144
+ this.originalLeft=this.element.scrollLeft;
145
+ this.originalTop=this.element.scrollTop;
146
+
147
+ if(this.options.mode == 'absolute') {
148
+ this.options.x -= this.originalLeft;
149
+ this.options.y -= this.originalTop;
150
+ }
151
+ },
152
+ update: function(position) {
153
+ this.element.scrollLeft = this.options.x * position + this.originalLeft;
154
+ this.element.scrollTop = this.options.y * position + this.originalTop;
155
+ }
156
+ });
skin/frontend/default/default/unibanner/js/numbered.js ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function banner_selection(centerdiv_id,m1,duration,total){
2
+ if(m1==1)
3
+ clearTimeout(time1);
4
+ if(document.getElementById(centerdiv_id).style.display=="none"){
5
+ var i;
6
+ for(i=0;i<array1.length;i++){
7
+ document.getElementById(array1[i]).style.display="none";
8
+ document.getElementById(array1[i]+"1").className="";
9
+ }
10
+ fadeeffect(centerdiv_id,m1);
11
+ }
12
+ }
13
+
14
+ function fadeeffect(it,m1){
15
+ Effect.Fade(it, { duration: .9, from: 0.2, to: 1 });
16
+ document.getElementById(it).style.display="inline";
17
+ document.getElementById(it+"1").className="selected";
18
+ if(m1==1)
19
+ flag=it.charAt(7);
20
+ }
21
+ var time;
22
+ function divin(){
23
+ clearTimeout(time1);
24
+ }
skin/frontend/default/default/unibanner/js/prettify.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function(){var x={};(function(){var c=["abstract bool break case catch char class const const_cast continue default delete deprecated dllexport dllimport do double dynamic_cast else enum explicit extern false float for friend goto if inline int long mutable naked namespace new noinline noreturn nothrow novtable operator private property protected public register reinterpret_cast return selectany short signed sizeof static static_cast struct switch template this thread throw true try typedef typeid typename union unsigned using declaration, directive uuid virtual void volatile while typeof",
2
+ "as base by byte checked decimal delegate descending event finally fixed foreach from group implicit in interface internal into is lock null object out override orderby params readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var","package synchronized boolean implements import throws instanceof transient extends final strictfp native super","debugger export function with NaN Infinity","require sub unless until use elsif BEGIN END","and assert def del elif except exec global lambda not or pass print raise yield False True None",
3
+ "then end begin rescue ensure module when undef next redo retry alias defined","done fi"];for(var a=0;a<c.length;a++){var b=c[a].split(" ");for(var d=0;d<b.length;d++){if(b[d]){x[b[d]]=true}}}}).call(this);function J(c){return c>="a"&&c<="z"||c>="A"&&c<="Z"}function q(c,a,b,d){c.unshift(b,d||0);try{a.splice.apply(a,c)}finally{c.splice(0,2)}}var R=(function(){var c=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",
4
+ ">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=","~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"],a="(?:(?:(?:^|[^0-9.])\\.{1,3})|(?:(?:^|[^\\+])\\+)|(?:(?:^|[^\\-])-)";for(var b=0;b<c.length;++b){var d=c[b];if(J(d.charAt(0))){a+="|\\b"+d}else{a+="|"+d.replace(/([^=<>:&])/g,"\\$1")}}a+="|^)\\s*$";return new RegExp(a)})(),y=/&/g,A=/</g,z=/>/g,$=/\"/g;function v(c){return c.replace(y,"&amp;").replace(A,
5
+ "&lt;").replace(z,"&gt;")}var Z=/&lt;/g,Y=/&gt;/g,T=/&apos;/g,aa=/&quot;/g,S=/&amp;/g;function I(c){var a=c.indexOf("&");if(a<0){return c}for(--a;(a=c.indexOf("&#",a+1))>=0;){var b=c.indexOf(";",a);if(b>=0){var d=c.substring(a+3,b),g=10;if(d&&d.charAt(0)=="x"){d=d.substring(1);g=16}var e=parseInt(d,g);if(!isNaN(e)){c=c.substring(0,a)+String.fromCharCode(e)+c.substring(b+1)}}}return c.replace(Z,"<").replace(Y,">").replace(T,"'").replace(aa,'"').replace(S,"&")}function w(c){return"XMP"==c.tagName}var t=
6
+ null;function H(c){if(null===t){var a=document.createElement("PRE");a.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'));t=!/</.test(a.innerHTML)}if(t){var b=c.innerHTML;if(w(c)){b=v(b)}return b}var d=[];for(var g=c.firstChild;g;g=g.nextSibling){u(g,d)}return d.join("")}function u(c,a){switch(c.nodeType){case 1:var b=c.tagName.toLowerCase();a.push("<",b);for(var d=0;d<c.attributes.length;++d){var g=c.attributes[d];if(!g.specified){continue}a.push(" ");u(g,a)}a.push(">");
7
+ for(var e=c.firstChild;e;e=e.nextSibling){u(e,a)}if(c.firstChild||!/^(?:br|link|img)$/.test(b)){a.push("</",b,">")}break;case 2:a.push(c.name.toLowerCase(),'="',c.value.replace(y,"&amp;").replace(A,"&lt;").replace(z,"&gt;").replace($,"&quot;"),'"');break;case 3:case 4:a.push(v(c.nodeValue));break}}function P(c){var a=0;return function(b){var d=null,g=0;for(var e=0,i=b.length;e<i;++e){var f=b.charAt(e);switch(f){case "\t":if(!d){d=[]}d.push(b.substring(g,e));var h=c-a%c;a+=h;for(;h>=0;h-=" ".length){d.push(" ".substring(0,
8
+ h))}g=e+1;break;case "\n":a=0;break;default:++a}}if(!d){return b}d.push(b.substring(g));return d.join("")}}var W=/(?:[^<]+|<!--[\s\S]*?--\>|<!\[CDATA\[([\s\S]*?)\]\]>|<\/?[a-zA-Z][^>]*>|<)/g,X=/^<!--/,V=/^<\[CDATA\[/,U=/^<br\b/i;function G(c){var a=c.match(W),b=[],d=0,g=[];if(a){for(var e=0,i=a.length;e<i;++e){var f=a[e];if(f.length>1&&f.charAt(0)==="<"){if(X.test(f)){continue}if(V.test(f)){b.push(f.substring(9,f.length-3));d+=f.length-12}else if(U.test(f)){b.push("\n");d+=1}else{g.push(d,f)}}else{var h=
9
+ I(f);b.push(h);d+=h.length}}}return{source:b.join(""),tags:g}}function r(c,a){var b={};(function(){var g=c.concat(a);for(var e=g.length;--e>=0;){var i=g[e],f=i[3];if(f){for(var h=f.length;--h>=0;){b[f.charAt(h)]=i}}}})();var d=a.length;return function(g,e){e=e||0;var i=[e,"pln"],f="",h=0,n=g;while(n.length){var j,k=null,m=b[n.charAt(0)];if(m){var l=n.match(m[1]);k=l[0];j=m[0]}else{for(var o=0;o<d;++o){m=a[o];var p=m[2];if(p&&!p.test(f)){continue}var l=n.match(m[1]);if(l){k=l[0];j=m[0];break}}if(!k){j=
10
+ "pln";k=n.substring(0,1)}}i.push(e+h,j);h+=k.length;n=n.substring(k.length);if(j!=="com"&&/\S/.test(k)){f=k}}return i}}var C=r([["str",/^\'(?:[^\\\']|\\[\s\S])*(?:\'|$)/,null,"'"],["str",/^\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)/,null,'"'],["str",/^\`(?:[^\\\`]|\\[\s\S])*(?:\`|$)/,null,"`"]],[["pln",/^(?:[^\'\"\`\/\#]+)/,null," \r\n"],["com",/^#[^\r\n]*/,null,"#"],["com",/^\/\/[^\r\n]*/,null],["str",/^\/(?:[^\\\*\/]|\\[\s\S])+(?:\/|$)/,R],["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null]]);var B=r([],[["pln",/^\s+/,
11
+ null," \r\n"],["pln",/^[a-z_$@][a-z_$@0-9]*/i,null],["lit",/^0x[a-f0-9]+[a-z]/i,null],["lit",/^(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?[a-z]*/i,null,"123456789"],["pun",/^[^\s\w\.$@]+/,null]]);function L(c,a){for(var b=0;b<a.length;b+=2){var d=a[b+1];if(d==="pln"){var g=a[b],e=b+2<a.length?a[b+2]:c.length,i=c.substring(g,e),f=B(i,g);for(var h=0,n=f.length;h<n;h+=2){var j=f[h+1];if(j==="pln"){var k=f[h],m=h+2<n?f[h+2]:i.length,l=c.substring(k,m);if(l=="."){f[h+1]="pun"}else if(l in x){f[h+
12
+ 1]="kwd"}else if(/^@?[A-Z][A-Z$]*[a-z][A-Za-z$]*$/.test(l)){f[h+1]=l.charAt(0)=="@"?"lit":"typ"}}}q(f,a,b,2);b+=f.length-2}}return a}var D=r([],[["pln",/^[^<]+/,null],["dec",/^<!\w[^>]*(?:>|$)/,null],["com",/^<!--[\s\S]*?(?:--\>|$)/,null],["src",/^<\?[\s\S]*?(?:\?>|$)/,null],["src",/^<%[\s\S]*?(?:%>|$)/,null],["src",/^<(script|style|xmp)\b[^>]*>[\s\S]*?<\/\1\b[^>]*>/i,null],["tag",/^<\/?\w[^<>]*>/,null]]);function Q(c){var a=D(c);for(var b=0;b<a.length;b+=2){if(a[b+1]==="src"){var d=a[b],g=b+2<a.length?
13
+ a[b+2]:c.length,e=c.substring(d,g),i=e.match(/^(<[^>]*>)([\s\S]*)(<\/[^>]*>)$/);if(i){a.splice(b,2,d,"tag",d+i[1].length,"src",d+i[1].length+(i[2]||"").length,"tag")}}}return a}var E=r([["atv",/^\'[^\']*(?:\'|$)/,null,"'"],["atv",/^\"[^\"]*(?:\"|$)/,null,'"'],["pun",/^[<>\/=]+/,null,"<>/="]],[["tag",/^[\w-]+/,/^</],["atv",/^[\w-]+/,/^=/],["atn",/^[\w-]+/,null],["pln",/^\s+/,null," \r\n"]]);function O(c,a){for(var b=0;b<a.length;b+=2){var d=a[b+1];if(d==="tag"){var g=a[b],e=b+2<a.length?a[b+2]:c.length,
14
+ i=c.substring(g,e),f=E(i,g);q(f,a,b,2);b+=f.length-2}}return a}function N(c,a){for(var b=0;b<a.length;b+=2){var d=a[b+1];if(d=="src"){var g=a[b],e=b+2<a.length?a[b+2]:c.length,i=s(c.substring(g,e));for(var f=0,h=i.length;f<h;f+=2){i[f]+=g}q(i,a,b,2);b+=i.length-2}}return a}function M(c,a){var b=false;for(var d=0;d<a.length;d+=2){var g=a[d+1];if(g==="atn"){var e=a[d],i=d+2<a.length?a[d+2]:c.length;b=/^on|^style$/i.test(c.substring(e,i))}else if(g=="atv"){if(b){var e=a[d],i=d+2<a.length?a[d+2]:c.length,
15
+ f=c.substring(e,i),h=f.length,n=h>=2&&/^[\"\']/.test(f)&&f.charAt(0)===f.charAt(h-1),j,k,m;if(n){k=e+1;m=i-1;j=f}else{k=e+1;m=i-1;j=f.substring(1,f.length-1)}var l=s(j);for(var o=0,p=l.length;o<p;o+=2){l[o]+=k}if(n){l.push(m,"atv");q(l,a,d+2,0)}else{q(l,a,d,2)}}b=false}}return a}function s(c){var a=C(c);a=L(c,a);return a}function F(c){var a=Q(c);a=O(c,a);a=N(c,a);a=M(c,a);return a}function K(c,a,b){var d=[],g=0,e=null,i=null,f=0,h=0,n=P(8);function j(m){if(m>g){if(e&&e!==i){d.push("</span>");e=null}if(!e&&
16
+ i){e=i;d.push('<span class="',e,'">')}var l=v(n(c.substring(g,m))).replace(/(\r\n?|\n| ) /g,"$1&nbsp;").replace(/\r\n?|\n/g,"<br>");d.push(l);g=m}}while(true){var k;if(f<a.length){if(h<b.length){k=a[f]<=b[h]}else{k=true}}else{k=false}if(k){j(a[f]);if(e){d.push("</span>");e=null}d.push(a[f+1]);f+=2}else if(h<b.length){j(b[h]);i=b[h+1];h+=2}else{break}}j(c.length);if(e){d.push("</span>")}return d.join("")}function ca(c){try{var a=G(c),b=a.source,d=a.tags,g=/^\s*</.test(b)&&/>\s*$/.test(b),e=g?F(b):
17
+ s(b);return K(b,d,e)}catch(i){if("console"in window){console.log(i);console.trace()}return c}}function ba(c){var a=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],b=[];for(var d=0;d<a.length;++d){for(var g=0;g<a[d].length;++g){b.push(a[d][g])}}a=null;var e=0;function i(){var f=(new Date).getTime()+250;for(;e<b.length&&(new Date).getTime()<f;e++){var h=b[e];if(h.className&&h.className.indexOf("prettyprint")>=0){var n=false;for(var j=
18
+ h.parentNode;j!=null;j=j.parentNode){if((j.tagName=="pre"||j.tagName=="code"||j.tagName=="xmp")&&j.className&&j.className.indexOf("prettyprint")>=0){n=true;break}}if(!n){var k=H(h);k=k.replace(/(?:\r\n?|\n)$/,"");var m=ca(k);if(!w(h)){h.innerHTML=m}else{var l=document.createElement("PRE");for(var o=0;o<h.attributes.length;++o){var p=h.attributes[o];if(p.specified){l.setAttribute(p.name,p.value)}}l.innerHTML=m;h.parentNode.replaceChild(l,h)}}}}if(e<b.length){setTimeout(i,250)}else if(c){c()}}i()};this.prettyPrint=ba})();
skin/frontend/default/default/unibanner/js/protoFlow.js ADDED
@@ -0,0 +1,663 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Class: ProtoFlow
3
+
4
+ License:
5
+ Copyright (c) 2008 DeenSoft.com - You are free to use this file wherever you wish but please do let us know at blog.deensoft.com
6
+ so that we can showcase it. You can even post your bugs on our blog and we will fix them asap.
7
+ This code is being release under open-terms. Use at your own risk. Give us feedback. Help us fix bugs and implement new features. :)
8
+ <contact@deensoft.com>
9
+
10
+ You can follow up with more comments and suggestions on our blog <http://blog.deensoft.com>
11
+
12
+ Description:
13
+ ProtoFlow v0.8 is a very early preview release that simulates Apples CoverFlow effect using Prototype/Scriptaculous lib.
14
+
15
+ ChangeLog:
16
+ July 7, 2008:
17
+ * Fixed z-index issue - Thanks to Xavvier (http://www.euclide.org/) for the fix.
18
+ March 26, 2008:
19
+ * Fixed major issue with IE7 and z-index for scrollbar (Thanks to all those who contributed on the blog)
20
+ March 19, 2008
21
+ * Fixed issues with IE
22
+ * Fixed major bug with images and links...
23
+
24
+ Initial:
25
+ * Added Reflection
26
+ * Fixed Captions
27
+
28
+ How to use:
29
+ (start code)
30
+ var myFlow = new ProtoFlow(
31
+ $('myElem'),
32
+ {
33
+ captions: 'captionsList'
34
+ }
35
+ );
36
+ (end)
37
+ */
38
+
39
+ var ProtoFlow = Class.create({
40
+ /*
41
+ Function: initialize
42
+ Constructor for ProtoFlow Class.
43
+
44
+ Parameters:
45
+ elem - {Mixed} the HTML object that ProtoFlow is initialize from. This can be either an HTML Object or ID to an HTML object.
46
+ opt - {Object} config Object
47
+ */
48
+ initialize: function(elem, opt){
49
+ opt = opt || {};
50
+ this.options = {
51
+ startIndex: 2,
52
+ interval: 60,
53
+ slider: true,
54
+ flex: 110,
55
+ captions: false,
56
+ autoplay: false,
57
+ autoplayInterval: 5,
58
+ useReflection: false,
59
+ enableOnClickScroll: false,
60
+ enableKeyboard: true,
61
+ enableMouse: true
62
+ };
63
+ Object.extend(this.options, opt);
64
+
65
+ this.useCaptions = this.options.captions; //initially we don't wanna use captions unless turned on?
66
+ this.elem = $(elem);
67
+ if (!this.elem)
68
+ return;
69
+
70
+ //console.log(this.elem.select('img'));
71
+ this.elem.setStyle({
72
+ overflow: "hidden",
73
+ position: "relative"
74
+ });
75
+ this.imageStack = this.elem.select('img'); //this.elem.childElements();
76
+ if (this.options.captions != false) {
77
+ this.captions = this.imageStack.pluck("alt");
78
+ //this.captions = this.captionsHolder.childElements();
79
+ //this.captions.each( ( function(elem, i){this.captions[i] = elem.innerHTML;} ).bind(this));
80
+ this.captionsCount = this.captions.size();
81
+ }
82
+
83
+ if (this.options.useReflection) {
84
+ this.imageStack.each(function(elem){
85
+ Reflection.add(elem, {
86
+ opacity: 2 / 3
87
+ });
88
+ }.bind(this));
89
+ this.stack = this.elem.childElements();
90
+ }
91
+ else {
92
+ this.stack = this.imageStack;
93
+ }
94
+ this.stackCount = (this.stack).size();
95
+
96
+
97
+
98
+ if (this.useCaptions) {
99
+ this.captionHolder = new Element('div');
100
+ this.captionHolder.className = "captionHolder";
101
+ this.captionHolder.setStyle({
102
+ width: "100%",
103
+ textAlign: "center",
104
+ position: 'absolute',
105
+ left: "0px",
106
+ top: (Element.getHeight(this.elem) - 80) + "px"
107
+ });
108
+ this.elem.appendChild(this.captionHolder);
109
+ }
110
+
111
+
112
+
113
+ this.currPos = this.options.startIndex - 1;
114
+ this.currIndex = this.currPos;
115
+ /* slider */
116
+ if (this.options.slider) {
117
+ this.sliderContainer = new Element('div');
118
+ this.sliderContainer.setStyle({
119
+ width: '200px',
120
+ height: '10px',
121
+ position: 'absolute',
122
+ top: (Element.getHeight(this.elem) - 30) + "px",
123
+ left: (Element.getWidth(this.elem) / 2 - (137 / 2)) + "px",
124
+ zIndex: 99999999
125
+ });
126
+
127
+ this.sliderTrack = new Element('div');
128
+ this.sliderTrack.className = "sliderTrack";
129
+
130
+ this.sliderHandle = new Element('div');
131
+ this.sliderHandle.className = "sliderHandle";
132
+
133
+ this.sliderTrack.appendChild(this.sliderHandle);
134
+ this.sliderContainer.appendChild(this.sliderTrack);
135
+
136
+ this.elem.appendChild(this.sliderContainer);
137
+
138
+ this.slider = new Control.Slider(this.sliderHandle, this.sliderTrack, {
139
+ range: $R(0, this.getStackCount() - 1),
140
+ sliderValue: this.getCurrentPos(), // won't work if set to 0 due to a bug(?) in script.aculo.us
141
+ onSlide: this.handleSlider.bind(this),
142
+ onChange: this.handleSlider.bind(this)
143
+ });
144
+ }
145
+
146
+
147
+
148
+ this.timer = 0;
149
+
150
+
151
+ /* sets up click listener on all the elements in the stack */
152
+ this.stack.each(function(elem){
153
+ elem.identify();
154
+ //console.log(elem);
155
+ //elem.observe("mouseover", function(){this.setStyle({"border": "2px solid yellow;"});});
156
+ if (this.options.enableOnClickScroll)
157
+ elem.observe('click', this.handleClick.bind(this));
158
+ }.bind(this));
159
+
160
+ if (this.options.enableOnClickScroll) //lets go through all the <a> tags and disable them..
161
+ {
162
+ this.disableLinks();
163
+ }
164
+
165
+ this.goTo(this.currPos);
166
+
167
+ this.autoplayer = null;
168
+ if (this.options.autoplay) {
169
+ this.autoplayer = new PeriodicalExecuter(this.autoPlay.bind(this), this.options.autoplayInterval);
170
+ }
171
+
172
+
173
+ /**
174
+ * Added Keyboard support thanks to Martin (martin[at]noremember.org)
175
+ */
176
+ if(this.options.enableKeyboard) {
177
+ document.observe('keyup', (function(e) {
178
+ var code = e.keyCode;
179
+ if(37 == code) this.previous();
180
+ if(39 == code) this.next();
181
+ }).bind(this));
182
+ }
183
+
184
+ if(this.options.enableMouse) {
185
+ var eventType = Prototype.Browser.Gecko ? "DOMMouseScroll" : "mousewheel";
186
+
187
+ Event.observe(this.elem, eventType, (function(e) {
188
+ this.enableMouse(e);
189
+ }).bind(this), false);
190
+
191
+ if (this.useCaptions) {
192
+ Event.observe(this.captionHolder, eventType, (function(e) {
193
+ this.enableMouse(e);
194
+ }).bind(this), false);
195
+ }
196
+ }
197
+ /***/
198
+ Event.observe(window, 'resize', this.handleWindowResize.bind(this));
199
+ },
200
+ /**
201
+ * Function: diableLinks
202
+ *
203
+ * This function goes through all the anchor tags in the stack and simply disables the href attribute.
204
+ * This is required if the user has set 'enableOnClickScroll' to be true
205
+ *
206
+ * A fix was contributed by Martin. Thank you!
207
+ */
208
+ disableLinks: function(){
209
+ this.elem.select("a").each(function(a){
210
+ a.observe('click', function(e) {
211
+ e.preventDefault();
212
+ });
213
+ });
214
+ },
215
+ /**
216
+ * Function: autoPlay
217
+ *
218
+ * Internal function that is used to scroll through the list automatically
219
+ */
220
+ autoPlay: function(){
221
+ if ((this.currIndex + 2) > this.stackCount) {
222
+ this.currIndex = 0;
223
+ }
224
+ this.currIndex = this.currIndex + 1
225
+ this.goTo(this.currIndex);
226
+ },
227
+ /**
228
+ * Function: handleWindowResize
229
+ *
230
+ * Currently does nothing. This will be implemented later on. Internal Function
231
+ * Parameters:
232
+ * event - {Object} Browser generated event
233
+ */
234
+ handleWindowResize: function(event){
235
+ },
236
+ /**
237
+ * Function: hanldeWheel
238
+ * This function should handle onwheel scroll events. This is quite buggy at the moment so disabled
239
+ * by default.
240
+ *
241
+ * Parameters:
242
+ *
243
+ * event - {Object} Browser Event
244
+ */
245
+ handleWheel: function(event){
246
+ v = Event.wheel(event);
247
+ this.goTo(this.currIndex + v);
248
+ this.slider.setValue(this.currIndex + v);
249
+ },
250
+ /**
251
+ * Function: handleSliderChange
252
+ * wrapper function called after slider has been moved. This in turn calls <goTo> function which
253
+ * moves the images around.
254
+ *
255
+ * Parameters:
256
+ * index - {int} index to move to
257
+ */
258
+ handleSliderChange: function(index){
259
+ this.goTo(index);
260
+ },
261
+ /**
262
+ * Function: handleSlider
263
+ * wrapper function called after slider has been moved. This in turn calls <goTo> function which
264
+ * moves the images around.
265
+ *
266
+ * Parameters:
267
+ * index - {int} index to move to.
268
+ */
269
+ handleSlider: function(index){
270
+ if (index)
271
+ this.goTo(index);
272
+ },
273
+ /**
274
+ * function: handleClick
275
+ * When an image is clicked we handle it by finding the appropiate index and then moving the images
276
+ * and updating the scrollbar as well.
277
+ *
278
+ * Parameters:
279
+ * e - {Object} Browser Event
280
+ */
281
+ handleClick: function(e){
282
+ var elem = Event.element(e);
283
+
284
+ var v = elem.getAttribute("index");
285
+
286
+ if (!v && this.options.useReflection) {
287
+ elem = elem.up('a');
288
+ v = elem.getAttribute("index");
289
+ }
290
+
291
+ this.currIndex = v;
292
+ this.goTo(v);
293
+ this.updateSlider(v);
294
+ },
295
+ /**
296
+ * Function: getCurrentPos
297
+ * Returns the current position of the image that is being focused on.
298
+ *
299
+ * Returns:
300
+ * current position - {int} index
301
+ */
302
+ getCurrentPos: function(){
303
+ return this.currPos;
304
+ },
305
+ /**
306
+ * function: goTo
307
+ * takes an index and moves the images to that index based on the flex and index provided. This also
308
+ * updates the captions to show the correct caption if enabled.
309
+ *
310
+ * Parameters:
311
+ * index - {int} index in the stack to move to
312
+ */
313
+ goTo: function(index){
314
+ this.slideTo(index * this.options.flex * -1);
315
+ //this.currPos = Math.round(index);
316
+ if (this.useCaptions) {
317
+ this.captionHolder.innerHTML = this.captions[Math.round(index)];
318
+ }
319
+ },
320
+ /**
321
+ * function: updateSlider
322
+ * updates the slider to currect position.
323
+ *
324
+ * parameters:
325
+ * index - {int} Index for the stack
326
+ */
327
+ updateSlider: function(index){
328
+ if (this.options.slider)
329
+ this.slider.setValue(index);
330
+ },
331
+ /**
332
+ * function: step
333
+ * Steps through the animation process. This is what makes it look so smooth ;)
334
+ */
335
+ step: function(){
336
+ if (this.target < this.currPos - 1 || this.target > this.currPos + 1) {
337
+ this.moveTo(this.currPos + (this.target - this.currPos) / 5);
338
+ window.setTimeout(this.step.bind(this), this.options.interval);
339
+ this.timer = 1;
340
+ }
341
+ else {
342
+ this.timer = 0;
343
+
344
+ }
345
+ },
346
+ /**
347
+ * function: slideTo
348
+ * This function sets up a timer and calls step on the interval specified via options.
349
+ * parameters:
350
+ * x - {int} index to move to
351
+ */
352
+ slideTo: function(x){
353
+ this.target = x;
354
+
355
+ if (this.timer == 0) {
356
+ window.setTimeout(this.step.bind(this), this.options.interval);
357
+ this.timer = 1;
358
+ }
359
+
360
+
361
+ },
362
+ /**
363
+ * function: moveTo
364
+ * Actually moves the images based on the position provided by <step> function
365
+ *
366
+ * parameters:
367
+ * currentPos - {int} Position to move to
368
+ */
369
+ moveTo: function(currentPos){
370
+ var x = currentPos;
371
+ this.currPos = currentPos;
372
+ var width = Element.getWidth(this.elem);
373
+ var height = Element.getHeight(this.elem);
374
+
375
+ var top = this.elem.offsetTop;
376
+ var zIndex = this.stackCount;
377
+ var flex = this.options.flex;
378
+ this.stack.each(function(elem, index){
379
+
380
+ Element.absolutize(elem);
381
+ elem.setAttribute("index", index);
382
+
383
+ var wsize=300;
384
+ var hsize=300;
385
+
386
+ if (this.options.useReflection) {
387
+ wsize=elem.select('img')[0].width;
388
+ hsize=elem.select('img')[0].height;
389
+ } else {
390
+ wsize=elem.width;
391
+ hsize=elem.height;
392
+ }
393
+
394
+ if (this.options.useReflection) {
395
+ elem.down(1).setAttribute('index', index);
396
+ }
397
+
398
+ var sign=1;
399
+ if(x < 0)
400
+ sign=-1;
401
+
402
+ var mvt=Math.abs(x/flex/this.stackCount);
403
+
404
+ if(mvt > 0.2) {
405
+ mvt=Math.min(1, Math.pow(mvt, 0.1));
406
+ } else if(mvt > 0.01) {
407
+ mvt=mvt*4;
408
+ }
409
+
410
+ var nx=(width - wsize)/2 + sign * (width - wsize - 20) * mvt / 2;
411
+ var ny=(20 + height - hsize)/2 - (height - hsize - 10) * mvt / 2;
412
+
413
+ elem.setStyle({
414
+ left: nx+'px',
415
+ top: ny+'px',
416
+ textAlign: "center"
417
+ });
418
+ //console.log(elem);
419
+ elem.style.zIndex = zIndex;
420
+
421
+ if (x < - (flex/2))
422
+ zIndex++;
423
+ else
424
+ zIndex--;
425
+
426
+ x += this.options.flex;
427
+
428
+ }.bind(this));
429
+ },
430
+ /**
431
+ Function: getStackCount
432
+ Returns the count of elements in the stack
433
+
434
+ Returns:
435
+ stackCount - {int} An integer value indicating how many elements are there in the stack.
436
+ */
437
+ getStackCount: function(){
438
+ return this.stackCount;
439
+ },
440
+ decreaseIndex: function(e) {
441
+ if(this.currIndex > 0)
442
+ this.currIndex--;
443
+ },
444
+
445
+ increaseIndex: function(e) {
446
+ if (this.currIndex < this.getStackCount() - 1)
447
+ this.currIndex++;
448
+ },
449
+
450
+ previous: function(e) {
451
+ this.decreaseIndex();
452
+ this.toCurrentIndex();
453
+ },
454
+
455
+ next: function(e) {
456
+ this.increaseIndex();
457
+ this.toCurrentIndex();
458
+ },
459
+
460
+ enableMouse: function(e) {
461
+ Event.wheel(e)< 0 ? this.next() : this.previous();
462
+ Event.stop(e);
463
+ },
464
+
465
+ toCurrentIndex: function(e) {
466
+ this.goTo(this.currIndex);
467
+ this.updateSlider(this.currIndex);
468
+ }
469
+ });
470
+
471
+ /**
472
+ * Code contributed by Martin
473
+ */
474
+ Object.extend(Event, {
475
+ wheel: function(event){
476
+ var delta = 0;
477
+ if (!event) event = window.event;
478
+
479
+ if (event.wheelDelta) {
480
+ delta = event.wheelDelta/120;
481
+ if (window.opera) delta = -delta;
482
+ }
483
+ else if (event.detail) {
484
+ delta = -event.detail/3;
485
+ }
486
+ return Math.round(delta); //Safari Round
487
+ }
488
+ });
489
+
490
+ /**
491
+ * reflection.js v1.8
492
+ * http://cow.neondragon.net/stuff/reflection/
493
+ * Freely distributable under MIT-style license.
494
+ */
495
+
496
+ /* From prototype.js */
497
+ if (!document.getElementsByClassName) {
498
+ document.getElementsByClassName = function(className) {
499
+ var children = document.getElementsByTagName('*') || document.all;
500
+ var elements = new Array();
501
+
502
+ for (var i = 0; i < children.length; i++) {
503
+ var child = children[i];
504
+ var classNames = child.className.split(' ');
505
+ for (var j = 0; j < classNames.length; j++) {
506
+ if (classNames[j] == className) {
507
+ elements.push(child);
508
+ break;
509
+ }
510
+ }
511
+ }
512
+ return elements;
513
+ }
514
+ }
515
+
516
+ var Reflection = {
517
+ defaultHeight : 0.5,
518
+ defaultOpacity: 0.5,
519
+
520
+ add: function(image, options) {
521
+ Reflection.remove(image);
522
+
523
+ doptions = { "height" : Reflection.defaultHeight, "opacity" : Reflection.defaultOpacity }
524
+ if (options) {
525
+ for (var i in doptions) {
526
+ if (!options[i]) {
527
+ options[i] = doptions[i];
528
+ }
529
+ }
530
+ } else {
531
+ options = doptions;
532
+ }
533
+
534
+ try {
535
+ var d = document.createElement('div');
536
+ var p = image;
537
+
538
+ var classes = p.className.split(' ');
539
+ var newClasses = '';
540
+ for (j=0;j<classes.length;j++) {
541
+ if (classes[j] != "reflect") {
542
+ if (newClasses) {
543
+ newClasses += ' '
544
+ }
545
+
546
+ newClasses += classes[j];
547
+ }
548
+ }
549
+
550
+ var reflectionHeight = Math.floor(p.height*options['height']);
551
+ var divHeight = Math.floor(p.height*(1+options['height']));
552
+
553
+ var reflectionWidth = p.width;
554
+
555
+ if (document.all && !window.opera) {
556
+ /* Fix hyperlinks */
557
+ if(p.parentElement.tagName == 'A') {
558
+ var d = document.createElement('a');
559
+ d.href = p.parentElement.href;
560
+ }
561
+
562
+ /* Copy original image's classes & styles to div */
563
+ d.className = newClasses;
564
+ p.className = 'reflected';
565
+
566
+ d.style.cssText = p.style.cssText;
567
+ p.style.cssText = 'vertical-align: bottom';
568
+
569
+ var reflection = document.createElement('img');
570
+ reflection.src = p.src;
571
+ reflection.style.width = reflectionWidth+'px';
572
+ reflection.style.display = 'block';
573
+ reflection.style.height = p.height+"px";
574
+
575
+ reflection.style.marginBottom = "-"+(p.height-reflectionHeight)+'px';
576
+ reflection.style.filter = 'flipv progid:DXImageTransform.Microsoft.Alpha(opacity='+(options['opacity']*100)+', style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy='+(options['height']*100)+')';
577
+
578
+ d.style.width = reflectionWidth+'px';
579
+ d.style.height = divHeight+'px';
580
+ p.parentNode.replaceChild(d, p);
581
+
582
+ d.appendChild(p);
583
+ d.appendChild(reflection);
584
+ } else {
585
+ var canvas = document.createElement('canvas');
586
+ if (canvas.getContext) {
587
+ /* Copy original image's classes & styles to div */
588
+ d.className = newClasses;
589
+ p.className = 'reflected';
590
+
591
+ d.style.cssText = p.style.cssText;
592
+ p.style.cssText = 'vertical-align: bottom';
593
+
594
+ var context = canvas.getContext("2d");
595
+
596
+ canvas.style.height = reflectionHeight+'px';
597
+ canvas.style.width = reflectionWidth+'px';
598
+ canvas.height = reflectionHeight;
599
+ canvas.width = reflectionWidth;
600
+
601
+ d.style.width = reflectionWidth+'px';
602
+ d.style.height = divHeight+'px';
603
+ p.parentNode.replaceChild(d, p);
604
+
605
+ d.appendChild(p);
606
+ d.appendChild(canvas);
607
+
608
+ context.save();
609
+
610
+ context.translate(0,image.height-1);
611
+ context.scale(1,-1);
612
+
613
+ context.drawImage(image, 0, 0, reflectionWidth, image.height);
614
+
615
+ context.restore();
616
+
617
+ context.globalCompositeOperation = "destination-out";
618
+ var gradient = context.createLinearGradient(0, 0, 0, reflectionHeight);
619
+
620
+ gradient.addColorStop(1, "rgba(255, 255, 255, 1.0)");
621
+ gradient.addColorStop(0, "rgba(255, 255, 255, "+(1-options['opacity'])+")");
622
+
623
+ context.fillStyle = gradient;
624
+ if (navigator.appVersion.indexOf('WebKit') != -1) {
625
+ context.fill();
626
+ } else {
627
+ context.fillRect(0, 0, reflectionWidth, reflectionHeight*2);
628
+ }
629
+ }
630
+ }
631
+ } catch (e) {
632
+ }
633
+ },
634
+
635
+ remove : function(image) {
636
+ if (image.className == "reflected") {
637
+ image.className = image.parentNode.className;
638
+ image.parentNode.parentNode.replaceChild(image, image.parentNode);
639
+ }
640
+ }
641
+ }
642
+
643
+ function addReflections() {
644
+ var rimages = document.getElementsByClassName('reflect');
645
+ for (i=0;i<rimages.length;i++) {
646
+ var rheight = null;
647
+ var ropacity = null;
648
+
649
+ var classes = rimages[i].className.split(' ');
650
+ for (j=0;j<classes.length;j++) {
651
+ if (classes[j].indexOf("rheight") == 0) {
652
+ var rheight = classes[j].substring(7)/100;
653
+ } else if (classes[j].indexOf("ropacity") == 0) {
654
+ var ropacity = classes[j].substring(8)/100;
655
+ }
656
+ }
657
+
658
+ Reflection.add(rimages[i], { height: rheight, opacity : ropacity});
659
+ }
660
+ }
661
+
662
+ var previousOnload = window.onload;
663
+ window.onload = function () { if(previousOnload) previousOnload(); addReflections(); }
skin/frontend/default/default/unibanner/js/protofade.js ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ Protofade 1.2 18/09/09
3
+ Copyright (c) 2009 Filippo Buratti; info [at] cssrevolt.com [dot] com; http://www.filippoburatti.net/
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
22
+ */
23
+
24
+ var Protofade = Class.create({
25
+
26
+ initialize: function(element, options) {
27
+ this.options = {
28
+ duration: 1,
29
+ delay: 4.0,
30
+ randomize: false,
31
+ autostart:true,
32
+ controls:false,
33
+ eSquare:false,
34
+ eRows: 3,
35
+ eCols: 5,
36
+ eColor: '#FFFFFF'
37
+ }
38
+ Object.extend(this.options, options || {});
39
+
40
+ this.element = $(element);
41
+ this.slides = this.element.childElements();
42
+ this.num_slides = this.slides.length;
43
+ this.current_slide = (this.options.randomize) ? (Math.floor(Math.random()*this.num_slides)) : 0;
44
+ this.end_slide = this.num_slides - 1;
45
+
46
+ this.slides.invoke('hide');
47
+ this.slides[this.current_slide].show();
48
+
49
+ if (this.options.autostart) {
50
+ this.startSlideshow();
51
+ }
52
+ if (this.options.controls) {
53
+ this.addControls();
54
+ }
55
+ if (this.options.eSquare) {
56
+ this.buildEsquare();
57
+ }
58
+ },
59
+
60
+ addControls: function() {
61
+
62
+ this.wrapper = this.element.up();
63
+ this.controls = new Element('div', { 'class': 'controls' });
64
+
65
+ this.controls.setStyle({
66
+
67
+
68
+
69
+
70
+ 'position':'relative',
71
+ 'margin':'-29px 0 0 0',
72
+ 'zIndex':1000
73
+
74
+
75
+ });
76
+
77
+ this.wrapper.insert(this.controls);
78
+
79
+ this.btn_next = new Element('a', { 'class': 'next', 'title': 'next;', href: '#' }).update('Next');
80
+ this.btn_next.setStyle({
81
+
82
+
83
+ padding: '4px',
84
+ color:'#ffffff'
85
+ });
86
+ this.btn_previous = new Element('a', { 'class': 'previous', 'title': 'previous;', href: '#' }).update('Previous');
87
+ this.btn_previous.setStyle({
88
+ padding: '4px',
89
+ color:'#ffffff'
90
+ });
91
+ this.btn_start = new Element('a', { 'class': 'start', 'title': 'start', href: '#' }).update('Start');
92
+ this.btn_start.setStyle({
93
+ padding: '4px',
94
+ color:'#ffffff'
95
+ });
96
+ this.btn_stop = new Element('a', { 'class': 'stop', 'title': 'Stop', href: '#' }).update('Stop');
97
+
98
+ this.btn_stop.setStyle({
99
+ padding: '4px',
100
+ color:'#ffffff'
101
+ });
102
+
103
+ this.btns = [this.btn_previous, this.btn_next, this.btn_start, this.btn_stop];
104
+ this.btns.each(function(el){
105
+ this.controls.insert(el);
106
+ }.bind(this));
107
+
108
+ this.btn_previous.observe('click', this.moveToPrevious.bindAsEventListener(this));
109
+ this.btn_next.observe('click', this.moveToNext.bindAsEventListener(this));
110
+ this.btn_start.observe('click', this.startSlideshow.bindAsEventListener(this));
111
+ this.btn_stop.observe('click', this.stopSlideshow.bindAsEventListener(this));
112
+ },
113
+
114
+ buildEsquare: function() {
115
+ this.eSquares = [];
116
+ var elDimension = this.element.getDimensions();
117
+ var elWidth = elDimension.width;
118
+ var elHeight = elDimension.height;
119
+
120
+ var sqWidth = elWidth / this.options.eCols;
121
+ var sqHeight = elHeight / this.options.eRows;
122
+
123
+ $R(0, this.options.eCols-1).each(function(col) {
124
+ this.eSquares[col] = [];
125
+ $R(0, this.options.eRows-1).each(function(row) {
126
+ var sqLeft = col * sqWidth;
127
+ var sqTop = row * sqHeight;
128
+ this.eSquares[col][row] = new Element('span').setStyle({
129
+ opacity: 0, backgroundColor: this.options.eColor,
130
+ position: 'absolute', 'z-index': 5,
131
+ left: sqLeft + 'px', top: sqTop + 'px',
132
+ width: sqWidth + 'px', height: sqHeight + 'px'
133
+ });
134
+ this.element.insert(this.eSquares[col][row]);
135
+ }.bind(this))
136
+ }.bind(this));
137
+ },
138
+
139
+ startSlideshow: function(event) {
140
+ if (event) { Event.stop(event); }
141
+ if (!this.running) {
142
+ this.executer = new PeriodicalExecuter(function(){
143
+ this.updateSlide(this.current_slide+1);
144
+ }.bind(this),this.options.delay);
145
+ this.running=true;
146
+ }
147
+ },
148
+
149
+ stopSlideshow: function(event) {
150
+ if (event) { Event.stop(event); }
151
+ if (this.executer) {
152
+ this.executer.stop();
153
+ this.running=false;
154
+ }
155
+ },
156
+
157
+ moveToPrevious: function (event) {
158
+ if (event) { Event.stop(event); }
159
+ this.stopSlideshow();
160
+ this.updateSlide(this.current_slide-1);
161
+ },
162
+
163
+ moveToNext: function (event) {
164
+ if (event) { Event.stop(event); }
165
+ this.stopSlideshow();
166
+ this.updateSlide(this.current_slide+1);
167
+ },
168
+
169
+ updateSlide: function(next_slide) {
170
+ if (next_slide > this.end_slide) {
171
+ next_slide = 0;
172
+ }
173
+ else if ( next_slide == -1 ) {
174
+ next_slide = this.end_slide;
175
+ }
176
+ this.fadeInOut(next_slide, this.current_slide);
177
+ },
178
+
179
+ fadeInOut: function (next, current) {
180
+ new Effect.Parallel([
181
+ new Effect.Fade(this.slides[current], { sync: true }),
182
+ new Effect.Appear(this.slides[next], { sync: true })
183
+ ], { duration: this.options.duration });
184
+
185
+ if (this.options.eSquare) {
186
+ $R(0, this.options.eCols-1).each(function(col) {
187
+ $R(0, this.options.eRows-1).each(function(row) {
188
+ var eSquare = this.eSquares[col][row];
189
+ var delay = Math.random() * 150;
190
+ setTimeout(this.delayedAppear.bind(this, eSquare), delay);
191
+ }.bind(this))
192
+ }.bind(this));
193
+ }
194
+
195
+ this.current_slide = next;
196
+ },
197
+
198
+ delayedAppear: function(eSquare) {
199
+ var opacity = Math.random();
200
+ new Effect.Parallel([
201
+ new Effect.Appear ( eSquare, { from: 0, to: opacity, duration: this.options.duration/4 } ),
202
+ new Effect.Appear ( eSquare, { from: opacity, to: 0, duration: this.options.duration/1.25} )
203
+ ], { sync: false });
204
+ }
205
+
206
+ });