Skip to content

Commit 49df15d

Browse files
author
Jason Smale
committed
Merge pull request #41 from max-mi/master
New config, dashboards, user & order selection when creating tickets, better SSO, user syncing and fixes.
2 parents 6d63f0b + f242cf8 commit 49df15d

File tree

86 files changed

+3298
-467
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+3298
-467
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/**
3+
* Copyright 2013 Zendesk.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
class Zendesk_Zendesk_Block_Adminhtml_Config_Buttons_Sync extends Mage_Adminhtml_Block_System_Config_Form_Field
19+
{
20+
protected function _prepareLayout()
21+
{
22+
parent::_prepareLayout();
23+
if (!$this->getTemplate()) {
24+
$this->setTemplate('zendesk/config/button-sync.phtml');
25+
}
26+
return $this;
27+
}
28+
29+
public function render(Varien_Data_Form_Element_Abstract $element)
30+
{
31+
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
32+
return parent::render($element);
33+
}
34+
35+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
36+
{
37+
$originalData = $element->getOriginalData();
38+
$this->addData(array(
39+
'button_label' => Mage::helper('zendesk')->__($originalData['button_label']),
40+
'html_id' => $element->getHtmlId(),
41+
'url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/zendesk/sync')
42+
));
43+
44+
return $this->_toHtml();
45+
}
46+
47+
public function getTestUrl()
48+
{
49+
return Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/zendesk/sync');
50+
}
51+
52+
public function getAuthHeader()
53+
{
54+
return 'Token token="' . Mage::helper('zendesk')->getApiToken(false) . '"';
55+
}
56+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright 2015 Zendesk
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
class Zendesk_Zendesk_Block_Adminhtml_Create_Customer extends Mage_Adminhtml_Block_Widget_Form_Container
19+
{
20+
21+
public function __construct()
22+
{
23+
parent::__construct();
24+
$this->setId('zendesk_create_customer_search');
25+
}
26+
27+
public function getHeaderText()
28+
{
29+
return Mage::helper('zendesk')->__('Please Select User to Add');
30+
}
31+
32+
public function getButtonsHtml()
33+
{
34+
$addButtonData = array(
35+
'label' => Mage::helper('zendesk')->__('Select User'),
36+
'onclick' => 'showUsers()',
37+
'id' => 'show-users'
38+
);
39+
return $this->getLayout()->createBlock('adminhtml/widget_button')->setData($addButtonData)->toHtml();
40+
}
41+
42+
public function getHeaderCssClass()
43+
{
44+
return 'head-catalog-customer';
45+
}
46+
47+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?php
2+
/**
3+
* Copyright 2015 Zendesk
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
class Zendesk_Zendesk_Block_Adminhtml_Create_Customer_Grid extends Mage_Adminhtml_Block_Widget_Grid
19+
{
20+
21+
public function __construct()
22+
{
23+
parent::__construct();
24+
$this->setId('zendesk_create_customer_search_grid');
25+
$this->setDefaultSort('entity_id');
26+
$this->setUseAjax(true);
27+
if ($this->getRequest()->getParam('collapse')) {
28+
$this->setIsCollapsed(true);
29+
}
30+
}
31+
32+
/**
33+
* Retrieve quote store object
34+
* @return Mage_Core_Model_Store
35+
*/
36+
public function getStore()
37+
{
38+
return Mage::getSingleton('adminhtml/session_quote')->getStore();
39+
}
40+
41+
/**
42+
* Prepare collection to be displayed in the grid
43+
*
44+
* @return Mage_Adminhtml_Block_Sales_Order_Create_Search_Grid
45+
*/
46+
protected function _prepareCollection()
47+
{
48+
$collection = Mage::getModel('customer/customer')->getCollection()
49+
->addAttributeToSelect('firstname')
50+
->addAttributeToSelect('lastname')
51+
->addAttributeToSelect('email');
52+
53+
54+
$this->setCollection($collection);
55+
return parent::_prepareCollection();
56+
}
57+
58+
/**
59+
* Prepare columns
60+
*
61+
* @return Mage_Adminhtml_Block_Sales_Order_Create_Search_Grid
62+
*/
63+
protected function _prepareColumns()
64+
{
65+
$this->addColumn('entity_id', array(
66+
'header' => Mage::helper('zendesk')->__('ID'),
67+
'sortable' => true,
68+
'width' => '60',
69+
'index' => 'entity_id'
70+
));
71+
$this->addColumn('firstname', array(
72+
'header' => Mage::helper('zendesk')->__('Firstname'),
73+
'index' => 'firstname'
74+
));
75+
$this->addColumn('lastname', array(
76+
'header' => Mage::helper('zendesk')->__('Lastname'),
77+
'index' => 'lastname'
78+
));
79+
$this->addColumn('email', array(
80+
'header' => Mage::helper('zendesk')->__('Email'),
81+
'index' => 'email'
82+
));
83+
$this->addColumn('action', array(
84+
'header' => Mage::helper('zendesk')->__('Action'),
85+
'renderer' => 'zendesk/adminhtml_create_customer_grid_renderer_action',
86+
'filter' => false,
87+
'sortable' => false
88+
));
89+
90+
return parent::_prepareColumns();
91+
}
92+
93+
public function getGridUrl()
94+
{
95+
return $this->getUrl('adminhtml/zendesk/loadBlock', array('block'=>'customer_grid', '_current' => true, 'collapse' => null));
96+
}
97+
98+
public function getRowUrl($row)
99+
{
100+
return "";
101+
}
102+
103+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright 2015 Zendesk
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
class Zendesk_Zendesk_Block_Adminhtml_Create_Customer_Grid_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
19+
{
20+
public function render(Varien_Object $row)
21+
{
22+
if ($row->getId()) {
23+
return "<button title='".Mage::helper('zendesk')->__('Add')."' type='button' class='scalable' onclick='javascript:insertUser(".$row->getId()."); return false;'><span><span><span>".Mage::helper('zendesk')->__('Add')."</span></span></span></button>";
24+
}
25+
}
26+
27+
}

