Lexity_Live - Version 1.3.0

Version Notes

Stable

Download this release

Release Info

Developer Lexity
Extension Lexity_Live
Version 1.3.0
Comparing to
See all releases


Code changes from version 1.2.0 to 1.3.0

app/code/local/LexityLive/Block/Credentials/Form/Edit.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LexityLive_Block_Credentials_Form_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
3
+
4
+ public function __construct() {
5
+ Mage::log('Lexity: In Block Form Edit');
6
+ parent::__construct();
7
+ $this->_objectId = 'credentials';
8
+ $this->_blockGroup = 'lexitylive';
9
+ $this->_controller = 'credentials_form';
10
+ $this->_mode = 'edit';
11
+ $this->_removeButton('reset')
12
+ ->_removeButton('back')
13
+ ->_removeButton('save');
14
+
15
+
16
+ // $this->_blockGroup = ‘form’; and $this->_controller = ‘adminhtml_form’;
17
+ // There two variables are very important, these variables are used to find
18
+ // FORM tabs php file. i.e the path of the form tabs php should be
19
+ // {$this->_blockGroup . ‘/’ . $this->_controller . ‘_’ . $this->_mode . ‘_form’}.
20
+ // The value of $this->_mode by default is ‘edit’. So the path of the php file which
21
+ // contains the form tag in our case would be ‘form/adminhtml_form_edit_form’.
22
+
23
+ // $this->_updateButton('save', 'label', Mage::helper('lexitylive')->__('Save'));
24
+ // $this->_updateButton('delete', 'label', Mage::helper('lexitylive')->__('Delete'));
25
+
26
+ // $this->_addButton('saveandcontinue', array(
27
+ // 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
28
+ // 'onclick' => 'saveAndContinueEdit()',
29
+ // 'class' => 'save',
30
+ // ), -100);
31
+
32
+ }
33
+
34
+ public function getHeaderText() {
35
+ Mage::log('Lexity: You got the header text');
36
+ return Mage::helper('lexitylive')->__('Account Information');
37
+ }
38
+
39
+
40
+
41
+
42
+ }
43
+
44
+ ?>
app/code/local/LexityLive/Block/Credentials/Form/Edit/Form.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LexityLive_Block_Credentials_Form_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ protected function _prepareForm() {
5
+ Mage::log('Lexity: In Block Form Edit Form');
6
+ $form = new Varien_Data_Form(array(
7
+ 'id' => 'edit_form',
8
+ 'action' => $this->getUrl(
9
+ '*/*/newapp',
10
+ array('credentials' => $this->getRequest()->getParam('credentials'))
11
+ ),
12
+ 'method' => 'post',
13
+ 'enctype' => 'multipart/form-data'
14
+ ));
15
+
16
+ $form->setUseContainer(true);
17
+ $this->setForm($form);
18
+ return parent::_prepareForm();
19
+ }
20
+ }
app/code/local/LexityLive/Block/Credentials/Form/Edit/Tab/Form.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LexityLive_Block_Credentials_Form_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ protected function _prepareForm() {
5
+ Mage::log('Lexity: In Block Form Edit Tab Form');
6
+ $form = new Varien_Data_Form();
7
+ $this->setForm($form);
8
+ $fieldset = $form->addFieldset(
9
+ 'form_form',
10
+ array('legend'=>Mage::helper('lexitylive')->__('Account Information')));
11
+ Mage::log('Lexity: fieldset');
12
+ $fieldset->addField('email', 'text', array(
13
+ 'label' => Mage::helper('lexitylive')->__('Email'),
14
+ 'class' => 'required-entry',
15
+ 'required' => true,
16
+ 'name' => 'email',
17
+ // 'onclick' => "alert('on click');",
18
+ // 'onchange' => "alert('on change');",
19
+ // 'style' => "border:10px",
20
+ 'value' => Mage::getSingleton('admin/session')->getUser()->getEmail(),
21
+ // 'disabled' => false,
22
+ // 'readonly' => false,
23
+ // 'after_element_html' => '<small>Comments</small>',
24
+ 'tabindex' => 1
25
+ ));
26
+ Mage::log('Lexity: addfield email');
27
+ $fieldset->addField('password', 'password', array(
28
+ 'label' => Mage::helper('lexitylive')->__('Password'),
29
+ 'class' => 'required-entry',
30
+ 'required' => true,
31
+ 'name' => 'password',
32
+ // 'onclick' => "",
33
+ // 'onchange' => "",
34
+ // 'style' => 'border:10px',
35
+ // 'value' => 'hello !!',
36
+ // 'disabled' => false,
37
+ // 'readonly' => false,
38
+ 'after_element_html' => '<small>This is your Lexity account password</small>',
39
+ 'tabindex' => 2
40
+ ));
41
+ Mage::log('Lexity: addfield password');
42
+ $fieldset->addField('domain', 'text', array(
43
+ 'label' => Mage::helper('lexitylive')->__('Domain'),
44
+ 'class' => 'required-entry',
45
+ 'required' => true,
46
+ 'name' => 'domain',
47
+ // 'onclick' => "alert('on click');",
48
+ // 'onchange' => "alert('on change');",
49
+ // 'style' => 'border:10px',
50
+ 'value' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB),
51
+ // 'disabled' => false,
52
+ 'readonly' => true,
53
+ // 'after_element_html' => '<small>Comments</small>',
54
+ 'tabindex' => 3
55
+ ));
56
+ Mage::log('Lexity: addfield domain');
57
+ $fieldset->addField('submit', 'submit', array(
58
+ // 'label' => Mage::helper('lexitylive')->__('Create Account'),
59
+ // 'required' => true,
60
+ 'value' => 'Create Account',
61
+ // 'after_element_html' => '<small>Comments</small>',
62
+ 'tabindex' => 4
63
+ ));
64
+ Mage::log('Lexity: addfield submit');
65
+ return parent::_prepareForm();
66
+ }
67
+ }
app/code/local/LexityLive/Block/Credentials/Form/Edit/Tabs.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LexityLive_Block_Credentials_Form_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
3
+
4
+ public function __construct() {
5
+ Mage::log('Lexity: In Block Form Edit Tabs');
6
+ parent::__construct();
7
+ $this->setId('form_tabs');
8
+ // this should be same as the form id in Credentials_Form_Edit_Form.php
9
+ $this->setDestElementId('edit_form');
10
+ $this->setTitle(Mage::helper('lexitylive')->__('Lexity Account'));
11
+ }
12
+
13
+ protected function _beforeToHtml() {
14
+ Mage::log('Lexity: Writing form to html');
15
+ $this->addTab('form_section', array(
16
+ 'label' => Mage::helper('lexitylive')->__('Account Information'),
17
+ 'title' => Mage::helper('lexitylive')->__('Account Information'),
18
+ 'content' => $this->getLayout()->createBlock('lexitylive/credentials_form_edit_tab_form')->toHtml(),
19
+ ));
20
+
21
+ return parent::_beforeToHtml();
22
+ }
23
+ }
app/code/local/LexityLive/Block/Embed.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LexityLive_Block_Embed extends Mage_Adminhtml_Block_Template
3
+ {
4
+ public function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('lexitylive/embed.phtml');
8
+ }
9
+ }
10
+ ?>
app/code/local/LexityLive/Block/Live.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
- class LexityLive_Block_Live extends Mage_Adminhtml_Block_Template
3
- {
4
- public function _construct()
5
- {
6
- parent::_construct();
7
- $this->setTemplate('lexitylive/live.phtml');
8
- }
9
- }
 
 
 
 
 
 
 
 
 
