Version Notes
Initial release.
Download this release
Release Info
Developer | cloud.IQ |
Extension | Cloudiq_Core |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Cloudiq/Core/Block/Adminhtml/Config/Edit.php +15 -0
- app/code/community/Cloudiq/Core/Block/Adminhtml/Config/Edit/Form.php +12 -0
- app/code/community/Cloudiq/Core/Block/Adminhtml/Config/Edit/Tab/Frame.php +43 -0
- app/code/community/Cloudiq/Core/Block/Adminhtml/Config/Edit/Tab/Global.php +87 -0
- app/code/community/Cloudiq/Core/Block/Adminhtml/Config/Edit/Tabs.php +20 -0
- app/code/community/Cloudiq/Core/Helper/Config.php +63 -0
- app/code/community/Cloudiq/Core/Helper/Data.php +5 -0
- app/code/community/Cloudiq/Core/Model/Api/Abstract.php +10 -0
- app/code/community/Cloudiq/Core/Model/Api/Core.php +67 -0
- app/code/community/Cloudiq/Core/Model/Api/Request.php +109 -0
- app/code/community/Cloudiq/Core/Model/Api/Response.php +168 -0
- app/code/community/Cloudiq/Core/Test/Config/Base.php +26 -0
- app/code/community/Cloudiq/Core/Test/Model/Api/Response.php +55 -0
- app/code/community/Cloudiq/Core/Test/Model/Api/TestCase.php +47 -0
- app/code/community/Cloudiq/Core/Test/Model/Api/data/Response/testWasSuccessfulBadResponseAttribute.txt +15 -0
- app/code/community/Cloudiq/Core/Test/Model/Api/data/Response/testWasSuccessfulStatusCodeAndResponseAttribute.txt +16 -0
- app/code/community/Cloudiq/Core/controllers/Adminhtml/CloudiqController.php +93 -0
- app/code/community/Cloudiq/Core/etc/adminhtml.xml +31 -0
- app/code/community/Cloudiq/Core/etc/config.xml +70 -0
- app/design/adminhtml/default/default/layout/cloudiq/core.xml +50 -0
- app/design/adminhtml/default/default/template/cloudiq/core/tab/frame/iframe.phtml +11 -0
- app/design/adminhtml/default/default/template/cloudiq/core/tab/frame/submitter.phtml +11 -0
- app/design/adminhtml/default/default/template/cloudiq/core/tab/global.phtml +15 -0
- app/design/adminhtml/default/default/template/cloudiq/core/tabs.phtml +39 -0
- app/etc/modules/Cloudiq_Core.xml +9 -0
- package.xml +20 -0
- skin/adminhtml/default/default/cloudiq/core.css +41 -0
app/code/community/Cloudiq/Core/Block/Adminhtml/Config/Edit.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Cloudiq_Core_Block_Adminhtml_Config_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
|
3 |
+
public function __construct() {
|
4 |
+
parent::__construct();
|
5 |
+
|
6 |
+
$this->_blockGroup = 'cloudiq_core';
|
7 |
+
$this->_controller = 'adminhtml_config';
|
8 |
+
$this->_mode = 'edit';
|
9 |
+
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getHeaderText() {
|
13 |
+
return $this->__('cloud.IQ Settings');
|
14 |
+
}
|
15 |
+
}
|
app/code/community/Cloudiq/Core/Block/Adminhtml/Config/Edit/Form.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Cloudiq_Core_Block_Adminhtml_Config_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
|
3 |
+
|
4 |
+
public function _prepareForm() {
|
5 |
+
$url = Mage::helper('adminhtml')->getUrl('*/*/save');
|
6 |
+
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $url, 'method' => 'post'));
|
7 |
+
$form->setUseContainer(true);
|
8 |
+
$this->setForm($form);
|
9 |
+
return parent::_prepareForm();
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
app/code/community/Cloudiq/Core/Block/Adminhtml/Config/Edit/Tab/Frame.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Cloudiq_Core_Block_Adminhtml_Config_Edit_Tab_Frame extends Mage_Adminhtml_Block_Abstract implements Mage_Adminhtml_Block_Widget_Tab_Interface {
|
3 |
+
|
4 |
+
/** @var $_helper Cloudiq_Core_Helper_Config */
|
5 |
+
protected $_helper;
|
6 |
+
|
7 |
+
public function _construct() {
|
8 |
+
$this->_helper = Mage::helper("cloudiq_core/config");
|
9 |
+
|
10 |
+
$this->setTemplate("cloudiq/core/tab/frame/iframe.phtml");
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Return the URL to query for the iframe's content.
|
15 |
+
*
|
16 |
+
* @return string
|
17 |
+
*/
|
18 |
+
public function getSubmitterUrl() {
|
19 |
+
return $this->getUrl("adminhtml/cloudiq/frame", array(
|
20 |
+
"module" => $this->getModule()
|
21 |
+
));
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getTabLabel() {
|
25 |
+
return $this->__($this->getLabel());
|
26 |
+
}
|
27 |
+
|
28 |
+
public function getTabTitle() {
|
29 |
+
return $this->__($this->getLabel());
|
30 |
+
}
|
31 |
+
|
32 |
+
public function canShowTab() {
|
33 |
+
return $this->_helper->hasBeenSetUp();
|
34 |
+
}
|
35 |
+
|
36 |
+
public function isHidden() {
|
37 |
+
return !$this->_helper->hasBeenSetUp();
|
38 |
+
}
|
39 |
+
|
40 |
+
protected function getFrameId() {
|
41 |
+
return "cloudiq_frame_" . $this->getModule();
|
42 |
+
}
|
43 |
+
}
|
app/code/community/Cloudiq/Core/Block/Adminhtml/Config/Edit/Tab/Global.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Cloudiq_Core_Block_Adminhtml_Config_Edit_Tab_Global extends Mage_Adminhtml_Block_Widget_Form implements Mage_Adminhtml_Block_Widget_Tab_Interface {
|
3 |
+
/** @var $_helper Cloudiq_Core_Helper_Data */
|
4 |
+
protected $_helper;
|
5 |
+
/** @var $_config_helper Cloudiq_Core_Helper_Config */
|
6 |
+
protected $_config_helper;
|
7 |
+
|
8 |
+
public function __construct() {
|
9 |
+
parent::__construct();
|
10 |
+
|
11 |
+
$this->_helper = Mage::helper('cloudiq_core');
|
12 |
+
$this->_config_helper = Mage::helper('cloudiq_core/config');
|
13 |
+
|
14 |
+
$this->setTemplate('cloudiq/core/tab/global.phtml');
|
15 |
+
}
|
16 |
+
|
17 |
+
protected function _prepareForm() {
|
18 |
+
$form = new Varien_Data_Form();
|
19 |
+
$fieldset = $form->addFieldset('settings', array('legend'=>$this->_helper->__('Global Settings')));
|
20 |
+
|
21 |
+
$fieldset->addField('global[enabled]', 'select', array(
|
22 |
+
'label' => $this->_helper->__('Enable Account?'),
|
23 |
+
'title' => $this->_helper->__('Enable Account?'),
|
24 |
+
'name' => 'global[enabled]',
|
25 |
+
'value' => $this->_config_helper->isEnabled(),
|
26 |
+
'values' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray()
|
27 |
+
));
|
28 |
+
|
29 |
+
$fieldset->addField('global[account_id]', 'text', array(
|
30 |
+
'label' => $this->_helper->__('cloud.IQ Account ID'),
|
31 |
+
'title' => $this->_helper->__('cloud.IQ Account ID'),
|
32 |
+
'name' => 'global[account_id]',
|
33 |
+
'note' => "Cut and paste this from the cloud.IQ confirmation message.",
|
34 |
+
'value' => $this->_config_helper->getAccountId(),
|
35 |
+
'required' => true
|
36 |
+
));
|
37 |
+
|
38 |
+
$fieldset->addField('global[token]', 'text', array(
|
39 |
+
'label' => $this->_helper->__('cloud.IQ Token'),
|
40 |
+
'title' => $this->_helper->__('cloud.IQ Token'),
|
41 |
+
'name' => 'global[token]',
|
42 |
+
'note' => "Cut and paste this from the cloud.IQ confirmation message.",
|
43 |
+
'value' => $this->_config_helper->getToken(),
|
44 |
+
'required' => true
|
45 |
+
));
|
46 |
+
|
47 |
+
$this->setForm($form);
|
48 |
+
}
|
49 |
+
|
50 |
+
public function getTabLabel() {
|
51 |
+
$label = $this->hasBeenSetUp() ? "Global Settings" : "cloud.IQ Sign up";
|
52 |
+
return $this->__($label);
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getTabTitle() {
|
56 |
+
$label = $this->hasBeenSetUp() ? "Global Settings" : "cloud.IQ Sign up";
|
57 |
+
return $this->__($label);
|
58 |
+
}
|
59 |
+
|
60 |
+
public function canShowTab() {
|
61 |
+
// Always show the Global settings tab
|
62 |
+
return true;
|
63 |
+
}
|
64 |
+
|
65 |
+
public function isHidden() {
|
66 |
+
// Always show the Global settings tab
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Check if the module has been setup with API access credentials.
|
72 |
+
*
|
73 |
+
* @return bool
|
74 |
+
*/
|
75 |
+
protected function hasBeenSetUp() {
|
76 |
+
return $this->_config_helper->hasBeenSetUp();
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Return the URL used for the Setup iFrame.
|
81 |
+
*
|
82 |
+
* @return string
|
83 |
+
*/
|
84 |
+
protected function getSetupUrl() {
|
85 |
+
return $this->getUrl("adminhtml/cloudiq/frame", array("module" => "signUp", "profile_id" => Cloudiq_Core_Helper_Config::CLOUDIQ_IFRAME_PROFILE_ID));
|
86 |
+
}
|
87 |
+
}
|
app/code/community/Cloudiq/Core/Block/Adminhtml/Config/Edit/Tabs.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Cloudiq_Core_Block_Adminhtml_Config_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
|
3 |
+
|
4 |
+
protected $_config_helper;
|
5 |
+
|
6 |
+
public function __construct() {
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('cloudiq_config_edit_tabs');
|
9 |
+
$this->setDestElementId('edit_form');
|
10 |
+
$this->setTitle(Mage::helper('adminhtml')->__('cloud.IQ Configuration'));
|
11 |
+
$this->_config_helper = Mage::helper('cloudiq_core/config');
|
12 |
+
$this->setTemplate('cloudiq/core/tabs.phtml');
|
13 |
+
}
|
14 |
+
|
15 |
+
protected function _beforeToHtml() {
|
16 |
+
// Open the Global Settings form tab by default
|
17 |
+
$this->setActiveTab("global_section");
|
18 |
+
return parent::_beforeToHtml();
|
19 |
+
}
|
20 |
+
}
|
app/code/community/Cloudiq/Core/Helper/Config.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Cloudiq_Core_Helper_Config extends Mage_Core_Helper_Abstract {
|
3 |
+
|
4 |
+
const CLOUDIQ_BASE_URL = "https://platform.cloud-iq.com/";
|
5 |
+
|
6 |
+
/**
|
7 |
+
* cloud.IQ use a profile_id GET parameter to tell their web app to support loading in an iframe.
|
8 |
+
*/
|
9 |
+
const CLOUDIQ_IFRAME_PROFILE_ID = 2;
|
10 |
+
|
11 |
+
public function hasBeenSetUp() {
|
12 |
+
return $this->getToken() != "";
|
13 |
+
}
|
14 |
+
|
15 |
+
public function getAccountId() {
|
16 |
+
return Mage::getStoreConfig('cloudiq_core/global/account_id');
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getToken() {
|
20 |
+
return Mage::getStoreConfig('cloudiq_core/global/token');
|
21 |
+
}
|
22 |
+
|
23 |
+
public function isEnabled() {
|
24 |
+
return Mage::getStoreConfig('cloudiq_core/global/enabled');
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Return a URL for the cloud.IQ service.
|
29 |
+
*
|
30 |
+
* @param $module
|
31 |
+
*
|
32 |
+
* @return string
|
33 |
+
*/
|
34 |
+
public function getCloudiqUrl($module, $profile_id = false) {
|
35 |
+
$url = self::CLOUDIQ_BASE_URL;
|
36 |
+
|
37 |
+
$parameters = array();
|
38 |
+
|
39 |
+
if ($module != "") {
|
40 |
+
$parameters[] = "module=" . $module;
|
41 |
+
}
|
42 |
+
|
43 |
+
if ($profile_id) {
|
44 |
+
$parameters[] = "profileId=" . $profile_id;
|
45 |
+
}
|
46 |
+
|
47 |
+
$parameters = implode("&", $parameters);
|
48 |
+
if ($parameters != "") {
|
49 |
+
$url .= "?" . $parameters;
|
50 |
+
}
|
51 |
+
|
52 |
+
return $url;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Return the URL for cloud.IQ API calls.
|
57 |
+
*
|
58 |
+
* @return string
|
59 |
+
*/
|
60 |
+
public function getCloudiqApiUrl() {
|
61 |
+
return self::CLOUDIQ_BASE_URL . "gateway";
|
62 |
+
}
|
63 |
+
}
|
app/code/community/Cloudiq/Core/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Cloudiq_Core_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
+
|
5 |
+
}
|
app/code/community/Cloudiq/Core/Model/Api/Abstract.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Cloudiq_Core_Model_Api_Abstract extends Varien_Object {
|
3 |
+
/**
|
4 |
+
* @return Cloudiq_Core_Model_Api_Request
|
5 |
+
*/
|
6 |
+
protected function _getRequestObject() {
|
7 |
+
return Mage::getModel('cloudiq_core/api_request');
|
8 |
+
}
|
9 |
+
}
|
10 |
+
|
app/code/community/Cloudiq/Core/Model/Api/Core.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Cloudiq_Core_Model_Api_Core extends Cloudiq_Core_Model_Api_Abstract {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Request account information from the cloud.IQ API for either the
|
7 |
+
* account provided or the account stored in the configuration (if none
|
8 |
+
* is provided). Returns an array with two elements:
|
9 |
+
* status - boolean flag, true if the request was successful, false otherwise
|
10 |
+
* content - the account information XML element, if the request was successful
|
11 |
+
* or the error message if it failed
|
12 |
+
*
|
13 |
+
* @param $account_id Account ID to lookup instead of the configured one.
|
14 |
+
* @param $token Account token to use instead of the configured one.
|
15 |
+
*
|
16 |
+
* @return array
|
17 |
+
*/
|
18 |
+
public function lookupAccount($account_id = NULL, $token = NULL) {
|
19 |
+
$parameters = array(
|
20 |
+
"mode" => "lookup",
|
21 |
+
"action" => "account"
|
22 |
+
);
|
23 |
+
|
24 |
+
if ($account_id != NULL && $token != NULL) {
|
25 |
+
// Lookup the account provided instead of the one saved
|
26 |
+
$parameters["id"] = $account_id;
|
27 |
+
$parameters["token"] = $token;
|
28 |
+
}
|
29 |
+
|
30 |
+
/** @var Cloudiq_Core_Model_Api_Request $request */
|
31 |
+
$request = $this->_getRequestObject()->setParameters($parameters);
|
32 |
+
$response = $request->send(Zend_Http_Client::GET);
|
33 |
+
|
34 |
+
$result = array(
|
35 |
+
"status" => false,
|
36 |
+
"content" => ""
|
37 |
+
);
|
38 |
+
|
39 |
+
if ($response) {
|
40 |
+
if ($response->wasSuccessful()) {
|
41 |
+
$account_response = $response->getResponse()->account;
|
42 |
+
|
43 |
+
if (!is_null($account_response)) {
|
44 |
+
if ($account_response["status"] == Cloudiq_Core_Model_Api_Response::STATUS_SUCCESS) {
|
45 |
+
$result["status"] = true;
|
46 |
+
$result["content"] = $account_response;
|
47 |
+
} else {
|
48 |
+
// Unsuccessful account response
|
49 |
+
$result["content"] = $response->getApiStatusCodeDescription($account_id["status"]);
|
50 |
+
if ($account_response->description) {
|
51 |
+
$result["content"] .= sprintf(": %s", $account_response->description);
|
52 |
+
}
|
53 |
+
}
|
54 |
+
} else {
|
55 |
+
$result["content"] = "Unknown API response status";
|
56 |
+
}
|
57 |
+
} else {
|
58 |
+
// Unsuccessful response
|
59 |
+
$result["content"] = $response->getErrorMessage();
|
60 |
+
}
|
61 |
+
} else {
|
62 |
+
$result["content"] = "Failed to connect to cloud.IQ API";
|
63 |
+
}
|
64 |
+
|
65 |
+
return $result;
|
66 |
+
}
|
67 |
+
}
|
app/code/community/Cloudiq/Core/Model/Api/Request.php
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @method setParameters(array $parameters)
|
4 |
+
* @method getParameters()
|
5 |
+
*/
|
6 |
+
class Cloudiq_Core_Model_Api_Request extends Varien_Object {
|
7 |
+
|
8 |
+
const LOG_LOCATION = "cloudiq_api.log";
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @param $method HTTP verb to use when making the request, e.g. GET, POST, DELETE, PUT.
|
12 |
+
*
|
13 |
+
* @throws Zend_Http_Exception
|
14 |
+
*
|
15 |
+
* @return Cloudiq_Core_Model_Api_Response
|
16 |
+
*/
|
17 |
+
public function send($method) {
|
18 |
+
$_config_helper = Mage::helper("cloudiq_core/config");
|
19 |
+
|
20 |
+
$parameters = $this->getParameters();
|
21 |
+
$get_params = array();
|
22 |
+
$post_params = array();
|
23 |
+
|
24 |
+
if (!isset($parameters["token"])) {
|
25 |
+
// Authenticate through GET parameters
|
26 |
+
$get_params["id"] = $_config_helper->getAccountId();
|
27 |
+
$get_params["token"] = $_config_helper->getToken();
|
28 |
+
}
|
29 |
+
|
30 |
+
if ($method == Zend_Http_Client::GET) {
|
31 |
+
$get_params = array_merge($get_params, $parameters);
|
32 |
+
} else {
|
33 |
+
$post_params = array_merge($post_params, $parameters);
|
34 |
+
}
|
35 |
+
|
36 |
+
$client = new Zend_Http_Client();
|
37 |
+
$client
|
38 |
+
->setUri($this->getEndpoint())
|
39 |
+
->setParameterGet($get_params)
|
40 |
+
->setParameterPost($post_params)
|
41 |
+
->setMethod($method);
|
42 |
+
|
43 |
+
try {
|
44 |
+
/** @var $request_result Zend_Http_Response */
|
45 |
+
$request_result = $client->request();
|
46 |
+
} catch (Zend_Http_Client_Exception $e) {
|
47 |
+
$this->_log(Zend_Log::ERR, $e->getMessage(), $this->getEndpoint(), $method, $get_params, $post_params);
|
48 |
+
return null;
|
49 |
+
}
|
50 |
+
|
51 |
+
/** @var $response Cloudiq_Core_Model_Api_Response */
|
52 |
+
$response = Mage::getModel('cloudiq_core/api_response');
|
53 |
+
$response->populate($request_result);
|
54 |
+
|
55 |
+
$this->_log(Zend_Log::DEBUG, "Success", $this->getEndpoint(), $method, $get_params, $post_params, $response);
|
56 |
+
|
57 |
+
return $response;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Return the URI to make API calls against.
|
62 |
+
*
|
63 |
+
* @return string
|
64 |
+
*/
|
65 |
+
public function getEndpoint() {
|
66 |
+
return Mage::helper("cloudiq_core/config")->getCloudiqApiUrl();
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Print the API request details to a log file.
|
71 |
+
*
|
72 |
+
* @param $level
|
73 |
+
* @param $status
|
74 |
+
* @param $url
|
75 |
+
* @param $method
|
76 |
+
* @param array $get_params
|
77 |
+
* @param array $post_params
|
78 |
+
* @param Cloudiq_Core_Model_Api_Response $response
|
79 |
+
*/
|
80 |
+
protected function _log($level, $status, $url, $method, $get_params = array(), $post_params = array(), $response = NULL) {
|
81 |
+
$message = sprintf("%s\nMethod: %s\nEndpoint: %s\n", $status, $method, $url);
|
82 |
+
|
83 |
+
if (!empty($get_params)) {
|
84 |
+
array_walk($get_params, function (&$v, $k) { $v = sprintf("%s = %s", $k, $v); });
|
85 |
+
$message .= sprintf("GET Parameters:\n\t%s\n", implode("\n\t", $get_params));
|
86 |
+
}
|
87 |
+
|
88 |
+
if (!empty($post_params)) {
|
89 |
+
array_walk($post_params, function (&$v, $k) { $v = sprintf("%s = %s", $k, $v); });
|
90 |
+
$message .= sprintf("POST Parameters:\n\t%s\n", implode("\n\t", $post_params));
|
91 |
+
}
|
92 |
+
|
93 |
+
if (!is_null($response)) {
|
94 |
+
$message .= sprintf("Response status: %s\n", ($response->wasSuccessful() ? "Successful" : "Failed"));
|
95 |
+
if (!$response->wasSuccessful()) {
|
96 |
+
$message .= sprintf("Response error: %s\n", $response->getErrorMessage());
|
97 |
+
}
|
98 |
+
$raw_response = $response->getRawResponse();
|
99 |
+
if ($raw_response) {
|
100 |
+
$message .= sprintf("Raw response:\n\t%s\n\t%s\n",
|
101 |
+
$raw_response->getHeadersAsString(true, "\n\t"),
|
102 |
+
implode("\n\t", explode("\n", $raw_response->getBody()))
|
103 |
+
);
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
Mage::log($message, $level, self::LOG_LOCATION);
|
108 |
+
}
|
109 |
+
}
|
app/code/community/Cloudiq/Core/Model/Api/Response.php
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @method setRawResponse(Zend_Http_Response $raw_response)
|
4 |
+
* @method Zend_Http_Response getRawResponse()
|
5 |
+
* @method setHttpStatusCode(int $status_code)
|
6 |
+
* @method int getHttpStatusCode()
|
7 |
+
* @method setXmlParseErrors(array $errors)
|
8 |
+
* @method array getXmlParseErrors()
|
9 |
+
* @method setResponse(SimpleXMLElement $data)
|
10 |
+
* @method SimpleXMLElement getResponse()
|
11 |
+
* @method bool hasResponse()
|
12 |
+
*/
|
13 |
+
class Cloudiq_Core_Model_Api_Response extends Varien_Object {
|
14 |
+
|
15 |
+
const STATUS_SUCCESS = 1;
|
16 |
+
const STATUS_AUTHENTICATION_FAILURE = 101;
|
17 |
+
const STATUS_REQUESTING_IP_NOT_VALID = 102;
|
18 |
+
const STATUS_INVALID_FUNCTION_REQUEST = 103;
|
19 |
+
const STATUS_REQUEST_MISSING_A_MANDATORY_PARAMETER = 104;
|
20 |
+
const STATUS_FORMAT_ERROR_IN_REQUEST_PARAMETERS = 105;
|
21 |
+
const STATUS_REQUEST_NOT_VALID_FOR_GIVEN_ACCOUNT = 106;
|
22 |
+
const STATUS_INTERNAL_ERROR_WHILE_PROCESSING_YOUR_REQUEST = 107;
|
23 |
+
const STATUS_VALIDATION_FAILED = 200;
|
24 |
+
|
25 |
+
public static $status_code_descriptions = array(
|
26 |
+
self::STATUS_SUCCESS => "Success",
|
27 |
+
self::STATUS_AUTHENTICATION_FAILURE => "Authentication failure",
|
28 |
+
self::STATUS_REQUESTING_IP_NOT_VALID => "Requesting ip not valid",
|
29 |
+
self::STATUS_INVALID_FUNCTION_REQUEST => "Invalid function request",
|
30 |
+
self::STATUS_REQUEST_MISSING_A_MANDATORY_PARAMETER => "Request missing a mandatory parameter",
|
31 |
+
self::STATUS_FORMAT_ERROR_IN_REQUEST_PARAMETERS => "Format error in request parameters",
|
32 |
+
self::STATUS_REQUEST_NOT_VALID_FOR_GIVEN_ACCOUNT => "Request not valid for given account",
|
33 |
+
self::STATUS_INTERNAL_ERROR_WHILE_PROCESSING_YOUR_REQUEST => "Internal error while processing your request",
|
34 |
+
self::STATUS_VALIDATION_FAILED => "Validation failed"
|
35 |
+
);
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Populate the response data from the given Zend_Http_Response object.
|
39 |
+
*
|
40 |
+
* @param Zend_Http_Response $raw_response
|
41 |
+
*
|
42 |
+
* @return $this
|
43 |
+
*/
|
44 |
+
public function populate(Zend_Http_Response $raw_response) {
|
45 |
+
$this->setRawResponse($raw_response);
|
46 |
+
|
47 |
+
$this->setHttpStatusCode((int) $raw_response->getStatus());
|
48 |
+
|
49 |
+
// Handle libxml errors internally
|
50 |
+
$this->setXmlParseErrors(NULL);
|
51 |
+
$xml_errors_setting = libxml_use_internal_errors(true);
|
52 |
+
|
53 |
+
$decoded_data = simplexml_load_string(utf8_encode($raw_response->getBody()));
|
54 |
+
|
55 |
+
if ($decoded_data) {
|
56 |
+
$this->setResponse($decoded_data);
|
57 |
+
} else {
|
58 |
+
$xml_errors = array();
|
59 |
+
foreach (libxml_get_errors() as $error) {
|
60 |
+
$xml_errors[] = preg_replace("/\n/", " ", $error->message);
|
61 |
+
}
|
62 |
+
$this->setXmlParseErrors($xml_errors);
|
63 |
+
}
|
64 |
+
|
65 |
+
// Reset libxml error settings
|
66 |
+
libxml_clear_errors();
|
67 |
+
libxml_use_internal_errors($xml_errors_setting);
|
68 |
+
|
69 |
+
return $this;
|
70 |
+
}
|
71 |
+
|
72 |
+
public function getResponseXPath($xpath) {
|
73 |
+
if ($this->hasResponse()) {
|
74 |
+
return $this->getResponse()->xpath($xpath);
|
75 |
+
} else {
|
76 |
+
return NULL;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Get the API response status code. Return false if there
|
82 |
+
* is no status code.
|
83 |
+
*
|
84 |
+
* @return int
|
85 |
+
*/
|
86 |
+
public function getApiStatusCode() {
|
87 |
+
$status_attribute_xpath = $this->getResponseXPath('/response/@status[1]');
|
88 |
+
if (count($status_attribute_xpath) == 1) {
|
89 |
+
$status_attribute = (string) $status_attribute_xpath[0];
|
90 |
+
if (is_numeric($status_attribute)) {
|
91 |
+
return (int) $status_attribute;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
return false;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Return the description text for the given API response code. Returns
|
99 |
+
* "Unknown" for unknown codes.
|
100 |
+
*
|
101 |
+
* @param int $code API response code
|
102 |
+
*
|
103 |
+
* @return string
|
104 |
+
*/
|
105 |
+
public function getApiStatusCodeDescription($code) {
|
106 |
+
if (isset(self::$status_code_descriptions[$code])) {
|
107 |
+
return self::$status_code_descriptions[$code];
|
108 |
+
}
|
109 |
+
|
110 |
+
return "Unknown";
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Perform a check on the HTTP Status Code returned by the request and evaluate the status attribute of
|
115 |
+
* the wrapping <response> element for a valid status code.
|
116 |
+
*
|
117 |
+
* @return bool
|
118 |
+
*/
|
119 |
+
public function wasSuccessful() {
|
120 |
+
if ($this->getResponse()) {
|
121 |
+
$http_status_string = (string) $this->getHttpStatusCode();
|
122 |
+
|
123 |
+
if (substr($http_status_string, 0, 1) == "2") {
|
124 |
+
$api_status = $this->getApiStatusCode();
|
125 |
+
|
126 |
+
if ($api_status !== false) {
|
127 |
+
return $api_status == self::STATUS_SUCCESS;
|
128 |
+
}
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
return false;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Choose and return the appropriate text error message for this request.
|
137 |
+
* Returns false if the request was successful.
|
138 |
+
*
|
139 |
+
* @return bool|string
|
140 |
+
*/
|
141 |
+
public function getErrorMessage() {
|
142 |
+
$message = false;
|
143 |
+
|
144 |
+
if (!$this->wasSuccessful()) {
|
145 |
+
// Check for API status errors
|
146 |
+
$api_status_code = $this->getApiStatusCode();
|
147 |
+
if ($api_status_code !== false) {
|
148 |
+
$message = $this->getApiStatusCodeDescription($api_status_code);
|
149 |
+
} else {
|
150 |
+
// Check for response parse errors
|
151 |
+
$xml_parse_errors = $this->getXmlParseErrors();
|
152 |
+
if (!empty($xml_parse_errors)) {
|
153 |
+
$message = "Failed to parse the API response: " . implode(", ", $xml_parse_errors);
|
154 |
+
} else {
|
155 |
+
// Check for HTTP errors
|
156 |
+
$http_status_code = $this->getHttpStatusCode();
|
157 |
+
if (!is_null($http_status_code)) {
|
158 |
+
$message = "HTTP Error: " . Zend_Http_Response::responseCodeAsText($http_status_code);
|
159 |
+
} else {
|
160 |
+
$message = "Unknown error";
|
161 |
+
}
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
return $message;
|
167 |
+
}
|
168 |
+
}
|
app/code/community/Cloudiq/Core/Test/Config/Base.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Cloudiq_Core_Test_Config_Base extends EcomDev_PHPUnit_Test_Case_Config {
|
3 |
+
/**
|
4 |
+
* @test
|
5 |
+
*/
|
6 |
+
public function testBasicConfiguration() {
|
7 |
+
$this->assertModuleCodePool('community');
|
8 |
+
$this->assertModuleVersion('1.0.0');
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @test
|
13 |
+
*/
|
14 |
+
public function testClassAliases() {
|
15 |
+
$this->assertHelperAlias('cloudiq_core', 'Cloudiq_Core_Helper_Data');
|
16 |
+
$this->assertModelAlias('cloudiq_core/test', 'Cloudiq_Core_Model_Test');
|
17 |
+
$this->assertBlockAlias('cloudiq_core/test', 'Cloudiq_Core_Block_Test');
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @test
|
22 |
+
*/
|
23 |
+
public function testDataHelperExists() {
|
24 |
+
$this->assertInstanceOf('Cloudiq_Core_Helper_Data', Mage::helper('cloudiq_core'));
|
25 |
+
}
|
26 |
+
}
|
app/code/community/Cloudiq/Core/Test/Model/Api/Response.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Cloudiq_Core_Test_Model_Api_Response extends Cloudiq_Core_Test_Model_Api_TestCase {
|
4 |
+
|
5 |
+
/** @var Cloudiq_Core_Model_Api_Response */
|
6 |
+
protected $_model;
|
7 |
+
|
8 |
+
protected function setUp() {
|
9 |
+
parent::setUp();
|
10 |
+
|
11 |
+
$this->_model = Mage::getModel('cloudiq_core/api_response');
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function tearDown() {
|
15 |
+
parent::tearDown();
|
16 |
+
|
17 |
+
$this->_model = null;
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @test
|
22 |
+
*/
|
23 |
+
public function testClassConstruction() {
|
24 |
+
$this->assertInstanceOf('Cloudiq_Core_Model_Api_Response', $this->_model);
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @test
|
29 |
+
*/
|
30 |
+
public function testWasSuccessfulNoRequest() {
|
31 |
+
$this->assertFalse($this->_model->wasSuccessful());
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @test
|
36 |
+
*/
|
37 |
+
public function testWasSuccessfulStatusCodeAndResponseAttribute() {
|
38 |
+
$successful_response = Zend_Http_Response::fromString($this->_loadFileContents('Response/testWasSuccessfulStatusCodeAndResponseAttribute.txt'));
|
39 |
+
|
40 |
+
$this->_model->populate($successful_response);
|
41 |
+
|
42 |
+
$this->assertTrue($this->_model->wasSuccessful());
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @test
|
47 |
+
*/
|
48 |
+
public function testWasSuccessfulBadResponseAttribute() {
|
49 |
+
$bad_response = Zend_Http_Response::fromString($this->_loadFileContents('Response/testWasSuccessfulBadResponseAttribute.txt'));
|
50 |
+
|
51 |
+
$this->_model->populate($bad_response);
|
52 |
+
|
53 |
+
$this->assertFalse($this->_model->wasSuccessful());
|
54 |
+
}
|
55 |
+
}
|
app/code/community/Cloudiq/Core/Test/Model/Api/TestCase.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
abstract class Cloudiq_Core_Test_Model_Api_TestCase extends EcomDev_PHPUnit_Test_Case {
|
3 |
+
/**
|
4 |
+
* @param string $http_method
|
5 |
+
* @param int $status_code
|
6 |
+
* @param string $response_filename
|
7 |
+
*
|
8 |
+
* @return PHPUnit_Framework_MockObject_MockObject
|
9 |
+
*/
|
10 |
+
public function getRequestMock($http_method, $status_code, $response_filename) {
|
11 |
+
$file_contents = $this->_loadFileContents($response_filename);
|
12 |
+
|
13 |
+
$this->assertNotNull($file_contents);
|
14 |
+
$this->assertNotEmpty($file_contents);
|
15 |
+
|
16 |
+
/** @var $response Cloudiq_Core_Model_Api_Response */
|
17 |
+
$response = Mage::getModel('cloudiq_core/api_response');
|
18 |
+
$response
|
19 |
+
->setStatusCode($status_code)
|
20 |
+
->setRawResponse($file_contents);
|
21 |
+
|
22 |
+
$request_mock = $this->getModelMock('cloudiq_core/api_request', array('send'));
|
23 |
+
|
24 |
+
$request_mock
|
25 |
+
->expects($this->once())
|
26 |
+
->method('send')
|
27 |
+
->with($this->equalTo($http_method))
|
28 |
+
->will($this->returnValue($response));
|
29 |
+
|
30 |
+
return $request_mock;
|
31 |
+
}
|
32 |
+
|
33 |
+
protected function _loadFileContents($file) {
|
34 |
+
$directory_tree = array(
|
35 |
+
Mage::getModuleDir('', 'Cloudiq_Core'),
|
36 |
+
'Test',
|
37 |
+
'Model',
|
38 |
+
'Api',
|
39 |
+
'data',
|
40 |
+
$file
|
41 |
+
);
|
42 |
+
|
43 |
+
$file_path = join(DS, $directory_tree);
|
44 |
+
|
45 |
+
return file_get_contents($file_path);
|
46 |
+
}
|
47 |
+
}
|
app/code/community/Cloudiq/Core/Test/Model/Api/data/Response/testWasSuccessfulBadResponseAttribute.txt
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
HTTP/1.1 403 Forbidden
|
2 |
+
Date: Tue, 18 Jun 2013 11:46:25 GMT
|
3 |
+
Server: Apache-Coyote/1.1
|
4 |
+
X-powered-by: Servlet 2.4; JBoss-4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)/Tomcat-5.5
|
5 |
+
Content-type: text/xml;charset=ISO-8859-1
|
6 |
+
Content-length: 201
|
7 |
+
Via: 1.1 nimbus.cloud-iq.com
|
8 |
+
Connection: close
|
9 |
+
|
10 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
11 |
+
<response status="101">
|
12 |
+
<description>Authentication failure</description>
|
13 |
+
<requestId>273025</requestId>
|
14 |
+
<dateTime>2013-06-18T11:46:25Z</dateTime>
|
15 |
+
</response>
|
app/code/community/Cloudiq/Core/Test/Model/Api/data/Response/testWasSuccessfulStatusCodeAndResponseAttribute.txt
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
HTTP/1.1 202 Accepted
|
2 |
+
Date: Tue, 18 Jun 2013 11:30:50 GMT
|
3 |
+
Server: Apache-Coyote/1.1
|
4 |
+
X-powered-by: Servlet 2.4; JBoss-4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)/Tomcat-5.5
|
5 |
+
Content-type: text/html;charset=ISO-8859-1
|
6 |
+
Content-length: 914
|
7 |
+
Via: 1.1 nimbus.cloud-iq.com
|
8 |
+
Connection: close
|
9 |
+
|
10 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
11 |
+
<response status="1">
|
12 |
+
<description>Success</description>
|
13 |
+
<requestId>273005</requestId>
|
14 |
+
<dateTime>2013-06-18T11:30:50Z</dateTime>
|
15 |
+
<timeZone>GMT</timeZone>
|
16 |
+
</response>
|
app/code/community/Cloudiq/Core/controllers/Adminhtml/CloudiqController.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Cloudiq_Core_Adminhtml_CloudiqController extends Mage_Adminhtml_Controller_Action {
|
3 |
+
public function editAction() {
|
4 |
+
$this->loadLayout();
|
5 |
+
$this->_setActiveMenu('cloudiq');
|
6 |
+
$this->renderLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function saveAction() {
|
10 |
+
Mage::dispatchEvent("cloudiq_core_config_save", array('request'=>$this->getRequest()));
|
11 |
+
|
12 |
+
$request = $this->getRequest();
|
13 |
+
$form_data = new Varien_Object($request->getParam("global"));
|
14 |
+
|
15 |
+
if (count($form_data->getData()) > 0) {
|
16 |
+
// Save global Cloud.IQ config data to system config
|
17 |
+
|
18 |
+
$account_id = trim($form_data->getData("account_id"));
|
19 |
+
$token = trim($form_data->getData("token"));
|
20 |
+
$enabled = ($form_data->getData("enabled")) ? 1 : 0;
|
21 |
+
|
22 |
+
// Validate the form fields
|
23 |
+
$validation_errors = 0;
|
24 |
+
|
25 |
+
if ($account_id == "") {
|
26 |
+
$validation_errors++;
|
27 |
+
Mage::getSingleton("adminhtml/session")->addError($this->__("cloud.IQ: Account ID can not be empty."));
|
28 |
+
}
|
29 |
+
|
30 |
+
if ($token == "") {
|
31 |
+
$validation_errors++;
|
32 |
+
Mage::getSingleton("adminhtml/session")->addError($this->__("cloud.IQ: Token can not be empty."));
|
33 |
+
}
|
34 |
+
|
35 |
+
if ($validation_errors == 0 && $enabled) {
|
36 |
+
// Check if the account is valid using the API
|
37 |
+
$result = Mage::getModel("cloudiq_core/api_core")->lookupAccount($account_id, $token);
|
38 |
+
if ($result["status"] !== true) {
|
39 |
+
$validation_errors++;
|
40 |
+
Mage::getSingleton("adminhtml/session")->addError(sprintf("%s: %s", $this->__("cloud.IQ: The account credentials provided could not be verified"), $this->__($result["content"])));
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
if ($validation_errors == 0) {
|
45 |
+
// Save configuration to system config
|
46 |
+
$_system_config = Mage::getConfig();
|
47 |
+
|
48 |
+
$_system_config->saveConfig("cloudiq_core/global/account_id", $account_id);
|
49 |
+
$_system_config->saveConfig("cloudiq_core/global/token", $token);
|
50 |
+
|
51 |
+
$_system_config->saveConfig("cloudiq_core/global/enabled", $enabled);
|
52 |
+
|
53 |
+
Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("cloudiq_core")->__("Global configuration saved."));
|
54 |
+
|
55 |
+
// Reload system config, so changes are picked up
|
56 |
+
$_system_config->reinit();
|
57 |
+
Mage::app()->reinitStores();
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
// Redirect back to the form, preserving any params (such as active tab)
|
62 |
+
$this->_redirect("*/*/edit", array("_current" => true));
|
63 |
+
}
|
64 |
+
|
65 |
+
public function frameAction() {
|
66 |
+
$_config_helper = Mage::helper("cloudiq_core/config");
|
67 |
+
|
68 |
+
$module = $this->getRequest()->getParam("module");
|
69 |
+
$profile_id = $this->getRequest()->getParam("profile_id");
|
70 |
+
|
71 |
+
$destination = $_config_helper->getCloudiqUrl($module, ($profile_id != null) ? $profile_id : null);
|
72 |
+
|
73 |
+
$additional_parameters = array();
|
74 |
+
|
75 |
+
// Pre-populate the sign up form with current user details
|
76 |
+
if ($module == "signUp") {
|
77 |
+
/** @var $user Mage_Admin_Model_User */
|
78 |
+
$user = Mage::getSingleton('admin/session')->getUser();
|
79 |
+
$additional_parameters["username"] = $user->getEmail();
|
80 |
+
$additional_parameters["fullName"] = $user->getName();
|
81 |
+
}
|
82 |
+
|
83 |
+
$this->getResponse()->setBody(
|
84 |
+
$this->getLayout()->createBlock("core/template", "")
|
85 |
+
->setTemplate("cloudiq/core/tab/frame/submitter.phtml")
|
86 |
+
->setDestination($destination)
|
87 |
+
->setAccountId($_config_helper->getAccountId())
|
88 |
+
->setToken($_config_helper->getToken())
|
89 |
+
->setAdditionalParameters($additional_parameters)
|
90 |
+
->toHtml()
|
91 |
+
);
|
92 |
+
}
|
93 |
+
}
|
app/code/community/Cloudiq/Core/etc/adminhtml.xml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<menu>
|
4 |
+
<cloudiq translate="title" module="cloudiq_core">
|
5 |
+
<title>cloud.IQ</title>
|
6 |
+
<sort_order>900</sort_order>
|
7 |
+
<action>adminhtml/cloudiq/edit</action>
|
8 |
+
</cloudiq>
|
9 |
+
</menu>
|
10 |
+
<acl>
|
11 |
+
<resources>
|
12 |
+
<admin>
|
13 |
+
<children>
|
14 |
+
<system>
|
15 |
+
<children>
|
16 |
+
<config>
|
17 |
+
<children>
|
18 |
+
<cloudiq_core translate="title">
|
19 |
+
<title>cloud.IQ Section</title>
|
20 |
+
<sort_order>60</sort_order>
|
21 |
+
</cloudiq_core>
|
22 |
+
</children>
|
23 |
+
</config>
|
24 |
+
</children>
|
25 |
+
</system>
|
26 |
+
</children>
|
27 |
+
</admin>
|
28 |
+
</resources>
|
29 |
+
</acl>
|
30 |
+
</config>
|
31 |
+
|
app/code/community/Cloudiq/Core/etc/config.xml
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
|
4 |
+
<modules>
|
5 |
+
<Cloudiq_Core>
|
6 |
+
<version>1.0.0</version>
|
7 |
+
</Cloudiq_Core>
|
8 |
+
</modules>
|
9 |
+
|
10 |
+
<global>
|
11 |
+
<blocks>
|
12 |
+
<cloudiq_core>
|
13 |
+
<class>Cloudiq_Core_Block</class>
|
14 |
+
</cloudiq_core>
|
15 |
+
</blocks>
|
16 |
+
<models>
|
17 |
+
<cloudiq_core>
|
18 |
+
<class>Cloudiq_Core_Model</class>
|
19 |
+
</cloudiq_core>
|
20 |
+
</models>
|
21 |
+
<helpers>
|
22 |
+
<cloudiq_core>
|
23 |
+
<class>Cloudiq_Core_Helper</class>
|
24 |
+
</cloudiq_core>
|
25 |
+
</helpers>
|
26 |
+
</global>
|
27 |
+
|
28 |
+
<frontend>
|
29 |
+
<routers>
|
30 |
+
<cloudiq>
|
31 |
+
<use>standard</use>
|
32 |
+
<args>
|
33 |
+
<frontName>cloudiq</frontName>
|
34 |
+
<module>Cloudiq_Core</module>
|
35 |
+
</args>
|
36 |
+
</cloudiq>
|
37 |
+
</routers>
|
38 |
+
</frontend>
|
39 |
+
|
40 |
+
<admin>
|
41 |
+
<routers>
|
42 |
+
<adminhtml>
|
43 |
+
<args>
|
44 |
+
<modules>
|
45 |
+
<cloudiq_core before="Mage_Adminhtml">Cloudiq_Core_Adminhtml</cloudiq_core>
|
46 |
+
</modules>
|
47 |
+
</args>
|
48 |
+
</adminhtml>
|
49 |
+
</routers>
|
50 |
+
</admin>
|
51 |
+
|
52 |
+
<adminhtml>
|
53 |
+
<layout>
|
54 |
+
<updates>
|
55 |
+
<cloudiq_core>
|
56 |
+
<file>cloudiq/core.xml</file>
|
57 |
+
</cloudiq_core>
|
58 |
+
</updates>
|
59 |
+
</layout>
|
60 |
+
</adminhtml>
|
61 |
+
|
62 |
+
<phpunit>
|
63 |
+
<suite>
|
64 |
+
<modules>
|
65 |
+
<Cloudiq_Core />
|
66 |
+
</modules>
|
67 |
+
</suite>
|
68 |
+
</phpunit>
|
69 |
+
|
70 |
+
</config>
|
app/design/adminhtml/default/default/layout/cloudiq/core.xml
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addCss"><stylesheet>cloudiq/core.css</stylesheet></action>
|
6 |
+
</reference>
|
7 |
+
</default>
|
8 |
+
<adminhtml_cloudiq_edit>
|
9 |
+
<reference name="content">
|
10 |
+
<block type="cloudiq_core/adminhtml_config_edit" name="cloudiq.config.edit"/>
|
11 |
+
</reference>
|
12 |
+
<reference name="left">
|
13 |
+
<block type="cloudiq_core/adminhtml_config_edit_tabs" name="cloudiq.config.edit.tabs">
|
14 |
+
<block type="cloudiq_core/adminhtml_config_edit_tab_global" name="cloudiq.config.edit.tab.global"/>
|
15 |
+
<action method="addTab">
|
16 |
+
<name>global_section</name>
|
17 |
+
<block>cloudiq.config.edit.tab.global</block>
|
18 |
+
</action>
|
19 |
+
<block type="cloudiq_core/adminhtml_config_edit_tab_frame" name="cloudiq.config.edit.tab.dashboard">
|
20 |
+
<action method="setLabel"><label>Dashboard</label></action>
|
21 |
+
<action method="setModule"><module>dashboard</module></action>
|
22 |
+
<action method="setTabName"><name>dashboard_section</name></action>
|
23 |
+
</block>
|
24 |
+
<action method="addTab">
|
25 |
+
<name>dashboard_section</name>
|
26 |
+
<block>cloudiq.config.edit.tab.dashboard</block>
|
27 |
+
</action>
|
28 |
+
<block type="cloudiq_core/adminhtml_config_edit_tab_frame" name="cloudiq.config.edit.tab.account">
|
29 |
+
<action method="setLabel"><label>Account</label></action>
|
30 |
+
<action method="setModule"><module>account</module></action>
|
31 |
+
<action method="setTabName"><name>account_section</name></action>
|
32 |
+
</block>
|
33 |
+
<action method="addTab">
|
34 |
+
<name>account_section</name>
|
35 |
+
<block>cloudiq.config.edit.tab.account</block>
|
36 |
+
</action>
|
37 |
+
<block type="cloudiq_core/adminhtml_config_edit_tab_frame" name="cloudiq.config.edit.tab.support">
|
38 |
+
<action method="setLabel"><label>Support</label></action>
|
39 |
+
<action method="setModule"><module>support</module></action>
|
40 |
+
<action method="setTabName"><name>support_section</name></action>
|
41 |
+
</block>
|
42 |
+
<action method="addTab">
|
43 |
+
<name>support_section</name>
|
44 |
+
<block>cloudiq.config.edit.tab.support</block>
|
45 |
+
</action>
|
46 |
+
</block>
|
47 |
+
</reference>
|
48 |
+
</adminhtml_cloudiq_edit>
|
49 |
+
</layout>
|
50 |
+
|
app/design/adminhtml/default/default/template/cloudiq/core/tab/frame/iframe.phtml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<iframe id="<?php echo $this->getFrameId(); ?>" src="<?php echo $this->getSubmitterUrl(); ?>" frameborder="0" width="100%" height="787px"></iframe>
|
2 |
+
<script type="text/javascript">
|
3 |
+
document.observe("dom:loaded", function () {
|
4 |
+
varienGlobalEvents.attachEventHandler("showTab", function (event) {
|
5 |
+
if (event.tab.name == "<?php echo $this->getTabName(); ?>") {
|
6 |
+
var frame = $('<?php echo $this->getFrameId(); ?>');
|
7 |
+
frame.src = frame.src; // Reload frame
|
8 |
+
}
|
9 |
+
});
|
10 |
+
});
|
11 |
+
</script>
|
app/design/adminhtml/default/default/template/cloudiq/core/tab/frame/submitter.phtml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<form action="<?php echo $this->getDestination(); ?>" method="POST">
|
2 |
+
<input type="hidden" name="id" value="<?php echo $this->getAccountId(); ?>" />
|
3 |
+
<input type="hidden" name="token" value="<?php echo $this->getToken() ?>" />
|
4 |
+
<?php $additional_parameters = $this->getAdditionalParameters(); ?>
|
5 |
+
<?php foreach ($additional_parameters as $name => $value): ?>
|
6 |
+
<input type="hidden" name="<?php echo $name; ?>" value="<?php echo $value; ?>" />
|
7 |
+
<?php endforeach; ?>
|
8 |
+
</form>
|
9 |
+
<script type="text/javascript">
|
10 |
+
document.forms[0].submit();
|
11 |
+
</script>
|
app/design/adminhtml/default/default/template/cloudiq/core/tab/global.phtml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Form template for the Global Settings tab of the configuration
|
4 |
+
* form for Cloudiq_Core module.
|
5 |
+
*
|
6 |
+
* Based on default/default/template/widget/form.phtml
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<div class="entry-edit">
|
10 |
+
<?php if (!$this->hasBeenSetUp()) : ?>
|
11 |
+
<iframe src="<?php echo $this->getSetupUrl() ?>" frameborder="0" width="100%" height="600"></iframe>
|
12 |
+
<?php endif; ?>
|
13 |
+
<?php echo $this->getFormHtml();?>
|
14 |
+
</div>
|
15 |
+
<?php echo $this->getChildHtml('form_after');?>
|
app/design/adminhtml/default/default/template/cloudiq/core/tabs.phtml
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if($this->getTitle()): ?>
|
2 |
+
<h3><?php echo $this->getTitle() ?></h3>
|
3 |
+
<?php endif ?>
|
4 |
+
<?php if(!empty($tabs)): ?>
|
5 |
+
<ul id="<?php echo $this->getId() ?>" class="tabs">
|
6 |
+
<?php foreach ($tabs as $_tab): ?>
|
7 |
+
<?php if (!$this->canShowTab($_tab)): continue; endif; ?>
|
8 |
+
<li <?php if($this->getTabIsHidden($_tab)): ?> style="display:none"<?php endif; ?>>
|
9 |
+
<a href="<?php echo $this->getTabUrl($_tab) ?>" id="<?php echo $this->getTabId($_tab) ?>" name="<?php echo $this->getTabId($_tab, false) ?>" title="<?php echo $this->getTabTitle($_tab) ?>" class="tab-item-link <?php echo $this->getTabClass($_tab) ?><?php if (preg_match('/\s?ajax\s?/', $_tab->getClass())) {?> notloaded<?php }?>">
|
10 |
+
<span><span class="changed" title="<?php echo $this->__('The information in this tab has been changed.') ?>"></span><span class="error" title="<?php echo $this->__('This tab contains invalid data. Please solve the problem before saving.') ?>"></span><?php echo $this->getTabLabel($_tab); ?></span>
|
11 |
+
</a>
|
12 |
+
<div id="<?php echo $this->getTabId($_tab) ?>_content" style="display:none;"><?php echo $this->getTabContent($_tab) ?></div>
|
13 |
+
</li>
|
14 |
+
<?php endforeach; ?>
|
15 |
+
</ul>
|
16 |
+
<script type="text/javascript">
|
17 |
+
<?php echo $this->getJsObjectName() ?> = new varienTabs('<?php echo $this->getId() ?>', '<?php echo $this->getDestElementId() ?>', '<?php echo $this->getActiveTabId() ?>', <?php echo $this->getAllShadowTabs()?>);
|
18 |
+
</script>
|
19 |
+
<script type="text/javascript">
|
20 |
+
document.observe("dom:loaded", function() {
|
21 |
+
var varien_tabs = <?php echo $this->getJsObjectName() ?>;
|
22 |
+
var original_url = $('edit_form').action;
|
23 |
+
|
24 |
+
$$('.form-buttons .save').each(function(element) {
|
25 |
+
element.onclick = function (e) {
|
26 |
+
var new_url = original_url;
|
27 |
+
if (original_url.substr(-1,1) != "/") {
|
28 |
+
new_url = new_url + "/";
|
29 |
+
}
|
30 |
+
new_url = new_url + "active_tab/" + varien_tabs.activeTab.name + "/";
|
31 |
+
|
32 |
+
$('edit_form').action = new_url;
|
33 |
+
|
34 |
+
editForm.submit();
|
35 |
+
}
|
36 |
+
});
|
37 |
+
});
|
38 |
+
</script>
|
39 |
+
<?php endif; ?>
|
app/etc/modules/Cloudiq_Core.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Cloudiq_Core>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Cloudiq_Core>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Cloudiq_Core</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.cloud-iq.com">Commercial License</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This extension provides a framework for other cloud.IQ extensions.</summary>
|
10 |
+
<description>This extension provides tools to communicate with the cloud.IQ platform and serves as a framework for other cloud.IQ modules, such as callMe and cartChecker.
|
11 |
+

|
12 |
+
It is usually installed automatically by other extensions as a dependency and should not need to be installed on its own.</description>
|
13 |
+
<notes>Initial release.</notes>
|
14 |
+
<authors><author><name>cloud.IQ</name><user>cloud_iq</user><email>sales@cloud-iq.com</email></author></authors>
|
15 |
+
<date>2013-09-04</date>
|
16 |
+
<time>13:01:46</time>
|
17 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Cloudiq_Core.xml" hash="cad973564b5dda06d3608f7e51d529e6"/></dir></target><target name="magecommunity"><dir name="Cloudiq"><dir name="Core"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Edit"><file name="Form.php" hash="adb6a7430c073ee2930b4d853fb4cfa3"/><dir name="Tab"><file name="Frame.php" hash="f95557ef75baf8aa41468bc7fb68a392"/><file name="Global.php" hash="3c99652197db041d5ef044abbdeeea9e"/></dir><file name="Tabs.php" hash="953109aea9e43c0dd960eb9f2aa041f6"/></dir><file name="Edit.php" hash="55f27f8954981871bd7e748f48f9e8c0"/></dir></dir></dir><dir name="Helper"><file name="Config.php" hash="4f7a9fc9fa6c444db5d0d72f51fa99b6"/><file name="Data.php" hash="528460cf7ec9f942f2f29f6dad1c52f1"/></dir><dir name="Model"><dir name="Api"><file name="Abstract.php" hash="a6df29a5d90cba70242cd36bd0689cd3"/><file name="Core.php" hash="41d56d74e1f0055a7d482c279dddf356"/><file name="Request.php" hash="43bd7500c74d97eac224c23518e3824b"/><file name="Response.php" hash="79e28972107425f31dbf6cc8d7210c86"/></dir></dir><dir name="Test"><dir name="Config"><file name="Base.php" hash="f2e2ca2e59d14048bf46b8c208787793"/></dir><dir name="Model"><dir name="Api"><file name="Response.php" hash="e9d5051331fabfcbe487778ae2c47cc3"/><file name="TestCase.php" hash="2d5114ea542aba75f666b6254390a5d6"/><dir name="data"><dir name="Response"><file name="testWasSuccessfulBadResponseAttribute.txt" hash="7edb6a3d909e8bfb7f04a3450b0fc1c8"/><file name="testWasSuccessfulStatusCodeAndResponseAttribute.txt" hash="14b598d1a6abd984d00cb76fa5351b81"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CloudiqController.php" hash="4cdb6fc9daf31260c6e020496f7ba557"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8ee43c9b6d84378c552987e7e980a50d"/><file name="config.xml" hash="d53122159940a78b5f8352355c9f0f99"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="cloudiq"><file name="core.xml" hash="f5fe732a5efecaffea2a1ad98f595a6d"/></dir></dir><dir name="template"><dir name="cloudiq"><dir name="core"><dir name="tab"><dir name="frame"><file name="iframe.phtml" hash="70e60d46b58138986b555b96c9f87dc5"/><file name="submitter.phtml" hash="d0c0dcb6206dd9298630dc564016e24f"/></dir><file name="global.phtml" hash="d91ea0fc9b1b2d48068732a3f203610c"/></dir><file name="tabs.phtml" hash="a14de21a37b43d13b4e70b9ef96933c7"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="cloudiq"><file name="core.css" hash="c22a2fe861358447637a640e75da9076"/></dir></dir></dir></dir></target></contents>
|
18 |
+
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
+
</package>
|
skin/adminhtml/default/default/cloudiq/core.css
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cloudiq-banner {
|
2 |
+
padding: 5px 27px 5px 47px;
|
3 |
+
background: rgb(255, 249, 233);
|
4 |
+
border-bottom: 1px solid rgb(238, 226, 190);
|
5 |
+
border-top: 1px solid rgb(238, 226, 190);
|
6 |
+
font-size: 11px;
|
7 |
+
line-height: 16px;
|
8 |
+
margin: 0 0 -3px;
|
9 |
+
color: rgb(68, 68, 68);
|
10 |
+
position: relative;
|
11 |
+
}
|
12 |
+
|
13 |
+
/*
|
14 |
+
* Expand the config form and adjust all elements to expand to the new size.
|
15 |
+
*/
|
16 |
+
#edit_form .form-list {
|
17 |
+
width: 590px;
|
18 |
+
}
|
19 |
+
|
20 |
+
#edit_form .form-list td.value {
|
21 |
+
width: auto;
|
22 |
+
}
|
23 |
+
|
24 |
+
#edit_form td.value .note {
|
25 |
+
width: 90%;
|
26 |
+
}
|
27 |
+
|
28 |
+
#edit_form td.value select {
|
29 |
+
width: 95%;
|
30 |
+
}
|
31 |
+
|
32 |
+
/* Text inputs are half-width by default */
|
33 |
+
#edit_form td.value input {
|
34 |
+
width: 50%;
|
35 |
+
}
|
36 |
+
|
37 |
+
/* Expand the Account ID and Token fields to fit the data */
|
38 |
+
#edit_form #settings.fieldset td.value input {
|
39 |
+
font-family: monospace;
|
40 |
+
width: 64%;
|
41 |
+
}
|