Version Notes
First Stable Release
Download this release
Release Info
Developer | Aftab Naveed |
Extension | Displaze_Slideshow |
Version | 1.7.0 |
Comparing to | |
See all releases |
Version 1.7.0
- app/code/community/Displaze/MySlideshow/Block/Adminhtml/Slideshow.php +41 -0
- app/code/community/Displaze/MySlideshow/Block/Adminhtml/Slideshow/Edit.php +116 -0
- app/code/community/Displaze/MySlideshow/Block/Adminhtml/Slideshow/Edit/Form.php +41 -0
- app/code/community/Displaze/MySlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Main.php +196 -0
- app/code/community/Displaze/MySlideshow/Block/Adminhtml/Slideshow/Edit/Tabs.php +55 -0
- app/code/community/Displaze/MySlideshow/Block/Adminhtml/Slideshow/Grid.php +104 -0
- app/code/community/Displaze/MySlideshow/Block/Adminhtml/Slideshow/Image/Renderer.php +31 -0
- app/code/community/Displaze/MySlideshow/Block/Slideshow.php +35 -0
- app/code/community/Displaze/MySlideshow/Helper/Data.php +35 -0
- app/code/community/Displaze/MySlideshow/Model/Resource/Slideshow.php +70 -0
- app/code/community/Displaze/MySlideshow/Model/Resource/Slideshow/Collection.php +44 -0
- app/code/community/Displaze/MySlideshow/Model/Slideshow.php +120 -0
- app/code/community/Displaze/MySlideshow/controllers/Adminhtml/SlideshowController.php +213 -0
- app/code/community/Displaze/MySlideshow/etc/adminhtml.xml +38 -0
- app/code/community/Displaze/MySlideshow/etc/config.xml +105 -0
- app/code/community/Displaze/MySlideshow/sql/myslideshow_setup/install-1.7.0.php +76 -0
- app/design/adminhtml/default/default/layout/displaze/myslideshow.xml +49 -0
- app/design/frontend/default/default/layout/displaze/myslideshow.xml +38 -0
- app/design/frontend/default/default/template/displaze/myslideshow/slideshow.phtml +56 -0
- app/etc/modules/Displaze_MySlideshow.xml +31 -0
- package.xml +18 -0
- skin/frontend/default/default/displaze/css/protoshow.css +305 -0
- skin/frontend/default/default/displaze/css/reset.css +102 -0
- skin/frontend/default/default/displaze/css/site.css +8 -0
- skin/frontend/default/default/displaze/images/pix.gif +0 -0
- skin/frontend/default/default/displaze/images/proto_controls_bg.png +0 -0
- skin/frontend/default/default/displaze/images/timer +21 -0
- skin/frontend/default/default/displaze/js/protoshow.js +746 -0
app/code/community/Displaze/MySlideshow/Block/Adminhtml/Slideshow.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Slideshow.php
|
5 |
+
*
|
6 |
+
* Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
7 |
+
*
|
8 |
+
* This file is part of Displaze Web Services Inc..
|
9 |
+
*
|
10 |
+
* Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
11 |
+
* it under the terms of the GNU General Public License as published by
|
12 |
+
* the Free Software Foundation, either version 3 of the License, or
|
13 |
+
* (at your option) any later version.
|
14 |
+
*
|
15 |
+
* Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
16 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
+
* GNU General Public License for more details.
|
19 |
+
*
|
20 |
+
* You should have received a copy of the GNU General Public License
|
21 |
+
* along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Container for Grid.
|
26 |
+
*
|
27 |
+
* @package Displaze_MySlideshow
|
28 |
+
* @subpackage Slideshow
|
29 |
+
*/
|
30 |
+
class Displaze_MySlideshow_Block_Adminhtml_Slideshow extends Mage_Adminhtml_Block_Widget_Grid_Container
|
31 |
+
{
|
32 |
+
public function __construct()
|
33 |
+
{
|
34 |
+
$this->setId('myslideshow_slideshow_gridbox');
|
35 |
+
$this->_controller = 'adminhtml_slideshow';
|
36 |
+
$this->_blockGroup = 'myslideshow';
|
37 |
+
$this->_headerText = 'Slideshow Management';
|
38 |
+
$this->_addButtonLabel = 'Add Slide';
|
39 |
+
parent::__construct();
|
40 |
+
}
|
41 |
+
}
|
app/code/community/Displaze/MySlideshow/Block/Adminhtml/Slideshow/Edit.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Edit.php
|
5 |
+
*
|
6 |
+
* Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
7 |
+
*
|
8 |
+
* This file is part of Displaze Web Services Inc..
|
9 |
+
*
|
10 |
+
* Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
11 |
+
* it under the terms of the GNU General Public License as published by
|
12 |
+
* the Free Software Foundation, either version 3 of the License, or
|
13 |
+
* (at your option) any later version.
|
14 |
+
*
|
15 |
+
* Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
16 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
+
* GNU General Public License for more details.
|
19 |
+
*
|
20 |
+
* You should have received a copy of the GNU General Public License
|
21 |
+
* along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
22 |
+
*/
|
23 |
+
|
24 |
+
class Displaze_MySlideshow_Block_Adminhtml_Slideshow_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
25 |
+
{
|
26 |
+
|
27 |
+
public function __construct()
|
28 |
+
{
|
29 |
+
$this->_objectId = 'id';
|
30 |
+
$this->_blockGroup = 'myslideshow';
|
31 |
+
$this->_controller = 'adminhtml_slideshow';
|
32 |
+
|
33 |
+
parent::__construct();
|
34 |
+
|
35 |
+
if ($this->_isAllowedAction('save')) {
|
36 |
+
$this->_updateButton('save', 'label', Mage::helper('myslideshow')->__('Save Slide'));
|
37 |
+
$this->_addButton('saveandcontinue', array(
|
38 |
+
'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
|
39 |
+
'onclick' => 'saveAndContinueEdit(\''.$this->_getSaveAndContinueUrl().'\')',
|
40 |
+
'class' => 'save',
|
41 |
+
), -100);
|
42 |
+
} else {
|
43 |
+
$this->_removeButton('save');
|
44 |
+
}
|
45 |
+
|
46 |
+
if ($this->_isAllowedAction('delete')) {
|
47 |
+
$this->_updateButton('delete', 'label', Mage::helper('myslideshow')->__('Delete Slide'));
|
48 |
+
} else {
|
49 |
+
$this->_removeButton('delete');
|
50 |
+
}
|
51 |
+
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getHeaderText()
|
56 |
+
{
|
57 |
+
if( Mage::registry('myslideshow_data') && Mage::registry('myslideshow_data')->getId() ) {
|
58 |
+
return Mage::helper('myslideshow')->__("Edit Slide '%s'", $this->htmlEscape(Mage::registry('myslideshow_data')->getTitle()));
|
59 |
+
} else {
|
60 |
+
return Mage::helper('myslideshow')->__('Add New Slide');
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Check permission for passed action
|
66 |
+
*
|
67 |
+
* @param string $action
|
68 |
+
* @return bool
|
69 |
+
*/
|
70 |
+
protected function _isAllowedAction($action)
|
71 |
+
{
|
72 |
+
//return Mage::getSingleton('admin/session')->isAllowed('mylink/link/' . $action);
|
73 |
+
return true;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Getter of url for "Save and Continue" button
|
78 |
+
* tab_id will be replaced by desired by JS later
|
79 |
+
*
|
80 |
+
* @return string
|
81 |
+
*/
|
82 |
+
protected function _getSaveAndContinueUrl()
|
83 |
+
{
|
84 |
+
return $this->getUrl('*/*/save', array(
|
85 |
+
'_current' => true,
|
86 |
+
'back' => 'edit',
|
87 |
+
'active_tab' => '{{tab_id}}'
|
88 |
+
));
|
89 |
+
}
|
90 |
+
|
91 |
+
protected function _prepareLayout()
|
92 |
+
{
|
93 |
+
$tabsBlock = $this->getLayout()->getBlock('myslideshow_adminhtml_slideshow_edit_tabs');
|
94 |
+
if ($tabsBlock) {
|
95 |
+
$tabsBlockJsObject = $tabsBlock->getJsObjectName();
|
96 |
+
$tabsBlockPrefix = $tabsBlock->getId() . '_';
|
97 |
+
} else {
|
98 |
+
$tabsBlockJsObject = 'myslideshow_tabsJsTabs';
|
99 |
+
$tabsBlockPrefix = 'myslideshow_tabs_';
|
100 |
+
}
|
101 |
+
|
102 |
+
$this->_formScripts[] = "
|
103 |
+
function saveAndContinueEdit(urlTemplate) {
|
104 |
+
var tabsIdValue = " . $tabsBlockJsObject . ".activeTab.id;
|
105 |
+
var tabsBlockPrefix = '" . $tabsBlockPrefix . "';
|
106 |
+
if (tabsIdValue.startsWith(tabsBlockPrefix)) {
|
107 |
+
tabsIdValue = tabsIdValue.substr(tabsBlockPrefix.length)
|
108 |
+
}
|
109 |
+
var template = new Template(urlTemplate, /(^|.|\\r|\\n)({{(\w+)}})/);
|
110 |
+
var url = template.evaluate({tab_id:tabsIdValue});
|
111 |
+
editForm.submit(url);
|
112 |
+
}
|
113 |
+
";
|
114 |
+
return parent::_prepareLayout();
|
115 |
+
}
|
116 |
+
}
|
app/code/community/Displaze/MySlideshow/Block/Adminhtml/Slideshow/Edit/Form.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Form.php
|
4 |
+
*
|
5 |
+
* Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
6 |
+
*
|
7 |
+
* This file is part of Displaze Web Services Inc..
|
8 |
+
*
|
9 |
+
* Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
10 |
+
* it under the terms of the GNU General Public License as published by
|
11 |
+
* the Free Software Foundation, either version 3 of the License, or
|
12 |
+
* (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
21 |
+
*/
|
22 |
+
|
23 |
+
class Displaze_MySlideshow_Block_Adminhtml_Slideshow_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
24 |
+
{
|
25 |
+
|
26 |
+
protected function _prepareForm()
|
27 |
+
{
|
28 |
+
$form = new Varien_Data_Form(array(
|
29 |
+
'id' => 'edit_form',
|
30 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
31 |
+
'method' => 'post',
|
32 |
+
'enctype' => 'multipart/form-data'
|
33 |
+
));
|
34 |
+
|
35 |
+
$form->setUseContainer(true);
|
36 |
+
$this->setForm($form);
|
37 |
+
|
38 |
+
return parent::_prepareForm();
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
app/code/community/Displaze/MySlideshow/Block/Adminhtml/Slideshow/Edit/Tab/Main.php
ADDED
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Main.php
|
5 |
+
*
|
6 |
+
* Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
7 |
+
*
|
8 |
+
* This file is part of Displaze Web Services Inc..
|
9 |
+
*
|
10 |
+
* Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
11 |
+
* it under the terms of the GNU General Public License as published by
|
12 |
+
* the Free Software Foundation, either version 3 of the License, or
|
13 |
+
* (at your option) any later version.
|
14 |
+
*
|
15 |
+
* Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
16 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
+
* GNU General Public License for more details.
|
19 |
+
*
|
20 |
+
* You should have received a copy of the GNU General Public License
|
21 |
+
* along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
22 |
+
*/
|
23 |
+
|
24 |
+
class Displaze_MySlideshow_Block_Adminhtml_Slideshow_Edit_Tab_Main extends Mage_Adminhtml_Block_Widget_Form
|
25 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
26 |
+
{
|
27 |
+
|
28 |
+
protected function _prepareForm()
|
29 |
+
{
|
30 |
+
/* @var $model Displaze_MySlideshow_Slideshow */
|
31 |
+
$model = Mage::registry('myslideshow_slideshow');
|
32 |
+
|
33 |
+
/*
|
34 |
+
* Checking if user have permissions to save information
|
35 |
+
*/
|
36 |
+
if ($this->_isAllowedAction('save')) {
|
37 |
+
$isElementDisabled = false;
|
38 |
+
} else {
|
39 |
+
$isElementDisabled = true;
|
40 |
+
}
|
41 |
+
|
42 |
+
$form = new Varien_Data_Form();
|
43 |
+
|
44 |
+
$form->setHtmlIdPrefix('myslideshow_');
|
45 |
+
|
46 |
+
$fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('myslideshow')->__('Slideshow')));
|
47 |
+
|
48 |
+
if ($model->getId()) {
|
49 |
+
$fieldset->addField('id', 'hidden', array(
|
50 |
+
'name' => 'id',
|
51 |
+
));
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
$fieldset->addField('title', 'text', array(
|
56 |
+
'name' => 'title',
|
57 |
+
'label' => Mage::helper('myslideshow')->__('Title'),
|
58 |
+
'title' => Mage::helper('myslideshow')->__('Title'),
|
59 |
+
'required' => true,
|
60 |
+
'disabled' => $isElementDisabled
|
61 |
+
));
|
62 |
+
|
63 |
+
|
64 |
+
$fieldset->addField('image', 'file', array(
|
65 |
+
'label' => Mage::helper('myslideshow')->__('Image'),
|
66 |
+
'required' => false,
|
67 |
+
'name' => 'image',
|
68 |
+
'after_element_html' => $this->_getImage() != false ? $this->_getImage() : ''
|
69 |
+
));
|
70 |
+
|
71 |
+
/* $fieldset->addField('identifier', 'text', array(
|
72 |
+
'name' => 'identifier',
|
73 |
+
'label' => Mage::helper('mylink')->__('URL Key'),
|
74 |
+
'title' => Mage::helper('mylink')->__('URL Key'),
|
75 |
+
'required' => false,
|
76 |
+
'class' => 'validate-identifier',
|
77 |
+
'note' => Mage::helper('mylink')->__('Relative to Website Base URL'),
|
78 |
+
'disabled' => $isElementDisabled
|
79 |
+
));*/
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Check is single store mode
|
83 |
+
*/
|
84 |
+
/* if (!Mage::app()->isSingleStoreMode()) {
|
85 |
+
$fieldset->addField('store_id', 'multiselect', array(
|
86 |
+
'name' => 'stores[]',
|
87 |
+
'label' => Mage::helper('myslideshow')->__('Store View'),
|
88 |
+
'title' => Mage::helper('myslideshow')->__('Store View'),
|
89 |
+
'required' => true,
|
90 |
+
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
|
91 |
+
'disabled' => $isElementDisabled
|
92 |
+
));
|
93 |
+
}*/
|
94 |
+
/* else {
|
95 |
+
$fieldset->addField('store_id', 'hidden', array(
|
96 |
+
'name' => 'stores[]',
|
97 |
+
'value' => Mage::app()->getStore(true)->getId()
|
98 |
+
));
|
99 |
+
$model->setStoreId(Mage::app()->getStore(true)->getId());
|
100 |
+
}*/
|
101 |
+
|
102 |
+
$fieldset->addField('status', 'select', array(
|
103 |
+
'label' => Mage::helper('myslideshow')->__('Slide Status'),
|
104 |
+
'title' => Mage::helper('myslideshow')->__('Slide Status'),
|
105 |
+
'name' => 'status',
|
106 |
+
'required' => true,
|
107 |
+
'options' => array(
|
108 |
+
'1' => Mage::helper('myslideshow')->__('Enabled'),
|
109 |
+
'0' => Mage::helper('myslideshow')->__('Disabled'),
|
110 |
+
),
|
111 |
+
'disabled' => $isElementDisabled
|
112 |
+
));
|
113 |
+
|
114 |
+
if (!$model->getId()) {
|
115 |
+
$model->setData('status', $isElementDisabled ? '0' : '1');
|
116 |
+
}
|
117 |
+
|
118 |
+
// Mage::dispatchEvent('renegade_mylink_link_edit_tab_main_prepare_form', array('form' => $form));
|
119 |
+
|
120 |
+
$form->setValues($model->getData());
|
121 |
+
$this->setForm($form);
|
122 |
+
|
123 |
+
return parent::_prepareForm();
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* return image url if it exists
|
128 |
+
* @return boolean
|
129 |
+
*/
|
130 |
+
protected function _getImage()
|
131 |
+
{
|
132 |
+
$id = $this->getRequest()->getParam('id');
|
133 |
+
if($id) {
|
134 |
+
$slide = Mage::getModel('myslideshow/slideshow')->load($id);
|
135 |
+
$image = Mage::helper('myslideshow')->getSlideshowUrl() . $slide->getImage();
|
136 |
+
//return "<img src={$image} width='22' height='22' /><br /><input type='checkbox' id='delete-image' name='delete_image' /><label for='delete-image'> Delete Image</label>";
|
137 |
+
return "<img src={$image} width='22' height='22' />";
|
138 |
+
}
|
139 |
+
|
140 |
+
return false;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Prepare label for tab
|
145 |
+
*
|
146 |
+
* @return string
|
147 |
+
*/
|
148 |
+
public function getTabLabel()
|
149 |
+
{
|
150 |
+
return Mage::helper('myslideshow')->__('Slide Information');
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Prepare title for tab
|
155 |
+
*
|
156 |
+
* @return string
|
157 |
+
*/
|
158 |
+
public function getTabTitle()
|
159 |
+
{
|
160 |
+
return Mage::helper('myslideshow')->__('Slide Info');
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Returns status flag about this tab can be shown or not
|
165 |
+
*
|
166 |
+
* @return true
|
167 |
+
*/
|
168 |
+
public function canShowTab()
|
169 |
+
{
|
170 |
+
return true;
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Returns status flag about this tab hidden or not
|
175 |
+
*
|
176 |
+
* @return true
|
177 |
+
*/
|
178 |
+
public function isHidden()
|
179 |
+
{
|
180 |
+
return false;
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Check permission for passed action
|
185 |
+
*
|
186 |
+
* @param string $action
|
187 |
+
* @return bool
|
188 |
+
*/
|
189 |
+
protected function _isAllowedAction($action)
|
190 |
+
{
|
191 |
+
//return Mage::getSingleton('admin/session')->isAllowed('mylink/link/' . $action);
|
192 |
+
return true;
|
193 |
+
}
|
194 |
+
|
195 |
+
|
196 |
+
}
|
app/code/community/Displaze/MySlideshow/Block/Adminhtml/Slideshow/Edit/Tabs.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Tabs.php
|
5 |
+
*
|
6 |
+
* Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
7 |
+
*
|
8 |
+
* This file is part of Displaze Web Services Inc..
|
9 |
+
*
|
10 |
+
* Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
11 |
+
* it under the terms of the GNU General Public License as published by
|
12 |
+
* the Free Software Foundation, either version 3 of the License, or
|
13 |
+
* (at your option) any later version.
|
14 |
+
*
|
15 |
+
* Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
16 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
+
* GNU General Public License for more details.
|
19 |
+
*
|
20 |
+
* You should have received a copy of the GNU General Public License
|
21 |
+
* along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
22 |
+
*/
|
23 |
+
|
24 |
+
|
25 |
+
class Displaze_MySlideshow_Block_Adminhtml_Slideshow_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
26 |
+
{
|
27 |
+
public function __construct()
|
28 |
+
{
|
29 |
+
parent::__construct();
|
30 |
+
$this->setId('myslideshow_tabs');
|
31 |
+
$this->setDestElementId('edit_form');
|
32 |
+
$this->setTitle(Mage::helper('myslideshow')->__('Slide'));
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* if you would want to create the tabs using code uncomment the following, else
|
37 |
+
* it has to be created using xml file which is the proper and neat method of doing it
|
38 |
+
|
39 |
+
protected function _beforeToHtml()
|
40 |
+
{
|
41 |
+
$this->addTab('main_section', array(
|
42 |
+
'label' => Mage::helper('mylink')->__('Link Information'),
|
43 |
+
'title' => Mage::helper('mylink')->__('Link Information'),
|
44 |
+
'content' => $this->getLayout()->createBlock('mylink/adminhtml_link_edit_tab_main')->toHtml(),
|
45 |
+
));
|
46 |
+
|
47 |
+
$this->addTab('meta_section', array(
|
48 |
+
'label' => Mage::helper('mylink')->__('Meta Data'),
|
49 |
+
'title' => Mage::helper('mylink')->__('Meta Data'),
|
50 |
+
'content' => $this->getLayout()->createBlock('mylink/adminhtml_link_edit_tab_meta')->toHtml(),
|
51 |
+
));
|
52 |
+
|
53 |
+
parent::_beforeToHtml();
|
54 |
+
}*/
|
55 |
+
}
|
app/code/community/Displaze/MySlideshow/Block/Adminhtml/Slideshow/Grid.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Grid.php
|
5 |
+
*
|
6 |
+
* Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
7 |
+
*
|
8 |
+
* This file is part of Displaze Web Services Inc..
|
9 |
+
*
|
10 |
+
* Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
11 |
+
* it under the terms of the GNU General Public License as published by
|
12 |
+
* the Free Software Foundation, either version 3 of the License, or
|
13 |
+
* (at your option) any later version.
|
14 |
+
*
|
15 |
+
* Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
16 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
+
* GNU General Public License for more details.
|
19 |
+
*
|
20 |
+
* You should have received a copy of the GNU General Public License
|
21 |
+
* along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
22 |
+
*/
|
23 |
+
|
24 |
+
class Displaze_MySlideshow_Block_Adminhtml_Slideshow_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
25 |
+
{
|
26 |
+
|
27 |
+
public function __construct()
|
28 |
+
{
|
29 |
+
parent::__construct();
|
30 |
+
$this->setId('displazeSlideshowGrid');
|
31 |
+
$this->setDefaultSort('id');
|
32 |
+
$this->setDefaultDir('ASC');
|
33 |
+
}
|
34 |
+
|
35 |
+
protected function _prepareCollection()
|
36 |
+
{
|
37 |
+
$collection = Mage::getModel('myslideshow/slideshow')->getCollection();
|
38 |
+
|
39 |
+
$this->setCollection($collection);
|
40 |
+
|
41 |
+
return parent::_prepareCollection();
|
42 |
+
}
|
43 |
+
|
44 |
+
protected function _prepareColumns()
|
45 |
+
{
|
46 |
+
|
47 |
+
$this->addColumn('id', array(
|
48 |
+
'header' => Mage::helper('myslideshow')->__('ID'),
|
49 |
+
'align' => 'left',
|
50 |
+
'width' => '10px',
|
51 |
+
'index' => 'id',
|
52 |
+
));
|
53 |
+
|
54 |
+
$this->addColumn('image', array(
|
55 |
+
'header' => Mage::helper('myslideshow')->__('Slide'),
|
56 |
+
'align' => 'center',
|
57 |
+
'index' => 'image',
|
58 |
+
'width' => '100px',
|
59 |
+
'renderer' => 'myslideshow/adminhtml_slideshow_image_renderer'
|
60 |
+
));
|
61 |
+
|
62 |
+
$this->addColumn('title', array(
|
63 |
+
'header' => Mage::helper('myslideshow')->__('Title'),
|
64 |
+
'align' => 'left',
|
65 |
+
'index' => 'title',
|
66 |
+
));
|
67 |
+
|
68 |
+
$this->addColumn('status', array(
|
69 |
+
'header' => Mage::helper('myslideshow')->__('Status'),
|
70 |
+
'index' => 'status',
|
71 |
+
'type' => 'options',
|
72 |
+
'options' => Mage::getSingleton('myslideshow/slideshow')->getAvailableStatuses()
|
73 |
+
));
|
74 |
+
|
75 |
+
$this->addColumn('creation_time', array(
|
76 |
+
'header' => Mage::helper('myslideshow')->__('Date Created'),
|
77 |
+
'index' => 'creation_time',
|
78 |
+
'type' => 'datetime',
|
79 |
+
));
|
80 |
+
|
81 |
+
$this->addColumn('update_time', array(
|
82 |
+
'header' => Mage::helper('myslideshow')->__('Last Modified'),
|
83 |
+
'index' => 'update_time',
|
84 |
+
'type' => 'datetime',
|
85 |
+
));
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
return parent::_prepareColumns();
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Row click url
|
94 |
+
*
|
95 |
+
* @return string
|
96 |
+
*/
|
97 |
+
public function getRowUrl($row)
|
98 |
+
{
|
99 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
100 |
+
}
|
101 |
+
|
102 |
+
|
103 |
+
|
104 |
+
}
|
app/code/community/Displaze/MySlideshow/Block/Adminhtml/Slideshow/Image/Renderer.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Renderer.php
|
5 |
+
*
|
6 |
+
* Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
7 |
+
*
|
8 |
+
* This file is part of Displaze Web Services Inc..
|
9 |
+
*
|
10 |
+
* Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
11 |
+
* it under the terms of the GNU General Public License as published by
|
12 |
+
* the Free Software Foundation, either version 3 of the License, or
|
13 |
+
* (at your option) any later version.
|
14 |
+
*
|
15 |
+
* Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
16 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
+
* GNU General Public License for more details.
|
19 |
+
*
|
20 |
+
* You should have received a copy of the GNU General Public License
|
21 |
+
* along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
22 |
+
*/
|
23 |
+
|
24 |
+
class Displaze_MySlideshow_Block_Adminhtml_Slideshow_Image_Renderer extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
25 |
+
{
|
26 |
+
public function render(Varien_Object $row)
|
27 |
+
{
|
28 |
+
$src = Mage::helper('myslideshow')->getSlideshowUrl().$row->getData($this->getColumn()->getIndex());
|
29 |
+
return "<img src={$src} width='100' height='100' />";
|
30 |
+
}
|
31 |
+
}
|
app/code/community/Displaze/MySlideshow/Block/Slideshow.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Slideshow.php
|
5 |
+
*
|
6 |
+
* Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
7 |
+
*
|
8 |
+
* This file is part of Displaze Web Services Inc..
|
9 |
+
*
|
10 |
+
* Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
11 |
+
* it under the terms of the GNU General Public License as published by
|
12 |
+
* the Free Software Foundation, either version 3 of the License, or
|
13 |
+
* (at your option) any later version.
|
14 |
+
*
|
15 |
+
* Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
16 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
+
* GNU General Public License for more details.
|
19 |
+
*
|
20 |
+
* You should have received a copy of the GNU General Public License
|
21 |
+
* along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
22 |
+
*/
|
23 |
+
|
24 |
+
|
25 |
+
class Displaze_MySlideshow_Block_Slideshow extends Mage_Core_Block_Template
|
26 |
+
{
|
27 |
+
|
28 |
+
public function getSlideshow()
|
29 |
+
{
|
30 |
+
$slidehow = Mage::getModel('myslideshow/slideshow')
|
31 |
+
->getCollection();
|
32 |
+
|
33 |
+
return $slidehow;
|
34 |
+
}
|
35 |
+
}
|
app/code/community/Displaze/MySlideshow/Helper/Data.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Data.php
|
4 |
+
*
|
5 |
+
* Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
6 |
+
*
|
7 |
+
* This file is part of Displaze Web Services Inc..
|
8 |
+
*
|
9 |
+
* Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
10 |
+
* it under the terms of the GNU General Public License as published by
|
11 |
+
* the Free Software Foundation, either version 3 of the License, or
|
12 |
+
* (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
21 |
+
*/
|
22 |
+
|
23 |
+
class Displaze_MySlideshow_Helper_Data extends Mage_Core_Helper_Abstract
|
24 |
+
{
|
25 |
+
|
26 |
+
public function getSlideshowUrl()
|
27 |
+
{
|
28 |
+
return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'displaze/myslideshow/';
|
29 |
+
}
|
30 |
+
|
31 |
+
public function getSlideshowPath()
|
32 |
+
{
|
33 |
+
return Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . '/displaze/myslideshow/';
|
34 |
+
}
|
35 |
+
}
|
app/code/community/Displaze/MySlideshow/Model/Resource/Slideshow.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Slide.php
|
4 |
+
*
|
5 |
+
* Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
6 |
+
*
|
7 |
+
* This file is part of Displaze Web Services Inc..
|
8 |
+
*
|
9 |
+
* Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
10 |
+
* it under the terms of the GNU General Public License as published by
|
11 |
+
* the Free Software Foundation, either version 3 of the License, or
|
12 |
+
* (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
21 |
+
*/
|
22 |
+
|
23 |
+
class Displaze_MySlideshow_Model_Resource_Slideshow extends Mage_Core_Model_Resource_Db_Abstract
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Store model
|
27 |
+
*
|
28 |
+
* @var null|Mage_Core_Model_Store
|
29 |
+
*/
|
30 |
+
protected $_store = null;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Initialize resource model
|
34 |
+
*
|
35 |
+
*/
|
36 |
+
protected function _construct()
|
37 |
+
{
|
38 |
+
$this->_init('myslideshow/slideshow', 'id');
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Process page data before saving
|
43 |
+
*
|
44 |
+
* @param Mage_Core_Model_Abstract $object
|
45 |
+
* @return Displaze_MySlideshow_Model_Resource_Slideshow
|
46 |
+
*/
|
47 |
+
protected function _beforeSave(Mage_Core_Model_Abstract $object)
|
48 |
+
{
|
49 |
+
/*
|
50 |
+
* For two attributes which represent timestamp data in DB
|
51 |
+
* we should make converting such as:
|
52 |
+
* If they are empty we need to convert them into DB
|
53 |
+
* type NULL so in DB they will be empty and not some default value
|
54 |
+
*/
|
55 |
+
foreach (array('activation_time_from', 'activation_time_to') as $field) {
|
56 |
+
$value = !$object->getData($field) ? null : $object->getData($field);
|
57 |
+
$object->setData($field, $this->formatDate($value));
|
58 |
+
}
|
59 |
+
|
60 |
+
// modify create / update dates
|
61 |
+
if ($object->isObjectNew() && !$object->hasCreationTime()) {
|
62 |
+
$object->setCreationTime(Mage::getSingleton('core/date')->gmtDate());
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
$object->setUpdateTime(Mage::getSingleton('core/date')->gmtDate());
|
67 |
+
|
68 |
+
return parent::_beforeSave($object);
|
69 |
+
}
|
70 |
+
}
|
app/code/community/Displaze/MySlideshow/Model/Resource/Slideshow/Collection.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Collection.php
|
5 |
+
*
|
6 |
+
* Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
7 |
+
*
|
8 |
+
* This file is part of Displaze Web Services Inc..
|
9 |
+
*
|
10 |
+
* Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
11 |
+
* it under the terms of the GNU General Public License as published by
|
12 |
+
* the Free Software Foundation, either version 3 of the License, or
|
13 |
+
* (at your option) any later version.
|
14 |
+
*
|
15 |
+
* Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
16 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
+
* GNU General Public License for more details.
|
19 |
+
*
|
20 |
+
* You should have received a copy of the GNU General Public License
|
21 |
+
* along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
22 |
+
*/
|
23 |
+
|
24 |
+
class Displaze_MySlideshow_Model_Resource_Slideshow_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* Load data for preview flag
|
28 |
+
*
|
29 |
+
* @var bool
|
30 |
+
*/
|
31 |
+
protected $_previewFlag;
|
32 |
+
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Define resource model
|
36 |
+
*
|
37 |
+
*/
|
38 |
+
protected function _construct()
|
39 |
+
{
|
40 |
+
$this->_init('myslideshow/slideshow');
|
41 |
+
//$this->_map['fields']['page_id'] = 'main_table.page_id';
|
42 |
+
//$this->_map['fields']['store'] = 'store_table.store_id';
|
43 |
+
}
|
44 |
+
}
|
app/code/community/Displaze/MySlideshow/Model/Slideshow.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Slide.php
|
4 |
+
*
|
5 |
+
* Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
6 |
+
*
|
7 |
+
* This file is part of Displaze Web Services Inc..
|
8 |
+
*
|
9 |
+
* Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
10 |
+
* it under the terms of the GNU General Public License as published by
|
11 |
+
* the Free Software Foundation, either version 3 of the License, or
|
12 |
+
* (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
21 |
+
*/
|
22 |
+
|
23 |
+
class Displaze_MySlideshow_Model_Slideshow extends Mage_Core_Model_Abstract
|
24 |
+
{
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Slide's Statuses
|
28 |
+
*/
|
29 |
+
const STATUS_ENABLED = 1;
|
30 |
+
const STATUS_DISABLED = 0;
|
31 |
+
|
32 |
+
|
33 |
+
protected $_path = '';
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Initialize resource model
|
37 |
+
*
|
38 |
+
*/
|
39 |
+
protected function _construct()
|
40 |
+
{
|
41 |
+
$this->_init('myslideshow/slideshow');
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Save Slideshow image.
|
46 |
+
*/
|
47 |
+
public function saveImage()
|
48 |
+
{
|
49 |
+
if(isset($_FILES['image']['name']) && (file_exists($_FILES['image']['tmp_name']))) {
|
50 |
+
|
51 |
+
try {
|
52 |
+
|
53 |
+
$uploader = new Varien_File_Uploader('image');
|
54 |
+
$uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png', 'bmp'));
|
55 |
+
|
56 |
+
$uploader->setAllowRenameFiles(true);
|
57 |
+
//$path = Mage::getBaseDir('media') . DS ;// 'displaze' . DS . 'myslideshow' . DS;
|
58 |
+
$path = $this->_initFolderStructure();
|
59 |
+
|
60 |
+
$uploader->save($path, $_FILES['image']['name']);
|
61 |
+
|
62 |
+
$this->setData('image', $_FILES['image']['name']);
|
63 |
+
|
64 |
+
|
65 |
+
} catch(Exception $e) {
|
66 |
+
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
return $this;
|
71 |
+
}
|
72 |
+
|
73 |
+
protected function _initFolderStructure()
|
74 |
+
{
|
75 |
+
$path = Mage::getBaseDir('media') . DS . 'displaze' . DS;
|
76 |
+
if(!is_dir($path)) {
|
77 |
+
mkdir($path, 0755);
|
78 |
+
}
|
79 |
+
|
80 |
+
$path = $path . 'myslideshow' . DS;
|
81 |
+
if(!is_dir($path)) {
|
82 |
+
mkdir($path, 0755);
|
83 |
+
}
|
84 |
+
|
85 |
+
return $this->_path = $path;
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
public function save()
|
90 |
+
{
|
91 |
+
$deleteImage = Mage::app()->getRequest()->getPost('delete_image');
|
92 |
+
if($deleteImage) {
|
93 |
+
|
94 |
+
}
|
95 |
+
|
96 |
+
$this->saveImage();
|
97 |
+
parent::save();
|
98 |
+
|
99 |
+
return $this;
|
100 |
+
}
|
101 |
+
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Prepare slide's statuses.
|
105 |
+
* Available event myslideshow_slide_get_available_statuses to customize statuses.
|
106 |
+
*
|
107 |
+
* @return array
|
108 |
+
*/
|
109 |
+
public function getAvailableStatuses()
|
110 |
+
{
|
111 |
+
$statuses = new Varien_Object(array(
|
112 |
+
self::STATUS_ENABLED => Mage::helper('myslideshow')->__('Enabled'),
|
113 |
+
self::STATUS_DISABLED => Mage::helper('myslideshow')->__('Disabled'),
|
114 |
+
));
|
115 |
+
|
116 |
+
Mage::dispatchEvent('myslideshow_slide_get_available_statuses', array('statuses' => $statuses));
|
117 |
+
|
118 |
+
return $statuses->getData();
|
119 |
+
}
|
120 |
+
}
|
app/code/community/Displaze/MySlideshow/controllers/Adminhtml/SlideshowController.php
ADDED
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* SlideshowController.php
|
4 |
+
*
|
5 |
+
* Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
6 |
+
*
|
7 |
+
* This file is part of Displaze Web Services Inc..
|
8 |
+
*
|
9 |
+
* Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
10 |
+
* it under the terms of the GNU General Public License as published by
|
11 |
+
* the Free Software Foundation, either version 3 of the License, or
|
12 |
+
* (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
21 |
+
*/
|
22 |
+
class Displaze_MySlideshow_Adminhtml_SlideshowController extends Mage_Adminhtml_Controller_Action
|
23 |
+
{
|
24 |
+
protected function _construct()
|
25 |
+
{
|
26 |
+
$this->setUsedModuleName('Displaze_MySlideshow');
|
27 |
+
}
|
28 |
+
|
29 |
+
protected function _initAction()
|
30 |
+
{
|
31 |
+
$this->loadLayout()
|
32 |
+
->_setActiveMenu('displaze')
|
33 |
+
->_addBreadcrumb(Mage::helper('myslideshow')->__('Slideshow'), Mage::helper('myslideshow')->__('Slideshow'))
|
34 |
+
->_addBreadcrumb(Mage::helper('myslideshow')->__('Manage Slideshow'), Mage::helper('myslideshow')->__('Manage Slideshow'));
|
35 |
+
return $this;
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
public function indexAction()
|
40 |
+
{
|
41 |
+
$this->_initAction();
|
42 |
+
// $this->_addContent($this->getLayout()->createBlock('myslideshow/adminhtml_slideshow_grid'));
|
43 |
+
$this->renderLayout();
|
44 |
+
}
|
45 |
+
|
46 |
+
public function newAction()
|
47 |
+
{
|
48 |
+
$this->_forward('edit');
|
49 |
+
}
|
50 |
+
|
51 |
+
public function editAction()
|
52 |
+
{
|
53 |
+
$this->_title($this->__('Displaze Slideshow'))
|
54 |
+
->_title($this->__('Slideshow'))
|
55 |
+
->_title($this->__('Manage Slideshow'));
|
56 |
+
|
57 |
+
// 1. Get ID and create model
|
58 |
+
$id = $this->getRequest()->getParam('id');
|
59 |
+
$model = Mage::getModel('myslideshow/slideshow');
|
60 |
+
|
61 |
+
// 2. Initial checking
|
62 |
+
if ($id) {
|
63 |
+
$model->load($id);
|
64 |
+
if (! $model->getId()) {
|
65 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
66 |
+
Mage::helper('myslideshow')->__('This slide no longer exists.'));
|
67 |
+
$this->_redirect('*/*/');
|
68 |
+
return;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
$this->_title($model->getId() ? $model->getTitle() : $this->__('New Slide'));
|
73 |
+
|
74 |
+
// 3. Set entered data if was error when we do save
|
75 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
76 |
+
if (! empty($data)) {
|
77 |
+
$model->setData($data);
|
78 |
+
}
|
79 |
+
|
80 |
+
// 4. Register model to use later in blocks
|
81 |
+
Mage::register('myslideshow_slideshow', $model);
|
82 |
+
|
83 |
+
// 5. Build edit form
|
84 |
+
$this->_initAction()
|
85 |
+
->_addBreadcrumb(
|
86 |
+
$id ? Mage::helper('myslideshow')->__('Edit Slide')
|
87 |
+
: Mage::helper('myslideshow')->__('New Slide'),
|
88 |
+
$id ? Mage::helper('myslideshow')->__('Edit Slide')
|
89 |
+
: Mage::helper('myslideshow')->__('New Slide'));
|
90 |
+
|
91 |
+
$this->renderLayout();
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* save slideshow
|
96 |
+
*/
|
97 |
+
public function saveAction()
|
98 |
+
{
|
99 |
+
// check if data sent
|
100 |
+
if ($data = $this->getRequest()->getPost()) {
|
101 |
+
$data = $this->_filterPostData($data);
|
102 |
+
//init model and set data
|
103 |
+
$model = Mage::getModel('myslideshow/slideshow');
|
104 |
+
|
105 |
+
if ($id = $this->getRequest()->getParam('id')) {
|
106 |
+
$model->load($id);
|
107 |
+
}
|
108 |
+
|
109 |
+
$model->setData($data);
|
110 |
+
|
111 |
+
Mage::dispatchEvent('myslideshow_slideshow_prepare_save', array('slideshow' => $model, 'request' => $this->getRequest()));
|
112 |
+
|
113 |
+
//validating
|
114 |
+
//if (!$this->_validatePostData($data)) {
|
115 |
+
// $this->_redirect('*/*/edit', array('id' => $model->getId(), '_current' => true));
|
116 |
+
// return;
|
117 |
+
//}
|
118 |
+
|
119 |
+
// try to save it
|
120 |
+
try {
|
121 |
+
// save the data
|
122 |
+
$model->save();
|
123 |
+
|
124 |
+
// display success message
|
125 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
126 |
+
Mage::helper('myslideshow')->__('The slide has been saved.'));
|
127 |
+
// clear previously saved data from session
|
128 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
129 |
+
// check if 'Save and Continue'
|
130 |
+
if ($this->getRequest()->getParam('back')) {
|
131 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId(), '_current'=>true));
|
132 |
+
return;
|
133 |
+
}
|
134 |
+
// go to grid
|
135 |
+
$this->_redirect('*/*/');
|
136 |
+
return;
|
137 |
+
|
138 |
+
} catch (Mage_Core_Exception $e) {
|
139 |
+
$this->_getSession()->addError($e->getMessage());
|
140 |
+
}
|
141 |
+
catch (Exception $e) {
|
142 |
+
$this->_getSession()->addException($e,
|
143 |
+
Mage::helper('myslideshow')->__('An error occurred while saving the slide.'));
|
144 |
+
}
|
145 |
+
|
146 |
+
$this->_getSession()->setFormData($data);
|
147 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
148 |
+
return;
|
149 |
+
}
|
150 |
+
$this->_redirect('*/*/');
|
151 |
+
}
|
152 |
+
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Filtering posted data. Converting localized data if needed
|
156 |
+
*
|
157 |
+
* @param array
|
158 |
+
* @return array
|
159 |
+
*/
|
160 |
+
protected function _filterPostData($data)
|
161 |
+
{
|
162 |
+
$data = $this->_filterDates($data, array('activation_time_from', 'activation_time_to'));
|
163 |
+
return $data;
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Delete action
|
169 |
+
*/
|
170 |
+
public function deleteAction()
|
171 |
+
{
|
172 |
+
// check if we know what should be deleted
|
173 |
+
if ($id = $this->getRequest()->getParam('id')) {
|
174 |
+
$title = "";
|
175 |
+
try {
|
176 |
+
// init model and delete
|
177 |
+
$model = Mage::getModel('myslideshow/slideshow');
|
178 |
+
$model->load($id);
|
179 |
+
$title = $model->getTitle();
|
180 |
+
$image = $model->getImage();
|
181 |
+
$this->_deleteImage($image);
|
182 |
+
$model->delete();
|
183 |
+
|
184 |
+
// display success message
|
185 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
186 |
+
Mage::helper('myslideshow')->__('The slide has been deleted.'));
|
187 |
+
// go to grid
|
188 |
+
Mage::dispatchEvent('displaze_adminhtml_slide_on_delete', array('title' => $title, 'status' => 'success'));
|
189 |
+
$this->_redirect('*/*/');
|
190 |
+
return;
|
191 |
+
|
192 |
+
} catch (Exception $e) {
|
193 |
+
Mage::dispatchEvent('displaze_adminhtml_slide_on_delete', array('title' => $title, 'status' => 'fail'));
|
194 |
+
// display error message
|
195 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
196 |
+
// go back to edit form
|
197 |
+
$this->_redirect('*/*/edit', array('id' => $id));
|
198 |
+
return;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
// display error message
|
202 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('myslideshow')->__('Unable to find a slide to delete.'));
|
203 |
+
// go to grid
|
204 |
+
$this->_redirect('*/*/');
|
205 |
+
}
|
206 |
+
|
207 |
+
protected function _deleteImage($image)
|
208 |
+
{
|
209 |
+
$filename = Mage::helper('myslideshow')->getSlideshowPath() . $image;
|
210 |
+
$file = new Varien_Io_File();
|
211 |
+
$file->rm($filename);
|
212 |
+
}
|
213 |
+
}
|
app/code/community/Displaze/MySlideshow/etc/adminhtml.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
adminhtml.xml
|
4 |
+
|
5 |
+
Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
6 |
+
|
7 |
+
This file is part of Displaze Web Services Inc..
|
8 |
+
|
9 |
+
Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
10 |
+
it under the terms of the GNU General Public License as published by
|
11 |
+
the Free Software Foundation, either version 3 of the License, or
|
12 |
+
(at your option) any later version.
|
13 |
+
|
14 |
+
Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
15 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
GNU General Public License for more details.
|
18 |
+
|
19 |
+
You should have received a copy of the GNU General Public License
|
20 |
+
along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
21 |
+
-->
|
22 |
+
|
23 |
+
<adminhtml>
|
24 |
+
<menu>
|
25 |
+
<displaze module="myslideshow">
|
26 |
+
<title>Displaze</title>
|
27 |
+
<sort_order>39</sort_order>
|
28 |
+
<children>
|
29 |
+
<slideshow module="myslideshow">
|
30 |
+
<title>My Slideshow</title>
|
31 |
+
<sort_order>2</sort_order>
|
32 |
+
<action>/slideshow/index</action>
|
33 |
+
</slideshow>
|
34 |
+
</children>
|
35 |
+
</displaze>
|
36 |
+
</menu>
|
37 |
+
|
38 |
+
</adminhtml>
|
app/code/community/Displaze/MySlideshow/etc/config.xml
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
config.xml
|
4 |
+
|
5 |
+
Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
6 |
+
|
7 |
+
This file is part of Displaze Web Services Inc..
|
8 |
+
|
9 |
+
Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
10 |
+
it under the terms of the GNU General Public License as published by
|
11 |
+
the Free Software Foundation, either version 3 of the License, or
|
12 |
+
(at your option) any later version.
|
13 |
+
|
14 |
+
Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
15 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
GNU General Public License for more details.
|
18 |
+
|
19 |
+
You should have received a copy of the GNU General Public License
|
20 |
+
along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
21 |
+
-->
|
22 |
+
|
23 |
+
|
24 |
+
<config>
|
25 |
+
<modules>
|
26 |
+
<Displaze_MySlideshow>
|
27 |
+
<version>1.7.0</version>
|
28 |
+
</Displaze_MySlideshow>
|
29 |
+
</modules>
|
30 |
+
|
31 |
+
|
32 |
+
<global>
|
33 |
+
|
34 |
+
<helpers>
|
35 |
+
<myslideshow>
|
36 |
+
<class>Displaze_MySlideshow_Helper</class>
|
37 |
+
</myslideshow>
|
38 |
+
</helpers>
|
39 |
+
|
40 |
+
<!-- Global Blocks definition -->
|
41 |
+
<blocks>
|
42 |
+
<myslideshow>
|
43 |
+
<class>Displaze_MySlideshow_Block</class>
|
44 |
+
</myslideshow>
|
45 |
+
</blocks>
|
46 |
+
|
47 |
+
<!--Global Models Definition -->
|
48 |
+
<models>
|
49 |
+
<myslideshow>
|
50 |
+
<class>Displaze_MySlideshow_Model</class>
|
51 |
+
<resourceModel>myslideshow_resource</resourceModel>
|
52 |
+
</myslideshow>
|
53 |
+
<myslideshow_resource>
|
54 |
+
<class>Displaze_MySlideshow_Model_Resource</class>
|
55 |
+
<entities>
|
56 |
+
<slideshow>
|
57 |
+
<table>displaze_my_slideshow</table>
|
58 |
+
</slideshow>
|
59 |
+
</entities>
|
60 |
+
</myslideshow_resource>
|
61 |
+
</models>
|
62 |
+
|
63 |
+
<resources>
|
64 |
+
<myslideshow_setup>
|
65 |
+
<setup>
|
66 |
+
<module>Displaze_MySlideshow</module>
|
67 |
+
</setup>
|
68 |
+
</myslideshow_setup>
|
69 |
+
</resources>
|
70 |
+
|
71 |
+
</global>
|
72 |
+
|
73 |
+
<!--Admin Configuration -->
|
74 |
+
<admin>
|
75 |
+
<routers>
|
76 |
+
<adminhtml>
|
77 |
+
<args>
|
78 |
+
<modules>
|
79 |
+
<Displaze_MySlideshow before="Mage_Adminhtml">Displaze_MySlideshow_Adminhtml</Displaze_MySlideshow>
|
80 |
+
</modules>
|
81 |
+
</args>
|
82 |
+
</adminhtml>
|
83 |
+
</routers>
|
84 |
+
</admin>
|
85 |
+
|
86 |
+
<adminhtml>
|
87 |
+
<layout>
|
88 |
+
<updates>
|
89 |
+
<myslideshow>
|
90 |
+
<file>displaze/myslideshow.xml</file>
|
91 |
+
</myslideshow>
|
92 |
+
</updates>
|
93 |
+
</layout>
|
94 |
+
</adminhtml>
|
95 |
+
|
96 |
+
<frontend>
|
97 |
+
<layout>
|
98 |
+
<updates>
|
99 |
+
<myslideshow>
|
100 |
+
<file>displaze/myslideshow.xml</file>
|
101 |
+
</myslideshow>
|
102 |
+
</updates>
|
103 |
+
</layout>
|
104 |
+
</frontend>
|
105 |
+
</config>
|
app/code/community/Displaze/MySlideshow/sql/myslideshow_setup/install-1.7.0.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* install-1.7.0.php
|
4 |
+
*
|
5 |
+
* Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
6 |
+
*
|
7 |
+
* This file is part of Displaze Web Services Inc..
|
8 |
+
*
|
9 |
+
* Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
10 |
+
* it under the terms of the GNU General Public License as published by
|
11 |
+
* the Free Software Foundation, either version 3 of the License, or
|
12 |
+
* (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
21 |
+
*/
|
22 |
+
|
23 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
24 |
+
$installer = $this;
|
25 |
+
|
26 |
+
$installer->startSetup();
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Create table 'myslideshow/slideshow'
|
30 |
+
*/
|
31 |
+
$table = $installer->getConnection()
|
32 |
+
->newTable($installer->getTable('myslideshow/slideshow'))
|
33 |
+
|
34 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
35 |
+
'identity' => true,
|
36 |
+
'nullable' => false,
|
37 |
+
'primary' => true,
|
38 |
+
), 'Slide ID')
|
39 |
+
|
40 |
+
->addColumn('title', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
41 |
+
'nullable' => false,
|
42 |
+
), 'Slide Title')
|
43 |
+
|
44 |
+
->addColumn('image', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
45 |
+
'nullable' => false,
|
46 |
+
), 'Slide Image')
|
47 |
+
|
48 |
+
->addColumn('status', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
49 |
+
'nullable' => false,
|
50 |
+
'default' => '1',
|
51 |
+
), 'Slide Status')
|
52 |
+
|
53 |
+
->addColumn('creation_time', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
54 |
+
), 'Slide Creation Time')
|
55 |
+
|
56 |
+
->addColumn('update_time', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
57 |
+
), 'Slide Modification Time')
|
58 |
+
|
59 |
+
->addColumn('activation_time_from', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
60 |
+
), 'Slide Activation Time From')
|
61 |
+
|
62 |
+
->addColumn('activation_time_to', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
63 |
+
), 'Slide Activation Time To')
|
64 |
+
|
65 |
+
->addColumn('status', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
66 |
+
'nullable' => false,
|
67 |
+
'default' => '1',
|
68 |
+
), 'Slide Status ')
|
69 |
+
|
70 |
+
->setComment('Displaze MySlideshow Table');
|
71 |
+
|
72 |
+
$installer->getConnection()->createTable($table);
|
73 |
+
|
74 |
+
$installer->endSetup();
|
75 |
+
|
76 |
+
|
app/design/adminhtml/default/default/layout/displaze/myslideshow.xml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
myslideshow.xml
|
4 |
+
|
5 |
+
Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
6 |
+
|
7 |
+
This file is part of Displaze Web Services Inc..
|
8 |
+
|
9 |
+
Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
10 |
+
it under the terms of the GNU General Public License as published by
|
11 |
+
the Free Software Foundation, either version 3 of the License, or
|
12 |
+
(at your option) any later version.
|
13 |
+
|
14 |
+
Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
15 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
GNU General Public License for more details.
|
18 |
+
|
19 |
+
You should have received a copy of the GNU General Public License
|
20 |
+
along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
21 |
+
-->
|
22 |
+
|
23 |
+
|
24 |
+
<layout version="1.0">
|
25 |
+
|
26 |
+
<adminhtml_slideshow_index>
|
27 |
+
<reference name="content">
|
28 |
+
<block type="myslideshow/adminhtml_slideshow" name="slideshow.grid" />
|
29 |
+
</reference>
|
30 |
+
</adminhtml_slideshow_index>
|
31 |
+
|
32 |
+
<!--Edit Area -->
|
33 |
+
<adminhtml_slideshow_edit>
|
34 |
+
|
35 |
+
<reference name="content">
|
36 |
+
<block type="myslideshow/adminhtml_slideshow_edit" name="displaze.slideshow.edit"></block>
|
37 |
+
</reference>
|
38 |
+
|
39 |
+
<reference name="left">
|
40 |
+
<block type="myslideshow/adminhtml_slideshow_edit_tabs" name="myslideshow_slideshow_edit_tabs">
|
41 |
+
<block type="myslideshow/adminhtml_slideshow_edit_tab_main" name="myslideshow_slideshow_edit_tab_main" />
|
42 |
+
<action method="addTab"><name>main_section</name><block>myslideshow_slideshow_edit_tab_main</block></action>
|
43 |
+
</block>
|
44 |
+
</reference>
|
45 |
+
|
46 |
+
</adminhtml_slideshow_edit>
|
47 |
+
|
48 |
+
</layout>
|
49 |
+
|
app/design/frontend/default/default/layout/displaze/myslideshow.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
myslideshow.xml
|
4 |
+
|
5 |
+
Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
6 |
+
|
7 |
+
This file is part of Displaze Web Services Inc..
|
8 |
+
|
9 |
+
Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
10 |
+
it under the terms of the GNU General Public License as published by
|
11 |
+
the Free Software Foundation, either version 3 of the License, or
|
12 |
+
(at your option) any later version.
|
13 |
+
|
14 |
+
Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
15 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
GNU General Public License for more details.
|
18 |
+
|
19 |
+
You should have received a copy of the GNU General Public License
|
20 |
+
along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
21 |
+
-->
|
22 |
+
|
23 |
+
<layout version="0.1.0">
|
24 |
+
<!--
|
25 |
+
Default layout, loads most of the links/pages
|
26 |
+
-->
|
27 |
+
|
28 |
+
<default>
|
29 |
+
|
30 |
+
<reference name="head">
|
31 |
+
<action method="addJs"><name>scriptaculous/scriptaculous.js</name></action>
|
32 |
+
<action method="addItem"><type>skin_js</type><name>displaze/js/protoshow.js</name></action>
|
33 |
+
<action method="addItem"><type>skin_css</type><name>displaze/css/protoshow.css</name></action>
|
34 |
+
</reference>
|
35 |
+
|
36 |
+
</default>
|
37 |
+
|
38 |
+
</layout>
|
app/design/frontend/default/default/template/displaze/myslideshow/slideshow.phtml
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Slideshow.php
|
4 |
+
*
|
5 |
+
* Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
6 |
+
*
|
7 |
+
* This file is part of Displaze Web Services Inc..
|
8 |
+
*
|
9 |
+
* Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
10 |
+
* it under the terms of the GNU General Public License as published by
|
11 |
+
* the Free Software Foundation, either version 3 of the License, or
|
12 |
+
* (at your option) any later version.
|
13 |
+
*
|
14 |
+
* Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
21 |
+
*/
|
22 |
+
|
23 |
+
$_slideshow = $this->getSlideshow();
|
24 |
+
?>
|
25 |
+
<div id="myslideshow" class="protoshow">
|
26 |
+
<ul class="show">
|
27 |
+
<?php foreach ($_slideshow as $_slide): ?>
|
28 |
+
<li class="slide" data-slide-interval="">
|
29 |
+
<img src="<?php echo Mage::helper('myslideshow')->getSlideshowUrl() . $_slide->getImage() ?>" alt="<?php echo $_slide->getTitle() ?>" />
|
30 |
+
</li>
|
31 |
+
<?php endforeach; ?>
|
32 |
+
</ul>
|
33 |
+
</div>
|
34 |
+
|
35 |
+
<script type="text/javascript">
|
36 |
+
|
37 |
+
|
38 |
+
Event.observe(window, "load", function() {
|
39 |
+
|
40 |
+
$('myslideshow') && $('myslideshow').protoShow({
|
41 |
+
interval : 2000,
|
42 |
+
captions : true,
|
43 |
+
transitionType : 'fade',
|
44 |
+
autoPlay : true,
|
45 |
+
stopText : 'Pause',
|
46 |
+
playText : 'Play',
|
47 |
+
nextText : 'Next',
|
48 |
+
previousText : 'Previous',
|
49 |
+
keyboardControls: false
|
50 |
+
/*controls : true*/
|
51 |
+
});
|
52 |
+
|
53 |
+
|
54 |
+
|
55 |
+
});
|
56 |
+
</script>
|
app/etc/modules/Displaze_MySlideshow.xml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
Displaze_Slideshow.xml
|
4 |
+
|
5 |
+
Copyright (c) 2012 Aftab Naveed <aftabnaveed@gmail.com>.
|
6 |
+
|
7 |
+
This file is part of Displaze Web Services Inc..
|
8 |
+
|
9 |
+
Displaze Web Services Inc. is free software: you can redistribute it and/or modify
|
10 |
+
it under the terms of the GNU General Public License as published by
|
11 |
+
the Free Software Foundation, either version 3 of the License, or
|
12 |
+
(at your option) any later version.
|
13 |
+
|
14 |
+
Displaze Web Services Inc. is distributed in the hope that it will be useful,
|
15 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
GNU General Public License for more details.
|
18 |
+
|
19 |
+
You should have received a copy of the GNU General Public License
|
20 |
+
along with Displaze Web Services Inc.. If not, see <http ://www.gnu.org/licenses/>.
|
21 |
+
-->
|
22 |
+
|
23 |
+
|
24 |
+
<config>
|
25 |
+
<modules>
|
26 |
+
<Displaze_MySlideshow>
|
27 |
+
<active>true</active>
|
28 |
+
<codePool>community</codePool>
|
29 |
+
</Displaze_MySlideshow>
|
30 |
+
</modules>
|
31 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Displaze_Slideshow</name>
|
4 |
+
<version>1.7.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GNU v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Protoshow Slideshow extension</summary>
|
10 |
+
<description>Displaze_Slideshow is an extension based on protoshow, which avoids adding any 3rd party javascript libraries.</description>
|
11 |
+
<notes>First Stable Release</notes>
|
12 |
+
<authors><author><name>Aftab Naveed</name><user>aftabnaveed</user><email>aftabnaveed@gmail.com</email></author></authors>
|
13 |
+
<date>2012-07-08</date>
|
14 |
+
<time>15:48:25</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Displaze"><dir name="MySlideshow"><dir name="Block"><dir name="Adminhtml"><dir name="Slideshow"><dir name="Edit"><file name="Form.php" hash="2492607f1b201e748b463862e5d607cc"/><dir name="Tab"><file name="Main.php" hash="632e06a2cd1aa953387425b12e836c7e"/></dir><file name="Tabs.php" hash="d529092c8da880e01c87ea39705d2965"/></dir><file name="Edit.php" hash="ac34eebe93d3b86f65601ee17887389c"/><file name="Grid.php" hash="4db1fa6f5e1c471d428ac72c27954623"/><dir name="Image"><file name="Renderer.php" hash="81c12dbaa69e26993ef4b1c9fee51402"/></dir></dir><file name="Slideshow.php" hash="d17c24414711565bed2ba45415ac3af5"/></dir><file name="Slideshow.php" hash="5c28e1214d5ec50052464b3c4b6de77e"/></dir><dir name="Helper"><file name="Data.php" hash="ff6ffc9874add69669a08623a024db3c"/></dir><dir name="Model"><dir name="Resource"><dir name="Slideshow"><file name="Collection.php" hash="6f7ea8a779482c27989b18b432a4e42c"/></dir><file name="Slideshow.php" hash="6480d2855546eafa66de86fafce09d62"/></dir><file name="Slideshow.php" hash="49abaf41a0d9b7e56e0237b05c573b76"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SlideshowController.php" hash="f3b196ac354586d5dd5d4ccbbe2f8eeb"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="efb4b3c687005b0e77f47bdb1d39931c"/><file name="config.xml" hash="1fbacd75da34e6365e204d3a62c7d3c5"/></dir><dir name="sql"><dir name="myslideshow_setup"><file name="install-1.7.0.php" hash="0be91373724d8814274b41fae3eb3f1c"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="displaze"><file name="myslideshow.xml" hash="957740ec7eb5641fa1ac4fdcc0611c90"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="displaze"><dir name="myslideshow"><file name="slideshow.phtml" hash="8fceccd83daf44715237af381c7b6353"/></dir></dir></dir><dir name="layout"><dir name="displaze"><file name="myslideshow.xml" hash="004955f6f855aece5664d4a38aea59e4"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Displaze_MySlideshow.xml" hash="32a04b313f33cbb7f98ca1c1a197cf34"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="displaze"><dir name="css"><file name="protoshow.css" hash="dc66a079b313a3d0337054b8596b6a05"/><file name="reset.css" hash="6d14fba47843fe2375aeeb7e5d9cf783"/><file name="site.css" hash="49d2f0bcd5a7fc47499b7e5b0f378d05"/></dir><dir name="images"><file name="pix.gif" hash="7ad866406509775de63f33224decc101"/><file name="proto_controls_bg.png" hash="617e2194cfc44442c2fefabc6efe5399"/><file name="timer" hash="37a562b0dc3cabd93bcc853ed6c06ead"/></dir><dir name="js"><file name="protoshow.js" hash="b07891f0413bbda78686c96d861abe8d"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/frontend/default/default/displaze/css/protoshow.css
ADDED
@@ -0,0 +1,305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* ####################################### */
|
2 |
+
/* ########### STANDARD SETUP ############ */
|
3 |
+
/* ####################################### */
|
4 |
+
|
5 |
+
.protoshow,
|
6 |
+
.protoshow .show {
|
7 |
+
position: relative;
|
8 |
+
margin: 0;
|
9 |
+
padding: 0;
|
10 |
+
list-style: none;
|
11 |
+
width: 900px;
|
12 |
+
height: 300px;
|
13 |
+
}
|
14 |
+
|
15 |
+
.slide {
|
16 |
+
position: absolute;
|
17 |
+
top: 0;
|
18 |
+
left: 0;
|
19 |
+
z-index: 90;
|
20 |
+
height: 100%;
|
21 |
+
}
|
22 |
+
|
23 |
+
.active-slide {
|
24 |
+
z-index: 100;
|
25 |
+
}
|
26 |
+
|
27 |
+
.protoshow .slide-caption {
|
28 |
+
position: absolute;
|
29 |
+
left: 0;
|
30 |
+
bottom: 0;
|
31 |
+
right: 0;
|
32 |
+
z-index: 100;
|
33 |
+
padding: 1em 10px;
|
34 |
+
background-color: #000;
|
35 |
+
background-color: rgba(0,0,0,.4);
|
36 |
+
color:#fff;
|
37 |
+
}
|
38 |
+
|
39 |
+
.proto-progress-timer {
|
40 |
+
position: absolute;
|
41 |
+
top: 7px;
|
42 |
+
right: 7px;
|
43 |
+
z-index: 9999;
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
/* TRANSITION SLIDE
|
48 |
+
------------------------------------------------*/
|
49 |
+
|
50 |
+
.transition-slide .show-window {
|
51 |
+
overflow: hidden;
|
52 |
+
position: relative;
|
53 |
+
}
|
54 |
+
|
55 |
+
.transition-slide .show {
|
56 |
+
position: absolute;
|
57 |
+
top: 0;
|
58 |
+
left: 0;
|
59 |
+
width: 999999px;
|
60 |
+
}
|
61 |
+
|
62 |
+
.transition-slide .slide {
|
63 |
+
position: static; /*overide*/
|
64 |
+
float: left;
|
65 |
+
display: block;
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
/* PROTO CONTROLS
|
70 |
+
------------------------------------------------*/
|
71 |
+
|
72 |
+
.proto-controls,
|
73 |
+
.proto-navigation {
|
74 |
+
margin: 0;
|
75 |
+
padding: 0;
|
76 |
+
list-style: none;
|
77 |
+
}
|
78 |
+
|
79 |
+
.proto-controls a:link,
|
80 |
+
.proto-controls a:visited,
|
81 |
+
.proto-navigation a:link,
|
82 |
+
.proto-navigation a:visited {
|
83 |
+
display: block;
|
84 |
+
text-indent: -9999px;
|
85 |
+
overflow: hidden;
|
86 |
+
}
|
87 |
+
|
88 |
+
.proto-controls li {
|
89 |
+
position: absolute;
|
90 |
+
top: 50%;
|
91 |
+
margin-top: -36px;
|
92 |
+
left: 10px;
|
93 |
+
width: 10%;
|
94 |
+
height: 100%;
|
95 |
+
z-index: 110;
|
96 |
+
}
|
97 |
+
|
98 |
+
.proto-controls .forward {
|
99 |
+
right: 10px;
|
100 |
+
left: auto;
|
101 |
+
}
|
102 |
+
|
103 |
+
.proto-controls a {
|
104 |
+
width: 100%;
|
105 |
+
height: 61px;
|
106 |
+
background: url(../images/proto_controls_bg.png) no-repeat 0 0;
|
107 |
+
opacity: 0.2;
|
108 |
+
-moz-opacity: 0.2;
|
109 |
+
filter:alpha(opacity=20);
|
110 |
+
}
|
111 |
+
|
112 |
+
.proto-controls a:hover,
|
113 |
+
.proto-controls a:focus {
|
114 |
+
opacity: 1;
|
115 |
+
-moz-opacity: 1;
|
116 |
+
filter:alpha(opacity=100);
|
117 |
+
}
|
118 |
+
|
119 |
+
.proto-controls .forward a {
|
120 |
+
background-position: 100% -90px;
|
121 |
+
}
|
122 |
+
|
123 |
+
|
124 |
+
/* PROTO NAVIGATION
|
125 |
+
------------------------------------------------*/
|
126 |
+
|
127 |
+
.proto-navigation {
|
128 |
+
position: absolute;
|
129 |
+
top: 0;
|
130 |
+
right: 50%;
|
131 |
+
float: right;
|
132 |
+
z-index: 120;
|
133 |
+
}
|
134 |
+
|
135 |
+
.proto-navigation li {
|
136 |
+
float: left;
|
137 |
+
left: 50%;
|
138 |
+
padding: 12px 6px;
|
139 |
+
position: relative;
|
140 |
+
|
141 |
+
}
|
142 |
+
|
143 |
+
.proto-navigation a {
|
144 |
+
background-color: #fff;
|
145 |
+
background-color: rgba(0,0,0,.2);
|
146 |
+
height: 8px;
|
147 |
+
text-decoration: none;
|
148 |
+
width: 8px;
|
149 |
+
-moz-border-radius:30px;
|
150 |
+
-webkit-border-radius:30px;
|
151 |
+
border-radius:30px;
|
152 |
+
-moz-box-shadow: inset 0 1px 0 1px rgba(0,0,0,.1);
|
153 |
+
-webkit-box-shadow: inset 0 1px 0 1px rgba(0,0,0,.1);
|
154 |
+
box-shadow: inset 0 1px 0 1px rgba(0,0,0,.1);
|
155 |
+
}
|
156 |
+
|
157 |
+
.proto-navigation a:hover,
|
158 |
+
.proto-navigation a:focus {
|
159 |
+
background-color: #999;
|
160 |
+
}
|
161 |
+
|
162 |
+
.proto-navigation .current-slide a {
|
163 |
+
background-color: #363F4E;
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
|
168 |
+
|
169 |
+
|
170 |
+
|
171 |
+
|
172 |
+
|
173 |
+
|
174 |
+
|
175 |
+
|
176 |
+
|
177 |
+
|
178 |
+
|
179 |
+
|
180 |
+
|
181 |
+
/*
|
182 |
+
.proto-navigation {
|
183 |
+
margin: 0;
|
184 |
+
padding: 0;
|
185 |
+
list-style: none;
|
186 |
+
position: absolute;
|
187 |
+
right: 5px;
|
188 |
+
bottom: -25px;
|
189 |
+
z-index: 200;
|
190 |
+
}
|
191 |
+
|
192 |
+
.proto-navigation li {
|
193 |
+
float: left;
|
194 |
+
margin-right: 10px;
|
195 |
+
}
|
196 |
+
|
197 |
+
.proto-navigation li a:link,
|
198 |
+
.proto-navigation li a:visited {
|
199 |
+
display: block;
|
200 |
+
width: 8px;
|
201 |
+
height: 8px;
|
202 |
+
text-decoration: none;
|
203 |
+
background-color: rgba(255,255,255,0.5);
|
204 |
+
border: 1px solid #090809;
|
205 |
+
color: #666;
|
206 |
+
text-indent: -9999px;
|
207 |
+
overflow: hidden;
|
208 |
+
-moz-border-radius: 30px;
|
209 |
+
-webkit-border-radius: 30px;
|
210 |
+
border-radius: 30px;
|
211 |
+
}
|
212 |
+
|
213 |
+
.proto-navigation li a:hover,
|
214 |
+
.proto-navigation li a:focus {
|
215 |
+
background-color: #fff;
|
216 |
+
border-color: #000;
|
217 |
+
}
|
218 |
+
|
219 |
+
|
220 |
+
.proto-navigation li.current-slide a:link,
|
221 |
+
.proto-navigation li.current-slide a:visited {
|
222 |
+
background-color: rgba(30,30,30,0.9);
|
223 |
+
|
224 |
+
}
|
225 |
+
|
226 |
+
|
227 |
+
|
228 |
+
|
229 |
+
|
230 |
+
|
231 |
+
.proto-controls {
|
232 |
+
margin: 0;
|
233 |
+
padding: 0;
|
234 |
+
list-style: none;
|
235 |
+
|
236 |
+
}
|
237 |
+
|
238 |
+
.proto-controls .forward,
|
239 |
+
.proto-controls .backward,
|
240 |
+
.proto-controls .start-stop {
|
241 |
+
z-index: 200;
|
242 |
+
float: left;
|
243 |
+
margin: 10px 10px 0 0;
|
244 |
+
}
|
245 |
+
|
246 |
+
.proto-controls .start-stop {
|
247 |
+
margin-top: 10px;
|
248 |
+
|
249 |
+
}
|
250 |
+
|
251 |
+
|
252 |
+
|
253 |
+
|
254 |
+
|
255 |
+
.proto-controls a:link,
|
256 |
+
.proto-controls a:visited {
|
257 |
+
display: inline-block;
|
258 |
+
background-color: #090809;
|
259 |
+
background-image: -moz-linear-gradient(
|
260 |
+
center top,
|
261 |
+
rgb(123,125,130) 2%,
|
262 |
+
rgb(75,80,88) 3%,
|
263 |
+
rgb(42,45,50) 100%
|
264 |
+
);
|
265 |
+
color: #fff;
|
266 |
+
padding: 5px 10px;
|
267 |
+
border: 1px solid #090809;
|
268 |
+
-moz-border-radius: 20px;
|
269 |
+
-webkit-border-radius: 20px;
|
270 |
+
border-radius: 20px;
|
271 |
+
text-decoration: none;
|
272 |
+
text-align: center;
|
273 |
+
width: 60px;
|
274 |
+
}
|
275 |
+
|
276 |
+
.proto-controls a:hover,
|
277 |
+
.proto-controls a:focus {
|
278 |
+
background-image: -moz-linear-gradient(
|
279 |
+
center bottom,
|
280 |
+
rgb(42,45,50) 100%,
|
281 |
+
rgb(75,80,88) 90%,
|
282 |
+
rgb(123,125,130) 20%
|
283 |
+
);
|
284 |
+
color: #e1e1e1;
|
285 |
+
}
|
286 |
+
|
287 |
+
|
288 |
+
.slide-caption {
|
289 |
+
position: absolute;
|
290 |
+
bottom: 0px;
|
291 |
+
left: 0px;
|
292 |
+
width: 880px;
|
293 |
+
background-color: rgba(0,0,0,.5);
|
294 |
+
color: #fff;
|
295 |
+
z-index: 200;
|
296 |
+
padding: 10px;
|
297 |
+
}
|
298 |
+
|
299 |
+
|
300 |
+
.proto-timer {
|
301 |
+
position: absolute;
|
302 |
+
top: 10px;
|
303 |
+
right: 10px;
|
304 |
+
z-index: 9999;
|
305 |
+
}*/
|
skin/frontend/default/default/displaze/css/reset.css
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
html5doctor.com Reset Stylesheet
|
3 |
+
v1.6.1
|
4 |
+
Last Updated: 2010-09-17
|
5 |
+
Author: Richard Clark - http://richclarkdesign.com
|
6 |
+
Twitter: @rich_clark
|
7 |
+
*/
|
8 |
+
|
9 |
+
html, body, div, span, object, iframe,
|
10 |
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
11 |
+
abbr, address, cite, code,
|
12 |
+
del, dfn, em, img, ins, kbd, q, samp,
|
13 |
+
small, strong, sub, sup, var,
|
14 |
+
b, i,
|
15 |
+
dl, dt, dd, ol, ul, li,
|
16 |
+
fieldset, form, label, legend,
|
17 |
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
18 |
+
article, aside, canvas, details, figcaption, figure,
|
19 |
+
footer, header, hgroup, menu, nav, section, summary,
|
20 |
+
time, mark, audio, video {
|
21 |
+
margin:0;
|
22 |
+
padding:0;
|
23 |
+
border:0;
|
24 |
+
outline:0;
|
25 |
+
font-size:100%;
|
26 |
+
vertical-align:baseline;
|
27 |
+
background:transparent;
|
28 |
+
}
|
29 |
+
|
30 |
+
body {
|
31 |
+
line-height:1;
|
32 |
+
}
|
33 |
+
|
34 |
+
article,aside,details,figcaption,figure,
|
35 |
+
footer,header,hgroup,menu,nav,section {
|
36 |
+
display:block;
|
37 |
+
}
|
38 |
+
|
39 |
+
nav ul {
|
40 |
+
list-style:none;
|
41 |
+
}
|
42 |
+
|
43 |
+
blockquote, q {
|
44 |
+
quotes:none;
|
45 |
+
}
|
46 |
+
|
47 |
+
blockquote:before, blockquote:after,
|
48 |
+
q:before, q:after {
|
49 |
+
content:'';
|
50 |
+
content:none;
|
51 |
+
}
|
52 |
+
|
53 |
+
a {
|
54 |
+
margin:0;
|
55 |
+
padding:0;
|
56 |
+
font-size:100%;
|
57 |
+
vertical-align:baseline;
|
58 |
+
background:transparent;
|
59 |
+
}
|
60 |
+
|
61 |
+
/* change colours to suit your needs */
|
62 |
+
ins {
|
63 |
+
background-color:#ff9;
|
64 |
+
color:#000;
|
65 |
+
text-decoration:none;
|
66 |
+
}
|
67 |
+
|
68 |
+
/* change colours to suit your needs */
|
69 |
+
mark {
|
70 |
+
background-color:#ff9;
|
71 |
+
color:#000;
|
72 |
+
font-style:italic;
|
73 |
+
font-weight:bold;
|
74 |
+
}
|
75 |
+
|
76 |
+
del {
|
77 |
+
text-decoration: line-through;
|
78 |
+
}
|
79 |
+
|
80 |
+
abbr[title], dfn[title] {
|
81 |
+
border-bottom:1px dotted;
|
82 |
+
cursor:help;
|
83 |
+
}
|
84 |
+
|
85 |
+
table {
|
86 |
+
border-collapse:collapse;
|
87 |
+
border-spacing:0;
|
88 |
+
}
|
89 |
+
|
90 |
+
/* change border colour to suit your needs */
|
91 |
+
hr {
|
92 |
+
display:block;
|
93 |
+
height:1px;
|
94 |
+
border:0;
|
95 |
+
border-top:1px solid #cccccc;
|
96 |
+
margin:1em 0;
|
97 |
+
padding:0;
|
98 |
+
}
|
99 |
+
|
100 |
+
input, select {
|
101 |
+
vertical-align:middle;
|
102 |
+
}
|
skin/frontend/default/default/displaze/css/site.css
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
body {
|
2 |
+
font-size: 12px;
|
3 |
+
font-family: Arial, Helvetica, sans-serif;
|
4 |
+
background-color: #f7f7f7;
|
5 |
+
padding: 30px;
|
6 |
+
}
|
7 |
+
|
8 |
+
|
skin/frontend/default/default/displaze/images/pix.gif
ADDED
Binary file
|
skin/frontend/default/default/displaze/images/proto_controls_bg.png
ADDED
Binary file
|
skin/frontend/default/default/displaze/images/timer
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2 |
+
<svg
|
3 |
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
4 |
+
xmlns:cc="http://creativecommons.org/ns#"
|
5 |
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
6 |
+
xmlns:svg="http://www.w3.org/2000/svg"
|
7 |
+
xmlns="http://www.w3.org/2000/svg"
|
8 |
+
version="1.1"
|
9 |
+
width="28.181629"
|
10 |
+
height="28.181629"
|
11 |
+
id="svg3845">
|
12 |
+
<g
|
13 |
+
transform="translate(-288.76632,-332.55708)"
|
14 |
+
id="layer1">
|
15 |
+
<path
|
16 |
+
d="M 751.0484,397.78333 A 17.67767,17.67767 0 1 1 733.37073,415.461"
|
17 |
+
transform="matrix(0.68395976,0,0,0.68395976,-210.82975,62.489294)"
|
18 |
+
id="path3022"
|
19 |
+
style="fill:none;stroke:#ffffff;stroke-width:5.84829712;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
20 |
+
</g>
|
21 |
+
</svg>
|
skin/frontend/default/default/displaze/js/protoshow.js
ADDED
@@ -0,0 +1,746 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* ProtoShow JavaScript slide show,
|
2 |
+
* v 0.9 (beta) - 24/02/12
|
3 |
+
* Copyright(c) 2012 David Smith (web: http://www.aheadcreative.com; twitter: @get_dave)
|
4 |
+
*
|
5 |
+
* This work is licenced under the Creative Commons Attribution-No Derivative Works 3.0 Unported License.
|
6 |
+
* http://creativecommons.org/licenses/by-nd/3.0/
|
7 |
+
*
|
8 |
+
* For more information on this project visit:
|
9 |
+
* http://www.protoshow.net
|
10 |
+
* http://www.deepbluesky.com
|
11 |
+
*
|
12 |
+
*--------------------------------------------------------------------------*/
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
if(typeof Prototype=='undefined' || typeof Scriptaculous =='undefined') {
|
17 |
+
throw("Protoshow.js requires the Prototype & Scriptaculous JavaScript frameworks");
|
18 |
+
} else {
|
19 |
+
|
20 |
+
var protoShow = Class.create({
|
21 |
+
|
22 |
+
initialize: function(element,options) {
|
23 |
+
|
24 |
+
// Default options
|
25 |
+
this.options = Object.extend({
|
26 |
+
selector : ".slide",
|
27 |
+
interval : 3000,
|
28 |
+
initialSlide : 1,
|
29 |
+
mode : "forward",
|
30 |
+
autoPlay : true,
|
31 |
+
autoRestart : true,
|
32 |
+
transitionType : "fade",
|
33 |
+
transitionTime : 1.5,
|
34 |
+
manTransitionTime : 0.5,
|
35 |
+
navigation : true,
|
36 |
+
controls : true,
|
37 |
+
stopText : "Pause",
|
38 |
+
playText : "Play",
|
39 |
+
nextText : "Next",
|
40 |
+
previousText : "Previous",
|
41 |
+
captions : false,
|
42 |
+
pauseOnHover : false,
|
43 |
+
keyboardControls : true,
|
44 |
+
fireEvents : true,
|
45 |
+
progressTimer : true,
|
46 |
+
swipeEvents : true
|
47 |
+
|
48 |
+
}, options || {}); // We use Prototype's Object.extend() to overwrite defaults with user preferences
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
|
53 |
+
// get/set various options
|
54 |
+
this.element = $(element); // DOM element that contains the slideshow
|
55 |
+
this.slides = this.element.select(this.options.selector); // Elements that are to be the "Slides"
|
56 |
+
this.slidesLength = this.slides.size(); // Total number of Slides
|
57 |
+
this.interval = this.options.interval;
|
58 |
+
this.transitionType = this.options.transitionType;
|
59 |
+
this.transitionTime = this.options.transitionTime;
|
60 |
+
this.manTransitionTime = this.options.manTransitionTime;
|
61 |
+
this.currentSlideID = this.options.initialSlide - 1;
|
62 |
+
this.nextSlideID = this.currentSlideID + 1;
|
63 |
+
this.playText = this.options.playText;
|
64 |
+
this.nextText = this.options.nextText;
|
65 |
+
this.previousText = this.options.previousText;
|
66 |
+
this.stopText = this.options.stopText;
|
67 |
+
this.mode = this[this.options.mode]; // Get play "mode" (forward, backward, random...etc)
|
68 |
+
this.autoPlay = this.options.autoPlay;
|
69 |
+
this.progressTimer = this.options.progressTimer;
|
70 |
+
this.showUniqueID = element; // get a unique ID based on the id attr of the show element
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
// define variables before use
|
76 |
+
this.running = false;
|
77 |
+
this.masterTimer = false;
|
78 |
+
this.animating = false; // boolean for "animating" status
|
79 |
+
this.loopCount = 0;
|
80 |
+
this.slideWidth = 0;
|
81 |
+
this.slideHeight = 0;
|
82 |
+
this.slideIntervals = [];
|
83 |
+
this.currentSlideEle = this.slides[this.currentSlideID];
|
84 |
+
this.nextSlideEle = this.slides[this.nextSlideID];
|
85 |
+
|
86 |
+
|
87 |
+
//run some initial setup
|
88 |
+
this.setupTransitions(this.options.transitionType);
|
89 |
+
this.setupSlides();
|
90 |
+
this.setupControls();
|
91 |
+
this.setupNavigation();
|
92 |
+
this.setupCaptions();
|
93 |
+
this.setupKeyboardControls();
|
94 |
+
this.setupSwipeEvents();
|
95 |
+
this.stopOnHover();
|
96 |
+
|
97 |
+
//this.createTimer();
|
98 |
+
this.setupTimer();
|
99 |
+
|
100 |
+
// let's get things going!
|
101 |
+
this.play();
|
102 |
+
|
103 |
+
},
|
104 |
+
|
105 |
+
|
106 |
+
/* DIRECTIONAL CONTROLS
|
107 |
+
------------------------------------------------*/
|
108 |
+
|
109 |
+
|
110 |
+
|
111 |
+
play: function() {
|
112 |
+
// Role: Starts the show and initialises master timer
|
113 |
+
|
114 |
+
var _this = this;
|
115 |
+
this.running = true;
|
116 |
+
this.toggleMasterTimer(true);
|
117 |
+
this.updateControls(true);
|
118 |
+
|
119 |
+
this.fireCustomEvent("protoShow:started");
|
120 |
+
},
|
121 |
+
|
122 |
+
stop: function() {
|
123 |
+
// Completely stops the show and clears the master timer
|
124 |
+
var _this = this;
|
125 |
+
|
126 |
+
this.running = false;
|
127 |
+
|
128 |
+
this.toggleMasterTimer(false);
|
129 |
+
this.updateControls(false);
|
130 |
+
|
131 |
+
this.fireCustomEvent("protoShow:stopped");
|
132 |
+
},
|
133 |
+
|
134 |
+
toggleMasterTimer: function(bln) {
|
135 |
+
var _this = this;
|
136 |
+
|
137 |
+
if (bln) {
|
138 |
+
// Check if custom interval has been defined by user as data attribute in HTML
|
139 |
+
var slideInterval = (this.slideIntervals[this.currentSlideID]) ? this.slideIntervals[this.currentSlideID] : this.interval;
|
140 |
+
this.runProgressTimer();
|
141 |
+
|
142 |
+
// Set Master time which controls progress of show
|
143 |
+
this.masterTimer = new PeriodicalExecuter(function(pe) {
|
144 |
+
_this.mode();
|
145 |
+
}, slideInterval/1000);
|
146 |
+
this.loopCount++;
|
147 |
+
} else {
|
148 |
+
this.stopProgressTimer();
|
149 |
+
_this.masterTimer && _this.masterTimer.stop();
|
150 |
+
_this.masterTimer = null;
|
151 |
+
}
|
152 |
+
|
153 |
+
},
|
154 |
+
|
155 |
+
forward: function(transTime) {
|
156 |
+
// Role: Runs slideshow "forwards"
|
157 |
+
|
158 |
+
this.goMaster( this.currentSlideID + 1, transTime, "forward");
|
159 |
+
},
|
160 |
+
|
161 |
+
backward: function(transTime) {
|
162 |
+
// Role: Runs slideshow "backwards"
|
163 |
+
|
164 |
+
this.goMaster( this.currentSlideID - 1, transTime, "backward");
|
165 |
+
},
|
166 |
+
|
167 |
+
next: function() {
|
168 |
+
this.forward(this.manTransitionTime);
|
169 |
+
},
|
170 |
+
|
171 |
+
previous: function() {
|
172 |
+
this.backward(this.manTransitionTime);
|
173 |
+
},
|
174 |
+
|
175 |
+
gotoSlide: function(slide,transTime) {
|
176 |
+
if (slide === this.currentSlideID) {
|
177 |
+
return false;
|
178 |
+
}
|
179 |
+
this.goMaster( slide, this.manTransitionTime );
|
180 |
+
},
|
181 |
+
|
182 |
+
goMaster: function(next,transTime, direction) {
|
183 |
+
// Role: Master function - controls delegation of slide swapping
|
184 |
+
|
185 |
+
var _this = this;
|
186 |
+
|
187 |
+
// First thing's first, we hault the show whatever the circumstances
|
188 |
+
this.toggleMasterTimer(false);
|
189 |
+
|
190 |
+
if(this.isAnimating()) {
|
191 |
+
return false;
|
192 |
+
}
|
193 |
+
|
194 |
+
// Set the transistion speed to transTime arg (if set) else fallback to standard transitionTime
|
195 |
+
var transTime = (transTime) ? transTime : _this.transitionTime;
|
196 |
+
|
197 |
+
|
198 |
+
|
199 |
+
this.toggleAnimating(true);
|
200 |
+
this.setNextIndex(next); // set this.nextSlideID correctly
|
201 |
+
|
202 |
+
this.fireCustomEvent("protoShow:transitionStarted",transTime,direction,_this.nextSlideID);
|
203 |
+
_this.updateNavigation(_this.currentSlideID, _this.nextSlideID);
|
204 |
+
|
205 |
+
this.transitionType(this.currentSlideEle,this.nextSlideEle, {
|
206 |
+
transitionTime : transTime,
|
207 |
+
transitionFinish : function() { // pass a callback to ensure play can't resume until transition has completed
|
208 |
+
_this.toggleAnimating(false);
|
209 |
+
_this.currentSlideEle.removeClassName('active-slide');
|
210 |
+
_this.nextSlideEle.addClassName('active-slide');
|
211 |
+
|
212 |
+
_this.updateCaptions(_this.nextSlideEle);
|
213 |
+
_this.fireCustomEvent("protoShow:transitionFinished");
|
214 |
+
_this.currentSlideID = _this.nextSlideID; // update current slide to be the slide we're just moved to
|
215 |
+
_this.currentSlideEle = _this.slides[_this.nextSlideID];
|
216 |
+
|
217 |
+
|
218 |
+
if (_this.autoPlay && _this.running ) {
|
219 |
+
// if we're autoplaying and we're not explicity stopped
|
220 |
+
// otherwise show Master Timer is not permitted to restart itself
|
221 |
+
_this.toggleMasterTimer(true);
|
222 |
+
}
|
223 |
+
}
|
224 |
+
});
|
225 |
+
},
|
226 |
+
|
227 |
+
|
228 |
+
/* TRANSITION FUNCTIONS
|
229 |
+
------------------------------------------------*/
|
230 |
+
|
231 |
+
fade: function(current,next,opts) {
|
232 |
+
// Role: Transition function
|
233 |
+
// Type: Fade - fades slides in and out
|
234 |
+
|
235 |
+
var _this = this;
|
236 |
+
|
237 |
+
next.show();
|
238 |
+
current.fade({
|
239 |
+
duration : opts.transitionTime,
|
240 |
+
afterFinish : function() {
|
241 |
+
return opts.transitionFinish();
|
242 |
+
}
|
243 |
+
});
|
244 |
+
},
|
245 |
+
|
246 |
+
slide: function(current,next,opts) {
|
247 |
+
// Role: Transition function
|
248 |
+
// Type: Slider - slides slides across the screen
|
249 |
+
var _this = this;
|
250 |
+
|
251 |
+
var leftPos = this.slideWidth * this.nextSlideID;
|
252 |
+
|
253 |
+
|
254 |
+
new Effect.Morph(_this.showEle, {
|
255 |
+
style: {
|
256 |
+
left: -leftPos + 'px'
|
257 |
+
},
|
258 |
+
duration : opts.transitionTime,
|
259 |
+
afterFinish : function() {
|
260 |
+
return opts.transitionFinish();
|
261 |
+
}
|
262 |
+
});
|
263 |
+
},
|
264 |
+
|
265 |
+
|
266 |
+
|
267 |
+
/* SETUP METHODS
|
268 |
+
------------------------------------------------*/
|
269 |
+
|
270 |
+
setupSlides: function() {
|
271 |
+
var _this = this;
|
272 |
+
|
273 |
+
|
274 |
+
|
275 |
+
// Get and set user defined custom intervals
|
276 |
+
this.slides.each(function(e, index) {
|
277 |
+
|
278 |
+
|
279 |
+
if (_this.options.transitionType !== "slide") {
|
280 |
+
e.hide();
|
281 |
+
}
|
282 |
+
var slideInt = e.readAttribute('data-slide-interval');
|
283 |
+
slideInt = (slideInt && slideInt.blank()) ? undefined : slideInt; // check slideInt is not a blank string
|
284 |
+
|
285 |
+
_this.slideIntervals.push(slideInt); // push intervals into array for use later
|
286 |
+
});
|
287 |
+
|
288 |
+
// Ensure first slide is visible and has active class
|
289 |
+
this.slides[this.currentSlideID].show().addClassName('active-slide');
|
290 |
+
},
|
291 |
+
|
292 |
+
setupTransitions: function(transType) {
|
293 |
+
// Role: Setup basics for transitions
|
294 |
+
var _this = this;
|
295 |
+
|
296 |
+
if (typeof(transType) == "function") { // user has defined custom transition function
|
297 |
+
// If function then user has passed in custom transition function to be used
|
298 |
+
this.transitionType = transType;
|
299 |
+
this.element.addClassName('transition-custom');
|
300 |
+
} else { // it's a string
|
301 |
+
this.transitionType = this[transType];
|
302 |
+
this.element.addClassName('transition-' + transType);
|
303 |
+
|
304 |
+
if (transType === "slide") {
|
305 |
+
|
306 |
+
this.showWindow = this.element.down('.show').wrap('div', { 'class': 'show-window' });
|
307 |
+
this.showEle = this.showWindow.down('.show');
|
308 |
+
var slideLayout = this.slides[0].getLayout();
|
309 |
+
this.slideWidth = slideLayout.get('width');
|
310 |
+
this.slideHeight = slideLayout.get('height');
|
311 |
+
|
312 |
+
|
313 |
+
this.showWindow.setStyle({
|
314 |
+
width : _this.slideWidth + "px",
|
315 |
+
height : _this.slideHeight + "px"
|
316 |
+
});
|
317 |
+
}
|
318 |
+
}
|
319 |
+
},
|
320 |
+
|
321 |
+
setupControls: function() {
|
322 |
+
// Role: Setup controls
|
323 |
+
|
324 |
+
var _this = this;
|
325 |
+
|
326 |
+
if (!this.options.controls) {
|
327 |
+
return false;
|
328 |
+
}
|
329 |
+
|
330 |
+
this.protoControls = this.element.down('.proto-controls'); // Stop/Forward/Back buttons
|
331 |
+
|
332 |
+
if (typeof this.protoControls==="undefined" ) {
|
333 |
+
|
334 |
+
var controlsEle = new Element('ol', { 'class': 'proto-controls'});
|
335 |
+
var controlsTemplate = new Template('<li class="#{htmlclass}"><a href="javascript:void(0)" title="#{title}">#{text}</a></li>');
|
336 |
+
|
337 |
+
var startStop = controlsTemplate.evaluate({
|
338 |
+
htmlclass: "proto-control start-stop",
|
339 |
+
text: this.playText,
|
340 |
+
title: "Pause the show"
|
341 |
+
});
|
342 |
+
var backward = controlsTemplate.evaluate({
|
343 |
+
htmlclass: "proto-control backward",
|
344 |
+
text: this.previousText,
|
345 |
+
title: "Go to Previous slide and play backwards"
|
346 |
+
});
|
347 |
+
var forward = controlsTemplate.evaluate({
|
348 |
+
htmlclass: "proto-control forward",
|
349 |
+
text: this.nextText,
|
350 |
+
title: "Go to Next slide and play forwards"
|
351 |
+
});
|
352 |
+
|
353 |
+
// Build a DOM fragment from all the above
|
354 |
+
controlsEle.insert(startStop,'bottom').insert(backward,'bottom').insert(forward,'bottom');
|
355 |
+
this.element.insert(controlsEle,'bottom'); // add into DOM
|
356 |
+
this.protoControls = $(controlsEle); // extend the DOM fragment
|
357 |
+
}
|
358 |
+
|
359 |
+
// If the controls already exists in the DOM
|
360 |
+
this.controlStartStop = this.protoControls.down('.start-stop');
|
361 |
+
this.controlForward = this.protoControls.down('.forward');
|
362 |
+
this.controlBackward = this.protoControls.down('.backward');
|
363 |
+
|
364 |
+
|
365 |
+
// define "lock" variable to stop abuse of controls
|
366 |
+
var handlingClick = false;
|
367 |
+
|
368 |
+
this.protoControls.on("click", ".proto-control", function(event, element) {
|
369 |
+
event.stop();
|
370 |
+
|
371 |
+
// make sure we're not processing multiple click events
|
372 |
+
if (handlingClick) {
|
373 |
+
return false;
|
374 |
+
}
|
375 |
+
|
376 |
+
handlingClick = true;
|
377 |
+
|
378 |
+
|
379 |
+
|
380 |
+
if(element === _this.controlForward) {
|
381 |
+
_this.next();
|
382 |
+
} else if (element === _this.controlBackward) {
|
383 |
+
_this.previous();
|
384 |
+
} else {
|
385 |
+
|
386 |
+
if (_this.running) {
|
387 |
+
_this.stop(); // if we're "Playing" then stop the show
|
388 |
+
} else {
|
389 |
+
_this.play(); // else if we're not "Playing" then start the show
|
390 |
+
}
|
391 |
+
}
|
392 |
+
/*remove the "lock" variable*/
|
393 |
+
handlingClick = false;
|
394 |
+
});
|
395 |
+
|
396 |
+
},
|
397 |
+
|
398 |
+
|
399 |
+
setupNavigation: function() {
|
400 |
+
// Role: Setup Navigation
|
401 |
+
var _this = this;
|
402 |
+
|
403 |
+
if (!this.options.navigation) {
|
404 |
+
return false;
|
405 |
+
}
|
406 |
+
|
407 |
+
this.protoNavigation = this.element.down('.proto-navigation');
|
408 |
+
|
409 |
+
if (typeof this.protoNavigation==="undefined" ) {
|
410 |
+
var navEle = new Element('ol', { 'class': 'proto-navigation'});
|
411 |
+
var navTemplate = new Template('<li><a href="##{number}" title="Skip to Slide #{number}">#{number}</a></li>');
|
412 |
+
|
413 |
+
this.slides.each(function(e,index) { // for each slide in the show create a Nav <li> using the Template above
|
414 |
+
var li = navTemplate.evaluate({number: index+1});
|
415 |
+
navEle.insert(li,'bottom');
|
416 |
+
});
|
417 |
+
|
418 |
+
this.element.insert(navEle,'bottom');
|
419 |
+
this.protoNavigation = this.element.down('.proto-navigation');
|
420 |
+
}
|
421 |
+
|
422 |
+
this.protoNavigation.down('li').addClassName('current-slide');
|
423 |
+
|
424 |
+
// define "lock" variable to stop abuse of controls
|
425 |
+
var handlingClick = false;
|
426 |
+
|
427 |
+
this.protoNavigation.on("click", "a", function(event, element) {
|
428 |
+
event.stop();
|
429 |
+
|
430 |
+
// make sure we're not processing multiple click events
|
431 |
+
if (handlingClick) {
|
432 |
+
return false;
|
433 |
+
}
|
434 |
+
|
435 |
+
handlingClick = true;
|
436 |
+
|
437 |
+
var index = element.hash.substr(1,2); // get the slide ID from the href hash (eg: #3)
|
438 |
+
_this.gotoSlide(index-1);
|
439 |
+
|
440 |
+
/*remove the "lock" variable*/
|
441 |
+
handlingClick = false;
|
442 |
+
});
|
443 |
+
},
|
444 |
+
|
445 |
+
updateNavigation: function(current,next) {
|
446 |
+
if (typeof this.protoNavigation !== "undefined" ) {
|
447 |
+
this.protoNavigation.select('li')[current].removeClassName('current-slide');
|
448 |
+
this.protoNavigation.select('li')[next].addClassName('current-slide');
|
449 |
+
}
|
450 |
+
},
|
451 |
+
|
452 |
+
setupCaptions: function() {
|
453 |
+
var _this = this;
|
454 |
+
|
455 |
+
if (this.options.captions) {
|
456 |
+
var captionEle = new Element('div', { 'class' : 'slide-caption'});
|
457 |
+
captionEle.hide();
|
458 |
+
this.element.insert(captionEle,'bottom');
|
459 |
+
this.captionsElement = captionEle;
|
460 |
+
this.updateCaptions(_this.currentSlideEle);
|
461 |
+
}
|
462 |
+
|
463 |
+
},
|
464 |
+
|
465 |
+
updateCaptions: function(slide) {
|
466 |
+
if (!this.options.captions) {
|
467 |
+
return false;
|
468 |
+
}
|
469 |
+
|
470 |
+
var nextCaption = slide.down('img').readAttribute('alt');
|
471 |
+
if (nextCaption.replace(/^\s*|\s*$/g,'').length) { // check that the attribute has some content (not just spaces)
|
472 |
+
if(!this.captionsElement.visible()) {
|
473 |
+
// just check that the element is visible
|
474 |
+
this.captionsElement.show();
|
475 |
+
}
|
476 |
+
this.captionsElement.update(nextCaption);
|
477 |
+
} else { // if no caption is found then hide the caption element
|
478 |
+
this.captionsElement.hide();
|
479 |
+
}
|
480 |
+
},
|
481 |
+
|
482 |
+
|
483 |
+
stopOnHover: function() {
|
484 |
+
var _this = this;
|
485 |
+
|
486 |
+
if (this.options.pauseOnHover) {
|
487 |
+
this.element.down('.show').observe('mouseenter',function() {
|
488 |
+
_this.stop();
|
489 |
+
}).observe('mouseleave',function() {
|
490 |
+
_this.play();
|
491 |
+
});
|
492 |
+
|
493 |
+
|
494 |
+
}
|
495 |
+
},
|
496 |
+
|
497 |
+
setupKeyboardControls: function() {
|
498 |
+
// 39 = right arrow
|
499 |
+
// 37 = left arrow
|
500 |
+
|
501 |
+
if (!this.options.keyboardControls) {
|
502 |
+
return false;
|
503 |
+
}
|
504 |
+
|
505 |
+
var _this = this;
|
506 |
+
document.observe('keydown', function(key) {
|
507 |
+
|
508 |
+
var keyCode = key.keyCode;
|
509 |
+
|
510 |
+
// stop arrow keys from working when focused on form items
|
511 |
+
if ( (!key.target.tagName.match('TEXTAREA|INPUT|SELECT')) && (keyCode === 37 || keyCode === 39) ) {
|
512 |
+
if (keyCode === 37) {
|
513 |
+
_this.previous();
|
514 |
+
} else if (keyCode === 39) {
|
515 |
+
_this.next();
|
516 |
+
}
|
517 |
+
} else {
|
518 |
+
return false;
|
519 |
+
}
|
520 |
+
});
|
521 |
+
},
|
522 |
+
|
523 |
+
setupSwipeEvents: function() {
|
524 |
+
var _this = this;
|
525 |
+
var touchStartX = false;
|
526 |
+
|
527 |
+
if (!this.options.swipeEvents) {
|
528 |
+
return false;
|
529 |
+
}
|
530 |
+
|
531 |
+
|
532 |
+
/* TOUCH START: Get and store the position of the initial touch */
|
533 |
+
this.element.observe('touchstart', function(e) {
|
534 |
+
|
535 |
+
touchStartX = e.targetTouches[0].clientX;
|
536 |
+
});
|
537 |
+
|
538 |
+
|
539 |
+
/* TOUCH MOVE: Called every time a user moves finger across the screen */
|
540 |
+
this.element.observe('touchmove', function(e) {
|
541 |
+
e.preventDefault();
|
542 |
+
if (touchStartX > e.targetTouches[0].clientX) {
|
543 |
+
_this.previous();
|
544 |
+
} else {
|
545 |
+
_this.next();
|
546 |
+
}
|
547 |
+
});
|
548 |
+
|
549 |
+
},
|
550 |
+
|
551 |
+
|
552 |
+
|
553 |
+
fireCustomEvent: function(event_name,trans_time,direction,slideID) {
|
554 |
+
if(this.options.fireEvents) {
|
555 |
+
var element = this.element;
|
556 |
+
element.fire(event_name, {
|
557 |
+
showID : this.showUniqueID,
|
558 |
+
transitionTime : trans_time,
|
559 |
+
direction : direction,
|
560 |
+
slideID : slideID
|
561 |
+
});
|
562 |
+
}
|
563 |
+
},
|
564 |
+
|
565 |
+
|
566 |
+
/* UTILITY FUNCTIONS
|
567 |
+
------------------------------------------------*/
|
568 |
+
|
569 |
+
isPlaying: function() {
|
570 |
+
return this.masterTimer != null;
|
571 |
+
},
|
572 |
+
|
573 |
+
isAnimating: function() {
|
574 |
+
return this.animating;
|
575 |
+
},
|
576 |
+
|
577 |
+
toggleAnimating: function(bln) {
|
578 |
+
// Role: toggles var to say whether animation is in progress and manipulates DOM
|
579 |
+
this.animating = bln;
|
580 |
+
if (bln) {
|
581 |
+
this.element.addClassName("animating");
|
582 |
+
} else {
|
583 |
+
this.element.removeClassName("animating");
|
584 |
+
}
|
585 |
+
},
|
586 |
+
|
587 |
+
setNextIndex: function(next) {
|
588 |
+
// Role: Decides on direction and ensures within bounds
|
589 |
+
|
590 |
+
if(next === undefined) { // Ensure "next" has a value
|
591 |
+
next = this.currentSlideID+1;
|
592 |
+
}
|
593 |
+
|
594 |
+
// Ensure we're within bounds
|
595 |
+
if (next >= this.slidesLength) {
|
596 |
+
next = 0;
|
597 |
+
} else if (next < 0 ){
|
598 |
+
next = this.slidesLength-1;
|
599 |
+
}
|
600 |
+
|
601 |
+
this.nextSlideID = next;
|
602 |
+
this.nextSlideEle = this.slides[this.nextSlideID];
|
603 |
+
},
|
604 |
+
|
605 |
+
updateControls: function(status) {
|
606 |
+
if (this.options.controls) {
|
607 |
+
// Role: Updates the status of the Play/Pause button
|
608 |
+
var _this = this;
|
609 |
+
|
610 |
+
if (status) { // The show has been started so update the button to "Pause"
|
611 |
+
this.controlStartStop.down('a').update(_this.stopText);
|
612 |
+
} else {
|
613 |
+
// The show has been stopped so update the button to "Play"
|
614 |
+
this.controlStartStop.down('a').update(_this.playText);
|
615 |
+
}
|
616 |
+
}
|
617 |
+
|
618 |
+
},
|
619 |
+
|
620 |
+
|
621 |
+
|
622 |
+
setupTimer: function() {
|
623 |
+
// Role: creates the proto-progress-timer <canvas> element, gets 2D Context and inserta into DOM
|
624 |
+
|
625 |
+
this.progressTimerEle = document.createElement('canvas');
|
626 |
+
if (this.progressTimerEle.getContext && this.progressTimerEle.getContext('2d')) { // test for Canvas support
|
627 |
+
this.progressTimerEle.writeAttribute('class','proto-progress-timer');
|
628 |
+
this.progressTimerEle.width = 30;
|
629 |
+
this.progressTimerEle.height = 30;
|
630 |
+
this.element.insert(this.progressTimerEle,'bottom');
|
631 |
+
this.progressTimerCtx = this.progressTimerEle.getContext('2d');
|
632 |
+
} else {
|
633 |
+
this.progressTimer = false; // no canvas support
|
634 |
+
}
|
635 |
+
},
|
636 |
+
|
637 |
+
|
638 |
+
runProgressTimer: function() {
|
639 |
+
// Role: runs & controls the animation of the "progress timer"
|
640 |
+
|
641 |
+
var _this = this;
|
642 |
+
|
643 |
+
|
644 |
+
if (this.progressTimer) { // if user has set to use progress timer and the browser supports <canvas>
|
645 |
+
|
646 |
+
|
647 |
+
|
648 |
+
this.progressTimerEle.show();
|
649 |
+
|
650 |
+
// use Epoch time to ensure code executes in time specified
|
651 |
+
// borrowed from Emile JS http://script.aculo.us/downloads/emile.pdf
|
652 |
+
var start = (new Date).getTime();
|
653 |
+
|
654 |
+
// we want the timer to finish slightly before the slide transitions
|
655 |
+
// so we shorten the duration by 1/4
|
656 |
+
var duration = this.interval*0.75;
|
657 |
+
var finish = start+duration;
|
658 |
+
var angleStart = 0;
|
659 |
+
|
660 |
+
|
661 |
+
this.progressTimerPE = new PeriodicalExecuter(function(pe) {
|
662 |
+
_this.resetProgressTimer(); // clear the canvas ready for next segment
|
663 |
+
this.drawArc(_this.progressTimerCtx,0,360,'rgba(0,0,0,.2)'); // redraw the black bg circle
|
664 |
+
|
665 |
+
var time = (new Date).getTime();
|
666 |
+
var pos = time>finish ? 1 : (time-start)/duration;
|
667 |
+
|
668 |
+
// draw the arch passing in the ctx and the degress of the arch
|
669 |
+
this.drawArc(_this.progressTimerCtx,-5,Math.floor(( (360) * pos)),'rgba(255,255,255,.8)',true);
|
670 |
+
|
671 |
+
if( (!this.isPlaying()) || time>finish) { // if we are stopped or we are finished then stop the PE and fade the canvas out
|
672 |
+
pe.stop();
|
673 |
+
_this.progressTimerEle.fade({
|
674 |
+
duration: (_this.interval > 1000) ? (_this.interval/8)/1000 : 0.2,
|
675 |
+
afterFinish: function() {
|
676 |
+
_this.resetProgressTimer();
|
677 |
+
}
|
678 |
+
});
|
679 |
+
}
|
680 |
+
}.bind(this),duration/100000);
|
681 |
+
}
|
682 |
+
},
|
683 |
+
|
684 |
+
|
685 |
+
resetProgressTimer: function() {
|
686 |
+
this.progressTimerEle.width = this.progressTimerEle.width;
|
687 |
+
},
|
688 |
+
|
689 |
+
stopProgressTimer: function() {
|
690 |
+
this.resetProgressTimer();
|
691 |
+
clearInterval(this.progressTimerPE);
|
692 |
+
},
|
693 |
+
|
694 |
+
drawArc: function(canvasCtx,startAngle,endAngle,strokeStyle) {
|
695 |
+
// Role: utility function for drawing archs on <canvas> elements
|
696 |
+
|
697 |
+
var drawingArc = true;
|
698 |
+
var ctx = canvasCtx;
|
699 |
+
|
700 |
+
ctx.beginPath();
|
701 |
+
ctx.strokeStyle = strokeStyle;
|
702 |
+
ctx.lineCap = 'butt';
|
703 |
+
ctx.lineWidth = 4;
|
704 |
+
|
705 |
+
ctx.arc(15,15,10, (Math.PI/180)*(startAngle-90),(Math.PI/180)*(endAngle-90), false);
|
706 |
+
ctx.stroke();
|
707 |
+
var drawingArc = false;
|
708 |
+
},
|
709 |
+
|
710 |
+
|
711 |
+
|
712 |
+
/* LOGGING FUNCTIONS
|
713 |
+
------------------------------------------------*/
|
714 |
+
|
715 |
+
/*reportSlides: function() {
|
716 |
+
console.log("Current slide: " + this.currentSlideID);
|
717 |
+
console.log("Next slide: " + this.nextSlideID);
|
718 |
+
},*/
|
719 |
+
|
720 |
+
|
721 |
+
|
722 |
+
|
723 |
+
cc: function() {
|
724 |
+
// catches the comma
|
725 |
+
}
|
726 |
+
|
727 |
+
|
728 |
+
|
729 |
+
|
730 |
+
});
|
731 |
+
|
732 |
+
Element.addMethods({
|
733 |
+
// Make Protoshow available as method of all Prototype extended elements
|
734 |
+
// http://www.prototypejs.org/api/element/addmethods
|
735 |
+
protoShow: function(element, options) {
|
736 |
+
element = $(element);
|
737 |
+
var theShow = new protoShow(element,options);
|
738 |
+
return theShow;
|
739 |
+
}
|
740 |
+
});
|
741 |
+
|
742 |
+
}
|
743 |
+
|
744 |
+
|
745 |
+
|
746 |
+
|