padoo_gallery - Version 1.0.2

Version Notes

Display images, pictures in the form of Photo Gallery & Product Gallery with lighbox.

Download this release

Release Info

Developer Padoosoft
Extension padoo_gallery
Version 1.0.2
Comparing to
See all releases


Version 1.0.2

Files changed (93) hide show
  1. app/code/local/Padoo/Gallery/Block/Admin/Album.php +36 -0
  2. app/code/local/Padoo/Gallery/Block/Admin/Album/Edit.php +62 -0
  3. app/code/local/Padoo/Gallery/Block/Admin/Album/Edit/Form.php +36 -0
  4. app/code/local/Padoo/Gallery/Block/Admin/Album/Edit/Tab/Form.php +102 -0
  5. app/code/local/Padoo/Gallery/Block/Admin/Album/Edit/Tabs.php +41 -0
  6. app/code/local/Padoo/Gallery/Block/Admin/Album/Grid.php +154 -0
  7. app/code/local/Padoo/Gallery/Block/Admin/Gallery.php +35 -0
  8. app/code/local/Padoo/Gallery/Block/Admin/Gallery/Edit.php +62 -0
  9. app/code/local/Padoo/Gallery/Block/Admin/Gallery/Edit/Form.php +36 -0
  10. app/code/local/Padoo/Gallery/Block/Admin/Gallery/Edit/Tab/Form.php +113 -0
  11. app/code/local/Padoo/Gallery/Block/Admin/Gallery/Edit/Tabs.php +41 -0
  12. app/code/local/Padoo/Gallery/Block/Admin/Gallery/Grid.php +166 -0
  13. app/code/local/Padoo/Gallery/Block/Admin/Review.php +30 -0
  14. app/code/local/Padoo/Gallery/Block/Admin/Review/Edit.php +62 -0
  15. app/code/local/Padoo/Gallery/Block/Admin/Review/Edit/Form.php +36 -0
  16. app/code/local/Padoo/Gallery/Block/Admin/Review/Edit/Tab/Form.php +126 -0
  17. app/code/local/Padoo/Gallery/Block/Admin/Review/Edit/Tabs.php +41 -0
  18. app/code/local/Padoo/Gallery/Block/Admin/Review/Grid.php +180 -0
  19. app/code/local/Padoo/Gallery/Block/Ajax.php +26 -0
  20. app/code/local/Padoo/Gallery/Block/Album.php +59 -0
  21. app/code/local/Padoo/Gallery/Block/Detail.php +84 -0
  22. app/code/local/Padoo/Gallery/Block/Gallery.php +154 -0
  23. app/code/local/Padoo/Gallery/Block/Page/Pager.php +293 -0
  24. app/code/local/Padoo/Gallery/Block/Review.php +131 -0
  25. app/code/local/Padoo/Gallery/Block/Search.php +94 -0
  26. app/code/local/Padoo/Gallery/Helper/Data.php +56 -0
  27. app/code/local/Padoo/Gallery/Helper/Image.php +332 -0
  28. app/code/local/Padoo/Gallery/Model/Album.php +27 -0
  29. app/code/local/Padoo/Gallery/Model/Gallery.php +27 -0
  30. app/code/local/Padoo/Gallery/Model/Image.php +522 -0
  31. app/code/local/Padoo/Gallery/Model/Mysql4/Album.php +27 -0
  32. app/code/local/Padoo/Gallery/Model/Mysql4/Album/Collection.php +27 -0
  33. app/code/local/Padoo/Gallery/Model/Mysql4/Gallery.php +27 -0
  34. app/code/local/Padoo/Gallery/Model/Mysql4/Gallery/Collection.php +27 -0
  35. app/code/local/Padoo/Gallery/Model/Mysql4/Review.php +27 -0
  36. app/code/local/Padoo/Gallery/Model/Mysql4/Review/Collection.php +27 -0
  37. app/code/local/Padoo/Gallery/Model/Review.php +27 -0
  38. app/code/local/Padoo/Gallery/Model/Status.php +32 -0
  39. app/code/local/Padoo/Gallery/Model/_Project.php +36 -0
  40. app/code/local/Padoo/Gallery/controllers/Admin/AlbumController.php +297 -0
  41. app/code/local/Padoo/Gallery/controllers/Admin/GalleryController.php +263 -0
  42. app/code/local/Padoo/Gallery/controllers/Admin/ReviewController.php +228 -0
  43. app/code/local/Padoo/Gallery/controllers/IndexController.php +86 -0
  44. app/code/local/Padoo/Gallery/controllers/ViewController.php +62 -0
  45. app/code/local/Padoo/Gallery/etc/adminhtml.xml +73 -0
  46. app/code/local/Padoo/Gallery/etc/config.xml +195 -0
  47. app/code/local/Padoo/Gallery/etc/system.xml +142 -0
  48. app/code/local/Padoo/Gallery/sql/gallery_setup/mysql4-install-0.1.0.php +51 -0
  49. app/code/local/Padoo/Gallery/sql/gallery_setup/mysql4-upgrade-0.1.0-0.1.1.php +38 -0
  50. app/code/local/Padoo/Gallery/sql/gallery_setup/mysql4-upgrade-0.1.1-0.1.2.php +48 -0
  51. app/code/local/Padoo/Gallery/sql/gallery_setup/mysql4-upgrade-0.1.2-0.1.3.php +19 -0
  52. app/code/local/Padoo/Gallery/sql/gallery_setup/mysql4-upgrade-1.0.1-1.0.2.php +19 -0
  53. app/design/adminhtml/default/default/layout/padoo_gallery.xml +18 -0
  54. app/design/adminhtml/default/default/template/gallery/grid.phtml +257 -0
  55. app/design/adminhtml/default/default/template/gallery/grid1.phtml +291 -0
  56. app/design/adminhtml/default/default/template/gallery/grid2.phtml +291 -0
  57. app/design/frontend/base/default/layout/padoo_gallery.xml +112 -0
  58. app/design/frontend/base/default/template/gallery/album.phtml +85 -0
  59. app/design/frontend/base/default/template/gallery/details.phtml +110 -0
  60. app/design/frontend/base/default/template/gallery/gallery.phtml +45 -0
  61. app/design/frontend/base/default/template/gallery/newalbums.phtml +17 -0
  62. app/design/frontend/base/default/template/gallery/photo/pager.phtml +53 -0
  63. app/design/frontend/base/default/template/gallery/photoalbum.phtml +22 -0
  64. app/design/frontend/base/default/template/gallery/result.phtml +43 -0
  65. app/design/frontend/base/default/template/gallery/search-form.phtml +17 -0
  66. app/etc/modules/Padoo_Gallery.xml +9 -0
  67. app/locale/en_US/Padoo_Gallery.csv +28 -0
  68. js/padoo/checkValue.js +10 -0
  69. js/padoo/jquery.js +2 -0
  70. js/padoo/jquery_noconflict.js +1 -0
  71. js/padoo/scriptaculous.js +58 -0
  72. js/padoo/simplecheckout.js +360 -0
  73. js/padoo/storelocator.js +239 -0
  74. js/padoo/tinybox.js +124 -0
  75. package.xml +68 -0
  76. skin/frontend/base/default/gallery/css/gallery.css +118 -0
  77. skin/frontend/base/default/gallery/css/jquery.rating.css +12 -0
  78. skin/frontend/base/default/gallery/css/lightbox.css +115 -0
  79. skin/frontend/base/default/gallery/images/bullet.gif +0 -0
  80. skin/frontend/base/default/gallery/images/close.gif +0 -0
  81. skin/frontend/base/default/gallery/images/closelabel.gif +0 -0
  82. skin/frontend/base/default/gallery/images/donate-button.gif +0 -0
  83. skin/frontend/base/default/gallery/images/download-icon.gif +0 -0
  84. skin/frontend/base/default/gallery/images/image-1.jpg +0 -0
  85. skin/frontend/base/default/gallery/images/loading.gif +0 -0
  86. skin/frontend/base/default/gallery/images/nextlabel.gif +0 -0
  87. skin/frontend/base/default/gallery/images/prevlabel.gif +0 -0
  88. skin/frontend/base/default/gallery/images/star.gif +0 -0
  89. skin/frontend/base/default/gallery/images/thumb-1.jpg +0 -0
  90. skin/frontend/base/default/gallery/js/jquery.colorbox.js +1106 -0
  91. skin/frontend/base/default/gallery/js/jquery.galleriffic.js +680 -0
  92. skin/frontend/base/default/gallery/js/jquery.rating.js +376 -0
  93. skin/frontend/base/default/gallery/js/lightbox.js +711 -0
app/code/local/Padoo/Gallery/Block/Admin/Album.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Album extends Mage_Adminhtml_Block_Widget_Grid_Container
21
+ {
22
+ public function __construct()
23
+ {
24
+ $this->_controller = 'admin_album';
25
+ $this->_blockGroup = 'gallery';
26
+ $this->_headerText = Mage::helper('gallery')->__('Album Manager');
27
+ $this->_addButtonLabel = Mage::helper('gallery')->__('Add Album');
28
+ $this->_addButton('sort', array(
29
+ 'label' => Mage::helper('gallery')->__('Save order'),
30
+ 'onclick' => 'saveSort();',
31
+ 'class' => 'button',
32
+ ));
33
+ parent::__construct();
34
+ }
35
+
36
+ }
app/code/local/Padoo/Gallery/Block/Admin/Album/Edit.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Album_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
21
+ {
22
+ public function __construct()
23
+ {
24
+ parent::__construct();
25
+
26
+ $this->_objectId = 'id';
27
+ $this->_blockGroup = 'gallery';
28
+ $this->_controller = 'admin_album';
29
+
30
+ $this->_updateButton('save', 'label', Mage::helper('gallery')->__('Save Album'));
31
+ $this->_updateButton('delete', 'label', Mage::helper('gallery')->__('Delete Album'));
32
+
33
+ $this->_addButton('saveandcontinue', array(
34
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
35
+ 'onclick' => 'saveAndContinueEdit()',
36
+ 'class' => 'save',
37
+ ), -100);
38
+
39
+ $this->_formScripts[] = "
40
+ function toggleEditor() {
41
+ if (tinyMCE.getInstanceById('album_content') == null) {
42
+ tinyMCE.execCommand('mceAddControl', false, 'album_content');
43
+ } else {
44
+ tinyMCE.execCommand('mceRemoveControl', false, 'album_content');
45
+ }
46
+ }
47
+
48
+ function saveAndContinueEdit(){
49
+ editForm.submit($('edit_form').action+'back/edit/');
50
+ }
51
+ ";
52
+ }
53
+
54
+ public function getHeaderText()
55
+ {
56
+ if( Mage::registry('album_data') && Mage::registry('album_data')->getId() ) {
57
+ return Mage::helper('gallery')->__("Edit Album '%s'", $this->htmlEscape(Mage::registry('album_data')->getTitle()));
58
+ } else {
59
+ return Mage::helper('gallery')->__('Add Album');
60
+ }
61
+ }
62
+ }
app/code/local/Padoo/Gallery/Block/Admin/Album/Edit/Form.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Album_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
21
+ {
22
+ protected function _prepareForm()
23
+ {
24
+ $form = new Varien_Data_Form(array(
25
+ 'id' => 'edit_form',
26
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
27
+ 'method' => 'post',
28
+ 'enctype' => 'multipart/form-data'
29
+ )
30
+ );
31
+
32
+ $form->setUseContainer(true);
33
+ $this->setForm($form);
34
+ return parent::_prepareForm();
35
+ }
36
+ }
app/code/local/Padoo/Gallery/Block/Admin/Album/Edit/Tab/Form.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Album_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
21
+ {
22
+ protected function _prepareForm()
23
+ {
24
+ $form = new Varien_Data_Form();
25
+ $this->setForm($form);
26
+ $fieldset = $form->addFieldset('album_form', array('legend'=>Mage::helper('gallery')->__('Album information')));
27
+
28
+ $fieldset->addField('title', 'text', array(
29
+ 'label' => Mage::helper('gallery')->__('Album Name'),
30
+ 'class' => 'required-entry',
31
+ 'required' => true,
32
+ 'name' => 'title',
33
+ ));
34
+
35
+ if (!Mage::app()->isSingleStoreMode()) {
36
+ $fieldset->addField('store_id', 'multiselect', array(
37
+ 'name' => 'stores[]',
38
+ 'label' => Mage::helper('gallery')->__('Store View'),
39
+ 'title' => Mage::helper('gallery')->__('Store View'),
40
+ 'required' => true,
41
+ 'values' => Mage::getSingleton('adminhtml/system_store')
42
+ ->getStoreValuesForForm(false, true),
43
+ ));
44
+ }
45
+ else {
46
+ $fieldset->addField('store_id', 'hidden', array(
47
+ 'name' => 'stores[]',
48
+ 'value' => Mage::app()->getStore(true)->getId()
49
+ ));
50
+ }
51
+ $fieldset->addField('filename', 'image', array(
52
+ 'label' => Mage::helper('gallery')->__('Photo'),
53
+ 'required' => true,
54
+ 'name' => 'filename',
55
+ ));
56
+ $fieldset->addField('url_key', 'text', array(
57
+ 'label' => Mage::helper('gallery')->__('Url key'),
58
+ 'required' => false,
59
+ 'name' => 'url_key',
60
+ ));
61
+ $fieldset->addField('status', 'select', array(
62
+ 'label' => Mage::helper('gallery')->__('Status'),
63
+ 'name' => 'status',
64
+ 'values' => array(
65
+ array(
66
+ 'value' => 1,
67
+ 'label' => Mage::helper('gallery')->__('Enabled'),
68
+ ),
69
+
70
+ array(
71
+ 'value' => 2,
72
+ 'label' => Mage::helper('gallery')->__('Disabled'),
73
+ ),
74
+ ),
75
+ ));
76
+
77
+ $fieldset->addField('order', 'text', array(
78
+ 'label' => Mage::helper('gallery')->__('Order'),
79
+ 'class' => 'validate-zero-or-greater input-text validation-failed',
80
+ 'required' => false,
81
+ 'name' => 'order',
82
+ ));
83
+ $fieldset->addField('content', 'editor', array(
84
+ 'name' => 'content',
85
+ 'label' => Mage::helper('gallery')->__('Description'),
86
+ 'title' => Mage::helper('gallery')->__('Description'),
87
+ 'style' => 'width:700px; height:200px;',
88
+ 'wysiwyg' => false,
89
+ ));
90
+ $fieldset->addField('url_rewrite_id', 'hidden', array(
91
+ 'name' => 'url_rewrite_id',
92
+ ));
93
+ if ( Mage::getSingleton('adminhtml/session')->getGalleryData() )
94
+ {
95
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getGalleryData());
96
+ Mage::getSingleton('adminhtml/session')->setGalleryData(null);
97
+ } elseif ( Mage::registry('album_data') ) {
98
+ $form->setValues(Mage::registry('album_data')->getData());
99
+ }
100
+ return parent::_prepareForm();
101
+ }
102
+ }
app/code/local/Padoo/Gallery/Block/Admin/Album/Edit/Tabs.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Album_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
21
+ {
22
+
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+ $this->setId('album_tabs');
27
+ $this->setDestElementId('edit_form');
28
+ $this->setTitle(Mage::helper('gallery')->__('Album Information'));
29
+ }
30
+
31
+ protected function _beforeToHtml()
32
+ {
33
+ $this->addTab('form_section', array(
34
+ 'label' => Mage::helper('gallery')->__('Album Information'),
35
+ 'title' => Mage::helper('gallery')->__('Album Information'),
36
+ 'content' => $this->getLayout()->createBlock('gallery/admin_album_edit_tab_form')->toHtml(),
37
+ ));
38
+
39
+ return parent::_beforeToHtml();
40
+ }
41
+ }
app/code/local/Padoo/Gallery/Block/Admin/Album/Grid.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Album_Grid extends Mage_Adminhtml_Block_Widget_Grid
21
+ {
22
+ public function __construct()
23
+ {
24
+ parent::__construct();
25
+ $this->setId('albumGrid');
26
+ $this->setDefaultSort('album_id');
27
+ $this->setDefaultDir('ASC');
28
+ $this->setSaveParametersInSession(true);
29
+ $this->setTemplate('gallery/grid.phtml');
30
+ }
31
+
32
+ protected function _prepareCollection()
33
+ {
34
+ $collection = Mage::getModel('gallery/album')->getCollection();
35
+ $store = $this->_getStore();
36
+ if ($store->getId()) {
37
+ $collection->addStoreFilter($store);
38
+ }
39
+ $this->setCollection($collection);
40
+ return parent::_prepareCollection();
41
+ }
42
+ protected function _getStore()
43
+ {
44
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
45
+ return Mage::app()->getStore($storeId);
46
+ }
47
+ protected function _prepareColumns()
48
+ {
49
+ $this->addColumn('album_id', array(
50
+ 'header' => Mage::helper('gallery')->__('ID'),
51
+ 'align' =>'right',
52
+ 'width' => '50px',
53
+ 'index' => 'album_id',
54
+ ));
55
+ $this->addColumn('filename', array(
56
+ 'header' => Mage::helper('gallery')->__('Thumbnail'),
57
+ 'align' =>'left',
58
+ 'index' => 'filename',
59
+ 'width' => '100px',
60
+ ));
61
+ $this->addColumn('title', array(
62
+ 'header' => Mage::helper('gallery')->__('Album'),
63
+ 'align' =>'left',
64
+ 'index' => 'title',
65
+ ));
66
+
67
+ $this->addColumn('order', array(
68
+ 'header' => Mage::helper('gallery')->__('Order'),
69
+ 'align' =>'left',
70
+ 'index' => 'order',
71
+ 'width' => '120px',
72
+ ));
73
+
74
+ $this->addColumn('status', array(
75
+ 'header' => Mage::helper('gallery')->__('Status'),
76
+ 'align' => 'left',
77
+ 'width' => '80px',
78
+ 'index' => 'status',
79
+ 'type' => 'options',
80
+ 'options' => array(
81
+ 1 => 'Enabled',
82
+ 2 => 'Disabled',
83
+ ),
84
+ ));
85
+
86
+ $this->addColumn('action',
87
+ array(
88
+ 'header' => Mage::helper('gallery')->__('Action'),
89
+ 'width' => '100',
90
+ 'type' => 'action',
91
+ 'getter' => 'getId',
92
+ 'actions' => array(
93
+ array(
94
+ 'caption' => Mage::helper('gallery')->__('Edit'),
95
+ 'url' => array('base'=> '*/*/edit'),
96
+ 'field' => 'id'
97
+ )
98
+ ),
99
+ 'filter' => false,
100
+ 'sortable' => false,
101
+ 'index' => 'stores',
102
+ 'is_system' => true,
103
+ ));
104
+
105
+ $this->addExportType('*/*/exportCsv', Mage::helper('gallery')->__('CSV'));
106
+ $this->addExportType('*/*/exportXml', Mage::helper('gallery')->__('XML'));
107
+
108
+ return parent::_prepareColumns();
109
+ }
110
+
111
+ protected function _prepareMassaction()
112
+ {
113
+ $this->setMassactionIdField('album_id');
114
+ $this->getMassactionBlock()->setFormFieldName('album');
115
+
116
+ $this->getMassactionBlock()->addItem('delete', array(
117
+ 'label' => Mage::helper('gallery')->__('Delete'),
118
+ 'url' => $this->getUrl('*/*/massDelete'),
119
+ 'confirm' => Mage::helper('gallery')->__('Are you sure?')
120
+ ));
121
+
122
+ $statuses = Mage::getSingleton('gallery/status')->getOptionArray();
123
+
124
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
125
+ $this->getMassactionBlock()->addItem('status', array(
126
+ 'label'=> Mage::helper('gallery')->__('Change status'),
127
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
128
+ 'additional' => array(
129
+ 'visibility' => array(
130
+ 'name' => 'status',
131
+ 'type' => 'select',
132
+ 'class' => 'required-entry',
133
+ 'label' => Mage::helper('gallery')->__('Status'),
134
+ 'values' => $statuses
135
+ )
136
+ )
137
+ ));
138
+ return $this;
139
+ }
140
+
141
+ public function getRowUrl($row)
142
+ {
143
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
144
+ }
145
+
146
+ public function getThumbnailSize()
147
+ {
148
+ $size = trim(Mage::getStoreConfig('gallery/info/backend_thumbnail_size'),' ');
149
+ $tmp = explode('-',$size);
150
+ if(sizeof($tmp)==2)
151
+ return array('width'=>is_numeric($tmp[0])?$tmp[0]:85,'height'=>is_numeric($tmp[1])?$tmp[1]:65);
152
+ return array('width'=>85,'height'=>65);
153
+ }
154
+ }
app/code/local/Padoo/Gallery/Block/Admin/Gallery.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Gallery extends Mage_Adminhtml_Block_Widget_Grid_Container
21
+ {
22
+ public function __construct()
23
+ {
24
+ $this->_controller = 'admin_gallery';
25
+ $this->_blockGroup = 'gallery';
26
+ $this->_headerText = Mage::helper('gallery')->__('Photo Manager');
27
+ $this->_addButtonLabel = Mage::helper('gallery')->__('Add Photo');
28
+ $this->_addButton('sort', array(
29
+ 'label' => Mage::helper('gallery')->__('Save order'),
30
+ 'onclick' => 'saveSort();',
31
+ 'class' => 'button',
32
+ ));
33
+ parent::__construct();
34
+ }
35
+ }
app/code/local/Padoo/Gallery/Block/Admin/Gallery/Edit.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Gallery_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
21
+ {
22
+ public function __construct()
23
+ {
24
+ parent::__construct();
25
+
26
+ $this->_objectId = 'id';
27
+ $this->_blockGroup = 'gallery';
28
+ $this->_controller = 'admin_gallery';
29
+
30
+ $this->_updateButton('save', 'label', Mage::helper('gallery')->__('Save Photo'));
31
+ $this->_updateButton('delete', 'label', Mage::helper('gallery')->__('Delete Photo'));
32
+
33
+ $this->_addButton('saveandcontinue', array(
34
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
35
+ 'onclick' => 'saveAndContinueEdit()',
36
+ 'class' => 'save',
37
+ ), -100);
38
+
39
+ $this->_formScripts[] = "
40
+ function toggleEditor() {
41
+ if (tinyMCE.getInstanceById('gallery_content') == null) {
42
+ tinyMCE.execCommand('mceAddControl', false, 'gallery_content');
43
+ } else {
44
+ tinyMCE.execCommand('mceRemoveControl', false, 'gallery_content');
45
+ }
46
+ }
47
+
48
+ function saveAndContinueEdit(){
49
+ editForm.submit($('edit_form').action+'back/edit/');
50
+ }
51
+ ";
52
+ }
53
+
54
+ public function getHeaderText()
55
+ {
56
+ if( Mage::registry('gallery_data') && Mage::registry('gallery_data')->getId() ) {
57
+ return Mage::helper('gallery')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('gallery_data')->getTitle()));
58
+ } else {
59
+ return Mage::helper('gallery')->__('Add Item');
60
+ }
61
+ }
62
+ }
app/code/local/Padoo/Gallery/Block/Admin/Gallery/Edit/Form.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Gallery_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
21
+ {
22
+ protected function _prepareForm()
23
+ {
24
+ $form = new Varien_Data_Form(array(
25
+ 'id' => 'edit_form',
26
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
27
+ 'method' => 'post',
28
+ 'enctype' => 'multipart/form-data'
29
+ )
30
+ );
31
+
32
+ $form->setUseContainer(true);
33
+ $this->setForm($form);
34
+ return parent::_prepareForm();
35
+ }
36
+ }
app/code/local/Padoo/Gallery/Block/Admin/Gallery/Edit/Tab/Form.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Gallery_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
21
+ {
22
+ protected function _prepareForm()
23
+ {
24
+ $form = new Varien_Data_Form();
25
+ $this->setForm($form);
26
+ $fieldset = $form->addFieldset('gallery_form', array('legend'=>Mage::helper('gallery')->__('Photo information')));
27
+
28
+ $albums = array(array('value' => '', 'label' => 'Select an Album'));
29
+ $collection = Mage::getModel('gallery/album')->getCollection();
30
+ foreach ($collection as $album) {
31
+ $albums[] = array('value' => $album->getId(), 'label' => $album->getTitle());
32
+ }
33
+
34
+ $fieldset->addField('album_id', 'select', array(
35
+ 'label' => Mage::helper('gallery')->__('Album'),
36
+ 'name' => 'album_id',
37
+ 'required' => true,
38
+ 'values' => $albums,
39
+ ));
40
+
41
+ if (!Mage::app()->isSingleStoreMode()) {
42
+ $fieldset->addField('store_id', 'multiselect', array(
43
+ 'name' => 'stores[]',
44
+ 'label' => Mage::helper('gallery')->__('Store View'),
45
+ 'title' => Mage::helper('gallery')->__('Store View'),
46
+ 'required' => true,
47
+ 'values' => Mage::getSingleton('adminhtml/system_store')
48
+ ->getStoreValuesForForm(false, true),
49
+ ));
50
+ }
51
+ else {
52
+ $fieldset->addField('store_id', 'hidden', array(
53
+ 'name' => 'stores[]',
54
+ 'value' => Mage::app()->getStore(true)->getId()
55
+ ));
56
+ }
57
+
58
+ $fieldset->addField('title', 'text', array(
59
+ 'label' => Mage::helper('gallery')->__('Title'),
60
+ 'class' => 'required-entry',
61
+ 'required' => true,
62
+ 'name' => 'title',
63
+ ));
64
+
65
+ $fieldset->addField('filename', 'image', array(
66
+ 'label' => Mage::helper('gallery')->__('File'),
67
+ 'required' => true,
68
+ 'name' => 'filename',
69
+ ));
70
+ /* $fieldset->addField('url_key', 'text', array(
71
+ 'label' => Mage::helper('gallery')->__('Url key'),
72
+ 'required' => false,
73
+ 'name' => 'url_key',
74
+ ));*/
75
+ $fieldset->addField('status', 'select', array(
76
+ 'label' => Mage::helper('gallery')->__('Status'),
77
+ 'name' => 'status',
78
+ 'values' => array(
79
+ array(
80
+ 'value' => 1,
81
+ 'label' => Mage::helper('gallery')->__('Enabled'),
82
+ ),
83
+
84
+ array(
85
+ 'value' => 2,
86
+ 'label' => Mage::helper('gallery')->__('Disabled'),
87
+ ),
88
+ ),
89
+ ));
90
+
91
+ $fieldset->addField('order', 'text', array(
92
+ 'label' => Mage::helper('gallery')->__('Order'),
93
+ 'class' => 'validate-zero-or-greater input-text validation-failed',
94
+ 'required' => false,
95
+ 'name' => 'order',
96
+ ));
97
+ $fieldset->addField('content', 'editor', array(
98
+ 'name' => 'content',
99
+ 'label' => Mage::helper('gallery')->__('Content'),
100
+ 'title' => Mage::helper('gallery')->__('Content'),
101
+ 'style' => 'width:700px; height:200px;',
102
+ 'wysiwyg' => false
103
+ ));
104
+ if ( Mage::getSingleton('adminhtml/session')->getGalleryData() )
105
+ {
106
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getGalleryData());
107
+ Mage::getSingleton('adminhtml/session')->setGalleryData(null);
108
+ } elseif ( Mage::registry('gallery_data') ) {
109
+ $form->setValues(Mage::registry('gallery_data')->getData());
110
+ }
111
+ return parent::_prepareForm();
112
+ }
113
+ }
app/code/local/Padoo/Gallery/Block/Admin/Gallery/Edit/Tabs.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Gallery_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
21
+ {
22
+
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+ $this->setId('gallery_tabs');
27
+ $this->setDestElementId('edit_form');
28
+ $this->setTitle(Mage::helper('gallery')->__('Photo Information'));
29
+ }
30
+
31
+ protected function _beforeToHtml()
32
+ {
33
+ $this->addTab('form_section', array(
34
+ 'label' => Mage::helper('gallery')->__('Photo Information'),
35
+ 'title' => Mage::helper('gallery')->__('Photo Information'),
36
+ 'content' => $this->getLayout()->createBlock('gallery/admin_gallery_edit_tab_form')->toHtml(),
37
+ ));
38
+
39
+ return parent::_beforeToHtml();
40
+ }
41
+ }
app/code/local/Padoo/Gallery/Block/Admin/Gallery/Grid.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Gallery_Grid extends Mage_Adminhtml_Block_Widget_Grid
21
+ {
22
+ public function __construct()
23
+ {
24
+ parent::__construct();
25
+ $this->setId('galleryGrid');
26
+ $this->setDefaultSort('gallery_id');
27
+ $this->setDefaultDir('ASC');
28
+ $this->setSaveParametersInSession(true);
29
+ $this->setTemplate('gallery/grid.phtml');
30
+ }
31
+
32
+ protected function _prepareCollection()
33
+ {
34
+ $collection = Mage::getModel('gallery/gallery')->getCollection();
35
+ $this->setCollection($collection);
36
+ return parent::_prepareCollection();
37
+ }
38
+
39
+ protected function _prepareColumns()
40
+ {
41
+ $this->addColumn('gallery_id', array(
42
+ 'header' => Mage::helper('gallery')->__('ID'),
43
+ 'align' =>'right',
44
+ 'width' => '50px',
45
+ 'index' => 'gallery_id',
46
+ ));
47
+ $this->addColumn('filename', array(
48
+ 'header' => Mage::helper('gallery')->__('Thumbnail'),
49
+ 'align' =>'left',
50
+ 'index' => 'filename',
51
+ 'width' => '100px',
52
+ ));
53
+ $this->addColumn('title', array(
54
+ 'header' => Mage::helper('gallery')->__('Title'),
55
+ 'align' =>'left',
56
+ 'index' => 'title',
57
+ ));
58
+
59
+ $albums = array();
60
+ $collection = Mage::getModel('gallery/album')->getCollection();
61
+ foreach ($collection as $album) {
62
+ $albums[$album->getId()] = $album->getTitle();
63
+ }
64
+
65
+ $this->addColumn('album_id', array(
66
+ 'header' => Mage::helper('gallery')->__('Album'),
67
+ 'align' =>'left',
68
+ 'width' => '100px',
69
+ 'index' => 'album_id',
70
+ 'type' => 'options',
71
+ 'options' => $albums,
72
+ ));
73
+ $this->addColumn('order', array(
74
+ 'header' => Mage::helper('gallery')->__('Order'),
75
+ 'align' =>'left',
76
+ 'index' => 'order',
77
+ 'width' => '80px',
78
+ ));
79
+ /*
80
+ $this->addColumn('content', array(
81
+ 'header' => Mage::helper('gallery')->__('Item Content'),
82
+ 'width' => '150px',
83
+ 'index' => 'content',
84
+ ));
85
+ */
86
+
87
+ $this->addColumn('status', array(
88
+ 'header' => Mage::helper('gallery')->__('Status'),
89
+ 'align' => 'left',
90
+ 'width' => '80px',
91
+ 'index' => 'status',
92
+ 'type' => 'options',
93
+ 'options' => array(
94
+ 1 => 'Enabled',
95
+ 2 => 'Disabled',
96
+ ),
97
+ ));
98
+
99
+ $this->addColumn('action',
100
+ array(
101
+ 'header' => Mage::helper('gallery')->__('Action'),
102
+ 'width' => '100',
103
+ 'type' => 'action',
104
+ 'getter' => 'getId',
105
+ 'actions' => array(
106
+ array(
107
+ 'caption' => Mage::helper('gallery')->__('Edit'),
108
+ 'url' => array('base'=> '*/*/edit'),
109
+ 'field' => 'id'
110
+ )
111
+ ),
112
+ 'filter' => false,
113
+ 'sortable' => false,
114
+ 'index' => 'stores',
115
+ 'is_system' => true,
116
+ ));
117
+
118
+ $this->addExportType('*/*/exportCsv', Mage::helper('gallery')->__('CSV'));
119
+ $this->addExportType('*/*/exportXml', Mage::helper('gallery')->__('XML'));
120
+
121
+ return parent::_prepareColumns();
122
+ }
123
+
124
+ protected function _prepareMassaction()
125
+ {
126
+ $this->setMassactionIdField('gallery_id');
127
+ $this->getMassactionBlock()->setFormFieldName('gallery');
128
+
129
+ $this->getMassactionBlock()->addItem('delete', array(
130
+ 'label' => Mage::helper('gallery')->__('Delete'),
131
+ 'url' => $this->getUrl('*/*/massDelete'),
132
+ 'confirm' => Mage::helper('gallery')->__('Are you sure?')
133
+ ));
134
+
135
+ $statuses = Mage::getSingleton('gallery/status')->getOptionArray();
136
+
137
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
138
+ $this->getMassactionBlock()->addItem('status', array(
139
+ 'label'=> Mage::helper('gallery')->__('Change status'),
140
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
141
+ 'additional' => array(
142
+ 'visibility' => array(
143
+ 'name' => 'status',
144
+ 'type' => 'select',
145
+ 'class' => 'required-entry',
146
+ 'label' => Mage::helper('gallery')->__('Status'),
147
+ 'values' => $statuses
148
+ )
149
+ )
150
+ ));
151
+ return $this;
152
+ }
153
+
154
+ public function getRowUrl($row)
155
+ {
156
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
157
+ }
158
+ public function getThumbnailSize()
159
+ {
160
+ $size = trim(Mage::getStoreConfig('gallery/info/backend_thumbnail_size'),' ');
161
+ $tmp = explode('-',$size);
162
+ if(sizeof($tmp)==2)
163
+ return array('width'=>is_numeric($tmp[0])?$tmp[0]:85,'height'=>is_numeric($tmp[1])?$tmp[1]:65);
164
+ return array('width'=>85,'height'=>65);
165
+ }
166
+ }
app/code/local/Padoo/Gallery/Block/Admin/Review.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Review extends Mage_Adminhtml_Block_Widget_Grid_Container
21
+ {
22
+ public function __construct()
23
+ {
24
+ $this->_controller = 'admin_review';
25
+ $this->_blockGroup = 'gallery';
26
+ $this->_headerText = Mage::helper('gallery')->__('Review Manager');
27
+ $this->_addButtonLabel = Mage::helper('gallery')->__('Add Review');
28
+ parent::__construct();
29
+ }
30
+ }
app/code/local/Padoo/Gallery/Block/Admin/Review/Edit.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Review_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
21
+ {
22
+ public function __construct()
23
+ {
24
+ parent::__construct();
25
+
26
+ $this->_objectId = 'id';
27
+ $this->_blockGroup = 'gallery';
28
+ $this->_controller = 'admin_review';
29
+
30
+ $this->_updateButton('save', 'label', Mage::helper('gallery')->__('Save Review'));
31
+ $this->_updateButton('delete', 'label', Mage::helper('gallery')->__('Delete Review'));
32
+
33
+ $this->_addButton('saveandcontinue', array(
34
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
35
+ 'onclick' => 'saveAndContinueEdit()',
36
+ 'class' => 'save',
37
+ ), -100);
38
+
39
+ $this->_formScripts[] = "
40
+ function toggleEditor() {
41
+ if (tinyMCE.getInstanceById('gallery_content') == null) {
42
+ tinyMCE.execCommand('mceAddControl', false, 'review_content');
43
+ } else {
44
+ tinyMCE.execCommand('mceRemoveControl', false, 'review_content');
45
+ }
46
+ }
47
+
48
+ function saveAndContinueEdit(){
49
+ editForm.submit($('edit_form').action+'back/edit/');
50
+ }
51
+ ";
52
+ }
53
+
54
+ public function getHeaderText()
55
+ {
56
+ if( Mage::registry('review_data') && Mage::registry('review_data')->getId() ) {
57
+ return Mage::helper('gallery')->__("Edit Review");
58
+ } else {
59
+ return Mage::helper('gallery')->__('Add Review');
60
+ }
61
+ }
62
+ }
app/code/local/Padoo/Gallery/Block/Admin/Review/Edit/Form.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Review_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
21
+ {
22
+ protected function _prepareForm()
23
+ {
24
+ $form = new Varien_Data_Form(array(
25
+ 'id' => 'edit_form',
26
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
27
+ 'method' => 'post',
28
+ 'enctype' => 'multipart/form-data'
29
+ )
30
+ );
31
+
32
+ $form->setUseContainer(true);
33
+ $this->setForm($form);
34
+ return parent::_prepareForm();
35
+ }
36
+ }
app/code/local/Padoo/Gallery/Block/Admin/Review/Edit/Tab/Form.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Review_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
21
+ {
22
+ protected function _prepareForm()
23
+ {
24
+ $form = new Varien_Data_Form();
25
+ $this->setForm($form);
26
+ $fieldset = $form->addFieldset('review_form', array('legend'=>Mage::helper('gallery')->__('Review information')));
27
+
28
+ $gallerys = array(array('value' => '', 'label' => 'Select an photo'));
29
+ $collection = Mage::getModel('gallery/gallery')->getCollection();
30
+ foreach ($collection as $album) {
31
+ $gallerys[] = array('value' => $album->getId(), 'label' => $album->getTitle());
32
+ }
33
+
34
+ $fieldset->addField('review_name', 'text', array(
35
+ 'label' => Mage::helper('gallery')->__('Name'),
36
+ 'class' => 'required-entry',
37
+ 'required' => true,
38
+ 'name' => 'review_name',
39
+ ));
40
+
41
+ $fieldset->addField('review_email', 'text', array(
42
+ 'label' => Mage::helper('gallery')->__('Email'),
43
+ 'class' => 'required-entry',
44
+ 'required' => true,
45
+ 'name' => 'review_email',
46
+ ));
47
+
48
+ $fieldset->addField('gallery_id', 'select', array(
49
+ 'label' => Mage::helper('gallery')->__('Photo'),
50
+ 'name' => 'gallery_id',
51
+ 'required' => true,
52
+ 'values' => $gallerys,
53
+ ));
54
+
55
+
56
+ $fieldset->addField('review_content', 'editor', array(
57
+ 'name' => 'review_content',
58
+ 'label' => Mage::helper('gallery')->__('Content'),
59
+ 'title' => Mage::helper('gallery')->__('Content'),
60
+ 'style' => 'width:700px; height:200px;',
61
+ 'wysiwyg' => false
62
+ ));
63
+
64
+ /* $fieldset->addField('url_key', 'text', array(
65
+ 'label' => Mage::helper('gallery')->__('Url key'),
66
+ 'required' => false,
67
+ 'name' => 'url_key',
68
+ ));*/
69
+ $fieldset->addField('review_rate', 'select', array(
70
+ 'label' => Mage::helper('gallery')->__('Rate'),
71
+ 'name' => 'review_rate',
72
+ 'values' => array(
73
+ array(
74
+ 'value' => 1,
75
+ 'label' => Mage::helper('gallery')->__('1'),
76
+ ),
77
+ array(
78
+ 'value' => 2,
79
+ 'label' => Mage::helper('gallery')->__('2'),
80
+ ),
81
+ array(
82
+ 'value' => 3,
83
+ 'label' => Mage::helper('gallery')->__('3'),
84
+ ),
85
+ array(
86
+ 'value' => 4,
87
+ 'label' => Mage::helper('gallery')->__('4'),
88
+ ),
89
+ array(
90
+ 'value' => 5,
91
+ 'label' => Mage::helper('gallery')->__('5'),
92
+ ),
93
+ ),
94
+ ));
95
+ $fieldset->addField('status', 'select', array(
96
+ 'label' => Mage::helper('gallery')->__('Status'),
97
+ 'name' => 'status',
98
+ 'values' => array(
99
+ array(
100
+ 'value' => 1,
101
+ 'label' => Mage::helper('gallery')->__('Enabled'),
102
+ ),
103
+
104
+ array(
105
+ 'value' => 2,
106
+ 'label' => Mage::helper('gallery')->__('Disabled'),
107
+ ),
108
+ ),
109
+ ));
110
+
111
+ $fieldset->addField('order', 'text', array(
112
+ 'label' => Mage::helper('gallery')->__('Order'),
113
+ 'class' => 'validate-zero-or-greater input-text validation-failed',
114
+ 'required' => false,
115
+ 'name' => 'order',
116
+ ));
117
+ if ( Mage::getSingleton('adminhtml/session')->getReviewData() )
118
+ {
119
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getReviewData());
120
+ Mage::getSingleton('adminhtml/session')->setReviewData(null);
121
+ } elseif ( Mage::registry('review_data') ) {
122
+ $form->setValues(Mage::registry('review_data')->getData());
123
+ }
124
+ return parent::_prepareForm();
125
+ }
126
+ }
app/code/local/Padoo/Gallery/Block/Admin/Review/Edit/Tabs.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Review_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
21
+ {
22
+
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+ $this->setId('review_tabs');
27
+ $this->setDestElementId('edit_form');
28
+ $this->setTitle(Mage::helper('gallery')->__('Review Information'));
29
+ }
30
+
31
+ protected function _beforeToHtml()
32
+ {
33
+ $this->addTab('form_section', array(
34
+ 'label' => Mage::helper('gallery')->__('Review Information'),
35
+ 'title' => Mage::helper('gallery')->__('Review Information'),
36
+ 'content' => $this->getLayout()->createBlock('gallery/admin_review_edit_tab_form')->toHtml(),
37
+ ));
38
+
39
+ return parent::_beforeToHtml();
40
+ }
41
+ }
app/code/local/Padoo/Gallery/Block/Admin/Review/Grid.php ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Admin_Review_Grid extends Mage_Adminhtml_Block_Widget_Grid
21
+ {
22
+ public function __construct()
23
+ {
24
+ parent::__construct();
25
+ $this->setId('reviewGrid');
26
+ $this->setDefaultSort('review_id');
27
+ $this->setDefaultDir('ASC');
28
+ $this->setSaveParametersInSession(true);
29
+ $this->setTemplate('gallery/grid.phtml');
30
+ }
31
+
32
+ protected function _prepareCollection()
33
+ {
34
+ $collection = Mage::getModel('gallery/review')->getCollection();
35
+ $this->setCollection($collection);
36
+ return parent::_prepareCollection();
37
+ }
38
+
39
+ protected function _prepareColumns()
40
+ {
41
+ $this->addColumn('review_id', array(
42
+ 'header' => Mage::helper('gallery')->__('ID'),
43
+ 'align' =>'right',
44
+ 'width' => '50px',
45
+ 'index' => 'review_id',
46
+ ));
47
+ $this->addColumn('review_name', array(
48
+ 'header' => Mage::helper('gallery')->__('Name'),
49
+ 'align' =>'left',
50
+ 'index' => 'review_name',
51
+ 'width' => '100px',
52
+ ));
53
+ $this->addColumn('review_email', array(
54
+ 'header' => Mage::helper('gallery')->__('Email'),
55
+ 'align' =>'left',
56
+ 'index' => 'review_email',
57
+ ));
58
+
59
+ $gallerys = array();
60
+ $collection = Mage::getModel('gallery/gallery')->getCollection();
61
+ foreach ($collection as $gallery) {
62
+ $gallerys[$gallery->getId()] = $gallery->getTitle();
63
+ }
64
+
65
+ $this->addColumn('gallery_id', array(
66
+ 'header' => Mage::helper('gallery')->__('Photo'),
67
+ 'align' =>'left',
68
+ 'width' => '100px',
69
+ 'index' => 'gallery_id',
70
+ 'type' => 'options',
71
+ 'options' => $gallerys,
72
+ ));
73
+ $this->addColumn('review_rate', array(
74
+ 'header' => Mage::helper('gallery')->__('Rate'),
75
+ 'align' => 'left',
76
+ 'width' => '80px',
77
+ 'index' => 'review_rate',
78
+ 'type' => 'options',
79
+ 'options' => array(
80
+ 1 => '1',
81
+ 2 => '2',
82
+ 3 => '3',
83
+ 4 => '4',
84
+ 5 => '5',
85
+ ),
86
+ ));
87
+ $this->addColumn('order', array(
88
+ 'header' => Mage::helper('gallery')->__('Order'),
89
+ 'align' =>'left',
90
+ 'index' => 'order',
91
+ 'width' => '80px',
92
+ ));
93
+ /*
94
+ $this->addColumn('content', array(
95
+ 'header' => Mage::helper('gallery')->__('Item Content'),
96
+ 'width' => '150px',
97
+ 'index' => 'content',
98
+ ));
99
+ */
100
+
101
+ $this->addColumn('status', array(
102
+ 'header' => Mage::helper('gallery')->__('Status'),
103
+ 'align' => 'left',
104
+ 'width' => '80px',
105
+ 'index' => 'status',
106
+ 'type' => 'options',
107
+ 'options' => array(
108
+ 1 => 'Enabled',
109
+ 2 => 'Disabled',
110
+ ),
111
+ ));
112
+
113
+ $this->addColumn('action',
114
+ array(
115
+ 'header' => Mage::helper('gallery')->__('Action'),
116
+ 'width' => '100',
117
+ 'type' => 'action',
118
+ 'getter' => 'getId',
119
+ 'actions' => array(
120
+ array(
121
+ 'caption' => Mage::helper('gallery')->__('Edit'),
122
+ 'url' => array('base'=> '*/*/edit'),
123
+ 'field' => 'id'
124
+ )
125
+ ),
126
+ 'filter' => false,
127
+ 'sortable' => false,
128
+ 'index' => 'stores',
129
+ 'is_system' => true,
130
+ ));
131
+
132
+ $this->addExportType('*/*/exportCsv', Mage::helper('gallery')->__('CSV'));
133
+ $this->addExportType('*/*/exportXml', Mage::helper('gallery')->__('XML'));
134
+
135
+ return parent::_prepareColumns();
136
+ }
137
+
138
+ protected function _prepareMassaction()
139
+ {
140
+ $this->setMassactionIdField('gallery_id');
141
+ $this->getMassactionBlock()->setFormFieldName('gallery');
142
+
143
+ $this->getMassactionBlock()->addItem('delete', array(
144
+ 'label' => Mage::helper('gallery')->__('Delete'),
145
+ 'url' => $this->getUrl('*/*/massDelete'),
146
+ 'confirm' => Mage::helper('gallery')->__('Are you sure?')
147
+ ));
148
+
149
+ $statuses = Mage::getSingleton('gallery/status')->getOptionArray();
150
+
151
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
152
+ $this->getMassactionBlock()->addItem('status', array(
153
+ 'label'=> Mage::helper('gallery')->__('Change status'),
154
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
155
+ 'additional' => array(
156
+ 'visibility' => array(
157
+ 'name' => 'status',
158
+ 'type' => 'select',
159
+ 'class' => 'required-entry',
160
+ 'label' => Mage::helper('gallery')->__('Status'),
161
+ 'values' => $statuses
162
+ )
163
+ )
164
+ ));
165
+ return $this;
166
+ }
167
+
168
+ public function getRowUrl($row)
169
+ {
170
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
171
+ }
172
+ public function getThumbnailSize()
173
+ {
174
+ $size = trim(Mage::getStoreConfig('gallery/info/backend_thumbnail_size'),' ');
175
+ $tmp = explode('-',$size);
176
+ if(sizeof($tmp)==2)
177
+ return array('width'=>is_numeric($tmp[0])?$tmp[0]:85,'height'=>is_numeric($tmp[1])?$tmp[1]:65);
178
+ return array('width'=>85,'height'=>65);
179
+ }
180
+ }
app/code/local/Padoo/Gallery/Block/Ajax.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Ajax extends Mage_Core_Block_Template{
21
+
22
+ public function checkEmailDuplicationAjax()
23
+ {
24
+ return $this->helper('gallery')->checkEmailDuplicationAjaxUrl();
25
+ }
26
+ }
app/code/local/Padoo/Gallery/Block/Album.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Album extends Mage_Core_Block_Template
21
+ {
22
+ protected $_banner = false;
23
+
24
+ public function _prepareLayout()
25
+ {
26
+ return parent::_prepareLayout();
27
+ }
28
+
29
+ public function getAlbum()
30
+ {
31
+ if (!$this->_album) {
32
+ $album_id = $this->getAlbumId();
33
+ if ($album_id) {
34
+ $album = Mage::getModel('gallery/album')->load($album_id);
35
+ if ($album->getId()==0) {
36
+ $album = Mage::getModel('gallery/album')->load($album_id, 'identifier');
37
+ }
38
+ $this->_album = $album;
39
+ }
40
+ }
41
+ return $this->_album;
42
+ }
43
+
44
+ public function getPhotos() {
45
+ $album = $this->getAlbum();
46
+ if($album){
47
+ $show_total = $this->getShowTotal() ? $this->getShowTotal():3;
48
+ $collection = Mage::getModel('gallery/gallery')->getCollection()
49
+ ->addFieldToFilter('status', true)
50
+ ->addFieldToFilter('album_id', $album->getAlbumId())
51
+ ->addOrder('order','ASC')
52
+ ->setPageSize($show_total);
53
+ if($collection->count()>0){
54
+ return $collection;
55
+ }
56
+ }
57
+ return false;
58
+ }
59
+ }
app/code/local/Padoo/Gallery/Block/Detail.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Detail extends Mage_Core_Block_Template
21
+ {
22
+ protected $_banner = false;
23
+
24
+ public function _prepareLayout()
25
+ {
26
+ return parent::_prepareLayout();
27
+ }
28
+
29
+ public function getDetails(){
30
+ if (Mage::registry('gallery_detail')) return Mage::registry('gallery_detail');
31
+ }
32
+
33
+ /* public function getUrlRewrite(Mage_Core_Model_Abstract $obj){
34
+ $rewrite = Mage::getModel('core/url_rewrite')
35
+ ->load($obj->getUrlRewriteId());
36
+ return trim(Mage::getBaseUrl(),'/')."/". $rewrite->getRequest_path();
37
+ } */
38
+
39
+ public function getAlbumByGalleryId($album_id){
40
+ if ($album_id) {
41
+ $album = Mage::getModel('gallery/album')->load($album_id);
42
+ if ($album->getId()==0) {
43
+ $album = Mage::getModel('gallery/album')->load($album_id, 'identifier');
44
+ }
45
+ }
46
+ return $album;
47
+ }
48
+
49
+ public function getBreadcrumbs(){
50
+ $item = $this->getDetails();
51
+ $album = $this->getAlbumByGalleryId($item->getAlbumId());
52
+ $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
53
+ $breadcrumbs->addCrumb('home', array('label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Home Page'), 'link'=>Mage::getBaseUrl()));
54
+ $breadcrumbs->addCrumb('gallery', array('label'=>'gallery', 'title'=>'gallery', 'link'=>$this->getUrl('gallery')));
55
+ $breadcrumbs->addCrumb('album', array('label'=>$album->getTitle(), 'title'=>$album->getTitle(), 'link'=>$this->getUrl('gallery/view/album',array('id'=>$album->getAlbumId()))) );
56
+ $breadcrumbs->addCrumb('details', array('label'=>$item->getTitle(), 'title'=>$item->getTitle()));
57
+ return $this->getLayout()->getBlock('breadcrumbs')->toHtml();
58
+ }
59
+
60
+ public function getReviews(){
61
+ $item = $this->getDetails();
62
+ $collection = Mage::getResourceModel('gallery/review_collection');
63
+ $collection->getSelect()->where('status = ?', 1)->where('gallery_id = ?', $item->getGalleryId());
64
+ return $collection;
65
+ }
66
+
67
+ public function getTotalRates(){
68
+ $item = $this->getDetails();
69
+ $collection = Mage::getResourceModel('gallery/review_collection');
70
+ $collection->getSelect()->where('status = ?', 1)->where('gallery_id = ?', $item->getGalleryId());
71
+ $rate=0;
72
+ $arr = array();
73
+ if(count($collection)){
74
+ foreach($collection as $record){
75
+ $rate += $record->getReviewRate();
76
+ }
77
+ $arr['rate'] = ( $rate/ (count($collection)* 5) ) *100;
78
+ $arr['total'] = count($collection);
79
+ }
80
+ return $arr;
81
+ }
82
+
83
+
84
+ }
app/code/local/Padoo/Gallery/Block/Gallery.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Gallery extends Mage_Core_Block_Template
21
+ {
22
+ protected $_defaultToolbarBlock = 'gallery/page_pager';
23
+
24
+ public function _prepareLayout()
25
+ {
26
+ return parent::_prepareLayout();
27
+ }
28
+
29
+ public function getGallery()
30
+ {
31
+ if (!$this->hasData('gallery')) {
32
+ $this->setData('gallery', Mage::registry('gallery'));
33
+ }
34
+ return $this->getData('gallery','asc');
35
+
36
+ }
37
+
38
+ public function getNewAlbums()
39
+ {
40
+ $total = $this->getTotalAlbum();
41
+
42
+ $collection_new_album = Mage::getModel('gallery/album')->getCollection()
43
+ ->addOrder('album_id','DESC')
44
+ ->setPageSize($total);
45
+
46
+ return $collection_new_album;
47
+ }
48
+
49
+ public function getPhotos() {
50
+ $collection = Mage::getModel('gallery/gallery')->getCollection()->addOrder('`order`','ASC')->addFieldToFilter('status', true);
51
+ if (Mage::registry('current_album')) $collection->addFieldToFilter('album_id' , Mage::registry('current_album')->getId());
52
+ else if ($this->getData('album_id')) {
53
+ $collection->addFieldToFilter('album_id' , $this->getData('album_id'));
54
+ $album = Mage::getModel('gallery/album')->load($this->getData('album_id'));
55
+ if ($album) {
56
+ Mage::register('current_album', $album);
57
+ }
58
+ }
59
+ $collection
60
+ ->addOrder('gallery_id','DESC');
61
+
62
+ $currentPage = (int)$this->getRequest()->getParam('page');
63
+ if(!$currentPage){
64
+ $currentPage = 1;
65
+ }
66
+
67
+ $currentLimit = (int)$this->getRequest()->getParam('limit');
68
+ if(!$currentLimit){
69
+ $currentLimit = Mage::getStoreConfig('gallery/info/images_per_page_default_value') ? Mage::getStoreConfig('gallery/info/images_per_page_default_value'):4;
70
+ }
71
+
72
+ $collection->setPageSize($currentLimit);
73
+ $collection->setCurPage($currentPage);
74
+ $storeId = Mage::app()->getStore(true)->getId();
75
+ foreach ($collection as $record) {
76
+ $stores = $record->getStoreId();
77
+ if(!(strpos($stores,$storeId) !== false || strpos($stores,0) !== false || $stores == 0 )){
78
+ $collection->removeItemByKey($record->getId());
79
+ }
80
+ }
81
+ return $collection;
82
+ }
83
+
84
+ public function getCurrentAlbum() {
85
+ if (Mage::registry('current_album')) return Mage::registry('current_album');
86
+ }
87
+
88
+ public function getAlbums() {
89
+ $storeId = Mage::app()->getStore(true)->getId();
90
+ $collection = Mage::getModel('gallery/album')->getCollection()
91
+ ->addFieldToFilter('status', true)
92
+ ->addOrder('album_id', 'DESC');
93
+ $data = array();
94
+ foreach ($collection as $record) {
95
+ $stores = $record->getStoreId();
96
+ if(strpos($stores,$storeId) !== false || strpos($stores,0) !== false || $stores == 0 ){
97
+ $data[$record->getId()] = $record;
98
+ }
99
+ }
100
+ return $data;
101
+ }
102
+
103
+ public function getTotalAlbumValue()
104
+ {
105
+ return $this->getTotalAlbum();
106
+ }
107
+
108
+ public function getUrlRewrite(Mage_Core_Model_Abstract $obj){
109
+ $rewrite = Mage::getModel('core/url_rewrite')
110
+ ->load($obj->getUrlRewriteId());
111
+ return trim(Mage::getBaseUrl(),'/')."/". $rewrite->getRequest_path();
112
+ }
113
+
114
+ public function getBreadcrumbs(){
115
+ $ablbum = $this->getCurrentAlbum();
116
+ $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
117
+ $breadcrumbs->addCrumb('home', array('label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Home Page'), 'link'=>Mage::getBaseUrl()));
118
+ $breadcrumbs->addCrumb('gallery', array('label'=>'gallery', 'title'=>'gallery', 'link'=>$this->getUrl('gallery')));
119
+ $breadcrumbs->addCrumb('album', array('label'=>$ablbum->getTitle(), 'title'=>$ablbum->getTitle()));
120
+ return $this->getLayout()->getBlock('breadcrumbs')->toHtml();
121
+ }
122
+
123
+ public function getMode()
124
+ {
125
+ return $this->getChild('toolbar')->getCurrentMode();
126
+ }
127
+
128
+ protected function _beforeToHtml()
129
+ {
130
+ $toolbar = $this->getToolbarBlock();
131
+
132
+ // called prepare sortable parameters
133
+ $collection = $this->getPhotos();
134
+
135
+ // set collection to toolbar and apply sort
136
+ $toolbar->setCollection($collection);
137
+
138
+ $this->setChild('toolbar', $toolbar);
139
+
140
+ $this->getPhotos()->load();
141
+ return parent::_beforeToHtml();
142
+ }
143
+
144
+ public function getToolbarBlock()
145
+ {
146
+ $block = $this->getLayout()->createBlock($this->_defaultToolbarBlock, microtime());
147
+ return $block;
148
+ }
149
+
150
+ public function getToolbarHtml()
151
+ {
152
+ return $this->getChildHtml('toolbar');
153
+ }
154
+ }
app/code/local/Padoo/Gallery/Block/Page/Pager.php ADDED
@@ -0,0 +1,293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Page_Pager extends Mage_Core_Block_Template
21
+ {
22
+ protected $_collection = null;
23
+ protected $_pageVarName = 'page';
24
+ protected $_limitVarName = 'limit';
25
+ protected $_availableLimit = array(5=>5);
26
+ protected $_dispersion = 3;
27
+ protected $_displayPages = 5;
28
+ protected $_showPerPage = true;
29
+
30
+ protected function _construct()
31
+ {
32
+ parent::_construct();
33
+ $this->setTemplate('gallery/photo/pager.phtml');
34
+ }
35
+
36
+ public function getCurrentPage()
37
+ {
38
+ if ($page = (int) $this->getRequest()->getParam($this->getPageVarName())) {
39
+ return $page;
40
+ }
41
+ return 1;
42
+ }
43
+
44
+ public function getLimit()
45
+ {
46
+ $limits = $this->getAvailableLimit();
47
+ if ($limit = $this->getRequest()->getParam($this->getLimitVarName())) {
48
+ if (isset($limits[$limit])) {
49
+ return $limit;
50
+ }
51
+ }
52
+ $limits = array_keys($limits);
53
+ return Mage::getStoreConfig('gallery/info/images_per_page_default_value') ? Mage::getStoreConfig('gallery/info/images_per_page_default_value'):4;
54
+ }
55
+
56
+ public function setCollection($collection)
57
+ {
58
+ //var_dump($this->_collection); exit;
59
+ $this->_collection = $collection
60
+ ->setCurPage($this->getCurrentPage());
61
+ // If not int - then not limit
62
+ if ((int) $this->getLimit()) {
63
+ $this->_collection->setPageSize($this->getLimit());
64
+ }
65
+ return $this;
66
+ }
67
+
68
+ /**
69
+ * @return Mage_Core_Model_Mysql4_Collection_Abstract
70
+ */
71
+ public function getCollection()
72
+ {
73
+ //Mage_Core_Model_Mysql4_Collection_Abstract
74
+ return $this->_collection;
75
+ }
76
+
77
+ public function setPageVarName($varName)
78
+ {
79
+ $this->_pageVarName = $varName;
80
+ return $this;
81
+ }
82
+
83
+ public function getPageVarName()
84
+ {
85
+ return $this->_pageVarName;
86
+ }
87
+
88
+ public function setShowPerPage($varName)
89
+ {
90
+ $this->_showPerPage=$varName;
91
+ }
92
+
93
+ public function getShowPerPage()
94
+ {
95
+ if( Mage::getStoreConfig('gallery/info/enabled_pagination')){
96
+ if(sizeof($this->getAvailableLimit())<=1) {
97
+ return false;
98
+ }
99
+ return $this->_showPerPage;
100
+ }else{
101
+ return false;
102
+ }
103
+ }
104
+
105
+ public function setLimitVarName($varName)
106
+ {
107
+ $this->_limitVarName = $varName;
108
+ return $this;
109
+ }
110
+
111
+ public function getLimitVarName()
112
+ {
113
+ return $this->_limitVarName;
114
+ }
115
+
116
+ public function setAvailableLimit(array $limits)
117
+ {
118
+ $this->_availableLimit = array();
119
+ $limits = Mage::getStoreConfig('gallery/info/images_per_page_allowed') ? Mage::getStoreConfig('gallery/info/images_per_page_allowed'):'4,8,12';
120
+ $limits = explode(',',$limits);
121
+ foreach($limits as $limit){
122
+ if(is_numeric($limit)) { $this->_availableLimit[$limit] = $limit;}
123
+ }
124
+ // $this->_availableLimit = $limits;
125
+ }
126
+
127
+ public function getAvailableLimit()
128
+ {
129
+ $this->_availableLimit = array();
130
+ $limits = Mage::getStoreConfig('gallery/info/images_per_page_allowed') ? Mage::getStoreConfig('gallery/info/images_per_page_allowed'):'4,8,12';
131
+ $limits = explode(',',$limits);
132
+ foreach($limits as $limit){
133
+ $this->_availableLimit[$limit] = $limit;
134
+ }
135
+ return $this->_availableLimit;
136
+ }
137
+
138
+ public function getFirstNum()
139
+ {
140
+ $collection = $this->getCollection();
141
+ return $collection->getPageSize()*($collection->getCurPage()-1)+1;
142
+ }
143
+
144
+ public function getLastNum()
145
+ {
146
+ $collection = $this->getCollection();
147
+ return $collection->getPageSize()*($collection->getCurPage()-1)+$collection->count();
148
+ }
149
+
150
+ public function setKeyword($keyword){
151
+ $this->_searchWord = $keyword;
152
+ return $this;
153
+ }
154
+ public function getTotalNum()
155
+ {
156
+ $_keyword = $_GET['keyword'];
157
+ $albumId = $this->getRequest()->getParam('id');
158
+ $collection = Mage::getResourceModel('gallery/gallery_collection');
159
+ if(!empty($_keyword)){
160
+ $exceptstrangesign = preg_replace('#[^0-9a-z]+#i', ' ', $_keyword);
161
+ $inputarrayword= array();
162
+ $inputarrayword=explode(' ',$exceptstrangesign);
163
+ $where ="";
164
+ for($i=0;$i<count($inputarrayword);$i++)
165
+ {
166
+ $where .= "title like '%".$inputarrayword[$i]."%' OR content like '%".$inputarrayword[$i]."%' OR ";
167
+ /* $where .= "title like '%".$inputarrayword[$i]."%' OR "; */
168
+ }
169
+ $where = substr($where,0,strlen($where)-4);
170
+ $collection->getSelect()->where($where);
171
+ }else{
172
+ $collection->getSelect()->where('album_id = ?', $albumId);
173
+ }
174
+ $collection->getSelect()->where('status = ?', 1);
175
+ $storeId = Mage::app()->getStore(true)->getId();
176
+ $data = array();
177
+ foreach ($collection as $record) {
178
+ $stores = $record->getStoreId();
179
+ if(strpos($stores,$storeId) !== false || strpos($stores,0) !== false || $stores == 0 ){
180
+ $data[$record->getId()] = $record;
181
+ }
182
+ }
183
+ if($data){
184
+ return sizeof($data);
185
+ }else{
186
+ return 0;
187
+ }
188
+ }
189
+
190
+ public function isFirstPage()
191
+ {
192
+ return $this->getCollection()->getCurPage() == 1;
193
+ }
194
+
195
+ public function getLastPageNum()
196
+ {
197
+ return $this->getCollection()->getLastPageNumber();
198
+ }
199
+
200
+ public function isLastPage()
201
+ {
202
+ return $this->getCollection()->getCurPage() >= $this->getLastPageNum();
203
+ }
204
+
205
+ public function isLimitCurrent($limit)
206
+ {
207
+ return $limit == $this->getLimit();
208
+ }
209
+
210
+ public function isPageCurrent($page)
211
+ {
212
+ return $page == $this->getCurrentPage();
213
+ }
214
+
215
+ public function getPages()
216
+ {
217
+ $collection = $this->getCollection();
218
+
219
+ $pages = array();
220
+ if ($collection->getLastPageNumber() <= $this->_displayPages) {
221
+ $pages = range(1, $collection->getLastPageNumber());
222
+ }
223
+ else {
224
+ $half = ceil($this->_displayPages / 2);
225
+ if ($collection->getCurPage() >= $half && $collection->getCurPage() <= $collection->getLastPageNumber() - $half) {
226
+ $start = ($collection->getCurPage() - $half) + 1;
227
+ $finish = ($start + $this->_displayPages) - 1;
228
+ }
229
+ elseif ($collection->getCurPage() < $half) {
230
+ $start = 1;
231
+ $finish = $this->_displayPages;
232
+ }
233
+ elseif ($collection->getCurPage() > ($collection->getLastPageNumber() - $half)) {
234
+ $finish = $collection->getLastPageNumber();
235
+ $start = $finish - $this->_displayPages + 1;
236
+ }
237
+
238
+ $pages = range($start, $finish);
239
+ }
240
+
241
+ return $pages;
242
+
243
+ // $pages = array();
244
+ // for ($i=$this->getCollection()->getCurPage(-$this->_dispersion); $i <= $this->getCollection()->getCurPage(+($this->_dispersion-1)); $i++)
245
+ // {
246
+ //
247
+ // $pages[] = $i;
248
+ // }
249
+ //
250
+ // return $pages;
251
+ }
252
+
253
+ public function getFirstPageUrl()
254
+ {
255
+ return $this->getPageUrl(1);
256
+ }
257
+
258
+ public function getPreviousPageUrl()
259
+ {
260
+ return $this->getPageUrl($this->getCollection()->getCurPage(-1));
261
+ }
262
+
263
+ public function getNextPageUrl()
264
+ {
265
+ return $this->getPageUrl($this->getCollection()->getCurPage(+1));
266
+ }
267
+
268
+ public function getLastPageUrl()
269
+ {
270
+ return $this->getPageUrl($this->getCollection()->getLastPageNumber());
271
+ }
272
+
273
+ public function getPageUrl($page)
274
+ {
275
+ return $this->getPagerUrl(array($this->getPageVarName()=>$page));
276
+ }
277
+
278
+ public function getLimitUrl($limit)
279
+ {
280
+ return $this->getPagerUrl(array($this->getLimitVarName()=>$limit));
281
+ }
282
+
283
+ public function getPagerUrl($params=array())
284
+ {
285
+ $urlParams = array();
286
+ $urlParams['_current'] = true;
287
+ $urlParams['_escape'] = true;
288
+ $urlParams['_use_rewrite'] = true;
289
+ $urlParams['_query'] = $params;
290
+ return $this->getUrl('*/*/*', $urlParams);
291
+ }
292
+
293
+ }
app/code/local/Padoo/Gallery/Block/Review.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Review extends Mage_Core_Block_Template
21
+ {
22
+ protected $_defaultToolbarBlock = 'gallery/page_pager';
23
+
24
+ public function _prepareLayout()
25
+ {
26
+ return parent::_prepareLayout();
27
+ }
28
+
29
+ public function getGallery()
30
+ {
31
+ if (!$this->hasData('gallery')) {
32
+ $this->setData('gallery', Mage::registry('gallery'));
33
+ }
34
+ return $this->getData('gallery','asc');
35
+
36
+ }
37
+ public function getNewAlbums()
38
+ {
39
+ $total = $this->getTotalAlbum();
40
+
41
+ $collection_new_album = Mage::getModel('gallery/album')->getCollection()
42
+ ->addOrder('album_id','DESC')
43
+ ->setPageSize($total);
44
+
45
+ return $collection_new_album;
46
+ }
47
+
48
+ public function getPhotos() {
49
+ $collection = Mage::getModel('gallery/gallery')->getCollection()->addFieldToFilter('status', true);
50
+ if (Mage::registry('current_album')) $collection->addFieldToFilter('album_id' , Mage::registry('current_album')->getId());
51
+ else if ($this->getData('album_id')) {
52
+ $collection->addFieldToFilter('album_id' , $this->getData('album_id'));
53
+ $album = Mage::getModel('gallery/album')->load($this->getData('album_id'));
54
+ if ($album) {
55
+ Mage::register('current_album', $album);
56
+ }
57
+ }
58
+ $collection
59
+ ->addOrder('gallery_id','DESC');
60
+
61
+ $currentPage = (int)$this->getRequest()->getParam('page');
62
+ if(!$currentPage){
63
+ $currentPage = 1;
64
+ }
65
+
66
+ $currentLimit = (int)$this->getRequest()->getParam('limit');
67
+ if(!$currentLimit){
68
+ $currentLimit = Mage::getStoreConfig('gallery/info/images_per_page_default_value') ? Mage::getStoreConfig('gallery/info/images_per_page_default_value'):4;
69
+ }
70
+
71
+ $collection->setPageSize($currentLimit);
72
+ $collection->setCurPage($currentPage);
73
+ return $collection;
74
+ }
75
+
76
+ public function getDescription() {
77
+ if (Mage::registry('current_album')) return Mage::registry('current_album')->getContent();
78
+ return '';
79
+ }
80
+
81
+ public function getAlbums() {
82
+ $collection = Mage::getModel('gallery/album')->getCollection()
83
+ ->addFieldToFilter('status', true)
84
+ ->addOrder('album_id', 'DESC');
85
+ return $collection;
86
+ }
87
+
88
+ public function getTotalAlbumValue()
89
+ {
90
+ return $this->getTotalAlbum();
91
+ }
92
+
93
+ public function getUrlRewrite(Mage_Core_Model_Abstract $obj){
94
+ $rewrite = Mage::getModel('core/url_rewrite')
95
+ ->load($obj->getUrlRewriteId());
96
+ return trim(Mage::getBaseUrl(),'/')."/". $rewrite->getRequest_path();
97
+ }
98
+
99
+
100
+ public function getMode()
101
+ {
102
+ return $this->getChild('toolbar')->getCurrentMode();
103
+ }
104
+
105
+ protected function _beforeToHtml()
106
+ {
107
+ $toolbar = $this->getToolbarBlock();
108
+
109
+ // called prepare sortable parameters
110
+ $collection = $this->getPhotos();
111
+
112
+ // set collection to toolbar and apply sort
113
+ $toolbar->setCollection($collection);
114
+
115
+ $this->setChild('toolbar', $toolbar);
116
+
117
+ $this->getPhotos()->load();
118
+ return parent::_beforeToHtml();
119
+ }
120
+
121
+ public function getToolbarBlock()
122
+ {
123
+ $block = $this->getLayout()->createBlock($this->_defaultToolbarBlock, microtime());
124
+ return $block;
125
+ }
126
+
127
+ public function getToolbarHtml()
128
+ {
129
+ return $this->getChildHtml('toolbar');
130
+ }
131
+ }
app/code/local/Padoo/Gallery/Block/Search.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Block_Search extends Mage_Core_Block_Template
21
+ {
22
+ protected $_defaultToolbarBlock = 'gallery/page_pager';
23
+
24
+ public function _prepareLayout()
25
+ {
26
+ return parent::_prepareLayout();
27
+ }
28
+
29
+ public function getPhotoResults() {
30
+ $_keyword= $_GET['keyword'];
31
+ $exceptstrangesign = preg_replace('#[^0-9a-z]+#i', ' ', $_keyword);
32
+ $inputarrayword= array();
33
+ $inputarrayword=explode(' ',$exceptstrangesign);
34
+ $collection = Mage::getResourceModel('gallery/gallery_collection');
35
+ $where ="";
36
+ for($i=0;$i<count($inputarrayword);$i++)
37
+ {
38
+ $where .= "title like '%".$inputarrayword[$i]."%' OR content like '%".$inputarrayword[$i]."%' OR ";
39
+ }
40
+ $where = substr($where,0,strlen($where)-4);
41
+ $collection->getSelect()->where($where)->where('status = ?', 1);
42
+
43
+ $currentPage = (int)$this->getRequest()->getParam('page');
44
+ if(!$currentPage){
45
+ $currentPage = 1;
46
+ }
47
+
48
+ $currentLimit = (int)$this->getRequest()->getParam('limit');
49
+ if(!$currentLimit){
50
+ $currentLimit = Mage::getStoreConfig('gallery/info/images_per_page_default_value') ? Mage::getStoreConfig('gallery/info/images_per_page_default_value'):4;
51
+ }
52
+
53
+ $collection->setPageSize($currentLimit);
54
+ $collection->setCurPage($currentPage);
55
+ $storeId = Mage::app()->getStore(true)->getId();
56
+ foreach ($collection as $record) {
57
+ $stores = $record->getStoreId();
58
+ if(!(strpos($stores,$storeId) !== false || strpos($stores,0) !== false || $stores == 0 )){
59
+ $collection->removeItemByKey($record->getId());
60
+ }
61
+ }
62
+ return $collection;
63
+ }
64
+
65
+ public function getMode(){
66
+ return $this->getChild('toolbar')->getCurrentMode();
67
+ }
68
+
69
+ protected function _beforeToHtml(){
70
+ $toolbar = $this->getToolbarBlock();
71
+
72
+ // called prepare sortable parameters
73
+ $collection = $this->getPhotoResults();
74
+
75
+ // set collection to toolbar and apply sort
76
+ $toolbar->setCollection($collection);
77
+
78
+ $this->setChild('toolbar', $toolbar);
79
+
80
+ $this->getPhotoResults()->load();
81
+ return parent::_beforeToHtml();
82
+ }
83
+
84
+ public function getToolbarBlock()
85
+ {
86
+ $block = $this->getLayout()->createBlock($this->_defaultToolbarBlock, microtime());
87
+ return $block;
88
+ }
89
+
90
+ public function getToolbarHtml()
91
+ {
92
+ return $this->getChildHtml('toolbar');
93
+ }
94
+ }
app/code/local/Padoo/Gallery/Helper/Data.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Helper_Data extends Mage_Core_Helper_Abstract
21
+ {
22
+ public function checkEmailDuplicationAjaxUrl()
23
+ {
24
+ return $this->_getUrl('gallery/account/checkemailduplication');
25
+ }
26
+
27
+ public function getDescription(){
28
+ return Mage::getStoreConfig('gallery/info/show_description') ? Mage::getStoreConfig('gallery/info/show_description'):0;
29
+ }
30
+
31
+ public function getEnabledPagination(){
32
+ if(Mage::getStoreConfig('gallery/info/enabled_pagination')){
33
+ return Mage::getStoreConfig('gallery/info/enabled_pagination');
34
+ }else{
35
+ return 1;
36
+ }
37
+ }
38
+
39
+ const MYCONFIG = "gallery/info/enabled";
40
+ const MYNAME = "Padoo_Gallery";
41
+
42
+ public function myConfig(){
43
+ return self::MYCONFIG;
44
+ }
45
+
46
+ function disableConfig()
47
+ {
48
+ Mage::getSingleton('core/config')->saveConfig($this->myConfig(),0);
49
+ Mage::getModel('core/config')->saveConfig("advanced/modules_disable_output/".self::MYNAME,1);
50
+ Mage::getConfig()->reinit();
51
+ }
52
+
53
+ public function getGallleryUrl(){
54
+ return $this->_getUrl('gallery');
55
+ }
56
+ }
app/code/local/Padoo/Gallery/Helper/Image.php ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Helper_Image extends Mage_Core_Helper_Abstract
21
+ {
22
+ protected $_model;
23
+ protected $_scheduleResize = false;
24
+ protected $_scheduleWatermark = false;
25
+ protected $_scheduleRotate = false;
26
+ protected $_angle;
27
+ protected $_watermark;
28
+ protected $_watermarkPosition;
29
+ protected $_watermarkSize;
30
+ protected $_imageFile;
31
+ protected $_placeholder;
32
+
33
+ /**
34
+ * Reset all previos data
35
+ */
36
+ protected function _reset()
37
+ {
38
+ $this->_model = null;
39
+ $this->_scheduleResize = false;
40
+ $this->_scheduleWatermark = false;
41
+ $this->_scheduleRotate = false;
42
+ $this->_angle = null;
43
+ $this->_watermark = null;
44
+ $this->_watermarkPosition = null;
45
+ $this->_watermarkSize = null;
46
+ $this->_imageFile = null;
47
+ return $this;
48
+ }
49
+
50
+ public function init($imageFile)
51
+ {
52
+ $this->_reset();
53
+ $this->_setModel(Mage::getModel('gallery/image'));
54
+ //$this->_getModel()->setDestinationSubdir($attributeName);
55
+ $this->setImageFile($imageFile);
56
+ return $this;
57
+ }
58
+
59
+ /**
60
+ * Schedule resize of the image
61
+ * $width *or* $height can be null - in this case, lacking dimension will be calculated.
62
+ *
63
+ * @see Mage_Catalog_Model_Product_Image
64
+ * @param int $width
65
+ * @param int $height
66
+ * @return Padoo_Gallery_Helper_Image
67
+ */
68
+ public function resize($width, $height = null)
69
+ {
70
+ $this->_getModel()->setWidth($width)->setHeight($height);
71
+ $this->_scheduleResize = true;
72
+ return $this;
73
+ }
74
+
75
+
76
+ /**
77
+ * Guarantee, that image picture width/height will not be distorted.
78
+ * Applicable before calling resize()
79
+ * It is true by default.
80
+ *
81
+ * @see Mage_Catalog_Model_Product_Image
82
+ * @param bool $flag
83
+ * @return Padoo_Gallery_Helper_Image
84
+ */
85
+ public function keepAspectRatio($flag)
86
+ {
87
+ $this->_getModel()->setKeepAspectRatio($flag);
88
+ return $this;
89
+ }
90
+
91
+ /**
92
+ * Guarantee, that image will have dimensions, set in $width/$height
93
+ * Applicable before calling resize()
94
+ * Not applicable, if keepAspectRatio(false)
95
+ *
96
+ * $position - TODO, not used for now - picture position inside the frame.
97
+ *
98
+ * @see Mage_Catalog_Model_Product_Image
99
+ * @param bool $flag
100
+ * @param array $position
101
+ * @return Padoo_Gallery_Helper_Image
102
+ */
103
+ public function keepFrame($flag, $position = array('center', 'middle'))
104
+ {
105
+ $this->_getModel()->setKeepFrame($flag);
106
+ return $this;
107
+ }
108
+
109
+ /**
110
+ * Guarantee, that image will not lose transparency if any.
111
+ * Applicable before calling resize()
112
+ * It is true by default.
113
+ *
114
+ * $alphaOpacity - TODO, not used for now
115
+ *
116
+ * @see Mage_Catalog_Model_Product_Image
117
+ * @param bool $flag
118
+ * @param int $alphaOpacity
119
+ * @return Padoo_Gallery_Helper_Image
120
+ */
121
+ public function keepTransparency($flag, $alphaOpacity = null)
122
+ {
123
+ $this->_getModel()->setKeepTransparency($flag);
124
+ return $this;
125
+ }
126
+
127
+ /**
128
+ * Guarantee, that image picture will not be bigger, than it was.
129
+ * Applicable before calling resize()
130
+ * It is false by default
131
+ *
132
+ * @param bool $flag
133
+ * @return Padoo_Gallery_Helper_Image
134
+ */
135
+ public function constrainOnly($flag)
136
+ {
137
+ $this->_getModel()->setConstrainOnly($flag);
138
+ return $this;
139
+ }
140
+
141
+ /**
142
+ * Set color to fill image frame with.
143
+ * Applicable before calling resize()
144
+ * The keepTransparency(true) overrides this (if image has transparent color)
145
+ * It is white by default.
146
+ *
147
+ * @param array $colorRGB
148
+ * @return Padoo_Gallery_Helper_Image
149
+ */
150
+ public function backgroundColor($colorRGB)
151
+ {
152
+ // assume that 3 params were given instead of array
153
+ if (!is_array($colorRGB)) {
154
+ $colorRGB = func_get_args();
155
+ }
156
+ $this->_getModel()->setBackgroundColor($colorRGB);
157
+ return $this;
158
+ }
159
+
160
+ public function rotate($angle)
161
+ {
162
+ $this->setAngle($angle);
163
+ $this->_getModel()->setAngle($angle);
164
+ $this->_scheduleRotate = true;
165
+ return $this;
166
+ }
167
+
168
+ public function watermark($fileName, $position, $size=null)
169
+ {
170
+ $this->setWatermark($fileName)
171
+ ->setWatermarkPosition($position)
172
+ ->setWatermarkSize($size);
173
+ $this->_scheduleWatermark = true;
174
+ return $this;
175
+ }
176
+
177
+ public function placeholder($fileName)
178
+ {
179
+ $this->_placeholder = $fileName;
180
+ }
181
+
182
+ public function getPlaceholder()
183
+ {
184
+ if (!$this->_placeholder) {
185
+ $attr = $this->_getModel()->getDestinationSubdir();
186
+ $this->_placeholder = 'images/catalog/product/placeholder/'.$attr.'.jpg';
187
+ }
188
+ return $this->_placeholder;
189
+ }
190
+
191
+ public function __toString()
192
+ {
193
+ try {
194
+ if( $this->getImageFile() ) {
195
+ $this->_getModel()->setBaseFile( $this->getImageFile() );
196
+ }
197
+
198
+ if( $this->_getModel()->isCached() ) {
199
+ return $this->_getModel()->getUrl();
200
+ } else {
201
+ if( $this->_scheduleRotate ) {
202
+ $this->_getModel()->rotate( $this->getAngle() );
203
+ }
204
+
205
+ if ($this->_scheduleResize) {
206
+ $this->_getModel()->resize();
207
+ }
208
+
209
+ if( $this->_scheduleWatermark ) {
210
+ $this->_getModel()
211
+ ->setWatermarkPosition( $this->getWatermarkPosition() )
212
+ ->setWatermarkSize($this->parseSize($this->getWatermarkSize()))
213
+ ->setWatermark($this->getWatermark(), $this->getWatermarkPosition());
214
+ } else {
215
+ if( $watermark = Mage::getStoreConfig("design/watermark/{$this->_getModel()->getDestinationSubdir()}_image") ) {
216
+ $this->_getModel()
217
+ ->setWatermarkPosition( $this->getWatermarkPosition() )
218
+ ->setWatermarkSize($this->parseSize($this->getWatermarkSize()))
219
+ ->setWatermark($watermark, $this->getWatermarkPosition());
220
+ }
221
+ }
222
+
223
+ $url = $this->_getModel()->saveFile()->getUrl();
224
+ }
225
+ } catch( Exception $e ) {
226
+ //Mage::log($e);
227
+ $url = Mage::getDesign()->getSkinUrl($this->getPlaceholder());
228
+ }
229
+ return $url;
230
+ }
231
+
232
+ /**
233
+ * Enter description here...
234
+ *
235
+ * @return Padoo_Gallery_Helper_Image
236
+ */
237
+ protected function _setModel($model)
238
+ {
239
+ $this->_model = $model;
240
+ return $this;
241
+ }
242
+
243
+ /**
244
+ * Enter description here...
245
+ *
246
+ * @return Mage_Catalog_Model_Product_Image
247
+ */
248
+ protected function _getModel()
249
+ {
250
+ return $this->_model;
251
+ }
252
+
253
+ protected function setAngle($angle)
254
+ {
255
+ $this->_angle = $angle;
256
+ return $this;
257
+ }
258
+
259
+ protected function getAngle()
260
+ {
261
+ return $this->_angle;
262
+ }
263
+
264
+ protected function setWatermark($watermark)
265
+ {
266
+ $this->_watermark = $watermark;
267
+ return $this;
268
+ }
269
+
270
+ protected function getWatermark()
271
+ {
272
+ return $this->_watermark;
273
+ }
274
+
275
+ protected function setWatermarkPosition($position)
276
+ {
277
+ $this->_watermarkPosition = $position;
278
+ return $this;
279
+ }
280
+
281
+ protected function getWatermarkPosition()
282
+ {
283
+ if( $this->_watermarkPosition ) {
284
+ return $this->_watermarkPosition;
285
+ } else {
286
+ return Mage::getStoreConfig("design/watermark/{$this->_getModel()->getDestinationSubdir()}_position");
287
+ }
288
+ }
289
+
290
+ public function setWatermarkSize($size)
291
+ {
292
+ $this->_watermarkSize = $size;
293
+ return $this;
294
+ }
295
+
296
+ protected function getWatermarkSize()
297
+ {
298
+ if( $this->_watermarkSize ) {
299
+ return $this->_watermarkSize;
300
+ } else {
301
+ return Mage::getStoreConfig("design/watermark/{$this->_getModel()->getDestinationSubdir()}_size");
302
+ }
303
+ }
304
+
305
+ protected function setImageFile($file)
306
+ {
307
+ $this->_imageFile = $file;
308
+ return $this;
309
+ }
310
+
311
+ protected function getImageFile()
312
+ {
313
+ return $this->_imageFile;
314
+ }
315
+
316
+ /**
317
+ * Enter description here...
318
+ *
319
+ * @return array
320
+ */
321
+ protected function parseSize($string)
322
+ {
323
+ $size = explode('x', strtolower($string));
324
+ if( sizeof($size) == 2 ) {
325
+ return array(
326
+ 'width' => ($size[0] > 0) ? $size[0] : null,
327
+ 'heigth' => ($size[1] > 0) ? $size[1] : null,
328
+ );
329
+ }
330
+ return false;
331
+ }
332
+ }
app/code/local/Padoo/Gallery/Model/Album.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Model_Album extends Mage_Core_Model_Abstract
21
+ {
22
+ public function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->_init('gallery/album');
26
+ }
27
+ }
app/code/local/Padoo/Gallery/Model/Gallery.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Model_Gallery extends Mage_Core_Model_Abstract
21
+ {
22
+ public function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->_init('gallery/gallery');
26
+ }
27
+ }
app/code/local/Padoo/Gallery/Model/Image.php ADDED
@@ -0,0 +1,522 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Model_Image extends Mage_Core_Model_Abstract
21
+ {
22
+ protected $_width;
23
+ protected $_height;
24
+
25
+ protected $_keepAspectRatio = true;
26
+ protected $_keepFrame = true;
27
+ protected $_keepTransparency = true;
28
+ protected $_constrainOnly = false;
29
+ protected $_backgroundColor = array(192, 192, 192);
30
+
31
+ protected $_baseFile;
32
+ protected $_newFile;
33
+ protected $_baseDir;
34
+ protected $_processor;
35
+ protected $_destinationSubdir;
36
+ protected $_angle;
37
+ protected $_watermarkPosition;
38
+ protected $_watermarkWidth;
39
+ protected $_watermarkHeigth;
40
+
41
+ /**
42
+ * @return Padoo_Gallery_Model_Image
43
+ */
44
+ public function setWidth($width)
45
+ {
46
+ $this->_width = $width;
47
+ return $this;
48
+ }
49
+
50
+ public function getWidth()
51
+ {
52
+ return $this->_width;
53
+ }
54
+
55
+ /**
56
+ * @return Padoo_Gallery_Model_Image
57
+ */
58
+ public function setHeight($height)
59
+ {
60
+ $this->_height = $height;
61
+ return $this;
62
+ }
63
+
64
+ public function getHeight()
65
+ {
66
+ return $this->_height;
67
+ }
68
+
69
+ /**
70
+ * @return Padoo_Gallery_Model_Image
71
+ */
72
+ public function setKeepAspectRatio($keep)
73
+ {
74
+ $this->_keepAspectRatio = (bool)$keep;
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * @return Padoo_Gallery_Model_Image
80
+ */
81
+ public function setKeepFrame($keep)
82
+ {
83
+ $this->_keepFrame = (bool)$keep;
84
+ return $this;
85
+ }
86
+
87
+ /**
88
+ * @return Padoo_Gallery_Model_Image
89
+ */
90
+ public function setKeepTransparency($keep)
91
+ {
92
+ $this->_keepTransparency = (bool)$keep;
93
+ return $this;
94
+ }
95
+
96
+ /**
97
+ * @return Padoo_Gallery_Model_Image
98
+ */
99
+ public function setConstrainOnly($flag)
100
+ {
101
+ $this->_constrainOnly = (bool)$flag;
102
+ return $this;
103
+ }
104
+
105
+ /**
106
+ * @return Padoo_Gallery_Model_Image
107
+ */
108
+ public function setBackgroundColor(array $rgbArray)
109
+ {
110
+ $this->_backgroundColor = $rgbArray;
111
+ return $this;
112
+ }
113
+
114
+ /**
115
+ * @return Padoo_Gallery_Model_Image
116
+ */
117
+ public function setSize($size)
118
+ {
119
+ // determine width and height from string
120
+ list($width, $height) = explode('x', strtolower($size), 2);
121
+ foreach (array('width', 'height') as $wh) {
122
+ $$wh = (int)$$wh;
123
+ if (empty($$wh))
124
+ $$wh = null;
125
+ }
126
+
127
+ // set sizes
128
+ $this->setWidth($width)->setHeight($height);
129
+
130
+ return $this;
131
+ }
132
+
133
+ protected function _checkMemory($file = null)
134
+ {
135
+ // print '$this->_getMemoryLimit() = '.$this->_getMemoryLimit();
136
+ // print '$this->_getMemoryUsage() = '.$this->_getMemoryUsage();
137
+ // print '$this->_getNeedMemoryForBaseFile() = '.$this->_getNeedMemoryForBaseFile();
138
+
139
+ return $this->_getMemoryLimit() > ($this->_getMemoryUsage() + $this->_getNeedMemoryForFile($file));
140
+ }
141
+
142
+ protected function _getMemoryLimit()
143
+ {
144
+ $memoryLimit = ini_get('memory_limit');
145
+
146
+ if (!isSet($memoryLimit[0])){
147
+ $memoryLimit = "128M";
148
+ }
149
+
150
+ if (substr($memoryLimit, -1) == 'M') {
151
+ return (int)$memoryLimit * 1024 * 1024;
152
+ }
153
+ return $memoryLimit;
154
+ }
155
+
156
+ protected function _getMemoryUsage()
157
+ {
158
+ if (function_exists('memory_get_usage')) {
159
+ return memory_get_usage();
160
+ }
161
+ return 0;
162
+ }
163
+
164
+ protected function _getNeedMemoryForFile($file = null)
165
+ {
166
+ $file = is_null($file) ? $this->getBaseFile() : $file;
167
+ if (!$file) {
168
+ return 0;
169
+ }
170
+
171
+ if (!file_exists($file) || !is_file($file)) {
172
+ return 0;
173
+ }
174
+
175
+ $imageInfo = getimagesize($file);
176
+
177
+ if (!isset($imageInfo['channels'])) {
178
+ // if there is no info about this parameter lets set it for maximum
179
+ $imageInfo['channels'] = 4;
180
+ }
181
+ if (!isset($imageInfo['bits'])) {
182
+ // if there is no info about this parameter lets set it for maximum
183
+ $imageInfo['bits'] = 8;
184
+ }
185
+ return round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $imageInfo['channels'] / 8 + Pow(2, 16)) * 1.65);
186
+ }
187
+
188
+ /**
189
+ * Convert array of 3 items (decimal r, g, b) to string of their hex values
190
+ *
191
+ * @param array $rgbArray
192
+ * @return string
193
+ */
194
+ private function _rgbToString($rgbArray)
195
+ {
196
+ $result = array();
197
+ foreach ($rgbArray as $value) {
198
+ if (null === $value) {
199
+ $result[] = 'null';
200
+ }
201
+ else {
202
+ $result[] = sprintf('%02s', dechex($value));
203
+ }
204
+ }
205
+ return implode($result);
206
+ }
207
+
208
+ /**
209
+ * Set filenames for base file and new file
210
+ *
211
+ * @param string $file
212
+ * @return Padoo_Gallery_Model_Image
213
+ */
214
+ public function setBaseFile($file)
215
+ {
216
+ $subDir = '';
217
+
218
+ if ($file) {
219
+ if (0 !== strpos($file, '/', 0)) {
220
+ $file = '/' . $file;
221
+ }
222
+
223
+ $pos = strripos($file, '/');
224
+ if ($pos!==false && $pos!==0) {
225
+ $subDir = substr($file, 0, $pos);
226
+ $file = substr($file, $pos);
227
+ }
228
+ }
229
+ //$baseDir = Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath();
230
+ $baseDir = Mage::getBaseDir('media') . $subDir;
231
+ $this->_baseDir = Mage::getBaseDir('media') . DS;
232
+
233
+ if ('/no_selection' == $file) {
234
+ $file = null;
235
+ }
236
+ if ($file) {
237
+ if ((!file_exists($baseDir . $file)) || !$this->_checkMemory($baseDir . $file)) {
238
+ $file = null;
239
+ }
240
+ }
241
+
242
+ /*
243
+ if (!$file) {
244
+ // check if placeholder defined in config
245
+ $isConfigPlaceholder = Mage::getStoreConfig("catalog/placeholder/{$this->getDestinationSubdir()}_placeholder");
246
+ $configPlaceholder = '/placeholder/' . $isConfigPlaceholder;
247
+ if ($isConfigPlaceholder && file_exists($baseDir . $configPlaceholder)) {
248
+ $file = $configPlaceholder;
249
+ }
250
+ else {
251
+ // replace file with skin or default skin placeholder
252
+ $skinBaseDir = Mage::getDesign()->getSkinBaseDir();
253
+ $skinPlaceholder = "/images/catalog/product/placeholder/{$this->getDestinationSubdir()}.jpg";
254
+ $file = $skinPlaceholder;
255
+ if (file_exists($skinBaseDir . $file)) {
256
+ $baseDir = $skinBaseDir;
257
+ }
258
+ else {
259
+ $baseDir = Mage::getDesign()->getSkinBaseDir(array('_theme' => 'default'));
260
+ }
261
+ }
262
+ }
263
+ */
264
+
265
+ $baseFile = $baseDir . $file;
266
+
267
+ if ((!$file) || (!file_exists($baseFile))) {
268
+ throw new Exception(Mage::helper('catalog')->__('Image file not found'));
269
+ }
270
+ $this->_baseFile = $baseFile;
271
+
272
+ // build new filename (most important params)
273
+ $path = array(
274
+ 'gallery',
275
+ 'cache'
276
+ );
277
+ if((!empty($this->_width)) || (!empty($this->_height)))
278
+ $path[] = "{$this->_width}x{$this->_height}";
279
+ // add misc params as a hash
280
+ $path[] = md5(
281
+ implode('_', array(
282
+ ($this->_keepAspectRatio ? '' : 'non') . 'proportional',
283
+ ($this->_keepFrame ? '' : 'no') . 'frame',
284
+ ($this->_keepTransparency ? '' : 'no') . 'transparency',
285
+ ($this->_constrainOnly ? 'do' : 'not') . 'constrainonly',
286
+ $this->_rgbToString($this->_backgroundColor),
287
+ 'angle' . $this->_angle
288
+ ))
289
+ );
290
+ // append prepared filename
291
+ $this->_newFile = implode('/', $path) . $file; // the $file contains heading slash
292
+
293
+ return $this;
294
+ }
295
+
296
+ public function getBaseFile()
297
+ {
298
+ return $this->_baseFile;
299
+ }
300
+
301
+ public function getBaseDir()
302
+ {
303
+ return $this->_baseDir;
304
+ }
305
+
306
+ public function getNewFile()
307
+ {
308
+ return $this->_newFile;
309
+ }
310
+
311
+ /**
312
+ * @return Padoo_Gallery_Model_Image
313
+ */
314
+ public function setImageProcessor($processor)
315
+ {
316
+ $this->_processor = $processor;
317
+ return $this;
318
+ }
319
+
320
+ /**
321
+ * @return Varien_Image
322
+ */
323
+ public function getImageProcessor()
324
+ {
325
+ if( !$this->_processor ) {
326
+ // var_dump($this->_checkMemory());
327
+ // if (!$this->_checkMemory()) {
328
+ // $this->_baseFile = null;
329
+ // }
330
+ $this->_processor = new Varien_Image($this->getBaseFile());
331
+ }
332
+ $this->_processor->keepAspectRatio($this->_keepAspectRatio);
333
+ $this->_processor->keepFrame($this->_keepFrame);
334
+ $this->_processor->keepTransparency($this->_keepTransparency);
335
+ $this->_processor->constrainOnly($this->_constrainOnly);
336
+ $this->_processor->backgroundColor($this->_backgroundColor);
337
+ return $this->_processor;
338
+ }
339
+
340
+ /**
341
+ * @see Varien_Image_Adapter_Abstract
342
+ * @return Padoo_Gallery_Model_Image
343
+ */
344
+ public function resize()
345
+ {
346
+ if (is_null($this->getWidth()) && is_null($this->getHeight())) {
347
+ return $this;
348
+ }
349
+ $this->getImageProcessor()->resize($this->_width, $this->_height);
350
+ return $this;
351
+ }
352
+
353
+ /**
354
+ * @return Padoo_Gallery_Model_Image
355
+ */
356
+ public function rotate($angle)
357
+ {
358
+ $angle = intval($angle);
359
+ $this->getImageProcessor()->rotate($angle);
360
+ return $this;
361
+ }
362
+
363
+ /**
364
+ * Set angle for rotating
365
+ *
366
+ * This func actually affects only the cache filename.
367
+ *
368
+ * @param int $angle
369
+ * @return Padoo_Gallery_Model_Image
370
+ */
371
+ public function setAngle($angle)
372
+ {
373
+ $this->_angle = $angle;
374
+ return $this;
375
+ }
376
+
377
+ /**
378
+ * @return Padoo_Gallery_Model_Image
379
+ */
380
+ public function setWatermark($file, $position=null, $size=null, $width=null, $heigth=null)
381
+ {
382
+ $filename = false;
383
+
384
+ if( !$file ) {
385
+ return $this;
386
+ }
387
+
388
+ $baseDir = Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath();
389
+
390
+ if( file_exists($baseDir . '/watermark/stores/' . Mage::app()->getStore()->getId() . $file) ) {
391
+ $filename = $baseDir . '/watermark/stores/' . Mage::app()->getStore()->getId() . $file;
392
+ } elseif ( file_exists($baseDir . '/watermark/websites/' . Mage::app()->getWebsite()->getId() . $file) ) {
393
+ $filename = $baseDir . '/watermark/websites/' . Mage::app()->getWebsite()->getId() . $file;
394
+ } elseif ( file_exists($baseDir . '/watermark/default/' . $file) ) {
395
+ $filename = $baseDir . '/watermark/default/' . $file;
396
+ } elseif ( file_exists($baseDir . '/watermark/' . $file) ) {
397
+ $filename = $baseDir . '/watermark/' . $file;
398
+ } else {
399
+ $baseDir = Mage::getDesign()->getSkinBaseDir();
400
+ if( file_exists($baseDir . $file) ) {
401
+ $filename = $baseDir . $file;
402
+ }
403
+ }
404
+
405
+ if( $filename ) {
406
+ $this->getImageProcessor()
407
+ ->setWatermarkPosition( ($position) ? $position : $this->getWatermarkPosition() )
408
+ ->setWatermarkWidth( ($width) ? $width : $this->getWatermarkWidth() )
409
+ ->setWatermarkHeigth( ($heigth) ? $heigth : $this->getWatermarkHeigth() )
410
+ ->watermark($filename);
411
+ }
412
+
413
+ return $this;
414
+ }
415
+
416
+ /**
417
+ * @return Padoo_Gallery_Model_Image
418
+ */
419
+ public function saveFile()
420
+ {
421
+ $this->getImageProcessor()->save($this->getBaseDir().$this->getNewFile());
422
+ return $this;
423
+ }
424
+
425
+ /**
426
+ * @return string
427
+ */
428
+ public function getUrl()
429
+ {
430
+ $baseDir = Mage::getBaseDir('media');
431
+ $path = str_replace($baseDir . DS, "", $this->_newFile);
432
+ return Mage::getBaseUrl('media') . str_replace(DS, '/', $path);
433
+ }
434
+
435
+ public function push()
436
+ {
437
+ $this->getImageProcessor()->display();
438
+ }
439
+
440
+ /**
441
+ * @return Padoo_Gallery_Model_Image
442
+ */
443
+ public function setDestinationSubdir($dir)
444
+ {
445
+ $this->_destinationSubdir = $dir;
446
+ return $this;
447
+ }
448
+
449
+ /**
450
+ * @return string
451
+ */
452
+ public function getDestinationSubdir()
453
+ {
454
+ return $this->_destinationSubdir;
455
+ }
456
+
457
+ public function isCached()
458
+ {
459
+ return file_exists($this->getBaseDir().$this->_newFile);
460
+ }
461
+
462
+ /**
463
+ * @return Padoo_Gallery_Model_Image
464
+ */
465
+ public function setWatermarkPosition($position)
466
+ {
467
+ $this->_watermarkPosition = $position;
468
+ return $this;
469
+ }
470
+
471
+ public function getWatermarkPosition()
472
+ {
473
+ return $this->_watermarkPosition;
474
+ }
475
+
476
+ /**
477
+ * @return Padoo_Gallery_Model_Image
478
+ */
479
+ public function setWatermarkSize($size)
480
+ {
481
+ if( is_array($size) ) {
482
+ $this->setWatermarkWidth($size['width'])
483
+ ->setWatermarkHeigth($size['heigth']);
484
+ }
485
+ return $this;
486
+ }
487
+
488
+ /**
489
+ * @return Padoo_Gallery_Model_Image
490
+ */
491
+ public function setWatermarkWidth($width)
492
+ {
493
+ $this->_watermarkWidth = $width;
494
+ return $this;
495
+ }
496
+
497
+ public function getWatermarkWidth()
498
+ {
499
+ return $this->_watermarkWidth;
500
+ }
501
+
502
+ /**
503
+ * @return Padoo_Gallery_Model_Image
504
+ */
505
+ public function setWatermarkHeigth($heigth)
506
+ {
507
+ $this->_watermarkHeigth = $heigth;
508
+ return $this;
509
+ }
510
+
511
+ public function getWatermarkHeigth()
512
+ {
513
+ return $this->_watermarkHeigth;
514
+ }
515
+
516
+ public function clearCache()
517
+ {
518
+ $directory = Mage::getBaseDir('media') . DS.'gallery'.DS.'cache'.DS;
519
+ $io = new Varien_Io_File();
520
+ $io->rmdir($directory, true);
521
+ }
522
+ }
app/code/local/Padoo/Gallery/Model/Mysql4/Album.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Model_Mysql4_Album extends Mage_Core_Model_Mysql4_Abstract
21
+ {
22
+ public function _construct()
23
+ {
24
+ // Note that the gallery_id refers to the key field in your database table.
25
+ $this->_init('gallery/album', 'album_id');
26
+ }
27
+ }
app/code/local/Padoo/Gallery/Model/Mysql4/Album/Collection.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Model_Mysql4_Album_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
21
+ {
22
+ public function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->_init('gallery/album');
26
+ }
27
+ }
app/code/local/Padoo/Gallery/Model/Mysql4/Gallery.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Model_Mysql4_Gallery extends Mage_Core_Model_Mysql4_Abstract
21
+ {
22
+ public function _construct()
23
+ {
24
+ // Note that the gallery_id refers to the key field in your database table.
25
+ $this->_init('gallery/gallery', 'gallery_id');
26
+ }
27
+ }
app/code/local/Padoo/Gallery/Model/Mysql4/Gallery/Collection.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Model_Mysql4_Gallery_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
21
+ {
22
+ public function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->_init('gallery/gallery');
26
+ }
27
+ }
app/code/local/Padoo/Gallery/Model/Mysql4/Review.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Model_Mysql4_Review extends Mage_Core_Model_Mysql4_Abstract
21
+ {
22
+ public function _construct()
23
+ {
24
+ // Note that the gallery_id refers to the key field in your database table.
25
+ $this->_init('gallery/review', 'review_id');
26
+ }
27
+ }
app/code/local/Padoo/Gallery/Model/Mysql4/Review/Collection.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Model_Mysql4_Review_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
21
+ {
22
+ public function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->_init('gallery/review');
26
+ }
27
+ }
app/code/local/Padoo/Gallery/Model/Review.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Model_Review extends Mage_Core_Model_Abstract
21
+ {
22
+ public function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->_init('gallery/review');
26
+ }
27
+ }
app/code/local/Padoo/Gallery/Model/Status.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Model_Status extends Varien_Object
21
+ {
22
+ const STATUS_ENABLED = 1;
23
+ const STATUS_DISABLED = 2;
24
+
25
+ static public function getOptionArray()
26
+ {
27
+ return array(
28
+ self::STATUS_ENABLED => Mage::helper('gallery')->__('Enabled'),
29
+ self::STATUS_DISABLED => Mage::helper('gallery')->__('Disabled')
30
+ );
31
+ }
32
+ }
app/code/local/Padoo/Gallery/Model/_Project.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Model_Project extends Varien_Object
21
+ {
22
+ const PROJECT_OTHERS = 'others';
23
+ const PROJECT_JEEP_TJ = 'jeep_tj';
24
+ const PROJECT_TACOMA = 'tacoma';
25
+ const PROJECT_JEEP_JK = 'jeep_jk';
26
+
27
+ static public function getOptionArray()
28
+ {
29
+ return array(
30
+ self::PROJECT_OTHERS => Mage::helper('gallery')->__('Others'),
31
+ self::PROJECT_JEEP_TJ => Mage::helper('gallery')->__('Jeep TJ'),
32
+ self::PROJECT_TACOMA => Mage::helper('gallery')->__('Tacoma'),
33
+ self::PROJECT_JEEP_JK => Mage::helper('gallery')->__('Jeep JK')
34
+ );
35
+ }
36
+ }
app/code/local/Padoo/Gallery/controllers/Admin/AlbumController.php ADDED
@@ -0,0 +1,297 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Admin_AlbumController extends Mage_Adminhtml_Controller_action
21
+ {
22
+ protected function _isAllowed()
23
+ {
24
+ return Mage::getSingleton('admin/session')->isAllowed('gallery/albums');
25
+ }
26
+
27
+ protected function _initAction() {
28
+ $this->loadLayout()
29
+ ->_setActiveMenu('gallery/items')
30
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Album Manager'), Mage::helper('adminhtml')->__('Album Manager'));
31
+
32
+ return $this;
33
+ }
34
+ public function indexAction() {
35
+ $this->_initAction()
36
+ ->renderLayout();
37
+ }
38
+
39
+ public function editAction() {
40
+ $id = $this->getRequest()->getParam('id');
41
+ $model = Mage::getModel('gallery/album')->load($id);
42
+
43
+ if ($model->getId() || $id == 0) {
44
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
45
+ if (!empty($data)) {
46
+ $model->setData($data);
47
+ }
48
+
49
+ Mage::register('album_data', $model);
50
+
51
+ $this->loadLayout();
52
+ $this->_setActiveMenu('gallery/items');
53
+
54
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
55
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
56
+
57
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
58
+
59
+ $this->_addContent($this->getLayout()->createBlock('gallery/admin_album_edit'))
60
+ ->_addLeft($this->getLayout()->createBlock('gallery/admin_album_edit_tabs'));
61
+
62
+ $this->renderLayout();
63
+ } else {
64
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('gallery')->__('Item does not exist'));
65
+ $this->_redirect('*/*/');
66
+ }
67
+ }
68
+
69
+ public function newAction() {
70
+ $this->_forward('edit');
71
+ }
72
+
73
+ public function saveAction() {
74
+ if ($data = $this->getRequest()->getPost()) {
75
+ //save store view
76
+ $storeView = $data['stores'];
77
+ $dataStore = "";
78
+ foreach($storeView as $store){
79
+ if($dataStore != "") $dataStore .=",";
80
+ $dataStore .= $store;
81
+ }
82
+ $data['store_id'] = $dataStore;
83
+
84
+ if($_FILES['filename']['name'] != '') {
85
+ try {
86
+ /* Starting upload */
87
+ $uploader = new Varien_File_Uploader('filename');
88
+
89
+ // Any extention would work
90
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
91
+ $uploader->setAllowRenameFiles(false);
92
+
93
+ // Set the file upload mode
94
+ // false -> get the file directly in the specified folder
95
+ // true -> get the file in the product like folders
96
+ // (file.jpg will go in something like /media/f/i/file.jpg)
97
+ $uploader->setFilesDispersion(false);
98
+
99
+ // We set media as the upload dir
100
+ $path = Mage::getBaseDir('media') . DS . 'gallery' . DS;
101
+ $uploader->save($path, $_FILES['filename']['name'] );
102
+
103
+ } catch (Exception $e) {
104
+
105
+ }
106
+
107
+ //this way the name is saved in DB
108
+ $data['filename'] = 'gallery/'.$_FILES['filename']['name'];
109
+ } else {
110
+ if(isset($data['filename']['delete']) && $data['filename']['delete'] == 1) {
111
+ $data['filename'] = '';
112
+ } else {
113
+ unset($data['filename']);
114
+ }
115
+ }
116
+
117
+ $model = Mage::getModel('gallery/album');
118
+ $model->setData($data)
119
+ ->setId($this->getRequest()->getParam('id'));
120
+
121
+
122
+ try {
123
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
124
+ $model->setCreatedTime(now())
125
+ ->setUpdateTime(now());
126
+ } else {
127
+ $model->setUpdateTime(now());
128
+ }
129
+
130
+ $model->save();
131
+
132
+ // insert new url rewrite
133
+ /* $suffix = ".html";
134
+ if(!strlen($model->getUrlKey()))
135
+ {
136
+ $rq_path = trim(strtolower($model->getTitle())). $suffix;
137
+ }else
138
+ {
139
+ $rq_path = $model->getUrlKey().$suffix;
140
+ }
141
+ while( is_int(strpos($rq_path,' ')))
142
+ {
143
+ $rq_path = str_replace(' ',' ',$rq_path);
144
+ }
145
+ $rq_path = str_replace(' ','-',$rq_path);
146
+
147
+ $url_rewrite_id = $data['url_rewrite_id']?$data['url_rewrite_id']:null;
148
+ $rewriteModel = Mage::getModel('core/url_rewrite');
149
+ $data = array(
150
+ 'url_rewrite_id'=> $url_rewrite_id,
151
+ 'is_system' => 1,
152
+ 'id_path' => 'gallery/album/'.$model->getId(),
153
+ 'request_path' => "gallery/".$rq_path,
154
+ 'target_path' => 'gallery/view/album/id/'.$model->getId(),
155
+ );
156
+ $rewriteModel->setData($data);
157
+ $rewriteModel->save();
158
+ $data = array('album_id'=>$model->getId());
159
+ $data['url_key'] = str_replace($suffix,'',$rq_path);
160
+ $data['url_rewrite_id'] = $rewriteModel->getId(); */
161
+
162
+ //Mage::getModel('gallery/album')->setData($data)->save();
163
+
164
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('gallery')->__('Photo was successfully saved'));
165
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
166
+
167
+ if ($this->getRequest()->getParam('back')) {
168
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
169
+ return;
170
+ }
171
+ $this->_redirect('*/*/');
172
+ return;
173
+ } catch (Exception $e) {
174
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
175
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
176
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
177
+ return;
178
+ }
179
+ }
180
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('gallery')->__('Unable to find photo to save'));
181
+ $this->_redirect('*/*/');
182
+ }
183
+
184
+ public function deleteAction() {
185
+ if( $this->getRequest()->getParam('id') > 0 ) {
186
+ try {
187
+ $model = Mage::getModel('gallery/album');
188
+
189
+ $model->load($this->getRequest()->getParam('id'));
190
+ $rewriteModel = Mage::getModel('core/url_rewrite')->load($model->getUrlRewriteId())->delete();
191
+ $model->delete();
192
+
193
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Photo was successfully deleted'));
194
+ $this->_redirect('*/*/');
195
+ } catch (Exception $e) {
196
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
197
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
198
+ }
199
+ }
200
+ $this->_redirect('*/*/');
201
+ }
202
+
203
+ public function massDeleteAction() {
204
+ $albumIds = $this->getRequest()->getParam('album');
205
+ if(!is_array($albumIds)) {
206
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select photo(s)'));
207
+ } else {
208
+ try {
209
+ foreach ($albumIds as $albumId) {
210
+ $model = Mage::getModel('gallery/album')->load($albumId);
211
+ $rewriteModel = Mage::getModel('core/url_rewrite')->load($model->getUrlRewriteId())->delete();
212
+ $model->delete();
213
+ }
214
+ Mage::getSingleton('adminhtml/session')->addSuccess(
215
+ Mage::helper('adminhtml')->__(
216
+ 'Total of %d record(s) were successfully deleted', count($albumIds)
217
+ )
218
+ );
219
+ } catch (Exception $e) {
220
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
221
+ }
222
+ }
223
+ $this->_redirect('*/*/index');
224
+ }
225
+
226
+ public function massStatusAction()
227
+ {
228
+ $albumIds = $this->getRequest()->getParam('album');
229
+ if(!is_array($albumIds)) {
230
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select photo(s)'));
231
+ } else {
232
+ try {
233
+ foreach ($albumIds as $albumId) {
234
+ $album = Mage::getSingleton('gallery/album')
235
+ ->load($albumId)
236
+ ->setStatus($this->getRequest()->getParam('status'))
237
+ ->setIsMassupdate(true)
238
+ ->save();
239
+ }
240
+ $this->_getSession()->addSuccess(
241
+ $this->__('Total of %d record(s) were successfully updated', count($albumIds))
242
+ );
243
+ } catch (Exception $e) {
244
+ $this->_getSession()->addError($e->getMessage());
245
+ }
246
+ }
247
+ $this->_redirect('*/*/index');
248
+ }
249
+
250
+ public function exportCsvAction()
251
+ {
252
+ $fileName = 'album.csv';
253
+ $content = $this->getLayout()->createBlock('gallery/admin_album_grid')
254
+ ->getCsv();
255
+
256
+ $this->_sendUploadResponse($fileName, $content);
257
+ }
258
+
259
+ public function exportXmlAction()
260
+ {
261
+ $fileName = 'album.xml';
262
+ $content = $this->getLayout()->createBlock('gallery/admin_album_grid')
263
+ ->getXml();
264
+
265
+ $this->_sendUploadResponse($fileName, $content);
266
+ }
267
+
268
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
269
+ {
270
+ $response = $this->getResponse();
271
+ $response->setHeader('HTTP/1.1 200 OK','');
272
+ $response->setHeader('Pragma', 'public', true);
273
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
274
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
275
+ $response->setHeader('Last-Modified', date('r'));
276
+ $response->setHeader('Accept-Ranges', 'bytes');
277
+ $response->setHeader('Content-Length', strlen($content));
278
+ $response->setHeader('Content-type', $contentType);
279
+ $response->setBody($content);
280
+ $response->sendResponse();
281
+ die;
282
+ }
283
+
284
+ public function saveOrderAction()
285
+ {
286
+ $items = explode('|',$this->getRequest()->getParam('items'));
287
+ $model = Mage::getModel('gallery/album');
288
+ foreach($items as $item)
289
+ {
290
+ $_item = explode('_',$item); //$_item[0] => id, $_item[1]=>order
291
+ $model->load($_item[0]);
292
+ $model->setOrder($_item[1]);
293
+ $model->save();
294
+ }
295
+ $this->_redirect('*/*/index');
296
+ }
297
+ }
app/code/local/Padoo/Gallery/controllers/Admin/GalleryController.php ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Admin_GalleryController extends Mage_Adminhtml_Controller_action
21
+ {
22
+ protected function _isAllowed()
23
+ {
24
+ return Mage::getSingleton('admin/session')->isAllowed('gallery/photos');
25
+ }
26
+
27
+ protected function _initAction() {
28
+ $this->loadLayout()
29
+ ->_setActiveMenu('gallery/items')
30
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Photo Manager'), Mage::helper('adminhtml')->__('Photo Manager'));
31
+
32
+ return $this;
33
+ }
34
+
35
+ public function indexAction() {
36
+ $this->_initAction()
37
+ ->renderLayout();
38
+ }
39
+
40
+ public function editAction() {
41
+ $id = $this->getRequest()->getParam('id');
42
+ $model = Mage::getModel('gallery/gallery')->load($id);
43
+
44
+ if ($model->getId() || $id == 0) {
45
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
46
+ if (!empty($data)) {
47
+ $model->setData($data);
48
+ }
49
+
50
+ Mage::register('gallery_data', $model);
51
+
52
+ $this->loadLayout();
53
+ $this->_setActiveMenu('gallery/items');
54
+
55
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
56
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
57
+
58
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
59
+
60
+ $this->_addContent($this->getLayout()->createBlock('gallery/admin_gallery_edit'))
61
+ ->_addLeft($this->getLayout()->createBlock('gallery/admin_gallery_edit_tabs'));
62
+
63
+ $this->renderLayout();
64
+ } else {
65
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('gallery')->__('Item does not exist'));
66
+ $this->_redirect('*/*/');
67
+ }
68
+ }
69
+
70
+ public function newAction() {
71
+ $this->_forward('edit');
72
+ }
73
+
74
+ public function saveAction() {
75
+ if ($data = $this->getRequest()->getPost()) {
76
+ //save store view
77
+ $storeView = $data['stores'];
78
+ $dataStore = "";
79
+ foreach($storeView as $store){
80
+ if($dataStore != "") $dataStore .=",";
81
+ $dataStore .= $store;
82
+ }
83
+ $data['store_id'] = $dataStore;
84
+
85
+ if($_FILES['filename']['name'] != '') {
86
+ try {
87
+ /* Starting upload */
88
+ $uploader = new Varien_File_Uploader('filename');
89
+
90
+ // Any extention would work
91
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
92
+ $uploader->setAllowRenameFiles(false);
93
+
94
+ // Set the file upload mode
95
+ // false -> get the file directly in the specified folder
96
+ // true -> get the file in the product like folders
97
+ // (file.jpg will go in something like /media/f/i/file.jpg)
98
+ $uploader->setFilesDispersion(false);
99
+
100
+ // We set media as the upload dir
101
+ $path = Mage::getBaseDir('media') . DS . 'gallery' . DS;
102
+ $uploader->save($path, $_FILES['filename']['name'] );
103
+
104
+ } catch (Exception $e) {
105
+
106
+ }
107
+
108
+ //this way the name is saved in DB
109
+ $data['filename'] = 'gallery/'.$_FILES['filename']['name'];
110
+ } else {
111
+ if(isset($data['filename']['delete']) && $data['filename']['delete'] == 1) {
112
+ $data['filename'] = '';
113
+ } else {
114
+ unset($data['filename']);
115
+ }
116
+ }
117
+
118
+
119
+ $model = Mage::getModel('gallery/gallery');
120
+ $model->setData($data)
121
+ ->setId($this->getRequest()->getParam('id'));
122
+
123
+ try {
124
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
125
+ $model->setCreatedTime(now())
126
+ ->setUpdateTime(now());
127
+ } else {
128
+ $model->setUpdateTime(now());
129
+ }
130
+
131
+ $model->save();
132
+
133
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('gallery')->__('Photo was successfully saved'));
134
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
135
+
136
+ if ($this->getRequest()->getParam('back')) {
137
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
138
+ return;
139
+ }
140
+ $this->_redirect('*/*/');
141
+ return;
142
+ } catch (Exception $e) {
143
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
144
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
145
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
146
+ return;
147
+ }
148
+ }
149
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('gallery')->__('Unable to find photo to save'));
150
+ $this->_redirect('*/*/');
151
+ }
152
+
153
+ public function deleteAction() {
154
+ if( $this->getRequest()->getParam('id') > 0 ) {
155
+ try {
156
+ $model = Mage::getModel('gallery/gallery');
157
+
158
+ $model->setId($this->getRequest()->getParam('id'))
159
+ ->delete();
160
+
161
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Photo was successfully deleted'));
162
+ $this->_redirect('*/*/');
163
+ } catch (Exception $e) {
164
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
165
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
166
+ }
167
+ }
168
+ $this->_redirect('*/*/');
169
+ }
170
+
171
+ public function massDeleteAction() {
172
+ $galleryIds = $this->getRequest()->getParam('gallery');
173
+ if(!is_array($galleryIds)) {
174
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select photo(s)'));
175
+ } else {
176
+ try {
177
+ foreach ($galleryIds as $galleryId) {
178
+ $gallery = Mage::getModel('gallery/gallery')->load($galleryId);
179
+ $gallery->delete();
180
+ }
181
+ Mage::getSingleton('adminhtml/session')->addSuccess(
182
+ Mage::helper('adminhtml')->__(
183
+ 'Total of %d record(s) were successfully deleted', count($galleryIds)
184
+ )
185
+ );
186
+ } catch (Exception $e) {
187
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
188
+ }
189
+ }
190
+ $this->_redirect('*/*/index');
191
+ }
192
+
193
+ public function massStatusAction()
194
+ {
195
+ $galleryIds = $this->getRequest()->getParam('gallery');
196
+ if(!is_array($galleryIds)) {
197
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select photo(s)'));
198
+ } else {
199
+ try {
200
+ foreach ($galleryIds as $galleryId) {
201
+ $gallery = Mage::getSingleton('gallery/gallery')
202
+ ->load($galleryId)
203
+ ->setStatus($this->getRequest()->getParam('status'))
204
+ ->setIsMassupdate(true)
205
+ ->save();
206
+ }
207
+ $this->_getSession()->addSuccess(
208
+ $this->__('Total of %d record(s) were successfully updated', count($galleryIds))
209
+ );
210
+ } catch (Exception $e) {
211
+ $this->_getSession()->addError($e->getMessage());
212
+ }
213
+ }
214
+ $this->_redirect('*/*/index');
215
+ }
216
+
217
+ public function exportCsvAction()
218
+ {
219
+ $fileName = 'gallery.csv';
220
+ $content = $this->getLayout()->createBlock('gallery/admin_gallery_grid')
221
+ ->getCsv();
222
+
223
+ $this->_sendUploadResponse($fileName, $content);
224
+ }
225
+
226
+ public function exportXmlAction()
227
+ {
228
+ $fileName = 'gallery.xml';
229
+ $content = $this->getLayout()->createBlock('gallery/admin_gallery_grid')
230
+ ->getXml();
231
+
232
+ $this->_sendUploadResponse($fileName, $content);
233
+ }
234
+
235
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
236
+ {
237
+ $response = $this->getResponse();
238
+ $response->setHeader('HTTP/1.1 200 OK','');
239
+ $response->setHeader('Pragma', 'public', true);
240
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
241
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
242
+ $response->setHeader('Last-Modified', date('r'));
243
+ $response->setHeader('Accept-Ranges', 'bytes');
244
+ $response->setHeader('Content-Length', strlen($content));
245
+ $response->setHeader('Content-type', $contentType);
246
+ $response->setBody($content);
247
+ $response->sendResponse();
248
+ die;
249
+ }
250
+ public function saveOrderAction()
251
+ {
252
+ $items = explode('|',$this->getRequest()->getParam('items'));
253
+ $model = Mage::getModel('gallery/gallery');
254
+ foreach($items as $item)
255
+ {
256
+ $_item = explode('_',$item); //$_item[0] => id, $_item[1]=>order
257
+ $model->load($_item[0]);
258
+ $model->setOrder($_item[1]);
259
+ $model->save();
260
+ }
261
+ $this->_redirect('*/*/index');
262
+ }
263
+ }
app/code/local/Padoo/Gallery/controllers/Admin/ReviewController.php ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_Admin_ReviewController extends Mage_Adminhtml_Controller_action
21
+ {
22
+ protected function _isAllowed()
23
+ {
24
+ return Mage::getSingleton('admin/session')->isAllowed('gallery/review');
25
+ }
26
+ protected function _initAction() {
27
+ $this->loadLayout()
28
+ ->_setActiveMenu('gallery/items')
29
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Photo Manager'), Mage::helper('adminhtml')->__('Photo Manager'));
30
+
31
+ return $this;
32
+ }
33
+
34
+ public function indexAction() {
35
+ $this->_initAction()
36
+ ->renderLayout();
37
+ }
38
+
39
+ public function editAction() {
40
+ $id = $this->getRequest()->getParam('id');
41
+ $model = Mage::getModel('gallery/review')->load($id);
42
+
43
+ if ($model->getId() || $id == 0) {
44
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
45
+ if (!empty($data)) {
46
+ $model->setData($data);
47
+ }
48
+
49
+ Mage::register('review_data', $model);
50
+
51
+ $this->loadLayout();
52
+ $this->_setActiveMenu('gallery/items');
53
+
54
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
55
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
56
+
57
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
58
+
59
+ $this->_addContent($this->getLayout()->createBlock('gallery/admin_review_edit'))
60
+ ->_addLeft($this->getLayout()->createBlock('gallery/admin_review_edit_tabs'));
61
+
62
+ $this->renderLayout();
63
+ } else {
64
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('gallery')->__('Item does not exist'));
65
+ $this->_redirect('*/*/');
66
+ }
67
+ }
68
+
69
+ public function newAction() {
70
+ $this->_forward('edit');
71
+ }
72
+
73
+ public function saveAction() {
74
+ if ($data = $this->getRequest()->getPost()) {
75
+ //save store view
76
+ $storeView = $data['stores'];
77
+ $dataStore = "";
78
+ foreach($storeView as $store){
79
+ if($dataStore != "") $dataStore .=",";
80
+ $dataStore .= $store;
81
+ }
82
+ $data['store_id'] = $dataStore;
83
+
84
+ $model = Mage::getModel('gallery/review');
85
+ $model->setData($data)
86
+ ->setId($this->getRequest()->getParam('id'));
87
+
88
+ try {
89
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
90
+ $model->setCreatedTime(now())
91
+ ->setUpdateTime(now());
92
+ } else {
93
+ $model->setUpdateTime(now());
94
+ }
95
+
96
+ $model->save();
97
+
98
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('gallery')->__('Photo was successfully saved'));
99
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
100
+
101
+ if ($this->getRequest()->getParam('back')) {
102
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
103
+ return;
104
+ }
105
+ $this->_redirect('*/*/');
106
+ return;
107
+ } catch (Exception $e) {
108
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
109
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
110
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
111
+ return;
112
+ }
113
+ }
114
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('gallery')->__('Unable to save review'));
115
+ $this->_redirect('*/*/');
116
+ }
117
+
118
+ public function deleteAction() {
119
+ if( $this->getRequest()->getParam('id') > 0 ) {
120
+ try {
121
+ $model = Mage::getModel('gallery/review');
122
+
123
+ $model->setId($this->getRequest()->getParam('id'))
124
+ ->delete();
125
+
126
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Review was successfully deleted'));
127
+ $this->_redirect('*/*/');
128
+ } catch (Exception $e) {
129
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
130
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
131
+ }
132
+ }
133
+ $this->_redirect('*/*/');
134
+ }
135
+
136
+ public function massDeleteAction() {
137
+ $reviewIds = $this->getRequest()->getParam('review');
138
+ if(!is_array($reviewIds)) {
139
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select photo(s)'));
140
+ } else {
141
+ try {
142
+ foreach ($reviewIds as $reviewId) {
143
+ $gallery = Mage::getModel('gallery/review')->load($reviewId);
144
+ $gallery->delete();
145
+ }
146
+ Mage::getSingleton('adminhtml/session')->addSuccess(
147
+ Mage::helper('adminhtml')->__(
148
+ 'Total of %d record(s) were successfully deleted', count($reviewIds)
149
+ )
150
+ );
151
+ } catch (Exception $e) {
152
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
153
+ }
154
+ }
155
+ $this->_redirect('*/*/index');
156
+ }
157
+
158
+ public function massStatusAction()
159
+ {
160
+ $reviewIds = $this->getRequest()->getParam('review');
161
+ if(!is_array($reviewIds)) {
162
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select review(s)'));
163
+ } else {
164
+ try {
165
+ foreach ($reviewIds as $reviewId) {
166
+ $gallery = Mage::getSingleton('gallery/review')
167
+ ->load($reviewId)
168
+ ->setStatus($this->getRequest()->getParam('status'))
169
+ ->setIsMassupdate(true)
170
+ ->save();
171
+ }
172
+ $this->_getSession()->addSuccess(
173
+ $this->__('Total of %d record(s) were successfully updated', count($reviewIds))
174
+ );
175
+ } catch (Exception $e) {
176
+ $this->_getSession()->addError($e->getMessage());
177
+ }
178
+ }
179
+ $this->_redirect('*/*/index');
180
+ }
181
+
182
+ public function exportCsvAction()
183
+ {
184
+ $fileName = 'gallery_review.csv';
185
+ $content = $this->getLayout()->createBlock('gallery/admin_review_grid')
186
+ ->getCsv();
187
+
188
+ $this->_sendUploadResponse($fileName, $content);
189
+ }
190
+
191
+ public function exportXmlAction()
192
+ {
193
+ $fileName = 'gallery_review.xml';
194
+ $content = $this->getLayout()->createBlock('gallery/admin_review_grid')
195
+ ->getXml();
196
+
197
+ $this->_sendUploadResponse($fileName, $content);
198
+ }
199
+
200
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
201
+ {
202
+ $response = $this->getResponse();
203
+ $response->setHeader('HTTP/1.1 200 OK','');
204
+ $response->setHeader('Pragma', 'public', true);
205
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
206
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
207
+ $response->setHeader('Last-Modified', date('r'));
208
+ $response->setHeader('Accept-Ranges', 'bytes');
209
+ $response->setHeader('Content-Length', strlen($content));
210
+ $response->setHeader('Content-type', $contentType);
211
+ $response->setBody($content);
212
+ $response->sendResponse();
213
+ die;
214
+ }
215
+ public function saveOrderAction()
216
+ {
217
+ $items = explode('|',$this->getRequest()->getParam('items'));
218
+ $model = Mage::getModel('gallery/gallery');
219
+ foreach($items as $item)
220
+ {
221
+ $_item = explode('_',$item); //$_item[0] => id, $_item[1]=>order
222
+ $model->load($_item[0]);
223
+ $model->setOrder($_item[1]);
224
+ $model->save();
225
+ }
226
+ $this->_redirect('*/*/index');
227
+ }
228
+ }
app/code/local/Padoo/Gallery/controllers/IndexController.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_IndexController extends Mage_Core_Controller_Front_Action
21
+ {
22
+ public function indexAction()
23
+ {
24
+ if (!Mage::getStoreConfig('gallery/info/enabled')) $this->_redirect('no-route');
25
+ $this->loadLayout();
26
+ $this->renderLayout();
27
+
28
+ //$this->_redirect('/');
29
+ }
30
+
31
+ public function searchAction()
32
+ {
33
+ if (!Mage::getStoreConfig('gallery/info/enabled')) $this->_redirect('no-route');
34
+ $this->loadLayout();
35
+ $this->renderLayout();
36
+ }
37
+
38
+ public function reviewAction(){
39
+ if (!Mage::getStoreConfig('gallery/info/enabled')) $this->_redirect('no-route');
40
+ $data = $this->getRequest()->getPost();
41
+ $review = Mage::getModel('gallery/review');
42
+ $session = Mage::getSingleton('core/session', array('name'=>'reviewfrontend'));
43
+ try {
44
+ $formId = 'gallery';
45
+ $magentoVersion = Mage::getVersion();
46
+ if (version_compare($magentoVersion, '1.7', '>=')){
47
+ //version is 1.7 or greater
48
+ $captchaModel = Mage::helper('captcha')->getCaptcha($formId);
49
+ if ($captchaModel->isRequired()) {
50
+ $word = $this->_getCaptchaString($this->getRequest(), $formId);
51
+ if (!$captchaModel->isCorrect($word)) {
52
+ Mage::getSingleton('core/session')->addError(Mage::helper('captcha')->__('Incorrect CAPTCHA.'));
53
+ $this->_redirectReferer('');
54
+ return;
55
+ }
56
+ }
57
+ }
58
+
59
+ $review->setGalleryId($data['gallery_id']);
60
+ $review->setReviewName($data['name']);
61
+ $review->setReviewEmail($data['email']);
62
+ $review->setReviewContent($data['content']);
63
+ $review->setReviewRate($data['gallery_rating']);
64
+ $review->setCreatedTime(now());
65
+ $review->setUpdateTime(now());
66
+ $review->save();
67
+ $session->addSuccess($this->__('Your review has been accepted'));
68
+ }catch (Exception $e) {
69
+ $session->setFormData($data);
70
+ $session->addError($this->__('Unable to post review. Please, try again later !'));
71
+ }
72
+
73
+ if ($redirectUrl = Mage::getSingleton('core/session')->getRedirectUrl(true)) {
74
+ $this->_redirectUrl($redirectUrl);
75
+ return;
76
+ }
77
+ $this->_redirectReferer();
78
+ }
79
+
80
+ protected function _getCaptchaString($request, $formId)
81
+ {
82
+ $captchaParams = $request->getPost(Mage_Captcha_Helper_Data::INPUT_NAME_FIELD_VALUE);
83
+ return $captchaParams[$formId];
84
+ }
85
+
86
+ }
app/code/local/Padoo/Gallery/controllers/ViewController.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Padoosoft Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0).
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you are unable to obtain it through the world-wide-web, please send
11
+ * an email to support@mage-addons.com so we can send you a copy immediately.
12
+ *
13
+ * @category Padoo
14
+ * @package Padoo_Gallery
15
+ * @author PadooSoft Team
16
+ * @copyright Copyright (c) 2010-2012 Padoo Co. (http://mage-addons.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Padoo_Gallery_ViewController extends Mage_Core_Controller_Front_Action
21
+ {
22
+ public function indexAction()
23
+ {
24
+ if (!Mage::getStoreConfig('gallery/info/enabled')) $this->_redirect('no-route');
25
+ $this->_redirect('gallery');
26
+ }
27
+
28
+ public function albumAction() {
29
+ if (!Mage::getStoreConfig('gallery/info/enabled')) $this->_redirect('no-route');
30
+ $album_id = $this->getRequest()->getParam('id');
31
+ if($album_id != null && $album_id != '') {
32
+ $album = Mage::getModel('gallery/album')->load($album_id);
33
+ } else {
34
+ $album = null;
35
+ }
36
+
37
+ if ($album) {
38
+ Mage::register('current_album', $album);
39
+ $this->loadLayout();
40
+ $this->renderLayout();
41
+ } else {
42
+ $this->_forward('noRoute');
43
+ }
44
+ }
45
+
46
+ public function detailAction() {
47
+ $id = $this->getRequest()->getParam('id');
48
+ if($id != null && $id != '') {
49
+ $details = Mage::getModel('gallery/gallery')->load($id);
50
+ } else {
51
+ $details = null;
52
+ }
53
+
54
+ if ($details) {
55
+ Mage::register('gallery_detail', $details);
56
+ $this->loadLayout();
57
+ $this->renderLayout();
58
+ } else {
59
+ $this->_forward('noRoute');
60
+ }
61
+ }
62
+ }
app/code/local/Padoo/Gallery/etc/adminhtml.xml ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <gallery module="gallery">
5
+ <title>Gallery 2</title>
6
+ <sort_order>71</sort_order>
7
+ <children>
8
+ <albums module="gallery">
9
+ <title>Manage Albums</title>
10
+ <sort_order>10</sort_order>
11
+ <action>gallery_admin/admin_album</action>
12
+ </albums>
13
+ <photos module="gallery">
14
+ <title>Manage Photos</title>
15
+ <sort_order>20</sort_order>
16
+ <action>gallery_admin/admin_gallery</action>
17
+ </photos>
18
+ <review module="gallery">
19
+ <title>Manage Review</title>
20
+ <sort_order>30</sort_order>
21
+ <action>gallery_admin/admin_review</action>
22
+ </review>
23
+ </children>
24
+ </gallery>
25
+ </menu>
26
+ <acl>
27
+ <resources>
28
+ <all>
29
+ <title>Allow Everything</title>
30
+ </all>
31
+ <admin>
32
+ <children>
33
+ <gallery module="gallery">
34
+ <title>Gallery</title>
35
+ <sort_order>71</sort_order>
36
+ <children>
37
+ <albums module="gallery">
38
+ <title>Manage Albums</title>
39
+ <sort_order>10</sort_order>
40
+ </albums>
41
+ <photos module="gallery">
42
+ <title>Manage Photos</title>
43
+ <sort_order>20</sort_order>
44
+ </photos>
45
+ <review module="gallery">
46
+ <title>Manage Review</title>
47
+ <sort_order>30</sort_order>
48
+ </review>
49
+ </children>
50
+ </gallery>
51
+ <system>
52
+ <children>
53
+ <config>
54
+ <children>
55
+ <gallery translate="title" module="gallery">
56
+ <title>Gallery</title>
57
+ </gallery>
58
+ </children>
59
+ </config>
60
+ </children>
61
+ </system>
62
+ </children>
63
+ </admin>
64
+ </resources>
65
+ </acl>
66
+ <layout>
67
+ <updates>
68
+ <gallery>
69
+ <file>gallery.xml</file>
70
+ </gallery>
71
+ </updates>
72
+ </layout>
73
+ </config>
app/code/local/Padoo/Gallery/etc/config.xml ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Padoo_Gallery>
5
+ <version>1.0.2</version>
6
+ </Padoo_Gallery>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <gallery>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Padoo_Gallery</module>
14
+ <frontName>gallery</frontName>
15
+ </args>
16
+ </gallery>
17
+ </routers>
18
+ <translate>
19
+ <modules>
20
+ <Padoo_Gallery>
21
+ <files>
22
+ <default>Padoo_Gallery.csv</default>
23
+ </files>
24
+ </Padoo_Gallery>
25
+ </modules>
26
+ </translate>
27
+ <layout>
28
+ <updates>
29
+ <gallery>
30
+ <file>padoo_gallery.xml</file>
31
+ </gallery>
32
+ </updates>
33
+ </layout>
34
+ </frontend>
35
+ <admin>
36
+ <routers>
37
+ <gallery_admin>
38
+ <use>admin</use>
39
+ <args>
40
+ <module>Padoo_Gallery</module>
41
+ <frontName>gallery_admin</frontName>
42
+ </args>
43
+ </gallery_admin>
44
+ </routers>
45
+ </admin>
46
+ <adminhtml>
47
+ <menu>
48
+ <gallery module="gallery">
49
+ <title>Gallery</title>
50
+ <sort_order>71</sort_order>
51
+ <children>
52
+ <albums module="gallery">
53
+ <title>Manage Albums</title>
54
+ <sort_order>10</sort_order>
55
+ <action>gallery_admin/admin_album</action>
56
+ </albums>
57
+ <photos module="gallery">
58
+ <title>Manage Photos</title>
59
+ <sort_order>20</sort_order>
60
+ <action>gallery_admin/admin_gallery</action>
61
+ </photos>
62
+ <review module="gallery">
63
+ <title>Manage Review</title>
64
+ <sort_order>30</sort_order>
65
+ <action>gallery_admin/admin_review</action>
66
+ </review>
67
+ </children>
68
+ </gallery>
69
+ </menu>
70
+ <acl>
71
+ <resources>
72
+ <all>
73
+ <title>Allow Everything</title>
74
+ </all>
75
+ <admin>
76
+ <children>
77
+ <gallery module="gallery">
78
+ <title>Gallery</title>
79
+ <sort_order>71</sort_order>
80
+ <children>
81
+ <albums module="gallery">
82
+ <title>Manage Albums</title>
83
+ <sort_order>10</sort_order>
84
+ </albums>
85
+ <photos module="gallery">
86
+ <title>Manage Photos</title>
87
+ <sort_order>20</sort_order>
88
+ </photos>
89
+ <review module="gallery">
90
+ <title>Manage Review</title>
91
+ <sort_order>30</sort_order>
92
+ </review>
93
+ </children>
94
+ </gallery>
95
+ <system>
96
+ <children>
97
+ <config>
98
+ <children>
99
+ <gallery translate="title" module="gallery">
100
+ <title>Gallery</title>
101
+ </gallery>
102
+ </children>
103
+ </config>
104
+ </children>
105
+ </system>
106
+ </children>
107
+ </admin>
108
+ </resources>
109
+ </acl>
110
+ <layout>
111
+ <updates>
112
+ <gallery>
113
+ <file>padoo_gallery.xml</file>
114
+ </gallery>
115
+ </updates>
116
+ </layout>
117
+ </adminhtml>
118
+ <global>
119
+ <models>
120
+ <gallery>
121
+ <class>Padoo_Gallery_Model</class>
122
+ <resourceModel>gallery_mysql4</resourceModel>
123
+ </gallery>
124
+ <gallery_mysql4>
125
+ <class>Padoo_Gallery_Model_Mysql4</class>
126
+ <entities>
127
+ <gallery>
128
+ <table>gallery</table>
129
+ </gallery>
130
+ <album>
131
+ <table>gallery_album</table>
132
+ </album>
133
+ <review>
134
+ <table>gallery_review</table>
135
+ </review>
136
+ </entities>
137
+ </gallery_mysql4>
138
+ </models>
139
+ <resources>
140
+ <gallery_setup>
141
+ <setup>
142
+ <module>Padoo_Gallery</module>
143
+ </setup>
144
+ <connection>
145
+ <use>core_setup</use>
146
+ </connection>
147
+ </gallery_setup>
148
+ <gallery_write>
149
+ <connection>
150
+ <use>core_write</use>
151
+ </connection>
152
+ </gallery_write>
153
+ <gallery_read>
154
+ <connection>
155
+ <use>core_read</use>
156
+ </connection>
157
+ </gallery_read>
158
+ </resources>
159
+ <blocks>
160
+ <gallery>
161
+ <class>Padoo_Gallery_Block</class>
162
+ </gallery>
163
+ </blocks>
164
+ <helpers>
165
+ <gallery>
166
+ <class>Padoo_Gallery_Helper</class>
167
+ </gallery>
168
+ </helpers>
169
+ </global>
170
+ <default>
171
+ <captcha>
172
+ <frontend>
173
+ <areas>
174
+ <gallery>
175
+ <label>Gallery Page</label>
176
+ </gallery>
177
+ </areas>
178
+ </frontend>
179
+ </captcha>
180
+ <customer>
181
+ <captcha>
182
+ <enable>1</enable>
183
+ <always_for>
184
+ <gallery>1</gallery>
185
+ </always_for>
186
+ <forms>gallery</forms>
187
+ </captcha>
188
+ </customer>
189
+ <gallery>
190
+ <info>
191
+ <enabled>1</enabled>
192
+ </info>
193
+ </gallery>
194
+ </default>
195
+ </config>
app/code/local/Padoo/Gallery/etc/system.xml ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <padoo_templates translate="label" module="gallery">
5
+ <label>Padoosoft extension</label>
6
+ <!-- it relation to diplaying position on left menu -->
7
+ <sort_order>198</sort_order>
8
+ </padoo_templates>
9
+ </tabs>
10
+ <sections>
11
+ <gallery translate="label" module="gallery">
12
+ <label>Gallery</label>
13
+ <tab>padoo_templates</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>4</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <info translate="label">
21
+ <label>General</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>10</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <fields>
28
+ <enabled translate="label">
29
+ <label>Enable</label>
30
+ <frontend_type>select</frontend_type>
31
+ <source_model>adminhtml/system_config_source_yesno</source_model>
32
+ <sort_order>1</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </enabled>
37
+ <enabled_pagination translate="label">
38
+ <label>Allow to show pagination</label>
39
+ <frontend_type>select</frontend_type>
40
+ <source_model>adminhtml/system_config_source_yesno</source_model>
41
+ <sort_order>2</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ </enabled_pagination>
46
+ <images_per_page_allowed translate="label">
47
+ <label>Images Per Page Allowed Values</label>
48
+ <frontend_type>text</frontend_type>
49
+ <sort_order>3</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ <comment>example 4,8,12 ...</comment>
54
+ </images_per_page_allowed>
55
+ <images_per_page_default_value translate="label">
56
+ <label>Images Per Page Default Value</label>
57
+ <frontend_type>text</frontend_type>
58
+ <sort_order>4</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </images_per_page_default_value>
63
+ <enable_search_box translate="label">
64
+ <label>Enable show search box</label>
65
+ <frontend_type>select</frontend_type>
66
+ <source_model>adminhtml/system_config_source_yesno</source_model>
67
+ <sort_order>5</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ </enable_search_box>
72
+ <toplink translate="label">
73
+ <label>Show Top Links</label>
74
+ <frontend_type>select</frontend_type>
75
+ <source_model>adminhtml/system_config_source_yesno</source_model>
76
+ <sort_order>6</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
+ </toplink>
81
+ </fields>
82
+ </info>
83
+ <lightbox translate="label">
84
+ <label>Light Box</label>
85
+ <frontend_type>text</frontend_type>
86
+ <sort_order>15</sort_order>
87
+ <show_in_default>1</show_in_default>
88
+ <show_in_website>1</show_in_website>
89
+ <show_in_store>1</show_in_store>
90
+ <fields>
91
+ <enable_lightbox translate="label">
92
+ <label>Enable Light box</label>
93
+ <frontend_type>select</frontend_type>
94
+ <source_model>adminhtml/system_config_source_yesno</source_model>
95
+ <sort_order>1</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ </enable_lightbox>
100
+ <enable_description_lightbox translate="label">
101
+ <label>Enable show description</label>
102
+ <frontend_type>select</frontend_type>
103
+ <source_model>adminhtml/system_config_source_yesno</source_model>
104
+ <sort_order>2</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>1</show_in_store>
108
+ </enable_description_lightbox>
109
+ </fields>
110
+ </lightbox>
111
+ <reviews translate="label">
112
+ <label>Reviews</label>
113
+ <frontend_type>text</frontend_type>
114
+ <sort_order>20</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ <fields>
119
+ <enable_review translate="label">
120
+ <label>Enable Review</label>
121
+ <frontend_type>select</frontend_type>
122
+ <source_model>adminhtml/system_config_source_yesno</source_model>
123
+ <sort_order>1</sort_order>
124
+ <show_in_default>1</show_in_default>
125
+ <show_in_website>1</show_in_website>
126
+ <show_in_store>1</show_in_store>
127
+ </enable_review>
128
+ <enable_write_review translate="label">
129
+ <label>Enable guest write review</label>
130
+ <frontend_type>select</frontend_type>
131
+ <source_model>adminhtml/system_config_source_yesno</source_model>
132
+ <sort_order>2</sort_order>
133
+ <show_in_default>1</show_in_default>
134
+ <show_in_website>1</show_in_website>
135
+ <show_in_store>1</show_in_store>
136
+ </enable_write_review>
137
+ </fields>
138
+ </reviews>
139
+ </groups>
140
+ </gallery>
141
+ </sections>
142
+ </config>
app/code/local/Padoo/Gallery/sql/gallery_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ DROP TABLE IF EXISTS {$this->getTable('gallery_album')};
10
+ CREATE TABLE {$this->getTable('gallery_album')} (
11
+ `album_id` int(11) unsigned NOT NULL auto_increment,
12
+ `title` varchar(255) NOT NULL default '',
13
+ `filename` varchar(255) NOT NULL default '',
14
+ `content` text NOT NULL default '',
15
+ `status` smallint(6) NOT NULL default '0',
16
+ `created_time` datetime NULL,
17
+ `update_time` datetime NULL,
18
+ PRIMARY KEY (`album_id`)
19
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
20
+
21
+ DROP TABLE IF EXISTS {$this->getTable('gallery')};
22
+ CREATE TABLE {$this->getTable('gallery')} (
23
+ `gallery_id` int(11) unsigned NOT NULL auto_increment,
24
+ `album_id` int(11) unsigned NOT NULL,
25
+ `title` varchar(255) NOT NULL default '',
26
+ `filename` varchar(255) NOT NULL default '',
27
+ `content` text NOT NULL default '',
28
+ `status` smallint(6) NOT NULL default '0',
29
+ `created_time` datetime NULL,
30
+ `update_time` datetime NULL,
31
+ PRIMARY KEY (`gallery_id`)
32
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
33
+
34
+ DROP TABLE IF EXISTS {$this->getTable('gallery_review')};
35
+ CREATE TABLE {$this->getTable('gallery_review')} (
36
+ `review_id` int(11) unsigned NOT NULL auto_increment,
37
+ `gallery_id` int(11) unsigned NOT NULL,
38
+ `review_name` varchar(255) NOT NULL default '',
39
+ `review_email` varchar(255) NOT NULL default '',
40
+ `review_content` text NOT NULL default '',
41
+ `review_rate` smallint(6) NOT NULL default '0',
42
+ `status` smallint(6) NOT NULL default '0',
43
+ `created_time` datetime NULL,
44
+ `update_time` datetime NULL,
45
+ `order` tinyint(4) NOT NULL default '0',
46
+ PRIMARY KEY (`review_id`)
47
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
48
+
49
+ ");
50
+
51
+ $installer->endSetup();
app/code/local/Padoo/Gallery/sql/gallery_setup/mysql4-upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Checkout
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ $installer = $this;
28
+ /* @var $installer Mage_Core_Model_Resource_Setup */
29
+
30
+ $installer->startSetup();
31
+
32
+ $installer->getConnection()->addColumn($installer->getTable('gallery'), 'order',
33
+ 'tinyint(4) NOT NULL DEFAULT 0 AFTER update_time'
34
+ );
35
+ $installer->getConnection()->addColumn($installer->getTable('gallery_album'), 'order',
36
+ 'tinyint(4) NOT NULL DEFAULT 0 AFTER update_time'
37
+ );
38
+ $installer->endSetup();
app/code/local/Padoo/Gallery/sql/gallery_setup/mysql4-upgrade-0.1.1-0.1.2.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Checkout
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ $installer = $this;
28
+ /* @var $installer Mage_Core_Model_Resource_Setup */
29
+
30
+ $installer->startSetup();
31
+
32
+ $installer->getConnection()->addColumn($installer->getTable('gallery_album'), 'url_rewrite_id',
33
+ 'int( 11 ) NOT NULL AFTER album_id'
34
+ );
35
+ $installer->getConnection()->addColumn($installer->getTable('gallery_album'), 'url_key',
36
+ 'VARCHAR( 255 ) NOT NULL AFTER url_rewrite_id'
37
+ );
38
+
39
+ /*$installer->getConnection()->addColumn($installer->getTable('gallery'), 'url_key',
40
+ 'VARCHAR( 255 ) NOT NULL AFTER url_rewrite_id'
41
+ );
42
+ $installer->getConnection()->addColumn($installer->getTable('gallery'), 'url_rewrite_id',
43
+ 'int( 11 ) NOT NULL AFTER album_id'
44
+ );
45
+ */
46
+ $installer->endSetup();
47
+ $installer = $this;
48
+
app/code/local/Padoo/Gallery/sql/gallery_setup/mysql4-upgrade-0.1.2-0.1.3.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ /* @var $installer Mage_Core_Model_Resource_Setup */
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->getConnection()->addColumn($installer->getTable('gallery_album'), 'identifier',
8
+ 'varchar(255) NOT NULL AFTER album_id'
9
+ );
10
+
11
+ /*$installer->getConnection()->addColumn($installer->getTable('gallery'), 'url_key',
12
+ 'VARCHAR( 255 ) NOT NULL AFTER url_rewrite_id'
13
+ );
14
+ $installer->getConnection()->addColumn($installer->getTable('gallery'), 'url_rewrite_id',
15
+ 'int( 11 ) NOT NULL AFTER album_id'
16
+ );
17
+ */
18
+ $installer->endSetup();
19
+ $installer = $this;
app/code/local/Padoo/Gallery/sql/gallery_setup/mysql4-upgrade-1.0.1-1.0.2.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ /* @var $installer Mage_Core_Model_Resource_Setup */
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->getConnection()->addColumn($installer->getTable('gallery_album'), 'store_id',
8
+ 'varchar(255) NOT NULL AFTER update_time'
9
+ );
10
+
11
+ $installer->getConnection()->addColumn($installer->getTable('gallery'), 'store_id',
12
+ 'VARCHAR( 255 ) NOT NULL AFTER update_time'
13
+ );
14
+ $installer->getConnection()->addColumn($installer->getTable('gallery_review'), 'store_id',
15
+ 'VARCHAR( 255 ) NOT NULL AFTER update_time'
16
+ );
17
+
18
+ $installer->endSetup();
19
+ $installer = $this;
app/design/adminhtml/default/default/layout/padoo_gallery.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <gallery_admin_admin_review_index>
4
+ <reference name="content">
5
+ <block type="gallery/admin_review" name="review" />
6
+ </reference>
7
+ </gallery_admin_admin_review_index>
8
+ <gallery_admin_admin_gallery_index>
9
+ <reference name="content">
10
+ <block type="gallery/admin_gallery" name="gallery" />
11
+ </reference>
12
+ </gallery_admin_admin_gallery_index>
13
+ <gallery_admin_admin_album_index>
14
+ <reference name="content">
15
+ <block type="gallery/admin_album" name="album" />
16
+ </reference>
17
+ </gallery_admin_admin_album_index>
18
+ </layout>
app/design/adminhtml/default/default/template/gallery/grid.phtml ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design_default
22
+ * @package Mage
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Template for Mage_Adminhtml_Block_Widget_Grid
30
+ *
31
+ * getId()
32
+ * getCollection()
33
+ * getColumns()
34
+ * getPagerVisibility()
35
+ * getVarNamePage()
36
+ */
37
+ $numColumns = sizeof($this->getColumns());
38
+ ?>
39
+ <script language="javascript" type="text/javascript">
40
+ if (!Array.prototype.inArray) {
41
+ Array.prototype.inArray=function(val) {
42
+ for (key in this) {
43
+ if (this[key]===val) {
44
+ return true; // If you want the key of the matched value, change "true" to "key"
45
+ }
46
+ }
47
+ return false;
48
+ }
49
+ }
50
+
51
+ function saveSort()
52
+ {
53
+ var numArr = new Array();
54
+ for(i = 0; i < 100; i ++)
55
+ {
56
+ numArr[i] = ""+i;
57
+ }
58
+
59
+ elements = document.getElementsByTagName('input')
60
+ var orders ='';
61
+ j = 0;
62
+ for(i = 0; i < elements.length; i ++)
63
+ {
64
+ if(elements[i].className == 'c_order')
65
+ {
66
+ if(numArr.inArray(elements[i].value))
67
+ {
68
+ orders += elements[i].title + "_" + elements[i].value +"|";
69
+ elements[i].style.border ="1px #000 solid";
70
+ }
71
+ else
72
+ {
73
+ elements[i].style.border ="1px #D40707 dashed";
74
+ elements[i].focus();
75
+ alert('Order must be a number!');
76
+ return;
77
+ }
78
+ }
79
+ }
80
+ param = orders.substr(0,orders.length-1);
81
+ window.location="<?php echo $this->getUrl('*/*/saveOrder/')?>items/" + param;
82
+ }
83
+ </script>
84
+ <?php if($this->getCollection()): ?>
85
+ <?php if($this->canDisplayContainer()): ?>
86
+ <?php if($this->getGridHeader()): ?>
87
+ <div class="content-header">
88
+ <table cellspacing="0">
89
+ <tr>
90
+ <td style="width:50%;"><h2><?php echo $this->getGridHeader(); ?></h2></td>
91
+ </tr>
92
+ </table>
93
+ </div>
94
+ <?php endif ?>
95
+
96
+ <div id="<?php echo $this->getId() ?>">
97
+ <?php else: ?>
98
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
99
+ <?php endif; ?>
100
+ <?php if($this->getPagerVisibility() || $this->getExportTypes() || $this->getFilterVisibility()): ?>
101
+ <table cellspacing="0" class="actions">
102
+ <tr>
103
+ <?php if($this->getPagerVisibility()): ?>
104
+ <td class="pager">
105
+ <?php echo $this->__('Page') ?>
106
+
107
+ <?php $_curPage = $this->getCollection()->getCurPage() ?>
108
+ <?php $_lastPage = $this->getCollection()->getLastPageNumber() ?>
109
+ <?php if($_curPage>1): ?>
110
+ <a href="#" title="<?php echo $this->__('Previous page') ?>" onclick="<?php echo $this->getId() ?>JsObject.setPage('<?php echo ($_curPage-1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="Go to Previous page" class="arrow"/></a>
111
+ <?php else: ?>
112
+ <img src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
113
+ <?php endif; ?>
114
+
115
+ <input type="text" name="<?php echo $this->getVarNamePage() ?>" value="<?php echo $_curPage ?>" class="input-text page" onkeypress="<?php echo $this->getId() ?>JsObject.inputPage(event, '<?php echo $_lastPage ?>')"/>
116
+
117
+ <?php if($_curPage < $_lastPage): ?>
118
+ <a href="#" title="<?php echo $this->__('Next page') ?>" onclick="<?php echo $this->getId() ?>JsObject.setPage('<?php echo ($_curPage+1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="Go to Next page" class="arrow"/></a>
119
+ <?php else: ?>
120
+ <img src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
121
+ <?php endif; ?>
122
+
123
+ <?php echo $this->__('of %s pages', $this->getCollection()->getLastPageNumber()) ?>
124
+ <span class="separator">|</span>
125
+ <?php echo $this->__('View') ?>
126
+ <select name="<?php echo $this->getVarNameLimit() ?>" onchange="<?php echo $this->getId() ?>JsObject.loadByElement(this)">
127
+ <option value="20"<?php if($this->getCollection()->getPageSize()==20): ?> selected="selected"<?php endif; ?>>20</option>
128
+ <option value="30"<?php if($this->getCollection()->getPageSize()==30): ?> selected="selected"<?php endif; ?>>30</option>
129
+ <option value="50"<?php if($this->getCollection()->getPageSize()==50): ?> selected="selected"<?php endif; ?>>50</option>
130
+ <option value="100"<?php if($this->getCollection()->getPageSize()==100): ?> selected="selected"<?php endif; ?>>100</option>
131
+ <option value="200"<?php if($this->getCollection()->getPageSize()==200): ?> selected="selected"<?php endif; ?>>200</option>
132
+ </select>
133
+ <?php echo $this->__('per page') ?><span class="separator">|</span>
134
+ <?php echo $this->__('Total %d records found', $this->getCollection()->getSize()) ?>
135
+ <span id="<?php echo $this->getHtmlId() ?>-total-count" class="no-display"><?php echo $this->getCollection()->getSize() ?></span>
136
+ <?php if($this->getRssLists()): ?>
137
+ <?php foreach ($this->getRssLists() as $_rss): ?>
138
+ <span class="separator">|</span><a href="<?php echo $_rss->getUrl() ?>" class="link-feed"><?php echo $_rss->getLabel() ?></a>
139
+ <?php endforeach ?>
140
+ <?php endif; ?>
141
+ </td>
142
+ <?php endif ?>
143
+ <?php if($this->getExportTypes()): ?>
144
+ <td class="export a-right">
145
+ <img src="<?php echo $this->getSkinUrl('images/icon_export.gif') ?>" alt="" class="v-middle"/>&nbsp; <?php echo $this->__('Export to:') ?>
146
+ <select name="<?php echo $this->getId() ?>_export" id="<?php echo $this->getId() ?>_export" style="width:8em;">
147
+ <?php foreach ($this->getExportTypes() as $_type): ?>
148
+ <option value="<?php echo $_type->getUrl() ?>"><?php echo $_type->getLabel() ?></option>
149
+ <?php endforeach; ?>
150
+ </select>
151
+ <?php echo $this->getExportButtonHtml() ?>
152
+ </td>
153
+ <?php endif; ?>
154
+ <td class="filter-actions a-right">
155
+ <?php echo $this->getMainButtonsHtml() ?>
156
+ </td>
157
+ </tr>
158
+ </table>
159
+ <?php endif; ?>
160
+ <?php if($this->getMassactionBlock()->isAvailable()): ?>
161
+ <?php echo $this->getMassactionBlockHtml() ?>
162
+ <?php endif ?>
163
+ <div class="grid">
164
+ <div class="hor-scroll">
165
+ <table cellspacing="0" class="data" id="<?php echo $this->getId() ?>_table">
166
+ <?php foreach ($this->getColumns() as $_column): ?>
167
+ <col <?php echo $_column->getHtmlProperty() ?> />
168
+ <?php if ($_column->getEditable() && !$_column->getEditOnly()) : ?>
169
+ <col <?php echo $_column->getHtmlProperty() ?> />
170
+ <?php endif ?>
171
+ <?php endforeach; ?>
172
+ <?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?>
173
+ <thead>
174
+ <?php if ($this->getHeadersVisibility()): ?>
175
+ <tr class="headings">
176
+ <?php foreach ($this->getColumns() as $_column): ?>
177
+ <th<?php echo $_column->getHeaderHtmlProperty() ?>><span class="nobr"><?php echo $_column->getHeaderHtml() ?></span></th>
178
+ <?php endforeach; ?>
179
+ </tr>
180
+ <?php endif; ?>
181
+ <?php if ($this->getFilterVisibility()): ?>
182
+ <tr class="filter">
183
+ <?php $i=0;foreach ($this->getColumns() as $_column): ?>
184
+ <th<?php echo $_column->getHeaderHtmlProperty() ?>><?php echo $_column->getFilterHtml() ?></th>
185
+ <?php endforeach; ?>
186
+ </tr>
187
+ <?php endif ?>
188
+ </thead>
189
+ <?php endif; ?>
190
+ <?php if ($this->getCountTotals()): ?>
191
+ <tfoot>
192
+ <tr>
193
+ <?php foreach ($this->getColumns() as $_column): ?>
194
+ <th class="<?php echo $_column->getCssProperty() ?>"><?php echo $_column->getRowField($_column->getGrid()->getTotals()) ?>&nbsp;</th>
195
+ <?php endforeach; ?>
196
+ </tr>
197
+ </tfoot>
198
+ <?php endif; ?>
199
+ <tbody>
200
+ <?php if (($this->getCollection()->getSize()>0) && (!$this->getIsCollapsed())): ?>
201
+ <?php foreach ($this->getCollection() as $_index=>$_item): ?>
202
+ <tr title="<?php echo $this->getRowUrl($_item) ?>"<?php if ($_class = $this->getRowClass($_item)):?> class="<?php echo $_class; ?>"<?php endif;?> >
203
+ <?php $i=0;foreach ($this->getColumns() as $column_id=>$_column): ?>
204
+ <td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns?'last':'' ?>">
205
+ <?php $thumbsize = $this->getThumbnailSize()?>
206
+
207
+ <?php
208
+ if( ($_html = $_column->getRowField($_item)) != '')
209
+ {
210
+ switch($column_id){
211
+ case "filename":
212
+ $_html = '<img src="'.$this->helper('gallery/image')->init($_html)->resize($thumbsize['width'],$thumbsize['height']).'">';
213
+ break;
214
+ case "order":
215
+ $_html = '<input title="'.$_item->getId().'" class="c_order" style="width:50px;" type="text" value="'.$_html.'">';
216
+ break;
217
+ default:
218
+ }
219
+ }else $_html="&nbsp;" ;
220
+ echo $_html;
221
+ ?>
222
+ </td>
223
+ <?php endforeach; ?>
224
+ </tr>
225
+ <?php endforeach; ?>
226
+ <?php elseif ($this->getEmptyText()): ?>
227
+ <tr>
228
+ <td class="empty-text <?php echo $this->getEmptyTextClass() ?>" colspan="100"><?php echo $this->getEmptyText() ?></td>
229
+ </tr>
230
+ <?php endif; ?>
231
+ </tbody>
232
+ </table>
233
+ </div>
234
+ </div>
235
+ <?php if($this->canDisplayContainer()): ?>
236
+ </div>
237
+ <script type="text/javascript">
238
+ //<![CDATA[
239
+ <?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
240
+ <?php echo $this->getJsObjectName() ?>.useAjax = '<?php echo $this->getUseAjax() ?>';
241
+ <?php if($this->getRowClickCallback()): ?>
242
+ <?php echo $this->getJsObjectName() ?>.rowClickCallback = <?php echo $this->getRowClickCallback() ?>;
243
+ <?php endif; ?>
244
+ <?php if($this->getCheckboxCheckCallback()): ?>
245
+ <?php echo $this->getJsObjectName() ?>.checkboxCheckCallback = <?php echo $this->getCheckboxCheckCallback() ?>;
246
+ <?php endif; ?>
247
+ <?php if($this->getRowInitCallback()): ?>
248
+ <?php echo $this->getJsObjectName() ?>.initRowCallback = <?php echo $this->getRowInitCallback() ?>;
249
+ <?php echo $this->getJsObjectName() ?>.rows.each(function(row){<?php echo $this->getRowInitCallback() ?>(<?php echo $this->getJsObjectName() ?>, row)});
250
+ <?php endif; ?>
251
+ <?php if($this->getMassactionBlock()->isAvailable()): ?>
252
+ <?php echo $this->getMassactionBlock()->getJavaScript() ?>
253
+ <?php endif ?>
254
+ //]]>
255
+ </script>
256
+ <?php endif; ?>
257
+ <?php endif ?>
app/design/adminhtml/default/default/template/gallery/grid1.phtml ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Template for Mage_Adminhtml_Block_Widget_Grid
30
+ *
31
+ * getId()
32
+ * getCollection()
33
+ * getColumns()
34
+ * getPagerVisibility()
35
+ * getVarNamePage()
36
+ */
37
+ $numColumns = sizeof($this->getColumns());
38
+ ?>
39
+ <script language="javascript" type="text/javascript">
40
+ if (!Array.prototype.inArray) {
41
+ Array.prototype.inArray=function(val) {
42
+ for (key in this) {
43
+ if (this[key]===val) {
44
+ return true; // If you want the key of the matched value, change "true" to "key"
45
+ }
46
+ }
47
+ return false;
48
+ }
49
+ }
50
+
51
+ function saveSort()
52
+ {
53
+ var numArr = new Array();
54
+ for(i = 0; i < 100; i ++)
55
+ {
56
+ numArr[i] = ""+i;
57
+ }
58
+
59
+ elements = document.getElementsByTagName('input')
60
+ var orders ='';
61
+ j = 0;
62
+ for(i = 0; i < elements.length; i ++)
63
+ {
64
+ if(elements[i].className == 'c_order')
65
+ {
66
+ if(numArr.inArray(elements[i].value))
67
+ {
68
+ orders += elements[i].title + "_" + elements[i].value +"|";
69
+ elements[i].style.border ="1px #000 solid";
70
+ }
71
+ else
72
+ {
73
+ elements[i].style.border ="1px #D40707 dashed";
74
+ elements[i].focus();
75
+ alert('Order must be a number!');
76
+ return;
77
+ }
78
+ }
79
+ }
80
+ param = orders.substr(0,orders.length-1);
81
+ window.location="<?php echo $this->getUrl('*/*/saveOrder/')?>items/" + param;
82
+ }
83
+ </script>
84
+ <?php if($this->getCollection()): ?>
85
+ <?php if($this->canDisplayContainer()): ?>
86
+ <?php if($this->getGridHeader()): ?>
87
+ <div class="content-header">
88
+ <table cellspacing="0">
89
+ <tr>
90
+ <td style="width:50%;"><h2><?php echo $this->getGridHeader(); ?></h2></td>
91
+ </tr>
92
+ </table>
93
+ </div>
94
+ <?php endif ?>
95
+
96
+ <div id="<?php echo $this->getId() ?>">
97
+ <?php else: ?>
98
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
99
+ <?php endif; ?>
100
+ <?php if($this->getPagerVisibility() || $this->getExportTypes() || $this->getFilterVisibility()): ?>
101
+ <table cellspacing="0" class="actions">
102
+ <tr>
103
+ <?php if($this->getPagerVisibility()): ?>
104
+ <td class="pager">
105
+ <?php echo $this->__('Page') ?>
106
+
107
+ <?php $_curPage = $this->getCollection()->getCurPage() ?>
108
+ <?php $_lastPage = $this->getCollection()->getLastPageNumber() ?>
109
+ <?php if($_curPage>1): ?>
110
+ <a href="#" title="<?php echo $this->__('Previous page') ?>" onclick="<?php echo $this->getId() ?>JsObject.setPage('<?php echo ($_curPage-1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="Go to Previous page" class="arrow"/></a>
111
+ <?php else: ?>
112
+ <img src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
113
+ <?php endif; ?>
114
+
115
+ <input type="text" name="<?php echo $this->getVarNamePage() ?>" value="<?php echo $_curPage ?>" class="input-text page" onkeypress="<?php echo $this->getId() ?>JsObject.inputPage(event, '<?php echo $_lastPage ?>')"/>
116
+
117
+ <?php if($_curPage < $_lastPage): ?>
118
+ <a href="#" title="<?php echo $this->__('Next page') ?>" onclick="<?php echo $this->getId() ?>JsObject.setPage('<?php echo ($_curPage+1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="Go to Next page" class="arrow"/></a>
119
+ <?php else: ?>
120
+ <img src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
121
+ <?php endif; ?>
122
+
123
+ <?php echo $this->__('of %s pages', $this->getCollection()->getLastPageNumber()) ?>
124
+ <span class="separator">|</span>
125
+ <?php echo $this->__('View') ?>
126
+ <select name="<?php echo $this->getVarNameLimit() ?>" onchange="<?php echo $this->getId() ?>JsObject.loadByElement(this)">
127
+ <option value="20"<?php if($this->getCollection()->getPageSize()==20): ?> selected="selected"<?php endif; ?>>20</option>
128
+ <option value="30"<?php if($this->getCollection()->getPageSize()==30): ?> selected="selected"<?php endif; ?>>30</option>
129
+ <option value="50"<?php if($this->getCollection()->getPageSize()==50): ?> selected="selected"<?php endif; ?>>50</option>
130
+ <option value="100"<?php if($this->getCollection()->getPageSize()==100): ?> selected="selected"<?php endif; ?>>100</option>
131
+ <option value="200"<?php if($this->getCollection()->getPageSize()==200): ?> selected="selected"<?php endif; ?>>200</option>
132
+ </select>
133
+ <?php echo $this->__('per page') ?><span class="separator">|</span>
134
+ <?php echo $this->__('Total %d records found', $this->getCollection()->getSize()) ?>
135
+ <span id="<?php echo $this->getHtmlId() ?>-total-count" class="no-display"><?php echo $this->getCollection()->getSize() ?></span>
136
+ <?php if($this->getRssLists()): ?>
137
+ <?php foreach ($this->getRssLists() as $_rss): ?>
138
+ <span class="separator">|</span><a href="<?php echo $_rss->getUrl() ?>" class="link-feed"><?php echo $_rss->getLabel() ?></a>
139
+ <?php endforeach ?>
140
+ <?php endif; ?>
141
+ </td>
142
+ <?php endif ?>
143
+ <?php if($this->getExportTypes()): ?>
144
+ <td class="export a-right">
145
+ <img src="<?php echo $this->getSkinUrl('images/icon_export.gif') ?>" alt="" class="v-middle"/>&nbsp; <?php echo $this->__('Export to:') ?>
146
+ <select name="<?php echo $this->getId() ?>_export" id="<?php echo $this->getId() ?>_export" style="width:8em;">
147
+ <?php foreach ($this->getExportTypes() as $_type): ?>
148
+ <option value="<?php echo $_type->getUrl() ?>"><?php echo $_type->getLabel() ?></option>
149
+ <?php endforeach; ?>
150
+ </select>
151
+ <?php echo $this->getExportButtonHtml() ?>
152
+ </td>
153
+ <?php endif; ?>
154
+ <td class="filter-actions a-right">
155
+ <?php echo $this->getMainButtonsHtml() ?>
156
+ </td>
157
+ </tr>
158
+ </table>
159
+ <?php endif; ?>
160
+ <?php if($this->getMassactionBlock()->isAvailable()): ?>
161
+ <?php echo $this->getMassactionBlockHtml() ?>
162
+ <?php endif ?>
163
+ <div class="grid">
164
+ <div class="hor-scroll">
165
+ <table cellspacing="0" class="data" id="<?php echo $this->getId() ?>_table">
166
+ <?php foreach ($this->getColumns() as $_column): ?>
167
+ <col <?php echo $_column->getHtmlProperty() ?> />
168
+ <?php if ($_column->getEditable() && !$_column->getEditOnly()) : ?>
169
+ <col <?php echo $_column->getHtmlProperty() ?> />
170
+ <?php endif ?>
171
+ <?php endforeach; ?>
172
+ <?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?>
173
+ <thead>
174
+ <?php if ($this->getHeadersVisibility()): ?>
175
+ <tr class="headings">
176
+ <?php foreach ($this->getColumns() as $_column): ?>
177
+ <th<?php echo $_column->getHeaderHtmlProperty() ?>><span class="nobr"><?php echo $_column->getHeaderHtml() ?></span></th>
178
+ <?php endforeach; ?>
179
+ </tr>
180
+ <?php endif; ?>
181
+ <?php if ($this->getFilterVisibility()): ?>
182
+ <tr class="filter">
183
+ <?php $i=0;foreach ($this->getColumns() as $_column): ?>
184
+ <th<?php echo $_column->getHeaderHtmlProperty() ?>><?php echo $_column->getFilterHtml() ?></th>
185
+ <?php endforeach; ?>
186
+ </tr>
187
+ <?php endif ?>
188
+ </thead>
189
+ <?php endif; ?>
190
+ <?php if ($this->getCountTotals()): ?>
191
+ <tfoot>
192
+ <tr class="totals">
193
+ <?php foreach ($this->getColumns() as $_column): ?>
194
+ <th class="<?php echo $_column->getCssProperty() ?>"><?php echo ($_column->hasTotalsLabel()) ? $_column->getTotalsLabel() : $_column->getRowField($_column->getGrid()->getTotals()) ?>&nbsp;</th>
195
+ <?php endforeach; ?>
196
+ </tr>
197
+ </tfoot>
198
+ <?php endif; ?>
199
+
200
+ <tbody>
201
+ <?php if (($this->getCollection()->getSize()>0) && (!$this->getIsCollapsed())): ?>
202
+ <?php foreach ($this->getCollection() as $_index=>$_item): ?>
203
+ <tr title="<?php echo $this->getRowUrl($_item) ?>"<?php if ($_class = $this->getRowClass($_item)):?> class="<?php echo $_class; ?>"<?php endif;?> >
204
+ <?php $i=0;foreach ($this->getColumns() as $column_id=>$_column): ?>
205
+
206
+ <?php if ($this->shouldRenderCell($_item, $_column)):?>
207
+ <?php $_rowspan = $this->getRowspan($_item, $_column);?>
208
+ <td <?php echo ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?>class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns?'last':'' ?>">
209
+ <?php $thumbsize = $this->getThumbnailSize()?>
210
+
211
+ <?php
212
+ if( ($_html = $_column->getRowField($_item)) != '')
213
+ {
214
+ switch($column_id){
215
+ case "filename":
216
+ $_html = '<img src="'.$this->helper('gallery/image')->init($_html)->resize($thumbsize['width'],$thumbsize['height']).'">';
217
+ break;
218
+ case "order":
219
+ $_html = '<input title="'.$_item->getId().'" class="c_order" style="width:50px;" type="text" value="'.$_html.'">';
220
+ break;
221
+ default:
222
+ }
223
+ }else $_html="&nbsp;" ;
224
+ echo $_html;
225
+ ?>
226
+
227
+ </td>
228
+ <?php if ($this->shouldRenderEmptyCell($_item, $_column)):?>
229
+ <td colspan="<?php echo $this->getEmptyCellColspan($_item)?>" class="last"><?php echo $this->getEmptyCellLabel()?></td>
230
+ <?php endif;?>
231
+ <?php endif;?>
232
+ <?php endforeach; ?>
233
+ </tr>
234
+ <?php if ($_multipleRows = $this->getMultipleRows($_item)):?>
235
+ <?php foreach ($_multipleRows as $_i):?>
236
+ <tr>
237
+ <?php $i=0;foreach ($this->getMultipleRowColumns($_i) as $_column): ?>
238
+ <td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns-1?'last':'' ?>">
239
+ <?php echo (($_html = $_column->getRowField($_i)) != '' ? $_html : '&nbsp;') ?>
240
+ </td>
241
+ <?php endforeach; ?>
242
+ </tr>
243
+ <?php endforeach;?>
244
+ <?php endif;?>
245
+
246
+ <?php if ($this->shouldRenderSubTotal($_item)): ?>
247
+ <tr class="subtotals">
248
+ <?php $i = 0; foreach ($this->getSubTotalColumns() as $_column): ?>
249
+ <td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i == $numColumns ? 'last' : '' ?>">
250
+ <?php echo ($_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() :
251
+ $_column->getRowField($this->getSubTotalItem($_item))
252
+ );
253
+ ?>
254
+ </td>
255
+ <?php endforeach; ?>
256
+ </tr>
257
+ <?php endif; ?>
258
+ <?php endforeach; ?>
259
+ <?php elseif ($this->getEmptyText()): ?>
260
+ <tr>
261
+ <td class="empty-text <?php echo $this->getEmptyTextClass() ?>" colspan="100"><?php echo $this->getEmptyText() ?></td>
262
+ </tr>
263
+ <?php endif; ?>
264
+ </tbody>
265
+
266
+ </table>
267
+ </div>
268
+ </div>
269
+ <?php if($this->canDisplayContainer()): ?>
270
+ </div>
271
+ <script type="text/javascript">
272
+ //<![CDATA[
273
+ <?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
274
+ <?php echo $this->getJsObjectName() ?>.useAjax = '<?php echo $this->getUseAjax() ?>';
275
+ <?php if($this->getRowClickCallback()): ?>
276
+ <?php echo $this->getJsObjectName() ?>.rowClickCallback = <?php echo $this->getRowClickCallback() ?>;
277
+ <?php endif; ?>
278
+ <?php if($this->getCheckboxCheckCallback()): ?>
279
+ <?php echo $this->getJsObjectName() ?>.checkboxCheckCallback = <?php echo $this->getCheckboxCheckCallback() ?>;
280
+ <?php endif; ?>
281
+ <?php if($this->getRowInitCallback()): ?>
282
+ <?php echo $this->getJsObjectName() ?>.initRowCallback = <?php echo $this->getRowInitCallback() ?>;
283
+ <?php echo $this->getJsObjectName() ?>.initGridRows();
284
+ <?php endif; ?>
285
+ <?php if($this->getMassactionBlock()->isAvailable()): ?>
286
+ <?php echo $this->getMassactionBlock()->getJavaScript() ?>
287
+ <?php endif ?>
288
+ //]]>
289
+ </script>
290
+ <?php endif; ?>
291
+ <?php endif ?>
app/design/adminhtml/default/default/template/gallery/grid2.phtml ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Template for Mage_Adminhtml_Block_Widget_Grid
30
+ *
31
+ * getId()
32
+ * getCollection()
33
+ * getColumns()
34
+ * getPagerVisibility()
35
+ * getVarNamePage()
36
+ */
37
+ $numColumns = sizeof($this->getColumns());
38
+ ?>
39
+ <script language="javascript" type="text/javascript">
40
+ if (!Array.prototype.inArray) {
41
+ Array.prototype.inArray=function(val) {
42
+ for (key in this) {
43
+ if (this[key]===val) {
44
+ return true; // If you want the key of the matched value, change "true" to "key"
45
+ }
46
+ }
47
+ return false;
48
+ }
49
+ }
50
+
51
+ function saveSort()
52
+ {
53
+ var numArr = new Array();
54
+ for(i = 0; i < 100; i ++)
55
+ {
56
+ numArr[i] = ""+i;
57
+ }
58
+
59
+ elements = document.getElementsByTagName('input')
60
+ var orders ='';
61
+ j = 0;
62
+ for(i = 0; i < elements.length; i ++)
63
+ {
64
+ if(elements[i].className == 'c_order')
65
+ {
66
+ if(numArr.inArray(elements[i].value))
67
+ {
68
+ orders += elements[i].title + "_" + elements[i].value +"|";
69
+ elements[i].style.border ="1px #000 solid";
70
+ }
71
+ else
72
+ {
73
+ elements[i].style.border ="1px #D40707 dashed";
74
+ elements[i].focus();
75
+ alert('Order must be a number!');
76
+ return;
77
+ }
78
+ }
79
+ }
80
+ param = orders.substr(0,orders.length-1);
81
+ window.location="<?php echo $this->getUrl('*/*/saveOrder/')?>items/" + param;
82
+ }
83
+ </script>
84
+ <?php if($this->getCollection()): ?>
85
+ <?php if($this->canDisplayContainer()): ?>
86
+ <?php if($this->getGridHeader()): ?>
87
+ <div class="content-header">
88
+ <table cellspacing="0">
89
+ <tr>
90
+ <td style="width:50%;"><h2><?php echo $this->getGridHeader(); ?></h2></td>
91
+ </tr>
92
+ </table>
93
+ </div>
94
+ <?php endif ?>
95
+
96
+ <div id="<?php echo $this->getId() ?>">
97
+ <?php else: ?>
98
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
99
+ <?php endif; ?>
100
+ <?php if($this->getPagerVisibility() || $this->getExportTypes() || $this->getFilterVisibility()): ?>
101
+ <table cellspacing="0" class="actions">
102
+ <tr>
103
+ <?php if($this->getPagerVisibility()): ?>
104
+ <td class="pager">
105
+ <?php echo $this->__('Page') ?>
106
+
107
+ <?php $_curPage = $this->getCollection()->getCurPage() ?>
108
+ <?php $_lastPage = $this->getCollection()->getLastPageNumber() ?>
109
+ <?php if($_curPage>1): ?>
110
+ <a href="#" title="<?php echo $this->__('Previous page') ?>" onclick="<?php echo $this->getId() ?>JsObject.setPage('<?php echo ($_curPage-1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="Go to Previous page" class="arrow"/></a>
111
+ <?php else: ?>
112
+ <img src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
113
+ <?php endif; ?>
114
+
115
+ <input type="text" name="<?php echo $this->getVarNamePage() ?>" value="<?php echo $_curPage ?>" class="input-text page" onkeypress="<?php echo $this->getId() ?>JsObject.inputPage(event, '<?php echo $_lastPage ?>')"/>
116
+
117
+ <?php if($_curPage < $_lastPage): ?>
118
+ <a href="#" title="<?php echo $this->__('Next page') ?>" onclick="<?php echo $this->getId() ?>JsObject.setPage('<?php echo ($_curPage+1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="Go to Next page" class="arrow"/></a>
119
+ <?php else: ?>
120
+ <img src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
121
+ <?php endif; ?>
122
+
123
+ <?php echo $this->__('of %s pages', $this->getCollection()->getLastPageNumber()) ?>
124
+ <span class="separator">|</span>
125
+ <?php echo $this->__('View') ?>
126
+ <select name="<?php echo $this->getVarNameLimit() ?>" onchange="<?php echo $this->getId() ?>JsObject.loadByElement(this)">
127
+ <option value="20"<?php if($this->getCollection()->getPageSize()==20): ?> selected="selected"<?php endif; ?>>20</option>
128
+ <option value="30"<?php if($this->getCollection()->getPageSize()==30): ?> selected="selected"<?php endif; ?>>30</option>
129
+ <option value="50"<?php if($this->getCollection()->getPageSize()==50): ?> selected="selected"<?php endif; ?>>50</option>
130
+ <option value="100"<?php if($this->getCollection()->getPageSize()==100): ?> selected="selected"<?php endif; ?>>100</option>
131
+ <option value="200"<?php if($this->getCollection()->getPageSize()==200): ?> selected="selected"<?php endif; ?>>200</option>
132
+ </select>
133
+ <?php echo $this->__('per page') ?><span class="separator">|</span>
134
+ <?php echo $this->__('Total %d records found', $this->getCollection()->getSize()) ?>
135
+ <span id="<?php echo $this->getHtmlId() ?>-total-count" class="no-display"><?php echo $this->getCollection()->getSize() ?></span>
136
+ <?php if($this->getRssLists()): ?>
137
+ <?php foreach ($this->getRssLists() as $_rss): ?>
138
+ <span class="separator">|</span><a href="<?php echo $_rss->getUrl() ?>" class="link-feed"><?php echo $_rss->getLabel() ?></a>
139
+ <?php endforeach ?>
140
+ <?php endif; ?>
141
+ </td>
142
+ <?php endif ?>
143
+ <?php if($this->getExportTypes()): ?>
144
+ <td class="export a-right">
145
+ <img src="<?php echo $this->getSkinUrl('images/icon_export.gif') ?>" alt="" class="v-middle"/>&nbsp; <?php echo $this->__('Export to:') ?>
146
+ <select name="<?php echo $this->getId() ?>_export" id="<?php echo $this->getId() ?>_export" style="width:8em;">
147
+ <?php foreach ($this->getExportTypes() as $_type): ?>
148
+ <option value="<?php echo $_type->getUrl() ?>"><?php echo $_type->getLabel() ?></option>
149
+ <?php endforeach; ?>
150
+ </select>
151
+ <?php echo $this->getExportButtonHtml() ?>
152
+ </td>
153
+ <?php endif; ?>
154
+ <td class="filter-actions a-right">
155
+ <?php echo $this->getMainButtonsHtml() ?>
156
+ </td>
157
+ </tr>
158
+ </table>
159
+ <?php endif; ?>
160
+ <?php if($this->getMassactionBlock()->isAvailable()): ?>
161
+ <?php echo $this->getMassactionBlockHtml() ?>
162
+ <?php endif ?>
163
+ <div class="grid">
164
+ <div class="hor-scroll">
165
+ <table cellspacing="0" class="data" id="<?php echo $this->getId() ?>_table">
166
+ <?php foreach ($this->getColumns() as $_column): ?>
167
+ <col <?php echo $_column->getHtmlProperty() ?> />
168
+ <?php if ($_column->getEditable() && !$_column->getEditOnly()) : ?>
169
+ <col <?php echo $_column->getHtmlProperty() ?> />
170
+ <?php endif ?>
171
+ <?php endforeach; ?>
172
+ <?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?>
173
+ <thead>
174
+ <?php if ($this->getHeadersVisibility()): ?>
175
+ <tr class="headings">
176
+ <?php foreach ($this->getColumns() as $_column): ?>
177
+ <th<?php echo $_column->getHeaderHtmlProperty() ?>><span class="nobr"><?php echo $_column->getHeaderHtml() ?></span></th>
178
+ <?php endforeach; ?>
179
+ </tr>
180
+ <?php endif; ?>
181
+ <?php if ($this->getFilterVisibility()): ?>
182
+ <tr class="filter">
183
+ <?php $i=0;foreach ($this->getColumns() as $_column): ?>
184
+ <th<?php echo $_column->getHeaderHtmlProperty() ?>><?php echo $_column->getFilterHtml() ?></th>
185
+ <?php endforeach; ?>
186
+ </tr>
187
+ <?php endif ?>
188
+ </thead>
189
+ <?php endif; ?>
190
+ <?php if ($this->getCountTotals()): ?>
191
+ <tfoot>
192
+ <tr class="totals">
193
+ <?php foreach ($this->getColumns() as $_column): ?>
194
+ <th class="<?php echo $_column->getCssProperty() ?>"><?php echo ($_column->hasTotalsLabel()) ? $_column->getTotalsLabel() : $_column->getRowField($_column->getGrid()->getTotals()) ?>&nbsp;</th>
195
+ <?php endforeach; ?>
196
+ </tr>
197
+ </tfoot>
198
+ <?php endif; ?>
199
+
200
+ <tbody>
201
+ <?php if (($this->getCollection()->getSize()>0) && (!$this->getIsCollapsed())): ?>
202
+ <?php foreach ($this->getCollection() as $_index=>$_item): ?>
203
+ <tr title="<?php echo $this->getRowUrl($_item) ?>"<?php if ($_class = $this->getRowClass($_item)):?> class="<?php echo $_class; ?>"<?php endif;?> >
204
+ <?php $i=0;foreach ($this->getColumns() as $column_id=>$_column): ?>
205
+
206
+ <?php if ($this->shouldRenderCell($_item, $_column)):?>
207
+ <?php $_rowspan = $this->getRowspan($_item, $_column);?>
208
+ <td <?php echo ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?>class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns?'last':'' ?>">
209
+ <?php $thumbsize = $this->getThumbnailSize()?>
210
+
211
+ <?php
212
+ if( ($_html = $_column->getRowField($_item)) != '')
213
+ {
214
+ switch($column_id){
215
+ case "filename":
216
+ $_html = '<img src="'.$this->helper('gallery/image')->init($_html)->resize($thumbsize['width'],$thumbsize['height']).'">';
217
+ break;
218
+ case "order":
219
+ $_html = '<input title="'.$_item->getId().'" class="c_order" style="width:50px;" type="text" value="'.$_html.'">';
220
+ break;
221
+ default:
222
+ }
223
+ }else $_html="&nbsp;" ;
224
+ echo $_html;
225
+ ?>
226
+
227
+ </td>
228
+ <?php if ($this->shouldRenderEmptyCell($_item, $_column)):?>
229
+ <td colspan="<?php echo $this->getEmptyCellColspan($_item)?>" class="last"><?php echo $this->getEmptyCellLabel()?></td>
230
+ <?php endif;?>
231
+ <?php endif;?>
232
+ <?php endforeach; ?>
233
+ </tr>
234
+ <?php if ($_multipleRows = $this->getMultipleRows($_item)):?>
235
+ <?php foreach ($_multipleRows as $_i):?>
236
+ <tr>
237
+ <?php $i=0;foreach ($this->getMultipleRowColumns($_i) as $_column): ?>
238
+ <td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns-1?'last':'' ?>">
239
+ <?php echo (($_html = $_column->getRowField($_i)) != '' ? $_html : '&nbsp;') ?>
240
+ </td>
241
+ <?php endforeach; ?>
242
+ </tr>
243
+ <?php endforeach;?>
244
+ <?php endif;?>
245
+
246
+ <?php if ($this->shouldRenderSubTotal($_item)): ?>
247
+ <tr class="subtotals">
248
+ <?php $i = 0; foreach ($this->getSubTotalColumns() as $_column): ?>
249
+ <td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i == $numColumns ? 'last' : '' ?>">
250
+ <?php echo ($_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() :
251
+ $_column->getRowField($this->getSubTotalItem($_item))
252
+ );
253
+ ?>
254
+ </td>
255
+ <?php endforeach; ?>
256
+ </tr>
257
+ <?php endif; ?>
258
+ <?php endforeach; ?>
259
+ <?php elseif ($this->getEmptyText()): ?>
260
+ <tr>
261
+ <td class="empty-text <?php echo $this->getEmptyTextClass() ?>" colspan="100"><?php echo $this->getEmptyText() ?></td>
262
+ </tr>
263
+ <?php endif; ?>
264
+ </tbody>
265
+
266
+ </table>
267
+ </div>
268
+ </div>
269
+ <?php if($this->canDisplayContainer()): ?>
270
+ </div>
271
+ <script type="text/javascript">
272
+ //<![CDATA[
273
+ <?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
274
+ <?php echo $this->getJsObjectName() ?>.useAjax = '<?php echo $this->getUseAjax() ?>';
275
+ <?php if($this->getRowClickCallback()): ?>
276
+ <?php echo $this->getJsObjectName() ?>.rowClickCallback = <?php echo $this->getRowClickCallback() ?>;
277
+ <?php endif; ?>
278
+ <?php if($this->getCheckboxCheckCallback()): ?>
279
+ <?php echo $this->getJsObjectName() ?>.checkboxCheckCallback = <?php echo $this->getCheckboxCheckCallback() ?>;
280
+ <?php endif; ?>
281
+ <?php if($this->getRowInitCallback()): ?>
282
+ <?php echo $this->getJsObjectName() ?>.initRowCallback = <?php echo $this->getRowInitCallback() ?>;
283
+ <?php echo $this->getJsObjectName() ?>.initGridRows();
284
+ <?php endif; ?>
285
+ <?php if($this->getMassactionBlock()->isAvailable()): ?>
286
+ <?php echo $this->getMassactionBlock()->getJavaScript() ?>
287
+ <?php endif ?>
288
+ //]]>
289
+ </script>
290
+ <?php endif; ?>
291
+ <?php endif ?>
app/design/frontend/base/default/layout/padoo_gallery.xml ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addItem"><type>js</type><name>padoo/jquery.js</name></action>
6
+ <action method="addItem"><type>js</type><name>padoo/jquery_noconflict.js</name></action>
7
+ <action method="addCss"><stylesheet>gallery/css/gallery.css</stylesheet></action>
8
+ <action method="addCss"><stylesheet>gallery/css/lightbox.css</stylesheet></action>
9
+ <action method="addItem"><type>skin_js</type><name>gallery/js/lightbox.js</name></action>
10
+ </reference>
11
+ <reference name="top.links">
12
+ <action ifconfig="gallery/info/toplink" method="addLink" translate="label title" module="gallery"><label>Gallery</label><url helper="gallery/getGallleryUrl" /><title>Gallery</title><prepare/><urlParams/><position>20</position><aParams> <target>_blank</target> </aParams></action>
13
+ </reference>
14
+ <reference name="right">
15
+ <block type="gallery/gallery" name="newalbum">
16
+ <action method="setTemplate" ifconfig="gallery/info/enabled">
17
+ <template>gallery/newalbums.phtml</template>
18
+ </action>
19
+ <action method="setTotalAlbum"><total_album>4</total_album></action>
20
+ </block>
21
+ </reference>
22
+ </default>
23
+
24
+ <gallery_index_index>
25
+ <reference name="head">
26
+ <action method="setTitle"><title>Gallery</title></action>
27
+ <action method="addItem"><type>js</type><name>padoo/jquery.js</name></action>
28
+ <action method="addItem"><type>js</type><name>padoo/jquery_noconflict.js</name></action>
29
+ <action method="addCss"><stylesheet>gallery/css/gallery.css</stylesheet></action>
30
+ <action method="addCss"><stylesheet>gallery/css/lightbox.css</stylesheet></action>
31
+ <action method="addItem"><type>skin_js</type><name>gallery/js/lightbox.js</name></action>
32
+ </reference>
33
+
34
+ <reference name="root">
35
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
36
+ </reference>
37
+
38
+ <reference name="content">
39
+ <block type="gallery/gallery" name="gallery" template="gallery/gallery.phtml" />
40
+ <!--<block type="gallery/ajax" name="ajax" template="gallery/ajax.phtml" /> -->
41
+ </reference>
42
+
43
+ </gallery_index_index>
44
+
45
+ <gallery_view_album>
46
+ <reference name="head">
47
+ <action method="setTitle"><title>Album</title></action>
48
+ <action method="addItem"><type>js</type><name>padoo/jquery.js</name></action>
49
+ <action method="addItem"><type>js</type><name>padoo/jquery_noconflict.js</name></action>
50
+ <action method="addCss"><stylesheet>gallery/css/gallery.css</stylesheet></action>
51
+ <action method="addCss"><stylesheet>gallery/css/lightbox.css</stylesheet></action>
52
+ <action method="addItem"><type>skin_js</type><name>gallery/js/lightbox.js</name></action>
53
+ </reference>
54
+
55
+ <reference name="root">
56
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
57
+ </reference>
58
+ <reference name="content">
59
+ <block type="gallery/gallery" name="gallery" template="gallery/album.phtml" />
60
+ </reference>
61
+ </gallery_view_album>
62
+
63
+ <gallery_view_detail>
64
+ <reference name="head">
65
+ <action method="setTitle"><title>Photo Infomation</title></action>
66
+ <action method="addItem"><type>js</type><name>padoo/jquery.js</name></action>
67
+ <action method="addItem"><type>js</type><name>padoo/jquery_noconflict.js</name></action>
68
+ <action method="addCss"><stylesheet>gallery/css/gallery.css</stylesheet></action>
69
+ <action method="addCss"><stylesheet>gallery/css/lightbox.css</stylesheet></action>
70
+ <action method="addCss"><stylesheet>gallery/css/jquery.rating.css</stylesheet></action>
71
+ <action method="addItem"><type>skin_js</type><name>gallery/js/lightbox.js</name></action>
72
+ <action method="addItem"><type>skin_js</type><name>gallery/js/jquery.rating.js</name></action>
73
+ </reference>
74
+
75
+ <reference name="root">
76
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
77
+ </reference>
78
+ <reference name="content">
79
+ <block type="gallery/detail" name="gallery" template="gallery/details.phtml">
80
+ <!-- Code Start For Display Captcha on Register page -->
81
+ <block type="captcha/captcha" name="captcha">
82
+ <reference name="head">
83
+ <action method="addJs"><file>mage/captcha.js</file></action>
84
+ </reference>
85
+ <action method="setFormId"><formId>gallery</formId></action>
86
+ <action method="setImgWidth"><width>230</width></action>
87
+ <action method="setImgHeight"><width>50</width></action>
88
+ </block>
89
+ <!-- Code End For Display Captcha on Register page-->
90
+ </block>
91
+ </reference>
92
+ </gallery_view_detail>
93
+
94
+ <gallery_index_search>
95
+ <reference name="head">
96
+ <action method="setTitle"><title>Search Result</title></action>
97
+ <action method="addItem"><type>js</type><name>padoo/jquery.js</name></action>
98
+ <action method="addItem"><type>js</type><name>padoo/jquery_noconflict.js</name></action>
99
+ <action method="addCss"><stylesheet>gallery/css/gallery.css</stylesheet></action>
100
+ <action method="addCss"><stylesheet>gallery/css/lightbox.css</stylesheet></action>
101
+ <action method="addCss"><stylesheet>gallery/css/jquery.rating.css</stylesheet></action>
102
+ <action method="addItem"><type>skin_js</type><name>gallery/js/lightbox.js</name></action>
103
+ <action method="addItem"><type>skin_js</type><name>gallery/js/jquery.rating.js</name></action>
104
+ </reference>
105
+ <reference name="root">
106
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
107
+ </reference>
108
+ <reference name="content">
109
+ <block type="gallery/search" name="gallery" template="gallery/result.phtml" />
110
+ </reference>
111
+ </gallery_index_search>
112
+ </layout>
app/design/frontend/base/default/template/gallery/album.phtml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $ablbum = $this->getCurrentAlbum();
3
+ ?>
4
+ <script type="text/javascript">
5
+ var fileLoadingImage = "<?php echo $this->getSkinUrl('gallery/images/loading.gif') ?>";
6
+ var fileBottomNavCloseImage = "<?php echo $this->getSkinUrl('gallery/images/closelabel.gif') ?>";
7
+ </script>
8
+ <?php
9
+ echo $this->getBreadcrumbs();
10
+ ?>
11
+ <div class="gallery-head">
12
+ <div class="title f-left" >
13
+ <?php echo $ablbum->getTitle() ?>
14
+ </div>
15
+ <?php if(Mage::getStoreConfig('gallery/info/enable_search_box')): ?>
16
+ <div class="search-container f-right">
17
+ <form method="get" action="<?php echo $this->getUrl('gallery/index/search') ?>" id="gallery_search_form">
18
+ <div class="gallery-form-search">
19
+ <input type="text" class="input-text" value="" name="keyword" id="gallery-search">
20
+ <button class="button" title="Search" type="submit"><span><span><?php echo $this->__('Search') ?></span></span></button>
21
+ <script type="text/javascript">
22
+ //&lt;![CDATA[
23
+ var gallerySearchForm = new Varien.searchForm('gallery_search_form', 'gallery-search', 'Find some photo...');
24
+ //]]&gt;
25
+ </script>
26
+ </div>
27
+ </form>
28
+ </div>
29
+ <?php endif; ?>
30
+ <div style="clear:both;"></div>
31
+ <div class="date">
32
+ <?php echo date("F j, Y g:i", strtotime($ablbum->getCreatedTime())); ?>
33
+ </div>
34
+ <div class="des">
35
+ <?php echo $ablbum->getContent() ?>
36
+ </div>
37
+ </div>
38
+ <div class="gallery-container album">
39
+ <ul>
40
+ <?php $collection = $this->getPhotos();
41
+ foreach ($collection as $item) :
42
+ $reviewCollection = Mage::getResourceModel('gallery/review_collection');
43
+ $reviewCollection->getSelect()->where('status = ?', 1)->where('gallery_id = ?', $item->getGalleryId());
44
+ $rate=0;
45
+ $rates = array();
46
+ if(count($reviewCollection)){
47
+
48
+ foreach($reviewCollection as $record){
49
+ $rate += $record->getReviewRate();
50
+ }
51
+ $rates['rate'] = ( $rate/ (count($reviewCollection)* 5) ) *100;
52
+ $rates['total'] = count($reviewCollection);
53
+ }
54
+ ?>
55
+ <li>
56
+ <?php if(Mage::getStoreConfig('gallery/lightbox/enable_lightbox')): ?>
57
+ <a href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . $item->getFilename() ?>" rel="lightbox[roadtrip]" title="<?php echo $item->getTitle() ?>" <?php if(Mage::getStoreConfig('gallery/lightbox/enable_description_lightbox')): ?>data-content="<?php echo $item->getContent() ?>" <?php endif; ?> ><img src="<?php echo $this->helper('gallery/image')->init($item->getFilename())->resize(175, 130) ?>" /></a>
58
+ <?php if(Mage::getStoreConfig('gallery/reviews/enable_review')): ?>
59
+ <div class="total-rate review-list">
60
+ <a href="<?php echo $this->getUrl('gallery/view/detail',array('id' => $item->getGalleryId())) ?>"><?php echo $item->getTitle() ?></a>
61
+ <ul title="Rate This!" class="star">
62
+ <li style="width: <?php echo $rates['rate'] ?>%" title="0" class="curr"></li>
63
+ </ul>
64
+ </div>
65
+ <?php else: ?>
66
+ <a href="<?php echo $this->getUrl('gallery/view/detail',array('id' => $item->getGalleryId())) ?>"><?php echo $item->getTitle() ?></a>
67
+ <?php endif; ?>
68
+ <?php else: ?>
69
+ <a href="<?php echo $this->getUrl('gallery/view/detail',array('id' => $item->getGalleryId())) ?>" title="<?php echo $item->getTitle() ?>"><img src="<?php echo $this->helper('gallery/image')->init($item->getFilename())->resize(175, 130) ?>" /></a>
70
+ <?php if(Mage::getStoreConfig('gallery/reviews/enable_review')): ?>
71
+ <div class="total-rate review-list">
72
+ <a href="<?php echo $this->getUrl('gallery/view/detail',array('id' => $item->getGalleryId())) ?>"><?php echo $item->getTitle() ?></a>
73
+ <ul title="Rate This!" class="star">
74
+ <li style="width: <?php echo $rates['rate'] ?>%" title="0" class="curr"></li>
75
+ </ul>
76
+ </div>
77
+ <?php else: ?>
78
+ <a href="<?php echo $this->getUrl('gallery/view/detail',array('id' => $item->getGalleryId())) ?>"><?php echo $item->getTitle() ?></a>
79
+ <?php endif; ?>
80
+ <?php endif; ?>
81
+ </li>
82
+ <?php endforeach; ?>
83
+ </ul>
84
+ </div>
85
+ <div style="clear:both;"><?php echo $this->getToolbarHtml(); ?></div>
app/design/frontend/base/default/template/gallery/details.phtml ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $item = $this->getDetails();
3
+ $reviews = $this->getReviews();
4
+ $rates = $this->getTotalRates();
5
+ ?>
6
+ <script type="text/javascript">
7
+ var fileLoadingImage = "<?php echo $this->getSkinUrl('gallery/images/loading.gif') ?>";
8
+ var fileBottomNavCloseImage = "<?php echo $this->getSkinUrl('gallery/images/closelabel.gif') ?>";
9
+ </script>
10
+ <?php
11
+ echo $this->getBreadcrumbs();
12
+ ?>
13
+ <div class="page-title">
14
+ <h1><?php echo $item->getTitle() ?></h1>
15
+ </div>
16
+
17
+ <div class="gallery-details">
18
+ <?php if(Mage::getStoreConfig('gallery/lightbox/enable_lightbox')): ?>
19
+ <a href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . $item->getFilename() ?>" rel="lightbox[projects]" title="<?php echo $item->getTitle() ?>" <?php if(Mage::getStoreConfig('gallery/lightbox/enable_description_lightbox')): ?>data-content="<?php echo $item->getContent() ?>" <?php endif; ?>><img src="<?php echo $this->helper('gallery/image')->init($item->getFilename()) ?>" /></a>
20
+ <?php else: ?>
21
+ <img src="<?php echo $this->helper('gallery/image')->init($item->getFilename()) ?>" />
22
+ <?php endif; ?>
23
+ <p><?php echo $item->getContent() ?></p>
24
+ <span class="date"><?php echo date("F j, Y g:i", strtotime($item->getCreatedTime())); ?></span>
25
+ </div>
26
+ <?php if(Mage::getStoreConfig('gallery/reviews/enable_review')): ?>
27
+ <div class="gallery-review">
28
+ <div class="review-list">
29
+ <h3><?php echo $this->__('All reviews') ?></h3>
30
+ <div class="total-rate">
31
+ <label class="f-left"><?php echo $this->__('Total Rate') ?></label>
32
+ <ul title="Rate This!" class="star">
33
+ <li style="width: <?php echo $rates['rate'] ?>%" title="0" class="curr"></li>
34
+ </ul>
35
+ <span class="totalrate"> ( <?php echo $rates['total'] ? $rates['total'] : 0 ?> <?php echo $this->__('rates') ?> )</span>
36
+ </div>
37
+ <div class="comment">
38
+ <?php foreach($reviews as $record): ?>
39
+ <?php $rate = ($record->getReviewRate() / 5) * 100; ?>
40
+ <div>
41
+ <ul title="Rate This!" class="star">
42
+ <li style="width: <?php echo $rate ?>%;" title="0" class="curr"></li>
43
+ </ul>
44
+ <span><?php echo $this->__('review by') ?> <b><?php echo $record->getReviewName() ?></b></span>
45
+ <span class="date"><?php echo $this->__('on') ?> <?php echo $record->getCreatedTime() ?></span>
46
+ <div class="content"><?php echo nl2br($record->getReviewContent()) ?></div>
47
+ </div>
48
+ <?php endforeach; ?>
49
+ </div>
50
+ </div>
51
+ <div style="clear:both"></div>
52
+ <?php if(Mage::getStoreConfig('gallery/reviews/enable_write_review')): ?>
53
+ <div class="review-form">
54
+ <h3><?php echo $this->__('Write review') ?></h3>
55
+ <form id="gallery_review_form" method="post" action="<?php echo $this->getUrl('gallery/index/review') ?>">
56
+ <input type="hidden" name="gallery_id" value="<?php echo $item->getGalleryId() ?>"/>
57
+ <ul class="form-list">
58
+ <li class="wide">
59
+ <label class="required"><?php echo $this->__('Rate') ?></label>
60
+ <div id="rate">
61
+ <input class="star required" type="radio" name="gallery_rating" value="1"/>
62
+ <input class="star" type="radio" name="gallery_rating" value="2"/>
63
+ <input class="star" type="radio" name="gallery_rating" value="3"/>
64
+ <input class="star" type="radio" name="gallery_rating" value="4"/>
65
+ <input class="star" type="radio" name="gallery_rating" value="5"/>
66
+ </div>
67
+ </li>
68
+ <li class="wide">
69
+ <label class="required"><em>*</em><?php echo $this->__('Name') ?></label>
70
+ <div class="input-box">
71
+ <input type="text" class="input-text required-entry" name="name"/>
72
+ </div>
73
+ </li>
74
+ <li class="wide">
75
+ <label class="required"><em>*</em><?php echo $this->__('Email') ?></label>
76
+ <div class="input-box">
77
+ <input type="text" class="input-text required-entry" name="email"/>
78
+ </div>
79
+ </li>
80
+ <li class="wide">
81
+ <label class="required"><?php echo $this->__('Comment') ?></label>
82
+ <div class="input-box">
83
+ <textarea class="input-text" name="content" rows="4"></textarea>
84
+ </div>
85
+ </li>
86
+ <li class="wide">
87
+ <?php echo $this->getChildHtml('captcha'); ?>
88
+ </li>
89
+ </ul>
90
+ <div class="box-actions">
91
+ <button class="button" title="Send" type="submit" >
92
+ <span><span><?php echo $this->__('Send') ?></span></span>
93
+ </button>
94
+ <button class="button" title="Reset" type="reset">
95
+ <span><span><?php echo $this->__('Reset') ?></span></span>
96
+ </button>
97
+ </div>
98
+ </form>
99
+ </div>
100
+ <script type="text/javascript">
101
+ //<![CDATA[
102
+ var galleryreviewForm = new VarienForm('gallery_review_form', true);
103
+ //]]>
104
+ $(function(){
105
+ jQuery('#rate :radio.star').rating();
106
+ });
107
+ </script>
108
+ <?php endif; ?>
109
+ </div>
110
+ <?php endif; ?>
app/design/frontend/base/default/template/gallery/gallery.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ var fileLoadingImage = "<?php echo $this->getSkinUrl('gallery/images/loading.gif') ?>";
3
+ var fileBottomNavCloseImage = "<?php echo $this->getSkinUrl('gallery/images/closelabel.gif') ?>";
4
+ </script>
5
+ <?php
6
+ $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
7
+ $breadcrumbs->addCrumb('home', array('label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Home Page'), 'link'=>Mage::getBaseUrl()));
8
+ $breadcrumbs->addCrumb('gallery', array('label'=>'gallery', 'title'=>'gallery'));
9
+ echo $this->getLayout()->getBlock('breadcrumbs')->toHtml();
10
+ ?>
11
+ <div class="gallery-head">
12
+ <div class="title f-left" >
13
+ <?php echo $this->__('Gallery') ?>
14
+ </div>
15
+ <?php if(Mage::getStoreConfig('gallery/info/enable_search_box')): ?>
16
+ <div class="search-container f-right">
17
+ <form method="get" action="<?php echo $this->getUrl('gallery/index/search') ?>" id="gallery_search_form">
18
+ <div class="gallery-form-search">
19
+ <input type="text" class="input-text" value="" name="keyword" id="gallery-search">
20
+ <button class="button" title="Search" type="submit"><span><span>Search</span></span></button>
21
+ <script type="text/javascript">
22
+ //&lt;![CDATA[
23
+ var gallerySearchForm = new Varien.searchForm('gallery_search_form', 'gallery-search', 'Find some photo...');
24
+ //]]&gt;
25
+ </script>
26
+ </div>
27
+ </form>
28
+ </div>
29
+ <?php endif; ?>
30
+ </div>
31
+ <div style="clear:both;"></div>
32
+ <div class="gallery-container">
33
+ <ul>
34
+ <?php
35
+ $collection = $this->getAlbums();
36
+ foreach ($collection as $item) { ?>
37
+ <li>
38
+ <a href="<?php echo $this->getUrl('gallery/view/album',array('id'=>$item->getAlbumId())) ?>"><?php echo $item->getTitle() ?></a>
39
+ <a href="<?php echo $this->getUrl('gallery/view/album',array('id'=>$item->getAlbumId())) ?>" title="<?php echo $item->getTitle() ?>" ><img src="<?php echo $this->helper('gallery/image')->init($item->getFilename())->resize(175, 130) ?>"/></a>
40
+
41
+ <?php echo $item->getDescription() ?>
42
+ </li>
43
+ <?php } ?>
44
+ </ul>
45
+ </div>
app/design/frontend/base/default/template/gallery/newalbums.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="box base-mini new-albums">
2
+ <div class="head">
3
+ <h4><?php echo $this->__('New Albums') ?></h4>
4
+ </div>
5
+
6
+ <?php $new_albums = $this->getNewAlbums(); ?>
7
+ <center>
8
+ <ul>
9
+ <?php foreach ($new_albums as $item): ?>
10
+ <li>
11
+ <a href="<?php echo $this->getUrlRewrite($item) ?>" alt="<?php echo $item->getTitle() ?>" ><img src="<?php echo $this->helper('gallery/image')->init($item->getFilename())->resize(80) ?>"/></a>
12
+ </li>
13
+ <?php endforeach; ?>
14
+ </ul>
15
+ </center>
16
+ <div class='view-all'><a href="<?php echo $this->getUrl('gallery') ?>"><?php echo $this->__('View all') ?></a></div>
17
+ </div>
app/design/frontend/base/default/template/gallery/photo/pager.phtml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php
3
+ /**
4
+ * Pager template
5
+ *
6
+ */
7
+ ?>
8
+ <?php if(count($this->getCollection())): ?>
9
+ <table class="toolbar-pager" cellspacing="0">
10
+ <tr>
11
+ <td class="td-page">
12
+ <?php if($this->getLastPageNum()>1): ?>
13
+ <?php echo Mage::helper('gallery')->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
14
+ <?php else: ?>
15
+ <strong><?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?></strong>
16
+ <?php endif; ?>
17
+ </td>
18
+ <?php if($this->getLastPageNum()>1): ?>
19
+ <td class="pages">
20
+ <strong><?php echo Mage::helper('gallery')->__('Page') ?>:</strong>
21
+ <ol>
22
+ <?php if (!$this->isFirstPage()): ?>
23
+ <li><a href="<?php echo $this->getPreviousPageUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="<?php echo $this->__('Previous Page') ?>" /></a></li>
24
+ <?php endif ?>
25
+ <?php foreach ($this->getPages() as $_page): ?>
26
+ <?php if ($this->isPageCurrent($_page)): ?>
27
+ <li><span class="on"><?php echo $_page ?></span></li>
28
+ <?php else: ?>
29
+ <li><a href="<?php echo $this->getPageUrl($_page) ?>"><?php echo $_page ?></a></li>
30
+ <?php endif ?>
31
+ <?php endforeach;; ?>
32
+ <?php if (!$this->isLastPage()): ?>
33
+ <li><a href="<?php echo $this->getNextPageUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="<?php echo $this->__('Next Page') ?>"/></a></li>
34
+ <?php endif ?>
35
+ </ol>
36
+ </td>
37
+ <?php endif; ?>
38
+ <?php if($this->getShowPerPage()): ?>
39
+ <td class="a-right">
40
+ <?php echo $this->__('Show') ?>
41
+ <select onchange="setLocation(this.value)">
42
+ <?php foreach ($this->getAvailableLimit() as $_key=>$_limit): ?>
43
+ <option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>>
44
+ <?php echo $_limit ?>
45
+ </option>
46
+ <?php endforeach; ?>
47
+ </select>
48
+ <?php echo $this->__('per page') ?>
49
+ </td>
50
+ <?php endif ?>
51
+ </tr>
52
+ </table>
53
+ <?php endif ?>
app/design/frontend/base/default/template/gallery/photoalbum.phtml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <link href="<?php echo $this->getSkinUrl('gallery/css/gallery.css')?>" type="text/css" media="all" rel="stylesheet"/>
2
+ <link href="<?php echo $this->getSkinUrl('gallery/css/lightbox.css')?>" type="text/css" media="all" rel="stylesheet"/>
3
+ <script src="<?php echo $this->getSkinUrl('gallery/js/lightbox.js')?>" type="text/javascript"></script>
4
+ <script type="text/javascript">
5
+ var fileLoadingImage = "<?php echo $this->getSkinUrl('gallery/images/loading.gif') ?>";
6
+ var fileBottomNavCloseImage = "<?php echo $this->getSkinUrl('gallery/images/closelabel.gif') ?>";
7
+ </script>
8
+ <?php if(Mage::helper('gallery')->getDescription()): ?>
9
+ <div><?php echo $this->getAlbum()->getContent() ?></div>
10
+ <?php endif;?>
11
+ <div class="gallery-container album">
12
+ <ul>
13
+ <?php $collection = $this->getPhotos();
14
+ foreach ($collection as $item) {
15
+ ?>
16
+ <li>
17
+ <a href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . $item->getFilename() ?>" rel="lightbox[projects]" title="<?php echo $item->getTitle() ?>" ><img src="<?php echo $this->helper('gallery/image')->init($item->getFilename())->resize(175, 131) ?>" /></a>
18
+ </li>
19
+ <?php } ?>
20
+ </ul>
21
+ <div style="clear:both; float:right"><a href="<?php echo $this->getUrl('gallery') ?>"><?php echo Mage::Helper('gallery')->__('View Album') ?></a></div>
22
+ </div>
app/design/frontend/base/default/template/gallery/result.phtml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ var fileLoadingImage = "<?php echo $this->getSkinUrl('gallery/images/loading.gif') ?>";
3
+ var fileBottomNavCloseImage = "<?php echo $this->getSkinUrl('gallery/images/closelabel.gif') ?>";
4
+ </script>
5
+ <?php
6
+ $_keyword= $_GET['keyword'];
7
+ ?>
8
+ <?php if(Mage::getStoreConfig('gallery/info/enable_search_box')): ?>
9
+ <div class="search-container f-right">
10
+ <form method="get" action="<?php echo $this->getUrl('gallery/index/search') ?>" id="gallery_search_form">
11
+ <div class="gallery-form-search">
12
+ <input type="text" class="input-text" value="<?php echo $_keyword ?>" name="keyword" id="gallery-search">
13
+ <button class="button" title="Search" type="submit"><span><span><?php echo Mage::Helper('gallery')->__('Search') ?></span></span></button>
14
+ <script type="text/javascript">
15
+ //&lt;![CDATA[
16
+ var gallerySearchForm = new Varien.searchForm('gallery_search_form', 'gallery-search', 'Find some photo...');
17
+ //]]&gt;
18
+ </script>
19
+ </div>
20
+ </form>
21
+ </div>
22
+ <?php endif; ?>
23
+ <?php if(count($this->getPhotoResults())): ?>
24
+ <h3><?php echo Mage::Helper('gallery')->__("Result for search : '%s'", $_keyword); ?></h3>
25
+ <div class="gallery-container album">
26
+ <ul>
27
+ <?php
28
+ foreach ($this->getPhotoResults() as $item):
29
+ ?>
30
+ <li>
31
+ <p><?php echo $item->getTitle() ?></p>
32
+ <a href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . $item->getFilename() ?>" rel="lightbox[projects]" title="<?php echo $item->getTitle() ?>"<?php if(Mage::getStoreConfig('gallery/configs/enable_description_lightbox')): ?> data-content="<?php echo $item->getContent() ?>" <?php endif; ?> ><img src="<?php echo $this->helper('gallery/image')->init($item->getFilename())->resize(175, 130) ?>" /></a>
33
+ <a href="<?php echo $this->getUrl('gallery/view/detail',array('id' => $item->getGalleryId())) ?>"><?php echo Mage::Helper('gallery')->__('Details') ?></a>
34
+ </li>
35
+ <?php endforeach; ?>
36
+ </ul>
37
+ <div style="clear:both; text-align: right;"><a href="<?php echo $this->getUrl('gallery') ?>"><?php echo Mage::Helper('gallery')->__('Back to Album') ?></a></div>
38
+ </div>
39
+ <div style="clear:both;"><?php echo $this->getToolbarHtml(); ?></div>
40
+ <?php else: ?>
41
+ <h3><?php echo Mage::Helper('gallery')->__("No result for : '%s'", $_keyword) ?></h3>
42
+ <?php endif; ?>
43
+
app/design/frontend/base/default/template/gallery/search-form.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_keyword= $_GET['keyword'];
3
+ ?>
4
+ <div class="search-container f-right">
5
+ <form method="get" action="<?php echo $this->getUrl('gallery/index/search') ?>" id="gallery_search_form">
6
+ <div class="gallery-form-search">
7
+ <input type="text" class="input-text" value="<?php echo $_keyword ?>" name="keyword" id="gallery_search">
8
+ <button class="button" title="Search" type="submit"><span><span>Search</span></span></button>
9
+ <script type="text/javascript">
10
+ //&lt;![CDATA[
11
+ var gallerySearchForm = new Varien.searchForm('gallery_search_form', 'gallery_search', 'Find some photo...');
12
+ //]]&gt;
13
+ </script>
14
+ </div>
15
+ </form>
16
+ </div>
17
+
app/etc/modules/Padoo_Gallery.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Padoo_Gallery>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Padoo_Gallery>
8
+ </modules>
9
+ </config>
app/locale/en_US/Padoo_Gallery.csv ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Result for search : '%s'","Result for search : '%s'"
2
+ "No result for : '%s'","No result for : '%s'"
3
+ "Search","Search"
4
+ "Back to Album","Back to Album"
5
+ "Details","Details"
6
+ "View Album","View Album"
7
+ "View all","View all"
8
+ "New Albums","New Albums"
9
+ "Gallery","Gallery"
10
+ "All reviews","All reviews"
11
+ "Total Rate","Total Rate"
12
+ "rates","rates"
13
+ "review by","review by"
14
+ "on","on"
15
+ "Write review","Write review"
16
+ "Rate","Rate"
17
+ "Name","Name"
18
+ "Email","Email"
19
+ "Comment","Comment"
20
+ "Send","Send"
21
+ "Reset","Reset"
22
+ "Items %s to %s of %s total","Items %s to %s of %s total"
23
+ "%s Item(s)","%s Item(s)"
24
+ "Page","Page"
25
+ "Previous Page","Previous Page"
26
+ "Next Page","Next Page"
27
+ "Show","Show"
28
+ "per page","per page"
js/padoo/checkValue.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ function checkValue(el){
2
+ for (var k=1; k<9; k++){
3
+ if((el.value == $("onepagecheckout_positions_position"+k).value) && (el.id != "onepagecheckout_positions_position"+k) && (el.value!="")){
4
+ el.value = "";
5
+ alert("This field already exists. Please choose other field !");
6
+ break;
7
+ }
8
+ }
9
+
10
+ }
js/padoo/jquery.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /*! jQuery v@1.8.1 jquery.com | jquery.org/license */
2
+ (function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c==="input"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bY(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bW.length;while(e--){b=bW[e]+c;if(b in a)return b}return d}function bZ(a,b){return a=b||a,p.css(a,"display")==="none"||!p.contains(a.ownerDocument,a)}function b$(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,"olddisplay"),b?(!e[f]&&c.style.display==="none"&&(c.style.display=""),c.style.display===""&&bZ(c)&&(e[f]=p._data(c,"olddisplay",cc(c.nodeName)))):(d=bH(c,"display"),!e[f]&&d!=="none"&&p._data(c,"olddisplay",d))}for(f=0;f<g;f++){c=a[f];if(!c.style)continue;if(!b||c.style.display==="none"||c.style.display==="")c.style.display=b?e[f]||"":"none"}return a}function b_(a,b,c){var d=bP.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function ca(a,b,c,d){var e=c===(d?"border":"content")?4:b==="width"?1:0,f=0;for(;e<4;e+=2)c==="margin"&&(f+=p.css(a,c+bV[e],!0)),d?(c==="content"&&(f-=parseFloat(bH(a,"padding"+bV[e]))||0),c!=="margin"&&(f-=parseFloat(bH(a,"border"+bV[e]+"Width"))||0)):(f+=parseFloat(bH(a,"padding"+bV[e]))||0,c!=="padding"&&(f+=parseFloat(bH(a,"border"+bV[e]+"Width"))||0));return f}function cb(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=!0,f=p.support.boxSizing&&p.css(a,"boxSizing")==="border-box";if(d<=0||d==null){d=bH(a,b);if(d<0||d==null)d=a.style[b];if(bQ.test(d))return d;e=f&&(p.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+ca(a,b,c||(f?"border":"content"),e)+"px"}function cc(a){if(bS[a])return bS[a];var b=p("<"+a+">").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write("<!doctype html><html><body>"),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bS[a]=c,c}function ci(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||ce.test(a)?d(a,e):ci(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ci(a+"["+e+"]",b[e],c,d);else d(a,b)}function cz(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h<i;h++)d=g[h],f=/^\+/.test(d),f&&(d=d.substr(1)||"*"),e=a[d]=a[d]||[],e[f?"unshift":"push"](c)}}function cA(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h,i=a[f],j=0,k=i?i.length:0,l=a===cv;for(;j<k&&(l||!h);j++)h=i[j](c,d,e),typeof h=="string"&&(!l||g[h]?h=b:(c.dataTypes.unshift(h),h=cA(a,c,d,e,h,g)));return(l||!h)&&!g["*"]&&(h=cA(a,c,d,e,"*",g)),h}function cB(a,c){var d,e,f=p.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&p.extend(!0,a,e)}function cC(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(f in k)f in d&&(c[k[f]]=d[f]);while(j[0]==="*")j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("content-type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}if(g)return g!==j[0]&&j.unshift(g),d[g]}function cD(a,b){var c,d,e,f,g=a.dataTypes.slice(),h=g[0],i={},j=0;a.dataFilter&&(b=a.dataFilter(b,a.dataType));if(g[1])for(c in a.converters)i[c.toLowerCase()]=a.converters[c];for(;e=g[++j];)if(e!=="*"){if(h!=="*"&&h!==e){c=i[h+" "+e]||i["* "+e];if(!c)for(d in i){f=d.split(" ");if(f[1]===e){c=i[h+" "+f[0]]||i["* "+f[0]];if(c){c===!0?c=i[d]:i[d]!==!0&&(e=f[0],g.splice(j--,0,e));break}}}if(c!==!0)if(c&&a["throws"])b=c(b);else try{b=c(b)}catch(k){return{state:"parsererror",error:c?k:"No conversion from "+h+" to "+e}}}h=e}return{state:"success",data:b}}function cL(){try{return new a.XMLHttpRequest}catch(b){}}function cM(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cU(){return setTimeout(function(){cN=b},0),cN=p.now()}function cV(a,b){p.each(b,function(b,c){var d=(cT[b]||[]).concat(cT["*"]),e=0,f=d.length;for(;e<f;e++)if(d[e].call(a,b,c))return})}function cW(a,b,c){var d,e=0,f=0,g=cS.length,h=p.Deferred().always(function(){delete i.elem}),i=function(){var b=cN||cU(),c=Math.max(0,j.startTime+j.duration-b),d=1-(c/j.duration||0),e=0,f=j.tweens.length;for(;e<f;e++)j.tweens[e].run(d);return h.notifyWith(a,[j,d,c]),d<1&&f?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:p.extend({},b),opts:p.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:cN||cU(),duration:c.duration,tweens:[],createTween:function(b,c,d){var e=p.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(e),e},stop:function(b){var c=0,d=b?j.tweens.length:0;for(;c<d;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;cX(k,j.opts.specialEasing);for(;e<g;e++){d=cS[e].call(j,a,k,j.opts);if(d)return d}return cV(j,k),p.isFunction(j.opts.start)&&j.opts.start.call(a,j),p.fx.timer(p.extend(i,{anim:j,queue:j.opts.queue,elem:a})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function cX(a,b){var c,d,e,f,g;for(c in a){d=p.camelCase(c),e=b[d],f=a[c],p.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=p.cssHooks[d];if(g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}}function cY(a,b,c){var d,e,f,g,h,i,j,k,l=this,m=a.style,n={},o=[],q=a.nodeType&&bZ(a);c.queue||(j=p._queueHooks(a,"fx"),j.unqueued==null&&(j.unqueued=0,k=j.empty.fire,j.empty.fire=function(){j.unqueued||k()}),j.unqueued++,l.always(function(){l.always(function(){j.unqueued--,p.queue(a,"fx").length||j.empty.fire()})})),a.nodeType===1&&("height"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],p.css(a,"display")==="inline"&&p.css(a,"float")==="none"&&(!p.support.inlineBlockNeedsLayout||cc(a.nodeName)==="inline"?m.display="inline-block":m.zoom=1)),c.overflow&&(m.overflow="hidden",p.support.shrinkWrapBlocks||l.done(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b){f=b[d];if(cP.exec(f)){delete b[d];if(f===(q?"hide":"show"))continue;o.push(d)}}g=o.length;if(g){h=p._data(a,"fxshow")||p._data(a,"fxshow",{}),q?p(a).show():l.done(function(){p(a).hide()}),l.done(function(){var b;p.removeData(a,"fxshow",!0);for(b in n)p.style(a,b,n[b])});for(d=0;d<g;d++)e=o[d],i=l.createTween(e,q?h[e]:0),n[e]=h[e]||p.style(a,e),e in h||(h[e]=i.start,q&&(i.end=i.start,i.start=e==="width"||e==="height"?1:0))}}function cZ(a,b,c,d,e){return new cZ.prototype.init(a,b,c,d,e)}function c$(a,b){var c,d={height:a},e=0;b=b?1:0;for(;e<4;e+=2-b)c=bV[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function da(a){return p.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var c,d,e=a.document,f=a.location,g=a.navigator,h=a.jQuery,i=a.$,j=Array.prototype.push,k=Array.prototype.slice,l=Array.prototype.indexOf,m=Object.prototype.toString,n=Object.prototype.hasOwnProperty,o=String.prototype.trim,p=function(a,b){return new p.fn.init(a,b,c)},q=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,r=/\S/,s=/\s+/,t=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.1",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i<j;i++)if((a=arguments[i])!=null)for(c in a){d=h[c],e=a[c];if(h===e)continue;k&&e&&(p.isPlainObject(e)||(f=p.isArray(e)))?(f?(f=!1,g=d&&p.isArray(d)?d:[]):g=d&&p.isPlainObject(d)?d:{},h[c]=p.extend(k,g,e)):e!==b&&(h[c]=e)}return h},p.extend({noConflict:function(b){return a.$===p&&(a.$=i),b&&a.jQuery===p&&(a.jQuery=h),p},isReady:!1,readyWait:1,holdReady:function(a){a?p.readyWait++:p.ready(!0)},ready:function(a){if(a===!0?--p.readyWait:p.isReady)return;if(!e.body)return setTimeout(p.ready,1);p.isReady=!0;if(a!==!0&&--p.readyWait>0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f<g;)if(c.apply(a[f++],d)===!1)break}else if(h){for(e in a)if(c.call(a[e],e,a[e])===!1)break}else for(;f<g;)if(c.call(a[f],f,a[f++])===!1)break;return a},trim:o&&!o.call(" ")?function(a){return a==null?"":o.call(a)}:function(a){return a==null?"":a.toString().replace(t,"")},makeArray:function(a,b){var c,d=b||[];return a!=null&&(c=p.type(a),a.length==null||c==="string"||c==="function"||c==="regexp"||p.isWindow(a)?j.call(d,a):p.merge(d,a)),d},inArray:function(a,b,c){var d;if(b){if(l)return l.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=c.length,e=a.length,f=0;if(typeof d=="number")for(;f<d;f++)a[e++]=c[f];else while(c[f]!==b)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;c=!!c;for(;f<g;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,c,d){var e,f,g=[],h=0,i=a.length,j=a instanceof p||i!==b&&typeof i=="number"&&(i>0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h<i;h++)e=c(a[h],h,d),e!=null&&(g[g.length]=e);else for(f in a)e=c(a[f],f,d),e!=null&&(g[g.length]=e);return g.concat.apply([],g)},guid:1,proxy:function(a,c){var d,e,f;return typeof c=="string"&&(d=a[c],c=a,a=d),p.isFunction(a)?(e=k.call(arguments,2),f=function(){return a.apply(c,e.concat(k.call(arguments)))},f.guid=a.guid=a.guid||f.guid||p.guid++,f):b},access:function(a,c,d,e,f,g,h){var i,j=d==null,k=0,l=a.length;if(d&&typeof d=="object"){for(k in d)p.access(a,c,k,d[k],1,g,e);f=1}else if(e!==b){i=h===b&&p.isFunction(e),j&&(i?(i=c,c=function(a,b,c){return i.call(p(a),c)}):(c.call(a,e),c=null));if(c)for(;k<l;k++)c(a[k],d,i?e.call(a[k],k,c(a[k],d)):e,h);f=1}return f?a:j?c.call(a):l?c(a[0],d):g},now:function(){return(new Date).getTime()}}),p.ready.promise=function(b){if(!d){d=p.Deferred();if(e.readyState==="complete")setTimeout(p.ready,1);else if(e.addEventListener)e.addEventListener("DOMContentLoaded",D,!1),a.addEventListener("load",p.ready,!1);else{e.attachEvent("onreadystatechange",D),a.attachEvent("onload",p.ready);var c=!1;try{c=a.frameElement==null&&e.documentElement}catch(f){}c&&c.doScroll&&function g(){if(!p.isReady){try{c.doScroll("left")}catch(a){return setTimeout(g,50)}p.ready()}}()}}return d.promise(b)},p.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){E["[object "+b+"]"]=b.toLowerCase()}),c=p(e);var F={};p.Callbacks=function(a){a=typeof a=="string"?F[a]||G(a):p.extend({},a);var c,d,e,f,g,h,i=[],j=!a.once&&[],k=function(b){c=a.memory&&b,d=!0,h=f||0,f=0,g=i.length,e=!0;for(;i&&h<g;h++)if(i[h].apply(b[0],b[1])===!1&&a.stopOnFalse){c=!1;break}e=!1,i&&(j?j.length&&k(j.shift()):c?i=[]:l.disable())},l={add:function(){if(i){var b=i.length;(function d(b){p.each(b,function(b,c){var e=p.type(c);e==="function"&&(!a.unique||!l.has(c))?i.push(c):c&&c.length&&e!=="string"&&d(c)})})(arguments),e?g=i.length:c&&(f=b,k(c))}return this},remove:function(){return i&&p.each(arguments,function(a,b){var c;while((c=p.inArray(b,i,c))>-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return typeof a=="object"?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b<d;b++)c[b]&&p.isFunction(c[b].promise)?c[b].promise().done(g(b,j,c)).fail(f.reject).progress(g(b,i,h)):--e}return e||f.resolveWith(j,c),f.promise()}}),p.support=function(){var b,c,d,f,g,h,i,j,k,l,m,n=e.createElement("div");n.setAttribute("className","t"),n.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length||!d)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="<div></div>",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||++p.uuid:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e<f;e++)delete d[b[e]];if(!(c?K:p.isEmptyObject)(d))return}}if(!c){delete h[i].data;if(!K(h[i]))return}g?p.cleanData([a],!0):p.support.deleteExpando||h!=h.window?delete h[i]:h[i]=null},_data:function(a,b,c){return p.data(a,b,c,!0)},acceptData:function(a){var b=a.nodeName&&p.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),p.fn.extend({data:function(a,c){var d,e,f,g,h,i=this[0],j=0,k=null;if(a===b){if(this.length){k=p.data(i);if(i.nodeType===1&&!p._data(i,"parsedAttrs")){f=i.attributes;for(h=f.length;j<h;j++)g=f[j].name,g.indexOf("data-")===0&&(g=p.camelCase(g.substring(5)),J(i,g,k[g]));p._data(i,"parsedAttrs",!0)}}return k}return typeof a=="object"?this.each(function(){p.data(this,a)}):(d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!",p.access(this,function(c){if(c===b)return k=this.triggerHandler("getData"+e,[d[0]]),k===b&&i&&(k=p.data(i,a),k=J(i,a,k)),k===b&&d[1]?this.data(d[0]):k;d[1]=c,this.each(function(){var b=p(this);b.triggerHandler("setData"+e,d),p.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.length,e=c.shift(),f=p._queueHooks(a,b),g=function(){p.dequeue(a,b)};e==="inprogress"&&(e=c.shift(),d--),e&&(b==="fx"&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length<d?p.queue(this[0],a):c===b?this:this.each(function(){var b=p.queue(this,a,c);p._queueHooks(this,a),a==="fx"&&b[0]!=="inprogress"&&p.dequeue(this,a)})},dequeue:function(a){return this.each(function(){p.dequeue(this,a)})},delay:function(a,b){return a=p.fx?p.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=p.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};typeof a!="string"&&(c=a,a=b),a=a||"fx";while(h--)d=p._data(g[h],a+"queueHooks"),d&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var L,M,N,O=/[\t\r\n]/g,P=/\r/g,Q=/^(?:button|input)$/i,R=/^(?:button|input|object|select|textarea)$/i,S=/^a(?:rea|)$/i,T=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,U=p.support.getSetAttribute;p.fn.extend({attr:function(a,b){return p.access(this,p.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{f=" "+e.className+" ";for(g=0,h=b.length;g<h;g++)~f.indexOf(" "+b[g]+" ")||(f+=b[g]+" ");e.className=p.trim(f)}}}return this},removeClass:function(a){var c,d,e,f,g,h,i;if(p.isFunction(a))return this.each(function(b){p(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(s);for(h=0,i=this.length;h<i;h++){e=this[h];if(e.nodeType===1&&e.className){d=(" "+e.className+" ").replace(O," ");for(f=0,g=c.length;f<g;f++)while(d.indexOf(" "+c[f]+" ")>-1)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(O," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c<d;c++){e=h[c];if(e.selected&&(p.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!p.nodeName(e.parentNode,"optgroup"))){b=p(e).val();if(i)return b;g.push(b)}}return i&&!g.length&&h.length?p(h[f]).val():g},set:function(a,b){var c=p.makeArray(b);return p(a).find("option").each(function(){this.selected=p.inArray(p(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,""+d),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g<d.length;g++)e=d[g],e&&(c=p.propFix[e]||e,f=T.test(e),f||p.attr(a,e,""),a.removeAttribute(U?e:c),f&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(Q.test(a.nodeName)&&a.parentNode)p.error("type property can't be changed");else if(!p.support.radioValue&&b==="radio"&&p.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}},value:{get:function(a,b){return L&&p.nodeName(a,"button")?L.get(a,b):b in a?a.value:null},set:function(a,b,c){if(L&&p.nodeName(a,"button"))return L.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(!a||h===3||h===8||h===2)return;return g=h!==1||!p.isXMLDoc(a),g&&(c=p.propFix[c]||c,f=p.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&(e=f.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):R.test(a.nodeName)||S.test(a.nodeName)&&a.href?0:b}}}}),M={get:function(a,c){var d,e=p.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;return b===!1?p.removeAttr(a,c):(d=p.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase())),c}},U||(N={name:!0,id:!0,coords:!0},L=p.valHooks.button={get:function(a,c){var d;return d=a.getAttributeNode(c),d&&(N[c]?d.value!=="":d.specified)?d.value:b},set:function(a,b,c){var d=a.getAttributeNode(c);return d||(d=e.createAttribute(c),a.setAttributeNode(d)),d.value=b+""}},p.each(["width","height"],function(a,b){p.attrHooks[b]=p.extend(p.attrHooks[b],{set:function(a,c){if(c==="")return a.setAttribute(b,"auto"),c}})}),p.attrHooks.contenteditable={get:L.get,set:function(a,b,c){b===""&&(b="false"),L.set(a,b,c)}}),p.support.hrefNormalized||p.each(["href","src","width","height"],function(a,c){p.attrHooks[c]=p.extend(p.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),p.support.style||(p.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),p.support.optSelected||(p.propHooks.selected=p.extend(p.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),p.support.enctype||(p.propFix.enctype="encoding"),p.support.checkOn||p.each(["radio","checkbox"],function(){p.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),p.each(["radio","checkbox"],function(){p.valHooks[this]=p.extend(p.valHooks[this],{set:function(a,b){if(p.isArray(b))return a.checked=p.inArray(p(a).val(),b)>=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j<c.length;j++){k=W.exec(c[j])||[],l=k[1],m=(k[2]||"").split(".").sort(),r=p.event.special[l]||{},l=(f?r.delegateType:r.bindType)||l,r=p.event.special[l]||{},n=p.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,namespace:m.join(".")},o),q=i[l];if(!q){q=i[l]=[],q.delegateCount=0;if(!r.setup||r.setup.call(a,e,m,h)===!1)a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h)}r.add&&(r.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,n):q.push(n),p.event.global[l]=!0}a=null},global:{},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,q,r=p.hasData(a)&&p._data(a);if(!r||!(m=r.events))return;b=p.trim(_(b||"")).split(" ");for(f=0;f<b.length;f++){g=W.exec(b[f])||[],h=i=g[1],j=g[2];if(!h){for(h in m)p.event.remove(a,h+b[f],c,d,!0);continue}n=p.event.special[h]||{},h=(d?n.delegateType:n.bindType)||h,o=m[h]||[],k=o.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(l=0;l<o.length;l++)q=o[l],(e||i===q.origType)&&(!c||c.guid===q.guid)&&(!j||j.test(q.namespace))&&(!d||d===q.selector||d==="**"&&q.selector)&&(o.splice(l--,1),q.selector&&o.delegateCount--,n.remove&&n.remove.call(a,q));o.length===0&&k!==o.length&&((!n.teardown||n.teardown.call(a,j,r.handle)===!1)&&p.removeEvent(a,h,r.handle),delete m[h])}p.isEmptyObject(m)&&(delete r.handle,p.removeData(a,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,f,g){if(!f||f.nodeType!==3&&f.nodeType!==8){var h,i,j,k,l,m,n,o,q,r,s=c.type||c,t=[];if($.test(s+p.event.triggered))return;s.indexOf("!")>=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j<q.length&&!c.isPropagationStopped();j++)k=q[j][0],c.type=q[j][1],o=(p._data(k,"events")||{})[c.type]&&p._data(k,"handle"),o&&o.apply(k,d),o=m&&k[m],o&&p.acceptData(k)&&o.apply(k,d)===!1&&c.preventDefault();return c.type=s,!g&&!c.isDefaultPrevented()&&(!n._default||n._default.apply(f.ownerDocument,d)===!1)&&(s!=="click"||!p.nodeName(f,"a"))&&p.acceptData(f)&&m&&f[s]&&(s!=="focus"&&s!=="blur"||c.target.offsetWidth!==0)&&!p.isWindow(f)&&(l=f[m],l&&(f[m]=null),p.event.triggered=s,f[s](),p.event.triggered=b,l&&(f[m]=l)),c.result}return},dispatch:function(c){c=p.event.fix(c||a.event);var d,e,f,g,h,i,j,k,l,m,n=(p._data(this,"events")||{})[c.type]||[],o=n.delegateCount,q=[].slice.call(arguments),r=!c.exclusive&&!c.namespace,s=p.event.special[c.type]||{},t=[];q[0]=c,c.delegateTarget=this;if(s.preDispatch&&s.preDispatch.call(this,c)===!1)return;if(o&&(!c.button||c.type!=="click"))for(f=c.target;f!=this;f=f.parentNode||this)if(f.disabled!==!0||c.type!=="click"){h={},j=[];for(d=0;d<o;d++)k=n[d],l=k.selector,h[l]===b&&(h[l]=p(l,this).index(f)>=0),h[l]&&j.push(k);j.length&&t.push({elem:f,matches:j})}n.length>o&&t.push({elem:this,matches:n.slice(o)});for(d=0;d<t.length&&!c.isPropagationStopped();d++){i=t[d],c.currentTarget=i.elem;for(e=0;e<i.matches.length&&!c.isImmediatePropagationStopped();e++){k=i.matches[e];if(r||!c.namespace&&!k.namespace||c.namespace_re&&c.namespace_re.test(k.namespace))c.data=k.data,c.handleObj=k,g=((p.event.special[k.origType]||{}).handle||k.handler).apply(i.elem,q),g!==b&&(c.result=g,g===!1&&(c.preventDefault(),c.stopPropagation()))}}return s.postDispatch&&s.postDispatch.call(this,c),c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,f,g,h=c.button,i=c.fromElement;return a.pageX==null&&c.clientX!=null&&(d=a.target.ownerDocument||e,f=d.documentElement,g=d.body,a.pageX=c.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=c.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?c.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0),a}},fix:function(a){if(a[p.expando])return a;var b,c,d=a,f=p.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=p.Event(d);for(b=g.length;b;)c=g[--b],a[c]=d[c];return a.target||(a.target=d.srcElement||e),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,f.filter?f.filter(a,d):a},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){p.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=p.extend(new p.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?p.event.trigger(e,null,b):p.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},p.event.handle=p.event.dispatch,p.removeEvent=e.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]=="undefined"&&(a[d]=null),a.detachEvent(d,c))},p.Event=function(a,b){if(this instanceof p.Event)a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?bb:ba):this.type=a,b&&p.extend(this,b),this.timeStamp=a&&a.timeStamp||p.now(),this[p.expando]=!0;else return new p.Event(a,b)},p.Event.prototype={preventDefault:function(){this.isDefaultPrevented=bb;var a=this.originalEvent;if(!a)return;a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=bb;var a=this.originalEvent;if(!a)return;a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()},isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba},p.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){p.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj,g=f.selector;if(!e||e!==d&&!p.contains(d,e))a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b;return c}}}),p.support.submitBubbles||(p.event.special.submit={setup:function(){if(p.nodeName(this,"form"))return!1;p.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=p.nodeName(c,"input")||p.nodeName(c,"button")?c.form:b;d&&!p._data(d,"_submit_attached")&&(p.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),p._data(d,"_submit_attached",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&p.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(p.nodeName(this,"form"))return!1;p.event.remove(this,"._submit")}}),p.support.changeBubbles||(p.event.special.change={setup:function(){if(V.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")p.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),p.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),p.event.simulate("change",this,a,!0)});return!1}p.event.add(this,"beforeactivate._change",function(a){var b=a.target;V.test(b.nodeName)&&!p._data(b,"_change_attached")&&(p.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&p.event.simulate("change",this.parentNode,a,!0)}),p._data(b,"_change_attached",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){return p.event.remove(this,"._change"),!V.test(this.nodeName)}}),p.support.focusinBubbles||p.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){p.event.simulate(b,a.target,p.event.fix(a),!0)};p.event.special[b]={setup:function(){c++===0&&e.addEventListener(a,d,!0)},teardown:function(){--c===0&&e.removeEventListener(a,d,!0)}}}),p.fn.extend({on:function(a,c,d,e,f){var g,h;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(h in a)this.on(h,c,d,a[h],f);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=ba;else if(!e)return this;return f===1&&(g=e,e=function(a){return p().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=p.guid++)),this.each(function(){p.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,p(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if(typeof a=="object"){for(f in a)this.off(f,c,a[f]);return this}if(c===!1||typeof c=="function")d=c,c=b;return d===!1&&(d=ba),this.each(function(){p.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){return p(this.context).on(a,this.selector,b,c),this},die:function(a,b){return p(this.context).off(a,this.selector||"**",b),this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){p.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return p.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||p.guid++,d=0,e=function(c){var e=(p._data(this,"lastToggle"+a.guid)||0)%d;return p._data(this,"lastToggle"+a.guid,e+1),c.preventDefault(),b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),p.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){p.fn[b]=function(a,c){return c==null&&(c=a,a=null),arguments.length>0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function $(a,b,c,d){c=c||[],b=b||q;var e,f,g,j,k=b.nodeType;if(k!==1&&k!==9)return[];if(!a||typeof a!="string")return c;g=h(b);if(!g&&!d)if(e=L.exec(a))if(j=e[1]){if(k===9){f=b.getElementById(j);if(!f||!f.parentNode)return c;if(f.id===j)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(j))&&i(b,f)&&f.id===j)return c.push(f),c}else{if(e[2])return u.apply(c,t.call(b.getElementsByTagName(a),0)),c;if((j=e[3])&&X&&b.getElementsByClassName)return u.apply(c,t.call(b.getElementsByClassName(j),0)),c}return bk(a,b,c,d,g)}function _(a){return function(b){var c=b.nodeName.toLowerCase();return c==="input"&&b.type===a}}function ba(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}}function bb(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}function bc(a,b,c,d){var e,g,h,i,j,k,l,m,n,p,r=!c&&b!==q,s=(r?"<s>":"")+a.replace(H,"$1<s>"),u=y[o][s];if(u)return d?0:t.call(u,0);j=a,k=[],m=0,n=f.preFilter,p=f.filter;while(j){if(!e||(g=I.exec(j)))g&&(j=j.slice(g[0].length),h.selector=l),k.push(h=[]),l="",r&&(j=" "+j);e=!1;if(g=J.exec(j))l+=g[0],j=j.slice(g[0].length),e=h.push({part:g.pop().replace(H," "),string:g[0],captures:g});for(i in p)(g=S[i].exec(j))&&(!n[i]||(g=n[i](g,b,c)))&&(l+=g[0],j=j.slice(g[0].length),e=h.push({part:i,string:g.shift(),captures:g}));if(!e)break}return l&&(h.selector=l),d?j.length:j?$.error(a):t.call(y(s,k),0)}function bd(a,b,e,f){var g=b.dir,h=s++;return a||(a=function(a){return a===e}),b.first?function(b){while(b=b[g])if(b.nodeType===1)return a(b)&&b}:f?function(b){while(b=b[g])if(b.nodeType===1&&a(b))return b}:function(b){var e,f=h+"."+c,i=f+"."+d;while(b=b[g])if(b.nodeType===1){if((e=b[o])===i)return b.sizset;if(typeof e=="string"&&e.indexOf(f)===0){if(b.sizset)return b}else{b[o]=i;if(a(b))return b.sizset=!0,b;b.sizset=!1}}}}function be(a,b){return a?function(c){var d=b(c);return d&&a(d===!0?c:d)}:b}function bf(a,b,c){var d,e,g=0;for(;d=a[g];g++)f.relative[d.part]?e=bd(e,f.relative[d.part],b,c):e=be(e,f.filter[d.part].apply(null,d.captures.concat(b,c)));return e}function bg(a){return function(b){var c,d=0;for(;c=a[d];d++)if(c(b))return!0;return!1}}function bh(a,b,c,d){var e=0,f=b.length;for(;e<f;e++)$(a,b[e],c,d)}function bi(a,b,c,d,e,g){var h,i=f.setFilters[b.toLowerCase()];return i||$.error(b),(a||!(h=e))&&bh(a||"*",d,h=[],e),h.length>0?i(h,c,g):[]}function bj(a,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s=0,t=a.length,v=S.POS,w=new RegExp("^"+v.source+"(?!"+A+")","i"),x=function(){var a=1,c=arguments.length-2;for(;a<c;a++)arguments[a]===b&&(n[a]=b)};for(;s<t;s++){f=a[s],g="",m=e;for(h=0,i=f.length;h<i;h++){j=f[h],k=j.string;if(j.part==="PSEUDO"){v.exec(""),l=0;while(n=v.exec(k)){o=!0,p=v.lastIndex=n.index+n[0].length;if(p>l){g+=k.slice(l,n.index),l=p,q=[c],J.test(g)&&(m&&(q=m),m=e);if(r=O.test(g))g=g.slice(0,-5).replace(J,"$&*"),l++;n.length>1&&n[0].replace(w,x),m=bi(g,n[1],n[2],q,m,r)}g=""}}o||(g+=k),o=!1}g?J.test(g)?bh(g,m||[c],d,e):$(g,c,d,e?e.concat(m):m):u.apply(d,m)}return t===1?d:$.uniqueSort(d)}function bk(a,b,e,g,h){a=a.replace(H,"$1");var i,k,l,m,n,o,p,q,r,s,v=bc(a,b,h),w=b.nodeType;if(S.POS.test(a))return bj(v,b,e,g);if(g)i=t.call(g,0);else if(v.length===1){if((o=t.call(v[0],0)).length>2&&(p=o[0]).part==="ID"&&w===9&&!h&&f.relative[o[1].part]){b=f.find.ID(p.captures[0].replace(R,""),b,h)[0];if(!b)return e;a=a.slice(o.shift().string.length)}r=(v=N.exec(o[0].string))&&!v.index&&b.parentNode||b,q="";for(n=o.length-1;n>=0;n--){p=o[n],s=p.part,q=p.string+q;if(f.relative[s])break;if(f.order.test(s)){i=f.find[s](p.captures[0].replace(R,""),r,h);if(i==null)continue;a=a.slice(0,a.length-q.length)+q.replace(S[s],""),a||u.apply(e,t.call(i,0));break}}}if(a){k=j(a,b,h),c=k.dirruns++,i==null&&(i=f.find.TAG("*",N.test(a)&&b.parentNode||b));for(n=0;m=i[n];n++)d=k.runs++,k(m)&&e.push(m)}return e}var c,d,e,f,g,h,i,j,k,l,m=!0,n="undefined",o=("sizcache"+Math.random()).replace(".",""),q=a.document,r=q.documentElement,s=0,t=[].slice,u=[].push,v=function(a,b){return a[o]=b||!0,a},w=function(){var a={},b=[];return v(function(c,d){return b.push(c)>f.cacheLength&&delete a[b.shift()],a[c]=d},a)},x=w(),y=w(),z=w(),A="[\\x20\\t\\r\\n\\f]",B="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",C=B.replace("w","w#"),D="([*^$|!~]?=)",E="\\["+A+"*("+B+")"+A+"*(?:"+D+A+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+C+")|)|)"+A+"*\\]",F=":("+B+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+E+")|[^:]|\\\\.)*|.*))\\)|)",G=":(nth|eq|gt|lt|first|last|even|odd)(?:\\(((?:-\\d)?\\d*)\\)|)(?=[^-]|$)",H=new RegExp("^"+A+"+|((?:^|[^\\\\])(?:\\\\.)*)"+A+"+$","g"),I=new RegExp("^"+A+"*,"+A+"*"),J=new RegExp("^"+A+"*([\\x20\\t\\r\\n\\f>+~])"+A+"*"),K=new RegExp(F),L=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,M=/^:not/,N=/[\x20\t\r\n\f]*[+~]/,O=/:not\($/,P=/h\d/i,Q=/input|select|textarea|button/i,R=/\\(?!\\)/g,S={ID:new RegExp("^#("+B+")"),CLASS:new RegExp("^\\.("+B+")"),NAME:new RegExp("^\\[name=['\"]?("+B+")['\"]?\\]"),TAG:new RegExp("^("+B.replace("w","w*")+")"),ATTR:new RegExp("^"+E),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+A+"*(even|odd|(([+-]|)(\\d*)n|)"+A+"*(?:([+-]|)"+A+"*(\\d+)|))"+A+"*\\)|)","i"),POS:new RegExp(G,"ig"),needsContext:new RegExp("^"+A+"*[>+~]|"+G,"i")},T=function(a){var b=q.createElement("div");try{return a(b)}catch(c){return!1}finally{b=null}},U=T(function(a){return a.appendChild(q.createComment("")),!a.getElementsByTagName("*").length}),V=T(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==n&&a.firstChild.getAttribute("href")==="#"}),W=T(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),X=T(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!a.getElementsByClassName||!a.getElementsByClassName("e").length?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length===2)}),Y=T(function(a){a.id=o+0,a.innerHTML="<a name='"+o+"'></a><div name='"+o+"'></div>",r.insertBefore(a,r.firstChild);var b=q.getElementsByName&&q.getElementsByName(o).length===2+q.getElementsByName(o+0).length;return e=!q.getElementById(o),r.removeChild(a),b});try{t.call(r.childNodes,0)[0].nodeType}catch(Z){t=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}$.matches=function(a,b){return $(a,null,null,b)},$.matchesSelector=function(a,b){return $(b,null,null,[a]).length>0},g=$.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=g(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=g(b);return c},h=$.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},i=$.contains=r.contains?function(a,b){var c=a.nodeType===9?a.documentElement:a,d=b&&b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:r.compareDocumentPosition?function(a,b){return b&&!!(a.compareDocumentPosition(b)&16)}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},$.attr=function(a,b){var c,d=h(a);return d||(b=b.toLowerCase()),f.attrHandle[b]?f.attrHandle[b](a):W||d?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},f=$.selectors={cacheLength:50,createPseudo:v,match:S,order:new RegExp("ID|TAG"+(Y?"|NAME":"")+(X?"|CLASS":"")),attrHandle:V?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},find:{ID:e?function(a,b,c){if(typeof b.getElementById!==n&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==n&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==n&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:U?function(a,b){if(typeof b.getElementsByTagName!==n)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c},NAME:function(a,b){if(typeof b.getElementsByName!==n)return b.getElementsByName(name)},CLASS:function(a,b,c){if(typeof b.getElementsByClassName!==n&&!c)return b.getElementsByClassName(a)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(R,""),a[3]=(a[4]||a[5]||"").replace(R,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||$.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&$.error(a[0]),a},PSEUDO:function(a,b,c){var d,e;if(S.CHILD.test(a[0]))return null;if(a[3])a[2]=a[3];else if(d=a[4])K.test(d)&&(e=bc(d,b,c,!0))&&(e=d.indexOf(")",d.length-e)-d.length)&&(d=d.slice(0,e),a[0]=a[0].slice(0,e)),a[2]=d;return a.slice(0,3)}},filter:{ID:e?function(a){return a=a.replace(R,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(R,""),function(b){var c=typeof b.getAttributeNode!==n&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(R,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=x[o][a];return b||(b=x(a,new RegExp("(^|"+A+")"+a+"("+A+"|$)"))),function(a){return b.test(a.className||typeof a.getAttribute!==n&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return b?function(d){var e=$.attr(d,a),f=e+"";if(e==null)return b==="!=";switch(b){case"=":return f===c;case"!=":return f!==c;case"^=":return c&&f.indexOf(c)===0;case"*=":return c&&f.indexOf(c)>-1;case"$=":return c&&f.substr(f.length-c.length)===c;case"~=":return(" "+f+" ").indexOf(c)>-1;case"|=":return f===c||f.substr(0,c.length+1)===c+"-"}}:function(b){return $.attr(b,a)!=null}},CHILD:function(a,b,c,d){if(a==="nth"){var e=s++;return function(a){var b,f,g=0,h=a;if(c===1&&d===0)return!0;b=a.parentNode;if(b&&(b[o]!==e||!a.sizset)){for(h=b.firstChild;h;h=h.nextSibling)if(h.nodeType===1){h.sizset=++g;if(h===a)break}b[o]=e}return f=a.sizset-d,c===0?f===0:f%c===0&&f/c>=0}}return function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b,c,d){var e,g=f.pseudos[a]||f.pseudos[a.toLowerCase()];return g||$.error("unsupported pseudo: "+a),g[o]?g(b,c,d):g.length>1?(e=[a,a,"",b],function(a){return g(a,0,e)}):g}},pseudos:{not:v(function(a,b,c){var d=j(a.replace(H,"$1"),b,c);return function(a){return!d(a)}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!f.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},contains:v(function(a){return function(b){return(b.textContent||b.innerText||g(b)).indexOf(a)>-1}}),has:v(function(a){return function(b){return $(a,b).length>0}}),header:function(a){return P.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:_("radio"),checkbox:_("checkbox"),file:_("file"),password:_("password"),image:_("image"),submit:ba("submit"),reset:ba("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return Q.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b,c){return c?a.slice(1):[a[0]]},last:function(a,b,c){var d=a.pop();return c?a:[d]},even:function(a,b,c){var d=[],e=c?1:0,f=a.length;for(;e<f;e=e+2)d.push(a[e]);return d},odd:function(a,b,c){var d=[],e=c?0:1,f=a.length;for(;e<f;e=e+2)d.push(a[e]);return d},lt:function(a,b,c){return c?a.slice(+b):a.slice(0,+b)},gt:function(a,b,c){return c?a.slice(0,+b+1):a.slice(+b+1)},eq:function(a,b,c){var d=a.splice(+b,1);return c?a:d}}},k=r.compareDocumentPosition?function(a,b){return a===b?(l=!0,0):(!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition:a.compareDocumentPosition(b)&4)?-1:1}:function(a,b){if(a===b)return l=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,h=b.parentNode,i=g;if(g===h)return bb(a,b);if(!g)return-1;if(!h)return 1;while(i)e.unshift(i),i=i.parentNode;i=h;while(i)f.unshift(i),i=i.parentNode;c=e.length,d=f.length;for(var j=0;j<c&&j<d;j++)if(e[j]!==f[j])return bb(e[j],f[j]);return j===c?bb(a,f[j],-1):bb(e[j],b,1)},[0,0].sort(k),m=!l,$.uniqueSort=function(a){var b,c=1;l=m,a.sort(k);if(l)for(;b=a[c];c++)b===a[c-1]&&a.splice(c--,1);return a},$.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},j=$.compile=function(a,b,c){var d,e,f,g=z[o][a];if(g&&g.context===b)return g;d=bc(a,b,c);for(e=0,f=d.length;e<f;e++)d[e]=bf(d[e],b,c);return g=z(a,bg(d)),g.context=b,g.runs=g.dirruns=0,g},q.querySelectorAll&&function(){var a,b=bk,c=/'|\\/g,d=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,e=[],f=[":active"],g=r.matchesSelector||r.mozMatchesSelector||r.webkitMatchesSelector||r.oMatchesSelector||r.msMatchesSelector;T(function(a){a.innerHTML="<select><option selected=''></option></select>",a.querySelectorAll("[selected]").length||e.push("\\["+A+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),T(function(a){a.innerHTML="<p test=''></p>",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+A+"*(?:\"\"|'')"),a.innerHTML="<input type='hidden'/>",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=e.length&&new RegExp(e.join("|")),bk=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a)))if(d.nodeType===9)try{return u.apply(f,t.call(d.querySelectorAll(a),0)),f}catch(i){}else if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){var j,k,l,m=d.getAttribute("id"),n=m||o,p=N.test(a)&&d.parentNode||d;m?n=n.replace(c,"\\$&"):d.setAttribute("id",n),j=bc(a,d,h),n="[id='"+n+"']";for(k=0,l=j.length;k<l;k++)j[k]=n+j[k].selector;try{return u.apply(f,t.call(p.querySelectorAll(j.join(",")),0)),f}catch(i){}finally{m||d.removeAttribute("id")}}return b(a,d,f,g,h)},g&&(T(function(b){a=g.call(b,"div");try{g.call(b,"[test!='']:sizzle"),f.push(S.PSEUDO.source,S.POS.source,"!=")}catch(c){}}),f=new RegExp(f.join("|")),$.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!h(b)&&!f.test(c)&&(!e||!e.test(c)))try{var i=g.call(b,c);if(i||a||b.document&&b.document.nodeType!==11)return i}catch(j){}return $(c,null,null,[b]).length>0})}(),f.setFilters.nth=f.setFilters.eq,f.filters=f.pseudos,$.attr=p.attr,p.find=$,p.expr=$.selectors,p.expr[":"]=p.expr.pseudos,p.unique=$.uniqueSort,p.text=$.getText,p.isXMLDoc=$.isXML,p.contains=$.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b<c;b++)if(p.contains(h[b],this))return!0});g=this.pushStack("","find",a);for(b=0,c=this.length;b<c;b++){d=g.length,p.find(a,this[b],g);if(b>0)for(e=d;e<g.length;e++)for(f=0;f<d;f++)if(g[f]===g[e]){g.splice(e--,1);break}}return g},has:function(a){var b,c=p(a,this),d=c.length;return this.filter(function(){for(b=0;b<d;b++)if(p.contains(this,c[b]))return!0})},not:function(a){return this.pushStack(bj(this,a,!1),"not",a)},filter:function(a){return this.pushStack(bj(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?bf.test(a)?p(a,this.context).index(this[0])>=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d<e;d++){c=this[d];while(c&&c.ownerDocument&&c!==b&&c.nodeType!==11){if(g?g.index(c)>-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/<tbody/i,br=/<|&#?\w+;/,bs=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,bu=new RegExp("<(?:"+bl+")[\\s/>]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,bz={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X<div>","</div>"]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return bh(this[0])?this.length?this.pushStack(p(p.isFunction(a)?a():a),"replaceWith",a):this:p.isFunction(a)?this.each(function(b){var c=p(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=p(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;p(this).remove(),b?p(b).before(a):p(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],l=this.length;if(!p.support.checkClone&&l>1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i<l;i++)d.call(c&&p.nodeName(this[i],"table")?bC(this[i],"tbody"):this[i],i===h?g:p.clone(g,!0,!0))}g=f=null,k.length&&p.each(k,function(a,b){b.src?p.ajax?p.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):p.error("no ajax"):p.globalEval((b.text||b.textContent||b.innerHTML||"").replace(by,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),p.buildFragment=function(a,c,d){var f,g,h,i=a[0];return c=c||e,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,a.length===1&&typeof i=="string"&&i.length<512&&c===e&&i.charAt(0)==="<"&&!bt.test(i)&&(p.support.checkClone||!bw.test(i))&&(p.support.html5Clone||!bu.test(i))&&(g=!0,f=p.fragments[i],h=f!==b),f||(f=c.createDocumentFragment(),p.clean(a,c,f,d),g&&(p.fragments[i]=h&&f)),{fragment:f,cacheable:g}},p.fragments={},p.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){p.fn[a]=function(c){var d,e=0,f=[],g=p(c),h=g.length,i=this.length===1&&this[0].parentNode;if((i==null||i&&i.nodeType===11&&i.childNodes.length===1)&&h===1)return g[b](this[0]),this;for(;e<h;e++)d=(e>0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=b===e&&bA,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(f=0;(h=a[f])!=null;f++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{s=s||bk(b),l=b.createElement("div"),s.appendChild(l),h=h.replace(bo,"<$1></$2>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]==="<table>"&&!m?l.childNodes:[];for(g=n.length-1;g>=0;--g)p.nodeName(n[g],"tbody")&&!n[g].childNodes.length&&n[g].parentNode.removeChild(n[g])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l.parentNode.removeChild(l)}h.nodeType?t.push(h):p.merge(t,h)}l&&(h=l=s=null);if(!p.support.appendChecked)for(f=0;(h=t[f])!=null;f++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(f=0;(h=t[f])!=null;f++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[f+1,0].concat(r)),f+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.chrome?b.webkit=!0:b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^(none|table(?!-c[ea]).+)/,bO=/^margin/,bP=new RegExp("^("+q+")(.*)$","i"),bQ=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bR=new RegExp("^([-+])=("+q+")","i"),bS={},bT={position:"absolute",visibility:"hidden",display:"block"},bU={letterSpacing:0,fontWeight:400},bV=["Top","Right","Bottom","Left"],bW=["Webkit","O","Moz","ms"],bX=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return b$(this,!0)},hide:function(){return b$(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bX.apply(this,arguments):this.each(function(){(c?a:bZ(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bY(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bR.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bY(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bU&&(f=bU[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(b,c){var d,e,f,g,h=a.getComputedStyle(b,null),i=b.style;return h&&(d=h[c],d===""&&!p.contains(b.ownerDocument,b)&&(d=p.style(b,c)),bQ.test(d)&&bO.test(c)&&(e=i.width,f=i.minWidth,g=i.maxWidth,i.minWidth=i.maxWidth=i.width=d,d=h.width,i.width=e,i.minWidth=f,i.maxWidth=g)),d}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bQ.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth===0&&bN.test(bH(a,"display"))?p.swap(a,bT,function(){return cb(a,b,d)}):cb(a,b,d)},set:function(a,c,d){return b_(a,c,d?ca(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bQ.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bV[d]+b]=e[d]||e[d-2]||e[0];return f}},bO.test(a)||(p.cssHooks[a+b].set=b_)});var cd=/%20/g,ce=/\[\]$/,cf=/\r?\n/g,cg=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ch=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ch.test(this.nodeName)||cg.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(cf,"\r\n")}}):{name:b.name,value:c.replace(cf,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ci(d,a[d],c,f);return e.join("&").replace(cd,"+")};var cj,ck,cl=/#.*$/,cm=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,co=/^(?:GET|HEAD)$/,cp=/^\/\//,cq=/\?/,cr=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,cs=/([?&])_=[^&]*/,ct=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,cu=p.fn.load,cv={},cw={},cx=["*/"]+["*"];try{cj=f.href}catch(cy){cj=e.createElement("a"),cj.href="",cj=cj.href}ck=ct.exec(cj.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&cu)return cu.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):c&&typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("<div>").append(a.replace(cr,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cB(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cB(a,b),a},ajaxSettings:{url:cj,isLocal:cn.test(ck[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cx},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cz(cv),ajaxTransport:cz(cw),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cC(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cD(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=""+(c||y),k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cm.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(cl,"").replace(cp,ck[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=ct.exec(l.url.toLowerCase()),l.crossDomain=!(!i||i[1]==ck[1]&&i[2]==ck[2]&&(i[3]||(i[1]==="http:"?80:443))==(ck[3]||(ck[1]==="http:"?80:443)))),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cA(cv,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!co.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cq.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cs,"$1_="+z);l.url=A+(A===l.url?(cq.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cx+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cA(cw,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cE=[],cF=/\?/,cG=/(=)\?(?=&|$)|\?\?/,cH=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cE.pop()||p.expando+"_"+cH++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cG.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cG.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cG,"$1"+f):m?c.data=i.replace(cG,"$1"+f):k&&(c.url+=(cF.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cE.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cI,cJ=a.ActiveXObject?function(){for(var a in cI)cI[a](0,1)}:!1,cK=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cL()||cM()}:cL,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cJ&&delete cI[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cK,cJ&&(cI||(cI={},p(a).unload(cJ)),cI[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cN,cO,cP=/^(?:toggle|show|hide)$/,cQ=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cR=/queueHooks$/,cS=[cY],cT={"*":[function(a,b){var c,d,e,f=this.createTween(a,b),g=cQ.exec(b),h=f.cur(),i=+h||0,j=1;if(g){c=+g[2],d=g[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&i){i=p.css(f.elem,a,!0)||c||1;do e=j=j||".5",i=i/j,p.style(f.elem,a,i+d),j=f.cur()/h;while(j!==1&&j!==e)}f.unit=d,f.start=i,f.end=g[1]?i+(g[1]+1)*c:c}return f}]};p.Animation=p.extend(cW,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d<e;d++)c=a[d],cT[c]=cT[c]||[],cT[c].unshift(b)},prefilter:function(a,b){b?cS.unshift(a):cS.push(a)}}),p.Tween=cZ,cZ.prototype={constructor:cZ,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(p.cssNumber[c]?"":"px")},cur:function(){var a=cZ.propHooks[this.prop];return a&&a.get?a.get(this):cZ.propHooks._default.get(this)},run:function(a){var b,c=cZ.propHooks[this.prop];return this.options.duration?this.pos=b=p.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):cZ.propHooks._default.set(this),this}},cZ.prototype.init.prototype=cZ.prototype,cZ.propHooks={_default:{get:function(a){var b;return a.elem[a.prop]==null||!!a.elem.style&&a.elem.style[a.prop]!=null?(b=p.css(a.elem,a.prop,!1,""),!b||b==="auto"?0:b):a.elem[a.prop]},set:function(a){p.fx.step[a.prop]?p.fx.step[a.prop](a):a.elem.style&&(a.elem.style[p.cssProps[a.prop]]!=null||p.cssHooks[a.prop])?p.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},cZ.propHooks.scrollTop=cZ.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},p.each(["toggle","show","hide"],function(a,b){var c=p.fn[b];p.fn[b]=function(d,e,f){return d==null||typeof d=="boolean"||!a&&p.isFunction(d)&&p.isFunction(e)?c.apply(this,arguments):this.animate(c$(b,!0),d,e,f)}}),p.fn.extend({fadeTo:function(a,b,c,d){return this.filter(bZ).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=p.isEmptyObject(a),f=p.speed(b,c,d),g=function(){var b=cW(this,p.extend({},a),f);e&&b.stop(!0)};return e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,c,d){var e=function(a){var b=a.stop;delete a.stop,b(d)};return typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,c=a!=null&&a+"queueHooks",f=p.timers,g=p._data(this);if(c)g[c]&&g[c].stop&&e(g[c]);else for(c in g)g[c]&&g[c].stop&&cR.test(c)&&e(g[c]);for(c=f.length;c--;)f[c].elem===this&&(a==null||f[c].queue===a)&&(f[c].anim.stop(d),b=!1,f.splice(c,1));(b||!d)&&p.dequeue(this,a)})}}),p.each({slideDown:c$("show"),slideUp:c$("hide"),slideToggle:c$("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){p.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),p.speed=function(a,b,c){var d=a&&typeof a=="object"?p.extend({},a):{complete:c||!c&&b||p.isFunction(a)&&a,duration:a,easing:c&&b||b&&!p.isFunction(b)&&b};d.duration=p.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in p.fx.speeds?p.fx.speeds[d.duration]:p.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";return d.old=d.complete,d.complete=function(){p.isFunction(d.old)&&d.old.call(this),d.queue&&p.dequeue(this,d.queue)},d},p.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},p.timers=[],p.fx=cZ.prototype.init,p.fx.tick=function(){var a,b=p.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||p.fx.stop()},p.fx.timer=function(a){a()&&p.timers.push(a)&&!cO&&(cO=setInterval(p.fx.tick,p.fx.interval))},p.fx.interval=13,p.fx.stop=function(){clearInterval(cO),cO=null},p.fx.speeds={slow:600,fast:200,_default:400},p.fx.step={},p.expr&&p.expr.filters&&(p.expr.filters.animated=function(a){return p.grep(p.timers,function(b){return a===b.elem}).length});var c_=/^(?:body|html)$/i;p.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){p.offset.setOffset(this,a,b)});var c,d,e,f,g,h,i,j,k,l,m=this[0],n=m&&m.ownerDocument;if(!n)return;return(e=n.body)===m?p.offset.bodyOffset(m):(d=n.documentElement,p.contains(d,m)?(c=m.getBoundingClientRect(),f=da(n),g=d.clientTop||e.clientTop||0,h=d.clientLeft||e.clientLeft||0,i=f.pageYOffset||d.scrollTop,j=f.pageXOffset||d.scrollLeft,k=c.top+i-g,l=c.left+j-h,{top:k,left:l}):{top:0,left:0})},p.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;return p.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(p.css(a,"marginTop"))||0,c+=parseFloat(p.css(a,"marginLeft"))||0),{top:b,left:c}},setOffset:function(a,b,c){var d=p.css(a,"position");d==="static"&&(a.style.position="relative");var e=p(a),f=e.offset(),g=p.css(a,"top"),h=p.css(a,"left"),i=(d==="absolute"||d==="fixed")&&p.inArray("auto",[g,h])>-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c_.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c_.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=da(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g,null)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window);
js/padoo/jquery_noconflict.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery.noConflict();
js/padoo/scriptaculous.js ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
2
+
3
+ // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
4
+ //
5
+ // Permission is hereby granted, free of charge, to any person obtaining
6
+ // a copy of this software and associated documentation files (the
7
+ // "Software"), to deal in the Software without restriction, including
8
+ // without limitation the rights to use, copy, modify, merge, publish,
9
+ // distribute, sublicense, and/or sell copies of the Software, and to
10
+ // permit persons to whom the Software is furnished to do so, subject to
11
+ // the following conditions:
12
+ //
13
+ // The above copyright notice and this permission notice shall be
14
+ // included in all copies or substantial portions of the Software.
15
+ //
16
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ //
24
+ // For details, see the script.aculo.us web site: http://script.aculo.us/
25
+
26
+ var Scriptaculous = {
27
+ Version: '1.8.1',
28
+ require: function(libraryName) {
29
+ // inserting via DOM fails in Safari 2.0, so brute force approach
30
+ document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
31
+ },
32
+ REQUIRED_PROTOTYPE: '1.6.0',
33
+ load: function() {
34
+ function convertVersionString(versionString){
35
+ var r = versionString.split('.');
36
+ return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
37
+ }
38
+
39
+ if((typeof Prototype=='undefined') ||
40
+ (typeof Element == 'undefined') ||
41
+ (typeof Element.Methods=='undefined') ||
42
+ (convertVersionString(Prototype.Version) <
43
+ convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
44
+ throw("script.aculo.us requires the Prototype JavaScript framework >= " +
45
+ Scriptaculous.REQUIRED_PROTOTYPE);
46
+
47
+ $A(document.getElementsByTagName("script")).findAll( function(s) {
48
+ return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
49
+ }).each( function(s) {
50
+ var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
51
+ var includes = s.src.match(/\?.*load=([a-z,]*)/);
52
+ (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
53
+ function(include) { Scriptaculous.require(path+include+'.js') });
54
+ });
55
+ }
56
+ }
57
+
58
+ Scriptaculous.load();
js/padoo/simplecheckout.js ADDED
@@ -0,0 +1,360 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Magento SimpleCheckout Extension
3
+ *
4
+ * @copyright: PadoosoftTeam (http://www.padoosoft.com)
5
+ * @version: 1.0
6
+ *
7
+ */
8
+
9
+ function startLoadingData(only_review_block){
10
+ if(only_review_block){
11
+ checkoutoverlay.createOverlay('review', $('onecheckout-review'));
12
+ }else{
13
+ if(update_shipping > 0)checkoutoverlay.createOverlay('shipping_methods', $('onecheckout_shipping_method'));
14
+ if(update_payment > 0)checkoutoverlay.createOverlay('payment_methods', $('onecheckout_payment_method'));
15
+ if(update_review > 0)checkoutoverlay.createOverlay('review', $('onecheckout-review'));
16
+ }
17
+ }
18
+
19
+ function stopLoadingData(){
20
+ checkoutoverlay.hideOverlay();
21
+ }
22
+
23
+
24
+ function shippingAddressChanged(){
25
+
26
+ if(!$('billing_use_for_shipping_yes').checked){
27
+ sendShippingAddress();
28
+ }
29
+ }
30
+
31
+ function billingAddressChanged(){
32
+ sendBillingAddress();
33
+ }
34
+
35
+ function changeShippingAddressMode(){
36
+
37
+ $flag = this.checked;
38
+
39
+ if($flag){
40
+ $('shipping-address-form').style.display = 'none';
41
+ sendBillingAddress();
42
+ }else{
43
+ $('shipping-address-form').style.display = 'block';
44
+ sendShippingAddress();
45
+ };
46
+
47
+ }
48
+
49
+ function buildQueryString(elements){
50
+
51
+ var q = '';
52
+
53
+ for(var i = 0;i < elements.length;i++){
54
+ if((elements[i].type == 'checkbox' || elements[i].type == 'radio') && !elements[i].checked){
55
+ continue;
56
+ }
57
+ q += elements[i].name + '=' + elements[i].value;
58
+
59
+ if(i+1 < elements.length){
60
+ q += '&';
61
+ }
62
+
63
+ }
64
+ return q;
65
+ }
66
+ function updateShopping(container){
67
+ startLoadingData();
68
+ var editItemUrl = checkoutUpdateUrl;
69
+ var q = prepairParams(container);
70
+ updateFormData(editItemUrl, q);
71
+ }
72
+ function deleteShopping(id){
73
+ startLoadingData();
74
+ var url=checkoutDeleteUrl+'id/'+id;
75
+ updateFormData(url, '');
76
+ }
77
+ function prepairParams(container) {
78
+ var params = {};
79
+ var fields = $(container).select('input', 'select', 'textarea');
80
+ var data = Form.serializeElements(fields, true);
81
+ data = $H(data);
82
+ var query ="";
83
+ if (data) {
84
+ data.each(function(value) {
85
+ if(query !="")
86
+ query +="&"
87
+ query +=value[0] + "=" + value[1];
88
+
89
+ });
90
+ }
91
+ return query;
92
+ }
93
+ function update_coupon(remove){
94
+ if($('coupon_code').value == ""){
95
+ alert('Please enter Coupon code !');
96
+ return;
97
+ }
98
+ startLoadingData();
99
+ if (remove){
100
+
101
+
102
+ $('remove-coupone').value = "1";
103
+ var q = buildQueryString($$('#coupon_code, #remove-coupone'));
104
+
105
+ return updateFormData(checkoutCouponUrl, q);
106
+ }
107
+ else{
108
+
109
+ $('remove-coupone').value = "0";
110
+ var q = buildQueryString($$('#coupon_code, #remove-coupone'));
111
+
112
+ return updateFormData(checkoutCouponUrl, q);
113
+ }
114
+ }
115
+
116
+ function elogin(e, p, url){
117
+
118
+ $('elogin-loading').style.display = 'block';
119
+ $('elogin-buttons').style.display = 'none';
120
+
121
+ var request = new Ajax.Request(url,
122
+ {
123
+ method:'post',
124
+ parameters:'username='+e+'&password='+p,
125
+ onSuccess: function(transport){ var response = eval('('+(transport.responseText || false)+')');
126
+
127
+ if(response.error){
128
+ $('elogin-message').innerHTML = response.message;
129
+ $('elogin-loading').style.display = 'none';
130
+ $('elogin-buttons').style.display = 'block';
131
+ }else{
132
+
133
+ location.reload();
134
+
135
+ }
136
+
137
+ },
138
+ onFailure: function(){ alert('Something went wrong...');stopLoadingData(); }
139
+ });
140
+ }
141
+
142
+ function updateFormData(url, q){
143
+
144
+ var request = new Ajax.Request(url,
145
+ {
146
+ method:'post',
147
+ parameters:q,
148
+ onSuccess: function(transport){ var response = eval('('+(transport.responseText || false)+')');
149
+
150
+ if(response.error){
151
+ if(response.review){
152
+ $('onecheckout-review-info').update(response.review);
153
+ }
154
+ stopLoadingData();
155
+ alert(response.message);
156
+ //coming soon...
157
+ }else{
158
+ if(response.shipping_rates && update_shipping > 0){
159
+ $('onecheckout-shippingmethod-available').update(response.shipping_rates);
160
+ }
161
+ if(response.payments && update_payment > 0){
162
+ $('onecheckout-paymentmethod-available').update(response.payments);
163
+ }
164
+ if(response.review && update_review >0){
165
+
166
+ var data = String(response.review)
167
+ if(data =="no_data"){
168
+ window.location = defaultCart;
169
+ return ;
170
+ }
171
+ $('onecheckout-review-info').update(response.review);
172
+ }
173
+
174
+ if(response.coupon){
175
+ $('onecheckout-coupon').update(response.coupon);
176
+ }
177
+ if(response.shippingMethods){
178
+ $('onecheckout_shipping_method').update(response.shippingMethods);
179
+ }
180
+
181
+ stopLoadingData();
182
+ }
183
+
184
+ },
185
+ onFailure: function(){ alert('Something went wrong...');stopLoadingData(); }
186
+ });
187
+
188
+ }
189
+
190
+
191
+ function sendBillingAddress(){
192
+
193
+ startLoadingData();
194
+
195
+ var q = buildQueryString($$('#onecheckout-addressbilling input, #onecheckout-addressbilling select, #onecheckout-addressbilling textarea, #billing_use_for_shipping_yes'));
196
+
197
+ if($('billing_use_for_shipping_yes') && $('billing_use_for_shipping_yes').checked){
198
+ return updateFormData(checkoutDefaultUrl, q);
199
+ }
200
+
201
+ return updateFormData(checkoutBillingUrl, q);
202
+
203
+
204
+ }
205
+
206
+ function sendShippingAddress(){
207
+
208
+ startLoadingData();
209
+
210
+ var q = buildQueryString($$('#shipping-address-form input, #shipping-address-form select, #shipping-address-form textarea'));
211
+
212
+ return updateFormData(checkoutShippingUrl, q);
213
+
214
+ }
215
+
216
+ function sendMethods(){
217
+
218
+ startLoadingData(true);
219
+
220
+ var q = '';
221
+
222
+ q += buildQueryString($$('#onecheckout-shippingmethod input, #onecheckout-shippingmethod select, #onecheckout-shippingmethod textarea'));
223
+ q += '&';
224
+ q += buildQueryString($$('#onecheckout-paymentmethod input, #onecheckout-paymentmethod select, #onecheckout-paymentmethod textarea'));
225
+
226
+ return updateFormData(checkoutTotalsUrl, q);
227
+
228
+ }
229
+
230
+ var checkoutoverlay = {
231
+ overlay:{},
232
+ hideOverlay:function(){
233
+ for(i in this.overlay){
234
+ this.overlay[i].style.display = 'none';
235
+ }
236
+ },
237
+ createOverlay:function(id, container){
238
+
239
+ if(this.overlay['sln-overlay-'+id]){
240
+
241
+ var overlay = this.overlay['sln-overlay-'+id];
242
+
243
+ }else{
244
+
245
+ var overlay = document.createElement('div');
246
+ overlay.id = 'sln-overlay-'+id;
247
+ var span = document.createElement('span');
248
+ span.className = "img-load";
249
+ overlay.appendChild(span);
250
+ container.appendChild(overlay);
251
+
252
+ this.overlay['sln-overlay-'+id] = overlay;
253
+ }
254
+
255
+ if(typeof SLN_IS_IE == 'boolean'){
256
+ container.style.position = 'relative';
257
+ }else{
258
+ SLN_IS_IE = false;
259
+ }
260
+
261
+ overlay.style.top = 0;
262
+ overlay.style.left = 0;
263
+ overlay.style.width = container.offsetWidth + (SLN_IS_IE ? 1 : 0) + 'px';
264
+ overlay.style.height = container.offsetHeight + 'px';
265
+ overlay.style.display = 'block';
266
+ overlay.style.background = '#ffffff';
267
+ overlay.style.position = 'absolute';
268
+ overlay.style.opacity = '0.7';
269
+ overlay.style.filter = 'alpha(opacity: 70)';
270
+
271
+ }
272
+ }
273
+
274
+
275
+
276
+
277
+ var paymentForm = Class.create();
278
+ paymentForm.prototype = {
279
+ beforeInitFunc:$H({}),
280
+ afterInitFunc:$H({}),
281
+ beforeValidateFunc:$H({}),
282
+ afterValidateFunc:$H({}),
283
+ initialize: function(formId){
284
+ this.form = $(this.formId = formId);
285
+ },
286
+ init : function () {
287
+ //var elements = Form.getElements(this.form);
288
+
289
+ var elements = $$('#onecheckout-paymentmethod-available input, #onecheckout-paymentmethod-available select, #onecheckout-paymentmethod-available textarea');
290
+
291
+ /*if ($(this.form)) {
292
+ $(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
293
+ }*/
294
+ var method = null;
295
+ for (var i=0; i<elements.length; i++) {
296
+ if (elements[i].name=='payment[method]') {
297
+ if (elements[i].checked) {
298
+ method = elements[i].value;
299
+ }
300
+ }
301
+ elements[i].setAttribute('autocomplete','off');
302
+ }
303
+ if (method) this.switchMethod(method);
304
+ },
305
+
306
+ switchMethod: function(method){
307
+ if (this.currentMethod && $('payment_form_'+this.currentMethod)) {
308
+
309
+ var form = $('payment_form_'+this.currentMethod);
310
+ form.style.display = 'none';
311
+ var elements = form.getElementsByTagName('input');
312
+ for (var i=0; i<elements.length; i++) elements[i].disabled = true;
313
+ var elements = form.getElementsByTagName('select');
314
+ for (var i=0; i<elements.length; i++) elements[i].disabled = true;
315
+
316
+
317
+ }
318
+ if ($('payment_form_'+method)){
319
+ var form = $('payment_form_'+method);
320
+ form.style.display = '';
321
+ var elements = form.getElementsByTagName('input');
322
+ for (var i=0; i<elements.length; i++) elements[i].disabled = false;
323
+ var elements = form.getElementsByTagName('select');
324
+ for (var i=0; i<elements.length; i++) elements[i].disabled = false;
325
+ this.currentMethod = method;
326
+ }
327
+ }
328
+ }
329
+ var billing = Class.create();
330
+ billing = billing.prototype = {
331
+ newAddress: function(isNew){
332
+ if (isNew) {
333
+
334
+ $('billing-new-address-form').select('input[type=text], select, textarea').each(function(e){if(!e.getAttribute('disabled') && !e.getAttribute('readonly')){e.value = ''};});
335
+
336
+ Element.show('billing-new-address-form');
337
+ } else {
338
+ Element.hide('billing-new-address-form');
339
+ }
340
+
341
+ billingAddressChanged();
342
+ }
343
+ }
344
+ var shipping = Class.create();
345
+ shipping = billing.prototype = {
346
+ newAddress: function(isNew){
347
+ if (isNew) {
348
+
349
+ $('shipping-new-address-form').select('input[type=text], select, textarea').each(function(e){if(!e.getAttribute('disabled') && !e.getAttribute('readonly')){e.value = ''};});
350
+
351
+ Element.show('shipping-new-address-form');
352
+ } else {
353
+ Element.hide('shipping-new-address-form');
354
+ }
355
+
356
+ shippingAddressChanged();
357
+
358
+ //shipping.setSameAsBilling(false);
359
+ }
360
+ }
js/padoo/storelocator.js ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ var Storelocator = Class.create();
3
+ Storelocator.prototype = {
4
+ initialize: function(latitude, longtitude, zoom_value){
5
+
6
+ // latitude = parseFloat($('latitude').getValue());
7
+ // longtitude = parseFloat($('longtitude').getValue());
8
+ this.stockholm = new google.maps.LatLng(latitude, longtitude);
9
+ this.zoom_value = zoom_value;
10
+ this.marker = null;
11
+ this.map = null;
12
+ //var zoom_value = parseInt($('zoom_level').getValue());
13
+ google.maps.event.addDomListener(window, 'load', this.initGoogleMap.bind(this));
14
+
15
+
16
+ },
17
+ initGoogleMap: function(){
18
+ var mapOptions = {
19
+ zoom: this.zoom_value,
20
+ mapTypeId: google.maps.MapTypeId.ROADMAP,
21
+ center: this.stockholm
22
+ };
23
+
24
+ this.map = new google.maps.Map($('googleMap'),
25
+ mapOptions);
26
+
27
+ this.marker = new google.maps.Marker({
28
+ map:this.map,
29
+ draggable:true,
30
+ position: this.stockholm
31
+ });
32
+ google.maps.event.addListener(this.marker, 'dragend', function(event) {
33
+ $('store_latitude_value').value = event.latLng.lat();
34
+ $('store_longtitude_value').value = event.latLng.lng();
35
+ $('latitude').value = event.latLng.lat();
36
+ $('longtitude').value = event.latLng.lng();
37
+ $('latitude').setStyle({
38
+ background: 'rgb(250, 230, 180)'
39
+ });
40
+ $('longtitude').setStyle({
41
+ background: 'rgb(250, 230, 180)'
42
+ });
43
+ }.bind(this));
44
+ google.maps.event.addListener(this.map, 'zoom_changed', function() {
45
+ var zoomLevel = this.map.getZoom();
46
+ $('zoom_level_value').value = zoomLevel;
47
+ $('zoom_level').value = zoomLevel;
48
+ $('zoom_level').setStyle({
49
+ background: 'rgb(250, 230, 180)'
50
+ });
51
+ }.bind(this));
52
+ },
53
+ reSizeMap: function (){
54
+ // map = this.map;
55
+
56
+ },
57
+ reLoadMap: function (){
58
+ // var service = new google.maps.places.PlacesService(map);
59
+ // service.textSearch(request, this.processSearchResults.bind(this));
60
+ }
61
+ }
62
+
63
+ var StorelocatorFrontEnd = Class.create();
64
+ StorelocatorFrontEnd.prototype = {
65
+ initialize: function(latitude, longtitude, zoom_value, idMap){
66
+ this.myLatlng = new google.maps.LatLng(latitude, longtitude);
67
+ this.markerArray = [];
68
+ this.markearryIdStore =[];
69
+ this.myOptions = {
70
+ zoom: zoom_value,
71
+ center: this.myLatlng,
72
+ mapTypeId: google.maps.MapTypeId.ROADMAP
73
+ };
74
+ this.map = new google.maps.Map(document.getElementById(idMap), this.myOptions);
75
+ this.bounds = new google.maps.LatLngBounds();
76
+ this.rendererOptions = {
77
+ map:this.map
78
+ };
79
+ this.directionsDisplay = new google.maps.DirectionsRenderer(this.rendererOptions);
80
+ this.directionsService = new google.maps.DirectionsService();
81
+ },
82
+
83
+ extendPoint: function(marker){
84
+ this.bounds.extend(marker);
85
+ },
86
+
87
+ placeMarker: function(point, store_info, storeId, image,zoomLevel, infoWindow, x, storeObject){
88
+ var marker;
89
+ if(image){
90
+ marker = new google.maps.Marker({
91
+ position: point,
92
+ map: this.map,
93
+ icon: image,
94
+ store_id :storeId
95
+ });
96
+ }
97
+ else {
98
+ marker = new google.maps.Marker({
99
+ position: point,
100
+ map: this.map,
101
+ store_id :storeId
102
+ });
103
+ }
104
+ storeObject.marker = marker;
105
+ this.markerArray.push(marker);
106
+ google.maps.event.addListener(marker, 'click', function(event) {
107
+ infoWindow.setContent(store_info);
108
+ infoWindow.setPosition(event.latLng);
109
+ infoWindow.open(this.map, marker);
110
+ if(zoomLevel!=0){
111
+ this.map.setZoom(zoomLevel);
112
+ }
113
+ this.setActiveForm(storeId, x);
114
+ }.bind(this));
115
+
116
+ //this.getPoupForm(store_info, point, marker, zoomLevel, storeId, infoWindow)
117
+ },
118
+ getPoupForm: function(store_info, point, zoomLevel, storeId, infoWindow){
119
+ $('id' + storeId).observe('click', function(event) {
120
+ infoWindow.setContent(store_info);
121
+ infoWindow.setPosition(point);
122
+ //marker_point = new google.maps.LatLng(setLat, setLon);
123
+ this.map.setCenter(point);
124
+ infoWindow.open(this.map);
125
+ if(zoomLevel!=0){
126
+ this.map.setZoom(zoomLevel);
127
+ }
128
+ }.bind(this));
129
+ },
130
+ setBoundFill: function (){
131
+ this.map.fitBounds(this.bounds);
132
+ this.map.setCenter(this.bounds.getCenter());
133
+ },
134
+
135
+ setActiveForm: function(id, x){
136
+ $$('.active').invoke('removeClassName', 'active');
137
+ $('id' + id).addClassName('active');
138
+ if(x){
139
+ for (i=0; i<=this.markearryIdStore.length-1; i++){
140
+ try{
141
+ if(this.markearryIdStore[i] == id){
142
+ $('padoo-storelocator-getdirection-'+id).show();
143
+ }else{
144
+ $('padoo-storelocator-getdirection-'+this.markearryIdStore[i]).hide();
145
+ }
146
+ }catch(err){
147
+
148
+ }
149
+ }
150
+ this.directionsDisplay.setPanel(document.getElementById('padoo-storelocator-directionsPanel-'+id));
151
+ this.calcRoute(id);
152
+ }
153
+ },
154
+
155
+ createMarker: function(marker_point){
156
+ //marker_point = new google.maps.LatLng(latitude, longitude);
157
+ image_icon = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|0099FF");
158
+ //shadow = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_shadow");
159
+ marker = new google.maps.Marker({
160
+ position: marker_point,
161
+ map: this.map,
162
+ icon: image_icon
163
+ // shadow: shadow
164
+ });
165
+ this.markerArray.push(marker);
166
+ this.extendPoint(marker_point);
167
+ },
168
+
169
+ createRadius: function (radius){
170
+ var myCircle = new google.maps.Circle({
171
+ center: this.markerArray[this.markerArray.length - 1].getPosition(),
172
+ map: this.map,
173
+ radius: radius,
174
+ strokeColor: "#FF0000",
175
+ strokeOpacity: 0.8,
176
+ strokeWeight: 2,
177
+ fillColor: "#B9D3EE",
178
+ fillOpacity: 0.35
179
+ });
180
+ var myBounds = myCircle.getBounds();
181
+
182
+ //filters markers
183
+ for(var i=this.markerArray.length;i--;){
184
+ if(!myBounds.contains(this.markerArray[i].getPosition()))
185
+ {
186
+ this.markerArray[i].setMap(null);
187
+ $("id"+this.markerArray[i].store_id).hide();
188
+ }
189
+ }
190
+ this.map.setCenter(this.markerArray[this.markerArray.length - 1].getPosition());
191
+ this.map.setZoom(this.map.getZoom()+1);
192
+ },
193
+
194
+ calcRoute: function (idstore){
195
+ destination_lat = $('storelocator-lat-'+idstore).value;
196
+ destination_lng = $('storelocator-lng-'+idstore).value;
197
+ finalMarker = this.markerArray.length - 1;
198
+ // for(var i=0; i< finalMarker; i++){
199
+ var request = {
200
+ origin: this.markerArray[finalMarker].getPosition(),
201
+ destination: new google.maps.LatLng(destination_lat, destination_lng),
202
+ waypoints:[],
203
+ travelMode: google.maps.DirectionsTravelMode.DRIVING
204
+ };
205
+ this.directionsService.route(request, function(response, status) {
206
+ if (status === google.maps.DirectionsStatus.OK) {
207
+ this.directionsDisplay.setDirections(response);
208
+ }
209
+ }.bind(this));
210
+ // }
211
+ },
212
+ computeTotalDistance: function (result) {
213
+ var total = 0;
214
+ var myroute = result.routes[0];
215
+ for (var i = 0; i < myroute.legs.length; i++) {
216
+ total += myroute.legs[i].distance.value;
217
+ }
218
+ }
219
+ }
220
+
221
+ var StorelocatorObject = Class.create();
222
+ StorelocatorObject.prototype = {
223
+ initialize: function(html, distance, storeId, marker){
224
+ this.html = html;
225
+ this.distance = distance;
226
+ this.storeId = storeId;
227
+ this.marker = marker;
228
+ }
229
+ }
230
+
231
+ var InfoPopup = Class.create();
232
+ InfoPopup.prototype = {
233
+ initialize: function(storeId,html, zoom, point){
234
+ this.storeId = storeId;
235
+ this.html = html;
236
+ this.point = point;
237
+ this.zoom = zoom;
238
+ }
239
+ }
js/padoo/tinybox.js ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var TINY={};
2
+
3
+ function T$(i){return document.getElementById(i)}
4
+
5
+ TINY.box=function(){
6
+ var p,m,b,fn,ic,iu,iw,ih,ia,f=0;
7
+ return{
8
+ show:function(c,u,w,h,a,t){
9
+ if(!f){
10
+ p=document.createElement('div'); p.id='tinybox';
11
+ m=document.createElement('div'); m.id='tinymask';
12
+ b=document.createElement('div'); b.id='tinycontent';
13
+ document.body.appendChild(m); document.body.appendChild(p); p.appendChild(b);
14
+ m.onclick=TINY.box.hide; window.onresize=TINY.box.resize; f=1
15
+ }
16
+ if(!a&&!u){
17
+ p.style.width=w?w+'px':'auto'; p.style.height=h?h+'px':'auto';
18
+ p.style.backgroundImage='none'; b.innerHTML=c
19
+ }else{
20
+ b.style.display='none'; p.style.width=p.style.height='100px'
21
+ }
22
+ this.mask();
23
+ ic=c; iu=u; iw=w; ih=h; ia=a; this.alpha(m,1,80,3);
24
+ if(t){setTimeout(function(){TINY.box.hide()},1000*t)}
25
+ },
26
+ fill:function(c,u,w,h,a){
27
+ if(u){
28
+ p.style.backgroundImage='';
29
+ var x=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
30
+ x.onreadystatechange=function(){
31
+ if(x.readyState==4&&x.status==200){TINY.box.psh(x.responseText,w,h,a)}
32
+ };
33
+ x.open('GET',c,1); x.send(null)
34
+ }else{
35
+ this.psh(c,w,h,a)
36
+ }
37
+ },
38
+ psh:function(c,w,h,a){
39
+ if(a){
40
+ if(!w||!h){
41
+ var x=p.style.width, y=p.style.height; b.innerHTML=c;
42
+ p.style.width=w?w+'px':''; p.style.height=h?h+'px':'';
43
+ b.style.display='';
44
+ w=parseInt(b.offsetWidth); h=parseInt(b.offsetHeight);
45
+ b.style.display='none'; p.style.width=x; p.style.height=y;
46
+ }else{
47
+ b.innerHTML=c
48
+ }
49
+ this.size(p,w,h)
50
+ }else{
51
+ p.style.backgroundImage='none'
52
+ }
53
+ },
54
+ hide:function(){
55
+ TINY.box.alpha(p,-1,0,3)
56
+ },
57
+ resize:function(){
58
+ TINY.box.pos(); TINY.box.mask()
59
+ },
60
+ mask:function(){
61
+ m.style.height=TINY.page.total(1)+'px';
62
+ m.style.width=''; m.style.width=TINY.page.total(0)+'px'
63
+ },
64
+ pos:function(){
65
+ var t=(TINY.page.height()/2)-(p.offsetHeight/2); t=t<10?10:t;
66
+ //p.style.top=(t+TINY.page.top())+'px';
67
+ p.style.top=TINY.page.top()+'px';
68
+ p.style.left=(TINY.page.width()/2)-(p.offsetWidth/2)+'px'
69
+ },
70
+ alpha:function(e,d,a){
71
+ clearInterval(e.ai);
72
+ if(d==1){
73
+ e.style.opacity=0; e.style.filter='alpha(opacity=0)';
74
+ e.style.display='block'; this.pos()
75
+ }
76
+ e.ai=setInterval(function(){TINY.box.ta(e,a,d)},20)
77
+ },
78
+ ta:function(e,a,d){
79
+ var o=Math.round(e.style.opacity*100);
80
+ if(o==a){
81
+ clearInterval(e.ai);
82
+ if(d==-1){
83
+ e.style.display='none';
84
+ e==p?TINY.box.alpha(m,-1,0,2):b.innerHTML=p.style.backgroundImage=''
85
+ }else{
86
+ e==m?this.alpha(p,1,100):TINY.box.fill(ic,iu,iw,ih,ia)
87
+ }
88
+ }else{
89
+ var n=Math.ceil((o+((a-o)*.5))); n=n==1?0:n;
90
+ e.style.opacity=n/100; e.style.filter='alpha(opacity='+n+')'
91
+ }
92
+ },
93
+ size:function(e,w,h){
94
+ e=typeof e=='object'?e:T$(e); clearInterval(e.si);
95
+ var ow=e.offsetWidth, oh=e.offsetHeight,
96
+ wo=ow-parseInt(e.style.width), ho=oh-parseInt(e.style.height);
97
+ var wd=ow-wo>w?0:1, hd=(oh-ho>h)?0:1;
98
+ e.si=setInterval(function(){TINY.box.ts(e,w,wo,wd,h,ho,hd)},20)
99
+ },
100
+ ts:function(e,w,wo,wd,h,ho,hd){
101
+ var ow=e.offsetWidth-wo, oh=e.offsetHeight-ho;
102
+ if(ow==w&&oh==h){
103
+ clearInterval(e.si); p.style.backgroundImage='none'; b.style.display='block'
104
+ }else{
105
+ if(ow!=w){var n=ow+((w-ow)*.5); e.style.width=wd?Math.ceil(n)+'px':Math.floor(n)+'px'}
106
+ if(oh!=h){var n=oh+((h-oh)*.5); e.style.height=hd?Math.ceil(n)+'px':Math.floor(n)+'px'}
107
+ this.pos()
108
+ }
109
+ }
110
+ }
111
+ }();
112
+
113
+ TINY.page=function(){
114
+ return{
115
+ top:function(){return document.documentElement.scrollTop||document.body.scrollTop},
116
+ width:function(){return self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth},
117
+ height:function(){return self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight},
118
+ total:function(d){
119
+ var b=document.body, e=document.documentElement;
120
+ return d?Math.max(Math.max(b.scrollHeight,e.scrollHeight),Math.max(b.clientHeight,e.clientHeight)):
121
+ Math.max(Math.max(b.scrollWidth,e.scrollWidth),Math.max(b.clientWidth,e.clientWidth))
122
+ }
123
+ }
124
+ }();
package.xml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>padoo_gallery</name>
4
+ <version>1.0.2</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License (GPL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Display images, pictures in the form of Photo Gallery &amp; Product Gallery with lighbox.</summary>
10
+ <description>&lt;div&gt;&#xD;
11
+ &lt;p&gt;Photo Gallery extension allows the store owner to add image galleries to their Magento store which can be viewed by users in the front-end with lightbox effect. The Photo Gallery extension is fully manageable from the Magento back-end and allows shop owners to easily add/remove/edit galleries and images.&lt;/p&gt;&#xD;
12
+ &lt;p&gt;Special the extension allow your client to write review for each image. It is one good option to you SEO your site.&lt;/p&gt;&#xD;
13
+ &lt;/div&gt;&#xD;
14
+ &lt;div&gt;&#xD;
15
+ &lt;h3&gt;Features and benefits&lt;/h3&gt;&#xD;
16
+ &lt;ul&gt;&#xD;
17
+ &lt;li&gt;100% opensource&lt;/li&gt;&#xD;
18
+ &lt;li&gt;Very easy to install and use&lt;/li&gt;&#xD;
19
+ &lt;li&gt;Doesn&#x2019;t override core Magento ( core class or core template)&lt;/li&gt;&#xD;
20
+ &lt;li&gt;Support responsive for difference devices&lt;/li&gt;&#xD;
21
+ &lt;li&gt;Works perfectly with popular browsers including Firefox, Chrome, IE and Safari&lt;/li&gt;&#xD;
22
+ &lt;li&gt;Friendly and easy to configurable&lt;/li&gt;&#xD;
23
+ &lt;li&gt;Compatibility: Magento CE 1.4, 1.5, 1.6, 1.7, 1.8, 1.9&lt;/li&gt;&#xD;
24
+ &lt;/ul&gt;&#xD;
25
+ &lt;/div&gt;&#xD;
26
+ &lt;div&gt;&#xD;
27
+ &lt;h3&gt;How to use the our Gallery extension&lt;/h3&gt;&#xD;
28
+ &lt;ol&gt;&#xD;
29
+ &lt;li&gt;Install via Magentoconnect or get it from our site Mage-addons.com&lt;/li&gt;&#xD;
30
+ &lt;li&gt;Configuration FAQ options are available in administration panel: System --&amp;gt; Configuration --&amp;gt; Padoosoft extension --&amp;gt; Gallery&lt;img alt="" src="http://www.mage-addons.com/media/wysiwyg/gallery/settings.png" /&gt;&lt;/li&gt;&#xD;
31
+ &lt;li&gt;On the backend, go to Gallery =&amp;gt; Manage albums&lt;img alt="" src="http://www.mage-addons.com/media/wysiwyg/gallery/manage-album.png" /&gt;&#xD;
32
+ To create a new group, click on the Add Album button:&#xD;
33
+ You can input the name, photo, description, status, store view, etc&#x2026; and save it.&#xD;
34
+ &lt;img alt="" src="http://www.mage-addons.com/media/wysiwyg/gallery/add-album.png" /&gt;&#xD;
35
+ &lt;/li&gt;&#xD;
36
+ &lt;li&gt;On the backend, go to Gallery =&amp;gt; Manage Photos&lt;img alt="" src="http://www.mage-addons.com/media/wysiwyg/gallery/manage-photo.png" /&gt;&#xD;
37
+ To create a new item, click on the Add Photo button: &#xD;
38
+ You can input the order, title, image, description and select the album, the displaying store view, then enable the Album items.&#xD;
39
+ &lt;img alt="" src="http://www.mage-addons.com/media/wysiwyg/gallery/add-photo.png" /&gt;&#xD;
40
+ &lt;/li&gt;&#xD;
41
+ &lt;li&gt;By default, you can find the link to Gallery page from the homepage or any page of the system.&#xD;
42
+ &#xD;
43
+ When clicking on an album, the album page will show all the photos as below:&#xD;
44
+ &lt;img alt="" src="http://www.mage-addons.com/media/wysiwyg/gallery/photos-list.png" /&gt;&#xD;
45
+ When clicking on a photo, a light box will show as below:&#xD;
46
+ &lt;img alt="" src="http://www.mage-addons.com/media/wysiwyg/gallery/lightbox.png" /&gt;&#xD;
47
+ &lt;/li&gt;&#xD;
48
+ &lt;li&gt;&#xD;
49
+ &lt;img alt="" src="http://www.mage-addons.com/media/wysiwyg/gallery/detail-photo.png" /&gt;&#xD;
50
+ Customers can submit their own question at the frontend. After finishing, their review will be listed at Manage Review page from the backend to wait for the store owner&#x2019;s check.&#xD;
51
+ &lt;img alt="" src="http://www.mage-addons.com/media/wysiwyg/gallery/review-photo.png" /&gt;&#xD;
52
+ &lt;/li&gt;&#xD;
53
+ &lt;/ol&gt;&#xD;
54
+ &lt;/div&gt;&#xD;
55
+ &lt;div&gt;&#xD;
56
+ &lt;h3&gt;How to disable the extension&lt;/h3&gt;&#xD;
57
+ &lt;p&gt;Set &amp;quot;No&amp;quot; on System &amp;gt; Configuration&amp;gt; Gallery &amp;gt; General&lt;/p&gt;&#xD;
58
+ &lt;p&gt;Open the file &#x201C;app/etc/modules/ Padoo_Gallery.xml&#x201D; and change the following line: Form &amp;quot;True&amp;quot; To &amp;quot; False&amp;quot;&#xD;
59
+ &lt;/p&gt;&#xD;
60
+ &lt;/div&gt;</description>
61
+ <notes>Display images, pictures in the form of Photo Gallery &amp; Product Gallery with lighbox.</notes>
62
+ <authors><author><name>Padoosoft</name><user>Padoo</user><email>stdspace@gmail.com</email></author></authors>
63
+ <date>2016-09-06</date>
64
+ <time>08:26:36</time>
65
+ <contents><target name="magelocal"><dir name="Padoo"><dir name="Gallery"><dir name="Block"><dir name="Admin"><dir name="Album"><dir name="Edit"><file name="Form.php" hash="242f58b333c55b26e025818c6208e2ff"/><dir name="Tab"><file name="Form.php" hash="80f2567185403d6f20c941c687c2cb21"/></dir><file name="Tabs.php" hash="21903413751c87a5f6e95334bcde3d79"/></dir><file name="Edit.php" hash="f0eec3c508e00055ff72f4ca81c4469a"/><file name="Grid.php" hash="b06bce951c847916cfddffd295679765"/></dir><file name="Album.php" hash="f99bd84c162fcfb6269ff1c9be220c6c"/><dir name="Gallery"><dir name="Edit"><file name="Form.php" hash="98ac8c12bec32d26ea8a1f1881ff4b2b"/><dir name="Tab"><file name="Form.php" hash="a619cc945989129282833bc908a7cab9"/></dir><file name="Tabs.php" hash="772a541e1d03829fa35a04f893c47156"/></dir><file name="Edit.php" hash="2114a7bb17b4ea26c09a85e4c87b108b"/><file name="Grid.php" hash="6c40878c237375a74e66cb788d74c837"/></dir><file name="Gallery.php" hash="d3b51eee2dd8d2908ec95167e786a850"/><dir name="Review"><dir name="Edit"><file name="Form.php" hash="10a596ba28c565669727a4c19762e580"/><dir name="Tab"><file name="Form.php" hash="98eb371fcd899043cf2df5d17f5c78c3"/></dir><file name="Tabs.php" hash="bc43887ae3157644e12dcf914d29849c"/></dir><file name="Edit.php" hash="87200104ee0331b345b37dd06a5c486a"/><file name="Grid.php" hash="7c40246b959d35173af41741b69e1072"/></dir><file name="Review.php" hash="cb66c84a34c3e75b9b2c7195fac10890"/></dir><file name="Ajax.php" hash="9ab378ca6223116eda3143292f33c239"/><file name="Album.php" hash="8f0aaa03b4d67c65474bf8816ac11ed5"/><file name="Detail.php" hash="7c60f54d13318b2415c7ce1768075451"/><file name="Gallery.php" hash="31d2492bb57f3754dcbf411df52fc530"/><dir name="Page"><file name="Pager.php" hash="48ff0dd0e64797428db574ba476ffa31"/></dir><file name="Review.php" hash="cfc5e6ca398eeafc2cee64b8dbdd2ed3"/><file name="Search.php" hash="b37790ac88f2149507de7fa4471d36c0"/></dir><dir name="Helper"><file name="Data.php" hash="03d58c5ec380ca26ed50ca34208b4ea7"/><file name="Image.php" hash="1e730e441611141381a9b7770426a1b4"/></dir><dir name="Model"><file name="Album.php" hash="0f5c41d5b222d8bb1b50d565a953430a"/><file name="Gallery.php" hash="6b3e9e913b0db55f1a2ed369389a0e78"/><file name="Image.php" hash="e7b86d3362725b3b3d41b2ef0c6ce9b3"/><dir name="Mysql4"><dir name="Album"><file name="Collection.php" hash="0b4b2851f9a1abc4547626534754ff2f"/></dir><file name="Album.php" hash="374ebdc096dc2ae3f67351279f568bf1"/><dir name="Gallery"><file name="Collection.php" hash="4ebaaf2037ede41b5f4c6eca185335ef"/></dir><file name="Gallery.php" hash="cdebf78744959e8a2a3f74732f562d0a"/><dir name="Review"><file name="Collection.php" hash="b143d3b76a79035f0027dd95d18d44b3"/></dir><file name="Review.php" hash="1302e3b0c265dea12613ac03f85abe07"/></dir><file name="Review.php" hash="045e33bf63c4f2929e66e391ca1df18a"/><file name="Status.php" hash="9a07d11ffb72d36ac29d34ee90d1a6a1"/><file name="_Project.php" hash="6441bb41d4fedbf53514bc96627d1bb2"/></dir><dir name="controllers"><dir name="Admin"><file name="AlbumController.php" hash="777bbc35839ec524ca0d2dce945b8463"/><file name="GalleryController.php" hash="13a25348a48e28180fdbdfaf6e7d8023"/><file name="ReviewController.php" hash="7a89db0ccb08e2efa9dfa7948a15e900"/></dir><file name="IndexController.php" hash="d1c3eced2e4b8b3a8a1eff1fc16d119e"/><file name="ViewController.php" hash="3edc430058edb9371d78755f9a63e1b5"/></dir><dir name="etc"><file name="adminhtml.xml" hash="d6684ae11816a7f6ff2308affd5c49b0"/><file name="config.xml" hash="3afc727644a4ccf311653d27130b4c1a"/><file name="system.xml" hash="8c0ce7a5deb095daf429d00e232c13a0"/></dir><dir name="sql"><dir name="gallery_setup"><file name="mysql4-install-0.1.0.php" hash="3a653f850e9e3d2d8fa3efc455dc7403"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="3e39456b709f0d2a4720f34770eba92a"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="982feb5ce58a2771644a29f001bbb0f7"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="03e792741fd2ac605fc7e5bfb3f8ddc9"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="e41d8895430c458355622644775c7c99"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Padoo_Gallery.xml" hash="86c2fc15863585e3345a4b455aa9c9fb"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="padoo_gallery.xml" hash="85d4f554113c8eaee494604e27170b9b"/></dir><dir name="template"><dir name="gallery"><file name="album.phtml" hash="71742fe5637d421e027a1ed84783ecac"/><file name="details.phtml" hash="20446bee614e4871003986f1dc0b81fa"/><file name="gallery.phtml" hash="1b86a889683b6c344dae6b17c9236e61"/><file name="newalbums.phtml" hash="6fa70ae03887d99cf377e10d9ec3c694"/><dir name="photo"><file name="pager.phtml" hash="6368a36bfc8b2ec3d978731d8e52517d"/></dir><file name="photoalbum.phtml" hash="f4b938ad20f5d6ad22170b6c83ea0755"/><file name="result.phtml" hash="65faf74d6293e96a0a4fa1e2a54188c7"/><file name="search-form.phtml" hash="93f3541e05184fdd694284e7600a9a46"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="padoo_gallery.xml" hash="dc187450f9b1049f19065dfc05a59f4a"/></dir><dir name="template"><dir name="gallery"><file name="grid.phtml" hash="61d2b84700c8ddfbe48423eeafaea428"/><file name="grid1.phtml" hash="17bb68dddd9983701bd447148fe8fe92"/><file name="grid2.phtml" hash="17bb68dddd9983701bd447148fe8fe92"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Padoo_Gallery.csv" hash="6abc85cbd80bdf1e355fa6f596987e64"/></dir></target><target name="mage"><dir name="js"><dir name="padoo"><file name="checkValue.js" hash="963c1c86bbd0462be3c4793399a86024"/><file name="jquery.js" hash="b08031186fb28716dcbb38bcbd3ace0d"/><file name="jquery_noconflict.js" hash="afdd9b4ecb226d898fe655136f849752"/><file name="scriptaculous.js" hash="b592273cfa1d97643325ad77f7030879"/><file name="simplecheckout.js" hash="7158c0b30c4fbf2cbfc9b87c3f065043"/><file name="storelocator.js" hash="4cd94ab10a4cd421fff843a3854f71c4"/><file name="tinybox.js" hash="7e8a0b5f8e639947f494c9668caa169c"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="gallery"><dir name="css"><file name="gallery.css" hash="ce9d441e2b1554ea27c7a936cfc881be"/><file name="jquery.rating.css" hash="94a70c9dcf1693e319c656d8cc0a5d7b"/><file name="lightbox.css" hash="11c5e9d4314e23dae6db539fca93c018"/></dir><dir name="images"><file name="bullet.gif" hash="1f7dd21de89bed2cf605ed7bd1276a63"/><file name="close.gif" hash="540f65d2b2f94032d6c3037622843a50"/><file name="closelabel.gif" hash="0e5462b0b4f00432eac4b33d5fa31c5a"/><file name="donate-button.gif" hash="fa03647656edb3a3cf87c5ca6f03eed7"/><file name="download-icon.gif" hash="6b66870c450a8d856f0a5a7e6087611d"/><file name="image-1.jpg" hash="2059be04139e24558449e53920e89924"/><file name="loading.gif" hash="7e99e1159a3686f6aa4f90043c554483"/><file name="nextlabel.gif" hash="110afaaaf901f67fee2357c5df88a1aa"/><file name="prevlabel.gif" hash="fb5fff30d471cc603589578015d36864"/><file name="star.gif" hash="3b7a845229f4041f5d8a18399f4c7357"/><file name="thumb-1.jpg" hash="9b1b923cd76561359f8886033a4f5848"/></dir><dir name="js"><file name="jquery.colorbox.js" hash="bedeb1e36e8e7a90732adccc8a4d10c9"/><file name="jquery.galleriffic.js" hash="e97b018587f4d35dc32aab823ccbf435"/><file name="jquery.rating.js" hash="d2390533b5ab98d05b13b81afdc9ae96"/><file name="lightbox.js" hash="278dfa36ab7dcf78da9f8c44cf291885"/></dir></dir></dir></dir></dir></target></contents>
66
+ <compatible/>
67
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
68
+ </package>
skin/frontend/base/default/gallery/css/gallery.css ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* For gallery */
2
+ .gallery-head{}
3
+ .gallery-form-search input{height: 17px; width: 250px;}
4
+ .gallery-head .title{font-size: 20px;}
5
+ .gallery-head .date{font-style: italic;}
6
+ .gallery-head .des{}
7
+ .gallery-container {
8
+ border-top: 1px solid #ccc;
9
+ margin-top: 20px;
10
+ }
11
+ .gallery-container p{margin:0}
12
+ .gallery-container ul{
13
+ padding:0 0 0 16px;
14
+ margin:0px;
15
+ }
16
+ .gallery-container ul li{
17
+ list-style-type:none;
18
+ text-align:center;
19
+ line-height:36px;
20
+ float: left;
21
+ padding: 10px 10px;
22
+ }
23
+ .gallery-container ul li a{
24
+ text-decoration:underline;
25
+ font-weight:bold;
26
+ display: block;
27
+ }
28
+ .gallery-container ul li .total-rate a{
29
+ float:left;
30
+ }
31
+ .gallery-container ul li .total-rate ul{
32
+ float:right;
33
+ margin:10px 0px 0px 0px;
34
+ }
35
+ .gallery-container ul li a:hover{
36
+ color:#000000;
37
+ text-decoration:underline;
38
+ font-weight:bold;
39
+ }
40
+ .gallery-container img {
41
+ border:1px solid #CCCCCC;
42
+ height:130px;
43
+ padding:5px;
44
+ width:175px;
45
+ }
46
+ .album ul li {
47
+ float: left;
48
+ }
49
+
50
+ .new-albums ul li {
51
+ float: left;
52
+ padding: 5px;
53
+ }
54
+
55
+ .new-albums .view-all {
56
+ clear: both;
57
+ padding-right:5px;
58
+ text-align:right;
59
+ }
60
+
61
+ .new-albums img {
62
+ border:1px solid #CCCCCC;
63
+ }
64
+ .toolbar-pager{
65
+ background-color:#f2f2f2;
66
+ margin:20px 0 10px;
67
+ border:1px solid #DDDDDD;
68
+ text-align:center;width:100%;position:relative;
69
+ }
70
+ .toolbar-pager .td-page{float:left;padding:4px 10px;}
71
+ .toolbar-pager .a-right{float:right;padding:padding:4px 10px;}
72
+ .toolbar-pager .pages{}
73
+ .toolbar-pager .pages ol {display:inline;}
74
+ .toolbar-pager .pages li {
75
+ display:inline;
76
+ margin:0 2px;
77
+ }
78
+ .toolbar-pager img{vertical-align:middle;}
79
+ .toolbar-pager caption,.toolbar-pager th,.toolbar-pager td {
80
+ font-weight:normal;
81
+ text-align:center;
82
+ vertical-align:middle;
83
+ }
84
+ .gallery-details {text-align: center;}
85
+ .gallery-details p{margin:15px 0;text-align: left;}
86
+ .gallery-details span.date{font-style: italic;display:block}
87
+ .gallery-details img{max-width:100%;}
88
+
89
+ /* rate */
90
+ .review-list ul.star{
91
+ background: rgba(0, 0, 0, 0) url("../images/star.gif") repeat-x scroll 0 0;
92
+ cursor: pointer;
93
+ float: left;
94
+ height: 16px;
95
+ left: 0;
96
+ list-style: outside none none;
97
+ margin: 0 10px 0 0;
98
+ padding: 0;
99
+ position: relative;
100
+ width: 80px;
101
+ }
102
+ .review-list ul.star li{
103
+ display: block;
104
+ float: left;
105
+ height: 16px;
106
+ margin: 0;
107
+ padding: 0;
108
+ position: absolute;
109
+ text-decoration: none;
110
+ text-indent: -9000px;
111
+ z-index: 20;
112
+ background: rgba(0, 0, 0, 0) url("../images/star.gif") repeat scroll left 16px;
113
+ }
114
+ .review-list ,.review-form {float: left;margin:0 0 20px;width: 100%;}
115
+ .review-list h3,.review-form h3{border-bottom: 1px solid #ccc;margin: 0 0 15px;}
116
+ .review-list .total-rate {margin:0 0 15px;}
117
+ .review-list .comment > div{margin:0 0 10px; float: left;width: 100%;}
118
+ .review-list .comment .content{margin:5px 0 0;}
skin/frontend/base/default/gallery/css/jquery.rating.css ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* jQuery.Rating Plugin CSS - http://www.fyneworks.com/jquery/star-rating/ */
2
+ div.rating-cancel,div.star-rating{float:left;width:17px;height:15px;text-indent:-999em;cursor:pointer;display:block;background:transparent;overflow:hidden}
3
+ div.rating-cancel,div.rating-cancel a{background:url(delete.gif) no-repeat 0 -16px}
4
+ div.star-rating,div.star-rating a{background:url(../images/star.gif) no-repeat 0 0px}
5
+ div.rating-cancel a,div.star-rating a{display:block;width:16px;height:100%;background-position:0 0px;border:0}
6
+ div.star-rating-on a{background-position:0 -32px!important}
7
+ div.star-rating-hover a{background-position:0 -32px}
8
+ /* Read Only CSS */
9
+ div.star-rating-readonly a{cursor:default !important}
10
+ /* Partial Star CSS */
11
+ div.star-rating{background:transparent!important;overflow:hidden!important}
12
+ /* END jQuery.Rating Plugin CSS */
skin/frontend/base/default/gallery/css/lightbox.css ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #lightbox{
2
+ position: absolute;
3
+ left: 0;
4
+ width: 100%;
5
+ z-index: 999;
6
+ text-align: center;
7
+ line-height: 0;
8
+ }
9
+ #lightbox img{ width: auto; height: auto;}
10
+ #lightbox a img{ border: none; }
11
+
12
+ #outerImageContainer{
13
+ position: relative;
14
+ background-color: #fff;
15
+ width: 250px;
16
+ height: 250px;
17
+ margin: 0 auto;
18
+ }
19
+
20
+ #imageContainer{
21
+ padding: 10px;
22
+ }
23
+
24
+ #loading{
25
+ position: absolute;
26
+ top: 40%;
27
+ left: 0%;
28
+ height: 25%;
29
+ width: 100%;
30
+ text-align: center;
31
+ line-height: 0;
32
+ background:url('../images/loading.gif') 50% 50% no-repeat;
33
+ font-size:0;
34
+ }
35
+ #hoverNav{
36
+ position: absolute;
37
+ top: 0;
38
+ left: 0;
39
+ height: 100%;
40
+ width: 100%;
41
+ z-index: 10;
42
+ }
43
+ #imageContainer>#hoverNav{ left: 0;}
44
+ #hoverNav a{ outline: none;}
45
+
46
+ #prevLinkImg, #nextLinkImg{
47
+ width: 49%;
48
+ height: 100%;
49
+ background: transparent url(../images/blank.gif) no-repeat; /* Trick IE into showing hover */
50
+ display: block;
51
+ }
52
+ #prevLinkImg { left: 0; float: left;}
53
+ #nextLinkImg { right: 0; float: right;}
54
+ #prevLinkImg:hover, #prevLinkImg:visited:hover { background: url(../images/prevlabel.gif) left 50% no-repeat; }
55
+ #nextLinkImg:hover, #nextLinkImg:visited:hover { background: url(../images/nextlabel.gif) right 50% no-repeat; }
56
+
57
+ #detailsNav{display:none}
58
+ #imageDataContainer{
59
+ font: 10px Verdana, Helvetica, sans-serif;
60
+ background-color: #fff;
61
+ margin: 0 auto;
62
+ line-height: 1.4em;
63
+ }
64
+
65
+ #imageData{ padding:0 10px; color: #666; }
66
+ #imageData #imageDetails{ width: 85%; float: left; text-align: left; padding-bottom: 10px; }
67
+ #imageData #caption{ font-weight: bold; display: block;}
68
+ #imageData #numberDisplay{ display: block; clear: left; padding-bottom: 1.0em; font-weight: bold; padding: 10px 0 0; }
69
+ #imageData #closeLink{ width: 66px;height: 22px; float: right; padding-bottom: 0.7em;background:url('../images/closelabel.gif') 0 0 no-repeat;font-size:0 }
70
+
71
+ #overlay{
72
+ position: absolute;
73
+ top: 0;
74
+ left: 0;
75
+ z-index: 999;
76
+ width: 100%;
77
+ height: 500px;
78
+ background-color: #000;
79
+ }
80
+
81
+
82
+ /* Min-Width */
83
+ .lbWidth { /* most browsers */
84
+ position: absolute;
85
+ top: 0px; left: 0px;
86
+ width: 100%;
87
+ min-width: 790px;
88
+ }
89
+
90
+ * html .lbContent { /* IE6 */
91
+ margin-left: -790px;
92
+ position:relative;
93
+ }
94
+
95
+ * html .lbMinWidth { /* IE6 */
96
+ padding-left: 790px;
97
+ }
98
+
99
+
100
+ /* Clearfix */
101
+ .clearfix:after {
102
+ content: ".";
103
+ display: block;
104
+ height: 0;
105
+ clear: both;
106
+ visibility: hidden;
107
+ }
108
+
109
+ .clearfix {display: inline-block;}
110
+
111
+ /* Hides from IE-mac \*/
112
+ * html .clearfix {height: 1%;}
113
+ .clearfix {/*display: block;*/}
114
+ /* End hide from IE-mac */
115
+
skin/frontend/base/default/gallery/images/bullet.gif ADDED
Binary file
skin/frontend/base/default/gallery/images/close.gif ADDED
Binary file
skin/frontend/base/default/gallery/images/closelabel.gif ADDED
Binary file
skin/frontend/base/default/gallery/images/donate-button.gif ADDED
Binary file
skin/frontend/base/default/gallery/images/download-icon.gif ADDED
Binary file
skin/frontend/base/default/gallery/images/image-1.jpg ADDED
Binary file
skin/frontend/base/default/gallery/images/loading.gif ADDED
Binary file
skin/frontend/base/default/gallery/images/nextlabel.gif ADDED
Binary file
skin/frontend/base/default/gallery/images/prevlabel.gif ADDED
Binary file
skin/frontend/base/default/gallery/images/star.gif ADDED
Binary file
skin/frontend/base/default/gallery/images/thumb-1.jpg ADDED
Binary file
skin/frontend/base/default/gallery/js/jquery.colorbox.js ADDED
@@ -0,0 +1,1106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ Colorbox v1.5.3 - 2014-03-04
3
+ jQuery lightbox and modal window plugin
4
+ (c) 2014 Jack Moore - http://www.jacklmoore.com/colorbox
5
+ license: http://www.opensource.org/licenses/mit-license.php
6
+ */
7
+ (function ($, document, window) {
8
+ var
9
+ // Default settings object.
10
+ // See http://jacklmoore.com/colorbox for details.
11
+ defaults = {
12
+ // data sources
13
+ html: false,
14
+ photo: false,
15
+ iframe: false,
16
+ inline: false,
17
+
18
+ // behavior and appearance
19
+ transition: "elastic",
20
+ speed: 300,
21
+ fadeOut: 300,
22
+ width: false,
23
+ initialWidth: "600",
24
+ innerWidth: false,
25
+ maxWidth: false,
26
+ height: false,
27
+ initialHeight: "450",
28
+ innerHeight: false,
29
+ maxHeight: false,
30
+ scalePhotos: true,
31
+ scrolling: true,
32
+ opacity: 0.9,
33
+ preloading: true,
34
+ className: false,
35
+ overlayClose: true,
36
+ escKey: true,
37
+ arrowKey: true,
38
+ top: false,
39
+ bottom: false,
40
+ left: false,
41
+ right: false,
42
+ fixed: false,
43
+ data: undefined,
44
+ closeButton: true,
45
+ fastIframe: true,
46
+ open: false,
47
+ reposition: true,
48
+ loop: true,
49
+ slideshow: false,
50
+ slideshowAuto: true,
51
+ slideshowSpeed: 2500,
52
+ slideshowStart: "start slideshow",
53
+ slideshowStop: "stop slideshow",
54
+ photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,
55
+
56
+ // alternate image paths for high-res displays
57
+ retinaImage: false,
58
+ retinaUrl: false,
59
+ retinaSuffix: '@2x.$1',
60
+
61
+ // internationalization
62
+ current: "({current} of {total})",
63
+ /* previous: "previous", */
64
+ previous: "",
65
+ next: "",
66
+ close: "close",
67
+ xhrError: "This content failed to load.",
68
+ imgError: "This image failed to load.",
69
+
70
+ // accessbility
71
+ returnFocus: true,
72
+ trapFocus: true,
73
+
74
+ // callbacks
75
+ onOpen: false,
76
+ onLoad: false,
77
+ onComplete: false,
78
+ onCleanup: false,
79
+ onClosed: false,
80
+
81
+ rel: function() {
82
+ return this.rel;
83
+ },
84
+ href: function() {
85
+ // Using .attr() so that the href can also be used to provide a selector for inline content
86
+ return $(this).attr('href');
87
+ },
88
+ title: function() {
89
+ return this.title;
90
+ }
91
+ },
92
+
93
+
94
+ // Abstracting the HTML and event identifiers for easy rebranding
95
+ colorbox = 'colorbox',
96
+ prefix = 'cbox',
97
+ boxElement = prefix + 'Element',
98
+
99
+ // Events
100
+ event_open = prefix + '_open',
101
+ event_load = prefix + '_load',
102
+ event_complete = prefix + '_complete',
103
+ event_cleanup = prefix + '_cleanup',
104
+ event_closed = prefix + '_closed',
105
+ event_purge = prefix + '_purge',
106
+
107
+ // Cached jQuery Object Variables
108
+ $overlay,
109
+ $box,
110
+ $wrap,
111
+ $content,
112
+ $topBorder,
113
+ $leftBorder,
114
+ $rightBorder,
115
+ $bottomBorder,
116
+ $related,
117
+ $window,
118
+ $loaded,
119
+ $loadingBay,
120
+ $loadingOverlay,
121
+ $title,
122
+ $current,
123
+ $slideshow,
124
+ $next,
125
+ $prev,
126
+ $close,
127
+ $groupControls,
128
+ $events = $('<a/>'), // $({}) would be prefered, but there is an issue with jQuery 1.4.2
129
+
130
+ // Variables for cached values or use across multiple functions
131
+ settings,
132
+ interfaceHeight,
133
+ interfaceWidth,
134
+ loadedHeight,
135
+ loadedWidth,
136
+ index,
137
+ photo,
138
+ open,
139
+ active,
140
+ closing,
141
+ loadingTimer,
142
+ publicMethod,
143
+ div = "div",
144
+ requests = 0,
145
+ previousCSS = {},
146
+ init;
147
+
148
+ // ****************
149
+ // HELPER FUNCTIONS
150
+ // ****************
151
+
152
+ // Convenience function for creating new jQuery objects
153
+ function $tag(tag, id, css) {
154
+ var element = document.createElement(tag);
155
+
156
+ if (id) {
157
+ element.id = prefix + id;
158
+ }
159
+
160
+ if (css) {
161
+ element.style.cssText = css;
162
+ }
163
+
164
+ return $(element);
165
+ }
166
+
167
+ // Get the window height using innerHeight when available to avoid an issue with iOS
168
+ // http://bugs.jquery.com/ticket/6724
169
+ function winheight() {
170
+ return window.innerHeight ? window.innerHeight : $(window).height();
171
+ }
172
+
173
+ function Settings(element, options) {
174
+ if (options !== Object(options)) {
175
+ options = {};
176
+ }
177
+
178
+ this.cache = {};
179
+ this.el = element;
180
+
181
+ this.value = function(key) {
182
+ var dataAttr;
183
+
184
+ if (this.cache[key] === undefined) {
185
+ dataAttr = $(this.el).attr('data-cbox-'+key);
186
+
187
+ if (dataAttr !== undefined) {
188
+ this.cache[key] = dataAttr;
189
+ } else if (options[key] !== undefined) {
190
+ this.cache[key] = options[key];
191
+ } else if (defaults[key] !== undefined) {
192
+ this.cache[key] = defaults[key];
193
+ }
194
+ }
195
+
196
+ return this.cache[key];
197
+ };
198
+
199
+ this.get = function(key) {
200
+ var value = this.value(key);
201
+ return $.isFunction(value) ? value.call(this.el, this) : value;
202
+ };
203
+ }
204
+
205
+ // Determine the next and previous members in a group.
206
+ function getIndex(increment) {
207
+ var
208
+ max = $related.length,
209
+ newIndex = (index + increment) % max;
210
+
211
+ return (newIndex < 0) ? max + newIndex : newIndex;
212
+ }
213
+
214
+ // Convert '%' and 'px' values to integers
215
+ function setSize(size, dimension) {
216
+ return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10));
217
+ }
218
+
219
+ // Checks an href to see if it is a photo.
220
+ // There is a force photo option (photo: true) for hrefs that cannot be matched by the regex.
221
+ function isImage(settings, url) {
222
+ return settings.get('photo') || settings.get('photoRegex').test(url);
223
+ }
224
+
225
+ function retinaUrl(settings, url) {
226
+ return settings.get('retinaUrl') && window.devicePixelRatio > 1 ? url.replace(settings.get('photoRegex'), settings.get('retinaSuffix')) : url;
227
+ }
228
+
229
+ function trapFocus(e) {
230
+ if ('contains' in $box[0] && !$box[0].contains(e.target)) {
231
+ e.stopPropagation();
232
+ $box.focus();
233
+ }
234
+ }
235
+
236
+ function setClass(str) {
237
+ if (setClass.str !== str) {
238
+ $box.add($overlay).removeClass(setClass.str).addClass(str);
239
+ setClass.str = str;
240
+ }
241
+ }
242
+
243
+ function getRelated() {
244
+ index = 0;
245
+
246
+ if (rel && rel !== 'nofollow') {
247
+ $related = $('.' + boxElement).filter(function () {
248
+ var options = $.data(this, colorbox);
249
+ var settings = new Settings(this, options);
250
+ return (settings.get('rel') === rel);
251
+ });
252
+ index = $related.index(settings.el);
253
+
254
+ // Check direct calls to Colorbox.
255
+ if (index === -1) {
256
+ $related = $related.add(settings.el);
257
+ index = $related.length - 1;
258
+ }
259
+ } else {
260
+ $related = $(settings.el);
261
+ }
262
+ }
263
+
264
+ function trigger(event) {
265
+ // for external use
266
+ $(document).trigger(event);
267
+ // for internal use
268
+ $events.triggerHandler(event);
269
+ }
270
+
271
+ var slideshow = (function(){
272
+ var active,
273
+ className = prefix + "Slideshow_",
274
+ click = "click." + prefix,
275
+ timeOut;
276
+
277
+ function clear () {
278
+ clearTimeout(timeOut);
279
+ }
280
+
281
+ function set() {
282
+ if (settings.get('loop') || $related[index + 1]) {
283
+ clear();
284
+ timeOut = setTimeout(publicMethod.next, settings.get('slideshowSpeed'));
285
+ }
286
+ }
287
+
288
+ function start() {
289
+ $slideshow
290
+ .html(settings.get('slideshowStop'))
291
+ .unbind(click)
292
+ .one(click, stop)
293
+ .removeClass('stop').addClass('start') ;
294
+ $events
295
+ .bind(event_complete, set)
296
+ .bind(event_load, clear);
297
+
298
+ $box.removeClass(className + "off").addClass(className + "on");
299
+ }
300
+
301
+ function stop() {
302
+ clear();
303
+
304
+ $events
305
+ .unbind(event_complete, set)
306
+ .unbind(event_load, clear);
307
+
308
+ $slideshow
309
+ .html(settings.get('slideshowStart'))
310
+ .removeClass('start').addClass('stop')
311
+ .unbind(click)
312
+ .one(click, function () {
313
+ publicMethod.next();
314
+ start();
315
+ });
316
+
317
+ $box.removeClass(className + "on").addClass(className + "off");
318
+ }
319
+
320
+ function reset() {
321
+ active = false;
322
+ $slideshow.hide();
323
+ clear();
324
+ $events
325
+ .unbind(event_complete, set)
326
+ .unbind(event_load, clear);
327
+ $box.removeClass(className + "off " + className + "on");
328
+ }
329
+
330
+ return function(){
331
+ if (active) {
332
+ if (!settings.get('slideshow')) {
333
+ $events.unbind(event_cleanup, reset);
334
+ reset();
335
+ }
336
+ } else {
337
+ if (settings.get('slideshow') && $related[1]) {
338
+ active = true;
339
+ $events.one(event_cleanup, reset);
340
+ if (settings.get('slideshowAuto')) {
341
+ start();
342
+ } else {
343
+ stop();
344
+ }
345
+ $slideshow.show();
346
+ }
347
+ }
348
+ };
349
+
350
+ }());
351
+
352
+
353
+ function launch(element) {
354
+ var options;
355
+
356
+ if (!closing) {
357
+
358
+ options = $(element).data('colorbox');
359
+
360
+ settings = new Settings(element, options);
361
+
362
+ rel = settings.get('rel');
363
+
364
+ getRelated();
365
+
366
+ if (!open) {
367
+ open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
368
+
369
+ setClass(settings.get('className'));
370
+
371
+ // Show colorbox so the sizes can be calculated in older versions of jQuery
372
+ $box.css({visibility:'hidden', display:'block'});
373
+
374
+ $loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden');
375
+ $content.css({width:'', height:''}).append($loaded);
376
+
377
+ // Cache values needed for size calculations
378
+ interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();
379
+ interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
380
+ loadedHeight = $loaded.outerHeight(true) +70;
381
+ loadedWidth = $loaded.outerWidth(true);
382
+
383
+ // Opens inital empty Colorbox prior to content being loaded.
384
+ settings.w = setSize(settings.get('initialWidth'), 'x');
385
+ settings.h = setSize(settings.get('initialHeight'), 'y');
386
+ $loaded.css({width:'', height:settings.h});
387
+ publicMethod.position();
388
+
389
+ trigger(event_open);
390
+ settings.get('onOpen');
391
+
392
+ $groupControls.add($title).hide();
393
+
394
+ $box.focus();
395
+
396
+ if (settings.get('trapFocus')) {
397
+ // Confine focus to the modal
398
+ // Uses event capturing that is not supported in IE8-
399
+ if (document.addEventListener) {
400
+
401
+ document.addEventListener('focus', trapFocus, true);
402
+
403
+ $events.one(event_closed, function () {
404
+ document.removeEventListener('focus', trapFocus, true);
405
+ });
406
+ }
407
+ }
408
+
409
+ // Return focus on closing
410
+ if (settings.get('returnFocus')) {
411
+ $events.one(event_closed, function () {
412
+ $(settings.el).focus();
413
+ });
414
+ }
415
+ }
416
+
417
+ $overlay.css({
418
+ opacity: parseFloat(settings.get('opacity')),
419
+ cursor: settings.get('overlayClose') ? "pointer" : "auto",
420
+ visibility: 'visible'
421
+ }).show();
422
+
423
+ if (settings.get('closeButton')) {
424
+ $close.html(settings.get('close')).appendTo($content);
425
+ } else {
426
+ $close.appendTo('<div/>'); // replace with .detach() when dropping jQuery < 1.4
427
+ }
428
+
429
+ load();
430
+ }
431
+ }
432
+
433
+ // Colorbox's markup needs to be added to the DOM prior to being called
434
+ // so that the browser will go ahead and load the CSS background images.
435
+ function appendHTML() {
436
+ if (!$box && document.body) {
437
+ init = false;
438
+ $window = $(window);
439
+ $box = $tag(div).attr({
440
+ id: colorbox,
441
+ 'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS.
442
+ role: 'dialog',
443
+ tabindex: '-1'
444
+ }).hide();
445
+ $overlay = $tag(div, "Overlay").hide();
446
+ $loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]);
447
+ $wrap = $tag(div, "Wrapper");
448
+
449
+ var $title_panel = $tag(div, "title_panel").append(
450
+ $title = $tag(div, "Title"),
451
+ $current = $tag(div, "Current")
452
+
453
+ );
454
+ var $button = $tag(div, "button").append(
455
+ $prev = $('<button type="button"/>').attr({id:prefix+'p-slider'}).addClass('preslider'),
456
+ $slideshow = $tag('button', "Slideshow").addClass('btn stop'),
457
+ $next = $('<button type="button"/>').attr({id:prefix+'n-slider'}).addClass('nextslider')
458
+
459
+ );
460
+ var $button_panel = $tag(div, "button_panel").append(
461
+ $title_panel,
462
+ $button
463
+ );
464
+ $button_panel.addClass('button-panel');
465
+ $content = $tag(div, "Content").append(
466
+ $button_panel,
467
+ $loadingOverlay
468
+ );
469
+
470
+ $close = $('<button type="button"/>').attr({id:prefix+'Close'});
471
+
472
+ $wrap.append( // The 3x3 Grid that makes up Colorbox
473
+ $tag(div).append(
474
+ $tag(div, "TopLeft"),
475
+ $topBorder = $tag(div, "TopCenter"),
476
+ $tag(div, "TopRight")
477
+ ),
478
+ $tag(div, false, 'clear:left').append(
479
+ $leftBorder = $tag(div, "MiddleLeft"),
480
+ $content,
481
+ $rightBorder = $tag(div, "MiddleRight")
482
+ ),
483
+ $tag(div, false, 'clear:left').append(
484
+ $tag(div, "BottomLeft"),
485
+ $bottomBorder = $tag(div, "BottomCenter"),
486
+ $tag(div, "BottomRight")
487
+ )
488
+ ).find('div div').css({'float': 'left'});
489
+
490
+ $loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;');
491
+
492
+ $groupControls = $next.add($prev).add($current).add($slideshow);
493
+
494
+ $(document.body).append($overlay, $box.append($wrap, $loadingBay));
495
+ }
496
+ }
497
+
498
+ // Add Colorbox's event bindings
499
+ function addBindings() {
500
+ function clickHandler(e) {
501
+ // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
502
+ // See: http://jacklmoore.com/notes/click-events/
503
+ if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {
504
+ e.preventDefault();
505
+ launch(this);
506
+ }
507
+ }
508
+
509
+ if ($box) {
510
+ if (!init) {
511
+ init = true;
512
+
513
+ // Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
514
+ $next.click(function () {
515
+ publicMethod.next();
516
+ });
517
+ $prev.click(function () {
518
+ publicMethod.prev();
519
+ });
520
+ $close.click(function () {
521
+ publicMethod.close();
522
+ });
523
+ $overlay.click(function () {
524
+ if (settings.get('overlayClose')) {
525
+ publicMethod.close();
526
+ }
527
+ });
528
+
529
+ // Key Bindings
530
+ $(document).bind('keydown.' + prefix, function (e) {
531
+ var key = e.keyCode;
532
+ if (open && settings.get('escKey') && key === 27) {
533
+ e.preventDefault();
534
+ publicMethod.close();
535
+ }
536
+ if (open && settings.get('arrowKey') && $related[1] && !e.altKey) {
537
+ if (key === 37) {
538
+ e.preventDefault();
539
+ $prev.click();
540
+ } else if (key === 39) {
541
+ e.preventDefault();
542
+ $next.click();
543
+ }
544
+ }
545
+ });
546
+
547
+ if ($.isFunction($.fn.on)) {
548
+ // For jQuery 1.7+
549
+ $(document).on('click.'+prefix, '.'+boxElement, clickHandler);
550
+ } else {
551
+ // For jQuery 1.3.x -> 1.6.x
552
+ // This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.
553
+ // This is not here for jQuery 1.9, it's here for legacy users.
554
+ $('.'+boxElement).live('click.'+prefix, clickHandler);
555
+ }
556
+ }
557
+ return true;
558
+ }
559
+ return false;
560
+ }
561
+
562
+ // Don't do anything if Colorbox already exists.
563
+ if ($.colorbox) {
564
+ return;
565
+ }
566
+
567
+ // Append the HTML when the DOM loads
568
+ $(appendHTML);
569
+
570
+
571
+ // ****************
572
+ // PUBLIC FUNCTIONS
573
+ // Usage format: $.colorbox.close();
574
+ // Usage from within an iframe: parent.jQuery.colorbox.close();
575
+ // ****************
576
+
577
+ publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
578
+ var settings;
579
+ var $obj = this;
580
+
581
+ options = options || {};
582
+
583
+ if ($.isFunction($obj)) { // assume a call to $.colorbox
584
+ $obj = $('<a/>');
585
+ options.open = true;
586
+ } else if (!$obj[0]) { // colorbox being applied to empty collection
587
+ return $obj;
588
+ }
589
+
590
+
591
+ if (!$obj[0]) { // colorbox being applied to empty collection
592
+ return $obj;
593
+ }
594
+
595
+ appendHTML();
596
+
597
+ if (addBindings()) {
598
+
599
+ if (callback) {
600
+ options.onComplete = callback;
601
+ }
602
+
603
+ $obj.each(function () {
604
+ var old = $.data(this, colorbox) || {};
605
+ $.data(this, colorbox, $.extend(old, options));
606
+ }).addClass(boxElement);
607
+
608
+ settings = new Settings($obj[0], options);
609
+
610
+ if (settings.get('open')) {
611
+ launch($obj[0]);
612
+ }
613
+ }
614
+
615
+ return $obj;
616
+ };
617
+
618
+ publicMethod.position = function (speed, loadedCallback) {
619
+ var
620
+ css,
621
+ top = 0,
622
+ left = 0,
623
+ offset = $box.offset(),
624
+ scrollTop,
625
+ scrollLeft;
626
+
627
+ $window.unbind('resize.' + prefix);
628
+
629
+ // remove the modal so that it doesn't influence the document width/height
630
+ $box.css({top: -9e4, left: -9e4});
631
+
632
+ scrollTop = $window.scrollTop();
633
+ scrollLeft = $window.scrollLeft();
634
+
635
+ if (settings.get('fixed')) {
636
+ offset.top -= scrollTop;
637
+ offset.left -= scrollLeft;
638
+ $box.css({position: 'fixed'});
639
+ } else {
640
+ top = scrollTop;
641
+ left = scrollLeft;
642
+ $box.css({position: 'absolute'});
643
+ }
644
+
645
+ // keeps the top and left positions within the browser's viewport.
646
+ if (settings.get('right') !== false) {
647
+ left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.get('right'), 'x'), 0);
648
+ } else if (settings.get('left') !== false) {
649
+ left += setSize(settings.get('left'), 'x');
650
+ } else {
651
+ left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
652
+ }
653
+
654
+ if (settings.get('bottom') !== false) {
655
+ top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.get('bottom'), 'y'), 0);
656
+ } else if (settings.get('top') !== false) {
657
+ top += setSize(settings.get('top'), 'y');
658
+ } else {
659
+ top += Math.round(Math.max(winheight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
660
+ }
661
+
662
+ $box.css({top: offset.top, left: offset.left, visibility:'visible'});
663
+
664
+ // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
665
+ // but it has to be shrank down around the size of div#colorbox when it's done. If not,
666
+ // it can invoke an obscure IE bug when using iframes.
667
+ $wrap[0].style.width = $wrap[0].style.height = "9999px";
668
+
669
+ function modalDimensions() {
670
+ $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt($box[0].style.width,10) - interfaceWidth)+'px';
671
+ $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt($box[0].style.height,10) - interfaceHeight)+'px';
672
+ }
673
+
674
+ css = {width: settings.w + loadedWidth + interfaceWidth, height: settings.h + loadedHeight + interfaceHeight, top: top, left: left};
675
+
676
+ // setting the speed to 0 if the content hasn't changed size or position
677
+ if (speed) {
678
+ var tempSpeed = 0;
679
+ $.each(css, function(i){
680
+ if (css[i] !== previousCSS[i]) {
681
+ tempSpeed = speed;
682
+ return;
683
+ }
684
+ });
685
+ speed = tempSpeed;
686
+ }
687
+
688
+ previousCSS = css;
689
+
690
+ if (!speed) {
691
+ $box.css(css);
692
+ }
693
+
694
+ $box.dequeue().animate(css, {
695
+ duration: speed || 0,
696
+ complete: function () {
697
+ modalDimensions();
698
+
699
+ active = false;
700
+
701
+ // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
702
+ $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
703
+ $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
704
+
705
+ if (settings.get('reposition')) {
706
+ setTimeout(function () { // small delay before binding onresize due to an IE8 bug.
707
+ $window.bind('resize.' + prefix, publicMethod.position);
708
+ }, 1);
709
+ }
710
+
711
+ if (loadedCallback) {
712
+ loadedCallback();
713
+ }
714
+ },
715
+ step: modalDimensions
716
+ });
717
+ };
718
+
719
+ publicMethod.resize = function (options) {
720
+ var scrolltop;
721
+
722
+ if (open) {
723
+ options = options || {};
724
+
725
+ if (options.width) {
726
+ settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
727
+ }
728
+
729
+ if (options.innerWidth) {
730
+ settings.w = setSize(options.innerWidth, 'x');
731
+ }
732
+
733
+ $loaded.css({width: settings.w});
734
+
735
+ if (options.height) {
736
+ settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
737
+ }
738
+
739
+ if (options.innerHeight) {
740
+ settings.h = setSize(options.innerHeight, 'y');
741
+ }
742
+
743
+ if (!options.innerHeight && !options.height) {
744
+ scrolltop = $loaded.scrollTop();
745
+ $loaded.css({height: "auto"});
746
+ settings.h = $loaded.height();
747
+ }
748
+
749
+ $loaded.css({height: settings.h});
750
+
751
+ if(scrolltop) {
752
+ $loaded.scrollTop(scrolltop);
753
+ }
754
+
755
+ publicMethod.position(settings.get('transition') === "none" ? 0 : settings.get('speed'));
756
+ }
757
+ };
758
+
759
+ publicMethod.prep = function (object) {
760
+ if (!open) {
761
+ return;
762
+ }
763
+
764
+ var callback, speed = settings.get('transition') === "none" ? 0 : settings.get('speed');
765
+
766
+ $loaded.remove();
767
+
768
+ $loaded = $tag(div, 'LoadedContent').append(object);
769
+
770
+ function getWidth() {
771
+ settings.w = settings.w || $loaded.width();
772
+ settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
773
+ return settings.w;
774
+ }
775
+ function getHeight() {
776
+ settings.h = settings.h || $loaded.height();
777
+ settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
778
+ return settings.h;
779
+ }
780
+
781
+ $loaded.hide()
782
+ .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
783
+ .css({width: getWidth(), overflow: settings.get('scrolling') ? 'auto' : 'hidden'})
784
+ .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
785
+ .prependTo($content);
786
+
787
+ $loadingBay.hide();
788
+
789
+ // floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
790
+
791
+ $(photo).css({'float': 'none'});
792
+
793
+ setClass(settings.get('className'));
794
+
795
+ callback = function () {
796
+ var total = $related.length,
797
+ iframe,
798
+ complete;
799
+
800
+ if (!open) {
801
+ return;
802
+ }
803
+
804
+ function removeFilter() { // Needed for IE8 in versions of jQuery prior to 1.7.2
805
+ if ($.support.opacity === false) {
806
+ $box[0].style.removeAttribute('filter');
807
+ }
808
+ }
809
+
810
+ complete = function () {
811
+ clearTimeout(loadingTimer);
812
+ $loadingOverlay.hide();
813
+ trigger(event_complete);
814
+ settings.get('onComplete');
815
+ };
816
+
817
+
818
+ $title.html(settings.get('title')).show();
819
+ $loaded.show();
820
+
821
+ if (total > 1) { // handle grouping
822
+ if (typeof settings.get('current') === "string") {
823
+ $current.html(settings.get('current').replace('{current}', index + 1).replace('{total}', total)).show();
824
+ }
825
+
826
+ $next[(settings.get('loop') || index < total - 1) ? "show" : "hide"]().html(settings.get('next'));
827
+ $prev[(settings.get('loop') || index) ? "show" : "hide"]().html(settings.get('previous'));
828
+
829
+ slideshow();
830
+
831
+ // Preloads images within a rel group
832
+ if (settings.get('preloading')) {
833
+ $.each([getIndex(-1), getIndex(1)], function(){
834
+ var img,
835
+ i = $related[this],
836
+ settings = new Settings(i, $.data(i, colorbox)),
837
+ src = settings.get('href');
838
+
839
+ if (src && isImage(settings, src)) {
840
+ src = retinaUrl(settings, src);
841
+ img = document.createElement('img');
842
+ img.src = src;
843
+ }
844
+ });
845
+ }
846
+ } else {
847
+ $groupControls.hide();
848
+ }
849
+
850
+ if (settings.get('iframe')) {
851
+ iframe = document.createElement('iframe');
852
+
853
+ if ('frameBorder' in iframe) {
854
+ iframe.frameBorder = 0;
855
+ }
856
+
857
+ if ('allowTransparency' in iframe) {
858
+ iframe.allowTransparency = "true";
859
+ }
860
+
861
+ if (!settings.get('scrolling')) {
862
+ iframe.scrolling = "no";
863
+ }
864
+
865
+ $(iframe)
866
+ .attr({
867
+ src: settings.get('href'),
868
+ name: (new Date()).getTime(), // give the iframe a unique name to prevent caching
869
+ 'class': prefix + 'Iframe',
870
+ allowFullScreen : true // allow HTML5 video to go fullscreen
871
+ })
872
+ .one('load', complete)
873
+ .appendTo($loaded);
874
+
875
+ $events.one(event_purge, function () {
876
+ iframe.src = "//about:blank";
877
+ });
878
+
879
+ if (settings.get('fastIframe')) {
880
+ $(iframe).trigger('load');
881
+ }
882
+ } else {
883
+ complete();
884
+ }
885
+
886
+ if (settings.get('transition') === 'fade') {
887
+ $box.fadeTo(speed, 1, removeFilter);
888
+ } else {
889
+ removeFilter();
890
+ }
891
+ };
892
+
893
+ if (settings.get('transition') === 'fade') {
894
+ $box.fadeTo(speed, 0, function () {
895
+ publicMethod.position(0, callback);
896
+ });
897
+ } else {
898
+ publicMethod.position(speed, callback);
899
+ }
900
+ };
901
+
902
+ function load () {
903
+ var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
904
+
905
+ active = true;
906
+
907
+ photo = false;
908
+
909
+ trigger(event_purge);
910
+ trigger(event_load);
911
+ settings.get('onLoad');
912
+
913
+ settings.h = settings.get('height') ?
914
+ setSize(settings.get('height'), 'y') - loadedHeight - interfaceHeight :
915
+ settings.get('innerHeight') && setSize(settings.get('innerHeight'), 'y');
916
+
917
+ settings.w = settings.get('width') ?
918
+ setSize(settings.get('width'), 'x') - loadedWidth - interfaceWidth :
919
+ settings.get('innerWidth') && setSize(settings.get('innerWidth'), 'x');
920
+
921
+ // Sets the minimum dimensions for use in image scaling
922
+ settings.mw = settings.w;
923
+ settings.mh = settings.h;
924
+
925
+ // Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
926
+ // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
927
+ if (settings.get('maxWidth')) {
928
+ settings.mw = setSize(settings.get('maxWidth'), 'x') - loadedWidth - interfaceWidth;
929
+ settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
930
+ }
931
+ if (settings.get('maxHeight')) {
932
+ settings.mh = setSize(settings.get('maxHeight'), 'y') - loadedHeight - interfaceHeight;
933
+ settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
934
+ }
935
+
936
+ href = settings.get('href');
937
+
938
+ loadingTimer = setTimeout(function () {
939
+ $loadingOverlay.show();
940
+ }, 100);
941
+
942
+ if (settings.get('inline')) {
943
+ // Inserts an empty placeholder where inline content is being pulled from.
944
+ // An event is bound to put inline content back when Colorbox closes or loads new content.
945
+ $inline = $tag(div).hide().insertBefore($(href)[0]);
946
+
947
+ $events.one(event_purge, function () {
948
+ $inline.replaceWith($loaded.children());
949
+ });
950
+
951
+ prep($(href));
952
+ } else if (settings.get('iframe')) {
953
+ // IFrame element won't be added to the DOM until it is ready to be displayed,
954
+ // to avoid problems with DOM-ready JS that might be trying to run in that iframe.
955
+ prep(" ");
956
+ } else if (settings.get('html')) {
957
+ prep(settings.get('html'));
958
+ } else if (isImage(settings, href)) {
959
+
960
+ href = retinaUrl(settings, href);
961
+
962
+ photo = document.createElement('img');
963
+
964
+ $(photo)
965
+ .addClass(prefix + 'Photo')
966
+ .bind('error',function () {
967
+ prep($tag(div, 'Error').html(settings.get('imgError')));
968
+ })
969
+ .one('load', function () {
970
+ var percent;
971
+
972
+ if (request !== requests) {
973
+ return;
974
+ }
975
+
976
+ $.each(['alt', 'longdesc', 'aria-describedby'], function(i,val){
977
+ var attr = $(settings.el).attr(val) || $(settings.el).attr('data-'+val);
978
+ if (attr) {
979
+ photo.setAttribute(val, attr);
980
+ }
981
+ });
982
+
983
+ if (settings.get('retinaImage') && window.devicePixelRatio > 1) {
984
+ photo.height = photo.height / window.devicePixelRatio;
985
+ photo.width = photo.width / window.devicePixelRatio;
986
+ }
987
+
988
+ if (settings.get('scalePhotos')) {
989
+ setResize = function () {
990
+ photo.height -= photo.height * percent;
991
+ photo.width -= photo.width * percent;
992
+ };
993
+ if (settings.mw && photo.width > settings.mw) {
994
+ percent = (photo.width - settings.mw) / photo.width;
995
+ setResize();
996
+ }
997
+ if (settings.mh && photo.height > settings.mh) {
998
+ percent = (photo.height - settings.mh) / photo.height;
999
+ setResize();
1000
+ }
1001
+ }
1002
+
1003
+ if (settings.h) {
1004
+ photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
1005
+ }
1006
+
1007
+ if ($related[1] && (settings.get('loop') || $related[index + 1])) {
1008
+ photo.style.cursor = 'pointer';
1009
+ photo.onclick = function () {
1010
+ publicMethod.next();
1011
+ };
1012
+ }
1013
+
1014
+ photo.style.width = photo.width + 'px';
1015
+ photo.style.height = photo.height + 'px';
1016
+
1017
+ setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
1018
+ prep(photo);
1019
+ }, 1);
1020
+ });
1021
+
1022
+ setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
1023
+ photo.src = href;
1024
+ }, 1);
1025
+ } else if (href) {
1026
+ $loadingBay.load(href, settings.get('data'), function (data, status) {
1027
+ if (request === requests) {
1028
+ prep(status === 'error' ? $tag(div, 'Error').html(settings.get('xhrError')) : $(this).contents());
1029
+ }
1030
+ });
1031
+ }
1032
+ }
1033
+
1034
+ // Navigates to the next page/image in a set.
1035
+ publicMethod.next = function () {
1036
+ if (!active && $related[1] && (settings.get('loop') || $related[index + 1])) {
1037
+ index = getIndex(1);
1038
+ launch($related[index]);
1039
+ }
1040
+ };
1041
+
1042
+ publicMethod.prev = function () {
1043
+ if (!active && $related[1] && (settings.get('loop') || index)) {
1044
+ index = getIndex(-1);
1045
+ launch($related[index]);
1046
+ }
1047
+ };
1048
+
1049
+ // Note: to use this within an iframe use the following format: parent.jQuery.colorbox.close();
1050
+ publicMethod.close = function () {
1051
+ if (open && !closing) {
1052
+
1053
+ closing = true;
1054
+
1055
+ open = false;
1056
+
1057
+ trigger(event_cleanup);
1058
+ settings.get('onCleanup');
1059
+
1060
+ $window.unbind('.' + prefix);
1061
+
1062
+ $overlay.fadeTo(settings.get('fadeOut') || 0, 0);
1063
+
1064
+ $box.stop().fadeTo(settings.get('fadeOut') || 0, 0, function () {
1065
+
1066
+ $box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
1067
+
1068
+ trigger(event_purge);
1069
+
1070
+ $loaded.remove();
1071
+
1072
+ setTimeout(function () {
1073
+ closing = false;
1074
+ trigger(event_closed);
1075
+ settings.get('onClosed');
1076
+ }, 1);
1077
+ });
1078
+ }
1079
+ };
1080
+
1081
+ // Removes changes Colorbox made to the document, but does not remove the plugin.
1082
+ publicMethod.remove = function () {
1083
+ if (!$box) { return; }
1084
+
1085
+ $box.stop();
1086
+ $.colorbox.close();
1087
+ $box.stop().remove();
1088
+ $overlay.remove();
1089
+ closing = false;
1090
+ $box = null;
1091
+ $('.' + boxElement)
1092
+ .removeData(colorbox)
1093
+ .removeClass(boxElement);
1094
+
1095
+ $(document).unbind('click.'+prefix);
1096
+ };
1097
+
1098
+ // A method for fetching the current element Colorbox is referencing.
1099
+ // returns a jQuery object.
1100
+ publicMethod.element = function () {
1101
+ return $(settings.el);
1102
+ };
1103
+
1104
+ publicMethod.settings = defaults;
1105
+
1106
+ }(jQuery, document, window));
skin/frontend/base/default/gallery/js/jquery.galleriffic.js ADDED
@@ -0,0 +1,680 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery Galleriffic plugin
3
+ *
4
+ * Copyright (c) 2008 Trent Foley (http://trentacular.com)
5
+ * Licensed under the MIT License:
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ *
8
+ * Thanks to Taku Sano (Mikage Sawatari), whose history plugin I adapted to work with Galleriffic
9
+ * Modified by Ghismo (ghismo.com) to disable the location rewrite
10
+ */
11
+ ;(function($) {
12
+
13
+ // Write noscript style
14
+ document.write("<style type='text/css'>.noscript{display:none}</style>");
15
+
16
+ var ver = 'galleriffic-1.0';
17
+ var galleryOffset = 0;
18
+ var galleries = [];
19
+ var allImages = [];
20
+ var historyCurrentHash;
21
+ var historyBackStack;
22
+ var historyForwardStack;
23
+ var isFirst = false;
24
+ var dontCheck = false;
25
+ var isInitialized = false;
26
+
27
+ function getHashFromString(hash) {
28
+ if (!hash) return -1;
29
+ hash = hash.replace(/^.*#/, '');
30
+ if (isNaN(hash)) return -1;
31
+ return (+hash);
32
+ }
33
+
34
+ function getHash() {
35
+ var hash = location.hash;
36
+ return getHashFromString(hash);
37
+ }
38
+
39
+ function registerGallery(gallery) {
40
+ galleries.push(gallery);
41
+
42
+ // update the global offset value
43
+ galleryOffset += gallery.data.length;
44
+ }
45
+
46
+ function getGallery(hash) {
47
+ for (i = 0; i < galleries.length; i++) {
48
+ var gallery = galleries[i];
49
+ if (hash < (gallery.data.length+gallery.offset))
50
+ return gallery;
51
+ }
52
+ return 0;
53
+ }
54
+
55
+ function getIndex(gallery, hash) {
56
+ return hash-gallery.offset;
57
+ }
58
+
59
+ function clickHandler(e, gallery, link) {
60
+ gallery.pause();
61
+
62
+ if (!gallery.settings.enableHistory) {
63
+ var hash = getHashFromString(link.href);
64
+ if (hash >= 0) {
65
+ var index = getIndex(gallery, hash);
66
+ if (index >= 0)
67
+ gallery.goto(index);
68
+ }
69
+ e.preventDefault();
70
+ }
71
+ }
72
+
73
+ function historyCallback() {
74
+ // Using present location.hash always (seems to work, unlike the hash argument passed to this callback)
75
+ var hash = getHash();
76
+ if (hash < 0) return;
77
+
78
+ var gallery = getGallery(hash);
79
+ if (!gallery) return;
80
+
81
+ var index = hash-gallery.offset;
82
+ gallery.goto(index);
83
+ }
84
+
85
+ function historyInit() {
86
+ if (isInitialized) return;
87
+ isInitialized = true;
88
+
89
+ var current_hash = location.hash; //(enableHistory) ? location.hash : currentIndexHash; // Ghismo
90
+
91
+ historyCurrentHash = current_hash;
92
+ if ($.browser.msie) {
93
+ // To stop the callback firing twice during initilization if no hash present
94
+ if (historyCurrentHash == '') {
95
+ historyCurrentHash = '#';
96
+ }
97
+ } else if ($.browser.safari) {
98
+ // etablish back/forward stacks
99
+ historyBackStack = [];
100
+ historyBackStack.length = history.length;
101
+ historyForwardStack = [];
102
+ isFirst = true;
103
+ }
104
+
105
+ setInterval(function() { historyCheck(); }, 100);
106
+ }
107
+
108
+ function historyAddHistory(hash) {
109
+ // This makes the looping function do something
110
+ historyBackStack.push(hash);
111
+ historyForwardStack.length = 0; // clear forwardStack (true click occured)
112
+ isFirst = true;
113
+ }
114
+
115
+ function historyCheck() {
116
+ if ($.browser.safari) {
117
+ if (!dontCheck) {
118
+ var historyDelta = history.length - historyBackStack.length;
119
+
120
+ if (historyDelta) { // back or forward button has been pushed
121
+ isFirst = false;
122
+ if (historyDelta < 0) { // back button has been pushed
123
+ // move items to forward stack
124
+ for (var i = 0; i < Math.abs(historyDelta); i++) historyForwardStack.unshift(historyBackStack.pop());
125
+ } else { // forward button has been pushed
126
+ // move items to back stack
127
+ for (var i = 0; i < historyDelta; i++) historyBackStack.push(historyForwardStack.shift());
128
+ }
129
+ var cachedHash = historyBackStack[historyBackStack.length - 1];
130
+ if (cachedHash != undefined) {
131
+ historyCurrentHash = location.hash; // (enableHistory) ? location.hash : currentIndexHash; // Ghismo
132
+ historyCallback();
133
+ }
134
+ } else if (historyBackStack[historyBackStack.length - 1] == undefined && !isFirst) {
135
+ historyCallback();
136
+ isFirst = true;
137
+ }
138
+ }
139
+ } else {
140
+ // otherwise, check for location.hash
141
+ var current_hash = location.hash; // (enableHistory) ? location.hash : currentIndexHash; // Ghismo
142
+ if(current_hash != historyCurrentHash) {
143
+ historyCurrentHash = current_hash;
144
+ historyCallback();
145
+ }
146
+ }
147
+ }
148
+
149
+ var defaults = {
150
+ delay: 3000,
151
+ numThumbs: 20,
152
+ preloadAhead: 40, // Set to -1 to preload all images
153
+ enableTopPager: false,
154
+ enableBottomPager: true,
155
+ imageContainerSel: '',
156
+ captionContainerSel: '',
157
+ controlsContainerSel: '',
158
+ loadingContainerSel: '',
159
+ renderSSControls: true,
160
+ renderNavControls: true,
161
+ playLinkText: 'Play',
162
+ pauseLinkText: 'Pause',
163
+ prevLinkText: 'Previous',
164
+ nextLinkText: 'Next',
165
+ nextPageLinkText: 'Next &rsaquo;',
166
+ prevPageLinkText: '&lsaquo; Prev',
167
+ enableHistory: false,
168
+ autoStart: false,
169
+ onChange: undefined, // accepts a delegate like such: function(prevIndex, nextIndex) { ... }
170
+ onTransitionOut: undefined, // accepts a delegate like such: function(callback) { ... }
171
+ onTransitionIn: undefined, // accepts a delegate like such: function() { ... }
172
+ onPageTransitionOut: undefined, // accepts a delegate like such: function(callback) { ... }
173
+ onPageTransitionIn: undefined // accepts a delegate like such: function() { ... }
174
+ };
175
+
176
+ $.fn.galleriffic = function(thumbsContainerSel, settings) {
177
+ // Extend Gallery Object
178
+ $.extend(this, {
179
+ ver: function() {
180
+ return ver;
181
+ },
182
+
183
+ initializeThumbs: function() {
184
+ this.data = [];
185
+ var gallery = this;
186
+
187
+ this.$thumbsContainer.find('ul.thumbs > li').each(function(i) {
188
+ var $li = $(this);
189
+ var $aThumb = $li.find('a.thumb');
190
+ var hash = gallery.offset+i;
191
+
192
+ gallery.data.push({
193
+ title:$aThumb.attr('title'),
194
+ slideUrl:$aThumb.attr('href'),
195
+ caption:$li.find('.caption').remove(),
196
+ hash:hash
197
+ });
198
+
199
+ // Setup history
200
+ $aThumb.attr('rel', 'history');
201
+ $aThumb.attr('href', '#'+hash);
202
+ $aThumb.click(function(e) {
203
+ clickHandler(e, gallery, this);
204
+ });
205
+ });
206
+ return this;
207
+ },
208
+
209
+ isPreloadComplete: false,
210
+
211
+ preloadInit: function() {
212
+ if (this.settings.preloadAhead == 0) return this;
213
+
214
+ this.preloadStartIndex = this.currentIndex;
215
+ var nextIndex = this.getNextIndex(this.preloadStartIndex);
216
+ return this.preloadRecursive(this.preloadStartIndex, nextIndex);
217
+ },
218
+
219
+ preloadRelocate: function(index) {
220
+ // By changing this startIndex, the current preload script will restart
221
+ this.preloadStartIndex = index;
222
+ return this;
223
+ },
224
+
225
+ preloadRecursive: function(startIndex, currentIndex) {
226
+ // Check if startIndex has been relocated
227
+ if (startIndex != this.preloadStartIndex) {
228
+ var nextIndex = this.getNextIndex(this.preloadStartIndex);
229
+ return this.preloadRecursive(this.preloadStartIndex, nextIndex);
230
+ }
231
+
232
+ var gallery = this;
233
+
234
+ // Now check for preloadAhead count
235
+ var preloadCount = currentIndex - startIndex;
236
+ if (preloadCount < 0)
237
+ preloadCount = this.data.length-1-startIndex+currentIndex;
238
+ if (this.settings.preloadAhead >= 0 && preloadCount > this.settings.preloadAhead) {
239
+ // Do this in order to keep checking for relocated start index
240
+ setTimeout(function() { gallery.preloadRecursive(startIndex, currentIndex); }, 500);
241
+ return this;
242
+ }
243
+
244
+ var imageData = this.data[currentIndex];
245
+ if (!imageData)
246
+ return this;
247
+
248
+ // If already loaded, continue
249
+ if (imageData.image)
250
+ return this.preloadNext(startIndex, currentIndex);
251
+
252
+ // Preload the image
253
+ var image = new Image();
254
+
255
+ image.onload = function() {
256
+ imageData.image = this;
257
+ gallery.preloadNext(startIndex, currentIndex);
258
+ };
259
+
260
+ image.alt = imageData.title;
261
+ image.src = imageData.slideUrl;
262
+
263
+ return this;
264
+ },
265
+
266
+ preloadNext: function(startIndex, currentIndex) {
267
+ var nextIndex = this.getNextIndex(currentIndex);
268
+ if (nextIndex == startIndex) {
269
+ this.isPreloadComplete = true;
270
+ } else {
271
+ // Use set timeout to free up thread
272
+ var gallery = this;
273
+ setTimeout(function() { gallery.preloadRecursive(startIndex, nextIndex); }, 100);
274
+ }
275
+ return this;
276
+ },
277
+
278
+ getNextIndex: function(index) {
279
+ var nextIndex = index+1;
280
+ if (nextIndex >= this.data.length)
281
+ nextIndex = 0;
282
+ return nextIndex;
283
+ },
284
+
285
+ getPrevIndex: function(index) {
286
+ var prevIndex = index-1;
287
+ if (prevIndex < 0)
288
+ prevIndex = this.data.length-1;
289
+ return prevIndex;
290
+ },
291
+
292
+ pause: function() {
293
+ if (this.interval)
294
+ this.toggleSlideshow();
295
+
296
+ return this;
297
+ },
298
+
299
+ play: function() {
300
+ if (!this.interval)
301
+ this.toggleSlideshow();
302
+
303
+ return this;
304
+ },
305
+
306
+ toggleSlideshow: function() {
307
+ if (this.interval) {
308
+ clearInterval(this.interval);
309
+ this.interval = 0;
310
+
311
+ if (this.$controlsContainer) {
312
+ this.$controlsContainer
313
+ .find('div.ss-controls a').removeClass().addClass('play')
314
+ .attr('title', this.settings.playLinkText)
315
+ .attr('href', '#play')
316
+ .html(this.settings.playLinkText);
317
+ }
318
+ } else {
319
+ this.ssAdvance();
320
+
321
+ var gallery = this;
322
+ this.interval = setInterval(function() {
323
+ gallery.ssAdvance();
324
+ }, this.settings.delay);
325
+
326
+ if (this.$controlsContainer) {
327
+ this.$controlsContainer
328
+ .find('div.ss-controls a').removeClass().addClass('pause')
329
+ .attr('title', this.settings.pauseLinkText)
330
+ .attr('href', '#pause')
331
+ .html(this.settings.pauseLinkText);
332
+ }
333
+ }
334
+
335
+ return this;
336
+ },
337
+
338
+ ssAdvance: function() {
339
+ var nextIndex = this.getNextIndex(this.currentIndex);
340
+ var nextHash = this.data[nextIndex].hash;
341
+
342
+ // Seems to be working on both FF and Safari
343
+ if (this.settings.enableHistory)
344
+ location.href = '#'+nextHash;
345
+ else
346
+ this.goto(nextIndex);
347
+
348
+ // IE we need to explicity call goto
349
+ //if ($.browser.msie) {
350
+ // this.goto(nextIndex);
351
+ //}
352
+
353
+ return this;
354
+ },
355
+
356
+ goto: function(index) {
357
+ if (index < 0) index = 0;
358
+ else if (index >= this.data.length) index = this.data.length-1;
359
+
360
+ if (this.settings.onChange)
361
+ this.settings.onChange(this.currentIndex, index);
362
+
363
+ this.currentIndex = index;
364
+ this.preloadRelocate(index);
365
+ return this.refresh();
366
+ },
367
+
368
+ refresh: function() {
369
+ var imageData = this.data[this.currentIndex];
370
+ if (!imageData)
371
+ return this;
372
+
373
+ // Flag we are transitioning
374
+ var isTransitioning = true;
375
+
376
+ var gallery = this;
377
+
378
+ var transitionOutCallback = function() {
379
+ // Flag that the transition has completed
380
+ isTransitioning = false;
381
+
382
+ // Update Controls
383
+ if (gallery.$controlsContainer) {
384
+ gallery.$controlsContainer
385
+ .find('div.nav-controls a.prev').attr('href', '#'+gallery.data[gallery.getPrevIndex(gallery.currentIndex)].hash).end()
386
+ .find('div.nav-controls a.next').attr('href', '#'+gallery.data[gallery.getNextIndex(gallery.currentIndex)].hash);
387
+ }
388
+
389
+ var imageData = gallery.data[gallery.currentIndex];
390
+
391
+ // Replace Caption
392
+ if (gallery.$captionContainer) {
393
+ gallery.$captionContainer.empty().append(imageData.caption);
394
+ }
395
+
396
+ if (imageData.image) {
397
+ gallery.buildImage(imageData.image);
398
+ } else {
399
+ // Show loading container
400
+ if (gallery.$loadingContainer) {
401
+ gallery.$loadingContainer.show();
402
+ }
403
+ }
404
+ }
405
+
406
+ if (this.settings.onTransitionOut) {
407
+ this.settings.onTransitionOut(transitionOutCallback);
408
+ } else {
409
+ this.$transitionContainers.hide();
410
+ transitionOutCallback();
411
+ }
412
+
413
+ if (!imageData.image) {
414
+ var image = new Image();
415
+
416
+ // Wire up mainImage onload event
417
+ image.onload = function() {
418
+ imageData.image = this;
419
+
420
+ if (!isTransitioning) {
421
+ gallery.buildImage(imageData.image);
422
+ }
423
+ };
424
+
425
+ // set alt and src
426
+ image.alt = imageData.title;
427
+ image.src = imageData.slideUrl;
428
+ }
429
+
430
+ // This causes the preloader (if still running) to relocate out from the currentIndex
431
+ this.relocatePreload = true;
432
+
433
+ return this.syncThumbs();
434
+ },
435
+
436
+ buildImage: function(image) {
437
+ if (this.$imageContainer) {
438
+ this.$imageContainer.empty();
439
+
440
+ var gallery = this;
441
+ var nextIndex = this.getNextIndex(this.currentIndex);
442
+
443
+ // Hide the loading conatiner
444
+ if (this.$loadingContainer) {
445
+ this.$loadingContainer.hide();
446
+ }
447
+
448
+ // Setup image
449
+ this.$imageContainer
450
+ .append('<span class="image-wrapper"><a class="advance-link" rel="history" href="#'+this.data[nextIndex].hash+'" title="'+image.alt+'"></a></span>')
451
+ .find('a')
452
+ .append(image)
453
+ .click(function(e) {
454
+ clickHandler(e, gallery, this);
455
+ });
456
+ }
457
+
458
+ if (this.settings.onTransitionIn)
459
+ this.settings.onTransitionIn();
460
+ else
461
+ this.$transitionContainers.show();
462
+
463
+ return this;
464
+ },
465
+
466
+ syncThumbs: function() {
467
+ if (this.$thumbsContainer) {
468
+ var page = Math.floor(this.currentIndex / this.settings.numThumbs);
469
+ if (page != this.currentPage) {
470
+ this.currentPage = page;
471
+ this.updateThumbs();
472
+ }
473
+
474
+ // Remove existing selected class and add selected class to new thumb
475
+ var $thumbs = this.$thumbsContainer.find('ul.thumbs').children();
476
+ $thumbs.filter('.selected').removeClass('selected');
477
+ $thumbs.eq(this.currentIndex).addClass('selected');
478
+ }
479
+
480
+ return this;
481
+ },
482
+
483
+ updateThumbs: function() {
484
+ var gallery = this;
485
+ var transitionOutCallback = function() {
486
+ gallery.rebuildThumbs();
487
+
488
+ // Transition In the thumbsContainer
489
+ if (gallery.settings.onPageTransitionIn)
490
+ gallery.settings.onPageTransitionIn();
491
+ else
492
+ gallery.$thumbsContainer.show();
493
+ };
494
+
495
+ // Transition Out the thumbsContainer
496
+ if (this.settings.onPageTransitionOut) {
497
+ this.settings.onPageTransitionOut(transitionOutCallback);
498
+ } else {
499
+ this.$thumbsContainer.hide();
500
+ transitionOutCallback();
501
+ }
502
+
503
+ return this;
504
+ },
505
+
506
+ rebuildThumbs: function() {
507
+ // Initialize currentPage to first page
508
+ if (this.currentPage < 0)
509
+ this.currentPage = 0;
510
+
511
+ var needsPagination = this.data.length > this.settings.numThumbs;
512
+
513
+ // Rebuild top pager
514
+ var $topPager = this.$thumbsContainer.find('div.top');
515
+ if ($topPager.length == 0)
516
+ $topPager = this.$thumbsContainer.prepend('<div class="top pagination"></div>').find('div.top');
517
+
518
+ if (needsPagination && this.settings.enableTopPager) {
519
+ $topPager.empty();
520
+ this.buildPager($topPager);
521
+ }
522
+
523
+ // Rebuild bottom pager
524
+ if (needsPagination && this.settings.enableBottomPager) {
525
+ var $bottomPager = this.$thumbsContainer.find('div.bottom');
526
+ if ($bottomPager.length == 0)
527
+ $bottomPager = this.$thumbsContainer.append('<div class="bottom pagination"></div>').find('div.bottom');
528
+ else
529
+ $bottomPager.empty();
530
+
531
+ this.buildPager($bottomPager);
532
+ }
533
+
534
+ var startIndex = this.currentPage*this.settings.numThumbs;
535
+ var stopIndex = startIndex+this.settings.numThumbs-1;
536
+ if (stopIndex >= this.data.length)
537
+ stopIndex = this.data.length-1;
538
+
539
+ // Show/Hide thumbs
540
+ var $thumbsUl = this.$thumbsContainer.find('ul.thumbs');
541
+ $thumbsUl.find('li').each(function(i) {
542
+ var $li = $(this);
543
+ if (i >= startIndex && i <= stopIndex) {
544
+ $li.show();
545
+ } else {
546
+ $li.hide();
547
+ }
548
+ });
549
+
550
+ // Remove the noscript class from the thumbs container ul
551
+ $thumbsUl.removeClass('noscript');
552
+
553
+ return this;
554
+ },
555
+
556
+ buildPager: function(pager) {
557
+ var gallery = this;
558
+ var startIndex = this.currentPage*this.settings.numThumbs;
559
+
560
+ // Prev Page Link
561
+ if (this.currentPage > 0) {
562
+ var prevPage = startIndex - this.settings.numThumbs;
563
+ pager.append('<a rel="history" href="#'+this.data[prevPage].hash+'" title="'+this.settings.prevPageLinkText+'">'+this.settings.prevPageLinkText+'</a>');
564
+ }
565
+
566
+ // Page Index Links
567
+ for (i=this.currentPage-3; i<=this.currentPage+3; i++) {
568
+ var pageNum = i+1;
569
+
570
+ if (i == this.currentPage)
571
+ pager.append('<span class="current">'+pageNum+'</span>');
572
+ else if (i>=0 && i<this.numPages) {
573
+ var imageIndex = i*this.settings.numThumbs;
574
+ pager.append('<a rel="history" href="#'+this.data[imageIndex].hash+'" title="'+pageNum+'">'+pageNum+'</a>');
575
+ }
576
+ }
577
+
578
+ // Next Page Link
579
+ var nextPage = startIndex+this.settings.numThumbs;
580
+ if (nextPage < this.data.length) {
581
+ pager.append('<a rel="history" href="#'+this.data[nextPage].hash+'" title="'+this.settings.nextPageLinkText+'">'+this.settings.nextPageLinkText+'</a>');
582
+ }
583
+
584
+ pager.find('a').click(function(e) {
585
+ clickHandler(e, gallery, this);
586
+ });
587
+
588
+ return this;
589
+ }
590
+ });
591
+
592
+ // Now initialize the gallery
593
+ this.settings = $.extend({}, defaults, settings);
594
+ //enableHistory = this.settings.enableHistory; // Ghismo
595
+
596
+ if (this.interval)
597
+ clearInterval(this.interval);
598
+
599
+ this.interval = 0;
600
+
601
+ if (this.settings.imageContainerSel) this.$imageContainer = $(this.settings.imageContainerSel);
602
+ if (this.settings.captionContainerSel) this.$captionContainer = $(this.settings.captionContainerSel);
603
+ if (this.settings.loadingContainerSel) this.$loadingContainer = $(this.settings.loadingContainerSel);
604
+
605
+ // Setup the jQuery object holding each container that will be transitioned
606
+ this.$transitionContainers = $([]);
607
+ if (this.$imageContainer)
608
+ this.$transitionContainers = this.$transitionContainers.add(this.$imageContainer);
609
+ if (this.$captionContainer)
610
+ this.$transitionContainers = this.$transitionContainers.add(this.$captionContainer);
611
+
612
+ // Set the hash index offset for this gallery
613
+ this.offset = galleryOffset;
614
+
615
+ this.$thumbsContainer = $(thumbsContainerSel);
616
+ this.initializeThumbs();
617
+
618
+ // Add this gallery to the global galleries array
619
+ registerGallery(this);
620
+
621
+ this.numPages = Math.ceil(this.data.length/this.settings.numThumbs);
622
+ this.currentPage = -1;
623
+ this.currentIndex = 0;
624
+ var gallery = this;
625
+
626
+ // Hide the loadingContainer
627
+ if (this.$loadingContainer)
628
+ this.$loadingContainer.hide();
629
+
630
+ // Setup controls
631
+ if (this.settings.controlsContainerSel) {
632
+ this.$controlsContainer = $(this.settings.controlsContainerSel).empty();
633
+
634
+ if (this.settings.renderSSControls) {
635
+ if (this.settings.autoStart) {
636
+ this.$controlsContainer
637
+ .append('<div class="ss-controls"><a href="#pause" class="pause" title="'+this.settings.pauseLinkText+'">'+this.settings.pauseLinkText+'</a></div>');
638
+ } else {
639
+ this.$controlsContainer
640
+ .append('<div class="ss-controls"><a href="#play" class="play" title="'+this.settings.playLinkText+'">'+this.settings.playLinkText+'</a></div>');
641
+ }
642
+
643
+ this.$controlsContainer.find('div.ss-controls a')
644
+ .click(function(e) {
645
+ gallery.toggleSlideshow();
646
+ e.preventDefault();
647
+ return false;
648
+ });
649
+ }
650
+
651
+ if (this.settings.renderNavControls) {
652
+ var $navControls = this.$controlsContainer
653
+ .append('<div class="nav-controls"><a class="prev" rel="history" title="'+this.settings.prevLinkText+'">'+this.settings.prevLinkText+'</a><a class="next" rel="history" title="'+this.settings.nextLinkText+'">'+this.settings.nextLinkText+'</a></div>')
654
+ .find('div.nav-controls a')
655
+ .click(function(e) {
656
+ clickHandler(e, gallery, this);
657
+ });
658
+ }
659
+ }
660
+
661
+ // Initialize history only once when the first gallery on the page is initialized
662
+ historyInit();
663
+
664
+ // Build image
665
+ var hash = getHash();
666
+ var hashGallery = (hash >= 0) ? getGallery(hash) : 0;
667
+ var gotoIndex = (hashGallery && this == hashGallery) ? (hash-this.offset) : 0;
668
+ this.goto(gotoIndex);
669
+
670
+ if (this.settings.autoStart) {
671
+
672
+ setTimeout(function() { gallery.play(); }, this.settings.delay);
673
+ }
674
+
675
+ // Kickoff Image Preloader after 1 second
676
+ setTimeout(function() { gallery.preloadInit(); }, 1000);
677
+
678
+ return this;
679
+ };
680
+ })(jQuery);
skin/frontend/base/default/gallery/js/jquery.rating.js ADDED
@@ -0,0 +1,376 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ ### jQuery Star Rating Plugin v4.11 - 2013-03-14 ###
3
+ * Home: http://www.fyneworks.com/jquery/star-rating/
4
+ * Code: http://code.google.com/p/jquery-star-rating-plugin/
5
+ *
6
+ * Licensed under http://en.wikipedia.org/wiki/MIT_License
7
+ ###
8
+ */
9
+
10
+ /*# AVOID COLLISIONS #*/
11
+ ;if(window.jQuery) (function($){
12
+ /*# AVOID COLLISIONS #*/
13
+
14
+ // IE6 Background Image Fix
15
+ if ((!$.support.opacity && !$.support.style)) try { document.execCommand("BackgroundImageCache", false, true)} catch(e) { };
16
+ // Thanks to http://www.visualjquery.com/rating/rating_redux.html
17
+
18
+ // plugin initialization
19
+ $.fn.rating = function(options){
20
+ if(this.length==0) return this; // quick fail
21
+
22
+ // Handle API methods
23
+ if(typeof arguments[0]=='string'){
24
+ // Perform API methods on individual elements
25
+ if(this.length>1){
26
+ var args = arguments;
27
+ return this.each(function(){
28
+ $.fn.rating.apply($(this), args);
29
+ });
30
+ };
31
+ // Invoke API method handler
32
+ $.fn.rating[arguments[0]].apply(this, $.makeArray(arguments).slice(1) || []);
33
+ // Quick exit...
34
+ return this;
35
+ };
36
+
37
+ // Initialize options for this call
38
+ var options = $.extend(
39
+ {}/* new object */,
40
+ $.fn.rating.options/* default options */,
41
+ options || {} /* just-in-time options */
42
+ );
43
+
44
+ // Allow multiple controls with the same name by making each call unique
45
+ $.fn.rating.calls++;
46
+
47
+ // loop through each matched element
48
+ this
49
+ .not('.star-rating-applied')
50
+ .addClass('star-rating-applied')
51
+ .each(function(){
52
+
53
+ // Load control parameters / find context / etc
54
+ var control, input = $(this);
55
+ var eid = (this.name || 'unnamed-rating').replace(/\[|\]/g, '_').replace(/^\_+|\_+$/g,'');
56
+ var context = $(this.form || document.body);
57
+
58
+ // FIX: http://code.google.com/p/jquery-star-rating-plugin/issues/detail?id=23
59
+ var raters = context.data('rating');
60
+ if(!raters || raters.call!=$.fn.rating.calls) raters = { count:0, call:$.fn.rating.calls };
61
+ var rater = raters[eid] || context.data('rating'+eid);
62
+
63
+ // if rater is available, verify that the control still exists
64
+ if(rater) control = rater.data('rating');
65
+
66
+ if(rater && control)//{// save a byte!
67
+ // add star to control if rater is available and the same control still exists
68
+ control.count++;
69
+
70
+ //}// save a byte!
71
+ else{
72
+ // create new control if first star or control element was removed/replaced
73
+
74
+ // Initialize options for this rater
75
+ control = $.extend(
76
+ {}/* new object */,
77
+ options || {} /* current call options */,
78
+ ($.metadata? input.metadata(): ($.meta?input.data():null)) || {}, /* metadata options */
79
+ { count:0, stars: [], inputs: [] }
80
+ );
81
+
82
+ // increment number of rating controls
83
+ control.serial = raters.count++;
84
+
85
+ // create rating element
86
+ rater = $('<span class="star-rating-control"/>');
87
+ input.before(rater);
88
+
89
+ // Mark element for initialization (once all stars are ready)
90
+ rater.addClass('rating-to-be-drawn');
91
+
92
+ // Accept readOnly setting from 'disabled' property
93
+ if(input.attr('disabled') || input.hasClass('disabled')) control.readOnly = true;
94
+
95
+ // Accept required setting from class property (class='required')
96
+ if(input.hasClass('required')) control.required = true;
97
+
98
+ // Create 'cancel' button
99
+ rater.append(
100
+ control.cancel = $('<div class="rating-cancel"><a title="' + control.cancel + '">' + control.cancelValue + '</a></div>')
101
+ .on('mouseover',function(){
102
+ $(this).rating('drain');
103
+ $(this).addClass('star-rating-hover');
104
+ //$(this).rating('focus');
105
+ })
106
+ .on('mouseout',function(){
107
+ $(this).rating('draw');
108
+ $(this).removeClass('star-rating-hover');
109
+ //$(this).rating('blur');
110
+ })
111
+ .on('click',function(){
112
+ $(this).rating('select');
113
+ })
114
+ .data('rating', control)
115
+ );
116
+
117
+ }; // first element of group
118
+
119
+ // insert rating star (thanks Jan Fanslau rev125 for blind support https://code.google.com/p/jquery-star-rating-plugin/issues/detail?id=125)
120
+ var star = $('<div role="text" aria-label="'+ this.title +'" class="star-rating rater-'+ control.serial +'"><a title="' + (this.title || this.value) + '">' + this.value + '</a></div>');
121
+ rater.append(star);
122
+
123
+ // inherit attributes from input element
124
+ if(this.id) star.attr('id', this.id);
125
+ if(this.className) star.addClass(this.className);
126
+
127
+ // Half-stars?
128
+ if(control.half) control.split = 2;
129
+
130
+ // Prepare division control
131
+ if(typeof control.split=='number' && control.split>0){
132
+ var stw = ($.fn.width ? star.width() : 0) || control.starWidth;
133
+ var spi = (control.count % control.split), spw = Math.floor(stw/control.split);
134
+ star
135
+ // restrict star's width and hide overflow (already in CSS)
136
+ .width(spw)
137
+ // move the star left by using a negative margin
138
+ // this is work-around to IE's stupid box model (position:relative doesn't work)
139
+ .find('a').css({ 'margin-left':'-'+ (spi*spw) +'px' })
140
+ };
141
+
142
+ // readOnly?
143
+ if(control.readOnly)//{ //save a byte!
144
+ // Mark star as readOnly so user can customize display
145
+ star.addClass('star-rating-readonly');
146
+ //} //save a byte!
147
+ else//{ //save a byte!
148
+ // Enable hover css effects
149
+ star.addClass('star-rating-live')
150
+ // Attach mouse events
151
+ .on('mouseover',function(){
152
+ $(this).rating('fill');
153
+ $(this).rating('focus');
154
+ })
155
+ .on('mouseout',function(){
156
+ $(this).rating('draw');
157
+ $(this).rating('blur');
158
+ })
159
+ .on('click',function(){
160
+ $(this).rating('select');
161
+ })
162
+ ;
163
+ //}; //save a byte!
164
+
165
+ // set current selection
166
+ if(this.checked) control.current = star;
167
+
168
+ // set current select for links
169
+ if(this.nodeName=="A"){
170
+ if($(this).hasClass('selected'))
171
+ control.current = star;
172
+ };
173
+
174
+ // hide input element
175
+ input.hide();
176
+
177
+ // backward compatibility, form element to plugin
178
+ input.on('change.rating',function(event){
179
+ if(event.selfTriggered) return false;
180
+ $(this).rating('select');
181
+ });
182
+
183
+ // attach reference to star to input element and vice-versa
184
+ star.data('rating.input', input.data('rating.star', star));
185
+
186
+ // store control information in form (or body when form not available)
187
+ control.stars[control.stars.length] = star[0];
188
+ control.inputs[control.inputs.length] = input[0];
189
+ control.rater = raters[eid] = rater;
190
+ control.context = context;
191
+
192
+ input.data('rating', control);
193
+ rater.data('rating', control);
194
+ star.data('rating', control);
195
+ context.data('rating', raters);
196
+ context.data('rating'+eid, rater); // required for ajax forms
197
+ }); // each element
198
+
199
+ // Initialize ratings (first draw)
200
+ $('.rating-to-be-drawn').rating('draw').removeClass('rating-to-be-drawn');
201
+
202
+ return this; // don't break the chain...
203
+ };
204
+
205
+ /*--------------------------------------------------------*/
206
+
207
+ /*
208
+ ### Core functionality and API ###
209
+ */
210
+ $.extend($.fn.rating, {
211
+ // Used to append a unique serial number to internal control ID
212
+ // each time the plugin is invoked so same name controls can co-exist
213
+ calls: 0,
214
+
215
+ focus: function(){
216
+ var control = this.data('rating'); if(!control) return this;
217
+ if(!control.focus) return this; // quick fail if not required
218
+ // find data for event
219
+ var input = $(this).data('rating.input') || $( this.tagName=='INPUT' ? this : null );
220
+ // focus handler, as requested by focusdigital.co.uk
221
+ if(control.focus) control.focus.apply(input[0], [input.val(), $('a', input.data('rating.star'))[0]]);
222
+ }, // $.fn.rating.focus
223
+
224
+ blur: function(){
225
+ var control = this.data('rating'); if(!control) return this;
226
+ if(!control.blur) return this; // quick fail if not required
227
+ // find data for event
228
+ var input = $(this).data('rating.input') || $( this.tagName=='INPUT' ? this : null );
229
+ // blur handler, as requested by focusdigital.co.uk
230
+ if(control.blur) control.blur.apply(input[0], [input.val(), $('a', input.data('rating.star'))[0]]);
231
+ }, // $.fn.rating.blur
232
+
233
+ fill: function(){ // fill to the current mouse position.
234
+ var control = this.data('rating'); if(!control) return this;
235
+ // do not execute when control is in read-only mode
236
+ if(control.readOnly) return;
237
+ // Reset all stars and highlight them up to this element
238
+ this.rating('drain');
239
+ this.prevAll().addBack().filter('.rater-'+ control.serial).addClass('star-rating-hover');
240
+ },// $.fn.rating.fill
241
+
242
+ drain: function() { // drain all the stars.
243
+ var control = this.data('rating'); if(!control) return this;
244
+ // do not execute when control is in read-only mode
245
+ if(control.readOnly) return;
246
+ // Reset all stars
247
+ control.rater.children().filter('.rater-'+ control.serial).removeClass('star-rating-on').removeClass('star-rating-hover');
248
+ },// $.fn.rating.drain
249
+
250
+ draw: function(){ // set value and stars to reflect current selection
251
+ var control = this.data('rating'); if(!control) return this;
252
+ // Clear all stars
253
+ this.rating('drain');
254
+ // Set control value
255
+ var current = $( control.current );//? control.current.data('rating.input') : null );
256
+ var starson = current.length ? current.prevAll().addBack().filter('.rater-'+ control.serial) : null;
257
+ if(starson) starson.addClass('star-rating-on');
258
+ // Show/hide 'cancel' button
259
+ control.cancel[control.readOnly || control.required?'hide':'show']();
260
+ // Add/remove read-only classes to remove hand pointer
261
+ this.siblings()[control.readOnly?'addClass':'removeClass']('star-rating-readonly');
262
+ },// $.fn.rating.draw
263
+
264
+
265
+
266
+
267
+
268
+ select: function(value,wantCallBack){ // select a value
269
+ var control = this.data('rating'); if(!control) return this;
270
+ // do not execute when control is in read-only mode
271
+ if(control.readOnly) return;
272
+ // clear selection
273
+ control.current = null;
274
+ // programmatically (based on user input)
275
+ if(typeof value!='undefined' || this.length>1){
276
+ // select by index (0 based)
277
+ if(typeof value=='number')
278
+ return $(control.stars[value]).rating('select',undefined,wantCallBack);
279
+ // select by literal value (must be passed as a string
280
+ if(typeof value=='string'){
281
+ //return
282
+ $.each(control.stars, function(){
283
+ //console.log($(this).data('rating.input'), $(this).data('rating.input').val(), value, $(this).data('rating.input').val()==value?'BINGO!':'');
284
+ if($(this).data('rating.input').val()==value) $(this).rating('select',undefined,wantCallBack);
285
+ });
286
+ // don't break the chain
287
+ return this;
288
+ };
289
+ }
290
+ else{
291
+ control.current = this[0].tagName=='INPUT' ?
292
+ this.data('rating.star') :
293
+ (this.is('.rater-'+ control.serial) ? this : null);
294
+ };
295
+ // Update rating control state
296
+ this.data('rating', control);
297
+ // Update display
298
+ this.rating('draw');
299
+ // find current input and its sibblings
300
+ var current = $( control.current ? control.current.data('rating.input') : null );
301
+ var lastipt = $( control.inputs ).filter(':checked');
302
+ var deadipt = $( control.inputs ).not(current);
303
+ // check and uncheck elements as required
304
+ deadipt.prop('checked',false);//.removeAttr('checked');
305
+ current.prop('checked',true);//.attr('checked','checked');
306
+ // trigger change on current or last selected input
307
+ $(current.length? current : lastipt ).trigger({ type:'change', selfTriggered:true });
308
+ // click callback, as requested here: http://plugins.jquery.com/node/1655
309
+ if((wantCallBack || wantCallBack == undefined) && control.callback) control.callback.apply(current[0], [current.val(), $('a', control.current)[0]]);// callback event
310
+ // don't break the chain
311
+ return this;
312
+ },// $.fn.rating.select
313
+
314
+
315
+
316
+
317
+
318
+ readOnly: function(toggle, disable){ // make the control read-only (still submits value)
319
+ var control = this.data('rating'); if(!control) return this;
320
+ // setread-only status
321
+ control.readOnly = toggle || toggle==undefined ? true : false;
322
+ // enable/disable control value submission
323
+ if(disable) $(control.inputs).attr("disabled", "disabled");
324
+ else $(control.inputs).removeAttr("disabled");
325
+ // Update rating control state
326
+ this.data('rating', control);
327
+ // Update display
328
+ this.rating('draw');
329
+ },// $.fn.rating.readOnly
330
+
331
+ disable: function(){ // make read-only and never submit value
332
+ this.rating('readOnly', true, true);
333
+ },// $.fn.rating.disable
334
+
335
+ enable: function(){ // make read/write and submit value
336
+ this.rating('readOnly', false, false);
337
+ }// $.fn.rating.select
338
+
339
+ });
340
+
341
+ /*--------------------------------------------------------*/
342
+
343
+ /*
344
+ ### Default Settings ###
345
+ eg.: You can override default control like this:
346
+ $.fn.rating.options.cancel = 'Clear';
347
+ */
348
+ $.fn.rating.options = { //$.extend($.fn.rating, { options: {
349
+ cancel: 'Cancel Rating', // advisory title for the 'cancel' link
350
+ cancelValue: '', // value to submit when user click the 'cancel' link
351
+ split: 0, // split the star into how many parts?
352
+
353
+ // Width of star image in case the plugin can't work it out. This can happen if
354
+ // the jQuery.dimensions plugin is not available OR the image is hidden at installation
355
+ starWidth: 16//,
356
+
357
+ //NB.: These don't need to be pre-defined (can be undefined/null) so let's save some code!
358
+ //half: false, // just a shortcut to control.split = 2
359
+ //required: false, // disables the 'cancel' button so user can only select one of the specified values
360
+ //readOnly: false, // disable rating plugin interaction/ values cannot be.one('change', //focus: function(){}, // executed when stars are focused
361
+ //blur: function(){}, // executed when stars are focused
362
+ //callback: function(){}, // executed when a star is clicked
363
+ }; //} });
364
+
365
+ /*--------------------------------------------------------*/
366
+
367
+
368
+ // auto-initialize plugin
369
+ $(function(){
370
+ $('input[type=radio].star').rating();
371
+ });
372
+
373
+
374
+ /*# AVOID COLLISIONS #*/
375
+ })(jQuery);
376
+ /*# AVOID COLLISIONS #*/
skin/frontend/base/default/gallery/js/lightbox.js ADDED
@@ -0,0 +1,711 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -----------------------------------------------------------------------------------
2
+ //
3
+ // Lightbox Slideshow v1.2 (compatible with Prototype 1.6)
4
+ // by Justin Barkhuff - http://www.justinbarkhuff.com/lab/lightbox_slideshow/
5
+ // Updated: 2008-01-11
6
+ //
7
+ // Largely based on Lightbox v2.02
8
+ // by Lokesh Dhakar - http://huddletogether.com/projects/lightbox2/
9
+ // 3/31/06
10
+ //
11
+ // Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
12
+ //
13
+ // The code inserts html at the bottom of the page that looks similar to this:
14
+ //
15
+ // <div id="overlay"></div>
16
+ // <div id="lightbox">
17
+ // <div id="outerImageContainer">
18
+ // <div id="imageContainer">
19
+ // <img id="lightboxImage" />
20
+ // <div id="hoverNav">
21
+ // <a href="javascript:void(0);" id="prevLinkImg">&laquo; prev</a>
22
+ // <a href="javascript:void(0);" id="nextLinkImg">next &raquo;</a>
23
+ // </div>
24
+ // <div id="loading">
25
+ // <a href="javascript:void(0);" id="loadingLink">loading</a>
26
+ // </div>
27
+ // </div>
28
+ // </div>
29
+ // <div id="imageDataContainer">
30
+ // <div id="imageData">
31
+ // <div id="imageDetails">
32
+ // <span id="caption"></span>
33
+ // <span id="numberDisplay"></span>
34
+ // <span id="detailsNav">
35
+ // <a id="prevLinkDetails" href="javascript:void(0);">&laquo; prev</a>
36
+ // <a id="nextLinkDetails" href="javascript:void(0);">next &raquo;</a>
37
+ // <a id="slideShowControl" href="javascript:void(0);">stop slideshow</a>
38
+ // </span>
39
+ // </div>
40
+ // <div id="close">
41
+ // <a id="closeLink" href="javascript:void(0);">close</a>
42
+ // </div>
43
+ // </div>
44
+ // </div>
45
+ // </div>
46
+ //
47
+ // -----------------------------------------------------------------------------------
48
+
49
+ //
50
+ // Lightbox Object
51
+ //
52
+
53
+ var Lightbox = {
54
+ activeImage : null,
55
+ badObjects : ['select','object','embed'],
56
+ container : null,
57
+ enableSlideshow : null,
58
+ groupName : null,
59
+ imageArray : [],
60
+ options : null,
61
+ overlayDuration : null,
62
+ overlayOpacity : null,
63
+ playSlides : null,
64
+ refTags : ['a','area'],
65
+ relAttribute : null,
66
+ resizeDuration : null,
67
+ slideShowTimer : null,
68
+ startImage : null,
69
+
70
+ //
71
+ // initialize()
72
+ // Constructor sets class properties and configuration options and
73
+ // inserts html at the bottom of the page which is used to display the shadow
74
+ // overlay and the image container.
75
+ //
76
+ initialize: function(options) {
77
+ if (!document.getElementsByTagName){ return; }
78
+
79
+ this.options = $H({
80
+ animate : true, // resizing animations
81
+ autoPlay : true, // should slideshow start automatically
82
+ borderSize : 10, // if you adjust the padding in the CSS, you will need to update this variable
83
+ containerID : document, // lightbox container object
84
+ enableSlideshow : true, // enable slideshow feature
85
+ googleAnalytics : false, // track individual image views using Google Analytics
86
+ imageDataLocation : 'south', // location of image caption information
87
+ initImage : '', // ID of image link to automatically launch when upon script initialization
88
+ loop : true, // whether to continuously loop slideshow images
89
+ overlayDuration : .2, // time to fade in shadow overlay
90
+ overlayOpacity : .8, // transparency of shadow overlay
91
+ prefix : '', // ID prefix for all dynamically created html elements
92
+ relAttribute : 'lightbox', // specifies the rel attribute value that triggers lightbox
93
+ resizeSpeed : 4, // controls the speed of the image resizing (1=slowest and 10=fastest)
94
+ showGroupName : false, // show group name of images in image details
95
+ slideTime : 5, // time to display images during slideshow
96
+ strings : { // allows for localization
97
+ closeLink : 'close',
98
+ loadingMsg : 'loading',
99
+ nextLink : 'next &raquo;',
100
+ prevLink : '&laquo; prev',
101
+ startSlideshow : 'start slideshow',
102
+ stopSlideshow : 'stop slideshow',
103
+ numDisplayPrefix : 'Image',
104
+ numDisplaySeparator : 'of'
105
+ }
106
+ }).merge(options);
107
+
108
+ if(this.options.get('animate')){
109
+ this.overlayDuration = Math.max(this.options.get('overlayDuration'),0);
110
+ this.options.set('resizeSpeed',Math.max(Math.min(this.options.get('resizeSpeed'),10),1));
111
+ this.resizeDuration = (11 - this.options.get('resizeSpeed')) * 0.15;
112
+ }else{
113
+ this.overlayDuration = 0;
114
+ this.resizeDuration = 0;
115
+ }
116
+
117
+ this.enableSlideshow = this.options.get('enableSlideshow');
118
+ this.overlayOpacity = Math.max(Math.min(this.options.get('overlayOpacity'),1),0);
119
+ this.playSlides = this.options.get('autoPlay');
120
+ this.container = $(this.options.get('containerID'));
121
+ this.relAttribute = this.options.get('relAttribute');
122
+ this.updateImageList();
123
+
124
+ var objBody = this.container != document ? this.container : document.getElementsByTagName('body').item(0);
125
+
126
+ var objOverlay = document.createElement('div');
127
+ objOverlay.setAttribute('id',this.getID('overlay'));
128
+ objOverlay.style.display = 'none';
129
+ objBody.appendChild(objOverlay);
130
+ Event.observe(objOverlay,'click',this.end.bindAsEventListener(this));
131
+
132
+ var objLightbox = document.createElement('div');
133
+ objLightbox.setAttribute('id',this.getID('lightbox'));
134
+ objLightbox.style.display = 'none';
135
+ objBody.appendChild(objLightbox);
136
+
137
+ var objImageDataContainer = document.createElement('div');
138
+ objImageDataContainer.setAttribute('id',this.getID('imageDataContainer'));
139
+ objImageDataContainer.className = this.getID('clearfix');
140
+
141
+ var objImageData = document.createElement('div');
142
+ objImageData.setAttribute('id',this.getID('imageData'));
143
+ objImageDataContainer.appendChild(objImageData);
144
+
145
+ var objImageDetails = document.createElement('div');
146
+ objImageDetails.setAttribute('id',this.getID('imageDetails'));
147
+ objImageData.appendChild(objImageDetails);
148
+
149
+ var objCaption = document.createElement('span');
150
+ objCaption.setAttribute('id',this.getID('caption'));
151
+ objImageDetails.appendChild(objCaption);
152
+
153
+ var objContent = document.createElement('span');
154
+ objContent.setAttribute('id',this.getID('content'));
155
+ objImageDetails.appendChild(objContent);
156
+
157
+ var objNumberDisplay = document.createElement('span');
158
+ objNumberDisplay.setAttribute('id',this.getID('numberDisplay'));
159
+ objImageDetails.appendChild(objNumberDisplay);
160
+
161
+
162
+ var objDetailsNav = document.createElement('span');
163
+ objDetailsNav.setAttribute('id',this.getID('detailsNav'));
164
+ objImageDetails.appendChild(objDetailsNav);
165
+
166
+ var objPrevLink = document.createElement('a');
167
+ objPrevLink.setAttribute('id',this.getID('prevLinkDetails'));
168
+ objPrevLink.setAttribute('href','javascript:void(0);');
169
+ objPrevLink.innerHTML = this.options.get('strings').prevLink;
170
+ objDetailsNav.appendChild(objPrevLink);
171
+ Event.observe(objPrevLink,'click',this.showPrev.bindAsEventListener(this));
172
+
173
+ var objNextLink = document.createElement('a');
174
+ objNextLink.setAttribute('id',this.getID('nextLinkDetails'));
175
+ objNextLink.setAttribute('href','javascript:void(0);');
176
+ objNextLink.innerHTML = this.options.get('strings').nextLink;
177
+ objDetailsNav.appendChild(objNextLink);
178
+ Event.observe(objNextLink,'click',this.showNext.bindAsEventListener(this));
179
+
180
+ var objSlideShowControl = document.createElement('a');
181
+ objSlideShowControl.setAttribute('id',this.getID('slideShowControl'));
182
+ objSlideShowControl.setAttribute('href','javascript:void(0);');
183
+ objDetailsNav.appendChild(objSlideShowControl);
184
+ Event.observe(objSlideShowControl,'click',this.toggleSlideShow.bindAsEventListener(this));
185
+
186
+ var objClose = document.createElement('div');
187
+ objClose.setAttribute('id',this.getID('close'));
188
+ objImageData.appendChild(objClose);
189
+
190
+ var objCloseLink = document.createElement('a');
191
+ objCloseLink.setAttribute('id',this.getID('closeLink'));
192
+ objCloseLink.setAttribute('href','javascript:void(0);');
193
+ objCloseLink.innerHTML = this.options.get('strings').closeLink;
194
+ objClose.appendChild(objCloseLink);
195
+ Event.observe(objCloseLink,'click',this.end.bindAsEventListener(this));
196
+
197
+ if(this.options.get('imageDataLocation') == 'north'){
198
+ objLightbox.appendChild(objImageDataContainer);
199
+ }
200
+
201
+ var objOuterImageContainer = document.createElement('div');
202
+ objOuterImageContainer.setAttribute('id',this.getID('outerImageContainer'));
203
+ objLightbox.appendChild(objOuterImageContainer);
204
+
205
+ var objImageContainer = document.createElement('div');
206
+ objImageContainer.setAttribute('id',this.getID('imageContainer'));
207
+ objOuterImageContainer.appendChild(objImageContainer);
208
+
209
+ var objLightboxImage = document.createElement('img');
210
+ objLightboxImage.setAttribute('id',this.getID('lightboxImage'));
211
+ objImageContainer.appendChild(objLightboxImage);
212
+
213
+ var objHoverNav = document.createElement('div');
214
+ objHoverNav.setAttribute('id',this.getID('hoverNav'));
215
+ objImageContainer.appendChild(objHoverNav);
216
+
217
+ var objPrevLinkImg = document.createElement('a');
218
+ objPrevLinkImg.setAttribute('id',this.getID('prevLinkImg'));
219
+ objPrevLinkImg.setAttribute('href','javascript:void(0);');
220
+ objHoverNav.appendChild(objPrevLinkImg);
221
+ Event.observe(objPrevLinkImg,'click',this.showPrev.bindAsEventListener(this));
222
+
223
+ var objNextLinkImg = document.createElement('a');
224
+ objNextLinkImg.setAttribute('id',this.getID('nextLinkImg'));
225
+ objNextLinkImg.setAttribute('href','javascript:void(0);');
226
+ objHoverNav.appendChild(objNextLinkImg);
227
+ Event.observe(objNextLinkImg,'click',this.showNext.bindAsEventListener(this));
228
+
229
+ var objLoading = document.createElement('div');
230
+ objLoading.setAttribute('id',this.getID('loading'));
231
+ objImageContainer.appendChild(objLoading);
232
+
233
+ var objLoadingLink = document.createElement('a');
234
+ objLoadingLink.setAttribute('id',this.getID('loadingLink'));
235
+ objLoadingLink.setAttribute('href','javascript:void(0);');
236
+ objLoadingLink.innerHTML = this.options.get('strings').loadingMsg;
237
+ objLoading.appendChild(objLoadingLink);
238
+ Event.observe(objLoadingLink,'click',this.end.bindAsEventListener(this));
239
+
240
+ if(this.options.get('imageDataLocation') != 'north'){
241
+ objLightbox.appendChild(objImageDataContainer);
242
+ }
243
+
244
+ if(this.options.get('initImage') != ''){
245
+ this.start($(this.options.get('initImage')));
246
+ }
247
+ },
248
+
249
+ //
250
+ // updateImageList()
251
+ // Loops through specific tags within 'container' looking for
252
+ // 'lightbox' references and applies onclick events to them.
253
+ //
254
+ updateImageList: function(){
255
+ var el, els, rel;
256
+ for(var i=0; i < this.refTags.length; i++){
257
+ els = this.container.getElementsByTagName(this.refTags[i]);
258
+ for(var j=0; j < els.length; j++){
259
+ el = els[j];
260
+ rel = String(el.getAttribute('rel'));
261
+ if (el.getAttribute('href') && (rel.toLowerCase().match(this.relAttribute))){
262
+ el.onclick = function(){Lightbox.start(this); return false;}
263
+ }
264
+ }
265
+ }
266
+ },
267
+
268
+ //
269
+ // start()
270
+ // Display overlay and lightbox. If image is part of a set, add siblings to imageArray.
271
+ //
272
+ start: function(imageLink) {
273
+
274
+ this.hideBadObjects();
275
+
276
+ // stretch overlay to fill page and fade in
277
+ var pageSize = this.getPageSize();
278
+ $(this.getID('overlay')).setStyle({height:pageSize.pageHeight+'px'});
279
+ new Effect.Appear(this.getID('overlay'), { duration: this.overlayDuration, from: 0, to: this.overlayOpacity });
280
+
281
+ this.imageArray = [];
282
+ this.groupName = null;
283
+
284
+ var rel = imageLink.getAttribute('rel');
285
+ var imageTitle = '';
286
+
287
+ // if image is NOT part of a group..
288
+ if(rel == this.relAttribute){
289
+ // add single image to imageArray
290
+ imageTitle = imageLink.getAttribute('title') ? imageLink.getAttribute('title') : '';
291
+ this.imageArray.push({'link':imageLink.getAttribute('href'), 'title':imageTitle, 'content':imageLink.getAttribute('data-content')});
292
+ this.startImage = 0;
293
+ } else {
294
+ // if image is part of a group..
295
+ var els = this.container.getElementsByTagName(imageLink.tagName);
296
+ // loop through anchors, find other images in group, and add them to imageArray
297
+ for (var i=0; i<els.length; i++){
298
+ var el = els[i];
299
+ if (el.getAttribute('href') && (el.getAttribute('rel') == rel)){
300
+ imageTitle = el.getAttribute('title') ? el.getAttribute('title') : '';
301
+ this.imageArray.push({'link':el.getAttribute('href'),'title':imageTitle,'content':el.getAttribute('data-content')});
302
+ if(el == imageLink){
303
+ this.startImage = this.imageArray.length-1;
304
+ }
305
+ }
306
+ }
307
+ // get group name
308
+ this.groupName = rel.substring(this.relAttribute.length+1,rel.length-1);
309
+ }
310
+
311
+ // calculate top offset for the lightbox and display
312
+ var pageScroll = this.getPageScroll();
313
+ var lightboxTop = pageScroll.y + (pageSize.winHeight / 15);
314
+
315
+ $(this.getID('lightbox')).setStyle({top:lightboxTop+'px'}).show();
316
+ this.changeImage(this.startImage);
317
+ },
318
+
319
+ //
320
+ // changeImage()
321
+ // Hide most elements and preload image in preparation for resizing image container.
322
+ //
323
+ changeImage: function(imageNum){
324
+ this.activeImage = imageNum;
325
+
326
+ this.disableKeyboardNav();
327
+ this.pauseSlideShow();
328
+
329
+ // hide elements during transition
330
+ $(this.getID('loading')).show();
331
+ $(this.getID('lightboxImage')).hide();
332
+ $(this.getID('hoverNav')).hide();
333
+ $(this.getID('imageDataContainer')).hide();
334
+ $(this.getID('numberDisplay')).hide();
335
+ $(this.getID('detailsNav')).hide();
336
+
337
+ var imgPreloader = new Image();
338
+
339
+ // once image is preloaded, resize image container
340
+ imgPreloader.onload=function(){
341
+ $(Lightbox.getID('lightboxImage')).src = imgPreloader.src;
342
+ Lightbox.resizeImageContainer(imgPreloader.width,imgPreloader.height);
343
+ }
344
+ imgPreloader.src = this.imageArray[this.activeImage].link;
345
+
346
+ if(this.options.get('googleAnalytics')){
347
+ urchinTracker(this.imageArray[this.activeImage].link);
348
+ }
349
+ },
350
+
351
+ //
352
+ // resizeImageContainer()
353
+ //
354
+ resizeImageContainer: function(imgWidth,imgHeight) {
355
+ // get current height and width
356
+ var cDims = $(this.getID('outerImageContainer')).getDimensions();
357
+
358
+ // scalars based on change from old to new
359
+ var xScale = ((imgWidth + (this.options.get('borderSize') * 2)) / cDims.width) * 100;
360
+ var yScale = ((imgHeight + (this.options.get('borderSize') * 2)) / cDims.height) * 100;
361
+
362
+ // calculate size difference between new and old image, and resize if necessary
363
+ var wDiff = (cDims.width - this.options.get('borderSize') * 2) - imgWidth;
364
+ var hDiff = (cDims.height - this.options.get('borderSize') * 2) - imgHeight;
365
+
366
+ if(!( hDiff == 0)){ new Effect.Scale(this.getID('outerImageContainer'), yScale, {scaleX: false, duration: this.resizeDuration, queue: 'front'}); }
367
+ if(!( wDiff == 0)){ new Effect.Scale(this.getID('outerImageContainer'), xScale, {scaleY: false, delay: this.resizeDuration, duration: this.resizeDuration}); }
368
+
369
+ // if new and old image are same size and no scaling transition is necessary,
370
+ // do a quick pause to prevent image flicker.
371
+ if((hDiff == 0) && (wDiff == 0)){
372
+ if(navigator.appVersion.indexOf('MSIE')!=-1){ this.pause(250); } else { this.pause(100);}
373
+ }
374
+
375
+ $(this.getID('prevLinkImg')).setStyle({height:imgHeight+'px'});
376
+ $(this.getID('nextLinkImg')).setStyle({height:imgHeight+'px'});
377
+ $(this.getID('imageDataContainer')).setStyle({width:(imgWidth+(this.options.get('borderSize') * 2))+'px'});
378
+
379
+ this.showImage();
380
+ },
381
+
382
+ //
383
+ // showImage()
384
+ // Display image and begin preloading neighbors.
385
+ //
386
+ showImage: function(){
387
+ $(this.getID('loading')).hide();
388
+ new Effect.Appear(this.getID('lightboxImage'), { duration: 0.5, queue: 'end', afterFinish: function(){ Lightbox.updateDetails(); } });
389
+ this.preloadNeighborImages();
390
+ },
391
+
392
+ //
393
+ // updateDetails()
394
+ // Display caption, image number, and bottom nav.
395
+ //
396
+ updateDetails: function() {
397
+ $(this.getID('caption')).show();
398
+ $(this.getID('caption')).update(this.imageArray[this.activeImage].title);
399
+ $(this.getID('content')).update(this.imageArray[this.activeImage].content);
400
+
401
+ // if image is part of set display 'Image x of y'
402
+ if(this.imageArray.length > 1){
403
+ var num_display = this.options.get('strings').numDisplayPrefix + ' ' + eval(this.activeImage + 1) + ' ' + this.options.get('strings').numDisplaySeparator + ' ' + this.imageArray.length;
404
+ if(this.options.get('showGroupName') && this.groupName != ''){
405
+ num_display += ' '+this.options.get('strings').numDisplaySeparator+' '+this.groupName;
406
+ }
407
+ $(this.getID('numberDisplay')).update(num_display).show();
408
+ if(!this.enableSlideshow){
409
+ $(this.getID('slideShowControl')).hide();
410
+ }
411
+ $(this.getID('detailsNav')).show();
412
+ }
413
+
414
+ new Effect.Parallel(
415
+ [ new Effect.SlideDown( this.getID('imageDataContainer'), { sync: true }),
416
+ new Effect.Appear(this.getID('imageDataContainer'), { sync: true }) ],
417
+ { duration:.65, afterFinish: function() { Lightbox.updateNav();} }
418
+ );
419
+ },
420
+
421
+ //
422
+ // updateNav()
423
+ // Display appropriate previous and next hover navigation.
424
+ //
425
+ updateNav: function() {
426
+ if(this.imageArray.length > 1){
427
+ $(this.getID('hoverNav')).show();
428
+ if(this.enableSlideshow){
429
+ if(this.playSlides){
430
+ this.startSlideShow();
431
+ } else {
432
+ this.stopSlideShow();
433
+ }
434
+ }
435
+ }
436
+ this.enableKeyboardNav();
437
+ },
438
+ //
439
+ // startSlideShow()
440
+ // Starts the slide show
441
+ //
442
+ startSlideShow: function(){
443
+ this.playSlides = true;
444
+ this.slideShowTimer = new PeriodicalExecuter(function(pe){ Lightbox.showNext(); pe.stop(); },this.options.get('slideTime'));
445
+ $(this.getID('slideShowControl')).update(this.options.get('strings').stopSlideshow);
446
+ },
447
+
448
+ //
449
+ // stopSlideShow()
450
+ // Stops the slide show
451
+ //
452
+ stopSlideShow: function(){
453
+ this.playSlides = false;
454
+ if(this.slideShowTimer){
455
+ this.slideShowTimer.stop();
456
+ }
457
+ $(this.getID('slideShowControl')).update(this.options.get('strings').startSlideshow);
458
+ },
459
+
460
+ //
461
+ // stopSlideShow()
462
+ // Stops the slide show
463
+ //
464
+ toggleSlideShow: function(){
465
+ if(this.playSlides){
466
+ this.stopSlideShow();
467
+ }else{
468
+ this.startSlideShow();
469
+ }
470
+ },
471
+
472
+ //
473
+ // pauseSlideShow()
474
+ // Pauses the slide show (doesn't change the value of this.playSlides)
475
+ //
476
+ pauseSlideShow: function(){
477
+ if(this.slideShowTimer){
478
+ this.slideShowTimer.stop();
479
+ }
480
+ },
481
+
482
+ //
483
+ // showNext()
484
+ // Display the next image in a group
485
+ //
486
+ showNext : function(){
487
+ if(this.imageArray.length > 1){
488
+ if(!this.options.get('loop') && ((this.activeImage == this.imageArray.length - 1 && this.startImage == 0) || (this.activeImage+1 == this.startImage))){
489
+ return this.end();
490
+ }
491
+ if(this.activeImage == this.imageArray.length - 1){
492
+ this.changeImage(0);
493
+ }else{
494
+ this.changeImage(this.activeImage+1);
495
+ }
496
+ }
497
+ },
498
+
499
+ //
500
+ // showPrev()
501
+ // Display the next image in a group
502
+ //
503
+ showPrev : function(){
504
+ if(this.imageArray.length > 1){
505
+ if(this.activeImage == 0){
506
+ this.changeImage(this.imageArray.length - 1);
507
+ }else{
508
+ this.changeImage(this.activeImage-1);
509
+ }
510
+ }
511
+ },
512
+
513
+ //
514
+ // showFirst()
515
+ // Display the first image in a group
516
+ //
517
+ showFirst : function(){
518
+ if(this.imageArray.length > 1){
519
+ this.changeImage(0);
520
+ }
521
+ },
522
+
523
+ //
524
+ // showFirst()
525
+ // Display the first image in a group
526
+ //
527
+ showLast : function(){
528
+ if(this.imageArray.length > 1){
529
+ this.changeImage(this.imageArray.length - 1);
530
+ }
531
+ },
532
+
533
+ //
534
+ // enableKeyboardNav()
535
+ //
536
+ enableKeyboardNav: function() {
537
+ document.onkeydown = this.keyboardAction;
538
+ },
539
+
540
+ //
541
+ // disableKeyboardNav()
542
+ //
543
+ disableKeyboardNav: function() {
544
+ document.onkeydown = '';
545
+ },
546
+
547
+ //
548
+ // keyboardAction()
549
+ //
550
+ keyboardAction: function(e) {
551
+ if (e == null) { // ie
552
+ keycode = event.keyCode;
553
+ } else { // mozilla
554
+ keycode = e.which;
555
+ }
556
+
557
+ key = String.fromCharCode(keycode).toLowerCase();
558
+
559
+ if(key == 'x' || key == 'o' || key == 'c'){ // close lightbox
560
+ Lightbox.end();
561
+ } else if(key == 'p' || key == '%'){ // display previous image
562
+ Lightbox.showPrev();
563
+ } else if(key == 'n' || key =='\''){ // display next image
564
+ Lightbox.showNext();
565
+ } else if(key == 'f'){ // display first image
566
+ Lightbox.showFirst();
567
+ } else if(key == 'l'){ // display last image
568
+ Lightbox.showLast();
569
+ } else if(key == 's'){ // toggle slideshow
570
+ if(Lightbox.imageArray.length > 0 && Lightbox.options.enableSlideshow){
571
+ Lightbox.toggleSlideShow();
572
+ }
573
+ }
574
+ },
575
+
576
+ //
577
+ // preloadNeighborImages()
578
+ // Preload previous and next images.
579
+ //
580
+ preloadNeighborImages: function(){
581
+ var nextImageID = this.imageArray.length - 1 == this.activeImage ? 0 : this.activeImage + 1;
582
+ nextImage = new Image();
583
+ nextImage.src = this.imageArray[nextImageID].link
584
+
585
+ var prevImageID = this.activeImage == 0 ? this.imageArray.length - 1 : this.activeImage - 1;
586
+ prevImage = new Image();
587
+ prevImage.src = this.imageArray[prevImageID].link;
588
+ },
589
+
590
+ //
591
+ // end()
592
+ //
593
+ end: function() {
594
+ this.disableKeyboardNav();
595
+ this.pauseSlideShow();
596
+ $(this.getID('lightbox')).hide();
597
+ new Effect.Fade(this.getID('overlay'), { duration:this.overlayDuration });
598
+ this.showBadObjects();
599
+ },
600
+
601
+ //
602
+ // showBadObjects()
603
+ //
604
+ showBadObjects: function (){
605
+ var els;
606
+ var tags = Lightbox.badObjects;
607
+ for(var i=0; i<tags.length; i++){
608
+ els = document.getElementsByTagName(tags[i]);
609
+ for(var j=0; j<els.length; j++){
610
+ $(els[j]).setStyle({visibility:'visible'});
611
+ }
612
+ }
613
+ },
614
+
615
+ //
616
+ // hideBadObjects()
617
+ //
618
+ hideBadObjects: function (){
619
+ var els;
620
+ var tags = Lightbox.badObjects;
621
+ for(var i=0; i<tags.length; i++){
622
+ els = document.getElementsByTagName(tags[i]);
623
+ for(var j=0; j<els.length; j++){
624
+ $(els[j]).setStyle({visibility:'hidden'});
625
+ }
626
+ }
627
+ },
628
+
629
+ //
630
+ // pause(numberMillis)
631
+ // Pauses code execution for specified time. Uses busy code, not good.
632
+ // Code from http://www.faqts.com/knowledge_base/view.phtml/aid/1602
633
+ //
634
+ pause: function(numberMillis) {
635
+ var now = new Date();
636
+ var exitTime = now.getTime() + numberMillis;
637
+ while(true){
638
+ now = new Date();
639
+ if (now.getTime() > exitTime)
640
+ return;
641
+ }
642
+ },
643
+
644
+ //
645
+ // getPageScroll()
646
+ // Returns array with x,y page scroll values.
647
+ // Core code from - quirksmode.org
648
+ //
649
+ getPageScroll: function(){
650
+ var x,y;
651
+ if (self.pageYOffset) {
652
+ x = self.pageXOffset;
653
+ y = self.pageYOffset;
654
+ } else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict
655
+ x = document.documentElement.scrollLeft;
656
+ y = document.documentElement.scrollTop;
657
+ } else if (document.body) {// all other Explorers
658
+ x = document.body.scrollLeft;
659
+ y = document.body.scrollTop;
660
+ }
661
+ return {x:x,y:y};
662
+ },
663
+
664
+ //
665
+ // getPageSize()
666
+ // Returns array with page width, height and window width, height
667
+ // Core code from - quirksmode.org
668
+ // Edit for Firefox by pHaez
669
+ //
670
+ getPageSize: function(){
671
+ var scrollX,scrollY,windowX,windowY,pageX,pageY;
672
+ if (window.innerHeight && window.scrollMaxY) {
673
+ scrollX = document.body.scrollWidth;
674
+ scrollY = window.innerHeight + window.scrollMaxY;
675
+ } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
676
+ scrollX = document.body.scrollWidth;
677
+ scrollY = document.body.scrollHeight;
678
+ } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
679
+ scrollX = document.body.offsetWidth;
680
+ scrollY = document.body.offsetHeight;
681
+ }
682
+
683
+ if (self.innerHeight) { // all except Explorer
684
+ windowX = self.innerWidth;
685
+ windowY = self.innerHeight;
686
+ } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
687
+ windowX = document.documentElement.clientWidth;
688
+ windowY = document.documentElement.clientHeight;
689
+ } else if (document.body) { // other Explorers
690
+ windowX = document.body.clientWidth;
691
+ windowY = document.body.clientHeight;
692
+ }
693
+
694
+ pageY = (scrollY < windowY) ? windowY : scrollY; // for small pages with total height less then height of the viewport
695
+ pageX = (scrollX < windowX) ? windowX : scrollX; // for small pages with total width less then width of the viewport
696
+
697
+ return {pageWidth:pageX,pageHeight:pageY,winWidth:windowX,winHeight:windowY};
698
+ },
699
+
700
+ //
701
+ // getID()
702
+ // Returns formatted Lightbox element ID
703
+ //
704
+ getID: function(id){
705
+ return this.options.get('prefix')+id;
706
+ }
707
+ }
708
+
709
+ // -----------------------------------------------------------------------------------
710
+
711
+ Event.observe(window,'load',function(){ Lightbox.initialize(); });