src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Create/Edit.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class Zendesk_Zendesk_Block_Adminhtml_Create_Edit extends Mage_Adminhtml_Block_W
1919
{
2020
protected function _construct()
2121
{
22-
parent::_construct();
23-
$this->_controller = FALSE;
22+
parent::_construct();
2423
}
2524

2625
protected function _preparelayout()

src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Create/Edit/Form.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ protected function _prepareForm()
105105

106106
$fieldset->addField('order', 'text', array(
107107
'name' => 'order',
108-
'label' => Mage::helper('zendesk')->__('Order number'),
109-
'title' => Mage::helper('zendesk')->__('Order number'),
108+
'label' => Mage::helper('zendesk')->__('Order Number'),
109+
'title' => Mage::helper('zendesk')->__('Order Number'),
110110
'required' => false
111111
));
112112

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright 2015 Zendesk
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
class Zendesk_Zendesk_Block_Adminhtml_Create_Order extends Mage_Adminhtml_Block_Widget_Form_Container
19+
{
20+
21+
public function __construct()
22+
{
23+
parent::__construct();
24+
$this->setId('zendesk_create_order_search');
25+
}
26+
27+
public function getHeaderText()
28+
{
29+
return Mage::helper('zendesk')->__('Please Select Order to Add');
30+
}
31+
32+
public function getButtonsHtml()
33+
{
34+
$addButtonData = array(
35+
'label' => Mage::helper('zendesk')->__('Select Order'),
36+
'onclick' => 'showOrders()',
37+
'id' => 'show-orders'
38+
);
39+
return $this->getLayout()->createBlock('adminhtml/widget_button')->setData($addButtonData)->toHtml();
40+
}
41+
42+
public function getHeaderCssClass()
43+
{
44+
return 'head-catalog-order';
45+
}
46+
47+
}

0 commit comments

Comments
 (0)