app/code/local/LexityLive/Model/Core.php CHANGED
@@ -1,11 +1,20 @@
1
  <?php
2
- class LexityLive_Model_Core extends Mage_Core_Model_Config
3
- {
4
- public $app_name = 'live';
5
  public $platform = 'magento';
6
 
7
- public function has_lexity_user()
8
- {
 
 
 
 
 
 
 
 
 
 
9
  $resource = Mage::getSingleton('core/resource');
10
  $readConnection = $resource->getConnection('core_read');
11
  $tableName = $resource->getTableName('api/user');
@@ -13,150 +22,162 @@ class LexityLive_Model_Core extends Mage_Core_Model_Config
13
  return isset($results[0]);
14
  }
15
 
16
- public function add_lexity_user($api_key)
17
- {
18
- $role = Mage::getModel('api/roles')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  ->setName('lexity_live')
20
  ->setPid(false)
 
 
21
  ->setRoleType('G')
22
  ->save();
 
 
 
23
 
24
- Mage::getModel("api/rules")
 
25
  ->setRoleId($role->getId())
26
  ->setResources(array('all'))
27
  ->saveRel();
28
-
 
 
29
  $user = Mage::getModel('api/user');
30
  $user->setData(array(
31
  'username' => 'lexity_live',
32
  'firstname' => 'lexity',
33
  'lastname' => 'lexity',
34
  'email' => 'support+live@lexity.com',
35
- 'api_key' => $api_key,
36
- 'api_key_confirmation' => $api_key,
37
  'is_active' => 1,
38
  'user_roles' => '',
39
  'assigned_user_role' => '',
40
  'role_name' => '',
41
  'roles' => array($role->getId())
42
  ));
43
-
44
- $user->save()->load($user->getId());
45
-
46
- $user->setRoleIds(array($role->getId()))
47
- ->setRoleUserId($user->getUserId())
48
- ->saveRelations();
49
- }
50
-
51
- public function create_account($new_token = null)
52
- {
53
- $user = Mage::getModel('api/user');
54
- $user->loadByUsername('lexity_live');
55
-
56
- $hash = $user->getApiKey();
57
- $hashArr = explode(':', $hash);
58
- switch (count($hashArr)) {
59
- case 1:
60
- $token = $hash;
61
- break;
62
- case 2:
63
- $token = $hashArr[0];
64
- $skey = $hashArr[1];
65
- break;
66
  }
67
- $hashed_token = $token;
68
 
69
- if (isset($new_token)) {
70
- $token = $new_token;
 
 
71
  }
72
 
73
- $admin_user = Mage::getSingleton('admin/session');
74
- $admin_email = $admin_user->getUser()->getEmail();
75
  $uri = "https://lexity.com/api/account/create?app="
76
- . $this->app_name
77
  . "&platform=" . $this->platform . "&password=" . $token
78
  . "&login=lexity_live"
79
- . "&email=" . urlencode($admin_email)
80
  . "&url=" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
81
-
82
  if (isset($skey)) {
83
- $uri .= "&skey=${skey}";
84
  }
85
-
86
- # initiate handshake
 
 
 
87
  $client = new Varien_Http_Client($uri);
88
  $response = $client->request('GET');
89
  $body = $response->getBody();
90
-
91
  $decode = json_decode($body);
92
  if (!isset($decode->error) && isset($decode->public_id)) {
93
- $this->saveConfig('lexity/live/public_id', $decode->public_id);
94
- $this->saveConfig('lexity/live/email', $admin_email);
95
  Mage::getConfig()->reinit();
96
  Mage::app()->reinitStores();
 
 
97
  }
98
 
99
- return "https://lexity.com/api/account/login?app="
100
- . $this->app_name
101
- . "&email=" . urlencode($admin_email)
102
- . "&platform=" . $this->platform . "&token=" . $hashed_token
103
- . "&public_id=" . $decode->public_id
104
- . "&domain=" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
105
- }
106
-
107
- public function get_lexity_login_url($target = null)
108
- {
109
- $user = Mage::getModel('api/user');
110
- $user->loadByUsername('lexity_live');
111
-
112
- $hash = $user->getApiKey();
113
- $hashArr = explode(':', $hash);
114
- switch (count($hashArr)) {
115
- case 1:
116
- $token = $hash;
117
- break;
118
- case 2:
119
- $token = $hashArr[0];
120
- $skey = $hashArr[1];
121
- break;
122
  }
 
123
 
 
 
 
 
 
 
 
 
 
 
 
124
  Mage::app()->getCacheInstance()->cleanType('config');
125
- $public_id = Mage::getStoreConfig('lexity/live/public_id');
126
- $login_email = Mage::getStoreConfig('lexity/live/email');
127
-
128
- $redirect_url = "https://lexity.com/api/account/login?app="
129
- . $this->app_name
130
  . "&platform=" . $this->platform . "&token=" . $token
131
  . "&public_id=" . $public_id
132
- . "&email=" . urlencode($login_email)
133
  . "&domain=" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
134
-
135
  if (!empty($target)) {
136
  $redirect_url .= "&target=${target}";
137
  }
138
-
139
- return $redirect_url;
140
- }
141
-
142
- public function loginAndRedirect($target = null)
143
- {
144
- Mage::app()->getCacheInstance()->cleanType('config');
145
- $public_id = Mage::getStoreConfig('lexity/live/public_id');
146
- if (empty($public_id)) {
147
- $token = md5(uniqid());
148
-
149
- if (!$this->has_lexity_user()) {
150
- $this->add_lexity_user($token);
151
- } else {
152
- $user = Mage::getModel('api/user')->loadByUsername("lexity_live");
153
- $user->setApiKey($token);
154
- $user->save();
155
  }
156
- $this->create_account($token);
 
157
  }
158
 
159
- return $this->get_lexity_login_url($target);
 
 
 
 
160
  }
161
  }
