Version Notes
This module was tested in Magento Commerce version 1.4.0.1 and 1.5.0.1, and work in this version smoothly.
Download this release
Release Info
Developer | Magento Core Team |
Extension | PSystem_Base |
Version | 1.0.1 |
Comparing to | |
See all releases |
Version 1.0.1
- app/code/community/PSystem/Base/Helper/Data.php +18 -0
- app/code/community/PSystem/Base/Model/Observer.php +55 -0
- app/code/community/PSystem/Base/etc/config.xml +48 -0
- app/code/community/PSystem/Base/etc/system.xml +17 -0
- app/design/frontend/default/default/layout/ps_base.xml +17 -0
- app/etc/modules/PSystem_Base.xml +17 -0
- js/pascalsystem/base.js +170 -0
- package.xml +18 -0
- skin/frontend/default/default/css/pascalsystem/base.css +16 -0
app/code/community/PSystem/Base/Helper/Data.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?
|
2 |
+
/**
|
3 |
+
* @category PSystem
|
4 |
+
* @package PSystem_Base
|
5 |
+
* @author Pascal System <info@pascalsystem.pl>
|
6 |
+
* @version 1.0.1
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Pascal Base Helper
|
11 |
+
*
|
12 |
+
* @category PSystem
|
13 |
+
* @package PSystem_Base
|
14 |
+
* @author Pascal System <info@pascalsystem.pl>
|
15 |
+
* @version 1.0.1
|
16 |
+
*/
|
17 |
+
class PSystem_Base_Helper_Data extends Mage_Core_Helper_Abstract {
|
18 |
+
}
|
app/code/community/PSystem/Base/Model/Observer.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category PSystem
|
4 |
+
* @package PSystem_Base
|
5 |
+
* @author Pascal System <info@pascalsystem.pl>
|
6 |
+
* @version 1.0.1
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Pascal Base utility observer
|
11 |
+
*
|
12 |
+
* @category PSystem
|
13 |
+
* @package PSystem_Base
|
14 |
+
* @author Pascal System <info@pascalsystem.pl>
|
15 |
+
* @version 1.0.1
|
16 |
+
*/
|
17 |
+
class PSystem_Base_Model_Observer {
|
18 |
+
/**
|
19 |
+
* Observer post dispatching
|
20 |
+
*
|
21 |
+
* @param Varien_Event_Observer $event
|
22 |
+
*/
|
23 |
+
public function postdispatch(Varien_Event_Observer $event) {
|
24 |
+
/* @var $controller Mage_Core_Controller_Varien_Action */
|
25 |
+
$controller = $event->getControllerAction();
|
26 |
+
if (!$controller->getRequest()->getHeader('X-Requested-With')) {
|
27 |
+
return;
|
28 |
+
}
|
29 |
+
|
30 |
+
$param = array();
|
31 |
+
|
32 |
+
if (function_exists('apache_request_headers'))
|
33 |
+
$headers = apache_request_headers();
|
34 |
+
else
|
35 |
+
$headers = getallheader();
|
36 |
+
foreach ($headers as $headerName => $headerValue) {
|
37 |
+
$headerName = strtolower($headerName);
|
38 |
+
if (!preg_match('/pascalsystem(.*)/',$headerName,$regs))
|
39 |
+
continue;
|
40 |
+
$param[$regs[1]] = $headerValue;
|
41 |
+
}
|
42 |
+
|
43 |
+
$layout = Mage::app()->getLayout();
|
44 |
+
$blocks = array();
|
45 |
+
foreach ($param as $blockName => $selector) {
|
46 |
+
$temp = $layout->getBlock($blockName);
|
47 |
+
$blocks[$blockName] = array(
|
48 |
+
'selector' => $selector,
|
49 |
+
'html' => ($temp)?$temp->toHtml():''
|
50 |
+
);
|
51 |
+
}
|
52 |
+
echo json_encode($blocks);
|
53 |
+
exit;
|
54 |
+
}
|
55 |
+
}
|
app/code/community/PSystem/Base/etc/config.xml
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category PSystem
|
5 |
+
* @package PSystem_Base
|
6 |
+
* @author Pascal System <info@pascalsystem.pl>
|
7 |
+
* @version 1.0.1
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<PSystem_Base>
|
13 |
+
<version>1.0.1</version>
|
14 |
+
</PSystem_Base>
|
15 |
+
</modules>
|
16 |
+
<global>
|
17 |
+
<models>
|
18 |
+
<psbase>
|
19 |
+
<class>PSystem_Base_Model</class>
|
20 |
+
</psbase>
|
21 |
+
</models>
|
22 |
+
<helpers>
|
23 |
+
<psbase>
|
24 |
+
<class>PSystem_Base_Helper</class>
|
25 |
+
</psbase>
|
26 |
+
</helpers>
|
27 |
+
<events>
|
28 |
+
<controller_action_postdispatch>
|
29 |
+
<observers>
|
30 |
+
<psystem_base_observer>
|
31 |
+
<type>singleton</type>
|
32 |
+
<class>psbase/observer</class>
|
33 |
+
<method>postdispatch</method>
|
34 |
+
</psystem_base_observer>
|
35 |
+
</observers>
|
36 |
+
</controller_action_postdispatch>
|
37 |
+
</events>
|
38 |
+
</global>
|
39 |
+
<frontend>
|
40 |
+
<layout>
|
41 |
+
<updates>
|
42 |
+
<psbase module="PSystem_Base">
|
43 |
+
<file>ps_base.xml</file>
|
44 |
+
</psbase>
|
45 |
+
</updates>
|
46 |
+
</layout>
|
47 |
+
</frontend>
|
48 |
+
</config>
|
app/code/community/PSystem/Base/etc/system.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category PSystem
|
5 |
+
* @package PSystem_Base
|
6 |
+
* @author Pascal System <info@pascalsystem.pl>
|
7 |
+
* @version 1.0.1
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<tabs>
|
12 |
+
<psystem translate="label">
|
13 |
+
<label>Pascal System</label>
|
14 |
+
<sort_order>100</sort_order>
|
15 |
+
</psystem>
|
16 |
+
</tabs>
|
17 |
+
</config>
|
app/design/frontend/default/default/layout/ps_base.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category PSystem
|
5 |
+
* @package PSystem_Base
|
6 |
+
* @author Pascal System <info@pascalsystem.pl>
|
7 |
+
* @version 1.0.1
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<layout version="1.0.0">
|
11 |
+
<default>
|
12 |
+
<reference name="head">
|
13 |
+
<action method="addCss"><stylesheet>css/pascalsystem/base.css</stylesheet></action>
|
14 |
+
<action method="addJs"><script>pascalsystem/base.js</script></action>
|
15 |
+
</reference>
|
16 |
+
</default>
|
17 |
+
</layout>
|
app/etc/modules/PSystem_Base.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category PSystem
|
5 |
+
* @package PSystem_Base
|
6 |
+
* @author Pascal System <info@pascalsystem.pl>
|
7 |
+
* @version 1.0.1
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<PSystem_Base>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>community</codePool>
|
15 |
+
</PSystem_Base>
|
16 |
+
</modules>
|
17 |
+
</config>
|
js/pascalsystem/base.js
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
PascalSystem Function
|
3 |
+
*/
|
4 |
+
var PS = {
|
5 |
+
onload : function(func) {
|
6 |
+
if (typeof this._domLoadedFunction == 'undefined')
|
7 |
+
PS._domLoadedFunction = new Array();
|
8 |
+
PS._domLoadedFunction.push(func);
|
9 |
+
document.observe("dom:loaded", PS._onload);
|
10 |
+
},
|
11 |
+
substr : function(strVal, startIndex, lengthSubstring) {
|
12 |
+
strVal = strVal.toString();
|
13 |
+
if (typeof lengthSubstring == 'undefined')
|
14 |
+
lengthSubstring = false;
|
15 |
+
if (typeof strVal.substr == 'function') {
|
16 |
+
if (lengthSubstring)
|
17 |
+
return strVal.substr(startIndex, lengthSubstring);
|
18 |
+
return strVal.substr(startIndex);
|
19 |
+
}
|
20 |
+
var strLen = strVal.length;
|
21 |
+
if (strLen<startIndex)
|
22 |
+
return '';
|
23 |
+
var buildStr = '';
|
24 |
+
for (var i=startIndex;i<strLen;i++) {
|
25 |
+
if (i>startIndex+lengthSubstring)
|
26 |
+
return buildStr;
|
27 |
+
buildStr+= strVal[i];
|
28 |
+
}
|
29 |
+
return buildStr;
|
30 |
+
},
|
31 |
+
evalJsOnContent : function(content) {
|
32 |
+
if (typeof content == 'string')
|
33 |
+
content = document.getElementById(content);
|
34 |
+
if (!content) return;
|
35 |
+
var scripts = content.getElementsByTagName('script');
|
36 |
+
for (var i=0;i<scripts.length;i++) {
|
37 |
+
eval(scripts[i].innerHTML);
|
38 |
+
}
|
39 |
+
},
|
40 |
+
overlayElement : function(element) {
|
41 |
+
if (typeof element == 'string')
|
42 |
+
element = document.getElementById(element);
|
43 |
+
if (!element) return;
|
44 |
+
element._psoverlay = document.createElement('div');
|
45 |
+
element._psoverlay.className = 'pascalsystem-overlay';
|
46 |
+
if (element.className && element.className.toString().length>0) {
|
47 |
+
element._psoverlay.className+= ' pascalsystem-'+element.className.toString().split(' ').join(' pascalsystem-');
|
48 |
+
}
|
49 |
+
if (element.id && element.id.toString().length>0) {
|
50 |
+
element._psoverlay.id+= 'pascalsystem-'+element.id.toString();
|
51 |
+
}
|
52 |
+
element._psoverlay.style.display = 'none';
|
53 |
+
element._psoverlay.style.position = 'absolute';
|
54 |
+
var temps = element.getElementsByTagName('*');
|
55 |
+
if (temps.length) {
|
56 |
+
element.insertBefore(element._psoverlay, temps[0]);
|
57 |
+
} else {
|
58 |
+
element.appendChild(element._psoverlay);
|
59 |
+
}
|
60 |
+
var dimm = $(element).getDimensions();
|
61 |
+
element._psoverlay.style.width = dimm.width.toString()+'px';
|
62 |
+
element._psoverlay.style.height = dimm.height.toString()+'px';
|
63 |
+
element._psoverlay.style.display = 'block';
|
64 |
+
return true;
|
65 |
+
},
|
66 |
+
unOverlayElement : function(element) {
|
67 |
+
return;
|
68 |
+
if (typeof element == 'string')
|
69 |
+
element = document.getElementById(element);
|
70 |
+
if (!element) return;
|
71 |
+
if (typeof element._psoverlay == 'undefined') return;
|
72 |
+
element._psoverlay.style.display = 'none';
|
73 |
+
element._psoverlay.parentNode.removeChild(element._psoverlay);
|
74 |
+
element._psoverlay = false;
|
75 |
+
return true;
|
76 |
+
},
|
77 |
+
eachFunc : function(selector, funcRef) {
|
78 |
+
if (typeof selector == 'string') {
|
79 |
+
selector = $$(selector);
|
80 |
+
}
|
81 |
+
for (var i=0;i<selector.length;i++) {
|
82 |
+
if (typeof funcRef == 'string') {
|
83 |
+
selector[i].funcRef();
|
84 |
+
} else {
|
85 |
+
funcRef(selector[i]);
|
86 |
+
}
|
87 |
+
}
|
88 |
+
},
|
89 |
+
extendConfig : function(baseConfObj, config) {
|
90 |
+
for (var key in config) {
|
91 |
+
if (typeof baseConfObj[key] == 'undefined') {
|
92 |
+
baseConfObj[key] = config[key];
|
93 |
+
continue;
|
94 |
+
}
|
95 |
+
if ((typeof config[key] == 'object') && (typeof config[key].length == 'undefined')) {
|
96 |
+
PS.extendConfig(baseConfObj[key], config[key]);
|
97 |
+
continue;
|
98 |
+
}
|
99 |
+
baseConfObj[key] = config[key];
|
100 |
+
}
|
101 |
+
},
|
102 |
+
_onload : function() {
|
103 |
+
if (typeof PS._domLoadedFunction == 'undefined')
|
104 |
+
return;
|
105 |
+
var funcRef;
|
106 |
+
for (var i=0;i<PS._domLoadedFunction.length;i++) {
|
107 |
+
funcRef = PS._domLoadedFunction[i];
|
108 |
+
if (typeof funcRef == 'function') {
|
109 |
+
funcRef();
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
113 |
+
};
|
114 |
+
/**
|
115 |
+
PascalSystem Ajax function
|
116 |
+
*/
|
117 |
+
PS.ajax = {
|
118 |
+
call : function(url, blocks) {
|
119 |
+
var isQuery = ((url.length>0) && (url[0]=='?') || (url.indexOf('?')>0))?true:false;
|
120 |
+
var params = {};
|
121 |
+
for (var key in blocks) {
|
122 |
+
params['pascalsystem'+key] = blocks[key];
|
123 |
+
}
|
124 |
+
var obj = new Ajax.Request(url,{
|
125 |
+
method:'get',
|
126 |
+
requestHeaders: params,
|
127 |
+
onSuccess: function(transport){
|
128 |
+
var response = transport.responseText || "";
|
129 |
+
var data = eval('('+response+')');
|
130 |
+
var selector;
|
131 |
+
var html;
|
132 |
+
var destEls;
|
133 |
+
var regs;
|
134 |
+
var replaceElement = false;
|
135 |
+
var destEl; var srcEl;
|
136 |
+
var temp;
|
137 |
+
for (var blockName in data) {
|
138 |
+
selector = data[blockName].selector;
|
139 |
+
regs = selector.split('|');
|
140 |
+
replaceElement = false;
|
141 |
+
if (regs.length>1) {
|
142 |
+
selector = regs[0];
|
143 |
+
replaceElement = regs[1];
|
144 |
+
}
|
145 |
+
destEls = $$(selector);
|
146 |
+
if (!destEls.length) continue;
|
147 |
+
if (replaceElement) {
|
148 |
+
destEls = $(destEls[0]).getElementsBySelector(replaceElement);
|
149 |
+
if (!destEls.length) continue;
|
150 |
+
temp = document.createElement('div');
|
151 |
+
temp.innerHTML = data[blockName].html;
|
152 |
+
srcEl = $(temp).getElementsBySelector(replaceElement);
|
153 |
+
if (!srcEl.length) continue;
|
154 |
+
srcEl = srcEl[0];
|
155 |
+
destEls[0].style.display = 'none';
|
156 |
+
destEls[0].parentNode.insertBefore(srcEl, destEls[0]);
|
157 |
+
destEls[0].parentNode.removeChild(destEls[0]);
|
158 |
+
temp = null;
|
159 |
+
destEl = destEls[0];
|
160 |
+
} else {
|
161 |
+
destEl = destEls[0];
|
162 |
+
destEl.innerHTML = data[blockName].html;
|
163 |
+
}
|
164 |
+
PS.evalJsOnContent(destEl);
|
165 |
+
}
|
166 |
+
PS._onload();
|
167 |
+
}
|
168 |
+
});
|
169 |
+
}
|
170 |
+
};
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>PSystem_Base</name>
|
4 |
+
<version>1.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Pascal System base</summary>
|
10 |
+
<description>Common libraries for other pascal system modules.</description>
|
11 |
+
<notes>This module was tested in Magento Commerce version 1.4.0.1 and 1.5.0.1, and work in this version smoothly.</notes>
|
12 |
+
<authors><author><name>Pascal System</name><user>auto-converted</user><email>info@pascalsystem.pl</email></author></authors>
|
13 |
+
<date>2011-03-28</date>
|
14 |
+
<time>22:00:03</time>
|
15 |
+
<contents><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="pascalsystem"><file name="base.css" hash="49bcce4684a42b1a116d4bae15c9680b"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="ps_base.xml" hash="d3723f04260852ffcbe6b96e9d1c7383"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="pascalsystem"><file name="base.js" hash="c822b4380927f213685ac6a40a74708a"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PSystem_Base.xml" hash="f08fb44f4cab0e6d94977f4ae0032e7c"/></dir></target><target name="magecommunity"><dir name="PSystem"><dir name="Base"><dir name="etc"><file name="config.xml" hash="bfad3697b7d5705baa3d2a7917cfe8f2"/><file name="system.xml" hash="f6c0a59e41c60459dce68c947c05aae2"/></dir><dir name="Helper"><file name="Data.php" hash="ebc68ac0163e1fa369cc55382e188690"/></dir><dir name="Model"><file name="Observer.php" hash="8fcf59110401faf4adda7402883f08cb"/></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies/>
|
18 |
+
</package>
|
skin/frontend/default/default/css/pascalsystem/base.css
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.pascalsystem-overlay {
|
2 |
+
background:#ffffff;
|
3 |
+
z-index:999;
|
4 |
+
-moz-opacity:.75;
|
5 |
+
-webkit-opacity:.75;
|
6 |
+
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=75)";
|
7 |
+
/*IE8*/ opacity:.75;
|
8 |
+
filter: alpha(opacity=75);
|
9 |
+
}
|
10 |
+
.pascalsystem-block-layered-nav {
|
11 |
+
-moz-opacity:.01;
|
12 |
+
-webkit-opacity:.01;
|
13 |
+
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=01)";
|
14 |
+
/*IE8*/ opacity:.01;
|
15 |
+
filter: alpha(opacity=01);
|
16 |
+
}
|