Version Notes
none
Download this release
Release Info
Developer | Wyomind |
Extension | Wyomind_Flashmediagallery |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Wyomind/Flashmediagallery/Block/Adminhtml/Catalog/Product/Helper/Form/Gallery/Content.php +25 -0
- app/code/community/Wyomind/Flashmediagallery/Block/Script.php +15 -0
- app/code/community/Wyomind/Flashmediagallery/Helper/Catalog/Image.php +43 -0
- app/code/community/Wyomind/Flashmediagallery/Model/Catalog/Product/Image.php +50 -0
- app/code/community/Wyomind/Flashmediagallery/Model/Observer.php +15 -0
- app/code/community/Wyomind/Flashmediagallery/Model/System/Config/Source/selectorAndSize.php +9 -0
- app/code/community/Wyomind/Flashmediagallery/controllers/Adminhtml/Catalog/Product/GalleryController.php +52 -0
- app/code/community/Wyomind/Flashmediagallery/etc/config.xml +131 -0
- app/code/community/Wyomind/Flashmediagallery/etc/system.xml +49 -0
- app/design/adminhtml/default/default/layout/flashmediagallery.xml +16 -0
- app/design/adminhtml/default/default/template/flashmediagallery/catalog/product/helper/gallery.phtml +129 -0
- app/design/frontend/default/default/layout/flashmediagallery.xml +16 -0
- app/etc/modules/Wyomind_Flashmediagallery.xml +17 -0
- lib/Varien/Data/Form/Element/Fmgscript.php +53 -0
- package.xml +18 -0
- skin/frontend/default/default/flashmediagallery/script.js +37 -0
app/code/community/Wyomind/Flashmediagallery/Block/Adminhtml/Catalog/Product/Helper/Form/Gallery/Content.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Wyomind_Flashmediagallery_Block_Adminhtml_Catalog_Product_Helper_Form_Gallery_Content extends Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content {
|
5 |
+
|
6 |
+
protected function _prepareLayout() {
|
7 |
+
$this->setChild('uploader', $this->getLayout()->createBlock('adminhtml/media_uploader')
|
8 |
+
);
|
9 |
+
|
10 |
+
$this->getUploader()->getConfig()
|
11 |
+
->setUrl(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/catalog_product_gallery/upload'))
|
12 |
+
->setFileField('image')
|
13 |
+
->setFilters(array(
|
14 |
+
'images' => array(
|
15 |
+
'label' => Mage::helper('adminhtml')->__('Images & flash (.gif, .jpg, .png, .flv, .swf'),
|
16 |
+
'files' => array('*.gif', '*.jpg', '*.png', '*.flv', '*.swf')
|
17 |
+
),
|
18 |
+
));
|
19 |
+
|
20 |
+
Mage::dispatchEvent('catalog_product_gallery_prepare_layout', array('block' => $this));
|
21 |
+
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
app/code/community/Wyomind/Flashmediagallery/Block/Script.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wyomind_Flashmediagallery_Block_Script extends Mage_Core_Block_Template {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
|
7 |
+
}
|
8 |
+
|
9 |
+
function _toHtml() {
|
10 |
+
|
11 |
+
|
12 |
+
return "<script type='text/javascript'>var fmg_selector='" . Mage::getStoreConfig("flashmediagallery/settings/selector") . "';</script>";
|
13 |
+
}
|
14 |
+
|
15 |
+
}
|
app/code/community/Wyomind/Flashmediagallery/Helper/Catalog/Image.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wyomind_Flashmediagallery_Helper_Catalog_Image extends Mage_Catalog_Helper_Image {
|
4 |
+
|
5 |
+
public function __toString() {
|
6 |
+
|
7 |
+
try {
|
8 |
+
|
9 |
+
$model = $this->_getModel();
|
10 |
+
|
11 |
+
if ($this->getImageFile()) {
|
12 |
+
$model->setBaseFile($this->getImageFile());
|
13 |
+
} else {
|
14 |
+
$model->setBaseFile($this->getProduct()->getData($model->getDestinationSubdir()));
|
15 |
+
}
|
16 |
+
if ($model->isMedia()){
|
17 |
+
|
18 |
+
return $model->getUrl();
|
19 |
+
}
|
20 |
+
if ($model->isCached()) {
|
21 |
+
return $model->getUrl();
|
22 |
+
} else {
|
23 |
+
if ($this->_scheduleRotate) {
|
24 |
+
$model->rotate($this->getAngle());
|
25 |
+
}
|
26 |
+
|
27 |
+
if ($this->_scheduleResize) {
|
28 |
+
$model->resize();
|
29 |
+
}
|
30 |
+
|
31 |
+
if ($this->getWatermark()) {
|
32 |
+
$model->setWatermark($this->getWatermark());
|
33 |
+
}
|
34 |
+
|
35 |
+
$url = $model->saveFile()->getUrl();
|
36 |
+
}
|
37 |
+
} catch (Exception $e) {
|
38 |
+
$url = Mage::getDesign()->getSkinUrl($this->getPlaceholder());
|
39 |
+
}
|
40 |
+
return $url;
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
app/code/community/Wyomind/Flashmediagallery/Model/Catalog/Product/Image.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Mage_Catalog
|
24 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Catalog product link model
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Catalog
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Wyomind_Flashmediagallery_Model_Catalog_Product_Image extends Mage_Catalog_Model_Product_Image {
|
36 |
+
|
37 |
+
public function isMedia() {
|
38 |
+
return (in_array(strtolower(pathinfo($this->_baseFile, PATHINFO_EXTENSION)), array('flv', 'gif', 'swf'))) ? true : false;
|
39 |
+
}
|
40 |
+
|
41 |
+
public function getUrl() {
|
42 |
+
$baseDir = Mage::getBaseDir();
|
43 |
+
$file = ($this->isMedia()) ? $this->_baseFile : $this->_newFile;
|
44 |
+
|
45 |
+
$path = str_replace($baseDir . DS, "", $file);
|
46 |
+
|
47 |
+
return Mage::getBaseUrl() . str_replace(DS, '/', $path);
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
app/code/community/Wyomind/Flashmediagallery/Model/Observer.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wyomind_Flashmediagallery_Model_Observer {
|
4 |
+
|
5 |
+
public function changeTemplate($observer) {
|
6 |
+
$block = $observer->getEvent()->getBlock();
|
7 |
+
|
8 |
+
if (get_class($block) == 'Wyomind_Flashmediagallery_Block_Adminhtml_Catalog_Product_Helper_Form_Gallery_Content') {
|
9 |
+
// consider getting the template name from configuration
|
10 |
+
$template = 'flashmediagallery/catalog/product/helper/gallery.phtml';
|
11 |
+
$block->setTemplate($template);
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
}
|
app/code/community/Wyomind/Flashmediagallery/Model/System/Config/Source/selectorAndSize.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wyomind_Flashmediagallery_Model_System_Config_Source_Selector {
|
4 |
+
|
5 |
+
public function toOptionArray(){
|
6 |
+
}
|
7 |
+
|
8 |
+
|
9 |
+
}
|
app/code/community/Wyomind/Flashmediagallery/controllers/Adminhtml/Catalog/Product/GalleryController.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wyomind_Flashmediagallery_Adminhtml_Catalog_Product_GalleryController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
public function uploadAction()
|
6 |
+
{
|
7 |
+
try {
|
8 |
+
$uploader = new Mage_Core_Model_File_Uploader('image');
|
9 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png','swf','flv'));
|
10 |
+
// $uploader->addValidateCallback('catalog_product_image',
|
11 |
+
// Mage::helper('catalog/image'), 'validateUploadFile');
|
12 |
+
$uploader->setAllowRenameFiles(true);
|
13 |
+
$uploader->setFilesDispersion(true);
|
14 |
+
$result = $uploader->save(
|
15 |
+
Mage::getSingleton('catalog/product_media_config')->getBaseTmpMediaPath()
|
16 |
+
);
|
17 |
+
|
18 |
+
Mage::dispatchEvent('catalog_product_gallery_upload_image_after', array(
|
19 |
+
'result' => $result,
|
20 |
+
'action' => $this
|
21 |
+
));
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Workaround for prototype 1.7 methods "isJSON", "evalJSON" on Windows OS
|
25 |
+
*/
|
26 |
+
$result['tmp_name'] = str_replace(DS, "/", $result['tmp_name']);
|
27 |
+
$result['path'] = str_replace(DS, "/", $result['path']);
|
28 |
+
|
29 |
+
$result['url'] = Mage::getSingleton('catalog/product_media_config')->getTmpMediaUrl($result['file']);
|
30 |
+
$result['file'] = $result['file'] . '.tmp';
|
31 |
+
$result['cookie'] = array(
|
32 |
+
'name' => session_name(),
|
33 |
+
'value' => $this->_getSession()->getSessionId(),
|
34 |
+
'lifetime' => $this->_getSession()->getCookieLifetime(),
|
35 |
+
'path' => $this->_getSession()->getCookiePath(),
|
36 |
+
'domain' => $this->_getSession()->getCookieDomain()
|
37 |
+
);
|
38 |
+
|
39 |
+
} catch (Exception $e) {
|
40 |
+
$result = array(
|
41 |
+
'error' => $e->getMessage(),
|
42 |
+
'errorcode' => $e->getCode());
|
43 |
+
}
|
44 |
+
|
45 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
46 |
+
}
|
47 |
+
|
48 |
+
protected function _isAllowed()
|
49 |
+
{
|
50 |
+
return Mage::getSingleton('admin/session')->isAllowed('catalog/products');
|
51 |
+
}
|
52 |
+
} // Class Mage_Adminhtml_Catalog_Product_GalleryController End
|
app/code/community/Wyomind/Flashmediagallery/etc/config.xml
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<Wyomind_Flashmediagallery>
|
6 |
+
<version>1.0.0</version>
|
7 |
+
</Wyomind_Flashmediagallery>
|
8 |
+
|
9 |
+
|
10 |
+
</modules>
|
11 |
+
<default>
|
12 |
+
<flashmediagallery>
|
13 |
+
<settings>
|
14 |
+
<selector>[{"selector":".catalog-category-view. product-image IMG","width":"135","height":"135"},{"selector":".catalog-product-view .product-image IMG","width":"265","height":"265"},{"selector":"#product-gallery-image","width":"450","height":"450"},{"selector":".product-image IMG","width":"100","height":"100"},{"selector":"","width":"","height":""},{"selector":"","width":"","height":""},{"selector":"","width":"","height":""},{"selector":"","width":"","height":""},{"selector":"","width":"","height":""},{"selector":"","width":"","height":""}]</selector>
|
15 |
+
</settings>
|
16 |
+
</flashmediagallery>
|
17 |
+
</default>
|
18 |
+
<global>
|
19 |
+
|
20 |
+
<blocks>
|
21 |
+
<flashmediagallery>
|
22 |
+
<class>Wyomind_Flashmediagallery_Block</class>
|
23 |
+
</flashmediagallery>
|
24 |
+
<adminhtml>
|
25 |
+
<rewrite>
|
26 |
+
<catalog_product_helper_form_gallery_content>Wyomind_Flashmediagallery_Block_Adminhtml_Catalog_Product_Helper_Form_Gallery_Content</catalog_product_helper_form_gallery_content>
|
27 |
+
</rewrite>
|
28 |
+
</adminhtml>
|
29 |
+
</blocks>
|
30 |
+
<rewrite>
|
31 |
+
|
32 |
+
<wyomind_flashmediagallery_adminhtml_catalog_product_gallery>
|
33 |
+
<from><![CDATA[#/admin/catalog_product_gallery/upload/#]]></from>
|
34 |
+
<to><![CDATA[/flashmediagallery/adminhtml_catalog_product_gallery/upload/]]></to>
|
35 |
+
</wyomind_flashmediagallery_adminhtml_catalog_product_gallery>
|
36 |
+
</rewrite>
|
37 |
+
<models>
|
38 |
+
<flashmediagallery>
|
39 |
+
<class>Wyomind_Flashmediagallery_Model</class>
|
40 |
+
</flashmediagallery>
|
41 |
+
<catalog>
|
42 |
+
<rewrite>
|
43 |
+
<product_image>wyomind_flashmediagallery_model_catalog_product_image</product_image>
|
44 |
+
</rewrite>
|
45 |
+
</catalog>
|
46 |
+
|
47 |
+
</models>
|
48 |
+
|
49 |
+
<helpers>
|
50 |
+
|
51 |
+
<catalog>
|
52 |
+
<rewrite>
|
53 |
+
<image>wyomind_flashmediagallery_helper_catalog_image</image>
|
54 |
+
</rewrite>
|
55 |
+
</catalog>
|
56 |
+
|
57 |
+
|
58 |
+
<flashmediagallery>
|
59 |
+
<class>Wyomind_Flashmediagallery_Helper</class>
|
60 |
+
</flashmediagallery>
|
61 |
+
</helpers>
|
62 |
+
</global>
|
63 |
+
<frontend>
|
64 |
+
<layout>
|
65 |
+
<updates>
|
66 |
+
<flashmediagallery>
|
67 |
+
<file>flashmediagallery.xml</file>
|
68 |
+
</flashmediagallery>
|
69 |
+
</updates>
|
70 |
+
</layout>
|
71 |
+
</frontend>
|
72 |
+
<admin>
|
73 |
+
<routers>
|
74 |
+
<flashmediagallery>
|
75 |
+
|
76 |
+
<use>admin</use>
|
77 |
+
<args>
|
78 |
+
<module>Wyomind_Flashmediagallery</module>
|
79 |
+
<frontName>flashmediagallery</frontName>
|
80 |
+
</args>
|
81 |
+
</flashmediagallery>
|
82 |
+
</routers>
|
83 |
+
</admin>
|
84 |
+
<adminhtml>
|
85 |
+
<events>
|
86 |
+
<adminhtml_block_html_before>
|
87 |
+
<observers>
|
88 |
+
<wyomind_flashmediagallery_template>
|
89 |
+
<type>model</type>
|
90 |
+
<class>Wyomind_Flashmediagallery_Model_Observer</class>
|
91 |
+
<method>changeTemplate</method>
|
92 |
+
</wyomind_flashmediagallery_template>
|
93 |
+
</observers>
|
94 |
+
|
95 |
+
|
96 |
+
</adminhtml_block_html_before>
|
97 |
+
</events>
|
98 |
+
<layout>
|
99 |
+
<updates>
|
100 |
+
<flashmediagallery>
|
101 |
+
<file>flashmediagallery.xml</file>
|
102 |
+
</flashmediagallery>
|
103 |
+
</updates>
|
104 |
+
</layout>
|
105 |
+
<acl>
|
106 |
+
<resources>
|
107 |
+
<all>
|
108 |
+
<title>Allow Everything</title>
|
109 |
+
</all>
|
110 |
+
<admin>
|
111 |
+
<children>
|
112 |
+
|
113 |
+
<system>
|
114 |
+
<children>
|
115 |
+
<config>
|
116 |
+
<children>
|
117 |
+
<flashmediagallery>
|
118 |
+
<title>Flash Media Gallery</title>
|
119 |
+
</flashmediagallery>
|
120 |
+
</children>
|
121 |
+
</config>
|
122 |
+
</children>
|
123 |
+
</system>
|
124 |
+
</children>
|
125 |
+
</admin>
|
126 |
+
</resources>
|
127 |
+
</acl>
|
128 |
+
|
129 |
+
</adminhtml>
|
130 |
+
|
131 |
+
</config>
|
app/code/community/Wyomind/Flashmediagallery/etc/system.xml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<WYOMIND translate="label">
|
5 |
+
<label>WYOMIND</label>
|
6 |
+
<sort_order>1000000</sort_order>
|
7 |
+
</WYOMIND>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<flashmediagallery translate="label">
|
11 |
+
<label>Flash Media Gallery</label>
|
12 |
+
<tab>WYOMIND</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>1001</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
|
20 |
+
<settings translate="label">
|
21 |
+
<label>Settings</label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<sort_order>110</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 |
+
|
29 |
+
<selector translate="label comment">
|
30 |
+
<label>Image selector</label>
|
31 |
+
<frontend_type>fmgscript</frontend_type>
|
32 |
+
<sort_order>0</sort_order>
|
33 |
+
<comment>
|
34 |
+
<![CDATA[<span class="notice">List of all css selectors that must be switched to a flash object + default width/height in pixel. </span>]]>
|
35 |
+
</comment>
|
36 |
+
<show_in_default>1</show_in_default>
|
37 |
+
<show_in_website>1</show_in_website>
|
38 |
+
<show_in_store>1</show_in_store>
|
39 |
+
</selector>
|
40 |
+
</fields>
|
41 |
+
</settings>
|
42 |
+
|
43 |
+
</groups>
|
44 |
+
</flashmediagallery>
|
45 |
+
|
46 |
+
</sections>
|
47 |
+
</config>
|
48 |
+
|
49 |
+
|
app/design/adminhtml/default/default/layout/flashmediagallery.xml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<layout version="0.1.0">
|
4 |
+
|
5 |
+
<adminhtml_catalog_product_edit>
|
6 |
+
<reference name="head">
|
7 |
+
|
8 |
+
<action method="addItem">
|
9 |
+
<type>skin_js</type>
|
10 |
+
<name>flashmediagallery/gallery.js</name>
|
11 |
+
</action>
|
12 |
+
</reference>
|
13 |
+
|
14 |
+
</adminhtml_catalog_product_edit>
|
15 |
+
|
16 |
+
</layout>
|
app/design/adminhtml/default/default/template/flashmediagallery/catalog/product/helper/gallery.phtml
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2012 Magento Inc. (http://www.magentocommerce.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 block Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content
|
30 |
+
*/
|
31 |
+
?>
|
32 |
+
<?php
|
33 |
+
$_block = $this;
|
34 |
+
/* @var $_block Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content */
|
35 |
+
?>
|
36 |
+
<div id="<?php echo $_block->getHtmlId() ?>" >
|
37 |
+
<ul class="messages">
|
38 |
+
<li class="notice-msg">
|
39 |
+
<ul>
|
40 |
+
<li>
|
41 |
+
<?php echo Mage::helper('catalog')->__('Image type and information need to be specified for each store view.'); ?>
|
42 |
+
</li>
|
43 |
+
</ul>
|
44 |
+
</li>
|
45 |
+
</ul>
|
46 |
+
<div class="grid">
|
47 |
+
<table cellspacing="0" class="data border" id="<?php echo $_block->getHtmlId() ?>_grid" width="100%">
|
48 |
+
<col width="1" />
|
49 |
+
<col />
|
50 |
+
<col width="70" />
|
51 |
+
<?php foreach ($_block->getImageTypes() as $typeId => $type): ?>
|
52 |
+
<col />
|
53 |
+
<?php endforeach; ?>
|
54 |
+
<col width="70" />
|
55 |
+
<col width="70" />
|
56 |
+
<thead>
|
57 |
+
<tr class="headings">
|
58 |
+
<th><?php echo Mage::helper('catalog')->__('Image') ?></th>
|
59 |
+
<th><?php echo Mage::helper('catalog')->__('Label') ?></th>
|
60 |
+
<th><?php echo Mage::helper('catalog')->__('Sort Order') ?></th>
|
61 |
+
<?php foreach ($_block->getImageTypes() as $typeId => $type): ?>
|
62 |
+
<th><?php echo $type['label'] ?></th>
|
63 |
+
<?php endforeach; ?>
|
64 |
+
<th><?php echo Mage::helper('catalog')->__('Exclude') ?></th>
|
65 |
+
<th class="last"><?php echo Mage::helper('catalog')->__('Remove') ?></th>
|
66 |
+
</tr>
|
67 |
+
</thead>
|
68 |
+
<tbody id="<?php echo $_block->getHtmlId() ?>_list">
|
69 |
+
<tr id="<?php echo $_block->getHtmlId() ?>_template" class="template no-display">
|
70 |
+
<td class="cell-image"><div class="place-holder" onmouseover="<?php echo $_block->getJsObjectName(); ?>.loadImage('__file__')"><span><?php echo Mage::helper('catalog')->__('Roll Over for preview') ?></span></div>
|
71 |
+
<embed src="<?php echo $this->getSkinUrl('images/spacer.swf') ?>" width="100" height="100" style="display:none;" alt="">
|
72 |
+
<img src="<?php echo $this->getSkinUrl('images/spacer.gif') ?>" width="100" style="display:none;" alt="" />
|
73 |
+
|
74 |
+
</td>
|
75 |
+
<td class="cell-label"><input type="text" <?php if ($_block->getElement()->getReadonly()): ?> disabled="disabled"<?php endif; ?> class="input-text" onkeyup="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" onchange="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>
|
76 |
+
<td class="cell-position"><input type="text" <?php if ($_block->getElement()->getReadonly()): ?> disabled="disabled"<?php endif; ?> class="input-text validate-number" onkeyup="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" onchange="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>
|
77 |
+
<?php foreach ($_block->getImageTypes() as $typeId => $type): ?>
|
78 |
+
<td class="cell-<?php echo $typeId ?> a-center"><input <?php if ($_block->getElement()->getAttributeReadonly($typeId)) : ?> disabled="disabled" <?php endif; ?> type="radio" name="<?php echo $type['field'] ?>" onclick="<?php echo $_block->getJsObjectName(); ?>.setProductImages('__file__')" value="__file__" /></td>
|
79 |
+
<?php endforeach; ?>
|
80 |
+
<td class="cell-disable a-center"><input type="checkbox" <?php if ($_block->getElement()->getReadonly()): ?> disabled="disabled"<?php endif; ?> onclick="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>
|
81 |
+
<td class="cell-remove a-center last"><input type="checkbox" <?php if ($_block->getElement()->getReadonly()): ?> disabled="disabled"<?php endif; ?> onclick="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>
|
82 |
+
</tr>
|
83 |
+
<?php if ($_block->hasUseDefault()): ?>
|
84 |
+
<tr id="<?php echo $_block->getHtmlId() ?>_default">
|
85 |
+
<td><?php echo Mage::helper('catalog')->__('Use Default Value') ?></td>
|
86 |
+
<td> </td>
|
87 |
+
<td> </td>
|
88 |
+
<?php foreach ($_block->getMediaAttributes() as $_attribute): ?>
|
89 |
+
<td class="a-center">
|
90 |
+
<?php if ($_block->getElement()->canDisplayUseDefault($_attribute)): ?>
|
91 |
+
<input class="default-checkbox" name="use_default[]" type="checkbox" <?php if ($_block->getElement()->getAttributeReadonly($_attribute->getAttributeCode())): ?> disabled="disabled" <?php endif; ?> onclick="<?php echo $_block->getJsObjectName(); ?>.updateUseDefault()"
|
92 |
+
<?php if ($_block->getElement()->usedDefault($_attribute)): ?>checked<?php endif; ?> value="<?php echo $_attribute->getAttributeCode() ?>" />
|
93 |
+
<?php endif ?>
|
94 |
+
</td>
|
95 |
+
<?php endforeach; ?>
|
96 |
+
<td> </td>
|
97 |
+
<td class="last"> </td>
|
98 |
+
</tr>
|
99 |
+
<?php endif ?>
|
100 |
+
<tr id="<?php echo $_block->getHtmlId() ?>-image-0">
|
101 |
+
<td class="cell-image"><?php echo Mage::helper('catalog')->__('No image') ?></td>
|
102 |
+
<td class="cell-label"><input type="hidden" /> </td>
|
103 |
+
<td class="cell-position"><input type="hidden" /> </td>
|
104 |
+
<?php foreach ($_block->getImageTypes() as $typeId => $type): ?>
|
105 |
+
<td class="cell-<?php echo $typeId ?> a-center"><input type="radio" <?php if ($_block->getElement()->getAttributeReadonly($typeId)) : ?> disabled="disabled" <?php endif; ?> name="<?php echo $type['field'] ?>" onclick="<?php echo $_block->getJsObjectName(); ?>.setProductImages('no_selection')" value="no_selection" /></td>
|
106 |
+
<?php endforeach; ?>
|
107 |
+
<td class="cell-disable"><input type="hidden" /> </td>
|
108 |
+
<td class="cell-remove last"><input type="hidden" /> </td>
|
109 |
+
</tr>
|
110 |
+
</tbody>
|
111 |
+
<?php if (!$_block->getElement()->getReadonly()): ?>
|
112 |
+
<tfoot>
|
113 |
+
<tr>
|
114 |
+
<td colspan="100" class="last" style="padding:8px">
|
115 |
+
<?php echo $_block->getUploaderHtml() ?>
|
116 |
+
</td>
|
117 |
+
</tr>
|
118 |
+
</tfoot>
|
119 |
+
<?php endif; ?>
|
120 |
+
</table>
|
121 |
+
</div>
|
122 |
+
</div>
|
123 |
+
<input type="hidden" id="<?php echo $_block->getHtmlId() ?>_save" name="<?php echo $_block->getElement()->getName() ?>[images]" value="<?php echo $_block->htmlEscape($_block->getImagesJson()) ?>" />
|
124 |
+
<input type="hidden" id="<?php echo $_block->getHtmlId() ?>_save_image" name="<?php echo $_block->getElement()->getName() ?>[values]" value="<?php echo $_block->htmlEscape($_block->getImagesValuesJson()) ?>" />
|
125 |
+
<script type="text/javascript">
|
126 |
+
//<![CDATA[
|
127 |
+
var <?php echo $_block->getJsObjectName(); ?> = new Product.Gallery('<?php echo $_block->getHtmlId() ?>', <?php if ($_block->getElement()->getReadonly()): ?>null<?php else: ?><?php echo $_block->getUploader()->getJsObjectName() ?><?php endif; ?>, <?php echo $_block->getImageTypesJson() ?>);
|
128 |
+
//]]>
|
129 |
+
</script>
|
app/design/frontend/default/default/layout/flashmediagallery.xml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<layout version="0.1.0">
|
4 |
+
|
5 |
+
<default>
|
6 |
+
<reference name="head">
|
7 |
+
|
8 |
+
<action method="addItem">
|
9 |
+
<type>skin_js</type>
|
10 |
+
<name>flashmediagallery/script.js</name>
|
11 |
+
</action>
|
12 |
+
<block type="flashmediagallery/script" name="flashmediagallery.script" as="flashmediagallery_script" after="-"/>
|
13 |
+
</reference>
|
14 |
+
</default>
|
15 |
+
|
16 |
+
</layout>
|
app/etc/modules/Wyomind_Flashmediagallery.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Wyomind
|
5 |
+
* @package Wyomind_Massstockupdate
|
6 |
+
* @author ModuleCreator
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Wyomind_Flashmediagallery>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>community</codePool>
|
15 |
+
</Wyomind_Flashmediagallery>
|
16 |
+
</modules>
|
17 |
+
</config>
|
lib/Varien/Data/Form/Element/Fmgscript.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Varien_Data_Form_Element_Fmgscript extends Varien_Data_Form_Element_Abstract {
|
4 |
+
|
5 |
+
public function __construct($attributes = array()) {
|
6 |
+
parent::__construct($attributes);
|
7 |
+
$this->setType('selectordimensions');
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Generates element html
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function getElementHtml() {
|
16 |
+
$data = json_decode($this->getValue());
|
17 |
+
|
18 |
+
$html = "<input type= 'hidden' class='' value='" . $this->getEscapedValue() . "' name='groups[settings][fields][selector][value]' id='flashmediagallery_settings_selector'/>";
|
19 |
+
$html .= "<table id='fmg-selectors'><thead><tr><th>#</th><th>css selector</th><th>width(px)</th><th>height(px)</th></tr></thead><tbody>";
|
20 |
+
for ($i = 0; $i < 10; $i++) {
|
21 |
+
$html.="<tr>"
|
22 |
+
. "<td>" . ($i + 1) . "</td>"
|
23 |
+
. "<td><input type='text' id='selector-" . ($i + 1) . "' style='width:250px' value='".$data[$i]->selector."'/></td>"
|
24 |
+
. "<td><input type='text' id='width-" . ($i + 1) . "' style='width:60px' value='".$data[$i]->width."'/></td>"
|
25 |
+
. "<td><input type='text' id='height-" . ($i + 1) . "' style='width:60px' value='".$data[$i]->height."'/></td>"
|
26 |
+
. "</tr>";
|
27 |
+
}
|
28 |
+
$html.= "</tbody></table>";
|
29 |
+
$html.="
|
30 |
+
<script>
|
31 |
+
document.observe('dom:loaded', function() {
|
32 |
+
|
33 |
+
$$('#fmg-selectors INPUT').each(function(e) {
|
34 |
+
|
35 |
+
e.observe('change', function() {
|
36 |
+
data=new Array;
|
37 |
+
$$('#fmg-selectors TBODY TR').each(function(tr){
|
38 |
+
tds=tr.select('INPUT');
|
39 |
+
data.push({selector:tds[0].getValue(),width:tds[1].getValue(),height:tds[2].getValue()});
|
40 |
+
|
41 |
+
})
|
42 |
+
flashmediagallery_settings_selector.value=Object.toJSON(data);
|
43 |
+
})
|
44 |
+
})
|
45 |
+
|
46 |
+
|
47 |
+
})</script>
|
48 |
+
|
49 |
+
";
|
50 |
+
return $html;
|
51 |
+
}
|
52 |
+
|
53 |
+
}
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Wyomind_Flashmediagallery</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Allow to add SWF files and animated GIFs into the product's gallery.</summary>
|
10 |
+
<description>This module is based on a js script that replace any swf file inserted in an image placeholder by an "embed" object.</description>
|
11 |
+
<notes>none</notes>
|
12 |
+
<authors><author><name>Wyomind</name><user>Pierre</user><email>contact@wyomind.com</email></author></authors>
|
13 |
+
<date>2014-08-08</date>
|
14 |
+
<time>14:32:42</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Wyomind"><dir name="Flashmediagallery"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Helper"><dir name="Form"><dir name="Gallery"><file name="Content.php" hash="c989ad476280ccbbb2de2cbbff0431d3"/></dir></dir></dir></dir></dir></dir><file name="Script.php" hash="76ca8c4ee75de15cc43b943222472a6c"/></dir><dir name="Helper"><dir name="Catalog"><file name="Image.php" hash="9ff40a69e51f46591a4991dd617ec73c"/></dir></dir><dir name="Model"><dir name="Catalog"><dir name="Product"><file name="Image.php" hash="2b64d41dff59542dc7a28ed482e65e89"/></dir></dir><file name="Observer.php" hash="08ca28e0fbeb379f00401dc559e9e787"/><dir name="System"><dir name="Config"><dir name="Source"><file name="selectorAndSize.php" hash="0616d43d50187ea1a5ef00be74411c32"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><file name="GalleryController.php" hash="f9a14e8b7509cedd209315b39c15910f"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="66a230662304fd4af9a0896be2fa95ee"/><file name="system.xml" hash="13b6540c74b5ec723303c19fa8f599a7"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wyomind_Flashmediagallery.xml" hash="bac7ccf2e4f4fab7ec79a40ef5e20f18"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="flashmediagallery.xml" hash="5eb87ce02a014eb125abb56897845f7b"/></dir><dir name="template"><dir name="flashmediagallery"><dir><dir name="catalog"><dir name="product"><dir name="helper"><file name="gallery.phtml" hash="c22f5360873bdf2be861a44f358ff733"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="flashmediagallery.xml" hash="52f5c7441d1a6666a506102e7d7ce0b8"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="flashmediagallery"><file name="script.js" hash="af011df138f884640f9e42a86db48ba0"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><file name="flashmediagallery" hash=""/></dir></dir></dir></target><target name="mage"><dir><dir name="lib"><dir name="Varien"><dir name="Data"><dir name="Form"><dir name="Element"><file name="Fmgscript.php" hash="82c8f4e2e54151c23fc40286d57efc7a"/></dir></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>4.0.0</min><max>5.6.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/frontend/default/default/flashmediagallery/script.js
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
document.observe("dom:loaded", function() {
|
4 |
+
|
5 |
+
data = fmg_selector.evalJSON();
|
6 |
+
paths = new Array;
|
7 |
+
data.each(function(s) {
|
8 |
+
if (s.selector != "") {
|
9 |
+
$$(s.selector).each(function(img) {
|
10 |
+
src = img.src;
|
11 |
+
|
12 |
+
|
13 |
+
if (img.readAttribute("height"))
|
14 |
+
height = img.readAttribute("height")
|
15 |
+
else
|
16 |
+
height = s.height
|
17 |
+
if (img.readAttribute("width"))
|
18 |
+
width = img.readAttribute("width")
|
19 |
+
else
|
20 |
+
width = s.width
|
21 |
+
|
22 |
+
if (src.indexOf('.swf') > -1) {
|
23 |
+
|
24 |
+
embed = Builder.node("EMBED", {"src": src, "type": "application/x-shockwave-flash", "allowscriptaccess": "false", "allowfullscreen": "true", "width": height, "height": width, "wmode": "transparent"})
|
25 |
+
img.replace(embed)
|
26 |
+
}
|
27 |
+
if (src.indexOf('.flv') > -1) {
|
28 |
+
|
29 |
+
embed = Builder.node("EMBED", {"src": src, "width": height, "height": width})
|
30 |
+
img.replace(embed)
|
31 |
+
}
|
32 |
+
|
33 |
+
})
|
34 |
+
}
|
35 |
+
})
|
36 |
+
})
|
37 |
+
|