Version Notes
Extension for upload videos to Youtube directly from your Magento Shop
Main features
* Directly upload videos on Youtube from Magento shop.
* Insert Youtube video by Youtube key
* Insert custom video HTML (embed tags)
* Use previously uploaded videos
* Upload video on your web hosting, convert it to *.flv format and display with nice FLW player.
Using a one string of code, you can add video to any place of product page, and not just:
getVideoHtml($_product->getId());?>
Download this release
Release Info
Developer | Tentura Team |
Extension | Tentura_Mvideo |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/local/Tentura/Mvideo/.DS_Store +0 -0
- app/code/local/Tentura/Mvideo/Block/Adminhtml/Catalog/Product/Edit/Action/Attribute/Tab/Attributes.php +85 -0
- app/code/local/Tentura/Mvideo/Helper/Data.php +37 -0
- app/code/local/Tentura/Mvideo/Model/Lang.php +25 -0
- app/code/local/Tentura/Mvideo/Model/Mvideo.php +41 -0
- app/code/local/Tentura/Mvideo/Model/MvideoForProducts.php +10 -0
- app/code/local/Tentura/Mvideo/Model/Mysql4/Mvideo.php +10 -0
- app/code/local/Tentura/Mvideo/Model/Mysql4/Mvideo/Collection.php +10 -0
- app/code/local/Tentura/Mvideo/Model/Mysql4/MvideoForProducts.php +10 -0
- app/code/local/Tentura/Mvideo/Model/Mysql4/MvideoForProducts/Collection.php +10 -0
- app/code/local/Tentura/Mvideo/Model/Observer.php +43 -0
- app/code/local/Tentura/Mvideo/Model/Status.php +15 -0
- app/code/local/Tentura/Mvideo/controllers/Adminhtml/Catalog/ProductController.php +107 -0
- app/code/local/Tentura/Mvideo/controllers/Adminhtml/MvideoController.php +386 -0
- app/code/local/Tentura/Mvideo/etc/config.xml +133 -0
- app/code/local/Tentura/Mvideo/etc/system.xml +52 -0
- app/code/local/Tentura/Mvideo/sql/.DS_Store +0 -0
- app/code/local/Tentura/Mvideo/sql/mvideo_setup/mysql4-install-0.1.0.php +32 -0
- app/design/adminhtml/default/default/layout/mvideo.xml +26 -0
- app/design/adminhtml/default/default/template/mvideo/coming.phtml +30 -0
- app/design/adminhtml/default/default/template/mvideo/upload.phtml +332 -0
- app/etc/modules/Tentura_Mvideo.xml +9 -0
- js/flowplayer-3.1.3.swf +0 -0
- js/flowplayer-3.1.4.min.js +24 -0
- js/flowplayer.controls-3.1.3.swf +0 -0
- package.xml +38 -0
app/code/local/Tentura/Mvideo/.DS_Store
ADDED
Binary file
|
app/code/local/Tentura/Mvideo/Block/Adminhtml/Catalog/Product/Edit/Action/Attribute/Tab/Attributes.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tentura_Mvideo_Block_Adminhtml_Catalog_Product_Edit_Action_Attribute_Tab_Attributes
|
4 |
+
extends Mage_Adminhtml_Block_Catalog_Form
|
5 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
6 |
+
{
|
7 |
+
|
8 |
+
|
9 |
+
public function getCategoryList()
|
10 |
+
{
|
11 |
+
|
12 |
+
|
13 |
+
if (Mage::getStoreConfig("mvideo/contacts/languages")!="")
|
14 |
+
$catURL = 'http://gdata.youtube.com/schemas/2007/categories.cat?hl='.Mage::getStoreConfig("mvideo/contacts/languages");
|
15 |
+
else
|
16 |
+
$catURL = 'http://gdata.youtube.com/schemas/2007/categories.cat';
|
17 |
+
|
18 |
+
$cxml = simplexml_load_file($catURL);
|
19 |
+
$cxml->registerXPathNamespace('atom', 'http://www.w3.org/2005/Atom');
|
20 |
+
$categories = $cxml->xpath('//atom:category');
|
21 |
+
|
22 |
+
$select = "<select id='mvideo_category' style='width:200px' name='mvideo_category'>";
|
23 |
+
foreach ($categories as $cat){
|
24 |
+
$select .= "<option value='".$cat['term']."'>".$cat['label']."</option>";
|
25 |
+
}
|
26 |
+
$select .= "</select>";
|
27 |
+
|
28 |
+
return $select;
|
29 |
+
|
30 |
+
}
|
31 |
+
protected function _construct()
|
32 |
+
{
|
33 |
+
$template = $this->setTemplate("mvideo/upload.phtml");
|
34 |
+
$template->videos = Mage::getModel('mvideo/mvideo')->getCollection()->toArray();
|
35 |
+
$_SESSION['mvideo_id'] = "";
|
36 |
+
$_SESSION['direct_filename'] = "";
|
37 |
+
|
38 |
+
|
39 |
+
if ($this->getRequest()->getParam('id') > 0){
|
40 |
+
|
41 |
+
$template->editInfo = Mage::getModel('mvideo/mvideoForProducts')->getCollection()->addFieldToFilter('product_id', $this->getRequest()->getParam('id'))->toArray();
|
42 |
+
// $template->editInfo = array();
|
43 |
+
// var_dump($template->editInfo);
|
44 |
+
|
45 |
+
}else
|
46 |
+
$template->editInfo = array();
|
47 |
+
|
48 |
+
parent::_construct();
|
49 |
+
$this->setShowGlobalIcon(true);
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
protected function _prepareLayout()
|
54 |
+
{
|
55 |
+
|
56 |
+
|
57 |
+
return parent::_prepareLayout();
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* ######################## TAB settings #################################
|
62 |
+
*/
|
63 |
+
public function getTabLabel()
|
64 |
+
{
|
65 |
+
return Mage::helper('catalog')->__('Video');
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getTabTitle()
|
69 |
+
{
|
70 |
+
return Mage::helper('catalog')->__('Video');
|
71 |
+
}
|
72 |
+
|
73 |
+
public function canShowTab()
|
74 |
+
{
|
75 |
+
if ($this->getRequest()->getParam('set') != "" || $this->getRequest()->getParam('type') != "" || $this->getRequest()->getParam('id') != "")
|
76 |
+
return true;
|
77 |
+
else
|
78 |
+
return false;
|
79 |
+
}
|
80 |
+
|
81 |
+
public function isHidden()
|
82 |
+
{
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
}
|
app/code/local/Tentura/Mvideo/Helper/Data.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tentura_Mvideo_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
public function getVideoHtml($productId)
|
7 |
+
{
|
8 |
+
|
9 |
+
$editInfo = Mage::getModel('mvideo/mvideoForProducts')->getCollection()->addFieldToFilter('product_id', $productId)->toArray();
|
10 |
+
$returnString = '<script src="'.Mage::getBaseUrl('js').'flowplayer-3.1.4.min.js"></script>';
|
11 |
+
foreach ($editInfo['items'] as $video){
|
12 |
+
if ($video['video_type'] == '1' || $video['video_type'] == '2' || $video['video_type'] == '4'){
|
13 |
+
$returnString .= '<object width="350" height="283"><param name="movie" value="http://www.youtube.com/v/'.$video['mvideo_code'].'&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'.$video['mvideo_code'].'&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="350" height="283"></embed></object>';
|
14 |
+
}
|
15 |
+
if ($video['video_type'] == '3'){
|
16 |
+
$returnString .= $video['html_text'];
|
17 |
+
}
|
18 |
+
if ($video['video_type'] == '5'){
|
19 |
+
|
20 |
+
$returnString .= '<a
|
21 |
+
href="'.str_replace("index.php", "", str_replace("index.php/", "", Mage::getBaseUrl()))."media/video/".$video['file_name'].'"
|
22 |
+
style="display:block;width:350px;height:283px;"
|
23 |
+
id="player">
|
24 |
+
<script language="JavaScript">
|
25 |
+
flowplayer("player", "'.Mage::getBaseUrl('js').'flowplayer-3.1.3.swf");
|
26 |
+
</script>
|
27 |
+
|
28 |
+
</a>';
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
33 |
+
return $returnString;
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
}
|
app/code/local/Tentura/Mvideo/Model/Lang.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tentura_Mvideo_Model_Lang
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
array('value'=>'en-US', 'label'=>Mage::helper('mvideo')->__('English (United States and Canada)')),
|
8 |
+
array('value'=>'zh-TW', 'label'=>Mage::helper('mvideo')->__('Chinese (Traditional)')),
|
9 |
+
array('value'=>'cs-CZ', 'label'=>Mage::helper('mvideo')->__('Czech')),
|
10 |
+
array('value'=>'nl-NL', 'label'=>Mage::helper('mvideo')->__('Dutch')),
|
11 |
+
array('value'=>'en-GB', 'label'=>Mage::helper('mvideo')->__('English (Great Britain, Ireland, Australia and New Zealand)')),
|
12 |
+
array('value'=>'fr-FR', 'label'=>Mage::helper('mvideo')->__('French')),
|
13 |
+
array('value'=>'de-DE', 'label'=>Mage::helper('mvideo')->__('German')),
|
14 |
+
array('value'=>'it-IT', 'label'=>Mage::helper('mvideo')->__('Italian')),
|
15 |
+
array('value'=>'ja-JP', 'label'=>Mage::helper('mvideo')->__('Japanese')),
|
16 |
+
array('value'=>'ko-KR', 'label'=>Mage::helper('mvideo')->__('Korean')),
|
17 |
+
array('value'=>'pl-PL', 'label'=>Mage::helper('mvideo')->__('Polish')),
|
18 |
+
array('value'=>'pt-BR', 'label'=>Mage::helper('mvideo')->__('Portuguese (Brazil)')),
|
19 |
+
array('value'=>'ru-RU', 'label'=>Mage::helper('mvideo')->__('Russian')),
|
20 |
+
array('value'=>'es-ES', 'label'=>Mage::helper('mvideo')->__('Spanish (Spain)')),
|
21 |
+
array('value'=>'es-MX', 'label'=>Mage::helper('mvideo')->__('Spanish (Mexico)')),
|
22 |
+
array('value'=>'sv-SE', 'label'=>Mage::helper('mvideo')->__('Swedish')),
|
23 |
+
);
|
24 |
+
}
|
25 |
+
}
|
app/code/local/Tentura/Mvideo/Model/Mvideo.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tentura_Mvideo_Model_Mvideo extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('mvideo/mvideo');
|
9 |
+
}
|
10 |
+
public function getVideoHtml($productId)
|
11 |
+
{
|
12 |
+
|
13 |
+
$editInfo = Mage::getModel('mvideo/mvideoForProducts')->getCollection()->addFieldToFilter('product_id', $productId)->toArray();
|
14 |
+
$returnString = '<script src="'.$this->getJsUrl().'flowplayer-3.1.4.min.js"></script>';
|
15 |
+
foreach ($editInfo['items'] as $video){
|
16 |
+
if ($video['video_type'] == '1' || $video['video_type'] == '2' || $video['video_type'] == '4'){
|
17 |
+
$returnString .= '<object width="350" height="283"><param name="movie" value="http://www.youtube.com/v/'.$video['mvideo_code'].'&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'.$video['mvideo_code'].'&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="350" height="283"></embed></object>';
|
18 |
+
}
|
19 |
+
if ($video['video_type'] == '3'){
|
20 |
+
$returnString .= $video['html_text'];
|
21 |
+
}
|
22 |
+
if ($video['video_type'] == '5'){
|
23 |
+
|
24 |
+
$returnString .= '<a
|
25 |
+
href="'.str_replace("index.php", "", str_replace("index.php/", "", $this->getBaseUrl()))."media/video/".$video['file_name'].'"
|
26 |
+
style="display:block;width:350px;height:283px;"
|
27 |
+
id="player">
|
28 |
+
<script language="JavaScript">
|
29 |
+
flowplayer("player", "<?php echo $this->getJsUrl();?>flowplayer-3.1.3.swf");
|
30 |
+
</script>
|
31 |
+
|
32 |
+
</a>';
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
37 |
+
return $returnString;
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
app/code/local/Tentura/Mvideo/Model/MvideoForProducts.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tentura_Mvideo_Model_MvideoForProducts extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('mvideo/mvideoForProducts');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tentura/Mvideo/Model/Mysql4/Mvideo.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tentura_Mvideo_Model_Mysql4_Mvideo extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the mvideo_id refers to the key field in your database table.
|
8 |
+
$this->_init('mvideo/mvideo', 'mvideo_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tentura/Mvideo/Model/Mysql4/Mvideo/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tentura_Mvideo_Model_Mysql4_Mvideo_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('mvideo/mvideo');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tentura/Mvideo/Model/Mysql4/MvideoForProducts.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tentura_Mvideo_Model_Mysql4_MvideoForProducts extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the mvideo_id refers to the key field in your database table.
|
8 |
+
$this->_init('mvideo/mvideoForProducts', 'id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tentura/Mvideo/Model/Mysql4/MvideoForProducts/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tentura_Mvideo_Model_Mysql4_MvideoForProducts_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('mvideo/mvideoForProducts');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tentura/Mvideo/Model/Observer.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tentura_Mvideo_Model_Observer extends Mage_Core_Model_Abstract
|
3 |
+
{
|
4 |
+
|
5 |
+
public function productSaveAfter($observer){
|
6 |
+
|
7 |
+
// exit;
|
8 |
+
$product = $observer->getProduct();
|
9 |
+
$data = Mage::app()->getRequest()->getPost();
|
10 |
+
|
11 |
+
$mvideoData['product_id'] = $product->getId();
|
12 |
+
$mvideoData['video_type'] = Mage::app()->getRequest()->getParam('video_type');
|
13 |
+
|
14 |
+
$uploadFlag = 0;
|
15 |
+
if ($mvideoData['video_type'] == '1' && Mage::app()->getRequest()->getParam('mvideo_uploaded_id') != ""){
|
16 |
+
$mvideoData['mvideo_code'] = Mage::app()->getRequest()->getParam('mvideo_uploaded_id');
|
17 |
+
$uploadFlag = 1;
|
18 |
+
}
|
19 |
+
if ($mvideoData['video_type'] == '2' && Mage::app()->getRequest()->getParam('key_text') != ""){
|
20 |
+
$mvideoData['mvideo_code'] = Mage::app()->getRequest()->getParam('key_text');
|
21 |
+
$uploadFlag = 1;
|
22 |
+
}
|
23 |
+
if ($mvideoData['video_type'] == '3' && Mage::app()->getRequest()->getParam('html_text') != ""){
|
24 |
+
$mvideoData['html_text'] = Mage::app()->getRequest()->getParam('html_text');
|
25 |
+
$uploadFlag = 1;
|
26 |
+
}
|
27 |
+
if ($mvideoData['video_type'] == '4' && Mage::app()->getRequest()->getParam('already_uploaded')!="0" && Mage::app()->getRequest()->getParam('already_uploaded')!=""){
|
28 |
+
$mvideoData['mvideo_code'] = Mage::app()->getRequest()->getParam('already_uploaded');
|
29 |
+
$uploadFlag = 1;
|
30 |
+
}
|
31 |
+
if ($mvideoData['video_type'] == '5' && Mage::app()->getRequest()->getParam('direct_upload_filename')!=""){
|
32 |
+
$mvideoData['file_name'] = Mage::app()->getRequest()->getParam('direct_upload_filename');
|
33 |
+
$uploadFlag = 1;
|
34 |
+
}
|
35 |
+
|
36 |
+
if ($uploadFlag == 1){
|
37 |
+
Mage::getModel('mvideo/mvideoForProducts')->setData($mvideoData)->setId(Mage::app()->getRequest()->getParam('mvideo'))->save();
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
app/code/local/Tentura/Mvideo/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tentura_Mvideo_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('mvideo')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('mvideo')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Tentura/Mvideo/controllers/Adminhtml/Catalog/ProductController.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'Mage/Adminhtml/controllers/Catalog/ProductController.php';
|
3 |
+
|
4 |
+
class Tentura_Youtube_Adminhtml_Catalog_ProductController extends Mage_Adminhtml_Catalog_ProductController
|
5 |
+
{
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Save product action
|
9 |
+
*/
|
10 |
+
public function saveAction()
|
11 |
+
{
|
12 |
+
// var_dump($this->getRequest()->getParam('youtube_uploaded_id'));
|
13 |
+
// exit;
|
14 |
+
$storeId = $this->getRequest()->getParam('store');
|
15 |
+
$redirectBack = $this->getRequest()->getParam('back', false);
|
16 |
+
$productId = $this->getRequest()->getParam('id');
|
17 |
+
$isEdit = (int)($this->getRequest()->getParam('id') != null);
|
18 |
+
|
19 |
+
$data = $this->getRequest()->getPost();
|
20 |
+
if ($data) {
|
21 |
+
if (!isset($data['product']['stock_data']['use_config_manage_stock'])) {
|
22 |
+
$data['product']['stock_data']['use_config_manage_stock'] = 0;
|
23 |
+
}
|
24 |
+
$product = $this->_initProductSave();
|
25 |
+
|
26 |
+
try {
|
27 |
+
$product->save();
|
28 |
+
$productId = $product->getId();
|
29 |
+
|
30 |
+
$youtubeData['product_id'] = $productId;
|
31 |
+
$youtubeData['video_type'] = $this->getRequest()->getParam('video_type');
|
32 |
+
|
33 |
+
$uploadFlag = 0;
|
34 |
+
if ($youtubeData['video_type'] == '1' && $this->getRequest()->getParam('youtube_uploaded_id') != ""){
|
35 |
+
$youtubeData['youtube_code'] = $this->getRequest()->getParam('youtube_uploaded_id');
|
36 |
+
$uploadFlag = 1;
|
37 |
+
}
|
38 |
+
if ($youtubeData['video_type'] == '2' && $this->getRequest()->getParam('key_text') != ""){
|
39 |
+
$youtubeData['youtube_code'] = $this->getRequest()->getParam('key_text');
|
40 |
+
$uploadFlag = 1;
|
41 |
+
}
|
42 |
+
if ($youtubeData['video_type'] == '3' && $this->getRequest()->getParam('html_text') != ""){
|
43 |
+
$youtubeData['html_text'] = $this->getRequest()->getParam('html_text');
|
44 |
+
$uploadFlag = 1;
|
45 |
+
}
|
46 |
+
if ($youtubeData['video_type'] == '4' && $this->getRequest()->getParam('already_uploaded')!="0" && $this->getRequest()->getParam('already_uploaded')!=""){
|
47 |
+
$youtubeData['youtube_code'] = $this->getRequest()->getParam('already_uploaded');
|
48 |
+
$uploadFlag = 1;
|
49 |
+
}
|
50 |
+
if ($youtubeData['video_type'] == '5' && $this->getRequest()->getParam('direct_upload_filename')!=""){
|
51 |
+
$youtubeData['file_name'] = $this->getRequest()->getParam('direct_upload_filename');
|
52 |
+
$uploadFlag = 1;
|
53 |
+
}
|
54 |
+
|
55 |
+
if ($uploadFlag == 1){
|
56 |
+
// echo "a";
|
57 |
+
Mage::getModel('youtube/youtubeForProducts')->setData($youtubeData)->setId($this->getRequest()->getParam('youtube'))->save();
|
58 |
+
}
|
59 |
+
// exit;
|
60 |
+
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Do copying data to stores
|
64 |
+
*/
|
65 |
+
if (isset($data['copy_to_stores'])) {
|
66 |
+
foreach ($data['copy_to_stores'] as $storeTo=>$storeFrom) {
|
67 |
+
$newProduct = Mage::getModel('catalog/product')
|
68 |
+
->setStoreId($storeFrom)
|
69 |
+
->load($productId)
|
70 |
+
->setStoreId($storeTo)
|
71 |
+
->save();
|
72 |
+
}
|
73 |
+
}
|
74 |
+
$this->_getSession()->addSuccess($this->__('Product was successfully saved.'));
|
75 |
+
}
|
76 |
+
catch (Mage_Core_Exception $e) {
|
77 |
+
$this->_getSession()->addError($e->getMessage())
|
78 |
+
->setProductData($data);
|
79 |
+
$redirectBack = true;
|
80 |
+
}
|
81 |
+
catch (Exception $e) {
|
82 |
+
// $this->_getSession()->addException($e, $this->__('Product saving error.'));
|
83 |
+
$this->_getSession()->addException($e, $e->getMessage());
|
84 |
+
$redirectBack = true;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
if ($redirectBack) {
|
89 |
+
$this->_redirect('*/*/edit', array(
|
90 |
+
'id' => $productId,
|
91 |
+
'_current'=>true
|
92 |
+
));
|
93 |
+
}
|
94 |
+
else if($this->getRequest()->getParam('popup')) {
|
95 |
+
$this->_redirect('*/*/created', array(
|
96 |
+
'_current' => true,
|
97 |
+
'id' => $productId,
|
98 |
+
'edit' => $isEdit
|
99 |
+
));
|
100 |
+
}
|
101 |
+
else {
|
102 |
+
$this->_redirect('*/*/', array('store'=>$storeId));
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
|
107 |
+
}
|
app/code/local/Tentura/Mvideo/controllers/Adminhtml/MvideoController.php
ADDED
@@ -0,0 +1,386 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tentura_Mvideo_Adminhtml_MvideoController extends Mage_Adminhtml_Controller_action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _initAction() {
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('mvideo/items')
|
9 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
10 |
+
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
public function checkStatusAction()
|
14 |
+
{
|
15 |
+
$yt = $this->mvideoAuth();
|
16 |
+
if (isset($_SESSION['mvideo_id'])){
|
17 |
+
$videoIdOfPrivateVideo = $_SESSION['mvideo_id'];
|
18 |
+
$location = 'http://gdata.youtube.com/feeds/api/users/default/uploads/' . $videoIdOfPrivateVideo;
|
19 |
+
$privateEntry = $yt->getVideoEntry(null, $location);
|
20 |
+
$videoEntry = $privateEntry;
|
21 |
+
$state = $videoEntry->getVideoState();
|
22 |
+
if ($state) {
|
23 |
+
echo '<br>Upload status for video is - <b>' . $state->getText() . "</b>\n";
|
24 |
+
} else {
|
25 |
+
echo "Not able to retrieve the video status information yet. " .
|
26 |
+
"Please try again later.\n";
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
public function getFormAction()
|
31 |
+
{
|
32 |
+
if ($this->getRequest()->getPost('title') == "" || $this->getRequest()->getPost('description') == ""){
|
33 |
+
$data['error'] = true;
|
34 |
+
$data['mvideo_error'] = "";
|
35 |
+
$data['error_text'] = "All fields are reqiured!";
|
36 |
+
}else{
|
37 |
+
|
38 |
+
try{
|
39 |
+
|
40 |
+
$yt = $this->mvideoAuth();
|
41 |
+
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
|
42 |
+
$myVideoEntry->setVideoTitle($this->getRequest()->getPost('title'));
|
43 |
+
$myVideoEntry->setVideoDescription($this->getRequest()->getPost('description'));
|
44 |
+
|
45 |
+
$myVideoEntry->setVideoCategory($this->getRequest()->getPost('mvideo_category'));
|
46 |
+
$myVideoEntry->SetVideoTags($this->getRequest()->getPost('title'));
|
47 |
+
$tokenHandlerUrl = 'http://gdata.youtube.com/action/GetUploadToken';
|
48 |
+
$tokenArray = $yt->getFormUploadToken($myVideoEntry, $tokenHandlerUrl);
|
49 |
+
$tokenValue = $tokenArray['token'];
|
50 |
+
$postUrl = $tokenArray['url'];
|
51 |
+
$form = "
|
52 |
+
";
|
53 |
+
|
54 |
+
$data['error'] = false;
|
55 |
+
$data['mvideo_error'] = "";
|
56 |
+
$_SESSION['video_title'] = $this->getRequest()->getPost('title');
|
57 |
+
$data['action'] = $postUrl."?nexturl=".$this->getUrl('mvideo/adminhtml_mvideo')."";
|
58 |
+
$data['tokenValue'] = $tokenValue;
|
59 |
+
|
60 |
+
}
|
61 |
+
catch(Exception $e){
|
62 |
+
// echo $e;
|
63 |
+
//echo "Error: " . $exception->getResponse()->getRawBody();
|
64 |
+
$data['error'] = true;
|
65 |
+
// echo $e;
|
66 |
+
$data['mvideo_error'] = "Mvideo error. Try again later. <br> Cases: <br>1. Wrong login or password <br>2. Exceeded number of connections. Please wait.";
|
67 |
+
|
68 |
+
// if ($this->getRequest()->getParam('set') != "" || $this->getRequest()->getParam('type') != "")
|
69 |
+
// Mage::getSingleton('adminhtml/session')->addError(Mage::helper('mvideo')->__("Authentication with Google failed. You type wrong login or password"));
|
70 |
+
}
|
71 |
+
}
|
72 |
+
echo json_encode($data);
|
73 |
+
}
|
74 |
+
public function mvideoAuth()
|
75 |
+
{
|
76 |
+
require_once 'Zend/Gdata/ClientLogin.php';
|
77 |
+
$clientLogin = new Zend_Gdata_ClientLogin();
|
78 |
+
$authenticationURL= 'https://www.google.com/youtube/accounts/ClientLogin';
|
79 |
+
$httpClient =
|
80 |
+
$clientLogin->getHttpClient(
|
81 |
+
$username = Mage::getStoreConfig("mvideo/contacts/login"),
|
82 |
+
$password = Mage::getStoreConfig("mvideo/contacts/pass"),
|
83 |
+
$service = 'youtube',
|
84 |
+
$client = null,
|
85 |
+
$source = 'MySource', // a short string identifying your application
|
86 |
+
$loginToken = null,
|
87 |
+
$loginCaptcha = null,
|
88 |
+
$authenticationURL);
|
89 |
+
|
90 |
+
require_once 'Zend/Gdata/YouTube.php';
|
91 |
+
require_once 'Zend/Gdata/YouTube/VideoEntry.php';
|
92 |
+
|
93 |
+
$developerKey = 'AI39si4GHy6APDI0Jjr67sWNRImktClpSjv6FR8aQ1nylDHhRrXZffrrrLIEqq2cFu47WJSNbKOxphlzMyli2MgXhF76yZABhg';
|
94 |
+
$applicationId = 'V';
|
95 |
+
$clientId = 'Mvideo extension for Magento';
|
96 |
+
|
97 |
+
return new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
|
98 |
+
}
|
99 |
+
public function indexAction() {
|
100 |
+
|
101 |
+
$yt = $this->mvideoAuth();
|
102 |
+
|
103 |
+
$videoIdOfPrivateVideo = $this->getRequest()->getParam('id');
|
104 |
+
$location = 'http://gdata.youtube.com/feeds/api/users/default/uploads/' . $videoIdOfPrivateVideo;
|
105 |
+
$privateEntry = $yt->getVideoEntry(null, $location);
|
106 |
+
$videoEntry = $privateEntry;
|
107 |
+
$state = $videoEntry->getVideoState();
|
108 |
+
if ($state) {
|
109 |
+
$message = "<input type='hidden' name='mvideo_uploaded_id' value='".$videoEntry->getVideoId()."'>Upload successfully <br> Upload status for video ID " . $videoEntry->getVideoId() . " is " .
|
110 |
+
$state->getName() . " " . $state->getText() . "";
|
111 |
+
} else {
|
112 |
+
$message = "Not able to retrieve the video status information yet. " .
|
113 |
+
"Please try again later.";
|
114 |
+
}
|
115 |
+
$data['title'] = $_SESSION['video_title'];
|
116 |
+
$data['key'] = $this->getRequest()->getParam('id');
|
117 |
+
|
118 |
+
$model = Mage::getModel('mvideo/mvideo');
|
119 |
+
$model->setData($data)
|
120 |
+
->setId($this->getRequest()->getParam('vid'));
|
121 |
+
|
122 |
+
$model->save();
|
123 |
+
$_SESSION['mvideo_message'] = $message;
|
124 |
+
$_SESSION['mvideo_id'] = $this->getRequest()->getParam('id');
|
125 |
+
echo "<script>parent.video_result(\"".$message."\");</script>";
|
126 |
+
}
|
127 |
+
public function delVideoAction()
|
128 |
+
{
|
129 |
+
Mage::getModel('mvideo/mvideoForProducts')->setId($this->getRequest()->getParam('id'))->delete();
|
130 |
+
echo 'success';
|
131 |
+
}
|
132 |
+
public function directUploadAction()
|
133 |
+
{
|
134 |
+
//echo "<script>parent.video_result('gut');</script>";
|
135 |
+
//var_dump($_FILES);
|
136 |
+
|
137 |
+
if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
|
138 |
+
|
139 |
+
try {
|
140 |
+
/* Starting upload */
|
141 |
+
$uploader = new Varien_File_Uploader('filename');
|
142 |
+
|
143 |
+
// Any extention would work
|
144 |
+
$uploader->setAllowedExtensions(array('avi','mpg','flv','iflv', 'mpeg', 'mp4'));
|
145 |
+
$uploader->setAllowRenameFiles(true);
|
146 |
+
|
147 |
+
// Set the file upload mode
|
148 |
+
// false -> get the file directly in the specified folder
|
149 |
+
// true -> get the file in the product like folders
|
150 |
+
// (file.jpg will go in something like /media/f/i/file.jpg)
|
151 |
+
$uploader->setFilesDispersion(false);
|
152 |
+
|
153 |
+
// We set media as the upload dir
|
154 |
+
$path = Mage::getBaseDir('media')."/video";
|
155 |
+
|
156 |
+
if (!is_dir($path)){
|
157 |
+
mkdir($path);
|
158 |
+
}
|
159 |
+
|
160 |
+
if (file_exists($path . "/".str_replace(".", "_", $_FILES['filename']['name']).".flv"))
|
161 |
+
$_FILES['filename']['name'] = rand(10000000, 99999999).$_FILES['filename']['name'];
|
162 |
+
|
163 |
+
$_FILES['filename']['name'] = str_replace(' ', "_", $_FILES['filename']['name']);
|
164 |
+
|
165 |
+
$filename = $_FILES['filename']['name'];
|
166 |
+
|
167 |
+
$uploader->save($path, $_FILES['filename']['name']);
|
168 |
+
|
169 |
+
|
170 |
+
|
171 |
+
// echo $_FILES['filename']['name'];
|
172 |
+
$src = $path."/".$_FILES['filename']['name'];
|
173 |
+
$dest = $path . "/".str_replace(".", "_", $_FILES['filename']['name']).".flv";
|
174 |
+
|
175 |
+
try{
|
176 |
+
|
177 |
+
$command = escapeshellcmd("ffmpeg -i $src $dest");
|
178 |
+
$output = shell_exec($command);
|
179 |
+
unlink($path.$filename);
|
180 |
+
if (file_exists($path . "/".str_replace(".", "_", $_FILES['filename']['name']).".flv")){
|
181 |
+
|
182 |
+
echo "<script>parent.video_result('Successfully upload <input type=\"hidden\" name=\"direct_upload_filename\" value=\"".str_replace(".", "_", $_FILES['filename']['name'])."\">', '');</script>";
|
183 |
+
$_SESSION['direct_filename'] = $_FILES['filename']['name'].".flv";
|
184 |
+
|
185 |
+
}
|
186 |
+
else{
|
187 |
+
echo "<script>parent.video_result('Error while file upload', 'error');</script>";
|
188 |
+
}
|
189 |
+
|
190 |
+
}catch(Exception $e){
|
191 |
+
|
192 |
+
|
193 |
+
if (file_exists($path . "/".$_FILES['filename']['name'])){
|
194 |
+
|
195 |
+
echo "<script>parent.video_result('Successfully upload <input type=\"hidden\" name=\"direct_upload_filename\" value=\"".$_FILES['filename']['name']."\">', '');</script>";
|
196 |
+
$_SESSION['direct_filename'] = $_FILES['filename']['name'];
|
197 |
+
|
198 |
+
}
|
199 |
+
else{
|
200 |
+
echo "<script>parent.video_result('Error while file upload', 'error');</script>";
|
201 |
+
}
|
202 |
+
|
203 |
+
}
|
204 |
+
|
205 |
+
|
206 |
+
|
207 |
+
} catch (Exception $e) {
|
208 |
+
echo $e;
|
209 |
+
echo "<script>parent.video_result('Error while file upload', 'error');</script>";
|
210 |
+
}
|
211 |
+
}
|
212 |
+
}
|
213 |
+
public function editAction() {
|
214 |
+
$id = $this->getRequest()->getParam('id');
|
215 |
+
$model = Mage::getModel('mvideo/mvideo')->load($id);
|
216 |
+
|
217 |
+
if ($model->getId() || $id == 0) {
|
218 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
219 |
+
if (!empty($data)) {
|
220 |
+
$model->setData($data);
|
221 |
+
}
|
222 |
+
|
223 |
+
Mage::register('mvideo_data', $model);
|
224 |
+
|
225 |
+
$this->loadLayout();
|
226 |
+
$this->_setActiveMenu('mvideo/items');
|
227 |
+
|
228 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
229 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
230 |
+
|
231 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
232 |
+
|
233 |
+
$this->_addContent($this->getLayout()->createBlock('mvideo/adminhtml_mvideo_edit'))
|
234 |
+
->_addLeft($this->getLayout()->createBlock('mvideo/adminhtml_mvideo_edit_tabs'));
|
235 |
+
|
236 |
+
$this->renderLayout();
|
237 |
+
} else {
|
238 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('mvideo')->__('Item does not exist'));
|
239 |
+
$this->_redirect('*/*/');
|
240 |
+
}
|
241 |
+
}
|
242 |
+
|
243 |
+
public function newAction() {
|
244 |
+
$this->_forward('edit');
|
245 |
+
}
|
246 |
+
|
247 |
+
public function saveAction() {
|
248 |
+
if ($data = $this->getRequest()->getPost()) {
|
249 |
+
|
250 |
+
|
251 |
+
$model = Mage::getModel('mvideo/mvideo');
|
252 |
+
$model->setData($data)
|
253 |
+
->setId($this->getRequest()->getParam('id'));
|
254 |
+
|
255 |
+
try {
|
256 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
257 |
+
$model->setCreatedTime(now())
|
258 |
+
->setUpdateTime(now());
|
259 |
+
} else {
|
260 |
+
$model->setUpdateTime(now());
|
261 |
+
}
|
262 |
+
|
263 |
+
$model->save();
|
264 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('mvideo')->__('Item was successfully saved'));
|
265 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
266 |
+
|
267 |
+
if ($this->getRequest()->getParam('back')) {
|
268 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
269 |
+
return;
|
270 |
+
}
|
271 |
+
$this->_redirect('*/*/');
|
272 |
+
return;
|
273 |
+
} catch (Exception $e) {
|
274 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
275 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
276 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
277 |
+
return;
|
278 |
+
}
|
279 |
+
}
|
280 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('mvideo')->__('Unable to find item to save'));
|
281 |
+
$this->_redirect('*/*/');
|
282 |
+
}
|
283 |
+
|
284 |
+
public function deleteAction() {
|
285 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
286 |
+
try {
|
287 |
+
$model = Mage::getModel('mvideo/mvideo');
|
288 |
+
|
289 |
+
$model->setId($this->getRequest()->getParam('id'))
|
290 |
+
->delete();
|
291 |
+
|
292 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
293 |
+
$this->_redirect('*/*/');
|
294 |
+
} catch (Exception $e) {
|
295 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
296 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
297 |
+
}
|
298 |
+
}
|
299 |
+
$this->_redirect('*/*/');
|
300 |
+
}
|
301 |
+
|
302 |
+
public function massDeleteAction() {
|
303 |
+
$mvideoIds = $this->getRequest()->getParam('mvideo');
|
304 |
+
if(!is_array($mvideoIds)) {
|
305 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
306 |
+
} else {
|
307 |
+
try {
|
308 |
+
foreach ($mvideoIds as $mvideoId) {
|
309 |
+
$mvideo = Mage::getModel('mvideo/mvideo')->load($mvideoId);
|
310 |
+
$mvideo->delete();
|
311 |
+
}
|
312 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
313 |
+
Mage::helper('adminhtml')->__(
|
314 |
+
'Total of %d record(s) were successfully deleted', count($mvideoIds)
|
315 |
+
)
|
316 |
+
);
|
317 |
+
} catch (Exception $e) {
|
318 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
319 |
+
}
|
320 |
+
}
|
321 |
+
$this->_redirect('*/*/index');
|
322 |
+
}
|
323 |
+
|
324 |
+
public function massStatusAction()
|
325 |
+
{
|
326 |
+
$mvideoIds = $this->getRequest()->getParam('mvideo');
|
327 |
+
if(!is_array($mvideoIds)) {
|
328 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
329 |
+
} else {
|
330 |
+
try {
|
331 |
+
foreach ($mvideoIds as $mvideoId) {
|
332 |
+
$mvideo = Mage::getSingleton('mvideo/mvideo')
|
333 |
+
->load($mvideoId)
|
334 |
+
->setStatus($this->getRequest()->getParam('status'))
|
335 |
+
->setIsMassupdate(true)
|
336 |
+
->save();
|
337 |
+
}
|
338 |
+
$this->_getSession()->addSuccess(
|
339 |
+
$this->__('Total of %d record(s) were successfully updated', count($mvideoIds))
|
340 |
+
);
|
341 |
+
} catch (Exception $e) {
|
342 |
+
$this->_getSession()->addError($e->getMessage());
|
343 |
+
}
|
344 |
+
}
|
345 |
+
$this->_redirect('*/*/index');
|
346 |
+
}
|
347 |
+
|
348 |
+
public function exportCsvAction()
|
349 |
+
{
|
350 |
+
$fileName = 'mvideo.csv';
|
351 |
+
$content = $this->getLayout()->createBlock('mvideo/adminhtml_mvideo_grid')
|
352 |
+
->getCsv();
|
353 |
+
|
354 |
+
$this->_sendUploadResponse($fileName, $content);
|
355 |
+
}
|
356 |
+
|
357 |
+
public function exportXmlAction()
|
358 |
+
{
|
359 |
+
$fileName = 'mvideo.xml';
|
360 |
+
$content = $this->getLayout()->createBlock('mvideo/adminhtml_mvideo_grid')
|
361 |
+
->getXml();
|
362 |
+
|
363 |
+
$this->_sendUploadResponse($fileName, $content);
|
364 |
+
}
|
365 |
+
public function uploadAction()
|
366 |
+
{
|
367 |
+
|
368 |
+
|
369 |
+
|
370 |
+
}
|
371 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
372 |
+
{
|
373 |
+
$response = $this->getResponse();
|
374 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
375 |
+
$response->setHeader('Pragma', 'public', true);
|
376 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
377 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
378 |
+
$response->setHeader('Last-Modified', date('r'));
|
379 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
380 |
+
$response->setHeader('Content-Length', strlen($content));
|
381 |
+
$response->setHeader('Content-type', $contentType);
|
382 |
+
$response->setBody($content);
|
383 |
+
$response->sendResponse();
|
384 |
+
die;
|
385 |
+
}
|
386 |
+
}
|
app/code/local/Tentura/Mvideo/etc/config.xml
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Tentura_Mvideo>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Tentura_Mvideo>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<mvideo>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Tentura_Mvideo</module>
|
14 |
+
<frontName>mvideo</frontName>
|
15 |
+
</args>
|
16 |
+
</mvideo>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<mvideo>
|
21 |
+
<file>mvideo.xml</file>
|
22 |
+
</mvideo>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<mvideo>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Tentura_Mvideo</module>
|
32 |
+
<frontName>mvideo</frontName>
|
33 |
+
</args>
|
34 |
+
</mvideo>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<acl>
|
39 |
+
<resources>
|
40 |
+
<all>
|
41 |
+
<title>Allow Everything</title>
|
42 |
+
</all>
|
43 |
+
<admin>
|
44 |
+
<children>
|
45 |
+
<Tentura_Mvideo>
|
46 |
+
<title>Mvideo Module</title>
|
47 |
+
<sort_order>10</sort_order>
|
48 |
+
</Tentura_Mvideo>
|
49 |
+
<system>
|
50 |
+
<children>
|
51 |
+
<config>
|
52 |
+
<children>
|
53 |
+
<mvideo translate="title" module="mvideo">
|
54 |
+
<title>Mvideo Section</title>
|
55 |
+
</mvideo>
|
56 |
+
</children>
|
57 |
+
</config>
|
58 |
+
</children>
|
59 |
+
</system>
|
60 |
+
|
61 |
+
</children>
|
62 |
+
</admin>
|
63 |
+
</resources>
|
64 |
+
</acl>
|
65 |
+
<layout>
|
66 |
+
<updates>
|
67 |
+
<mvideo>
|
68 |
+
<file>mvideo.xml</file>
|
69 |
+
</mvideo>
|
70 |
+
</updates>
|
71 |
+
</layout>
|
72 |
+
</adminhtml>
|
73 |
+
<global>
|
74 |
+
<events>
|
75 |
+
<catalog_product_save_after>
|
76 |
+
<observers>
|
77 |
+
<Conlabz_Referral>
|
78 |
+
<type>singleton</type>
|
79 |
+
<class>mvideo/observer</class>
|
80 |
+
<method>productSaveAfter</method>
|
81 |
+
</Conlabz_Referral>
|
82 |
+
</observers>
|
83 |
+
</catalog_product_save_after>
|
84 |
+
</events>
|
85 |
+
<models>
|
86 |
+
<mvideo>
|
87 |
+
<class>Tentura_Mvideo_Model</class>
|
88 |
+
<resourceModel>mvideo_mysql4</resourceModel>
|
89 |
+
</mvideo>
|
90 |
+
<mvideo_mysql4>
|
91 |
+
<class>Tentura_Mvideo_Model_Mysql4</class>
|
92 |
+
<entities>
|
93 |
+
<mvideo>
|
94 |
+
<table>mvideo</table>
|
95 |
+
</mvideo>
|
96 |
+
<mvideoForProducts>
|
97 |
+
<table>mvideo_for_products</table>
|
98 |
+
</mvideoForProducts>
|
99 |
+
</entities>
|
100 |
+
</mvideo_mysql4>
|
101 |
+
</models>
|
102 |
+
<resources>
|
103 |
+
<mvideo_setup>
|
104 |
+
<setup>
|
105 |
+
<module>Tentura_Mvideo</module>
|
106 |
+
</setup>
|
107 |
+
<connection>
|
108 |
+
<use>core_setup</use>
|
109 |
+
</connection>
|
110 |
+
</mvideo_setup>
|
111 |
+
<mvideo_write>
|
112 |
+
<connection>
|
113 |
+
<use>core_write</use>
|
114 |
+
</connection>
|
115 |
+
</mvideo_write>
|
116 |
+
<mvideo_read>
|
117 |
+
<connection>
|
118 |
+
<use>core_read</use>
|
119 |
+
</connection>
|
120 |
+
</mvideo_read>
|
121 |
+
</resources>
|
122 |
+
<blocks>
|
123 |
+
<mvideo>
|
124 |
+
<class>Tentura_Mvideo_Block</class>
|
125 |
+
</mvideo>
|
126 |
+
</blocks>
|
127 |
+
<helpers>
|
128 |
+
<mvideo>
|
129 |
+
<class>Tentura_Mvideo_Helper</class>
|
130 |
+
</mvideo>
|
131 |
+
</helpers>
|
132 |
+
</global>
|
133 |
+
</config>
|
app/code/local/Tentura/Mvideo/etc/system.xml
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<mvideo translate="label">
|
5 |
+
<label>Mvideo Configuration</label>
|
6 |
+
<tab>catalog</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>100</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>1</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<contacts translate="label">
|
14 |
+
<label>Youtube account information</label>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>10</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>1</show_in_store>
|
20 |
+
<fields>
|
21 |
+
<login translate="label">
|
22 |
+
<label>Youtube login or Google E-mail</label>
|
23 |
+
<frontend_type>text</frontend_type>
|
24 |
+
<sort_order>10</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>1</show_in_website>
|
27 |
+
<show_in_store>1</show_in_store>
|
28 |
+
</login>
|
29 |
+
<pass translate="label">
|
30 |
+
<label>Password</label>
|
31 |
+
<frontend_type>password</frontend_type>
|
32 |
+
<sort_order>11</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 |
+
</pass>
|
37 |
+
<languages translate="label" module="catalogsearch">
|
38 |
+
<label>Youtube categories language</label>
|
39 |
+
<frontend_type>select</frontend_type>
|
40 |
+
<source_model>mvideo/lang</source_model>
|
41 |
+
<sort_order>12</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 |
+
</languages>
|
46 |
+
</fields>
|
47 |
+
</contacts>
|
48 |
+
|
49 |
+
</groups>
|
50 |
+
</mvideo>
|
51 |
+
</sections>
|
52 |
+
</config>
|
app/code/local/Tentura/Mvideo/sql/.DS_Store
ADDED
Binary file
|
app/code/local/Tentura/Mvideo/sql/mvideo_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
|
10 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('mvideo')} (
|
11 |
+
`mvideo_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
12 |
+
`title` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`key` text NOT NULL,
|
14 |
+
`status` smallint(6) NOT NULL DEFAULT '0',
|
15 |
+
`created_time` timestamp NULL DEFAULT NULL,
|
16 |
+
PRIMARY KEY (`mvideo_id`)
|
17 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=15 ;
|
18 |
+
|
19 |
+
|
20 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('mvideo_for_products')} (
|
21 |
+
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
22 |
+
`product_id` bigint(20) NOT NULL,
|
23 |
+
`mvideo_code` varchar(200) NOT NULL,
|
24 |
+
`video_type` int(11) NOT NULL,
|
25 |
+
`html_text` text NOT NULL,
|
26 |
+
`file_name` text NOT NULL,
|
27 |
+
PRIMARY KEY (`id`)
|
28 |
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
|
29 |
+
|
30 |
+
");
|
31 |
+
|
32 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/mvideo.xml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<mvideo_adminhtml_mvideo_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="mvideo/adminhtml_mvideo" name="mvideo" />
|
6 |
+
</reference>
|
7 |
+
</mvideo_adminhtml_mvideo_index>
|
8 |
+
<adminhtml_catalog_product_new>
|
9 |
+
<reference name="product_tabs">
|
10 |
+
<block type="mvideo/adminhtml_catalog_product_edit_action_attribute_tab_attributes" name="tab_attributes" template='mvideo/upload.phtml'/>
|
11 |
+
<action method="addTab"><name>attributes</name><block>tab_attributes</block></action>
|
12 |
+
</reference>
|
13 |
+
</adminhtml_catalog_product_new>
|
14 |
+
<adminhtml_catalog_product_edit>
|
15 |
+
<reference name="product_tabs">
|
16 |
+
<block type="mvideo/adminhtml_catalog_product_edit_action_attribute_tab_attributes" name="tab_attributes" template='mvideo/upload.phtml'/>
|
17 |
+
<action method="addTab"><name>attributes</name><block>tab_attributes</block></action>
|
18 |
+
</reference>
|
19 |
+
</adminhtml_catalog_product_edit>
|
20 |
+
<mvideo_catalog_product_index>
|
21 |
+
<update handle="catalog_product_index"/>
|
22 |
+
</mvideo_catalog_product_index>
|
23 |
+
<mvideo_index>
|
24 |
+
<block type="mvideo/mvideo" name="mvideo" />
|
25 |
+
</mvideo_index>
|
26 |
+
</layout>
|
app/design/adminhtml/default/default/template/mvideo/coming.phtml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
<div class="content-header">
|
28 |
+
<h3><?php echo Mage::helper('adminhtml')->__('Sorry, this feature is coming soon...') ?></h3>
|
29 |
+
</div>
|
30 |
+
<p><?php echo Mage::helper('adminhtml')->__('We\'re in our typing table, coding away more features for Magento. Thank you for your patience.') ?></p>
|
app/design/adminhtml/default/default/template/mvideo/upload.phtml
ADDED
@@ -0,0 +1,332 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script src="<?php echo $this->getJsUrl();?>flowplayer-3.1.4.min.js"></script>
|
2 |
+
|
3 |
+
|
4 |
+
<script>
|
5 |
+
function upload()
|
6 |
+
{
|
7 |
+
$('upload').style.display='';
|
8 |
+
$('key').style.display='none';
|
9 |
+
$('html').style.display='none';
|
10 |
+
$('related').style.display='none';
|
11 |
+
$('direct').style.display='none';
|
12 |
+
$('upload_result').innerHTML = "";
|
13 |
+
|
14 |
+
}
|
15 |
+
function key()
|
16 |
+
{
|
17 |
+
$('upload').style.display='none';
|
18 |
+
$('key').style.display='';
|
19 |
+
$('html').style.display='none';
|
20 |
+
$('related').style.display='none';
|
21 |
+
$('direct').style.display='none';
|
22 |
+
$('upload_result').innerHTML = "";
|
23 |
+
}
|
24 |
+
function html()
|
25 |
+
{
|
26 |
+
$('upload').style.display='none';
|
27 |
+
$('key').style.display='none';
|
28 |
+
$('html').style.display='';
|
29 |
+
$('related').style.display='none';
|
30 |
+
$('direct').style.display='none';
|
31 |
+
$('upload_result').innerHTML = "";
|
32 |
+
}
|
33 |
+
function related()
|
34 |
+
{
|
35 |
+
$('upload').style.display='none';
|
36 |
+
$('key').style.display='none';
|
37 |
+
$('html').style.display='none';
|
38 |
+
$('related').style.display='';
|
39 |
+
$('direct').style.display='none';
|
40 |
+
$('upload_result').innerHTML = "";
|
41 |
+
}
|
42 |
+
function directUpload()
|
43 |
+
{
|
44 |
+
$('upload').style.display='none';
|
45 |
+
$('key').style.display='none';
|
46 |
+
$('html').style.display='none';
|
47 |
+
$('related').style.display='none';
|
48 |
+
$('direct').style.display='';
|
49 |
+
$('upload_result').innerHTML = "";
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
function video_result(a, error_type)
|
54 |
+
{
|
55 |
+
//$('upload_result').innerHTML='<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/'+a+'=ru&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+a+'&hl=ru&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>';
|
56 |
+
if (error_type == "error")
|
57 |
+
$('upload_result').innerHTML='<div id="messages"><ul class="messages"><li class="error-msg"><ul><li>'+a+'</li></ul></li></ul></div>';
|
58 |
+
else
|
59 |
+
$('upload_result').innerHTML='<div id="messages"><ul class="messages"><li class="success-msg"><ul><li>'+a+'</li></ul></li></ul></div>';
|
60 |
+
|
61 |
+
//alert("asd");
|
62 |
+
}
|
63 |
+
function status_get()
|
64 |
+
{
|
65 |
+
url = '<?php echo $this->getUrl('mvideo/adminhtml_mvideo/checkStatus'); ?>';
|
66 |
+
new Ajax.Request(url, {
|
67 |
+
method: 'post',
|
68 |
+
onSuccess: function(transport) {
|
69 |
+
$('status_answer').innerHTML = "";
|
70 |
+
$('status_answer').innerHTML = transport.responseText;
|
71 |
+
|
72 |
+
}});
|
73 |
+
|
74 |
+
}
|
75 |
+
function backform()
|
76 |
+
{
|
77 |
+
|
78 |
+
$('upload_div').style.display="";
|
79 |
+
$('upload_div1').style.display="none";
|
80 |
+
|
81 |
+
}
|
82 |
+
function sendVideoInfo()
|
83 |
+
{
|
84 |
+
url = '<?php echo $this->getUrl('mvideo/adminhtml_mvideo/getForm'); ?>';
|
85 |
+
new Ajax.Request(url, {
|
86 |
+
method: 'post',
|
87 |
+
parameters: $('videoInfo').serialize(),
|
88 |
+
onSuccess: function(transport, json) {
|
89 |
+
var data = transport.responseText.evalJSON(true);
|
90 |
+
if (data['error'] == false){
|
91 |
+
$('upload_form_id').action = data['action'];
|
92 |
+
$('token').value = data['tokenValue'];
|
93 |
+
|
94 |
+
$('upload_div1').style.display = "";
|
95 |
+
$('upload_div').style.display="none";
|
96 |
+
$('warning_upload').style.display="none";
|
97 |
+
}
|
98 |
+
else{
|
99 |
+
// alert(data['mvideo_error']);
|
100 |
+
if (data['mvideo_error']!="")
|
101 |
+
$('warning_upload').innerHTML=data['mvideo_error'];
|
102 |
+
$('warning_upload').style.display="";
|
103 |
+
|
104 |
+
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
}
|
109 |
+
});
|
110 |
+
}
|
111 |
+
function del_video(id){
|
112 |
+
url = '<?php echo $this->getUrl('mvideo/adminhtml_mvideo/delVideo');?>id/'+id;
|
113 |
+
new Ajax.Request(url, {
|
114 |
+
method: 'post',
|
115 |
+
parameters: $('videoInfo').serialize(),
|
116 |
+
onSuccess: function(transport, json) {
|
117 |
+
if (transport.responseText == 'success'){
|
118 |
+
|
119 |
+
$('div_video_'+id).style.display='none';
|
120 |
+
|
121 |
+
}
|
122 |
+
|
123 |
+
}
|
124 |
+
});
|
125 |
+
}
|
126 |
+
</script>
|
127 |
+
|
128 |
+
<?php
|
129 |
+
if (sizeof($this->editInfo) > 0){
|
130 |
+
?>
|
131 |
+
<div class="entry-edit">
|
132 |
+
<div class="entry-edit-head">
|
133 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('mvideo')->__('Videos for this product');?></h4>
|
134 |
+
</div>
|
135 |
+
<fieldset id="grop_fields">
|
136 |
+
<div>
|
137 |
+
<?php
|
138 |
+
foreach ($this->editInfo['items'] as $video){
|
139 |
+
echo "<div id='div_video_".$video['id']."'>";
|
140 |
+
if ($video['video_type'] == '1' || $video['video_type'] == '2' || $video['video_type'] == '4'){
|
141 |
+
?>
|
142 |
+
<object width="350" height="283"><param name="movie" value="http://www.youtube.com/v/<?php echo $video['mvideo_code']?>&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/<?php echo $video['mvideo_code']?>&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="350" height="283"></embed></object>
|
143 |
+
<?php
|
144 |
+
}
|
145 |
+
if ($video['video_type'] == '3'){
|
146 |
+
?>
|
147 |
+
<?php echo $video['html_text']?>
|
148 |
+
<?php
|
149 |
+
}
|
150 |
+
if ($video['video_type'] == '5'){
|
151 |
+
?>
|
152 |
+
<a
|
153 |
+
href="<?php echo str_replace("index.php", "", str_replace("index.php/", "", $this->getBaseUrl()))."media/video/".$video['file_name']?>"
|
154 |
+
style="display:block;width:350px;height:283px;"
|
155 |
+
id="player">
|
156 |
+
</a>
|
157 |
+
|
158 |
+
<script language="JavaScript">
|
159 |
+
flowplayer("player", "<?php echo $this->getJsUrl();?>flowplayer-3.1.3.swf");
|
160 |
+
</script>
|
161 |
+
<?php
|
162 |
+
}
|
163 |
+
echo "<br><center><button class='scalable' type='button' onclick='del_video(\"".$video['id']."\")'><span>Delete file</span></button></center><br><br></div>";
|
164 |
+
}
|
165 |
+
?>
|
166 |
+
</div>
|
167 |
+
</fieldset>
|
168 |
+
</div>
|
169 |
+
<?php } ?>
|
170 |
+
<div class="entry-edit">
|
171 |
+
<div class="entry-edit-head">
|
172 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('mvideo')->__('Product In Websites');?></h4>
|
173 |
+
</div>
|
174 |
+
<fieldset id="grop_fields">
|
175 |
+
<div>
|
176 |
+
<table>
|
177 |
+
<tr><td><input type='radio' name='video_type' value='1' onclick="upload()" checked></td><td> <?php echo Mage::helper('mvideo')->__('Upload Video to Youtube');?></td></tr>
|
178 |
+
<tr><td><input type='radio' name='video_type' value='2' onclick="key()"></td><td> <?php echo Mage::helper('mvideo')->__('Use Youtube Video Key');?></td></tr>
|
179 |
+
<tr><td><input type='radio' name='video_type' value='3' onclick="html()"></td><td> <?php echo Mage::helper('mvideo')->__('Insert Html');?></td></tr>
|
180 |
+
<tr><td><input type='radio' name='video_type' value='4' onclick="related()"></td><td> <?php echo Mage::helper('mvideo')->__('Early uploaded Youtube video');?></td></tr>
|
181 |
+
<tr><td><input type='radio' name='video_type' value='5' onclick="directUpload()"></td><td> <?php echo Mage::helper('mvideo')->__('Upload video on your site');?></td></tr>
|
182 |
+
|
183 |
+
</table>
|
184 |
+
<br>
|
185 |
+
<span id='upload_result'></span>
|
186 |
+
|
187 |
+
<div id='upload'>
|
188 |
+
<?php
|
189 |
+
if(isset($_SESSION['mvideo_id1'])){
|
190 |
+
echo "Currently upload video Id - <b>".$_SESSION['mvideo_id']."</b>";
|
191 |
+
?>
|
192 |
+
<span id='status_answer'><?php //echo $this->checkStatusAction()?></span><img onclick='status_get()' src='<?php echo $this->getSkinUrl()?>/ico-refresh.gif'>
|
193 |
+
<?php
|
194 |
+
}
|
195 |
+
?>
|
196 |
+
|
197 |
+
<div >
|
198 |
+
<div id="warning_upload" style="clear:both;
|
199 |
+
font-size:0.95em;
|
200 |
+
font-weight:bold;
|
201 |
+
line-height:1.25em;
|
202 |
+
margin:3px 0 0 0px;
|
203 |
+
min-height:15px;
|
204 |
+
color:#D40707;
|
205 |
+
font-weight:bold;
|
206 |
+
display:none;
|
207 |
+
"><?php echo Mage::helper('mvideo')->__('Wrong title or description');?></div>
|
208 |
+
</div>
|
209 |
+
<div id='upload_div1' style="display:none">
|
210 |
+
<button class="scalable save" type="button" onclick='backform()'><span><?php echo Mage::helper('mvideo')->__('Back');?></span></button>
|
211 |
+
<form id="upload_form_id" target="upload_frame" action="" method="post" enctype="multipart/form-data">
|
212 |
+
<input name="file" type="file"/>
|
213 |
+
<input id='token' name="token" type="hidden" value=""/>
|
214 |
+
<button class="scalable save" type="submit" ><span><?php echo Mage::helper('mvideo')->__('Upload Video File');?></span></button>
|
215 |
+
</form>
|
216 |
+
</div>
|
217 |
+
|
218 |
+
<div id='upload_div'>
|
219 |
+
<form id='videoInfo' >
|
220 |
+
<table cellspacing="0" class="form-list">
|
221 |
+
<tbody>
|
222 |
+
<tr>
|
223 |
+
<td class="label"><label for="title"><?php echo Mage::helper('mvideo')->__('Title');?> <span class="required">*</span></label></td>
|
224 |
+
<td class="value"><input type="text" class="input-text" value="" name="title" id="title"/></td>
|
225 |
+
<td class="scope-label"></td>
|
226 |
+
<td><small> </small></td>
|
227 |
+
</tr>
|
228 |
+
<tr>
|
229 |
+
<td class="label"><label for="description"><?php echo Mage::helper('mvideo')->__('Description');?> <span class="required">*</span></label></td>
|
230 |
+
<td class="value"><input type="text" class="input-text" value="" name="description" id="description"/></td>
|
231 |
+
<td class="scope-label"></td>
|
232 |
+
<td><small> </small></td>
|
233 |
+
</tr>
|
234 |
+
<tr>
|
235 |
+
<td class="label"><label for="weight"><?php echo Mage::helper('mvideo')->__('Category');?> </label></td>
|
236 |
+
<td class="value"><?php echo $this->getCategoryList(); ?></td>
|
237 |
+
<td class="scope-label"></td>
|
238 |
+
<td><small> </small></td>
|
239 |
+
</tr>
|
240 |
+
</tbody>
|
241 |
+
</table>
|
242 |
+
|
243 |
+
<button type='button' class='scalable save' onclick='sendVideoInfo()'><?php echo Mage::helper('mvideo')->__('Next');?></button>
|
244 |
+
</form>
|
245 |
+
</div>
|
246 |
+
|
247 |
+
|
248 |
+
<iframe style='display:none' name='upload_frame'></iframe>
|
249 |
+
<iframe style='display:none' name='direct_upload_frame'></iframe>
|
250 |
+
</div>
|
251 |
+
<div id='key' style="display:none">
|
252 |
+
<table cellspacing="0" class="form-list">
|
253 |
+
<tbody>
|
254 |
+
<tr>
|
255 |
+
<td class="label">
|
256 |
+
<?php echo Mage::helper('mvideo')->__('Youtube video key');?>:
|
257 |
+
|
258 |
+
</td>
|
259 |
+
<td class="value">
|
260 |
+
<input type='text' name='key_text' class='input-text' style='width:300px'>
|
261 |
+
</td>
|
262 |
+
</tr>
|
263 |
+
</tbody>
|
264 |
+
</table>
|
265 |
+
</div>
|
266 |
+
<div id='html' style="display:none;">
|
267 |
+
<table cellspacing="0" class="form-list">
|
268 |
+
<tbody>
|
269 |
+
<tr>
|
270 |
+
<td class="label">
|
271 |
+
<?php echo Mage::helper('mvideo')->__('HTML code for video');?>:
|
272 |
+
|
273 |
+
</td>
|
274 |
+
<td class="value">
|
275 |
+
<input type='text' name='html_text' style='width:300px' class='input-text'>
|
276 |
+
</td>
|
277 |
+
</tr>
|
278 |
+
</tbody>
|
279 |
+
</table>
|
280 |
+
|
281 |
+
</div>
|
282 |
+
<div id='related' style="display:none;">
|
283 |
+
<table cellspacing="0" class="form-list">
|
284 |
+
<tbody>
|
285 |
+
<tr>
|
286 |
+
<td class="label">
|
287 |
+
<?php echo Mage::helper('mvideo')->__('Early uploaded');?>:
|
288 |
+
|
289 |
+
</td>
|
290 |
+
<td class="value">
|
291 |
+
<select id='already_uploaded' name='already_uploaded' style='width:300px'>
|
292 |
+
<option value='0'></option>
|
293 |
+
<?php
|
294 |
+
//var_dump($videos);
|
295 |
+
//sort($this->videos['items']);
|
296 |
+
foreach ($this->videos['items'] as $video){
|
297 |
+
echo "<option value='".$video['key']."'>".$video['title']."</option>";
|
298 |
+
}
|
299 |
+
|
300 |
+
?>
|
301 |
+
</select>
|
302 |
+
</td>
|
303 |
+
</tr>
|
304 |
+
</tbody>
|
305 |
+
</table>
|
306 |
+
|
307 |
+
</div>
|
308 |
+
|
309 |
+
<div style='display:none' id='direct'>
|
310 |
+
<form id='direct_form' target='direct_upload_frame' action="<?php echo $this->getUrl('mvideo/adminhtml_mvideo/directUpload'); ?>" method="post" enctype="multipart/form-data">
|
311 |
+
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
312 |
+
|
313 |
+
<table cellspacing="0" class="form-list">
|
314 |
+
<tbody>
|
315 |
+
<tr>
|
316 |
+
<td class="label" valign='middle'>
|
317 |
+
<span style="display:block; margin-top:4px"><?php echo Mage::helper('mvideo')->__('Select video file');?>:</span>
|
318 |
+
</td>
|
319 |
+
<td class="value">
|
320 |
+
<input name="filename" type="file"/>
|
321 |
+
</td>
|
322 |
+
<td valign='middle'>
|
323 |
+
<button class="scalable save" type="submit" style="float:left; margin-top:4px"><span><?php echo Mage::helper('mvideo')->__('Upload File');?></span></button>
|
324 |
+
</td>
|
325 |
+
</tr>
|
326 |
+
</tbody>
|
327 |
+
</table>
|
328 |
+
</form>
|
329 |
+
</div>
|
330 |
+
</div>
|
331 |
+
</fieldset>
|
332 |
+
</div>
|
app/etc/modules/Tentura_Mvideo.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Tentura_Mvideo>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Tentura_Mvideo>
|
8 |
+
</modules>
|
9 |
+
</config>
|
js/flowplayer-3.1.3.swf
ADDED
Binary file
|
js/flowplayer-3.1.4.min.js
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* flowplayer.js 3.1.4. The Flowplayer API
|
3 |
+
*
|
4 |
+
* Copyright 2009 Flowplayer Oy
|
5 |
+
*
|
6 |
+
* This file is part of Flowplayer.
|
7 |
+
*
|
8 |
+
* Flowplayer is free software: you can redistribute it and/or modify
|
9 |
+
* it under the terms of the GNU General Public License as published by
|
10 |
+
* the Free Software Foundation, either version 3 of the License, or
|
11 |
+
* (at your option) any later version.
|
12 |
+
*
|
13 |
+
* Flowplayer is distributed in the hope that it will be useful,
|
14 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
+
* GNU General Public License for more details.
|
17 |
+
*
|
18 |
+
* You should have received a copy of the GNU General Public License
|
19 |
+
* along with Flowplayer. If not, see <http://www.gnu.org/licenses/>.
|
20 |
+
*
|
21 |
+
* Date: 2009-09-04 11:42:25 +0000 (Fri, 04 Sep 2009)
|
22 |
+
* Revision: 316
|
23 |
+
*/
|
24 |
+
(function(){function g(o){console.log("$f.fireEvent",[].slice.call(o))}function k(q){if(!q||typeof q!="object"){return q}var o=new q.constructor();for(var p in q){if(q.hasOwnProperty(p)){o[p]=k(q[p])}}return o}function m(t,q){if(!t){return}var o,p=0,r=t.length;if(r===undefined){for(o in t){if(q.call(t[o],o,t[o])===false){break}}}else{for(var s=t[0];p<r&&q.call(s,p,s)!==false;s=t[++p]){}}return t}function c(o){return document.getElementById(o)}function i(q,p,o){if(typeof p!="object"){return q}if(q&&p){m(p,function(r,s){if(!o||typeof s!="function"){q[r]=s}})}return q}function n(s){var q=s.indexOf(".");if(q!=-1){var p=s.substring(0,q)||"*";var o=s.substring(q+1,s.length);var r=[];m(document.getElementsByTagName(p),function(){if(this.className&&this.className.indexOf(o)!=-1){r.push(this)}});return r}}function f(o){o=o||window.event;if(o.preventDefault){o.stopPropagation();o.preventDefault()}else{o.returnValue=false;o.cancelBubble=true}return false}function j(q,o,p){q[o]=q[o]||[];q[o].push(p)}function e(){return"_"+(""+Math.random()).substring(2,10)}var h=function(t,r,s){var q=this;var p={};var u={};q.index=r;if(typeof t=="string"){t={url:t}}i(this,t,true);m(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),function(){var v="on"+this;if(v.indexOf("*")!=-1){v=v.substring(0,v.length-1);var w="onBefore"+v.substring(2);q[w]=function(x){j(u,w,x);return q}}q[v]=function(x){j(u,v,x);return q};if(r==-1){if(q[w]){s[w]=q[w]}if(q[v]){s[v]=q[v]}}});i(this,{onCuepoint:function(x,w){if(arguments.length==1){p.embedded=[null,x];return q}if(typeof x=="number"){x=[x]}var v=e();p[v]=[x,w];if(s.isLoaded()){s._api().fp_addCuepoints(x,r,v)}return q},update:function(w){i(q,w);if(s.isLoaded()){s._api().fp_updateClip(w,r)}var v=s.getConfig();var x=(r==-1)?v.clip:v.playlist[r];i(x,w,true)},_fireEvent:function(v,y,w,A){if(v=="onLoad"){m(p,function(B,C){if(C[0]){s._api().fp_addCuepoints(C[0],r,B)}});return false}A=A||q;if(v=="onCuepoint"){var z=p[y];if(z){return z[1].call(s,A,w)}}if(y&&"onBeforeBegin,onMetaData,onStart,onUpdate,onResume".indexOf(v)!=-1){i(A,y);if(y.metaData){if(!A.duration){A.duration=y.metaData.duration}else{A.fullDuration=y.metaData.duration}}}var x=true;m(u[v],function(){x=this.call(s,A,y,w)});return x}});if(t.onCuepoint){var o=t.onCuepoint;q.onCuepoint.apply(q,typeof o=="function"?[o]:o);delete t.onCuepoint}m(t,function(v,w){if(typeof w=="function"){j(u,v,w);delete t[v]}});if(r==-1){s.onCuepoint=this.onCuepoint}};var l=function(p,r,q,t){var s={};var o=this;var u=false;if(t){i(s,t)}m(r,function(v,w){if(typeof w=="function"){s[v]=w;delete r[v]}});i(this,{animate:function(y,z,x){if(!y){return o}if(typeof z=="function"){x=z;z=500}if(typeof y=="string"){var w=y;y={};y[w]=z;z=500}if(x){var v=e();s[v]=x}if(z===undefined){z=500}r=q._api().fp_animate(p,y,z,v);return o},css:function(w,x){if(x!==undefined){var v={};v[w]=x;w=v}r=q._api().fp_css(p,w);i(o,r);return o},show:function(){this.display="block";q._api().fp_showPlugin(p);return o},hide:function(){this.display="none";q._api().fp_hidePlugin(p);return o},toggle:function(){this.display=q._api().fp_togglePlugin(p);return o},fadeTo:function(y,x,w){if(typeof x=="function"){w=x;x=500}if(w){var v=e();s[v]=w}this.display=q._api().fp_fadeTo(p,y,x,v);this.opacity=y;return o},fadeIn:function(w,v){return o.fadeTo(1,w,v)},fadeOut:function(w,v){return o.fadeTo(0,w,v)},getName:function(){return p},getPlayer:function(){return q},_fireEvent:function(w,v,x){if(w=="onUpdate"){var y=q._api().fp_getPlugin(p);if(!y){return}i(o,y);delete o.methods;if(!u){m(y.methods,function(){var A=""+this;o[A]=function(){var B=[].slice.call(arguments);var C=q._api().fp_invoke(p,A,B);return C==="undefined"||C===undefined?o:C}});u=true}}var z=s[w];if(z){z.apply(o,v);if(w.substring(0,1)=="_"){delete s[w]}}}})};function b(o,t,z){var E=this,y=null,x,u,p=[],s={},B={},r,v,w,D,A,q;i(E,{id:function(){return r},isLoaded:function(){return(y!==null)},getParent:function(){return o},hide:function(F){if(F){o.style.height="0px"}if(y){y.style.height="0px"}return E},show:function(){o.style.height=q+"px";if(y){y.style.height=A+"px"}return E},isHidden:function(){return y&&parseInt(y.style.height,10)===0},load:function(F){if(!y&&E._fireEvent("onBeforeLoad")!==false){m(a,function(){this.unload()});x=o.innerHTML;if(x&&!flashembed.isSupported(t.version)){o.innerHTML=""}flashembed(o,t,{config:z});if(F){F.cached=true;j(B,"onLoad",F)}}return E},unload:function(){if(x.replace(/\s/g,"")!==""){if(E._fireEvent("onBeforeUnload")===false){return E}try{if(y){y.fp_close()}}catch(F){}y=null;o.innerHTML=x;E._fireEvent("onUnload")}return E},getClip:function(F){if(F===undefined){F=D}return p[F]},getCommonClip:function(){return u},getPlaylist:function(){return p},getPlugin:function(F){var H=s[F];if(!H&&E.isLoaded()){var G=E._api().fp_getPlugin(F);if(G){H=new l(F,G,E);s[F]=H}}return H},getScreen:function(){return E.getPlugin("screen")},getControls:function(){return E.getPlugin("controls")},getConfig:function(F){return F?k(z):z},getFlashParams:function(){return t},loadPlugin:function(I,H,K,J){if(typeof K=="function"){J=K;K={}}var G=J?e():"_";E._api().fp_loadPlugin(I,H,K,G);var F={};F[G]=J;var L=new l(I,null,E,F);s[I]=L;return L},getState:function(){return y?y.fp_getState():-1},play:function(G,F){function H(){if(G!==undefined){E._api().fp_play(G,F)}else{E._api().fp_play()}}if(y){H()}else{E.load(function(){H()})}return E},getVersion:function(){var G="flowplayer.js 3.1.4";if(y){var F=y.fp_getVersion();F.push(G);return F}return G},_api:function(){if(!y){throw"Flowplayer "+E.id()+" not loaded when calling an API method"}return y},setClip:function(F){E.setPlaylist([F]);return E},getIndex:function(){return w}});m(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut").split(","),function(){var F="on"+this;if(F.indexOf("*")!=-1){F=F.substring(0,F.length-1);var G="onBefore"+F.substring(2);E[G]=function(H){j(B,G,H);return E}}E[F]=function(H){j(B,F,H);return E}});m(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed").split(","),function(){var F=this;E[F]=function(H,G){if(!y){return E}var I=null;if(H!==undefined&&G!==undefined){I=y["fp_"+F](H,G)}else{I=(H===undefined)?y["fp_"+F]():y["fp_"+F](H)}return I==="undefined"||I===undefined?E:I}});E._fireEvent=function(O){if(typeof O=="string"){O=[O]}var P=O[0],M=O[1],K=O[2],J=O[3],I=0;if(z.debug){g(O)}if(!y&&P=="onLoad"&&M=="player"){y=y||c(v);A=y.clientHeight;m(p,function(){this._fireEvent("onLoad")});m(s,function(Q,R){R._fireEvent("onUpdate")});u._fireEvent("onLoad")}if(P=="onLoad"&&M!="player"){return}if(P=="onError"){if(typeof M=="string"||(typeof M=="number"&&typeof K=="number")){M=K;K=J}}if(P=="onContextMenu"){m(z.contextMenu[M],function(Q,R){R.call(E)});return}if(P=="onPluginEvent"){var F=M.name||M;var G=s[F];if(G){G._fireEvent("onUpdate",M);G._fireEvent(K,O.slice(3))}return}if(P=="onPlaylistReplace"){p=[];var L=0;m(M,function(){p.push(new h(this,L++,E))})}if(P=="onClipAdd"){if(M.isInStream){return}M=new h(M,K,E);p.splice(K,0,M);for(I=K+1;I<p.length;I++){p[I].index++}}var N=true;if(typeof M=="number"&&M<p.length){D=M;var H=p[M];if(H){N=H._fireEvent(P,K,J)}if(!H||N!==false){N=u._fireEvent(P,K,J,H)}}m(B[P],function(){N=this.call(E,M,K);if(this.cached){B[P].splice(I,1)}if(N===false){return false}I++});return N};function C(){if($f(o)){$f(o).getParent().innerHTML="";w=$f(o).getIndex();a[w]=E}else{a.push(E);w=a.length-1}q=parseInt(o.style.height,10)||o.clientHeight;if(typeof t=="string"){t={src:t}}r=o.id||"fp"+e();v=t.id||r+"_api";t.id=v;t.cachebusting=true;z.playerId=r;if(typeof z=="string"){z={clip:{url:z}}}if(typeof z.clip=="string"){z.clip={url:z.clip}}z.clip=z.clip||{};if(o.getAttribute("href",2)&&!z.clip.url){z.clip.url=o.getAttribute("href",2)}u=new h(z.clip,-1,E);z.playlist=z.playlist||[z.clip];var F=0;m(z.playlist,function(){var H=this;if(typeof H=="object"&&H.length){H={url:""+H}}m(z.clip,function(I,J){if(J!==undefined&&H[I]===undefined&&typeof J!="function"){H[I]=J}});z.playlist[F]=H;H=new h(H,F,E);p.push(H);F++});m(z,function(H,I){if(typeof I=="function"){if(u[H]){u[H](I)}else{j(B,H,I)}delete z[H]}});m(z.plugins,function(H,I){if(I){s[H]=new l(H,I,E)}});if(!z.plugins||z.plugins.controls===undefined){s.controls=new l("controls",null,E)}s.canvas=new l("canvas",null,E);t.bgcolor=t.bgcolor||"#000000";t.version=t.version||[9,0];t.expressInstall="http://www.flowplayer.org/swf/expressinstall.swf";function G(H){if(!E.isLoaded()&&E._fireEvent("onBeforeClick")!==false){E.load()}return f(H)}x=o.innerHTML;if(x.replace(/\s/g,"")!==""){if(o.addEventListener){o.addEventListener("click",G,false)}else{if(o.attachEvent){o.attachEvent("onclick",G)}}}else{if(o.addEventListener){o.addEventListener("click",f,false)}E.load()}}if(typeof o=="string"){flashembed.domReady(function(){var F=c(o);if(!F){throw"Flowplayer cannot access element: "+o}else{o=F;C()}})}else{C()}}var a=[];function d(o){this.length=o.length;this.each=function(p){m(o,p)};this.size=function(){return o.length}}window.flowplayer=window.$f=function(){var p=null;var o=arguments[0];if(!arguments.length){m(a,function(){if(this.isLoaded()){p=this;return false}});return p||a[0]}if(arguments.length==1){if(typeof o=="number"){return a[o]}else{if(o=="*"){return new d(a)}m(a,function(){if(this.id()==o.id||this.id()==o||this.getParent()==o){p=this;return false}});return p}}if(arguments.length>1){var r=arguments[1];var q=(arguments.length==3)?arguments[2]:{};if(typeof o=="string"){if(o.indexOf(".")!=-1){var t=[];m(n(o),function(){t.push(new b(this,k(r),k(q)))});return new d(t)}else{var s=c(o);return new b(s!==null?s:o,r,q)}}else{if(o){return new b(o,r,q)}}}return null};i(window.$f,{fireEvent:function(){var o=[].slice.call(arguments);var q=$f(o[0]);return q?q._fireEvent(o.slice(1)):null},addPlugin:function(o,p){b.prototype[o]=p;return $f},each:m,extend:i});if(typeof jQuery=="function"){jQuery.prototype.flowplayer=function(q,p){if(!arguments.length||typeof arguments[0]=="number"){var o=[];this.each(function(){var r=$f(this);if(r){o.push(r)}});return arguments.length?o[arguments[0]]:new d(o)}return this.each(function(){$f(this,k(q),p?k(p):{})})}}})();(function(){var e=typeof jQuery=="function";var i={width:"100%",height:"100%",allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:null,onFail:null,expressInstall:null,w3c:false,cachebusting:false};if(e){jQuery.tools=jQuery.tools||{};jQuery.tools.flashembed={version:"1.0.4",conf:i}}function j(){if(c.done){return false}var l=document;if(l&&l.getElementsByTagName&&l.getElementById&&l.body){clearInterval(c.timer);c.timer=null;for(var k=0;k<c.ready.length;k++){c.ready[k].call()}c.ready=null;c.done=true}}var c=e?jQuery:function(k){if(c.done){return k()}if(c.timer){c.ready.push(k)}else{c.ready=[k];c.timer=setInterval(j,13)}};function f(l,k){if(k){for(key in k){if(k.hasOwnProperty(key)){l[key]=k[key]}}}return l}function g(k){switch(h(k)){case"string":k=k.replace(new RegExp('(["\\\\])',"g"),"\\$1");k=k.replace(/^\s?(\d+)%/,"$1pct");return'"'+k+'"';case"array":return"["+b(k,function(n){return g(n)}).join(",")+"]";case"function":return'"function()"';case"object":var l=[];for(var m in k){if(k.hasOwnProperty(m)){l.push('"'+m+'":'+g(k[m]))}}return"{"+l.join(",")+"}"}return String(k).replace(/\s/g," ").replace(/\'/g,'"')}function h(l){if(l===null||l===undefined){return false}var k=typeof l;return(k=="object"&&l.push)?"array":k}if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})}function b(k,n){var m=[];for(var l in k){if(k.hasOwnProperty(l)){m[l]=n(k[l])}}return m}function a(r,t){var q=f({},r);var s=document.all;var n='<object width="'+q.width+'" height="'+q.height+'"';if(s&&!q.id){q.id="_"+(""+Math.random()).substring(9)}if(q.id){n+=' id="'+q.id+'"'}if(q.cachebusting){q.src+=((q.src.indexOf("?")!=-1?"&":"?")+Math.random())}if(q.w3c||!s){n+=' data="'+q.src+'" type="application/x-shockwave-flash"'}else{n+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'}n+=">";if(q.w3c||s){n+='<param name="movie" value="'+q.src+'" />'}q.width=q.height=q.id=q.w3c=q.src=null;for(var l in q){if(q[l]!==null){n+='<param name="'+l+'" value="'+q[l]+'" />'}}var o="";if(t){for(var m in t){if(t[m]!==null){o+=m+"="+(typeof t[m]=="object"?g(t[m]):t[m])+"&"}}o=o.substring(0,o.length-1);n+='<param name="flashvars" value=\''+o+"' />"}n+="</object>";return n}function d(m,p,l){var k=flashembed.getVersion();f(this,{getContainer:function(){return m},getConf:function(){return p},getVersion:function(){return k},getFlashvars:function(){return l},getApi:function(){return m.firstChild},getHTML:function(){return a(p,l)}});var q=p.version;var r=p.expressInstall;var o=!q||flashembed.isSupported(q);if(o){p.onFail=p.version=p.expressInstall=null;m.innerHTML=a(p,l)}else{if(q&&r&&flashembed.isSupported([6,65])){f(p,{src:r});l={MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title};m.innerHTML=a(p,l)}else{if(m.innerHTML.replace(/\s/g,"")!==""){}else{m.innerHTML="<h2>Flash version "+q+" or greater is required</h2><h3>"+(k[0]>0?"Your version is "+k:"You have no flash plugin installed")+"</h3>"+(m.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='http://www.adobe.com/go/getflashplayer'>here</a></p>");if(m.tagName=="A"){m.onclick=function(){location.href="http://www.adobe.com/go/getflashplayer"}}}}}if(!o&&p.onFail){var n=p.onFail.call(this);if(typeof n=="string"){m.innerHTML=n}}if(document.all){window[p.id]=document.getElementById(p.id)}}window.flashembed=function(l,m,k){if(typeof l=="string"){var n=document.getElementById(l);if(n){l=n}else{c(function(){flashembed(l,m,k)});return}}if(!l){return}if(typeof m=="string"){m={src:m}}var o=f({},i);f(o,m);return new d(l,o,k)};f(window.flashembed,{getVersion:function(){var m=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var l=navigator.plugins["Shockwave Flash"].description;if(typeof l!="undefined"){l=l.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var n=parseInt(l.replace(/^(.*)\..*$/,"$1"),10);var r=/r/.test(l)?parseInt(l.replace(/^.*r(.*)$/,"$1"),10):0;m=[n,r]}}else{if(window.ActiveXObject){try{var p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(q){try{p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");m=[6,0];p.AllowScriptAccess="always"}catch(k){if(m[0]==6){return m}}try{p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(o){}}if(typeof p=="object"){l=p.GetVariable("$version");if(typeof l!="undefined"){l=l.replace(/^\S+\s+(.*)$/,"$1").split(",");m=[parseInt(l[0],10),parseInt(l[2],10)]}}}}return m},isSupported:function(k){var m=flashembed.getVersion();var l=(m[0]>k[0])||(m[0]==k[0]&&m[1]>=k[1]);return l},domReady:c,asString:g,getHTML:a});if(e){jQuery.fn.flashembed=function(l,k){var m=null;this.each(function(){m=flashembed(this,l,k)});return l.api===false?this:m}}})();
|
js/flowplayer.controls-3.1.3.swf
ADDED
Binary file
|
package.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Tentura_Mvideo</name>
|
4 |
+
<version>0.1.0</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>Extension for upload videos to Youtube directly from your Magento Shop</summary>
|
10 |
+
<description>Extension for upload videos to Youtube directly from your Magento Shop
|
11 |
+

|
12 |
+
Main features
|
13 |
+
* Directly upload videos on Youtube from Magento shop. 
|
14 |
+
* Insert Youtube video by Youtube key
|
15 |
+
* Insert custom video HTML (embed tags)
|
16 |
+
* Use previously uploaded videos
|
17 |
+
* Upload video on your web hosting, convert it to *.flv format and display with nice FLW player.
|
18 |
+

|
19 |
+
Using a one string of code, you can add video to any place of product page, and not just:
|
20 |
+
<?php echo Mage::helper('mvideo')->getVideoHtml($_product->getId());?></description>
|
21 |
+
<notes>Extension for upload videos to Youtube directly from your Magento Shop
|
22 |
+

|
23 |
+
Main features
|
24 |
+
* Directly upload videos on Youtube from Magento shop. 
|
25 |
+
* Insert Youtube video by Youtube key
|
26 |
+
* Insert custom video HTML (embed tags)
|
27 |
+
* Use previously uploaded videos
|
28 |
+
* Upload video on your web hosting, convert it to *.flv format and display with nice FLW player.
|
29 |
+

|
30 |
+
Using a one string of code, you can add video to any place of product page, and not just:
|
31 |
+
<?php echo Mage::helper('mvideo')->getVideoHtml($_product->getId());?></notes>
|
32 |
+
<authors><author><name>Tentura Team</name><user>tentura</user><email>info@tentura.eu</email></author></authors>
|
33 |
+
<date>2012-12-01</date>
|
34 |
+
<time>02:37:22</time>
|
35 |
+
<contents><target name="magelocal"><dir name="Tentura"><dir name="Mvideo"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Action"><dir name="Attribute"><dir name="Tab"><file name="Attributes.php" hash="b945d32c89e7259e321b6166f0cfda9b"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="bac7d13adc14bab694a5247e03f041df"/></dir><dir name="Model"><file name="Lang.php" hash="122a64dc148fcb78fa8764ae8c25e0ac"/><file name="Mvideo.php" hash="cb59749eeeda09bc0b9a802dfeffef83"/><file name="MvideoForProducts.php" hash="74d2032015b08d725ff8f33d37ea691f"/><dir name="Mysql4"><dir name="Mvideo"><file name="Collection.php" hash="208c601a6035358641aa477ecb9a4389"/></dir><file name="Mvideo.php" hash="424b0c1b509aa531c83ba09aecd7236c"/><dir name="MvideoForProducts"><file name="Collection.php" hash="2354cc9739b5003b0787ee4c5d1d238c"/></dir><file name="MvideoForProducts.php" hash="51179cda1deea8bf4e2dd78b215ec500"/></dir><file name="Observer.php" hash="d14bf716a841585367b6331764082a38"/><file name="Status.php" hash="5b6247bd570f73e991cda60beab7f7b8"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Catalog"><file name="ProductController.php" hash="cd8a060d598bc5d293eb5f17ac78be0c"/></dir><file name="MvideoController.php" hash="0d330629f935a3273c4cb48f95f844e7"/></dir></dir><dir name="etc"><file name="config.xml" hash="d5c8ccc71eb1b42f95e1acd7452f6388"/><file name="system.xml" hash="2bf1b91255e50972b8a41f6439390947"/></dir><dir name="sql"><dir name="mvideo_setup"><file name="mysql4-install-0.1.0.php" hash="c4f4eac995fa0404bc168f56c191814a"/></dir><file name=".DS_Store" hash="7758c840a3caf8bf0047ee4c2d8fef91"/></dir><file name=".DS_Store" hash="bc4bd711acf6f51eb916d5b24b019a58"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="mvideo.xml" hash="a6b843dce1e6d0349373527ae41de171"/></dir><dir name="template"><dir name="mvideo"><file name="coming.phtml" hash="a85aa9f654f00f8ac1583bc7fcca6cf7"/><file name="upload.phtml" hash="364248fde9247e0d0cd90bd6923b6071"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Tentura_Mvideo.xml" hash="f275d3e8cfbcf8168e365a58f788651a"/></dir></target><target name="mageweb"><dir name="js"><file name="flowplayer-3.1.3.swf" hash="956808b1fa1c2d399514e07a34542a1a"/><file name="flowplayer-3.1.4.min.js" hash="7e9498111e106b20c032ee2c84ef7fe7"/><file name="flowplayer.controls-3.1.3.swf" hash="0e88f2ed2b1ec37d3259a1d20ae0f5c7"/></dir></target></contents>
|
36 |
+
<compatible/>
|
37 |
+
<dependencies><required><php><min>5.2.13</min><max>5.4.9</max></php></required></dependencies>
|
38 |
+
</package>
|