162
  ?>
1
  <?php
2
+ class LexityLive_Model_Core extends Mage_Core_Model_Config {
3
+
 
4
  public $platform = 'magento';
5
 
6
+ public function report_error($errors) {
7
+ $message = 'An error has occured <br>';
8
+ foreach ($errors as $sub => $msg) {
9
+ $message .= $sub . ': ' . $msg . '<br>';
10
+ }
11
+ $message .= 'Please contact Lexity support for more assistance <br> '
12
+ .' support@lexity.com or 1-855-533-8144';
13
+ // Mage::getSingleton('core/session')->addError($message);
14
+ die($message);
15
+ }
16
+
17
+ public function has_lexity_user() {
18
  $resource = Mage::getSingleton('core/resource');
19
  $readConnection = $resource->getConnection('core_read');
20
  $tableName = $resource->getTableName('api/user');
22
  return isset($results[0]);
23
  }
24
 
25
+ public function get_api_key() {
26
+ if ($this->has_lexity_user()) {
27
+ $user = Mage::getModel('api/user');
28
+ $user->loadByUsername('lexity_live');
29
+ return $user->getApiKey();
30
+ } else {
31
+ return null;
32
+ }
33
+ }
34
+
35
+ public function check_credentials() {
36
+ $token = $this->get_api_key();
37
+ Mage::app()->getCacheInstance()->cleanType('config');
38
+ $public_id = Mage::getStoreConfig('lexity/public_id');
39
+ $email = Mage::getStoreConfig('lexity/email');
40
+ if ($token == null && $public_id == null && $email == null) {
41
+ return 'getcredentials';
42
+ } else if (isset($public_id) && isset($email) && $token == null) {
43
+ return 'newapp';
44
+ } else {
45
+ return 'redirect';
46
+ }
47
+ }
48
+
49
+ public function create_account($email=null, $password=null) {
50
+ $token = md5(uniqid());
51
+ $errors = array();
52
+ if ($email == null) {
53
+ $email = Mage::getStoreConfig('lexity/email');
54
+ }
55
+
56
+ try {
57
+ $role = Mage::getModel('api/roles')
58
  ->setName('lexity_live')
59
  ->setPid(false)
60
+ // RoleType is either 'G' for group or 'U' for user since we create
61
+ // a new api and role for each app maybe we should change it to 'U'
62
  ->setRoleType('G')
63
  ->save();
64
+ } catch (Exception $e) {
65
+ $errors['Role'] = 'Api Role could not be made: ' . $e->getMessage();
66
+ }
67
 
68
+ try {
69
+ Mage::getModel("api/rules")
70
  ->setRoleId($role->getId())
71
  ->setResources(array('all'))
72
  ->saveRel();
73
+ } catch (Exception $e) {
74
+ $errors['Rule'] = 'Api Rule could not be made: ' . $e->getMessage();
75
+ }
76
  $user = Mage::getModel('api/user');
77
  $user->setData(array(
78
  'username' => 'lexity_live',
79
  'firstname' => 'lexity',
80
  'lastname' => 'lexity',
81
  'email' => 'support+live@lexity.com',
82
+ 'api_key' => $token,
83
+ 'api_key_confirmation' => $token,
84
  'is_active' => 1,
85
  'user_roles' => '',
86
  'assigned_user_role' => '',
87
  'role_name' => '',
88
  'roles' => array($role->getId())
89
  ));
90
+ try {
91
+ $user->save()->load($user->getId());
92
+ $user->setRoleIds(array($role->getId()))
93
+ ->setRoleUserId($user->getUserId())
94
+ ->saveRelations();
95
+ } catch (Exception $e) {
96
+ $errors['User'] = 'Api User could not be made: ' . $e->getMessage();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  }
 
98
 
99
+ $hash = $this->get_api_key();
100
+ $hash_array = explode(':', $hash);
101
+ if (count($hash_array) == 2) {
102
+ $skey = $hash_array[1];
103
  }
104
 
 
 
105
  $uri = "https://lexity.com/api/account/create?app="
106
+ . "live"
107
  . "&platform=" . $this->platform . "&password=" . $token
108
  . "&login=lexity_live"
109
+ . "&email=" . urlencode($email)
110
  . "&url=" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
 
111
  if (isset($skey)) {
112
+ $uri .= "&skey=" . $skey;
113
  }
114
+ if (isset($password)) {
115
+ // should I hash this password?...at least urlencode it
116
+ $uri .= "&user_password=" . urlencode($password);
117
+ }
118
+ // initiate handshake
119
  $client = new Varien_Http_Client($uri);
120
  $response = $client->request('GET');
121
  $body = $response->getBody();
122
+ // interpret response
123
  $decode = json_decode($body);
124
  if (!isset($decode->error) && isset($decode->public_id)) {
125
+ $this->saveConfig('lexity/public_id', $decode->public_id);
126
+ $this->saveConfig('lexity/email', $email);
127
  Mage::getConfig()->reinit();
128
  Mage::app()->reinitStores();
129
+ } else {
130
+ $errors['Registration'] = $decode->error . '<br>' . $uri;
131
  }
132
 
133
+ if ($errors) {
134
+ $this->report_error($errors);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  }
136
+ }
137
 
138
+ public function get_lexity_login_url($target = null) {
139
+ Mage::log('Lexity: getting lexity login url');
140
+ $errors = array();
141
+ $token = $this->get_api_key();
142
+ $token_array = explode(':', $token);
143
+ if (count($token_array) == 2) {
144
+ $token = $token_array[0];
145
+ } else {
146
+ $redirect['errors']['API User'] = 'token does not have hash key';
147
+ } // else the token has no skey
148
+ // Clean Cache
149
  Mage::app()->getCacheInstance()->cleanType('config');
150
+ $public_id = Mage::getStoreConfig('lexity/public_id');
151
+ $email = Mage::getStoreConfig('lexity/email');
152
+ $redirect_url= "https://lexity.com/api/account/login?app="
153
+ . "live"
 
154
  . "&platform=" . $this->platform . "&token=" . $token
155
  . "&public_id=" . $public_id
156
+ . "&email=" . urlencode($email)
157
  . "&domain=" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
 
158
  if (!empty($target)) {
159
  $redirect_url .= "&target=${target}";
160
  }
161
+ Mage::log('Lexity: this is the url: ' . $redirect_url);
162
+ try {
163
+ $client = new Varien_Http_Client($redirect_url);
164
+ $response = $client->request('GET');
165
+ $body = $response->getBody();
166
+ // interpret response
167
+ $decode = json_decode($body);
168
+ if (isset($decode->error)) {
169
+ Mage::log('Lexity: Error encountered while getting redirect');
170
+ $errors['Redirect URL'] = $decode->error . '<br>' . $redirect_url;
 
 
 
 
 
 
 
171
  }
172
+ } catch (Exception $e) {
173
+ Mage::log('Lexity: Redirect successful');
174
  }
175
 
176
+ if ($errors) {
177
+ $this->report_error($errors);
178
+ } else {
179
+ return $redirect_url;
180
+ }
181
  }
182
  }
