Version Notes
First release
Download this release
Release Info
Developer | Wiseboost |
Extension | Wiseboost_QuickProductEdit |
Version | 1.0.0.0 |
Comparing to | |
See all releases |
Version 1.0.0.0
- app/code/community/Wiseboost/General/Helper/Data.php +21 -0
- app/code/community/Wiseboost/General/Model/Feed.php +129 -0
- app/code/community/Wiseboost/General/etc/config.xml +90 -0
- app/code/community/Wiseboost/General/etc/system.xml +42 -0
- app/code/community/Wiseboost/TopBar/controllers/CheckController.php +174 -0
- app/code/community/Wiseboost/TopBar/etc/config.xml +58 -0
- app/design/frontend/base/default/layout/wiseboost/topbar.xml +28 -0
- app/design/frontend/base/default/template/wiseboost/topbar.xml +27 -0
- app/design/frontend/base/default/template/wiseboost/topbar/view.phtml +52 -0
- app/etc/modules/Wiseboost_General.xml +9 -0
- app/etc/modules/Wiseboost_TopBar.xml +28 -0
- package.xml +18 -0
- skin/frontend/base/default/css/wbtb.css +96 -0
- skin/frontend/base/default/images/Wiseboost_TopBar/logo.png +0 -0
- skin/frontend/base/default/js/Wiseboost_TopBar/wbtb.js +84 -0
app/code/community/Wiseboost/General/Helper/Data.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Wiseboost
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Wiseboost
|
13 |
+
* @package Wiseboost_General
|
14 |
+
* @copyright Copyright (c) 2013 Wiseboost. (http://www.wiseboost.com)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
class Wiseboost_General_Helper_Data extends Mage_Core_Helper_Abstract
|
19 |
+
{
|
20 |
+
|
21 |
+
}
|
app/code/community/Wiseboost/General/Model/Feed.php
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Wiseboost
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Wiseboost
|
13 |
+
* @package Wiseboost_General
|
14 |
+
* @copyright Copyright (c) 2013 Wiseboost. (http://www.wiseboost.com)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
class Wiseboost_General_Model_Feed extends Mage_AdminNotification_Model_Feed
|
19 |
+
{
|
20 |
+
const XML_USE_HTTPS_PATH = 'wiseboostgeneral/feed/use_https';
|
21 |
+
const XML_FEED_URL_PATH = 'wiseboostgeneral/feed/url';
|
22 |
+
const XML_FREQUENCY_PATH = 'wiseboostgeneral/feed/frequency';
|
23 |
+
const XML_FREQUENCY_ENABLE = 'wiseboostgeneral/feed/enable';
|
24 |
+
const XML_LAST_UPDATE_PATH = 'wiseboostgeneral/feed/last_update';
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Retrieve feed url
|
28 |
+
*
|
29 |
+
* @return string
|
30 |
+
*/
|
31 |
+
public function getFeedUrl()
|
32 |
+
{
|
33 |
+
if (is_null($this->_feedUrl)) {
|
34 |
+
$this->_feedUrl = (Mage::getStoreConfigFlag(self::XML_USE_HTTPS_PATH) ? 'https://' : 'http://')
|
35 |
+
. Mage::getStoreConfig(self::XML_FEED_URL_PATH);
|
36 |
+
}
|
37 |
+
return $this->_feedUrl;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Check feed for modification
|
42 |
+
*
|
43 |
+
* @return Mage_AdminNotification_Model_Feed
|
44 |
+
*/
|
45 |
+
public function checkUpdate()
|
46 |
+
{
|
47 |
+
|
48 |
+
if (($this->getFrequency() + $this->getLastUpdate()) > time()) {
|
49 |
+
return $this;
|
50 |
+
}
|
51 |
+
|
52 |
+
$feedData = array();
|
53 |
+
|
54 |
+
$feedXml = $this->getFeedData();
|
55 |
+
|
56 |
+
if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
|
57 |
+
foreach ($feedXml->channel->item as $item) {
|
58 |
+
if ($this->isValidItem($item)) {
|
59 |
+
$feedData[] = array(
|
60 |
+
'severity' => (int)$item->severity ? (int)$item->severity : 3,
|
61 |
+
'date_added' => $this->getDate((string)$item->pubDate),
|
62 |
+
'title' => (string)$item->title,
|
63 |
+
'description' => (string)$item->description,
|
64 |
+
'url' => (string)$item->link,
|
65 |
+
);
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
if ($feedData) {
|
70 |
+
Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
|
71 |
+
}
|
72 |
+
|
73 |
+
}
|
74 |
+
$this->setLastUpdate();
|
75 |
+
|
76 |
+
return $this;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Retrieve Update Frequency
|
81 |
+
*
|
82 |
+
* @return int
|
83 |
+
*/
|
84 |
+
public function getFrequency()
|
85 |
+
{
|
86 |
+
return Mage::getStoreConfig(self::XML_FREQUENCY_PATH) * 3600;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Retrieve Last update time
|
91 |
+
*
|
92 |
+
* @return int
|
93 |
+
*/
|
94 |
+
public function getLastUpdate()
|
95 |
+
{
|
96 |
+
return Mage::app()->loadCache('wiseboostgeneral_notifications_lastcheck');
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Set last update time (now)
|
101 |
+
*
|
102 |
+
* @return Mage_AdminNotification_Model_Feed
|
103 |
+
*/
|
104 |
+
public function setLastUpdate()
|
105 |
+
{
|
106 |
+
Mage::app()->saveCache(time(), 'wiseboostgeneral_notifications_lastcheck');
|
107 |
+
return $this;
|
108 |
+
}
|
109 |
+
|
110 |
+
public static function check(){
|
111 |
+
if (!Mage::getStoreConfig(self::XML_FREQUENCY_ENABLE)) {
|
112 |
+
return;
|
113 |
+
}
|
114 |
+
|
115 |
+
return Mage::getModel('wiseboostgeneral/feed')->checkUpdate();
|
116 |
+
}
|
117 |
+
|
118 |
+
/* Valid the feed item */
|
119 |
+
private function isValidItem($item) {
|
120 |
+
$bValid = false;
|
121 |
+
|
122 |
+
if ( (strtotime($this->getDate((string)$item->pubDate))) >=
|
123 |
+
(strtotime("7 May 2013")) ) {
|
124 |
+
$bValid = true;
|
125 |
+
}
|
126 |
+
|
127 |
+
return $bValid;
|
128 |
+
}
|
129 |
+
}
|
app/code/community/Wiseboost/General/etc/config.xml
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Wiseboost_General>
|
5 |
+
<version>2.0</version>
|
6 |
+
</Wiseboost_General>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<wiseboostgeneral>
|
11 |
+
<class>Wiseboost_General_Block</class>
|
12 |
+
</wiseboostgeneral>
|
13 |
+
</blocks>
|
14 |
+
<resources>
|
15 |
+
<wiseboostgeneral_setup>
|
16 |
+
<setup>
|
17 |
+
<module>Wiseboost_General</module>
|
18 |
+
</setup>
|
19 |
+
<connection>
|
20 |
+
<use>core_setup</use>
|
21 |
+
</connection>
|
22 |
+
</wiseboostgeneral_setup>
|
23 |
+
<wiseboostgeneral_write>
|
24 |
+
<connection>
|
25 |
+
<use>core_write</use>
|
26 |
+
</connection>
|
27 |
+
</wiseboostgeneral_write>
|
28 |
+
<wiseboostgeneral_read>
|
29 |
+
<connection>
|
30 |
+
<use>core_read</use>
|
31 |
+
</connection>
|
32 |
+
</wiseboostgeneral_read>
|
33 |
+
</resources>
|
34 |
+
<models>
|
35 |
+
<wiseboostgeneral>
|
36 |
+
<class>Wiseboost_General_Model</class>
|
37 |
+
</wiseboostgeneral>
|
38 |
+
</models>
|
39 |
+
<helpers>
|
40 |
+
<wiseboostgeneral>
|
41 |
+
<class>Wiseboost_General_Helper</class>
|
42 |
+
</wiseboostgeneral>
|
43 |
+
</helpers>
|
44 |
+
</global>
|
45 |
+
<adminhtml>
|
46 |
+
<acl>
|
47 |
+
<resources>
|
48 |
+
<all>
|
49 |
+
<title>Allow Everything</title>
|
50 |
+
</all>
|
51 |
+
<admin>
|
52 |
+
<children>
|
53 |
+
<system>
|
54 |
+
<children>
|
55 |
+
<config>
|
56 |
+
<children>
|
57 |
+
<wiseboostgeneral>
|
58 |
+
<title>Wiseboost - General</title>
|
59 |
+
</wiseboostgeneral>
|
60 |
+
</children>
|
61 |
+
</config>
|
62 |
+
</children>
|
63 |
+
</system>
|
64 |
+
</children>
|
65 |
+
</admin>
|
66 |
+
</resources>
|
67 |
+
</acl>
|
68 |
+
<events>
|
69 |
+
<controller_action_predispatch>
|
70 |
+
<observers>
|
71 |
+
<wiseboostgeneral>
|
72 |
+
<type>singleton</type>
|
73 |
+
<class>wiseboostgeneral/feed</class>
|
74 |
+
<method>check</method>
|
75 |
+
</wiseboostgeneral>
|
76 |
+
</observers>
|
77 |
+
</controller_action_predispatch>
|
78 |
+
</events>
|
79 |
+
</adminhtml>
|
80 |
+
<default>
|
81 |
+
<wiseboostgeneral>
|
82 |
+
<feed>
|
83 |
+
<url>www.wiseboost.com/?feed=rss2&cat=12</url>
|
84 |
+
<use_https>0</use_https>
|
85 |
+
<frequency>24</frequency>
|
86 |
+
<enable>1</enable>
|
87 |
+
</feed>
|
88 |
+
</wiseboostgeneral>
|
89 |
+
</default>
|
90 |
+
</config>
|
app/code/community/Wiseboost/General/etc/system.xml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<wiseboostgeneral translate="label" module="wiseboostgeneral">
|
5 |
+
<label>Wiseboost General</label>
|
6 |
+
<sort_order>99999</sort_order>
|
7 |
+
</wiseboostgeneral>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<wiseboostgeneral translate="label" module="wiseboostgeneral">
|
11 |
+
<label>Notifications</label>
|
12 |
+
<tab>wiseboostgeneral</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>99999</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<feed>
|
20 |
+
<label>Notifications</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>70</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<enable translate="label">
|
28 |
+
<label>Enabled</label>
|
29 |
+
<comment>Enable notifications from Wiseboost</comment>
|
30 |
+
<frontend_type>select</frontend_type>
|
31 |
+
<sort_order>100</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
36 |
+
</enable>
|
37 |
+
</fields>
|
38 |
+
</feed>
|
39 |
+
</groups>
|
40 |
+
</wiseboostgeneral>
|
41 |
+
</sections>
|
42 |
+
</config>
|
app/code/community/Wiseboost/TopBar/controllers/CheckController.php
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Wiseboost
|
13 |
+
* @package Wiseboost_TopBar
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
class Wiseboost_TopBar_CheckController extends Mage_Adminhtml_Controller_Action
|
17 |
+
{
|
18 |
+
|
19 |
+
public function preDispatch()
|
20 |
+
{
|
21 |
+
$answer = array();
|
22 |
+
$answer['error']['code'] = -1;
|
23 |
+
$answer['error']['msg'] = ""; // admin not logged in.
|
24 |
+
|
25 |
+
try
|
26 |
+
{
|
27 |
+
ob_start();
|
28 |
+
|
29 |
+
$admin_logged_in = false;
|
30 |
+
|
31 |
+
// Ensure we're in the admin session namespace for checking the admin user...
|
32 |
+
|
33 |
+
// version of Magento 1.7 use 'adminhtml', 1.5 use 'PHPSESSID'. This might be configurable,
|
34 |
+
// in this case the bar will never show up.
|
35 |
+
$sessionName = ((array_key_exists(('adminhtml'), $_COOKIE)) ? 'adminhtml' : 'PHPSESSID');
|
36 |
+
|
37 |
+
Mage::getSingleton('core/session', array('name' => $sessionName))->start();
|
38 |
+
|
39 |
+
$admin_logged_in = Mage::getSingleton('admin/session', array('name' => $sessionName))->isLoggedIn();
|
40 |
+
|
41 |
+
|
42 |
+
// ..get back to the original.
|
43 |
+
Mage::getSingleton('core/session', array('name' => $this->_sessionNamespace))->start();
|
44 |
+
|
45 |
+
if ($admin_logged_in)
|
46 |
+
{
|
47 |
+
$answer['error']['code'] = 1;
|
48 |
+
$answer['error']['msg'] = ""; // admin logged in.
|
49 |
+
|
50 |
+
|
51 |
+
// retrieve POST parameters
|
52 |
+
$storeId = (int)Mage::app()->getFrontController()->getRequest()->getParam('store_id', false);
|
53 |
+
$cleanBaseURL = Mage::app()->getFrontController()->getRequest()->getParam('cleanbaseurl', false);
|
54 |
+
|
55 |
+
|
56 |
+
// $vPath = 'orange.html';
|
57 |
+
$vPath = Mage::app()->getFrontController()->getRequest()->getParam('path', false);
|
58 |
+
$oRewrite = Mage::getModel('core/url_rewrite')
|
59 |
+
->setStoreId(Mage::app()->getStore($storeId)->getId())
|
60 |
+
->loadByRequestPath($vPath);
|
61 |
+
|
62 |
+
|
63 |
+
$iProductId = $oRewrite->getProductId();
|
64 |
+
|
65 |
+
$answer['admin']['url'] = "";
|
66 |
+
if ($iProductId != null)
|
67 |
+
{
|
68 |
+
$oProduct = Mage::getModel('catalog/product')->load($iProductId);
|
69 |
+
$answer['admin']['url'] = Mage::helper("adminhtml")->getUrl("adminhtml/catalog_product/edit/",array("id"=>$iProductId));
|
70 |
+
}
|
71 |
+
|
72 |
+
|
73 |
+
// retrieve store information
|
74 |
+
$answer['store']['id'] = $storeId;
|
75 |
+
$answer['store']['name'] = Mage::app()->getStore($storeId)->getName();
|
76 |
+
$answer['store']['cleanbaseurl'] = $cleanBaseURL;
|
77 |
+
|
78 |
+
|
79 |
+
// retrieve user information
|
80 |
+
$user = Mage::getSingleton('admin/session');
|
81 |
+
$answer['user']['name'] = $user->getUser()->getUsername();
|
82 |
+
$answer['user']['url'] = Mage::helper("adminhtml")->getUrl("adminhtml/", array());
|
83 |
+
|
84 |
+
|
85 |
+
$html = $this->getTopBarHTML($answer);
|
86 |
+
|
87 |
+
$output = ob_get_contents();
|
88 |
+
ob_end_clean();
|
89 |
+
if ($output == "")
|
90 |
+
{
|
91 |
+
// return the HTML code
|
92 |
+
echo $html;
|
93 |
+
return ;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
else
|
97 |
+
{
|
98 |
+
ob_end_clean();
|
99 |
+
}
|
100 |
+
}
|
101 |
+
catch (Exception $e)
|
102 |
+
{
|
103 |
+
// echo 'Caught exception: ', $e->getMessage(), "\n";
|
104 |
+
ob_end_clean();
|
105 |
+
}
|
106 |
+
|
107 |
+
echo "";
|
108 |
+
}
|
109 |
+
|
110 |
+
public function indexAction()
|
111 |
+
{
|
112 |
+
}
|
113 |
+
|
114 |
+
private function getTopBarHTML($answer)
|
115 |
+
{
|
116 |
+
$html = '';
|
117 |
+
|
118 |
+
$html .= '<div class="wiseboost_topbar_header" id="wiseboost_topbar" style="display: block;">';
|
119 |
+
$html .= ' <div class="wiseboost_topbar_header_inner">';
|
120 |
+
$html .= ' <ul class="wiseboost_topbar_horz_list wiseboost_topbar_horz_list_left">';
|
121 |
+
$html .= ' <li id="wiseboost_topbar_logo">';
|
122 |
+
$html .= ' <span><a href="http://www.wiseboost.com/" target="_blank" style="position">';
|
123 |
+
$html .= ' <img src="' . $answer['store']['cleanbaseurl'] . '/skin/frontend/base/default/images/Wiseboost_TopBar/logo.png" />';
|
124 |
+
$html .= ' </a></span>';
|
125 |
+
$html .= ' </li>';
|
126 |
+
$html .= ' <li>';
|
127 |
+
$html .= ' <span id="wiseboost_topbar_storename">' . $answer['store']['name'] . '</span>';
|
128 |
+
$html .= ' </li>';
|
129 |
+
if ($answer['admin']['url'] != "")
|
130 |
+
{
|
131 |
+
$html .= ' <li>';
|
132 |
+
$html .= ' <a href="'. $answer['admin']['url'] . '"" id="wiseboost_topbar_edit" target="_blank">Edit Product (will open in a new window)</a>';
|
133 |
+
$html .= ' </li>';
|
134 |
+
}
|
135 |
+
$html .= ' </ul>';
|
136 |
+
$html .= ' <ul class="wiseboost_topbar_horz_list wiseboost_topbar_horz_list_right">';
|
137 |
+
if ($answer['user']['name'] != "")
|
138 |
+
{
|
139 |
+
$html .= ' <li id="wiseboost_topbar_admin">';
|
140 |
+
$html .= ' <span>Logged in as : <a id="wiseboost_topbar_username" href="' . $answer['user']['url'] . '">' . $answer['user']['name'] . '</a></span>';
|
141 |
+
$html .= ' </li>';
|
142 |
+
}
|
143 |
+
$html .= ' <ul class="nav">';
|
144 |
+
$html .= ' <li><a class="header_top_link" title="" href="/account">TAG Conférence</a>';
|
145 |
+
$html .= ' <ul>';
|
146 |
+
$html .= ' <li><a class="header_top_link" title="" href="/account/logout">Déconnexion</a></li>';
|
147 |
+
$html .= ' </ul>';
|
148 |
+
$html .= ' </li>';
|
149 |
+
$html .= ' </ul>';
|
150 |
+
$html .= ' </ul>';
|
151 |
+
$html .= ' </div>';
|
152 |
+
$html .= '</div>';
|
153 |
+
|
154 |
+
return $this->sanitize_output($html);
|
155 |
+
}
|
156 |
+
|
157 |
+
private function sanitize_output($buffer)
|
158 |
+
{
|
159 |
+
$search = array(
|
160 |
+
'/\>[^\S ]+/s', //strip whitespaces after tags, except space
|
161 |
+
'/[^\S ]+\</s', //strip whitespaces before tags, except space
|
162 |
+
'/(\s)+/s' // shorten multiple whitespace sequences
|
163 |
+
);
|
164 |
+
$replace = array(
|
165 |
+
'>',
|
166 |
+
'<',
|
167 |
+
'\\1'
|
168 |
+
);
|
169 |
+
$buffer = preg_replace($search, $replace, $buffer);
|
170 |
+
|
171 |
+
return $buffer;
|
172 |
+
}
|
173 |
+
}
|
174 |
+
?>
|
app/code/community/Wiseboost/TopBar/etc/config.xml
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
*
|
13 |
+
* @category Wiseboost
|
14 |
+
* @package Wiseboost_TopBar
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
-->
|
18 |
+
<config>
|
19 |
+
<modules>
|
20 |
+
<Wiseboost_TopBar>
|
21 |
+
<version>1.0.0</version>
|
22 |
+
</Wiseboost_TopBar>
|
23 |
+
</modules>
|
24 |
+
<global>
|
25 |
+
<blocks>
|
26 |
+
<wiseboost_topbar>
|
27 |
+
<class>Wiseboost_TopBar_Block</class>
|
28 |
+
</wiseboost_topbar>
|
29 |
+
</blocks>
|
30 |
+
|
31 |
+
<!-- Custom Admin Notifications -->
|
32 |
+
|
33 |
+
</global>
|
34 |
+
<frontend>
|
35 |
+
<layout>
|
36 |
+
<updates>
|
37 |
+
<wiseboost_topbar>
|
38 |
+
<file>wiseboost/topbar.xml</file>
|
39 |
+
</wiseboost_topbar>
|
40 |
+
</updates>
|
41 |
+
</layout>
|
42 |
+
</frontend>
|
43 |
+
<admin>
|
44 |
+
<routers>
|
45 |
+
<topbar_check>
|
46 |
+
<use>admin</use>
|
47 |
+
<args>
|
48 |
+
<module>Wiseboost_TopBar</module>
|
49 |
+
<frontName>topbar_check</frontName>
|
50 |
+
</args>
|
51 |
+
</topbar_check>
|
52 |
+
</routers>
|
53 |
+
</admin>
|
54 |
+
|
55 |
+
|
56 |
+
<!-- Custom Admin Notifications -->
|
57 |
+
|
58 |
+
</config>
|
app/design/frontend/base/default/layout/wiseboost/topbar.xml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
*
|
13 |
+
* @category Wiseboost
|
14 |
+
* @package Wiseboost_TopBar
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
-->
|
18 |
+
<layout>
|
19 |
+
<default>
|
20 |
+
<reference name="head">
|
21 |
+
<action method="addCss"><file>css/wbtb.css</file></action>
|
22 |
+
<action method="addItem"><type>skin_js</type><script>js/Wiseboost_TopBar/wbtb.js</script></action>
|
23 |
+
</reference>
|
24 |
+
<reference name="before_body_end">
|
25 |
+
<block type="page/html" name="Wiseboost_TopBar.view" as="wiseboost_topbar" template="wiseboost/topbar/view.phtml" />
|
26 |
+
</reference>
|
27 |
+
</default>
|
28 |
+
</layout>
|
app/design/frontend/base/default/template/wiseboost/topbar.xml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
*
|
13 |
+
* @category Wiseboost
|
14 |
+
* @package Wiseboost_TopBar
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
-->
|
18 |
+
<layout>
|
19 |
+
<default>
|
20 |
+
<reference name="before_body_end">
|
21 |
+
<block type="Wiseboost/TopBar" name="Wiseboost_TopBar.view" as="wiseboost_topbar" template="page/view.phtml" />
|
22 |
+
|
23 |
+
<action method="unsetData"><key>cache_lifetime</key></action>
|
24 |
+
<action method="unsetData"><key>cache_tags</key></action>
|
25 |
+
</reference>
|
26 |
+
</default>
|
27 |
+
</layout>
|
app/design/frontend/base/default/template/wiseboost/topbar/view.phtml
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Wiseboost
|
13 |
+
* @package Wiseboost_TopBar
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
<?php if(!Mage::getStoreConfigFlag('advanced/modules_disable_output/Wiseboost_TopBar')) { ?>
|
18 |
+
<?php
|
19 |
+
$baseURL = Mage::app()->getStore(Mage::app()->getStore()->getId())->getBaseUrl(/*Mage_Core_Model_Store::URL_TYPE_LINK*/);
|
20 |
+
$cleanBaseURL = $baseURL;
|
21 |
+
$indexBaseURL = $baseURL;
|
22 |
+
|
23 |
+
$sufix = "index.php/";
|
24 |
+
if (substr($baseURL, strlen($baseURL) - strlen($sufix)) == $sufix)
|
25 |
+
{
|
26 |
+
$cleanBaseURL = substr($baseURL, 0, strlen($baseURL) - strlen($sufix) - 1);
|
27 |
+
}
|
28 |
+
else
|
29 |
+
{
|
30 |
+
$indexBaseURL .= "index.php";
|
31 |
+
}
|
32 |
+
$path = substr(Mage::helper('core/url')->getCurrentUrl(), strlen($baseURL));
|
33 |
+
|
34 |
+
// store
|
35 |
+
$storeId = Mage::app()->getStore()->getId();
|
36 |
+
?>
|
37 |
+
<script type="text/javascript">
|
38 |
+
var wbtopbar_params = "function=check&path=<?php echo $path; ?>&store_id=<?php echo $storeId; ?>&cleanbaseurl=<?php echo urlencode($cleanBaseURL); ?>";
|
39 |
+
var wbtopbar_cleanbaseurl = "<?php echo $cleanBaseURL; ?>";
|
40 |
+
var wbtopbar_indexbaseurl = "<?php echo $indexBaseURL; ?>";
|
41 |
+
function wbtopbar_onLoad() {
|
42 |
+
wbtopbarInit(wbtopbar_indexbaseurl, wbtopbar_cleanbaseurl, wbtopbar_params);
|
43 |
+
}
|
44 |
+
if (window.addEventListener) {
|
45 |
+
window.addEventListener( "load", wbtopbar_onLoad, false );
|
46 |
+
} else if ( window.attachEvent ) {
|
47 |
+
window.attachEvent( "onload", wbtopbar_onLoad );
|
48 |
+
} else if (window.onLoad) {
|
49 |
+
window.onload = wbtopbar_onLoad;
|
50 |
+
}
|
51 |
+
</script>
|
52 |
+
<?php } ?>
|
app/etc/modules/Wiseboost_General.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Wiseboost_General>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Wiseboost_General>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/Wiseboost_TopBar.xml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
*
|
13 |
+
* @category Wiseboost
|
14 |
+
* @package Wiseboost_TopBar
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
-->
|
18 |
+
<config>
|
19 |
+
<modules>
|
20 |
+
<Wiseboost_TopBar>
|
21 |
+
<active>true</active>
|
22 |
+
<codePool>community</codePool>
|
23 |
+
<depends>
|
24 |
+
<Mage_Catalog />
|
25 |
+
</depends>
|
26 |
+
</Wiseboost_TopBar>
|
27 |
+
</modules>
|
28 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Wiseboost_QuickProductEdit</name>
|
4 |
+
<version>1.0.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Adds a bar to the top of your store with a link to product page in the admin panel when you are logged in as admin.</summary>
|
10 |
+
<description>Adds a bar to the top of your store with a link to product page in the admin panel when you are logged in as admin.</description>
|
11 |
+
<notes>First release</notes>
|
12 |
+
<authors><author><name>Wiseboost</name><user>Wiseboost</user><email>raceface89@hotmail.com</email></author></authors>
|
13 |
+
<date>2013-05-09</date>
|
14 |
+
<time>02:45:30</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Wiseboost"><dir name="TopBar"><dir name="controllers"><file name="CheckController.php" hash="7032774e7417faffffa268aacedfc77f"/></dir><dir name="etc"><file name="config.xml" hash="bb07212d3d43870b6ea3df16c6f5dfa8"/></dir></dir><dir name="General"><dir name="Helper"><file name="Data.php" hash="4fa9a117fd0fbcd2d3f60ee7059366d0"/></dir><dir name="Model"><file name="Feed.php" hash="ec3d2e01280846544278f16d692a8b9a"/></dir><dir name="etc"><file name="config.xml" hash="280a531e7531969121cc0fd8204cce08"/><file name="system.xml" hash="b200dcdb89dafc389aafb09ef29cd8c4"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="wiseboost"><file name="topbar.xml" hash="be68c3e8a2d39fbdab5e2fc44baf9258"/></dir></dir><dir name="template"><dir name="wiseboost"><file name="topbar.xml" hash="cc3727eeab50d691b057fd62cab51d04"/><dir name="topbar"><file name="view.phtml" hash="c0266d97216da65a5ac933b86918e64a"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wiseboost_TopBar.xml" hash="5b200ad495050694b908140e7126b5dd"/><file name="Wiseboost_General.xml" hash="8373b0af51b16d30b3f43af037076706"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="wbtb.css" hash="e2c62195e3c212917563674eea5c9be5"/></dir><dir name="images"><dir name="Wiseboost_TopBar"><file name="logo.png" hash="05aa68da14a409ffa8284867239c5ee5"/></dir></dir><dir name="js"><dir name="Wiseboost_TopBar"><file name="wbtb.js" hash="35b7489b19c64f3f3c4df0b9d4b269af"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/frontend/base/default/css/wbtb.css
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wiseboost_topbar_header
|
2 |
+
{
|
3 |
+
background: #474747;
|
4 |
+
border-bottom: 1px solid #373737;
|
5 |
+
color: #000;
|
6 |
+
height: 28px;
|
7 |
+
left: 0;
|
8 |
+
opacity: 0.94;
|
9 |
+
position: relative;
|
10 |
+
width: 100%;
|
11 |
+
z-index: 2147483647;
|
12 |
+
overflow: hidden;
|
13 |
+
position: fixed;
|
14 |
+
top: 0px;
|
15 |
+
left: 0px;
|
16 |
+
}
|
17 |
+
|
18 |
+
/* IE */
|
19 |
+
* html .wiseboost_topbar_header {
|
20 |
+
position: absolute;
|
21 |
+
}
|
22 |
+
|
23 |
+
.wiseboost_topbar_header_inner
|
24 |
+
{
|
25 |
+
margin-left: auto;
|
26 |
+
margin-right: auto;
|
27 |
+
z-index: 2147483647;
|
28 |
+
}
|
29 |
+
|
30 |
+
.wiseboost_topbar_header_inner a, .wiseboost_topbar_header_inner span
|
31 |
+
{
|
32 |
+
font-family: sans-serif;
|
33 |
+
font-size: 13px;
|
34 |
+
font-weight: 400;
|
35 |
+
font-style: normal;
|
36 |
+
font-size-adjust: none;
|
37 |
+
color: #CCCCCC;
|
38 |
+
text-transform: none;
|
39 |
+
text-decoration: none;
|
40 |
+
letter-spacing: normal;
|
41 |
+
line-height: 28px;
|
42 |
+
text-align: left;
|
43 |
+
direction: ltr;
|
44 |
+
}
|
45 |
+
|
46 |
+
.wiseboost_topbar_horz_list_left a, .wiseboost_topbar_horz_list_left span
|
47 |
+
{
|
48 |
+
display: block;
|
49 |
+
padding: 0 10px 0 10px;
|
50 |
+
}
|
51 |
+
.wiseboost_topbar_horz_list_left span, .wiseboost_topbar_horz_list_right span
|
52 |
+
{
|
53 |
+
cursor: default;
|
54 |
+
}
|
55 |
+
|
56 |
+
.wiseboost_topbar_horz_list_right
|
57 |
+
{
|
58 |
+
float: right;
|
59 |
+
}
|
60 |
+
.wiseboost_topbar_horz_list_right span
|
61 |
+
{
|
62 |
+
padding: 0 10px 0 10px;
|
63 |
+
}
|
64 |
+
.wiseboost_topbar_horz_list_right li
|
65 |
+
{
|
66 |
+
border-left: 2px solid #555555;
|
67 |
+
}
|
68 |
+
|
69 |
+
ul.wiseboost_topbar_horz_list
|
70 |
+
{
|
71 |
+
margin:0;
|
72 |
+
padding-left:0;
|
73 |
+
white-space:nowrap;
|
74 |
+
}
|
75 |
+
.wiseboost_topbar_horz_list li
|
76 |
+
{
|
77 |
+
display:inline;
|
78 |
+
list-style-type:none;
|
79 |
+
border-right: 2px solid #555555;
|
80 |
+
float: left;
|
81 |
+
}
|
82 |
+
.wiseboost_topbar_horz_list li a:hover
|
83 |
+
{
|
84 |
+
background: linear-gradient(to top, #3A3A3A, #222222) repeat scroll 0 0 #222222;
|
85 |
+
color: #FAFAFA;
|
86 |
+
}
|
87 |
+
|
88 |
+
#wiseboost_topbar_logo a, #wiseboost_topbar_logo span
|
89 |
+
{
|
90 |
+
padding: 0;
|
91 |
+
}
|
92 |
+
|
93 |
+
#wiseboost_topbar_admin a
|
94 |
+
{
|
95 |
+
background: transparent;
|
96 |
+
}
|
skin/frontend/base/default/images/Wiseboost_TopBar/logo.png
ADDED
Binary file
|
skin/frontend/base/default/js/Wiseboost_TopBar/wbtb.js
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function wbtopbarAjaxPost(ajaxCfgObj)
|
2 |
+
{
|
3 |
+
var xmlhttp;
|
4 |
+
if (window.XMLHttpRequest)
|
5 |
+
{
|
6 |
+
// code for IE7+, Firefox, Chrome, Opera, Safari
|
7 |
+
xmlhttp=new XMLHttpRequest();
|
8 |
+
}
|
9 |
+
else
|
10 |
+
{
|
11 |
+
// code for IE6, IE5
|
12 |
+
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
13 |
+
}
|
14 |
+
|
15 |
+
xmlhttp.open("POST", ajaxCfgObj.url, true);
|
16 |
+
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
17 |
+
|
18 |
+
xmlhttp.setRequestHeader("Content-length", ajaxCfgObj.params.length);
|
19 |
+
xmlhttp.setRequestHeader("Connection", "close");
|
20 |
+
|
21 |
+
xmlhttp.onreadystatechange = function() {
|
22 |
+
if (xmlhttp.readyState == 4) {
|
23 |
+
if (xmlhttp.status == 200) {
|
24 |
+
if (xmlhttp.responseText != '') {
|
25 |
+
ajaxCfgObj.onRx(xmlhttp.responseText);
|
26 |
+
} else {
|
27 |
+
if (ajaxCfgObj.onError)
|
28 |
+
{
|
29 |
+
ajaxCfgObj.onError('Response is empty');
|
30 |
+
}
|
31 |
+
}
|
32 |
+
} else {
|
33 |
+
if (ajaxCfgObj.onError)
|
34 |
+
{
|
35 |
+
var msg = "Error - " + String(xmlhttp.status) + ' ' + xmlhttp.statusText;
|
36 |
+
|
37 |
+
if (xmlhttp.status == 0)
|
38 |
+
{
|
39 |
+
msg = "Error - " + String(xmlhttp.status) + ' - ' + "Server connection failed.";
|
40 |
+
setTimeout(function() { ajaxCfgObj.onError(msg); }, 20000);
|
41 |
+
return ;
|
42 |
+
}
|
43 |
+
else
|
44 |
+
{
|
45 |
+
if (xmlhttp.statusText == "Unknown")
|
46 |
+
{
|
47 |
+
msg = "Error - " + String(xmlhttp.status);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
ajaxCfgObj.onError(msg);
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
xmlhttp.send(ajaxCfgObj.params);
|
58 |
+
}
|
59 |
+
|
60 |
+
function wbtopbarRx(data)
|
61 |
+
{
|
62 |
+
wbtopbarRender(data);
|
63 |
+
}
|
64 |
+
|
65 |
+
function wbtopbarRender(html)
|
66 |
+
{
|
67 |
+
if (html != "")
|
68 |
+
{
|
69 |
+
var body_el = document.getElementsByTagName("body")[0];
|
70 |
+
|
71 |
+
if (body_el)
|
72 |
+
{
|
73 |
+
var div_el = document.createElement('div');
|
74 |
+
div_el.innerHTML = html;
|
75 |
+
body_el.appendChild(div_el);
|
76 |
+
body_el.style.paddingTop = '28px';
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
function wbtopbarInit(indexbaseurl, cleanbaseurl, params)
|
82 |
+
{
|
83 |
+
wbtopbarAjaxPost({url: indexbaseurl + "/topbar_check/check", onRx: wbtopbarRx, params: params});
|
84 |
+
}
|