Version Notes
Added tickets tab to order view page
Download this release
Release Info
Developer | Hussey Coding |
Extension | HusseyCoding_Sirportly |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
- app/code/community/HusseyCoding/Sirportly/Block/Adminhtml/Sales/Order/View/Tab/SirportlyTickets.php +64 -0
- app/code/community/HusseyCoding/Sirportly/Helper/Data.php +54 -0
- app/code/community/HusseyCoding/Sirportly/controllers/Sales/OrderController.php +52 -0
- app/code/community/HusseyCoding/Sirportly/etc/config.xml +24 -1
- app/design/adminhtml/default/default/layout/sirportly.xml +21 -0
- app/design/adminhtml/default/default/template/sirportly/sales/order/view/tab/sirportlytickets.phtml +43 -0
- package.xml +6 -6
- skin/adminhtml/default/default/sirportly/css/ordertickets.css +5 -0
- skin/adminhtml/default/default/sirportly/js/ordertickets.js +52 -0
app/code/community/HusseyCoding/Sirportly/Block/Adminhtml/Sales/Order/View/Tab/SirportlyTickets.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class HusseyCoding_Sirportly_Block_Adminhtml_Sales_Order_View_Tab_SirportlyTickets extends Mage_Adminhtml_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->setTemplate('sirportly/sales/order/view/tab/sirportlytickets.phtml');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function getOrder()
|
11 |
+
{
|
12 |
+
return Mage::registry('current_order');
|
13 |
+
}
|
14 |
+
|
15 |
+
public function getTabLabel()
|
16 |
+
{
|
17 |
+
return $this->__('Sirportly Tickets');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getTabTitle()
|
21 |
+
{
|
22 |
+
return $this->__('Sirportly Tickets');
|
23 |
+
}
|
24 |
+
|
25 |
+
public function getTabClass()
|
26 |
+
{
|
27 |
+
return 'ajax only';
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getClass()
|
31 |
+
{
|
32 |
+
return $this->getTabClass();
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getTabUrl()
|
36 |
+
{
|
37 |
+
return $this->getUrl('sirportly/sales_order/sirportlyTickets', array('_current' => true));
|
38 |
+
}
|
39 |
+
|
40 |
+
public function canShowTab()
|
41 |
+
{
|
42 |
+
return true;
|
43 |
+
}
|
44 |
+
|
45 |
+
public function isHidden()
|
46 |
+
{
|
47 |
+
return false;
|
48 |
+
}
|
49 |
+
|
50 |
+
public function getCustomerEmail()
|
51 |
+
{
|
52 |
+
return $this->getOrder()->getCustomerEmail();
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getCustomerName()
|
56 |
+
{
|
57 |
+
return $this->getOrder()->getCustomerName();
|
58 |
+
}
|
59 |
+
|
60 |
+
public function getTicketsByEmail()
|
61 |
+
{
|
62 |
+
return Mage::helper('sirportly')->getTicketsByEmail($this->getCustomerEmail());
|
63 |
+
}
|
64 |
+
}
|
app/code/community/HusseyCoding/Sirportly/Helper/Data.php
CHANGED
@@ -190,4 +190,58 @@ class HusseyCoding_Sirportly_Helper_Data extends Mage_Core_Helper_Abstract
|
|
190 |
$return = Mage::getStoreConfig('sirportly/' . $config . '/' . $field);
|
191 |
return !empty($return) ? $return : Mage::getStoreConfig('sirportly/ticketassign/' . $field);
|
192 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
}
|
190 |
$return = Mage::getStoreConfig('sirportly/' . $config . '/' . $field);
|
191 |
return !empty($return) ? $return : Mage::getStoreConfig('sirportly/ticketassign/' . $field);
|
192 |
}
|
193 |
+
|
194 |
+
public function getTicketsByEmail($email)
|
195 |
+
{
|
196 |
+
if ($id = $this->_getContactIdByEmail($email)):
|
197 |
+
$params = array('contact' => $id, 'sort_by' => 'updated_at', 'order' => 'desc');
|
198 |
+
$client = $this->_getRequestObject('/api/v2/tickets/contact', $params);
|
199 |
+
$result = $this->_sendRequest($client, true);
|
200 |
+
|
201 |
+
if (!empty($result['records'])):
|
202 |
+
$tickets = $result['records'];
|
203 |
+
$pages = (int) $result['pagination']['pages'];
|
204 |
+
if ($pages > 1):
|
205 |
+
$current = 1;
|
206 |
+
while ($pages >= $current):
|
207 |
+
$current++;
|
208 |
+
$params = array('contact' => $id, 'sort_by' => 'updated_at', 'order' => 'desc', 'page' => $current);
|
209 |
+
$client = $this->_getRequestObject('/api/v2/tickets/contact', $params);
|
210 |
+
$result = $this->_sendRequest($client, true);
|
211 |
+
if (!empty($result['records'])):
|
212 |
+
$tickets = array_merge($tickets, $result['records']);
|
213 |
+
endif;
|
214 |
+
|
215 |
+
if ($current >= 10 || empty($result['records'])):
|
216 |
+
break;
|
217 |
+
endif;
|
218 |
+
endwhile;
|
219 |
+
endif;
|
220 |
+
|
221 |
+
return $tickets;
|
222 |
+
endif;
|
223 |
+
endif;
|
224 |
+
|
225 |
+
return array();
|
226 |
+
}
|
227 |
+
|
228 |
+
private function _getContactIdByEmail($email)
|
229 |
+
{
|
230 |
+
$params = array('query' => $email, 'limit' => 1, 'types' => 'email');
|
231 |
+
$client = $this->_getRequestObject('/api/v2/contacts/search', $params);
|
232 |
+
$result = $this->_sendRequest($client, true);
|
233 |
+
|
234 |
+
if (!empty($result[0]['contact']['id'])):
|
235 |
+
return $result[0]['contact']['id'];
|
236 |
+
endif;
|
237 |
+
|
238 |
+
return false;
|
239 |
+
}
|
240 |
+
|
241 |
+
public function getTicketUpdates($reference)
|
242 |
+
{
|
243 |
+
$params = array('ticket' => $reference);
|
244 |
+
$client = $this->_getRequestObject('/api/v2/ticket_updates/all', $params);
|
245 |
+
return $this->_sendRequest($client, true);
|
246 |
+
}
|
247 |
}
|
app/code/community/HusseyCoding/Sirportly/controllers/Sales/OrderController.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
include_once("Mage/Adminhtml/controllers/Sales/OrderController.php");
|
3 |
+
class HusseyCoding_Sirportly_Sales_OrderController extends Mage_Adminhtml_Sales_OrderController
|
4 |
+
{
|
5 |
+
public function sirportlyTicketsAction()
|
6 |
+
{
|
7 |
+
$this->_initOrder();
|
8 |
+
$html = $this->getLayout()->createBlock('sirportly/adminhtml_sales_order_view_tab_sirportlyTickets')->toHtml();
|
9 |
+
$translate = Mage::getModel('core/translate_inline');
|
10 |
+
if ($translate->isAllowed()) {
|
11 |
+
$translate->processResponseBody($html);
|
12 |
+
}
|
13 |
+
$this->getResponse()->setBody($html);
|
14 |
+
}
|
15 |
+
|
16 |
+
public function sirportlyUpdatesAction()
|
17 |
+
{
|
18 |
+
$result = 'failed';
|
19 |
+
$updates = false;
|
20 |
+
if ($reference = $this->getRequest()->getParam('reference')):
|
21 |
+
if ($updates = Mage::helper('sirportly')->getTicketUpdates($reference)):
|
22 |
+
$result = 'success';
|
23 |
+
$updates = $this->_buildUpdateHtml($updates);
|
24 |
+
endif;
|
25 |
+
endif;
|
26 |
+
|
27 |
+
$this->getResponse()->setBody(Zend_Json::encode(array('result' => $result, 'updates' => $updates)));
|
28 |
+
}
|
29 |
+
|
30 |
+
private function _buildUpdateHtml($updates)
|
31 |
+
{
|
32 |
+
$return = array();
|
33 |
+
$count = 0;
|
34 |
+
foreach ($updates as $update):
|
35 |
+
$timestamp = strtotime($update['posted_at']);
|
36 |
+
$timestamp = date('M jS, Y, g:i a', $timestamp);
|
37 |
+
$return[$count]['timestamp'] = $timestamp;
|
38 |
+
if (!empty($update['author']['name'])):
|
39 |
+
$return[$count]['name'] = $update['author']['name'];
|
40 |
+
elseif (!empty($update['author']['first_name']) && !empty($update['author']['last_name'])):
|
41 |
+
$return[$count]['name'] = $update['author']['first_name'] . ' ' . $update['author']['last_name'];
|
42 |
+
else:
|
43 |
+
$return[$count]['name'] = 'Unknown';
|
44 |
+
endif;
|
45 |
+
$return[$count]['subject'] = $update['subject'];
|
46 |
+
$return[$count]['message'] = nl2br($update['message']);
|
47 |
+
$count++;
|
48 |
+
endforeach;
|
49 |
+
|
50 |
+
return $return;
|
51 |
+
}
|
52 |
+
}
|
app/code/community/HusseyCoding/Sirportly/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<HusseyCoding_Sirportly>
|
5 |
-
<version>1.0.
|
6 |
</HusseyCoding_Sirportly>
|
7 |
</modules>
|
8 |
<global>
|
@@ -21,6 +21,11 @@
|
|
21 |
<class>HusseyCoding_Sirportly_Model</class>
|
22 |
</sirportly>
|
23 |
</models>
|
|
|
|
|
|
|
|
|
|
|
24 |
</global>
|
25 |
<frontend>
|
26 |
<routers>
|
@@ -51,5 +56,23 @@
|
|
51 |
</observers>
|
52 |
</core_config_data_save_after>
|
53 |
</events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
</adminhtml>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
</config>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<HusseyCoding_Sirportly>
|
5 |
+
<version>1.0.3</version>
|
6 |
</HusseyCoding_Sirportly>
|
7 |
</modules>
|
8 |
<global>
|
21 |
<class>HusseyCoding_Sirportly_Model</class>
|
22 |
</sirportly>
|
23 |
</models>
|
24 |
+
<blocks>
|
25 |
+
<sirportly>
|
26 |
+
<class>HusseyCoding_Sirportly_Block</class>
|
27 |
+
</sirportly>
|
28 |
+
</blocks>
|
29 |
</global>
|
30 |
<frontend>
|
31 |
<routers>
|
56 |
</observers>
|
57 |
</core_config_data_save_after>
|
58 |
</events>
|
59 |
+
<layout>
|
60 |
+
<updates>
|
61 |
+
<sirportly>
|
62 |
+
<file>sirportly.xml</file>
|
63 |
+
</sirportly>
|
64 |
+
</updates>
|
65 |
+
</layout>
|
66 |
</adminhtml>
|
67 |
+
<admin>
|
68 |
+
<routers>
|
69 |
+
<sirportly>
|
70 |
+
<use>admin</use>
|
71 |
+
<args>
|
72 |
+
<module>HusseyCoding_Sirportly</module>
|
73 |
+
<frontName>sirportly</frontName>
|
74 |
+
</args>
|
75 |
+
</sirportly>
|
76 |
+
</routers>
|
77 |
+
</admin>
|
78 |
</config>
|
app/design/adminhtml/default/default/layout/sirportly.xml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<adminhtml_sales_order_view>
|
4 |
+
<reference name="sales_order_tabs">
|
5 |
+
<action method="addTab">
|
6 |
+
<name>sirportly_tickets</name>
|
7 |
+
<block>sirportly/adminhtml_sales_order_view_tab_sirportlyTickets</block>
|
8 |
+
</action>
|
9 |
+
</reference>
|
10 |
+
<reference name="head">
|
11 |
+
<action method="addItem">
|
12 |
+
<type>skin_js</type>
|
13 |
+
<name>sirportly/js/ordertickets.js</name>
|
14 |
+
</action>
|
15 |
+
<action method="addItem">
|
16 |
+
<type>skin_css</type>
|
17 |
+
<name>sirportly/css/ordertickets.css</name>
|
18 |
+
</action>
|
19 |
+
</reference>
|
20 |
+
</adminhtml_sales_order_view>
|
21 |
+
</layout>
|
app/design/adminhtml/default/default/template/sirportly/sales/order/view/tab/sirportlytickets.phtml
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="entry-edit">
|
2 |
+
<div class="entry-edit-head">
|
3 |
+
<h4 class="icon-head">
|
4 |
+
Ticket history for <?php echo $this->getCustomerName(); ?> (<?php echo $this->getCustomerEmail(); ?>)
|
5 |
+
</h4>
|
6 |
+
</div>
|
7 |
+
<fieldset>
|
8 |
+
<table cellspacing="10" width="100%">
|
9 |
+
<colgroup>
|
10 |
+
<col width="100">
|
11 |
+
<col width="100">
|
12 |
+
</colgroup>
|
13 |
+
<thead>
|
14 |
+
<tr>
|
15 |
+
<th>Status</th>
|
16 |
+
<th>Priority</th>
|
17 |
+
<th>Subject</th>
|
18 |
+
</tr>
|
19 |
+
</thead>
|
20 |
+
<tbody>
|
21 |
+
<?php $count = 0; ?>
|
22 |
+
<?php foreach ($this->getTicketsByEmail() as $ticket): ?>
|
23 |
+
<?php $count++; ?>
|
24 |
+
<tr class="sirportly-ticket-click" onclick="thisordertickets.getUpdates('<?php echo $ticket['reference']; ?>')">
|
25 |
+
<td><?php echo $ticket['status']['name']; ?></td>
|
26 |
+
<td><?php echo $ticket['priority']['name']; ?></td>
|
27 |
+
<td><?php echo $ticket['subject']; ?></td>
|
28 |
+
</tr>
|
29 |
+
<tr id="target-<?php echo $ticket['reference']; ?>" class="sirportly-ticket-target">
|
30 |
+
<td colspan="3"></td>
|
31 |
+
</tr>
|
32 |
+
<?php endforeach; ?>
|
33 |
+
</tbody>
|
34 |
+
</table>
|
35 |
+
</fieldset>
|
36 |
+
</div>
|
37 |
+
<script type="text/javascript">
|
38 |
+
//<![CDATA[
|
39 |
+
var thisordertickets = new ordertickets();
|
40 |
+
thisordertickets.hideTargets();
|
41 |
+
thisordertickets.updateurl = "<?php echo Mage::helper('adminhtml')->getUrl('sirportly/sales_order/sirportlyUpdates'); ?>";
|
42 |
+
//]]>
|
43 |
+
</script>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>HusseyCoding_Sirportly</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Magento to Sirportly integration.</summary>
|
10 |
-
<description>Create Sirportly helpdesk tickets via the Magento contact form, and when payments fail.</description>
|
11 |
-
<notes>
|
12 |
<authors><author><name>Hussey Coding</name><user>husseycoding</user><email>info@husseycoding.co.uk</email></author></authors>
|
13 |
-
<date>2013-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="HusseyCoding"><dir name="Sirportly"><dir name="controllers"><file name="TicketController.php" hash="c3e74986c4d7c79a02a0a8df2564e174"/></dir><dir name="etc"><file name="adminhtml.xml" hash="31ce0056778c58c2430b0b2cccb9b1a5"/><file name="config.xml" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>HusseyCoding_Sirportly</name>
|
4 |
+
<version>1.0.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Magento to Sirportly integration.</summary>
|
10 |
+
<description>Create Sirportly helpdesk tickets via the Magento contact form, and when payments fail. Also view customer tickets on the admin order view page.</description>
|
11 |
+
<notes>Added tickets tab to order view page</notes>
|
12 |
<authors><author><name>Hussey Coding</name><user>husseycoding</user><email>info@husseycoding.co.uk</email></author></authors>
|
13 |
+
<date>2013-10-17</date>
|
14 |
+
<time>08:23:04</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="HusseyCoding"><dir name="Sirportly"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="SirportlyTickets.php" hash="9a4bdbc45f0b1fe4fbd8de88db5bbb1a"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Sales"><file name="OrderController.php" hash="4fdf8bd73ce40473934063ec68207328"/></dir><file name="TicketController.php" hash="c3e74986c4d7c79a02a0a8df2564e174"/></dir><dir name="etc"><file name="adminhtml.xml" hash="31ce0056778c58c2430b0b2cccb9b1a5"/><file name="config.xml" hash="8b63b53e615be2544a3eb207d013c9da"/><file name="system.xml" hash="af6f7f8ac461ac21ada683270f124ad9"/></dir><dir name="Helper"><file name="CheckoutData.php" hash="08531cf50917af39a587802e3876a5f3"/><file name="Data.php" hash="f1eed8b19d4b368faf1021d6be35dc5a"/></dir><dir name="Model"><file name="Observer.php" hash="a14e57ea58ba025f62483efd650b55fa"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Department"><file name="Contact.php" hash="681e7d40a46fec9fc43690b298fc18d6"/></dir><file name="Department.php" hash="f8a708f2e042365bd892bfd1f392fec3"/><dir name="Priority"><file name="Contact.php" hash="3415f060eac9c459afc1b0cef7b0a028"/></dir><file name="Priority.php" hash="682065ee3cdcab991e5fd252730c8640"/><dir name="Status"><file name="Contact.php" hash="47d7f3976f25eff30a2ef816a6682e26"/></dir><file name="Status.php" hash="60fd06d1743463ad345afa2cb1827e9d"/><dir name="Team"><file name="Contact.php" hash="d851dd72b7278cf1b755c8bfba869bcc"/></dir><file name="Team.php" hash="1b1fc5cfb6c50a74a57aba2252f43874"/></dir></dir></dir></dir></dir><dir name="Common"><dir name="etc"><file name="system.xml" hash="6c9ba9f227b9adfc9abf97f17b46fdbf"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="HusseyCoding_Sirportly.xml" hash="a92236145783da6931bf04a2028ae285"/><file name="HusseyCoding_Common.xml" hash="31e82d3d9b3179c2fa9e002f9669da47"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="sirportly.xml" hash="60e4095bd8f1dcf51c3ae0c2daa70147"/></dir><dir name="template"><dir name="sirportly"><file name="contact.phtml" hash="4225d9efe951991fb3a21a276be0f6c7"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="sirportly.xml" hash="9a18dd5ee50b5fcefd4fcd0d8429df82"/></dir><dir name="template"><dir name="sirportly"><dir name="sales"><dir name="order"><dir name="view"><dir name="tab"><file name="sirportlytickets.phtml" hash="5cb478d71bc9c8a086372725f815ccc2"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="js"><file name="sirportlysubmit.js" hash="d6a80d54715f19ff7811a6d9d69daa9a"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="sirportly"><dir name="css"><file name="ordertickets.css" hash="4cb89484b761ab95958207f29cc1e689"/></dir><dir name="js"><file name="ordertickets.js" hash="d040a67d7bb5e9b0f69a1b85c56be2e4"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
skin/adminhtml/default/default/sirportly/css/ordertickets.css
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.sirportly-ticket-click { cursor:pointer; }
|
2 |
+
.sirportly-ticket-target td { padding:15px; border:1px solid #e3e3e3; }
|
3 |
+
.sirportly-ticket-target .ticket-update span { font-weight:bold; width:100px; display:inline-block; }
|
4 |
+
.sirportly-ticket-target .ticket-update-subject { margin-bottom:5px; }
|
5 |
+
.sirportly-ticket-target .ticket-update-message { margin-bottom:10px; padding-bottom:10px; border-bottom:1px solid #e3e3e3; }
|
skin/adminhtml/default/default/sirportly/js/ordertickets.js
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var ordertickets = Class.create({
|
2 |
+
showTarget: function(reference) {
|
3 |
+
$("target-" + reference).show();
|
4 |
+
},
|
5 |
+
hideTarget: function(reference) {
|
6 |
+
$("target-" + reference).hide();
|
7 |
+
},
|
8 |
+
hideTargets: function() {
|
9 |
+
$$("tr.sirportly-ticket-target").each(function(e) {
|
10 |
+
e.hide();
|
11 |
+
}.bind(this));
|
12 |
+
},
|
13 |
+
shouldUpdate: function(reference) {
|
14 |
+
if ($("target-" + reference).visible()) {
|
15 |
+
return false;
|
16 |
+
} else {
|
17 |
+
return true;
|
18 |
+
}
|
19 |
+
},
|
20 |
+
getUpdates: function(reference) {
|
21 |
+
if (this.shouldUpdate(reference)) {
|
22 |
+
var parameters = {reference:reference};
|
23 |
+
new Ajax.Request(this.updateurl, {
|
24 |
+
parameters: parameters,
|
25 |
+
onSuccess: function(response) {
|
26 |
+
var contentarray = response.responseText.evalJSON();
|
27 |
+
if (typeof(contentarray) == "object") {
|
28 |
+
if (contentarray.result == "success") {
|
29 |
+
var updates = contentarray.updates;
|
30 |
+
this.updateTicket(reference, updates);
|
31 |
+
} else {
|
32 |
+
alert("Failed to get updates!")
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}.bind(this)
|
36 |
+
});
|
37 |
+
} else {
|
38 |
+
this.hideTarget(reference);
|
39 |
+
}
|
40 |
+
},
|
41 |
+
updateTicket: function(reference, updates) {
|
42 |
+
var html = "";
|
43 |
+
updates.each(function(e) {
|
44 |
+
html += "<div class=\"ticket-update ticket-update-timestamp\"><span>Timestamp:</span>" + e.timestamp + "</div>";
|
45 |
+
html += "<div class=\"ticket-update ticket-update-name\"><span>Author:</span>" + e.name + "</div>";
|
46 |
+
html += "<div class=\"ticket-update ticket-update-subject\"><span>Subject:</span>" + e.subject + "</div>";
|
47 |
+
html += "<div class=\"ticket-update ticket-update-message\">" + e.message + "</div>";
|
48 |
+
}.bind(this));
|
49 |
+
$("target-" + reference).down().update(html);
|
50 |
+
this.showTarget(reference);
|
51 |
+
}
|
52 |
+
});
|