183
  ?>
app/code/local/LexityLive/controllers/CoreController.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- class LexityLive_CoreController extends Mage_Adminhtml_Controller_Action
3
- {
4
- public function golexityAction()
5
- {
6
- if (Mage::getModel('lexitylive/core')->has_lexity_user()) {
7
- Mage::Log('Found lexity user, redirecting for login.');
8
- }
9
- else {
10
- Mage::Log('No lexity user found, redirecting for account creation.');
11
-
12
- $token = uniqid();
13
- Mage::Log("Shared public key is: " . Mage::getModel('lexitylive/core')->shared_key);
14
- Mage::Log("Token is: ${token}");
15
- Mage::getModel('lexitylive/core')->add_lexity_user($token);
16
- //$this->getResponse()->setRedirect("http://lexity.com/?token=${token}");
17
- }
18
- }
19
- }
20
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/LexityLive/controllers/MarketingController.php CHANGED
@@ -1,20 +1,56 @@
1
  <?php
2
- class LexityLive_MarketingController extends Mage_Adminhtml_Controller_Action
3
- {
4
- public function golexityAction()
5
- {
6
- Mage::app()->getCacheInstance()->cleanType('config');
7
- $public_id = Mage::getStoreConfig('lexity/live/public_id');
8
- if (empty($public_id)) {
9
- $uri = Mage::getModel('lexitylive/core')->loginAndRedirect();
10
- $this->getResponse()->setRedirect($uri);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
12
- else {
 
 
 
13
  $this->_title('Lexity Live');
14
- $this->loadLayout()
15
- ->_setActiveMenu('Marketing');
16
- $this->_addContent($this->getLayout()->createBlock('lexitylive/live'));
17
  $this->renderLayout();
 
 
 
18
  }
19
  }
20
  }
1
  <?php
2
+ class LexityLive_MarketingController extends Mage_Adminhtml_Controller_Action {
3
+
4
+ public $embed = true;
5
+
6
+ public function goLexityAction() {
7
+ $core = Mage::getModel('lexitylive/core');
8
+ $action = $core->check_credentials();
9
+ $this->_forward($action);
10
+ }
11
+
12
+ public function getCredentialsAction() {
13
+ Mage::log('Lexity: forworded to getCredentialsAction');
14
+ $this->_title('Confirm Credentials');
15
+ $this->loadLayout()->_setActiveMenu('Marketing');
16
+ $block = $this->getLayout()->createBlock('lexitylive/credentials_form_edit');
17
+ $left_block = $this->getLayout()->createBlock('lexitylive/credentials_form_edit_tabs');
18
+ $this->_addContent($block)->_addLeft($left_block);
19
+ $this->renderLayout();
20
+ }
21
+
22
+ public function newAppAction() {
23
+ Mage::log('Lexity: submitted to newAppAction');
24
+ $core = Mage::getModel('lexitylive/core');
25
+ if ($data = $this->getRequest()->getPost()) {
26
+ $email = $data['email'];
27
+ $password = $data['password'];
28
+ $core->create_account($email, $password);
29
+ } else {
30
+ $core->create_account();
31
+ }
32
+ $this->_forward('goLexity');
33
+ }
34
+
35
+ public function redirectAction() {
36
+ $core = Mage::getModel('lexitylive/core');
37
+ if ($this->embed) {
38
+ $target = urlencode('admin/live?embed=true');
39
+ } else {
40
+ $target = null;
41
  }
42
+ $url = $core->get_lexity_login_url($target);
43
+ if ($this->embed) {
44
+ Mage::log('Lexity: forwarded to embedAction');
45
+ Mage::register('embed_url', $url);
46
  $this->_title('Lexity Live');
47
+ $this->loadLayout()->_setActiveMenu('Marketing');
48
+ $block = $this->getLayout()->createBlock('lexitylive/embed');
49
+ $this->_addContent($block);
50
  $this->renderLayout();
51
+ } else {
52
+ Mage::log('Lexity: forwarded to redirectAction');
53
+ $this->getResponse()->setRedirect($url);
54
  }
55
  }
56
  }
app/code/local/LexityLive/etc/config.xml CHANGED
@@ -5,6 +5,21 @@
5
  <version>0.1.0</version>
6
  </lexitylive>
7
  </modules>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  <global>
9
  <helpers>
10
  <lexitylive>
5
  <version>0.1.0</version>
6
  </lexitylive>
7
  </modules>
8
+ <adminhtml>
9
+ <menu>
10
+ <Lexity translate="title">
11
+ <title>Marketing</title>
12
+ <children>
13
+ <lexitylive translate="title" module="lexitylive">
14
+ <title>Lexity Live</title>
15
+ <action>lexitylive/marketing/golexity</action>
16
+ <sort_order>0</sort_order>
17
+ </lexitylive>
18
+ </children>
19
+ <sort_order>900</sort_order>
20
+ </Lexity>
21
+ </menu>
22
+ </adminhtml>
23
  <global>
24
  <helpers>
25
  <lexitylive>
app/design/adminhtml/default/default/template/lexitylive/credentials.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $email = Mage::getSingleton('admin/session')->getUser()->getEmail();
3
+ $domain = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
4
+ ?>
5
+
6
+ <form action="<? echo $this->getFormAction(); ?>" method="POST">
7
+ <fieldset>
8
+ <legend>Please confirm the credentials you would like to use for your Lexity account.</legend>
9
+
10
+ <label for="email">Email:</label>
11
+ <input type="text" name="email" value="<? echo $email ?>" />
12
+
13
+ <label for="password">Password:</label>
14
+ <input type="password" name="password" />
15
+
16
+ <label for="domain">Domain:</label>
17
+ <input type="text" name="domain" value="<? echo $domain ?>" disabled />
18
+
19
+ <input type="hidden" name="form_key" value="<? echo $this->getFormKey(); ?>" />
20
+
21
+ <input type="submit" value="Create Account" />
22
+ </fieldset>
23
+ </form>
app/design/adminhtml/default/default/template/lexitylive/embed.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ // $uri = Mage::getModel('lexitylive/core')->get_lexity_login_url(urlencode('admin/live?embed=true'));
3
+ $url = Mage::registry('embed_url')
4
+ ?>
5
+
6
+ <iframe src="<?php echo $url ?>" width="100%" style="min-height: 800px;" scrolling="auto" frameborder="0"></iframe>
app/design/adminhtml/default/default/template/lexitylive/live.phtml DELETED
@@ -1,5 +0,0 @@
1
- <?php
2
- $liveUri = Mage::getModel('lexitylive/core')->loginAndRedirect(urlencode('admin/live?embed=true'));
3
- ?>
4
-
5
- <iframe src="<?php echo $liveUri ?>" width="100%" style="min-height: 800px;" scrolling="auto" frameborder="0"></iframe>
 
 
 
 
 
package.xml CHANGED
@@ -1,30 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Lexity_Live</name>
4
- <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license>BSD License</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Your Customers. In Real Time. For Free. </summary>
10
- <description>With Lexity Live You Can:&#xD;
11
- &#xD;
12
- Monitor Your Customer Activity In Real Time&#xD;
13
- &#xD;
14
- Lexity Live is a free website traffic analysis tool designed for ecommerce, with real-time visitor tracking. Other tools like Google Analytics can take hours to process data, too late for you to react. With Lexity Live, real-time information about current site visitors lets you watch your customers browse your web site and category pages, learn about your products from product pages, and go from checkout to purchase, all as it happens. &#xD;
15
- &#xD;
16
- Track Your Store's Traffic&#xD;
17
- &#xD;
18
- See how your traffic improves over time and when your peak hours of business are, while tracking where your customers are coming from and what they are looking for. View reports on unique visitors, page views, keyword trends, top referring sites, search engines, and geolocation.&#xD;
19
- &#xD;
20
- See Where Your Customers Spend Their Time&#xD;
21
- &#xD;
22
- What pages do your customers look at and for how long? Where are they dropping off? Find out by tracking each individual customer and seeing their realtime behavior in your ecommerce store. Detailed path and page analysis reports for unique visitors include time on site, down to the second.</description>
23
- <notes>Bug fixes and improvements to overall stability.</notes>
24
  <authors><author><name>Lexity</name><user>lexity</user><email>support@lexity.com</email></author></authors>
25
- <date>2012-08-28</date>
26
- <time>20:50:11</time>
27
- <contents><target name="magelocal"><dir name="LexityLive"><dir name="Block"><file name="Live.php" hash="eba95b73fc106ee5f16f79007900bce4"/></dir><dir name="Helper"><file name="Data.php" hash="81b07c4eb066f3f6ca74ac7f288ea3d1"/></dir><dir name="Model"><dir name="Core"><file name="Api.php" hash="0ca1f11c4dbd825832c0141d0a8103bf"/></dir><file name="Core.php" hash="816a8decbd743507d413920faa1375f8"/><dir name="Order"><file name="Api.php" hash="793c3381f2b330162edff20d032aa87a"/></dir></dir><dir name="controllers"><file name="CoreController.php" hash="825255d558bf9b79877bb89d67c95153"/><file name="MarketingController.php" hash="2654936fd724a1c15b376cf3fa0be089"/></dir><dir name="etc"><file name="api.xml" hash="2839f8ced7d210be5d75616876de301b"/><file name="config.xml" hash="f747cf1797200f99cc1f66c6d924fd30"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="LexityLive.xml" hash="90f47f9fefe55580e1e77f118100c3a1"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="lexitylive"><file name="live.phtml" hash="b654ecf70b4e8c99658b15fe8bd6e990"/></dir></dir></dir></dir></dir></target></contents>
28
  <compatible/>
29
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
30
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Lexity_Live</name>
4
+ <version>1.3.0</version>
5
  <stability>stable</stability>
6
  <license>BSD License</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>TBW</summary>
10
+ <description>TBW</description>
11
+ <notes>Stable</notes>
 
 
 
 
 
 
 
 
 
 
 
 
12
  <authors><author><name>Lexity</name><user>lexity</user><email>support@lexity.com</email></author></authors>
13
+ <date>2013-02-28</date>
14
+ <time>22:38:43</time>
15
+ <contents><target name="magelocal"><dir name="LexityLive"><dir name="Block"><dir name="Credentials"><dir name="Form"><dir name="Edit"><file name="Form.php" hash="b20058385d1974f6daedd2893f50098b"/><dir name="Tab"><file name="Form.php" hash="aa8753330bed3a6e96a19cc8a29a8834"/></dir><file name="Tabs.php" hash="8a9fd510259ab78ffcf0bd8bdc646d09"/></dir><file name="Edit.php" hash="40cb907dd77c353e1ba2aec9a1774bf0"/></dir></dir><file name="Embed.php" hash="389dfb1d5f5f6d56727355440b328f61"/></dir><dir name="Helper"><file name="Data.php" hash="81b07c4eb066f3f6ca74ac7f288ea3d1"/></dir><dir name="Model"><dir name="Core"><file name="Api.php" hash="0ca1f11c4dbd825832c0141d0a8103bf"/></dir><file name="Core.php" hash="7448fbd8dcc7296108e79e38af597cac"/><dir name="Order"><file name="Api.php" hash="793c3381f2b330162edff20d032aa87a"/></dir></dir><dir name="controllers"><file name="MarketingController.php" hash="0fccf277778b923a1101fb54bd7b8dd3"/></dir><dir name="etc"><file name="api.xml" hash="2839f8ced7d210be5d75616876de301b"/><file name="config.xml" hash="8a3987f8fd91f852f1813990c88b7e8d"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="LexityLive.xml" hash="90f47f9fefe55580e1e77f118100c3a1"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="lexitylive"><file name="credentials.phtml" hash="2b19db0cf4ba77c5b92bf2f4179f462b"/><file name="embed.phtml" hash="0d60bf2559aa2c8084725f6fd0a4c3be"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>