Version Notes
This is first stable release of the extension. This is well tested in all new magento releases.
Download this release
Release Info
Developer | Rajeev K Tomy |
Extension | js-css-for-sb |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Rkt/JsCssforSb/Block/Jscss.php +24 -0
- app/code/community/Rkt/JsCssforSb/Helper/Data.php +28 -0
- app/code/community/Rkt/JsCssforSb/Helper/Data.php~ +28 -0
- app/code/community/Rkt/JsCssforSb/Model/Block.php +17 -0
- app/code/community/Rkt/JsCssforSb/Model/JsCss.php +16 -0
- app/code/community/Rkt/JsCssforSb/Model/Observer.php +200 -0
- app/code/community/Rkt/JsCssforSb/Model/Resource/JsCss.php +20 -0
- app/code/community/Rkt/JsCssforSb/Model/Resource/JsCss/Collection.php +15 -0
- app/code/community/Rkt/JsCssforSb/Model/Resource/Setup.php +11 -0
- app/code/community/Rkt/JsCssforSb/etc/config.xml +103 -0
- app/code/community/Rkt/JsCssforSb/sql/rkt_jscssforsb_setup/install-1.0.0.php +62 -0
- app/etc/modules/Rkt_JsCssforSb.xml +22 -0
- package.xml +34 -0
app/code/community/Rkt/JsCssforSb/Block/Jscss.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Jscss Block
|
4 |
+
*
|
5 |
+
* @category Extension
|
6 |
+
* @package Rkt_JsCssforSb
|
7 |
+
* @author Programmer-RKT
|
8 |
+
*/
|
9 |
+
class Rkt_JsCssforSb_Block_Jscss extends Mage_Core_Block_Template {
|
10 |
+
|
11 |
+
/**
|
12 |
+
*
|
13 |
+
* Retrieve jscss entity
|
14 |
+
*
|
15 |
+
* @param int | $id
|
16 |
+
* @return Rkt_JsCssforSb_Model_JsCss
|
17 |
+
*
|
18 |
+
*/
|
19 |
+
public function getJscssEntity($id){
|
20 |
+
|
21 |
+
return Mage::getModel('rkt_jscssforsb/jsCss')->load($id);
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
app/code/community/Rkt/JsCssforSb/Helper/Data.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Helper
|
4 |
+
*
|
5 |
+
* @category Extension
|
6 |
+
* @package Rkt_JsCssforSb
|
7 |
+
* @author Programmer-RKT
|
8 |
+
*/
|
9 |
+
class Rkt_JsCssforSb_Helper_Data extends Mage_Core_Helper_Abstract {
|
10 |
+
|
11 |
+
/**
|
12 |
+
*
|
13 |
+
* Use to trim unwanted spaces, new lines from passed data
|
14 |
+
*
|
15 |
+
* @param string | $data
|
16 |
+
* @return string
|
17 |
+
*
|
18 |
+
*/
|
19 |
+
public function modifyData($data){
|
20 |
+
if($data != ''){
|
21 |
+
$trimed_data = str_replace(array(" ","\n","\t","'"),array("","","",'"'),trim($data));
|
22 |
+
|
23 |
+
return preg_replace('/\s+/','',$trimed_data );
|
24 |
+
}
|
25 |
+
|
26 |
+
return '';
|
27 |
+
}
|
28 |
+
}
|
app/code/community/Rkt/JsCssforSb/Helper/Data.php~
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Helper
|
4 |
+
*
|
5 |
+
* @category Extension
|
6 |
+
* @package Rkt_JsCssforSb
|
7 |
+
* @author Programmer-RKT
|
8 |
+
*/
|
9 |
+
class Rkt_JsCssforSb_Helper_Data extends Mage_Core_Helper_Abstract {
|
10 |
+
|
11 |
+
/**
|
12 |
+
*
|
13 |
+
* Use to trim unwanted spaces, new lines from passed data
|
14 |
+
*
|
15 |
+
* @param string | $data
|
16 |
+
* @return string
|
17 |
+
*
|
18 |
+
*/
|
19 |
+
public function modifyData($data){
|
20 |
+
if($data != '')
|
21 |
+
$trimed_data = str_replace(array(" ","\n","\t","'"),array("","","",'"'),trim($data));
|
22 |
+
|
23 |
+
return preg_replace('/\s+/','',$trimed_data );
|
24 |
+
}
|
25 |
+
|
26 |
+
return '';
|
27 |
+
}
|
28 |
+
}
|
app/code/community/Rkt/JsCssforSb/Model/Block.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Rewrite for Mage_Cms_Model_Block
|
4 |
+
*
|
5 |
+
* @category Extension
|
6 |
+
* @package Rkt_JsCssforSb
|
7 |
+
* @author Programmer-RKT
|
8 |
+
*/
|
9 |
+
class Rkt_JsCssforSb_Model_Block extends Mage_Cms_Model_Block {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Prefix of model events names
|
13 |
+
*
|
14 |
+
* @var string
|
15 |
+
*/
|
16 |
+
protected $_eventPrefix = 'cms_block';
|
17 |
+
}
|
app/code/community/Rkt/JsCssforSb/Model/JsCss.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Model for jscss
|
4 |
+
*
|
5 |
+
* @category Extension
|
6 |
+
* @package Rkt_JsCssforSb
|
7 |
+
* @author Programmer-RKT
|
8 |
+
*/
|
9 |
+
class Rkt_JsCssforSb_Model_JsCss extends Mage_Core_Model_Abstract {
|
10 |
+
|
11 |
+
protected function _construct(){
|
12 |
+
|
13 |
+
$this->_init('rkt_jscssforsb/jsCss');
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/Rkt/JsCssforSb/Model/Observer.php
ADDED
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Observer that adds new fieldsets for cms -> static blocks
|
4 |
+
*
|
5 |
+
* @category Extension
|
6 |
+
* @package Rkt_JsCssforSb
|
7 |
+
* @author Programmer-RKT
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Rkt_JsCssforSb_Model_Observer {
|
11 |
+
|
12 |
+
/**
|
13 |
+
*
|
14 |
+
* Use to set jsscss fieldsets in cms_block
|
15 |
+
*
|
16 |
+
* @param Varien_Event_Observer | $observer
|
17 |
+
*
|
18 |
+
*/
|
19 |
+
public function addNewFieldsetForCmsBlock($observer) {
|
20 |
+
|
21 |
+
$block = $observer->getEvent()->getBlock();
|
22 |
+
|
23 |
+
//check whether block is cms_block_form
|
24 |
+
if ($block instanceof Mage_Adminhtml_Block_Cms_Block_Edit_Form) {
|
25 |
+
|
26 |
+
//get cms_block form
|
27 |
+
$form = $block->getForm();
|
28 |
+
|
29 |
+
//get jscss values
|
30 |
+
$js_value = ''; $css_value = '';
|
31 |
+
$block_id = (int)Mage::registry('cms_block')->getBlockId();
|
32 |
+
$cms_block = $this->getJsCssEntity($block_id);
|
33 |
+
|
34 |
+
//get values if entity exist
|
35 |
+
if($cms_block){
|
36 |
+
|
37 |
+
$js_value = $cms_block->getJscssJs();
|
38 |
+
$css_value = $cms_block->getJscssCss();
|
39 |
+
}
|
40 |
+
|
41 |
+
//add jscss fieldsets and its fields
|
42 |
+
$fieldset = $form->addFieldset('jscss_fieldset', array(
|
43 |
+
'legend'=>Mage::helper('rkt_jscssforsb')->__('Js/Css Section'),
|
44 |
+
'class' => 'fieldset-wide')
|
45 |
+
);
|
46 |
+
$fieldset->addField('jscss_js', 'textarea', array(
|
47 |
+
'name' => 'jscss_js',
|
48 |
+
'label' => Mage::helper('rkt_jscssforsb')->__('Insert Javascript'),
|
49 |
+
'title' => Mage::helper('rkt_jscssforsb')->__('Insert Javascript'),
|
50 |
+
'required' => false,
|
51 |
+
'value' => Mage::helper('rkt_jscssforsb')->__($js_value),
|
52 |
+
|
53 |
+
));
|
54 |
+
$fieldset->addField('jscss_css', 'textarea', array(
|
55 |
+
'name' => 'jscss_css',
|
56 |
+
'label' => Mage::helper('rkt_jscssforsb')->__('Insert CSS'),
|
57 |
+
'title' => Mage::helper('rkt_jscssforsb')->__('Insert CSS'),
|
58 |
+
'required' => false,
|
59 |
+
'value' => Mage::helper('rkt_jscssforsb')->__($css_value),
|
60 |
+
|
61 |
+
));
|
62 |
+
}
|
63 |
+
|
64 |
+
return;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
*
|
69 |
+
* Use to save js and css for cms_block
|
70 |
+
*
|
71 |
+
* @param Varien_Event_Observer | $observer
|
72 |
+
*
|
73 |
+
*/
|
74 |
+
public function saveJsCss($observer) {
|
75 |
+
|
76 |
+
//get object
|
77 |
+
$cms_block = $observer->getEvent()->getObject();
|
78 |
+
|
79 |
+
//retrieve essential datas to store
|
80 |
+
$block_id = (int)$cms_block->getBlockId();
|
81 |
+
$js = Mage::helper('rkt_jscssforsb')->modifyData($cms_block->getJscssJs());
|
82 |
+
$css = Mage::helper('rkt_jscssforsb')->modifyData($cms_block->getJscssCss());
|
83 |
+
|
84 |
+
if($js != '' || $css != ''){
|
85 |
+
|
86 |
+
//prepare data to save
|
87 |
+
$data = array(
|
88 |
+
'block_id' => $block_id,
|
89 |
+
'jscss_js' => $js,
|
90 |
+
'jscss_css' => $css,
|
91 |
+
);
|
92 |
+
|
93 |
+
//model
|
94 |
+
$model = Mage::getModel('rkt_jscssforsb/jsCss');
|
95 |
+
|
96 |
+
//saves data if cms block is new
|
97 |
+
if(!$this->getJsCssEntity($block_id)){
|
98 |
+
|
99 |
+
$model->addData($data);
|
100 |
+
$model->save();
|
101 |
+
}
|
102 |
+
|
103 |
+
//saves data if entry already exist
|
104 |
+
else {
|
105 |
+
|
106 |
+
$exist_block = $this->getJsCssEntity($block_id);
|
107 |
+
$exist_block->addData($data);
|
108 |
+
$exist_block->save();
|
109 |
+
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
*
|
117 |
+
* Apply css and js to static blocks
|
118 |
+
*
|
119 |
+
* @param Varien_Event_Observer | $observer
|
120 |
+
*
|
121 |
+
*/
|
122 |
+
public function applyJsCssToCMSBlocks($observer) {
|
123 |
+
|
124 |
+
//set default values to variables
|
125 |
+
$flag = 0; $jscss_ids = array();
|
126 |
+
|
127 |
+
$layout = $observer->getEvent()->getLayout();
|
128 |
+
|
129 |
+
foreach ($layout->getAllBlocks() as $block) {
|
130 |
+
|
131 |
+
if ($block instanceof Mage_Cms_Block_Block) {
|
132 |
+
|
133 |
+
$flag = 1;
|
134 |
+
//get cms block id
|
135 |
+
$block_identifier = $block->getBlockId();
|
136 |
+
$block_id = (int)Mage::getModel('cms/block')->getCollection()
|
137 |
+
->addFieldToSelect('block_id')
|
138 |
+
->addFieldToFilter('identifier', array('eq' => $block_identifier))
|
139 |
+
->load()
|
140 |
+
->getFirstItem()
|
141 |
+
->getBlockId();
|
142 |
+
|
143 |
+
|
144 |
+
//check for any entry that is correspond for cms block
|
145 |
+
if($cms_block = $this->getJsCssEntity($block_id)){
|
146 |
+
|
147 |
+
//store jscss ids
|
148 |
+
$jscss_ids[] = (int)$cms_block->getJscssId();
|
149 |
+
|
150 |
+
|
151 |
+
}
|
152 |
+
|
153 |
+
}
|
154 |
+
}
|
155 |
+
//print_r($jscss_ids);die();
|
156 |
+
if($flag == 1){
|
157 |
+
|
158 |
+
//create a custom block to insert js and css correspond to cms block
|
159 |
+
$new_block = $layout->createBlock(
|
160 |
+
|
161 |
+
'Rkt_JsCssforSb_Block_Jscss',
|
162 |
+
'jscss_block',
|
163 |
+
array(
|
164 |
+
|
165 |
+
'template' => 'rkt_jscssforsb/jscss.phtml',
|
166 |
+
'jscss_ids' => Mage::helper('rkt_jscssforsb')->__(implode(",",$jscss_ids)),
|
167 |
+
));
|
168 |
+
$layout->getBlock('content')->append($new_block);
|
169 |
+
|
170 |
+
}
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
*
|
176 |
+
* Use to get jscss entity correspond to cms > block that is editing currently
|
177 |
+
*
|
178 |
+
* @param int | $block_id
|
179 |
+
* @return boolean or Rkt_JsCssforSb_Model_JsCss | false or $item
|
180 |
+
*
|
181 |
+
*/
|
182 |
+
public function getJsCssEntity($block_id){
|
183 |
+
|
184 |
+
//loads collection
|
185 |
+
$collection = Mage::getModel('rkt_jscssforsb/jsCss')->getCollection()
|
186 |
+
->addFieldToSelect('*')
|
187 |
+
->addFieldToFilter('block_id', array('eq' => $block_id))
|
188 |
+
->load();
|
189 |
+
//ensure an item exist
|
190 |
+
if(count($collection->getFirstItem()->getData())){
|
191 |
+
|
192 |
+
return $collection->getFirstItem();
|
193 |
+
}
|
194 |
+
|
195 |
+
return false;
|
196 |
+
}
|
197 |
+
}
|
198 |
+
//http://stackoverflow.com/questions/17832914/how-do-i-extend-cms-block-on-save-event-of-magento
|
199 |
+
?>
|
200 |
+
|
app/code/community/Rkt/JsCssforSb/Model/Resource/JsCss.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Resource for jscss
|
4 |
+
*
|
5 |
+
* @category Extension
|
6 |
+
* @package Rkt_JsCssforSb
|
7 |
+
* @author Programmer-RKT
|
8 |
+
*/
|
9 |
+
class Rkt_JsCssforSb_Model_Resource_JsCss extends Mage_Core_Model_Resource_Db_Abstract {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Initialize resource model
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
protected function _construct()
|
16 |
+
{
|
17 |
+
$this->_init('rkt_jscssforsb/jsCss', 'jscss_id');
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
app/code/community/Rkt/JsCssforSb/Model/Resource/JsCss/Collection.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Collection for jscss
|
4 |
+
*
|
5 |
+
* @category Extension
|
6 |
+
* @package Rkt_JsCssforSb
|
7 |
+
* @author Programmer-RKT
|
8 |
+
*/
|
9 |
+
class Rkt_JsCssforSb_Model_Resource_JsCss_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
|
10 |
+
|
11 |
+
protected function _construct(){
|
12 |
+
|
13 |
+
$this->_init('rkt_jscssforsb/jsCss');
|
14 |
+
}
|
15 |
+
}
|
app/code/community/Rkt/JsCssforSb/Model/Resource/Setup.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Resource Setup
|
4 |
+
*
|
5 |
+
* @category Extension
|
6 |
+
* @package Rkt_JsCssforSb
|
7 |
+
* @author Programmer-RKT
|
8 |
+
*/
|
9 |
+
class Rkt_JsCssforSb_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
|
10 |
+
|
11 |
+
}
|
app/code/community/Rkt/JsCssforSb/etc/config.xml
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* configuration
|
5 |
+
*
|
6 |
+
*
|
7 |
+
* @category Extension
|
8 |
+
* @package rkt_jscssforsb
|
9 |
+
* @programmer Programmer-rkt
|
10 |
+
*/
|
11 |
+
-->
|
12 |
+
<config>
|
13 |
+
<modules>
|
14 |
+
<Rkt_JsCssforSb>
|
15 |
+
<version>1.0.0</version>
|
16 |
+
</Rkt_JsCssforSb>
|
17 |
+
</modules>
|
18 |
+
<frontend>
|
19 |
+
<events>
|
20 |
+
<controller_action_layout_generate_blocks_after>
|
21 |
+
<observers>
|
22 |
+
<apply_jscss_to_cmsblocks>
|
23 |
+
<class>rkt_jscssforsb/observer</class>
|
24 |
+
<method>applyJsCssToCMSBlocks</method>
|
25 |
+
</apply_jscss_to_cmsblocks>
|
26 |
+
</observers>
|
27 |
+
</controller_action_layout_generate_blocks_after>
|
28 |
+
</events>
|
29 |
+
</frontend>
|
30 |
+
<adminhtml>
|
31 |
+
<events>
|
32 |
+
<adminhtml_block_html_before>
|
33 |
+
<observers>
|
34 |
+
<add_jscss_fieldset_in_cms_block_edit_form>
|
35 |
+
<class>rkt_jscssforsb/observer</class>
|
36 |
+
<method>addNewFieldsetForCmsBlock</method>
|
37 |
+
</add_jscss_fieldset_in_cms_block_edit_form>
|
38 |
+
</observers>
|
39 |
+
</adminhtml_block_html_before>
|
40 |
+
<cms_block_save_after>
|
41 |
+
<observers>
|
42 |
+
<save_jscss>
|
43 |
+
<class>rkt_jscssforsb/observer</class>
|
44 |
+
<method>saveJsCss</method>
|
45 |
+
</save_jscss>
|
46 |
+
</observers>
|
47 |
+
</cms_block_save_after>
|
48 |
+
</events>
|
49 |
+
</adminhtml>
|
50 |
+
<global>
|
51 |
+
<models>
|
52 |
+
<cms>
|
53 |
+
<rewrite>
|
54 |
+
<block>Rkt_JsCssforSb_Model_Block</block>
|
55 |
+
</rewrite>
|
56 |
+
</cms>
|
57 |
+
<rkt_jscssforsb>
|
58 |
+
<class>Rkt_JsCssforSb_Model</class>
|
59 |
+
<resourceModel>rkt_jscssforsb_resource</resourceModel>
|
60 |
+
</rkt_jscssforsb>
|
61 |
+
<rkt_jscssforsb_resource>
|
62 |
+
<class>Rkt_JsCssforSb_Model_Resource</class>
|
63 |
+
<entities>
|
64 |
+
<jsCss>
|
65 |
+
<table>rkt_jscssforsb_cms_block_jscss</table>
|
66 |
+
</jsCss>
|
67 |
+
</entities>
|
68 |
+
</rkt_jscssforsb_resource>
|
69 |
+
</models>
|
70 |
+
<resources>
|
71 |
+
<rkt_jscssforsb_setup>
|
72 |
+
<setup>
|
73 |
+
<module>Rkt_JsCssforSb</module>
|
74 |
+
<class>Rkt_JsCssforSb_Model_Resource_Setup</class>
|
75 |
+
</setup>
|
76 |
+
<connection>
|
77 |
+
<use>core_setup</use>
|
78 |
+
</connection>
|
79 |
+
</rkt_jscssforsb_setup>
|
80 |
+
<rkt_jscssforsb_write>
|
81 |
+
<connection>
|
82 |
+
<use>core_write</use>
|
83 |
+
</connection>
|
84 |
+
</rkt_jscssforsb_write>
|
85 |
+
<rkt_jscssforsb_read>
|
86 |
+
<connection>
|
87 |
+
<use>core_read</use>
|
88 |
+
</connection>
|
89 |
+
</rkt_jscssforsb_read>
|
90 |
+
</resources>
|
91 |
+
<helpers>
|
92 |
+
<rkt_jscssforsb>
|
93 |
+
<class>Rkt_JsCssforSb_Helper</class>
|
94 |
+
</rkt_jscssforsb>
|
95 |
+
</helpers>
|
96 |
+
<blocks>
|
97 |
+
<rkt_jscssforsb>
|
98 |
+
<class>Rkt_JsCssforSb_Block</class>
|
99 |
+
</rkt_jscssforsb>
|
100 |
+
|
101 |
+
</blocks>
|
102 |
+
</global>
|
103 |
+
</config>
|
app/code/community/Rkt/JsCssforSb/sql/rkt_jscssforsb_setup/install-1.0.0.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* installer
|
4 |
+
*
|
5 |
+
* @category Extension
|
6 |
+
* @package Rkt_JsCssforSb
|
7 |
+
* @author Programmer-RKT
|
8 |
+
*/
|
9 |
+
|
10 |
+
$installer = $this;
|
11 |
+
//die(__FILE__);
|
12 |
+
$installer->startSetup();
|
13 |
+
|
14 |
+
$tableName = $installer->getTable('rkt_jscssforsb/jsCss');
|
15 |
+
|
16 |
+
// Check if the table already exists
|
17 |
+
if ($installer->getConnection()->isTableExists($tableName) != true) {
|
18 |
+
|
19 |
+
$table = $installer->getConnection()->newTable($installer->getTable('rkt_jscssforsb/jsCss'))
|
20 |
+
|
21 |
+
->addColumn('jscss_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
22 |
+
'identity' => true,
|
23 |
+
'unsigned' => true,
|
24 |
+
'nullable' => false,
|
25 |
+
'primary' => true,
|
26 |
+
),
|
27 |
+
'JsCss Enity Id'
|
28 |
+
)
|
29 |
+
->addColumn('block_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
30 |
+
'nullable' => true,
|
31 |
+
'unsigned' => true,
|
32 |
+
),
|
33 |
+
'CMS Block Id'
|
34 |
+
)
|
35 |
+
->addColumn('jscss_css', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
36 |
+
'nullable' => true,
|
37 |
+
),
|
38 |
+
'Css for CMS Block'
|
39 |
+
)
|
40 |
+
->addColumn('jscss_js', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
41 |
+
'nullable' => true,
|
42 |
+
),
|
43 |
+
'JS for CMS Block'
|
44 |
+
)
|
45 |
+
|
46 |
+
->addForeignKey(
|
47 |
+
$installer->getFkName(
|
48 |
+
'rkt_jscssforsb/jsCss',
|
49 |
+
'mcrypt_enc_is_block_algorithm_mode(td)',
|
50 |
+
'cms/block',
|
51 |
+
'block_id'
|
52 |
+
),
|
53 |
+
'block_id', $installer->getTable('cms/block'), 'block_id',
|
54 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
|
55 |
+
|
56 |
+
->setComment('Table for Rkt_JsCssforSb extension');
|
57 |
+
|
58 |
+
$installer->getConnection()->createTable($table);
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
$installer->endSetup();
|
app/etc/modules/Rkt_JsCssforSb.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Rktnto
|
5 |
+
*
|
6 |
+
*
|
7 |
+
* @category Extension
|
8 |
+
* @package Rkt_JsCssforSb
|
9 |
+
* @programmer Programmer-rkt
|
10 |
+
*/
|
11 |
+
-->
|
12 |
+
<config>
|
13 |
+
<modules>
|
14 |
+
<Rkt_JsCssforSb>
|
15 |
+
<active>true</active>
|
16 |
+
<codePool>community</codePool>
|
17 |
+
<depends>
|
18 |
+
<Mage_Cms />
|
19 |
+
</depends>
|
20 |
+
</Rkt_JsCssforSb>
|
21 |
+
</modules>
|
22 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>js-css-for-sb</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://rajeev-k-tomy.blogspot.in/">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>A Magento Extension that will allow to add javascript and css for static blocks. </summary>
|
10 |
+
<description><h2>INTRODUCTION</h2>
|
11 |
+

|
12 |
+
A Magento Extension that will allow to add javascript and css for static blocks. This extension makes static blocks somewhat &quot;dynamic&quot;. For every static block, there will be provision to add javascript and CSS to that particular static block. Whenever static blocks with js and css are rendered in frontend, these properties will get applied to that static blocks
|
13 |
+

|
14 |
+
<h2>COMPATIBILITY</h2>
|
15 |
+

|
16 |
+
Currently this extension supports Magento 1.8,1.8.1,1.9
|
17 |
+

|
18 |
+

|
19 |
+
<h2>NOTES</h2>
|
20 |
+

|
21 |
+
<ul>
|
22 |
+
<li>Don't put script or style tags inside the text areas. The extension will autogenerate this enclosure html tags.</li>
|
23 |
+
<li>You can put javascirpt and css directly inside text areas
|
24 |
+
Don't put html contents inside the text area</li>
|
25 |
+
<li>You can put jquery in text area. In this case, it is your job to make sure that, necessary jquery files are added.</li>
|
26 |
+
<li>By default, all the script that are related to static blocks are get included in the bottom side of the page and css files are included in head part (bottom side).</li></ul></description>
|
27 |
+
<notes>This is first stable release of the extension. This is well tested in all new magento releases.</notes>
|
28 |
+
<authors><author><name>Rajeev K Tomy</name><user>Rajeev_KT</user><email>rajeevphpdeveloper@gmail.com</email></author></authors>
|
29 |
+
<date>2014-08-21</date>
|
30 |
+
<time>12:05:53</time>
|
31 |
+
<contents><target name="magecommunity"><dir name="Rkt"><dir name="JsCssforSb"><dir name="Block"><file name="Jscss.php" hash="53acaed81b34be203c8207bde6f31369"/></dir><dir name="Helper"><file name="Data.php" hash="be0fd17363bbcc8e72af264a19c17da5"/><file name="Data.php~" hash="d5850d5e99867bfbd0fe92c1da0bbea0"/></dir><dir name="Model"><file name="Block.php" hash="df72873f83fe52d19f4ec634ab1f7cf8"/><file name="JsCss.php" hash="f138ee0345cd14b8542e56595a641b6e"/><file name="Observer.php" hash="2c144bc1c6785d8152a42e205334bd10"/><dir name="Resource"><dir name="JsCss"><file name="Collection.php" hash="63381048f23f6b2d555a7302f9f8be55"/></dir><file name="JsCss.php" hash="1387928530281587eb04469135c3c4bc"/><file name="Setup.php" hash="fc79061b804cd01529773cad5c939022"/></dir></dir><dir name="etc"><file name="config.xml" hash="ee1d777fe5aad300f1e839cf43e449de"/></dir><dir name="sql"><dir name="rkt_jscssforsb_setup"><file name="install-1.0.0.php" hash="e3cd316717a2a4a2e93580c2b5747164"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><file name="rkt_jscssforsb" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Rkt_JsCssforSb.xml" hash="b67f5083c0ee056b38cad9bde3b6a8ec"/></dir></target></contents>
|
32 |
+
<compatible/>
|
33 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
34 |
+
</package>
|