Version Notes
This is the initial release of AlertSite for Magento.
Download this release
Release Info
Developer | SmartBear Software |
Extension | smartbear_alertsite |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Smartbear/Alertsite/Block/Adminhtml/Create.php +76 -0
- app/code/community/Smartbear/Alertsite/Block/Adminhtml/Dashboard.php +71 -0
- app/code/community/Smartbear/Alertsite/Block/Adminhtml/Notifications.php +35 -0
- app/code/community/Smartbear/Alertsite/Block/Adminhtml/Smartbear.php +12 -0
- app/code/community/Smartbear/Alertsite/Block/Adminhtml/System/Form/Renderer/ConfigMessage.php +29 -0
- app/code/community/Smartbear/Alertsite/Block/Adminhtml/System/Form/Renderer/DeviceDescription.php +56 -0
- app/code/community/Smartbear/Alertsite/Block/Adminhtml/System/Form/Renderer/Label.php +41 -0
- app/code/community/Smartbear/Alertsite/Block/Adminhtml/System/Form/Renderer/LinkButton.php +38 -0
- app/code/community/Smartbear/Alertsite/Helper/Data.php +18 -0
- app/code/community/Smartbear/Alertsite/Model/Alertsiteapi.php +904 -0
- app/code/community/Smartbear/Alertsite/Model/Observer.php +60 -0
- app/code/community/Smartbear/Alertsite/Model/System/Config/Backend/Editaccount.php +63 -0
- app/code/community/Smartbear/Alertsite/Model/System/Config/Backend/Editdevice.php +45 -0
- app/code/community/Smartbear/Alertsite/Model/System/Config/Backend/Enable.php +44 -0
- app/code/community/Smartbear/Alertsite/controllers/Adminhtml/AlertsiteController.php +128 -0
- app/code/community/Smartbear/Alertsite/etc/adminhtml.xml +58 -0
- app/code/community/Smartbear/Alertsite/etc/config.xml +84 -0
- app/code/community/Smartbear/Alertsite/etc/system.xml +160 -0
- app/design/adminhtml/default/default/layout/alertsite.xml +38 -0
- app/design/adminhtml/default/default/template/alertsite/create.phtml +90 -0
- app/design/adminhtml/default/default/template/alertsite/dashboard.phtml +36 -0
- app/design/adminhtml/default/default/template/alertsite/linkbutton.phtml +10 -0
- app/design/adminhtml/default/default/template/alertsite/notifications.phtml +11 -0
- app/etc/modules/Smartbear_Alertsite.xml +9 -0
- package.xml +19 -0
- skin/adminhtml/default/default/smartbear/alertsite/css/alertsite.css +25 -0
- skin/adminhtml/default/default/smartbear/alertsite/images/smartbear_15_icon.png +0 -0
- skin/adminhtml/default/default/smartbear/alertsite/images/smartbear_20_icon.gif +0 -0
- skin/adminhtml/default/default/smartbear/alertsite/images/smartbear_error.png +0 -0
- skin/adminhtml/default/default/smartbear/alertsite/images/smartbear_great.png +0 -0
- skin/adminhtml/default/default/smartbear/alertsite/images/smartbear_info.png +0 -0
- skin/adminhtml/default/default/smartbear/alertsite/images/smartbear_notice.png +0 -0
- skin/adminhtml/default/default/smartbear/alertsite/images/smartbear_warning.png +0 -0
app/code/community/Smartbear/Alertsite/Block/Adminhtml/Create.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Smartbear_Alertsite_Block_Adminhtml_Notifications
|
4 |
+
* Notifications block. Displays a note at the top of adminhtml pages.
|
5 |
+
*
|
6 |
+
* @category
|
7 |
+
* @package Smartbear_Alertsite
|
8 |
+
*/
|
9 |
+
class Smartbear_Alertsite_Block_Adminhtml_Create extends Mage_Adminhtml_Block_Template
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Sets the form action urls for the page.
|
13 |
+
*/
|
14 |
+
public function _construct()
|
15 |
+
{
|
16 |
+
parent::_construct();
|
17 |
+
|
18 |
+
$this->setFormAction(Mage::helper('adminhtml')->getUrl('*/alertsite/provision'));
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Retrieve Session Form Key
|
23 |
+
*
|
24 |
+
* @return string
|
25 |
+
*/
|
26 |
+
public function getFormKey()
|
27 |
+
{
|
28 |
+
return Mage::getSingleton('core/session')->getFormKey();
|
29 |
+
}
|
30 |
+
|
31 |
+
public function getFirstname()
|
32 |
+
{
|
33 |
+
$user = Mage::getSingleton('admin/session')->getUser();
|
34 |
+
if($user && $user->getFirstname())
|
35 |
+
return ucwords($user->getFirstname());
|
36 |
+
else
|
37 |
+
return '';
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getLastname()
|
41 |
+
{
|
42 |
+
$user = Mage::getSingleton('admin/session')->getUser();
|
43 |
+
if($user && $user->getLastname())
|
44 |
+
return ucwords($user->getLastname());
|
45 |
+
else
|
46 |
+
return '';
|
47 |
+
}
|
48 |
+
|
49 |
+
public function getCompanyName()
|
50 |
+
{
|
51 |
+
$storeName = Mage::getStoreConfig('general/store_information/name', Mage::app()->getStore()->getCode());
|
52 |
+
if($storeName)
|
53 |
+
return $storeName;
|
54 |
+
else
|
55 |
+
return '';
|
56 |
+
}
|
57 |
+
|
58 |
+
public function getStoreUrl()
|
59 |
+
{
|
60 |
+
$storeUrl = Mage::getStoreConfig('web/secure/base_url', Mage::app()->getStore()->getCode());
|
61 |
+
if($storeUrl)
|
62 |
+
return $storeUrl;
|
63 |
+
else
|
64 |
+
return '';
|
65 |
+
}
|
66 |
+
|
67 |
+
public function getEmail()
|
68 |
+
{
|
69 |
+
$user = Mage::getSingleton('admin/session')->getUser();
|
70 |
+
if($user && $user->getEmail())
|
71 |
+
return ucwords($user->getEmail());
|
72 |
+
else
|
73 |
+
return '';
|
74 |
+
}
|
75 |
+
|
76 |
+
}
|
app/code/community/Smartbear/Alertsite/Block/Adminhtml/Dashboard.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Smartbear_Alertsite_Block_Adminhtml_Dashboard extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
var $_template = "alertsite/dashboard.phtml";
|
7 |
+
|
8 |
+
/** @var $_alertsiteApi Smartbear_Alertsite_Model_AlertsiteApi */
|
9 |
+
private $_alertsiteApi = null;
|
10 |
+
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
|
15 |
+
if(! Mage::helper('alertsite')->getConfig('alertsite_config', 'enabled') )
|
16 |
+
{
|
17 |
+
return;
|
18 |
+
}
|
19 |
+
|
20 |
+
$this->_alertsiteApi = Mage::getModel('alertsite/alertsiteapi');
|
21 |
+
$this->_alertsiteApi->getDeviceStatus();
|
22 |
+
}
|
23 |
+
|
24 |
+
public function isEnabled()
|
25 |
+
{
|
26 |
+
return Mage::helper('alertsite')->getConfig('alertsite_config', 'enabled');
|
27 |
+
}
|
28 |
+
|
29 |
+
public function getFriendlyStatus()
|
30 |
+
{
|
31 |
+
return $this->_alertsiteApi->getFriendlyStatus();
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getStatusCode()
|
35 |
+
{
|
36 |
+
return $this->_alertsiteApi->getStatusCode();
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getStatusTime()
|
40 |
+
{
|
41 |
+
$timeAtLastChange = $this->_alertsiteApi->getStatusLastChanged();
|
42 |
+
$currentTime = time();
|
43 |
+
$timeDiff = $currentTime - $timeAtLastChange;
|
44 |
+
|
45 |
+
/** @var $dateModel Mage_Core_Model_Date */
|
46 |
+
$dateModel = Mage::getModel('core/date');
|
47 |
+
|
48 |
+
if ($timeAtLastChange)
|
49 |
+
return $dateModel->date('M j, g:i:s A', $timeAtLastChange);
|
50 |
+
else
|
51 |
+
return 'N/A';
|
52 |
+
}
|
53 |
+
|
54 |
+
public function getStatusDescription()
|
55 |
+
{
|
56 |
+
return $this->_alertsiteApi->getDeviceDescription();
|
57 |
+
}
|
58 |
+
|
59 |
+
public function _toHtml()
|
60 |
+
{
|
61 |
+
if(! Mage::helper('alertsite')->getConfig('alertsite_config', 'enabled') )
|
62 |
+
{
|
63 |
+
return "</fieldset></div>";
|
64 |
+
}
|
65 |
+
|
66 |
+
$html = $this->renderView();
|
67 |
+
return $html;
|
68 |
+
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
app/code/community/Smartbear/Alertsite/Block/Adminhtml/Notifications.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SL_Signaturelink_Block_Adminhtml_Notifications
|
4 |
+
* Notifications block. Displays a note at the top of adminhtml pages.
|
5 |
+
*
|
6 |
+
* @category Signaturelink
|
7 |
+
* @package SL_Signaturelink
|
8 |
+
*/
|
9 |
+
class Smartbear_Alertsite_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Get x management url
|
13 |
+
*
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
public function getManageUrl()
|
17 |
+
{
|
18 |
+
return $this->getUrl('adminhtml/system_config/edit', array('section' => 'alertsite'));
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Check to see if config options are set
|
23 |
+
* @return bool
|
24 |
+
*/
|
25 |
+
public function isRequiredSettingsNotification()
|
26 |
+
{
|
27 |
+
if(!Mage::helper('alertsite')->getConfig('alertsite_config', 'enabled'))
|
28 |
+
{
|
29 |
+
return false;
|
30 |
+
}
|
31 |
+
|
32 |
+
$test = (strlen(trim(Mage::helper('alertsite')->getConfig('alertsite_config', 'alertsite_user'))) == 0 || strlen(trim(Mage::helper('alertsite')->getConfig('alertsite_config', 'alertsite_pass'))) == 0);
|
33 |
+
return $test;
|
34 |
+
}
|
35 |
+
}
|
app/code/community/Smartbear/Alertsite/Block/Adminhtml/Smartbear.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Smartbear_Alertsite_Block_Adminhtml_Notifications
|
4 |
+
* Notifications block. Displays a note at the top of adminhtml pages.
|
5 |
+
*
|
6 |
+
* @category
|
7 |
+
* @package Smartbear_Alertsite
|
8 |
+
*/
|
9 |
+
class Smartbear_Alertsite_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
|
10 |
+
{
|
11 |
+
|
12 |
+
}
|
app/code/community/Smartbear/Alertsite/Block/Adminhtml/System/Form/Renderer/ConfigMessage.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Signaturelink
|
4 |
+
* @package SL_Signaturelink
|
5 |
+
*/
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Renderer for sub-heading in fieldset
|
9 |
+
*
|
10 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
11 |
+
*/
|
12 |
+
class Smartbear_Alertsite_Block_Adminhtml_System_Form_Renderer_ConfigMessage
|
13 |
+
extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* Render element html
|
17 |
+
*
|
18 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
19 |
+
* @return string
|
20 |
+
*/
|
21 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
22 |
+
{
|
23 |
+
return sprintf('<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5">'
|
24 |
+
. '<h4 id="%s">%s</h4><div id="system-fieldset-sub-head-comment">%s</div></td></tr>',
|
25 |
+
$element->getHtmlId(), $element->getHtmlId(),
|
26 |
+
$element->getLabel(), $element->getComment()
|
27 |
+
);
|
28 |
+
}
|
29 |
+
}
|
app/code/community/Smartbear/Alertsite/Block/Adminhtml/System/Form/Renderer/DeviceDescription.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Smartbear_Alertsite_Block_Adminhtml_System_Form_Renderer_DeviceDescription
|
4 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
5 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Get equipped with API!
|
9 |
+
*
|
10 |
+
* @return Smartbear_Alertsite_Model_AlertsiteApi
|
11 |
+
*/
|
12 |
+
public function getApi()
|
13 |
+
{
|
14 |
+
return Mage::getModel('alertsite/alertsiteapi');
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Unset scope label and pass further to parent render()
|
19 |
+
*
|
20 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
24 |
+
{
|
25 |
+
// Unset the scope label near the button
|
26 |
+
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
27 |
+
return parent::render($element);
|
28 |
+
}
|
29 |
+
|
30 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
31 |
+
{
|
32 |
+
$this->addData(array(
|
33 |
+
'html_id' => $element->getHtmlId()
|
34 |
+
));
|
35 |
+
|
36 |
+
return $this->_toHtml();
|
37 |
+
}
|
38 |
+
|
39 |
+
protected function _toHtml()
|
40 |
+
{
|
41 |
+
|
42 |
+
$api = $this->getApi();
|
43 |
+
$response = $api->getDeviceStatus();
|
44 |
+
$deviceDescription = $api->getDeviceDescription();
|
45 |
+
|
46 |
+
if (empty($deviceDescription))
|
47 |
+
$deviceDescription = 'None configured';
|
48 |
+
|
49 |
+
$html = '<h5 id="'. $this->getHtmlId() . '"><span>';
|
50 |
+
$html .= $deviceDescription;
|
51 |
+
$html .= '</span></h5>';
|
52 |
+
|
53 |
+
return $html;
|
54 |
+
|
55 |
+
}
|
56 |
+
}
|
app/code/community/Smartbear/Alertsite/Block/Adminhtml/System/Form/Renderer/Label.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Adminhtml system config datetime field renderer
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Adminhtml
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Smartbear_Alertsite_Block_Adminhtml_System_Form_Renderer_Label extends Mage_Adminhtml_Block_System_Config_Form_Field
|
36 |
+
{
|
37 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
38 |
+
{
|
39 |
+
return '<h5 id="'.$element->getHtmlId().'"><span>'.$this->escapeHtml($element->getValue()).'</span></h5>';
|
40 |
+
}
|
41 |
+
}
|
app/code/community/Smartbear/Alertsite/Block/Adminhtml/System/Form/Renderer/LinkButton.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Smartbear_Alertsite_Block_Adminhtml_System_Form_Renderer_LinkButton
|
4 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
5 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
6 |
+
{
|
7 |
+
protected $_template = 'alertsite/linkbutton.phtml';
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Unset scope label and pass further to parent render()
|
11 |
+
*
|
12 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
16 |
+
{
|
17 |
+
// Unset the scope label near the button
|
18 |
+
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
19 |
+
return parent::render($element);
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Get the button and scripts contents
|
24 |
+
*
|
25 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
26 |
+
* @return string
|
27 |
+
*/
|
28 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
29 |
+
{
|
30 |
+
$originalData = $element->getOriginalData();
|
31 |
+
$this->addData(array(
|
32 |
+
'button_label' => $originalData['button_label'],
|
33 |
+
'html_id' => $element->getHtmlId(),
|
34 |
+
'button_url' => Mage::getModel('adminhtml/url')->getUrl($originalData['button_url']),
|
35 |
+
));
|
36 |
+
return $this->_toHtml();
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Smartbear/Alertsite/Helper/Data.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Smartbear_Alertsite_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
|
5 |
+
const XML_CONFIG_PATH = 'alertsite/';
|
6 |
+
|
7 |
+
public function getConfig($section, $key, $flag = false) {
|
8 |
+
$path = self::XML_CONFIG_PATH . $section . '/' . $key;
|
9 |
+
|
10 |
+
if ($flag) {
|
11 |
+
return Mage::getStoreConfigFlag($path);
|
12 |
+
} else {
|
13 |
+
return Mage::getStoreConfig($path);
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
|
18 |
+
}
|
app/code/community/Smartbear/Alertsite/Model/Alertsiteapi.php
ADDED
@@ -0,0 +1,904 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Alertsite API Model
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* @method string getStatusCode()
|
7 |
+
* @method string getStatusLastChanged()
|
8 |
+
* @method string getDeviceDescription()
|
9 |
+
* @method string getLastResponseTime()
|
10 |
+
* @method setStatusCode(string $code)
|
11 |
+
* @method setStatusLastChanged(string $date)
|
12 |
+
* @method setDeviceDescription(string $description)
|
13 |
+
* @method setLastResponseTime(string $time)
|
14 |
+
* @method setLastApiStatus(int $status)
|
15 |
+
* @method int getLastApiStatus()
|
16 |
+
* @method setLastApiMessage(string $message)
|
17 |
+
* @method string getLastApiMessage()
|
18 |
+
*
|
19 |
+
*/
|
20 |
+
class Smartbear_Alertsite_Model_Alertsiteapi extends Mage_Core_Model_Abstract
|
21 |
+
{
|
22 |
+
|
23 |
+
//Endpoint URLs
|
24 |
+
const ALERTSITE_REST_API_URL = 'https://www.alertsite.com/cgi-bin/alertsite-restapi/index.cgi/'; // http://help.alertsite.com/AlertSite/RestAPI
|
25 |
+
const ALERTSITE_REPORT_API_URL = 'https://www.alertsite.com/report-api/'; // http://help.alertsite.com/ReportAPI
|
26 |
+
const ALERTSITE_PROVISION_API_URL = 'https://www.alertsite.com/cgi-bin/orderform';
|
27 |
+
|
28 |
+
//Config paths that are needed for configuration of AlertSite API
|
29 |
+
const CONFIG_ACTIVATION_URL = 'alertsite/alertsite_config/alertsite_activation_email';
|
30 |
+
const CONFIG_DEVICE_ID = 'alertsite/alertsite_config/device_id';
|
31 |
+
const CONFIG_DEJACLICK_DEVICE_ID = 'alertsite/alertsite_config/dejaclick_device_id';
|
32 |
+
const CONFIG_CLIENT_ID = 'alertsite/alertsite_config/client_id';
|
33 |
+
const CONFIG_ALERTSITE_USER = 'alertsite/alertsite_config/alertsite_user';
|
34 |
+
const CONFIG_ALERTSITE_PASS = 'alertsite/alertsite_config/alertsite_pass';
|
35 |
+
const CONFIG_ALERTSITE_DEVICE_URL = 'alertsite/alertsite_config/device_url';
|
36 |
+
const CONFIG_ALERTSITE_DEVICE_DESCRIPTION = 'alertsite/alertsite_config/device_description';
|
37 |
+
const CONFIG_ALERTSITE_ENABLED = 'alertsite/alertsite_config/enabled';
|
38 |
+
const CONFIG_ALERTSITE_PROVISIONED = 'alertsite/alertsite_config/provisioned';
|
39 |
+
const CONFIG_ALERTSITE_PHONE = 'alertsite/alertsite_config/alertsite_phone';
|
40 |
+
|
41 |
+
|
42 |
+
protected $_statusApiResult = null;
|
43 |
+
protected $_detailApiResult = null;
|
44 |
+
protected $_statuses =
|
45 |
+
array(
|
46 |
+
"0" => "Site responded normally to all tests",
|
47 |
+
"1" => "TCP connection failed",
|
48 |
+
"2" => "Test timed out",
|
49 |
+
"3" => "Invalid response from server",
|
50 |
+
"5" => "Validation failed",
|
51 |
+
"6" => "No response from server",
|
52 |
+
"7" => "HTTP error from web server",
|
53 |
+
"8" => "Web site is redirected (warning)",
|
54 |
+
"9" => "Ping failed (site is not responding)",
|
55 |
+
"51" => "Unable to resolve IP address",
|
56 |
+
"60" => "soapUI-specific error",
|
57 |
+
"61" => "soapUI startup error",
|
58 |
+
"99" => "Unable to ping from location",
|
59 |
+
"80" => "Browser event timeout encountered",
|
60 |
+
"82" => "Page took too long to load",
|
61 |
+
"83" => "Firefox event notification did not occur",
|
62 |
+
"84" => "Page location did not change when expected",
|
63 |
+
"85" => "Expected page updates did not occur",
|
64 |
+
"86" => "Network activity did not stop",
|
65 |
+
"89" => "Internal Browser timeout",
|
66 |
+
"81" => "Maximum transaction time was exceeded",
|
67 |
+
"90" => "Unexpected processing exception occurred",
|
68 |
+
"91" => "Minimum match score not met",
|
69 |
+
"92" => "Maximum number of skipped events exceeded",
|
70 |
+
"93" => "Missing instruction for dialog prompt",
|
71 |
+
"94" => "Maximum transaction steps exceeded",
|
72 |
+
"95" => "Unable to monitor from chosen station",
|
73 |
+
"96" => "Unable to parse transaction XML",
|
74 |
+
"97" => "Target page element was not found",
|
75 |
+
"70" => "Remote verification did not detect an error. No alert is generated",
|
76 |
+
"71" => "Remote verification has confirmed an error. Alert is generated",
|
77 |
+
"72" => "Remote verification response was not received. Alert is generated",
|
78 |
+
"73" => "Remote verification response was invalid. Alert is generated",
|
79 |
+
"79" => "Remote verification was unavailable. Alert is generated",
|
80 |
+
"98" => "Notification (alert) was generated",
|
81 |
+
"9095" => "Unable to run test from chosen monitoring location",
|
82 |
+
"50XX" => "Mobile Device error where XX corresponds to the codes above",
|
83 |
+
"5300" => "Service Execution Error",
|
84 |
+
"60XX" => "soapUI error where XX corresponds to the codes above",
|
85 |
+
"70XX" => "Page object error where XX corresponds to the codes above",
|
86 |
+
"7121" => "Object length changed",
|
87 |
+
"7122" => "Missing object",
|
88 |
+
"7123" => "New object found",
|
89 |
+
"7130" => "No fullpage objects found",
|
90 |
+
"7202" => "Fullpage Timeout",
|
91 |
+
"4030" => "Warning threshold exceeded for monitored item",
|
92 |
+
"4040" => "Error threshold exceeded for monitored item",
|
93 |
+
"4050" => "Reported results were not received when expected",
|
94 |
+
"4059" => "Ping failed (server not reporting)"
|
95 |
+
);
|
96 |
+
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Get the configured username returned from provisioning
|
100 |
+
*
|
101 |
+
* @return string
|
102 |
+
*/
|
103 |
+
public function getUsername()
|
104 |
+
{
|
105 |
+
return Mage::helper('alertsite')->getConfig('alertsite_config', 'alertsite_user');
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Get the configured password returned from provisioning
|
110 |
+
*
|
111 |
+
* todo make sure that we change the password config type to obscured
|
112 |
+
* @return string
|
113 |
+
*/
|
114 |
+
public function getPassword()
|
115 |
+
{
|
116 |
+
return Mage::helper('alertsite')->getConfig('alertsite_config', 'alertsite_pass');
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Get the configured phone number!
|
121 |
+
*
|
122 |
+
* @return string
|
123 |
+
*/
|
124 |
+
public function getPhone()
|
125 |
+
{
|
126 |
+
return Mage::helper('alertsite')->getConfig('alertsite_config', 'alertsite_phone');
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Get the configured device id returned from provisioning
|
131 |
+
*
|
132 |
+
* @return string
|
133 |
+
*/
|
134 |
+
public function getDeviceId()
|
135 |
+
{
|
136 |
+
return Mage::helper('alertsite')->getConfig('alertsite_config','device_id');
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Get the configured dejaclick device id returned from provisioning
|
141 |
+
*
|
142 |
+
* @return string
|
143 |
+
*/
|
144 |
+
public function getDejaclickDeviceId()
|
145 |
+
{
|
146 |
+
return Mage::helper('alertsite')->getConfig('alertsite_config','dejaclick_device_id');
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Get the configured customer id returned from provisioning
|
151 |
+
*
|
152 |
+
* @return string
|
153 |
+
*/
|
154 |
+
public function getCustomerId()
|
155 |
+
{
|
156 |
+
return Mage::helper('alertsite')->getConfig('alertsite_config','client_id');
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Get the configured device monitor url
|
161 |
+
* @return string
|
162 |
+
*/
|
163 |
+
public function getDeviceMonitorUrl()
|
164 |
+
{
|
165 |
+
return Mage::helper('alertsite')->getConfig('alertsite_config','device_url');
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Get a url for use in a curl call
|
170 |
+
*
|
171 |
+
* @param string $action
|
172 |
+
* @param array $params
|
173 |
+
* @param string $api
|
174 |
+
* @return string
|
175 |
+
*/
|
176 |
+
public function getUrl($action = '', $params = array(), $api = 'rest')
|
177 |
+
{
|
178 |
+
|
179 |
+
$baseUrl = '';
|
180 |
+
|
181 |
+
switch(strtolower($api))
|
182 |
+
{
|
183 |
+
case 'report':
|
184 |
+
$baseUrl = self::ALERTSITE_REPORT_API_URL;
|
185 |
+
break;
|
186 |
+
case 'rest':
|
187 |
+
$baseUrl = self::ALERTSITE_REST_API_URL;
|
188 |
+
break;
|
189 |
+
case 'provision':
|
190 |
+
$baseUrl = self::ALERTSITE_PROVISION_API_URL;
|
191 |
+
break;
|
192 |
+
default:
|
193 |
+
$baseUrl = self::ALERTSITE_REST_API_URL;
|
194 |
+
}
|
195 |
+
|
196 |
+
$url = $baseUrl.$action;
|
197 |
+
|
198 |
+
if (!empty($params))
|
199 |
+
{
|
200 |
+
$customerId = ''; // customer id appears at the beginning of the urls in report calls - might be unused now
|
201 |
+
if (array_key_exists('customer_id', $params))
|
202 |
+
{
|
203 |
+
$customerId = $params['customer_id'];
|
204 |
+
|
205 |
+
unset($params['customer_id']);
|
206 |
+
}
|
207 |
+
|
208 |
+
$url .= '/'.$customerId.'?';
|
209 |
+
|
210 |
+
$i = 0;
|
211 |
+
$size = count($params);
|
212 |
+
|
213 |
+
foreach ($params as $k => $v)
|
214 |
+
{
|
215 |
+
$url .= urlencode($k).'='.urlencode($v);
|
216 |
+
if ($i!=$size-1)
|
217 |
+
$url .= '&';
|
218 |
+
|
219 |
+
$i++;
|
220 |
+
}
|
221 |
+
|
222 |
+
}
|
223 |
+
|
224 |
+
return $url;
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Build an XML request for our (Rest) API
|
229 |
+
*
|
230 |
+
*
|
231 |
+
* Here's a typical request:
|
232 |
+
* <Upload>
|
233 |
+
* <APIVersion>1.1</APIVersion>
|
234 |
+
* <Authenticate>
|
235 |
+
* <Login>$LOGIN</Login>
|
236 |
+
* <SessionID>$SESSION_ID</SessionID>
|
237 |
+
* </Authenticate>
|
238 |
+
* <Request>
|
239 |
+
* <ObjDevice>$OBJ_DEVICE</ObjDevice>
|
240 |
+
* <URL>$URL</URL>
|
241 |
+
* </Request>
|
242 |
+
* </Upload>
|
243 |
+
*
|
244 |
+
* Here's the special case Login request:
|
245 |
+
*
|
246 |
+
* <Login>
|
247 |
+
* <ControlID></ControlID>
|
248 |
+
* <KeepAlive>1</KeepAlive>
|
249 |
+
* <Login>foo@bar.com</Login>
|
250 |
+
* <Password>$PASS</Password>
|
251 |
+
* </Login>
|
252 |
+
*
|
253 |
+
*
|
254 |
+
* @param string $root
|
255 |
+
* @param bool $autoLogin - automatically log in if we don't have a session id
|
256 |
+
* @return SimpleXMLElement
|
257 |
+
*/
|
258 |
+
public function getRequest($root = '', $autoLogin = true)
|
259 |
+
{
|
260 |
+
|
261 |
+
$requestXml = new SimpleXMLElement('<'.$root.'/>');
|
262 |
+
|
263 |
+
|
264 |
+
if ($root == 'Login') // special case login xml
|
265 |
+
{
|
266 |
+
$requestXml->KeepAlive = '1';
|
267 |
+
$requestXml->Login = $this->getUsername();
|
268 |
+
$requestXml->Password = $this->getPassword();
|
269 |
+
|
270 |
+
} else
|
271 |
+
{
|
272 |
+
$requestXml->APIVersion = '1.1';
|
273 |
+
|
274 |
+
// set up login and session
|
275 |
+
$requestXml->Authenticate->Login = $this->getUsername();
|
276 |
+
|
277 |
+
if ($autoLogin && !$this->getSessionId())
|
278 |
+
$this->login(); // if we don't have a session id, we have to log in... this will trigger the special case code above.
|
279 |
+
|
280 |
+
$requestXml->Authenticate->SessionID = $this->getSessionId();
|
281 |
+
}
|
282 |
+
|
283 |
+
return $requestXml;
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Curl function to make a post or get request and get the resulting response.
|
288 |
+
*
|
289 |
+
* Called with the URL to use, the request object if necessary, what kind of request you want and whether or not
|
290 |
+
* you are making an XML request!
|
291 |
+
*
|
292 |
+
* @param string $url
|
293 |
+
* @param SimpleXMLElement|null $request todo maybe make this a string someday
|
294 |
+
* @param string $action
|
295 |
+
* @param bool $xml
|
296 |
+
* @return SimpleXMLElement|bool
|
297 |
+
*/
|
298 |
+
public function getCurlResponse($url, $request = null, $action = 'POST', $xml = true)
|
299 |
+
{
|
300 |
+
if ($action == 'POST')
|
301 |
+
{
|
302 |
+
// curl set up
|
303 |
+
$ch = curl_init();
|
304 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
305 |
+
|
306 |
+
if($xml)
|
307 |
+
{
|
308 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
309 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
310 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
311 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
|
312 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $request->asXML());
|
313 |
+
// Mage::Log('Request - '.$request->asXML(), null, 'alertsite.log', true);
|
314 |
+
|
315 |
+
}
|
316 |
+
else
|
317 |
+
{
|
318 |
+
$fieldString = '';
|
319 |
+
|
320 |
+
foreach($request as $key=>$value) { $fieldString .= $key.'='.$value.'&'; }
|
321 |
+
|
322 |
+
$fieldString = rtrim($fieldString, '&');
|
323 |
+
|
324 |
+
curl_setopt($ch,CURLOPT_POST, count($request));
|
325 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $fieldString);
|
326 |
+
|
327 |
+
}
|
328 |
+
|
329 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
330 |
+
$output = curl_exec($ch);
|
331 |
+
// Mage::Log('Response - '.$output->asXML(), null, 'alertsite.log', true);
|
332 |
+
curl_close($ch);
|
333 |
+
|
334 |
+
// todo everything went swell check
|
335 |
+
$output = $this->getObjectFromXml($output);
|
336 |
+
|
337 |
+
return $output;
|
338 |
+
}
|
339 |
+
|
340 |
+
if ($action == 'GET')
|
341 |
+
{
|
342 |
+
// todo graceful failure on username not defined
|
343 |
+
$username = $this->getUsername();
|
344 |
+
$password = $this->getPassword();
|
345 |
+
|
346 |
+
//Get the result from the AlertSite/SmartBear API
|
347 |
+
$ch = curl_init();
|
348 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
349 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
350 |
+
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
|
351 |
+
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
|
352 |
+
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
353 |
+
$output = curl_exec($ch);
|
354 |
+
curl_close($ch);
|
355 |
+
|
356 |
+
$output = $this->getObjectFromXml($output);
|
357 |
+
|
358 |
+
return $output;
|
359 |
+
}
|
360 |
+
|
361 |
+
return false;
|
362 |
+
}
|
363 |
+
|
364 |
+
|
365 |
+
/**
|
366 |
+
* Process an XML response string to create an XML object
|
367 |
+
*
|
368 |
+
* @param $xmlString
|
369 |
+
* @return bool|SimpleXMLElement
|
370 |
+
*/
|
371 |
+
public function getObjectFromXml($xmlString)
|
372 |
+
{
|
373 |
+
try {
|
374 |
+
$output = simplexml_load_string($xmlString);
|
375 |
+
}
|
376 |
+
catch(Exception $ex) {
|
377 |
+
//todo: check if we should log this message
|
378 |
+
return false;
|
379 |
+
}
|
380 |
+
|
381 |
+
return $output;
|
382 |
+
}
|
383 |
+
|
384 |
+
/**
|
385 |
+
* Login to the SMARTBEAR ALERTSITE Api
|
386 |
+
*
|
387 |
+
* @return bool
|
388 |
+
*/
|
389 |
+
public function login()
|
390 |
+
{
|
391 |
+
$request = $this->getRequest('Login');
|
392 |
+
|
393 |
+
// curl set up
|
394 |
+
$url = $this->getUrl('user/login');
|
395 |
+
|
396 |
+
$response = $this->getCurlResponse($url, $request);
|
397 |
+
|
398 |
+
if ($response && property_exists($response, 'Status') && $response->Status == '0' && property_exists($response, 'SessionID'))
|
399 |
+
{
|
400 |
+
$this->setSessionId((string) $response->SessionID);
|
401 |
+
return true;
|
402 |
+
}
|
403 |
+
else // there was an error,
|
404 |
+
{
|
405 |
+
//Check to see if the response code was 47, i.e. account was not activated yet
|
406 |
+
if($response && property_exists($response, 'Status') && $response->Status == '47')
|
407 |
+
{
|
408 |
+
$activationUrl = Mage::helper('alertsite')->getConfig('alertsite_config', 'alertsite_activation_email');
|
409 |
+
Mage::getSingleton('adminhtml/session')->addError('Your SmartBear AlertSite account has not yet been activated. Click <a target="_blank" onclick="setTimeout(\'window.location=window.location;\', 2000);" href="'.$activationUrl.'">here</a> to enable your account.');
|
410 |
+
return false;
|
411 |
+
}
|
412 |
+
}
|
413 |
+
|
414 |
+
}
|
415 |
+
|
416 |
+
|
417 |
+
|
418 |
+
/**
|
419 |
+
* Path: devices/download
|
420 |
+
*
|
421 |
+
* Request Body XML:
|
422 |
+
* <Download>
|
423 |
+
* <Authenticate>
|
424 |
+
* <Login>bob</Login>
|
425 |
+
* <SessionID>ef770427109e343e</SessionID>
|
426 |
+
* </Authenticate>
|
427 |
+
* <Request>
|
428 |
+
* <ControlID>control_555</ControlID>
|
429 |
+
* <ObjDevice>83621</ObjDevice>
|
430 |
+
* </Request>
|
431 |
+
* </Download>
|
432 |
+
*
|
433 |
+
* @return SimpleXMLElement
|
434 |
+
*/
|
435 |
+
public function getDevice()
|
436 |
+
{
|
437 |
+
$request = $this->getRequest('Download');
|
438 |
+
$request->Request->ObjDevice = $this->getDeviceId();
|
439 |
+
|
440 |
+
$url = $this->getUrl('devices/download');
|
441 |
+
|
442 |
+
$response = $this->getCurlResponse($url, $request);
|
443 |
+
|
444 |
+
return $response;
|
445 |
+
}
|
446 |
+
|
447 |
+
/**
|
448 |
+
* Get the device status for this account!
|
449 |
+
*
|
450 |
+
* Path: devices/status
|
451 |
+
*
|
452 |
+
* Request Body XML:
|
453 |
+
* <Status>
|
454 |
+
* <APIVersion>1.1</APIVersion>
|
455 |
+
* <Authenticate>
|
456 |
+
* <Login>foo@bar.com</Login>
|
457 |
+
* <SessionID>17d63297eb5956be</SessionID>
|
458 |
+
* </Authenticate>
|
459 |
+
* <Request>
|
460 |
+
* <ControlID>5555-99</ControlID>
|
461 |
+
* <ObjDevice>159560</ObjDevice>
|
462 |
+
* </Request>
|
463 |
+
* </Status>
|
464 |
+
*
|
465 |
+
* @return SimpleXMLElement|bool
|
466 |
+
*/
|
467 |
+
public function getDeviceStatus()
|
468 |
+
{
|
469 |
+
|
470 |
+
// set up our request!
|
471 |
+
$request = $this->getRequest('Status');
|
472 |
+
$request->Request->ObjDevice = $this->getDeviceId(); // todo no device id
|
473 |
+
$request->Request->ControlID = 1;
|
474 |
+
$url = $this->getUrl('devices/status');
|
475 |
+
|
476 |
+
// prepare response!
|
477 |
+
/** @var $response SimpleXMLElement */
|
478 |
+
$response = $this->getCurlResponse($url, $request);
|
479 |
+
|
480 |
+
if ($response && property_exists($response, 'Request'))
|
481 |
+
{
|
482 |
+
// if we got a valid response back, we should check for errors
|
483 |
+
/** @var $requestResponse SimpleXMLElement */
|
484 |
+
$requestResponse = $response->Request;
|
485 |
+
|
486 |
+
// if there aren't any errors...
|
487 |
+
if ($requestResponse
|
488 |
+
&& property_exists($requestResponse, 'Status')
|
489 |
+
&& $requestResponse->Status == '0')
|
490 |
+
{
|
491 |
+
|
492 |
+
// grab that device
|
493 |
+
$device = $requestResponse->Device; // todo NO DEVICE?
|
494 |
+
|
495 |
+
// do what we used to do
|
496 |
+
$this->setStatusCode((string)$device->StatusCode);
|
497 |
+
$this->setStatusLastChanged((string)$device->DtLastStatus);
|
498 |
+
$this->setDeviceDescription((string)$device->Descrip);
|
499 |
+
}
|
500 |
+
|
501 |
+
return $response;
|
502 |
+
}
|
503 |
+
|
504 |
+
return false;
|
505 |
+
}
|
506 |
+
|
507 |
+
/**
|
508 |
+
* Update our account information.
|
509 |
+
*
|
510 |
+
* Path: account/update
|
511 |
+
*
|
512 |
+
* Request body XML:
|
513 |
+
* <Update>
|
514 |
+
* <Authenticate>
|
515 |
+
* <Login>bob@foo.com</Login>
|
516 |
+
* <SessionID>10d0f31bbcc57750</SessionID>
|
517 |
+
* </Authenticate>
|
518 |
+
* <Request>
|
519 |
+
* <ControlID>control 12345</ControlID>
|
520 |
+
* <User>
|
521 |
+
* <SelectedLogin>bob@foo.com</SelectedLogin>
|
522 |
+
* <Login>joe@foo.com</Login>
|
523 |
+
* <ContactPhone1>954-312-1111</ContactPhone1>
|
524 |
+
* <ContactPhone2>954-312-2222</ContactPhone2>
|
525 |
+
* </User>
|
526 |
+
* <Company>My New Company Name</Company>
|
527 |
+
* <TimeZone>-5</TimeZone>
|
528 |
+
* <DST>US</DST>
|
529 |
+
* </Request>
|
530 |
+
* </Update>
|
531 |
+
*
|
532 |
+
*
|
533 |
+
* @param Varien_Object $info
|
534 |
+
* @return bool
|
535 |
+
*/
|
536 |
+
public function updateAccount($info)
|
537 |
+
{
|
538 |
+
// set up request object
|
539 |
+
$request = $this->getRequest('Update');
|
540 |
+
$request->Request->ControlID = 1;
|
541 |
+
|
542 |
+
if ($info->getLogin())
|
543 |
+
{
|
544 |
+
$request->Request->User->SelectedLogin = $this->getUsername();
|
545 |
+
$request->Request->User->Login = $info->getLogin();
|
546 |
+
}
|
547 |
+
|
548 |
+
if ($info->getContactPhone())
|
549 |
+
{
|
550 |
+
$request->Request->User->SelectedLogin = $this->getUsername();
|
551 |
+
$request->Request->User->ContactPhone1 = $info->getContactPhone();
|
552 |
+
// $request->Request->User->ContactPhone2 = '';
|
553 |
+
}
|
554 |
+
|
555 |
+
// $request->Request->Company = '';
|
556 |
+
// $request->Request->TimeZone = '';
|
557 |
+
// $request->Request->DST = '';
|
558 |
+
|
559 |
+
$url = $this->getUrl('account/update');
|
560 |
+
|
561 |
+
// prepare response!
|
562 |
+
/** @var $response SimpleXMLElement */
|
563 |
+
$response = $this->getCurlResponse($url, $request);
|
564 |
+
|
565 |
+
if ($response && property_exists($response, 'Request'))
|
566 |
+
{
|
567 |
+
// if we got a valid response back, we should check for errors
|
568 |
+
/** @var $requestResponse SimpleXMLElement */
|
569 |
+
$requestResponse = $response->Request;
|
570 |
+
|
571 |
+
// if there aren't any errors...
|
572 |
+
if ($requestResponse
|
573 |
+
&& property_exists($requestResponse, 'Status'))
|
574 |
+
{
|
575 |
+
|
576 |
+
if ($requestResponse->Status == '0')
|
577 |
+
{
|
578 |
+
return true; // success!
|
579 |
+
}
|
580 |
+
else // we ran into some trouble...
|
581 |
+
{
|
582 |
+
$this->setLastApiStatus($requestResponse->Status);
|
583 |
+
|
584 |
+
if (property_exists($requestResponse, 'Message'))
|
585 |
+
$this->setLastApiMessage($requestResponse->Message.' ('.$this->getLastApiStatus().')');
|
586 |
+
}
|
587 |
+
}
|
588 |
+
}
|
589 |
+
|
590 |
+
// something terrible happened
|
591 |
+
return false;
|
592 |
+
}
|
593 |
+
|
594 |
+
/**
|
595 |
+
* Update the Device URL for our account!
|
596 |
+
*
|
597 |
+
* Path: devices/upload
|
598 |
+
*
|
599 |
+
* Request body XML:
|
600 |
+
* <Upload>
|
601 |
+
* <APIVersion>1.1</APIVersion>
|
602 |
+
* <Authenticate>
|
603 |
+
* <Login>foo@bar.com</Login>
|
604 |
+
* <SessionID>17d63297eb5956be</SessionID>
|
605 |
+
* </Authenticate>
|
606 |
+
* <Request>
|
607 |
+
* <ControlID>5555-99</ControlID>
|
608 |
+
* <ObjDevice>159560</ObjDevice>
|
609 |
+
* <HttpFollowRedirect>n</HttpFollowRedirect>
|
610 |
+
* <URL>www.cnn.com</URL>
|
611 |
+
* </Request>
|
612 |
+
* <Request> todo make sure to update the deja click device too...
|
613 |
+
* <ControlID>5555-100</ControlID>
|
614 |
+
* <ObjDevice>159561</ObjDevice>
|
615 |
+
* <HttpFollowRedirect>n</HttpFollowRedirect>
|
616 |
+
* <URL>www.cnn.com</URL>
|
617 |
+
* <Monitor>n</Monitor>
|
618 |
+
* </Request>
|
619 |
+
* </Upload>
|
620 |
+
*
|
621 |
+
* $LOGIN, $SESSION_ID, $OBJ_DEVICE and $URL need to be replaced with appropriate values.
|
622 |
+
* Please note that the "APIVersion" node (with value 1.1) is required to enable the URL node to take effect.
|
623 |
+
* Other applicable nodes can be defined in the "Request" node when the "URL" node is defined.
|
624 |
+
*
|
625 |
+
* @param string $deviceId
|
626 |
+
* @param string $url
|
627 |
+
* @return bool
|
628 |
+
*/
|
629 |
+
public function updateDeviceUrl($url = '', $deviceId = '', $dejaclickDeviceId = '')
|
630 |
+
{
|
631 |
+
if (empty($deviceId))
|
632 |
+
$deviceId = $this->getDeviceId();
|
633 |
+
|
634 |
+
if (empty($dejaclickDeviceId))
|
635 |
+
$dejaclickDeviceId = $this->getDejaclickDeviceId();
|
636 |
+
|
637 |
+
|
638 |
+
|
639 |
+
// set up request object
|
640 |
+
$request = $this->getRequest('Upload');
|
641 |
+
|
642 |
+
$siteDeviceRequest = $request->addChild('Request');
|
643 |
+
$siteDeviceRequest->ObjDevice = $deviceId;
|
644 |
+
$siteDeviceRequest->URL = $url;
|
645 |
+
$siteDeviceRequest->Descrip = $url;
|
646 |
+
$siteDeviceRequest->HttpFollowRedirect = 'n'; // should fix error code 64 - and remove request for function we don't qualify for
|
647 |
+
$siteDeviceRequest->ControlID = 1;
|
648 |
+
|
649 |
+
$dejaclickDeviceRequest = $request->addChild('Request');
|
650 |
+
$dejaclickDeviceRequest->ObjDevice = $dejaclickDeviceId;
|
651 |
+
$dejaclickDeviceRequest->URL = $url;
|
652 |
+
$dejaclickDeviceRequest->Descrip = $url;
|
653 |
+
$dejaclickDeviceRequest->HttpFollowRedirect = 'n'; // should fix error code 64 - and remove request for function we don't qualify for
|
654 |
+
$dejaclickDeviceRequest->ControlID = 1;
|
655 |
+
|
656 |
+
|
657 |
+
$url = $this->getUrl('devices/upload');
|
658 |
+
|
659 |
+
// prepare response!
|
660 |
+
/** @var $response SimpleXMLElement */
|
661 |
+
$response = $this->getCurlResponse($url, $request);
|
662 |
+
|
663 |
+
if ($response && property_exists($response, 'Request'))
|
664 |
+
{
|
665 |
+
// if we got a valid response back, we should check for errors
|
666 |
+
/** @var $requestResponse SimpleXMLElement */
|
667 |
+
$requestResponse = $response->Request;
|
668 |
+
|
669 |
+
// if there aren't any errors...
|
670 |
+
if ($requestResponse
|
671 |
+
&& property_exists($requestResponse, 'Status'))
|
672 |
+
{
|
673 |
+
|
674 |
+
if ($requestResponse->Status == '0')
|
675 |
+
{
|
676 |
+
return true; // success!
|
677 |
+
}
|
678 |
+
else // prepare error response
|
679 |
+
{
|
680 |
+
$this->setLastApiStatus($requestResponse->Status);
|
681 |
+
|
682 |
+
if (property_exists($requestResponse, 'Message'))
|
683 |
+
$this->setLastApiMessage($requestResponse->Message.' ('.$this->getLastStatus().')');
|
684 |
+
}
|
685 |
+
}
|
686 |
+
}
|
687 |
+
|
688 |
+
// something terrible happened
|
689 |
+
return false;
|
690 |
+
}
|
691 |
+
|
692 |
+
/**
|
693 |
+
* Simple toggle function for turning monitor on and off on default device.
|
694 |
+
*
|
695 |
+
* for request structure
|
696 |
+
* @see Smartbear_Alertsite_Model_Alertsiteapi::updateDeviceUrl()
|
697 |
+
*
|
698 |
+
* @param bool $enable
|
699 |
+
* @return bool|SimpleXMLElement
|
700 |
+
*/
|
701 |
+
public function enableMonitor($enable = true)
|
702 |
+
{
|
703 |
+
if ($enable)
|
704 |
+
$enable = 'y';
|
705 |
+
else
|
706 |
+
$enable = 'n';
|
707 |
+
|
708 |
+
// set up request object
|
709 |
+
$request = $this->getRequest('Upload');
|
710 |
+
|
711 |
+
$siteDevice = $request->addChild('Request');
|
712 |
+
$siteDevice->ObjDevice = $this->getDeviceId();
|
713 |
+
$siteDevice->HttpFollowRedirect = 'n';
|
714 |
+
$siteDevice->Monitor = $enable;
|
715 |
+
|
716 |
+
$dejaclickDevice = $request->addChild('Request');
|
717 |
+
$dejaclickDevice->ObjDevice = $this->getDejaclickDeviceId();
|
718 |
+
$dejaclickDevice->HttpFollowRedirect = 'n';
|
719 |
+
$dejaclickDevice->Monitor = $enable;
|
720 |
+
|
721 |
+
$url = $this->getUrl('devices/upload');
|
722 |
+
|
723 |
+
/** @var $response SimpleXMLElement */
|
724 |
+
$response = $this->getCurlResponse($url, $request);
|
725 |
+
|
726 |
+
if ($response && property_exists($response, 'Request'))
|
727 |
+
{
|
728 |
+
// if we got a valid response back, we should check for errors
|
729 |
+
/** @var $requestResponse SimpleXMLElement */
|
730 |
+
$requestResponse = $response->Request;
|
731 |
+
|
732 |
+
// if there aren't any errors...
|
733 |
+
if ($requestResponse
|
734 |
+
&& property_exists($requestResponse, 'Status'))
|
735 |
+
{
|
736 |
+
|
737 |
+
if ($requestResponse->Status == '0')
|
738 |
+
{
|
739 |
+
return true; // success!
|
740 |
+
}
|
741 |
+
else // prepare error response
|
742 |
+
{
|
743 |
+
$this->setLastApiStatus($requestResponse->Status);
|
744 |
+
|
745 |
+
if (property_exists($requestResponse, 'Message'))
|
746 |
+
$this->setLastApiMessage($requestResponse->Message.' ('.$this->getLastStatus().')');
|
747 |
+
}
|
748 |
+
}
|
749 |
+
}
|
750 |
+
|
751 |
+
return false;
|
752 |
+
}
|
753 |
+
|
754 |
+
/**
|
755 |
+
* This does a lookup in the status array defined at the top of the class to produce a friendly status message.
|
756 |
+
*
|
757 |
+
* @param bool $code
|
758 |
+
* @return bool|string
|
759 |
+
*/
|
760 |
+
public function getFriendlyStatus($code = false)
|
761 |
+
{
|
762 |
+
if($code === false && $this->hasData('status_code'))
|
763 |
+
$code = $this->getStatusCode();
|
764 |
+
else
|
765 |
+
return false;
|
766 |
+
|
767 |
+
$statuses = $this->_statuses;
|
768 |
+
$status = $statuses[$code];
|
769 |
+
return $status;
|
770 |
+
}
|
771 |
+
|
772 |
+
/**
|
773 |
+
* Provision a new account with SmartBear's AlertSite API and return any response
|
774 |
+
*
|
775 |
+
* @param $parameters
|
776 |
+
* @throws Exception - error message encountered when provisioning
|
777 |
+
* @return bool - was the account successfully provisioned?
|
778 |
+
*/
|
779 |
+
public function provisionAccount(Varien_Object $parameters)
|
780 |
+
{
|
781 |
+
//get the provisioning URL
|
782 |
+
$url = self::ALERTSITE_PROVISION_API_URL;
|
783 |
+
|
784 |
+
$apiFriendlyParams = array();
|
785 |
+
|
786 |
+
$apiFriendlyParams['fname'] = urlencode($parameters->getFirstName());
|
787 |
+
$apiFriendlyParams['lname'] = urlencode($parameters->getLastName());
|
788 |
+
$apiFriendlyParams['phone'] = urlencode($parameters->getPhone());
|
789 |
+
$apiFriendlyParams['company'] = urlencode($parameters->getCompanyName());
|
790 |
+
$apiFriendlyParams['api_version'] = urlencode('1.0');
|
791 |
+
$apiFriendlyParams['order_type'] = urlencode('magento');
|
792 |
+
$apiFriendlyParams['response_type'] = urlencode('xml');
|
793 |
+
$apiFriendlyParams['login_email'] = urlencode($parameters->getLoginEmail());
|
794 |
+
$apiFriendlyParams['monitor_url'] = urlencode($parameters->getMonitorUrl());
|
795 |
+
|
796 |
+
$this->setPhone($parameters->getPhone());
|
797 |
+
|
798 |
+
$response = $this->getCurlResponse($url, $apiFriendlyParams, 'POST', false);
|
799 |
+
|
800 |
+
if(!$response)
|
801 |
+
{
|
802 |
+
throw new Exception("There was a problem provisioning your new account. Please try again or contact SmartBear support.");
|
803 |
+
return false;
|
804 |
+
}
|
805 |
+
|
806 |
+
$status = (string)$response["status"];
|
807 |
+
|
808 |
+
if($status == 'failed')
|
809 |
+
{
|
810 |
+
$error = $response->Error;
|
811 |
+
|
812 |
+
$errorMessage = (string)$error['description'];
|
813 |
+
|
814 |
+
if((string)$error['code'] == "0001")
|
815 |
+
{
|
816 |
+
|
817 |
+
if($error->missing_fields)
|
818 |
+
{
|
819 |
+
$count = count($error->missing_fields);
|
820 |
+
$missingFields = "";
|
821 |
+
|
822 |
+
if($count > 1)
|
823 |
+
{
|
824 |
+
foreach($error->missing_fields as $missingField)
|
825 |
+
{
|
826 |
+
if((string)$missingField['name'] == 'monitor_url')
|
827 |
+
$missingFields .= " - Monitor URL Required";
|
828 |
+
else if((string)$missingField['name'] == 'login_email')
|
829 |
+
$missingFields .= " - Login Email Required";
|
830 |
+
}
|
831 |
+
}
|
832 |
+
|
833 |
+
else
|
834 |
+
{
|
835 |
+
if((string)$error->missing_fields['name'] == 'monitor_url')
|
836 |
+
$missingFields .= " - Monitor URL Required";
|
837 |
+
else if((string)$error->missing_fields['name'] == 'login_email')
|
838 |
+
$missingFields .= " - Login Email Required";
|
839 |
+
}
|
840 |
+
|
841 |
+
$errorMessage .= $missingFields;
|
842 |
+
|
843 |
+
}
|
844 |
+
}
|
845 |
+
|
846 |
+
throw new Exception($errorMessage);
|
847 |
+
}
|
848 |
+
else if($status == 'success')
|
849 |
+
{
|
850 |
+
$this->_newAlertSiteConfig($response->AccountCreated);
|
851 |
+
return true;
|
852 |
+
|
853 |
+
}
|
854 |
+
|
855 |
+
return false;
|
856 |
+
|
857 |
+
}
|
858 |
+
|
859 |
+
/**
|
860 |
+
* Helper function to create a new account given a response from the provisioning API
|
861 |
+
*
|
862 |
+
* todo could use some cleanup.
|
863 |
+
*
|
864 |
+
* @param SimpleXMLElement $newAccount
|
865 |
+
*/
|
866 |
+
protected function _newAlertSiteConfig($newAccount)
|
867 |
+
{
|
868 |
+
$account = $newAccount->Account;
|
869 |
+
$devices = $newAccount->Devices;
|
870 |
+
//Setup user info
|
871 |
+
Mage::getConfig()->saveConfig(self::CONFIG_ALERTSITE_ENABLED, true);
|
872 |
+
Mage::getConfig()->saveConfig(self::CONFIG_ACTIVATION_URL, (string)$account['activation_url']);
|
873 |
+
Mage::getConfig()->saveConfig(self::CONFIG_ALERTSITE_USER, (string)$account['login']);
|
874 |
+
Mage::getConfig()->saveConfig(self::CONFIG_ALERTSITE_PASS, (string)$account['password']);
|
875 |
+
|
876 |
+
Mage::getConfig()->saveConfig(self::CONFIG_CLIENT_ID, (string)$account['custid']);
|
877 |
+
Mage::getConfig()->saveConfig(self::CONFIG_ALERTSITE_PROVISIONED, 1);
|
878 |
+
|
879 |
+
if($this->getPhone())
|
880 |
+
Mage::getConfig()->saveConfig(self::CONFIG_ALERTSITE_PHONE, $this->getPhone());
|
881 |
+
|
882 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('Thank you for creating your AlertSite account. Click <a target="_blank" onclick="setTimeout(\'window.location=window.location;\', 2000);" href="'.(string)$account['activation_url'].'">here</a> to enable your account.');
|
883 |
+
|
884 |
+
//Setup Devices
|
885 |
+
foreach($devices->Device as $device)
|
886 |
+
{
|
887 |
+
$deviceType = (string)$device['type'];
|
888 |
+
if($deviceType == 'ipd')
|
889 |
+
{
|
890 |
+
Mage::getConfig()->saveConfig(self::CONFIG_ALERTSITE_DEVICE_URL, (string)$device['URL']);
|
891 |
+
Mage::getConfig()->saveConfig(self::CONFIG_ALERTSITE_DEVICE_DESCRIPTION, (string)$device['description']);
|
892 |
+
Mage::getConfig()->saveConfig(self::CONFIG_DEVICE_ID, (string)$device['obj_device']);
|
893 |
+
break;
|
894 |
+
}
|
895 |
+
else if($deviceType == 'dejaclick')
|
896 |
+
{
|
897 |
+
Mage::getConfig()->saveConfig(self::CONFIG_DEJACLICK_DEVICE_ID, (string)$device['obj_device']);
|
898 |
+
}
|
899 |
+
}
|
900 |
+
|
901 |
+
Mage::getConfig()->reinit();
|
902 |
+
Mage::app()->reinitStores();
|
903 |
+
}
|
904 |
+
}
|
app/code/community/Smartbear/Alertsite/Model/Observer.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Smartbear_Alertsite_Model_Observer
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Place the hook in order to land our alertsite block on the Dash.
|
6 |
+
*
|
7 |
+
* @param Varien_Event_Observer $observer
|
8 |
+
* @return Smartbear_Alertsite_Model_Observer
|
9 |
+
*/
|
10 |
+
public function coreBlockAbstractPrepareLayoutAfter(Varien_Event_Observer $observer)
|
11 |
+
{
|
12 |
+
if(!Mage::helper('alertsite')->getConfig('alertsite_config', 'enabled') || strlen(trim(Mage::helper('alertsite')->getConfig('alertsite_config', 'alertsite_user'))) < 1)
|
13 |
+
{
|
14 |
+
return $this;
|
15 |
+
}
|
16 |
+
|
17 |
+
if (Mage::app()->getFrontController()->getAction()->getFullActionName() === 'adminhtml_dashboard_index')
|
18 |
+
{
|
19 |
+
$block = $observer->getBlock();
|
20 |
+
if ($block->getNameInLayout() === 'dashboard')
|
21 |
+
{
|
22 |
+
$block->getChild('topSearches')->setAlertsiteDashboardHook(true);
|
23 |
+
}
|
24 |
+
}
|
25 |
+
return $this;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Looks for the hook we set and adds our own custom block.
|
30 |
+
*
|
31 |
+
* @param Varien_Event_Observer $observer
|
32 |
+
* @return Smartbear_Alertsite_Model_Observer
|
33 |
+
*/
|
34 |
+
public function coreBlockAbstractToHtmlAfter(Varien_Event_Observer $observer)
|
35 |
+
{
|
36 |
+
|
37 |
+
if(!Mage::helper('alertsite')->getConfig('alertsite_config', 'enabled') || strlen(trim(Mage::helper('alertsite')->getConfig('alertsite_config', 'alertsite_user'))) < 1)
|
38 |
+
{
|
39 |
+
return $this;
|
40 |
+
}
|
41 |
+
|
42 |
+
if (Mage::app()->getFrontController()->getAction()->getFullActionName() === 'adminhtml_dashboard_index')
|
43 |
+
{
|
44 |
+
if ($observer->getBlock()->getAlertsiteDashboardHook())
|
45 |
+
{
|
46 |
+
$html = $observer->getTransport()->getHtml(); // grab the html that's already rendered
|
47 |
+
|
48 |
+
|
49 |
+
/** @var $dashboardBox Smartbear_Alertsite_Block_Adminhtml_Dashboard */
|
50 |
+
$dashboardBox = $observer->getBlock()->getLayout()->createBlock('alertsite/adminhtml_dashboard');
|
51 |
+
|
52 |
+
$html .= $dashboardBox->toHtml();
|
53 |
+
|
54 |
+
$observer->getTransport()->setHtml($html);
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
}
|
app/code/community/Smartbear/Alertsite/Model/System/Config/Backend/Editaccount.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Backend config model for changing our account info
|
4 |
+
*/
|
5 |
+
class Smartbear_Alertsite_Model_System_Config_Backend_Editaccount extends Mage_Core_Model_Config_Data
|
6 |
+
{
|
7 |
+
|
8 |
+
// const for this config value
|
9 |
+
const XML_PATH_ACCOUNT_USERNAME = 'alertsite/alertsite_config/alertsite_user';
|
10 |
+
const XML_PATH_ACCOUNT_PHONE = 'alertsite/alertsite_config/alertsite_phone';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Get equipped with API!
|
14 |
+
*
|
15 |
+
* @return Smartbear_Alertsite_Model_AlertsiteApi
|
16 |
+
*/
|
17 |
+
public function getApi()
|
18 |
+
{
|
19 |
+
return Mage::getModel('alertsite/alertsiteapi');
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Saves our account information to the internet before we save everything
|
24 |
+
*
|
25 |
+
* @throws Exception
|
26 |
+
* @return Mage_Core_Model_Abstract
|
27 |
+
*/
|
28 |
+
protected function _beforeSave()
|
29 |
+
{
|
30 |
+
$api = $this->getApi();
|
31 |
+
|
32 |
+
$update = false;
|
33 |
+
$login = $this->getData('groups/alertsite_config/fields/alertsite_user/value');
|
34 |
+
$phone = $this->getData('groups/alertsite_config/fields/alertsite_phone/value');
|
35 |
+
|
36 |
+
$request = new Varien_Object();
|
37 |
+
|
38 |
+
|
39 |
+
if ($login != $api->getUsername())
|
40 |
+
{
|
41 |
+
$request->setLogin($login);
|
42 |
+
$update = true;
|
43 |
+
}
|
44 |
+
|
45 |
+
if ($phone != $api->getPhone())
|
46 |
+
{
|
47 |
+
$request->setContactPhone($phone);
|
48 |
+
$update = true;
|
49 |
+
}
|
50 |
+
|
51 |
+
if ($update)
|
52 |
+
{
|
53 |
+
$updatedResponse = $api->updateAccount($request);
|
54 |
+
|
55 |
+
if (!$updatedResponse)
|
56 |
+
{
|
57 |
+
throw new Exception($api->getLastApiMessage());
|
58 |
+
}
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
}
|
63 |
+
}
|
app/code/community/Smartbear/Alertsite/Model/System/Config/Backend/Editdevice.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Backend config model for changing our device URL
|
4 |
+
*/
|
5 |
+
class Smartbear_Alertsite_Model_System_Config_Backend_Editdevice extends Mage_Core_Model_Config_Data
|
6 |
+
{
|
7 |
+
|
8 |
+
// const for this config value
|
9 |
+
const XML_PATH_DEVICE_URL = 'alertsite/alertsite_config/device_url';
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Get equipped with API!
|
13 |
+
*
|
14 |
+
* @return Smartbear_Alertsite_Model_AlertsiteApi
|
15 |
+
*/
|
16 |
+
public function getApi()
|
17 |
+
{
|
18 |
+
return Mage::getModel('alertsite/alertsiteapi');
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Saves our url to our SMARTBEAR ALERTSITE account
|
23 |
+
*
|
24 |
+
* @throws Exception
|
25 |
+
* @return Mage_Core_Model_Abstract
|
26 |
+
*/
|
27 |
+
public function _beforeSave()
|
28 |
+
{
|
29 |
+
$api = $this->getApi();
|
30 |
+
$url = $this->getValue();
|
31 |
+
|
32 |
+
if ($url != $api->getDeviceMonitorUrl())
|
33 |
+
{ // new url doesn't match old url...
|
34 |
+
$result = $api->updateDeviceUrl($url);
|
35 |
+
|
36 |
+
if (!$result)
|
37 |
+
{
|
38 |
+
throw new Exception($api->getLastApiMessage());
|
39 |
+
}
|
40 |
+
|
41 |
+
Mage::getConfig()->saveConfig('alertsite/alertsite_config/device_description', $url);
|
42 |
+
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/community/Smartbear/Alertsite/Model/System/Config/Backend/Enable.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Backend config model for changing our device URL
|
4 |
+
*/
|
5 |
+
class Smartbear_Alertsite_Model_System_Config_Backend_Enable extends Mage_Core_Model_Config_Data
|
6 |
+
{
|
7 |
+
|
8 |
+
// const for this config value
|
9 |
+
const XML_PATH_DEVICE_URL = 'alertsite/alertsite_config/enabled';
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Get equipped with API!
|
13 |
+
*
|
14 |
+
* @return Smartbear_Alertsite_Model_AlertsiteApi
|
15 |
+
*/
|
16 |
+
public function getApi()
|
17 |
+
{
|
18 |
+
return Mage::getModel('alertsite/alertsiteapi');
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Saves our url to our SMARTBEAR ALERTSITE account
|
23 |
+
*
|
24 |
+
* @throws Exception
|
25 |
+
* @return Mage_Core_Model_Abstract
|
26 |
+
*/
|
27 |
+
public function save()
|
28 |
+
{
|
29 |
+
$enable = $this->getValue();
|
30 |
+
|
31 |
+
$api = $this->getApi();
|
32 |
+
$result = $api->enableMonitor($enable);
|
33 |
+
|
34 |
+
if (!$result)
|
35 |
+
{
|
36 |
+
/** @var $session Mage_Admin_Model_Session */
|
37 |
+
$session = Mage::getSingleton('admin/session');
|
38 |
+
|
39 |
+
$session->addError('You have disabled the Alertsite extension but there was a problem with disabling Alertsite monitoring - please contact <a href="http://help.alertsite.com/MagentoHelp">support</a>.');
|
40 |
+
}
|
41 |
+
|
42 |
+
return parent::save();
|
43 |
+
}
|
44 |
+
}
|
app/code/community/Smartbear/Alertsite/controllers/Adminhtml/AlertsiteController.php
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Smartbear_Alertsite_Adminhtml_AlertsiteController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
|
5 |
+
protected $_publicActions = array('resetalertsite', 'index');
|
6 |
+
|
7 |
+
protected function _initAction()
|
8 |
+
{
|
9 |
+
$this->loadLayout()->_setActiveMenu('alertsite/alertsite');
|
10 |
+
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function indexAction() {
|
15 |
+
|
16 |
+
}
|
17 |
+
|
18 |
+
public function testAction()
|
19 |
+
{
|
20 |
+
$request = $this->getRequest();
|
21 |
+
$ajax = $this->getRequest()->isAjax();
|
22 |
+
$params = $request->getParams();
|
23 |
+
|
24 |
+
if($ajax){
|
25 |
+
$block = $this->getLayout()->createBlock('core/template');
|
26 |
+
$this->getResponse()->setBody($block->toHtml());
|
27 |
+
}
|
28 |
+
else
|
29 |
+
{
|
30 |
+
$this->_title($this->__('Smart Bear Report'));
|
31 |
+
$this->loadLayout();
|
32 |
+
$this->renderLayout();
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
public function lolAction()
|
38 |
+
{
|
39 |
+
/** @var $api Smartbear_Alertsite_Model_AlertsiteApi */
|
40 |
+
$api = Mage::getModel('alertsite/alertsiteapi');
|
41 |
+
|
42 |
+
$enabled = $api->enableMonitor(false);
|
43 |
+
|
44 |
+
$devices = $api->getDevice();
|
45 |
+
|
46 |
+
var_dump($devices);
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
public function createAction()
|
51 |
+
{
|
52 |
+
$this->_title($this->__('Create SmertBear AlertSite account'));
|
53 |
+
$this->loadLayout();
|
54 |
+
$this->renderLayout();
|
55 |
+
}
|
56 |
+
|
57 |
+
public function provisionAction()
|
58 |
+
{
|
59 |
+
$result = array();
|
60 |
+
$formValues = new Varien_Object(Mage::app()->getRequest()->getParams());
|
61 |
+
|
62 |
+
/** @var $api Smartbear_Alertsite_Model_AlertsiteApi */
|
63 |
+
$api = Mage::getModel('alertsite/alertsiteapi');
|
64 |
+
|
65 |
+
try{
|
66 |
+
$apiResponse = $api->provisionAccount($formValues);
|
67 |
+
}catch(Exception $e)
|
68 |
+
{
|
69 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
70 |
+
}
|
71 |
+
|
72 |
+
//If the API response is true aka success, then we'll redirect the user to the config section of Magento
|
73 |
+
if($apiResponse)
|
74 |
+
{
|
75 |
+
$configUrl = $this->getUrl('*/system_config/edit');
|
76 |
+
$this->getResponse()->setRedirect($configUrl);
|
77 |
+
}
|
78 |
+
//Else we want to show the error message and display the site up form again
|
79 |
+
else
|
80 |
+
{
|
81 |
+
$this->getResponse()->setRedirect(Mage::getModel('adminhtml/url')->getUrl('*/alertsite/create'));
|
82 |
+
}
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* todo: delete this?
|
88 |
+
*
|
89 |
+
* This is to help us quickly reset all of the modules config values so we can test in various states
|
90 |
+
*
|
91 |
+
*/
|
92 |
+
public function resetalertsiteAction()
|
93 |
+
{
|
94 |
+
$CONFIG_ACTIVATION_URL = 'alertsite/alertsite_config/alertsite_activation_email';
|
95 |
+
$CONFIG_DEVICE_ID = 'alertsite/alertsite_config/device_id';
|
96 |
+
$CONFIG_CLIENT_ID = 'alertsite/alertsite_config/client_id';
|
97 |
+
$CONFIG_ALERTSITE_USER = 'alertsite/alertsite_config/alertsite_user';
|
98 |
+
$CONFIG_ALERTSITE_PASS = 'alertsite/alertsite_config/alertsite_pass';
|
99 |
+
$CONFIG_ALERTSITE_DEVICE_URL = 'alertsite/alertsite_config/device_url';
|
100 |
+
$CONFIG_ALERTSITE_DEVICE_DESCRIPTION = 'alertsite/alertsite_config/device_description';
|
101 |
+
$CONFIG_DEJACLICK_DEJACLICK_DEVICE_ID = 'alertsite/alertsite_config/dejaclick_device_id';
|
102 |
+
$CONFIG_ALERTSITE_PROVISIONED = 'alertsite/alertsite_config/provisioned';
|
103 |
+
$CONFIG_ALERTSITE_PHONE = 'alertsite/alertsite_config/alertsite_phone';
|
104 |
+
$CONFIG_ALERTSITE_ENABLED = 'alertsite/alertsite_config/enabled';
|
105 |
+
|
106 |
+
//Setup user info
|
107 |
+
Mage::getConfig()->saveConfig($CONFIG_ACTIVATION_URL, "", 'default', 0);
|
108 |
+
Mage::getConfig()->saveConfig($CONFIG_ALERTSITE_USER, "", 'default', 0);
|
109 |
+
Mage::getConfig()->saveConfig($CONFIG_ALERTSITE_PASS, "", 'default', 0);
|
110 |
+
Mage::getConfig()->saveConfig($CONFIG_CLIENT_ID, "", 'default', 0);
|
111 |
+
Mage::getConfig()->saveConfig($CONFIG_ALERTSITE_DEVICE_URL, "", 'default', 0);
|
112 |
+
Mage::getConfig()->saveConfig($CONFIG_ALERTSITE_DEVICE_DESCRIPTION, "", 'default', 0);
|
113 |
+
Mage::getConfig()->saveConfig($CONFIG_DEVICE_ID, "", 'default', 0);
|
114 |
+
Mage::getConfig()->saveConfig('alertsite/alertsite_config/enabled', "1", 'default', 0);
|
115 |
+
Mage::getConfig()->saveConfig($CONFIG_DEJACLICK_DEJACLICK_DEVICE_ID, "");
|
116 |
+
Mage::getConfig()->saveConfig($CONFIG_ALERTSITE_PROVISIONED, 0);
|
117 |
+
Mage::getConfig()->saveConfig($CONFIG_ALERTSITE_PHONE, "");
|
118 |
+
Mage::getConfig()->saveConfig($CONFIG_ALERTSITE_ENABLED, true);
|
119 |
+
|
120 |
+
Mage::getConfig()->reinit();
|
121 |
+
Mage::app()->reinitStores();
|
122 |
+
|
123 |
+
$configUrl = Mage::getUrl('adminhtml/system_config/edit', array('section' => 'alertsite'));
|
124 |
+
$this->getResponse()->setRedirect($configUrl);
|
125 |
+
}
|
126 |
+
|
127 |
+
|
128 |
+
}
|
app/code/community/Smartbear/Alertsite/etc/adminhtml.xml
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<!--<menu>-->
|
4 |
+
<!--<report>-->
|
5 |
+
<!--<children>-->
|
6 |
+
<!--<alertsite translate="title" module="alertsite">-->
|
7 |
+
<!--<title>SmartBear</title>-->
|
8 |
+
<!--<children>-->
|
9 |
+
<!--<alertsite translate="title" module="review">-->
|
10 |
+
<!--<title>AlertSite Report</title>-->
|
11 |
+
<!--<action>adminhtml/alertsite/index/</action>-->
|
12 |
+
<!--</alertsite>-->
|
13 |
+
<!--</children>-->
|
14 |
+
<!--<sort_order>50</sort_order>-->
|
15 |
+
<!--</alertsite>-->
|
16 |
+
<!--</children>-->
|
17 |
+
<!--</report>-->
|
18 |
+
<!--</menu>-->
|
19 |
+
|
20 |
+
<layout>
|
21 |
+
<updates>
|
22 |
+
<alertsite>
|
23 |
+
<file>alertsite.xml</file>
|
24 |
+
</alertsite>
|
25 |
+
</updates>
|
26 |
+
</layout>
|
27 |
+
|
28 |
+
<acl>
|
29 |
+
<resources>
|
30 |
+
<all>
|
31 |
+
<title>Allow Everything</title>
|
32 |
+
</all>
|
33 |
+
<admin>
|
34 |
+
<children>
|
35 |
+
<!--<system>-->
|
36 |
+
<!--<children>-->
|
37 |
+
<!--<alertsite module="alertsite">-->
|
38 |
+
<!--<title>SmartBear AlertSite Report</title>-->
|
39 |
+
<!--<sort_order>10</sort_order>-->
|
40 |
+
<!--</alertsite>-->
|
41 |
+
<!--</children>-->
|
42 |
+
<!--</system>-->
|
43 |
+
<system>
|
44 |
+
<children>
|
45 |
+
<config>
|
46 |
+
<children>
|
47 |
+
<alertsite module="alertsite">
|
48 |
+
<title>SmartBear AlertSite Configuration</title>
|
49 |
+
</alertsite>
|
50 |
+
</children>
|
51 |
+
</config>
|
52 |
+
</children>
|
53 |
+
</system>
|
54 |
+
</children>
|
55 |
+
</admin>
|
56 |
+
</resources>
|
57 |
+
</acl>
|
58 |
+
</config>
|
app/code/community/Smartbear/Alertsite/etc/config.xml
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Smartbear_Alertsite>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Smartbear_Alertsite>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<alertsite>
|
11 |
+
<class>Smartbear_Alertsite_Model</class>
|
12 |
+
</alertsite>
|
13 |
+
</models>
|
14 |
+
<helpers>
|
15 |
+
<alertsite>
|
16 |
+
<class>Smartbear_Alertsite_Helper</class>
|
17 |
+
</alertsite>
|
18 |
+
</helpers>
|
19 |
+
<blocks>
|
20 |
+
<alertsite>
|
21 |
+
<class>Smartbear_Alertsite_Block</class>
|
22 |
+
</alertsite>
|
23 |
+
</blocks>
|
24 |
+
<resources>
|
25 |
+
<alertsite_setup>
|
26 |
+
<setup>
|
27 |
+
<module>Smartbear_Alertsite</module>
|
28 |
+
</setup>
|
29 |
+
<connection>
|
30 |
+
<use>core_setup</use>
|
31 |
+
</connection>
|
32 |
+
</alertsite_setup>
|
33 |
+
</resources>
|
34 |
+
</global>
|
35 |
+
|
36 |
+
<adminhtml>
|
37 |
+
<events>
|
38 |
+
<core_block_abstract_prepare_layout_after>
|
39 |
+
<observers>
|
40 |
+
<smartbear_alertsite>
|
41 |
+
<class>alertsite/observer</class>
|
42 |
+
<method>coreBlockAbstractPrepareLayoutAfter</method>
|
43 |
+
</smartbear_alertsite>
|
44 |
+
</observers>
|
45 |
+
</core_block_abstract_prepare_layout_after>
|
46 |
+
<core_block_abstract_to_html_after>
|
47 |
+
<observers>
|
48 |
+
<smartbear_alertsite>
|
49 |
+
<class>alertsite/observer</class>
|
50 |
+
<method>coreBlockAbstractToHtmlAfter</method>
|
51 |
+
</smartbear_alertsite>
|
52 |
+
</observers>
|
53 |
+
</core_block_abstract_to_html_after>
|
54 |
+
</events>
|
55 |
+
<layout>
|
56 |
+
<updates>
|
57 |
+
<alertsite>
|
58 |
+
<file>alertsite.xml</file>
|
59 |
+
</alertsite>
|
60 |
+
</updates>
|
61 |
+
</layout>
|
62 |
+
</adminhtml>
|
63 |
+
|
64 |
+
<admin>
|
65 |
+
<routers>
|
66 |
+
<adminhtml>
|
67 |
+
<args>
|
68 |
+
<modules>
|
69 |
+
<alertsite after="Mage_Adminhtml">Smartbear_Alertsite_Adminhtml</alertsite>
|
70 |
+
</modules>
|
71 |
+
</args>
|
72 |
+
</adminhtml>
|
73 |
+
</routers>
|
74 |
+
</admin>
|
75 |
+
|
76 |
+
<default>
|
77 |
+
<alertsite>
|
78 |
+
<alertsite_config>
|
79 |
+
<enabled>1</enabled>
|
80 |
+
<provisioned>0</provisioned>
|
81 |
+
</alertsite_config>
|
82 |
+
</alertsite>
|
83 |
+
</default>
|
84 |
+
</config>
|
app/code/community/Smartbear/Alertsite/etc/system.xml
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<alertsite translate="label">
|
5 |
+
<label>SmartBear AlertSite</label>
|
6 |
+
<tab>service</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>400</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 |
+
<alertsite_config translate="label">
|
14 |
+
<label>SmartBear AlertSite Configuration</label>
|
15 |
+
<sort_order>5</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<expanded>1</expanded>
|
20 |
+
<fields>
|
21 |
+
<smartbear_account_header translate="label">
|
22 |
+
<label>Register</label>
|
23 |
+
<frontend_model>alertsite/adminhtml_system_form_renderer_configMessage</frontend_model>
|
24 |
+
<comment>AlertSite will help you make sure your webstore is available and performing well. Just click the button below to register for your free account.</comment>
|
25 |
+
<sort_order>2</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>0</show_in_website>
|
28 |
+
<show_in_store>0</show_in_store>
|
29 |
+
<depends>
|
30 |
+
<provisioned>0</provisioned>
|
31 |
+
</depends>
|
32 |
+
</smartbear_account_header>
|
33 |
+
<smartbear_account_button>
|
34 |
+
<label/>
|
35 |
+
<frontend_model>alertsite/adminhtml_system_form_renderer_linkButton</frontend_model>
|
36 |
+
<button_label>Create my free account</button_label>
|
37 |
+
<button_url><![CDATA[http://www.alertsite.com]]></button_url>
|
38 |
+
<comment></comment>
|
39 |
+
<sort_order>5</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>0</show_in_website>
|
42 |
+
<show_in_store>0</show_in_store>
|
43 |
+
<depends>
|
44 |
+
<provisioned>0</provisioned>
|
45 |
+
</depends>
|
46 |
+
</smartbear_account_button>
|
47 |
+
<enabled translate="label">
|
48 |
+
<label><![CDATA[Enable SmartBear AlertSite]]></label>
|
49 |
+
<frontend_type>select</frontend_type>
|
50 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
51 |
+
<backend_model>alertsite/system_config_backend_enable</backend_model>
|
52 |
+
<sort_order>7</sort_order>
|
53 |
+
<show_in_default>1</show_in_default>
|
54 |
+
<show_in_website>0</show_in_website>
|
55 |
+
<show_in_store>0</show_in_store>
|
56 |
+
<depends>
|
57 |
+
<provisioned>1</provisioned>
|
58 |
+
</depends>
|
59 |
+
</enabled>
|
60 |
+
<alertsite_user translate="label">
|
61 |
+
<label><![CDATA[AlertSite Account Login]]></label>
|
62 |
+
<frontend_type>text</frontend_type>
|
63 |
+
<frontend_model>alertsite/adminhtml_system_form_renderer_label</frontend_model>
|
64 |
+
<sort_order>10</sort_order>
|
65 |
+
<show_in_default>1</show_in_default>
|
66 |
+
<show_in_website>0</show_in_website>
|
67 |
+
<show_in_store>0</show_in_store>
|
68 |
+
<depends>
|
69 |
+
<provisioned>1</provisioned>
|
70 |
+
</depends>
|
71 |
+
</alertsite_user>
|
72 |
+
<alertsite_phone>
|
73 |
+
<label><![CDATA[AlertSite Account Phone]]></label>
|
74 |
+
<frontend_type>text</frontend_type>
|
75 |
+
<sort_order>15</sort_order>
|
76 |
+
<show_in_default>0</show_in_default>
|
77 |
+
<show_in_website>0</show_in_website>
|
78 |
+
<show_in_store>0</show_in_store>
|
79 |
+
<depends>
|
80 |
+
<provisioned>1</provisioned>
|
81 |
+
</depends>
|
82 |
+
</alertsite_phone>
|
83 |
+
<alertsite_pass translate="label">
|
84 |
+
<label><![CDATA[AlertSite Account Password]]></label>
|
85 |
+
<frontend_type>password</frontend_type>
|
86 |
+
<sort_order>20</sort_order>
|
87 |
+
<show_in_default>0</show_in_default>
|
88 |
+
<show_in_website>0</show_in_website>
|
89 |
+
<show_in_store>0</show_in_store>
|
90 |
+
</alertsite_pass>
|
91 |
+
<alertsite_activation_email translate="label">
|
92 |
+
<label><![CDATA[Activation Email]]></label>
|
93 |
+
<frontend_type>text</frontend_type>
|
94 |
+
<sort_order>10</sort_order>
|
95 |
+
<show_in_default>0</show_in_default>
|
96 |
+
<show_in_website>0</show_in_website>
|
97 |
+
<show_in_store>0</show_in_store>
|
98 |
+
</alertsite_activation_email>
|
99 |
+
<client_id>
|
100 |
+
<label><![CDATA[Client ID]]></label>
|
101 |
+
<frontend_type>text</frontend_type>
|
102 |
+
<sort_order>30</sort_order>
|
103 |
+
<show_in_default>0</show_in_default>
|
104 |
+
<show_in_website>0</show_in_website>
|
105 |
+
<show_in_store>0</show_in_store>
|
106 |
+
</client_id>
|
107 |
+
<device_id>
|
108 |
+
<label><![CDATA[Device ID]]></label>
|
109 |
+
<frontend_type>text</frontend_type>
|
110 |
+
<sort_order>40</sort_order>
|
111 |
+
<show_in_default>0</show_in_default>
|
112 |
+
<show_in_website>0</show_in_website>
|
113 |
+
<show_in_store>0</show_in_store>
|
114 |
+
</device_id>
|
115 |
+
<dejaclick_device_id>
|
116 |
+
<label><![CDATA[Dejaclick Device ID]]></label>
|
117 |
+
<frontend_type>text</frontend_type>
|
118 |
+
<sort_order>40</sort_order>
|
119 |
+
<show_in_default>0</show_in_default>
|
120 |
+
<show_in_website>0</show_in_website>
|
121 |
+
<show_in_store>0</show_in_store>
|
122 |
+
</dejaclick_device_id>
|
123 |
+
<device_description>
|
124 |
+
<label><![CDATA[Website Description]]></label>
|
125 |
+
<frontend_model>alertsite/adminhtml_system_form_renderer_deviceDescription</frontend_model>
|
126 |
+
<comment></comment>
|
127 |
+
<sort_order>45</sort_order>
|
128 |
+
<show_in_default>1</show_in_default>
|
129 |
+
<show_in_website>0</show_in_website>
|
130 |
+
<show_in_store>0</show_in_store>
|
131 |
+
<depends>
|
132 |
+
<provisioned>1</provisioned>
|
133 |
+
</depends>
|
134 |
+
</device_description>
|
135 |
+
<device_url>
|
136 |
+
<label><![CDATA[Website URL]]></label>
|
137 |
+
<frontend_type>text</frontend_type>
|
138 |
+
<backend_model>alertsite/system_config_backend_editdevice</backend_model>
|
139 |
+
<sort_order>50</sort_order>
|
140 |
+
<show_in_default>1</show_in_default>
|
141 |
+
<show_in_website>0</show_in_website>
|
142 |
+
<show_in_store>0</show_in_store>
|
143 |
+
<depends>
|
144 |
+
<provisioned>1</provisioned>
|
145 |
+
</depends>
|
146 |
+
</device_url>
|
147 |
+
<provisioned translate="label">
|
148 |
+
<label><![CDATA[Account has been provisioned]]></label>
|
149 |
+
<frontend_type>text</frontend_type>
|
150 |
+
<sort_order>1</sort_order>
|
151 |
+
<show_in_default>0</show_in_default>
|
152 |
+
<show_in_website>0</show_in_website>
|
153 |
+
<show_in_store>0</show_in_store>
|
154 |
+
</provisioned>
|
155 |
+
</fields>
|
156 |
+
</alertsite_config>
|
157 |
+
</groups>
|
158 |
+
</alertsite>
|
159 |
+
</sections>
|
160 |
+
</config>
|
app/design/adminhtml/default/default/layout/alertsite.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<default>
|
4 |
+
<reference name="notifications">
|
5 |
+
<block type="alertsite/adminhtml_notifications" name="alertsite_notifications" template="alertsite/notifications.phtml" />
|
6 |
+
</reference>
|
7 |
+
</default>
|
8 |
+
|
9 |
+
<smartbear_adminhtml_index>
|
10 |
+
<reference name="content">
|
11 |
+
<block type="alertsite/adminhtml_smartbear" name="smartbear" />
|
12 |
+
</reference>
|
13 |
+
</smartbear_adminhtml_index>
|
14 |
+
|
15 |
+
<adminhtml_alertsite_create>
|
16 |
+
<reference name="head">
|
17 |
+
<action method="addCss"><name>smartbear/alertsite/css/alertsite.css</name></action>
|
18 |
+
<action method="addJs"><name>smartbear/alertsite/jquery.min.js</name></action>
|
19 |
+
<action method="addJs"><name>smartbear/alertsite/alertsite.js</name></action>
|
20 |
+
</reference>
|
21 |
+
<reference name="content">
|
22 |
+
<block type="alertsite/adminhtml_create" name="smartbear.create" template="alertsite/create.phtml" />
|
23 |
+
</reference>
|
24 |
+
<reference name="left">
|
25 |
+
<block type="adminhtml/system_config_switcher" name="adminhtml.system.config.switcher" before="-"/>
|
26 |
+
</reference>
|
27 |
+
</adminhtml_alertsite_create>
|
28 |
+
|
29 |
+
<adminhtml_dashboard_index>
|
30 |
+
<reference name="head">
|
31 |
+
<action method="addCss"><name>smartbear/alertsite/css/alertsite.css</name></action>
|
32 |
+
</reference>
|
33 |
+
</adminhtml_dashboard_index>
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
</layout>
|
app/design/adminhtml/default/default/template/alertsite/create.phtml
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php /** @var $this Smartbear_Alertsite_Block_Adminhtml_Create */ ?>
|
2 |
+
<div class="main-col-inner">
|
3 |
+
<div id="messages">
|
4 |
+
|
5 |
+
</div>
|
6 |
+
|
7 |
+
<div class="content-header">
|
8 |
+
<table cellspacing="0">
|
9 |
+
<tbody>
|
10 |
+
<tr>
|
11 |
+
<td>
|
12 |
+
<h3>SmartBear AlertSite Account Creation</h3>
|
13 |
+
</td>
|
14 |
+
</tr>
|
15 |
+
</tbody>
|
16 |
+
</table>
|
17 |
+
</div>
|
18 |
+
|
19 |
+
<div class="entry-edit">
|
20 |
+
<div class="entry-edit-head">
|
21 |
+
<h4 class="icon-head head-edit-form fieldset-legend">New SmartBear AlertSite Account Information</h4>
|
22 |
+
</div>
|
23 |
+
<div class="fieldset">
|
24 |
+
<form action="<?php echo $this->getFormAction(); ?>" method="post" id="alertsite-provision" >
|
25 |
+
<table class="form-list">
|
26 |
+
<input name="form_key" type="hidden" value="<?php echo $this->getFormKey(); ?>">
|
27 |
+
<tr>
|
28 |
+
<td class="label">
|
29 |
+
<label for="company_name" style="">Company Name</label>
|
30 |
+
</td>
|
31 |
+
<td class="value">
|
32 |
+
<input id="company_name" name="company_name" value="<?php echo $this->getCompanyName(); ?>" class=" input-text required-entry" type="text">
|
33 |
+
</td>
|
34 |
+
</tr>
|
35 |
+
<tr>
|
36 |
+
<td class="label">
|
37 |
+
<label for="first_name" style="">First Name</label>
|
38 |
+
</td>
|
39 |
+
<td class="value">
|
40 |
+
<input id="first_name" name="first_name" class="input-text" value="<?php echo $this->getFirstname(); ?>" type="text">
|
41 |
+
</td>
|
42 |
+
</tr>
|
43 |
+
<tr>
|
44 |
+
<td class="label">
|
45 |
+
<label for="last_name" style="">Last Name</label>
|
46 |
+
</td>
|
47 |
+
<td class="value">
|
48 |
+
<input id="last_name" name="last_name" class="input-text" value="<?php echo $this->getLastname(); ?>" type="text">
|
49 |
+
</td>
|
50 |
+
</tr>
|
51 |
+
<tr>
|
52 |
+
<td class="label">
|
53 |
+
<label for="phone" style="">Phone</label>
|
54 |
+
</td>
|
55 |
+
<td class="value">
|
56 |
+
<input id="phone" name="phone" value="" class="input-text" type="text">
|
57 |
+
</td>
|
58 |
+
</tr>
|
59 |
+
<tr>
|
60 |
+
<td class="label">
|
61 |
+
<label for="login_email" style="">Login Email <span class="required">*</span></label>
|
62 |
+
</td>
|
63 |
+
<td class="value">
|
64 |
+
<input id="login_email" class="validate-email input-text" name="login_email" value="<?php echo $this->getEmail(); ?>" type="text">
|
65 |
+
</td>
|
66 |
+
</tr>
|
67 |
+
<tr>
|
68 |
+
<td class="label">
|
69 |
+
<label for="monitor_url" style="">Monitor URL <span class="required">*</span></label>
|
70 |
+
</td>
|
71 |
+
<td class="value">
|
72 |
+
<input id="monitor_url" name="monitor_url" value="<?php echo $this->getStoreUrl(); ?>" class="input-text" type="text">
|
73 |
+
</td>
|
74 |
+
</tr>
|
75 |
+
|
76 |
+
<tr>
|
77 |
+
<td colspan="2"><br /><strong>Creating a free AlertSite by SmartBear account indicates you accept <a href="http://www.alertsite.com/magento_extension_terms.shtml" target="_blank" >our user terms</a></strong><br /></td>
|
78 |
+
</tr>
|
79 |
+
|
80 |
+
<tr>
|
81 |
+
<td>
|
82 |
+
<br />
|
83 |
+
<button type="submit" class="button"><span>Create AlertSite Account</span></button>
|
84 |
+
</td>
|
85 |
+
</tr>
|
86 |
+
</table>
|
87 |
+
</form>
|
88 |
+
</div>
|
89 |
+
</div>
|
90 |
+
</div>
|
app/design/adminhtml/default/default/template/alertsite/dashboard.phtml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php /** @var $this Smartbear_Alertsite_Block_Adminhtml_Dashboard */ ?>
|
2 |
+
</fieldset></div>
|
3 |
+
|
4 |
+
<div class="entry-edit">
|
5 |
+
<div class="entry-edit-head"><h4><img style="position:relative; top:3px;" class="smartbear-icon" src="<?php echo $this->getSkinUrl($this->__('smartbear/alertsite/images/smartbear_15_icon.png')); ?>" alt="SmartBear" /> SmartBear AlertSite Status</h4></div>
|
6 |
+
<fieldset class="np">
|
7 |
+
<div class="alertsite-dashboard-box">
|
8 |
+
|
9 |
+
<?php if($this->getStatusCode() === "0"){ ?>
|
10 |
+
<img style="position:relative; top:3px;" class="smartbear-status-icon" src="<?php echo $this->getSkinUrl($this->__('smartbear/alertsite/images/smartbear_great.png')); ?>" alt="SmartBear" />
|
11 |
+
<?php }else if($this->getStatusCode() === "1" || $this->getStatusCode() === "2" || $this->getStatusCode() === "3" ||$this->getStatusCode() === "6"){ ?>
|
12 |
+
<img style="position:relative; top:3px;" class="smartbear-status-icon" src="<?php echo $this->getSkinUrl($this->__('smartbear/alertsite/images/smartbear_warning.png')); ?>" alt="SmartBear" />
|
13 |
+
<?php }else{ ?>
|
14 |
+
<img style="position:relative; top:3px;" class="smartbear-status-icon" src="<?php echo $this->getSkinUrl($this->__('smartbear/alertsite/images/smartbear_notice.png')); ?>" alt="SmartBear" />
|
15 |
+
<?php } ?>
|
16 |
+
|
17 |
+
<div class="alertsite-friendly-status">
|
18 |
+
<span class="device-description"><?php echo $this->getStatusDescription(); ?></span>
|
19 |
+
<h4>Status code:
|
20 |
+
<span style="font-size:120%;">
|
21 |
+
<?php echo $this->getStatusCode(); ?>
|
22 |
+
<?php if($this->getStatusCode() === NULL){ ?>
|
23 |
+
Unable to communicate with AlertSite. Please try again later or check the <a href="http://help.alertsite.com/MagentoHelp">help</a>.
|
24 |
+
<?php } ?>
|
25 |
+
</span>
|
26 |
+
</h4>
|
27 |
+
<p><?php echo $this->getFriendlyStatus(); ?></p>
|
28 |
+
<?php if($this->getStatusCode() !== NULL){ ?>
|
29 |
+
<em style="font-size:95%;"> (<?php echo $this->__('Last status change: '); ?><?php echo $this->getStatusTime(); ?>)</em>
|
30 |
+
<?php } ?>
|
31 |
+
<br />
|
32 |
+
</div>
|
33 |
+
<div class="clear"></div>
|
34 |
+
</div>
|
35 |
+
</fieldset>
|
36 |
+
</div>
|
app/design/adminhtml/default/default/template/alertsite/linkbutton.phtml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Smartbear_Alertsite
|
4 |
+
*/
|
5 |
+
/** @var $this Smartbear_Alertsite_Block_Adminhtml_System_Form_Renderer_LinkButton */
|
6 |
+
?>
|
7 |
+
<button style="" onclick="window.location='<?php echo Mage::getModel('adminhtml/url')->getUrl('*/alertsite/create'); ?>'; return false;" class="scalable add" type="button" id="<?php echo $this->getHtmlId() ?>">
|
8 |
+
<span><?php echo $this->escapeHtml($this->getButtonLabel()); ?></span>
|
9 |
+
</button>
|
10 |
+
</form>
|
app/design/adminhtml/default/default/template/alertsite/notifications.phtml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Signaturelink
|
4 |
+
* @package Smartbear_Alertsite
|
5 |
+
*/
|
6 |
+
?>
|
7 |
+
<?php if($this->isRequiredSettingsNotification()):?>
|
8 |
+
<div class="notification-global" id="notification">
|
9 |
+
<strong><?php echo $this->__('Thank you for installing the AlertSite Extension – Create your free AlertSite account <a href="%s">here</a>.', $this->getManageUrl());?></strong>
|
10 |
+
</div>
|
11 |
+
<?php endif;?>
|
app/etc/modules/Smartbear_Alertsite.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Smartbear_Alertsite>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Smartbear_Alertsite>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>smartbear_alertsite</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.alertsite.com/order_terms_agreement.shtml">Free</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>The AlertSite for Magento extension provides a free service to monitor store availability and performance from the end-user perspective.</summary>
|
10 |
+
<description>Delivering fast, feel-good customer experiences from your online store is critical to your success. The data overwhelmingly shows that if your site is unavailable or the functionality is slow or inconsistent, your users may go elsewhere. To ensure your website performs optimally, you need to see what your customers see.
|
11 |
+
The AlertSite for Magento extension offers Magento users a Free service to measure store availability and performance that's completely integrated into the Magento user interface.</description>
|
12 |
+
<notes>This is the initial release of AlertSite for Magento.</notes>
|
13 |
+
<authors><author><name>SmartBear Software</name><user>Kgodskind</user><email>magento-extension@SmartBear.com</email></author></authors>
|
14 |
+
<date>2013-02-01</date>
|
15 |
+
<time>21:57:18</time>
|
16 |
+
<contents><target name="magecommunity"><dir name="Smartbear"><dir name="Alertsite"><dir name="Block"><dir name="Adminhtml"><file name="Create.php" hash="b3436c12db0dcc9138a37ca0479ea622"/><file name="Dashboard.php" hash="1c95a6dabc323b54c0f41fe802818756"/><file name="Notifications.php" hash="e6ee80fb6a4d2d671774548ba31e557e"/><file name="Smartbear.php" hash="4f294b360278d140b23c82050b1d964e"/><dir name="System"><dir name="Form"><dir name="Renderer"><file name="ConfigMessage.php" hash="df00daab83b9178424c704b9c6e5ce2f"/><file name="DeviceDescription.php" hash="906fcdda396b0a761aeb169498ef66c3"/><file name="Label.php" hash="184619f752eb3bf52d6da7af2e61dc02"/><file name="LinkButton.php" hash="9fd9bc004a0a5bb98f93ba3a96d296c9"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="89e3e48e7f2c5bbb974766eb9e7f9817"/></dir><dir name="Model"><file name="Alertsiteapi.php" hash="e859710006d5f0f0b19d10231d997fb7"/><file name="Observer.php" hash="1c0ec96e16ff718fd69a241abc8dcb20"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Editaccount.php" hash="33143529817d03942040bf4c67cd041a"/><file name="Editdevice.php" hash="df58feb985765b2c655573e07bd72e5f"/><file name="Enable.php" hash="3e7a720cf8700839fc9be8cbcac9e140"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AlertsiteController.php" hash="3bf0dd18200efb3df56a67debf9932e4"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="98cc9c3b6d0ed0822ad2f5e7355152aa"/><file name="config.xml" hash="394d1ce0f6cde2742217a461efd825d4"/><file name="system.xml" hash="646d3eed844caad3c297579b45cd0ee6"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="alertsite.xml" hash="3380f9beea504676bd368d1db513142d"/></dir><dir name="template"><dir name="alertsite"><file name="create.phtml" hash="6dda7689159922a06bd186effd6ee4c7"/><file name="dashboard.phtml" hash="4c9f11365a14c17c028c3f8e04426a9f"/><file name="linkbutton.phtml" hash="dfab7081f8110fd760914f5b44e80f85"/><file name="notifications.phtml" hash="3de0d42fac7f00f3cf3f6545da6271d7"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Smartbear_Alertsite.xml" hash="64a3cc66ca83c2f77239814fee24b53f"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="smartbear"><dir name="alertsite"><dir name="css"><file name="alertsite.css" hash="965c443f3d52c41c28a57cde992b92f8"/></dir><dir name="images"><file name="smartbear_15_icon.png" hash="9aa725351c49766f194f5727c924e62a"/><file name="smartbear_20_icon.gif" hash="221347ce1d17b26af00b8f73c6f853b1"/><file name="smartbear_error.png" hash="fb6f697ff3c3bec25b2ac8696a7dcbfd"/><file name="smartbear_great.png" hash="1e4330c182c17b937dcdd244b2c8043b"/><file name="smartbear_info.png" hash="a267bcdeb04b0e4d9e1b9cb621060f07"/><file name="smartbear_notice.png" hash="deec6c7c7c72442526f25e50b7996732"/><file name="smartbear_warning.png" hash="d59c3691206e009d4fbb49aee38a29da"/></dir></dir></dir></dir></dir></dir></target></contents>
|
17 |
+
<compatible/>
|
18 |
+
<dependencies><required><php><min>5.3.6</min><max>5.4.11</max></php><extension><name>curl</name><min>7.21.3</min><max></max></extension><extension><name>SimpleXML</name><min></min><max></max></extension></required></dependencies>
|
19 |
+
</package>
|
skin/adminhtml/default/default/smartbear/alertsite/css/alertsite.css
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
.alertsite-dashboard-box{
|
3 |
+
width:100%;
|
4 |
+
padding:20px 30px 30px 30px;
|
5 |
+
}
|
6 |
+
|
7 |
+
.alertsite-dashboard-box .device-description{
|
8 |
+
font-weight:bold;
|
9 |
+
display:block;
|
10 |
+
font-size:130%;
|
11 |
+
}
|
12 |
+
|
13 |
+
.alertsite-dashboard-box h4{
|
14 |
+
margin-bottom:0;
|
15 |
+
}
|
16 |
+
|
17 |
+
.alertsite-dashboard-box .smartbear-status-icon{
|
18 |
+
float:left;
|
19 |
+
}
|
20 |
+
|
21 |
+
.alertsite-friendly-status{
|
22 |
+
width:60%;
|
23 |
+
float:left;
|
24 |
+
margin-left:20px;
|
25 |
+
}
|
skin/adminhtml/default/default/smartbear/alertsite/images/smartbear_15_icon.png
ADDED
Binary file
|
skin/adminhtml/default/default/smartbear/alertsite/images/smartbear_20_icon.gif
ADDED
Binary file
|
skin/adminhtml/default/default/smartbear/alertsite/images/smartbear_error.png
ADDED
Binary file
|
skin/adminhtml/default/default/smartbear/alertsite/images/smartbear_great.png
ADDED
Binary file
|
skin/adminhtml/default/default/smartbear/alertsite/images/smartbear_info.png
ADDED
Binary file
|
skin/adminhtml/default/default/smartbear/alertsite/images/smartbear_notice.png
ADDED
Binary file
|
skin/adminhtml/default/default/smartbear/alertsite/images/smartbear_warning.png
ADDED
Binary file
|