Magestore_Supportticket - Version 0.2.1

Version Notes

Supportticket

Download this release

Release Info

Developer Magestore
Extension Magestore_Supportticket
Version 0.2.1
Comparing to
See all releases


Version 0.2.1

Files changed (149) hide show
  1. app/code/local/Magestore/Supportticket/Block/Activeemail.php +16 -0
  2. app/code/local/Magestore/Supportticket/Block/Adminhtml/Department.php +12 -0
  3. app/code/local/Magestore/Supportticket/Block/Adminhtml/Department/Edit.php +38 -0
  4. app/code/local/Magestore/Supportticket/Block/Adminhtml/Department/Edit/Form.php +19 -0
  5. app/code/local/Magestore/Supportticket/Block/Adminhtml/Department/Edit/Tab/Form.php +129 -0
  6. app/code/local/Magestore/Supportticket/Block/Adminhtml/Department/Edit/Tabs.php +24 -0
  7. app/code/local/Magestore/Supportticket/Block/Adminhtml/Department/Grid.php +132 -0
  8. app/code/local/Magestore/Supportticket/Block/Adminhtml/Departmentgroup.php +12 -0
  9. app/code/local/Magestore/Supportticket/Block/Adminhtml/Departmentgroup/Edit.php +38 -0
  10. app/code/local/Magestore/Supportticket/Block/Adminhtml/Departmentgroup/Edit/Form.php +19 -0
  11. app/code/local/Magestore/Supportticket/Block/Adminhtml/Departmentgroup/Edit/Tab/Form.php +79 -0
  12. app/code/local/Magestore/Supportticket/Block/Adminhtml/Departmentgroup/Edit/Tabs.php +24 -0
  13. app/code/local/Magestore/Supportticket/Block/Adminhtml/Departmentgroup/Grid.php +126 -0
  14. app/code/local/Magestore/Supportticket/Block/Adminhtml/Statuslog.php +14 -0
  15. app/code/local/Magestore/Supportticket/Block/Adminhtml/Statuslog/Grid.php +82 -0
  16. app/code/local/Magestore/Supportticket/Block/Adminhtml/Supportticket.php +12 -0
  17. app/code/local/Magestore/Supportticket/Block/Adminhtml/Supportticket/Edit.php +45 -0
  18. app/code/local/Magestore/Supportticket/Block/Adminhtml/Supportticket/Edit/Form.php +19 -0
  19. app/code/local/Magestore/Supportticket/Block/Adminhtml/Supportticket/Edit/Tab/Form.php +58 -0
  20. app/code/local/Magestore/Supportticket/Block/Adminhtml/Supportticket/Edit/Tabs.php +24 -0
  21. app/code/local/Magestore/Supportticket/Block/Adminhtml/Supportticket/Grid.php +116 -0
  22. app/code/local/Magestore/Supportticket/Block/Adminhtml/Template.php +12 -0
  23. app/code/local/Magestore/Supportticket/Block/Adminhtml/Template/Edit.php +38 -0
  24. app/code/local/Magestore/Supportticket/Block/Adminhtml/Template/Edit/Form.php +19 -0
  25. app/code/local/Magestore/Supportticket/Block/Adminhtml/Template/Edit/Tab/Form.php +79 -0
  26. app/code/local/Magestore/Supportticket/Block/Adminhtml/Template/Edit/Tabs.php +24 -0
  27. app/code/local/Magestore/Supportticket/Block/Adminhtml/Template/Grid.php +119 -0
  28. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket.php +12 -0
  29. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Assignuser.php +39 -0
  30. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Assignuser/Form.php +19 -0
  31. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Assignuser/Tab/Form.php +28 -0
  32. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Assignuser/Tab/History.php +22 -0
  33. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Assignuser/Tabs.php +24 -0
  34. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Edit.php +56 -0
  35. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Edit/Form.php +19 -0
  36. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Edit/Tab/Form.php +172 -0
  37. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Edit/Tabs.php +24 -0
  38. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Grid.php +215 -0
  39. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Message.php +64 -0
  40. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Message/Form.php +19 -0
  41. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Message/Tab/Form.php +90 -0
  42. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Message/Tab/History.php +22 -0
  43. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Message/Tab/Privatehistory.php +22 -0
  44. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Message/Tab/View.php +22 -0
  45. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Message/Tabs.php +42 -0
  46. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Renderer/Isprivate.php +17 -0
  47. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Renderer/Priority.php +26 -0
  48. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Renderer/Status.php +31 -0
  49. app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Renderer/Tooltip.php +14 -0
  50. app/code/local/Magestore/Supportticket/Block/List.php +73 -0
  51. app/code/local/Magestore/Supportticket/Block/Readmail.php +32 -0
  52. app/code/local/Magestore/Supportticket/Block/Setupemail.php +33 -0
  53. app/code/local/Magestore/Supportticket/Block/Sliderbar.php +89 -0
  54. app/code/local/Magestore/Supportticket/Block/Submit.php +33 -0
  55. app/code/local/Magestore/Supportticket/Block/Ticketform.php +68 -0
  56. app/code/local/Magestore/Supportticket/Block/View.php +46 -0
  57. app/code/local/Magestore/Supportticket/Helper/Data.php +680 -0
  58. app/code/local/Magestore/Supportticket/Model/Department.php +41 -0
  59. app/code/local/Magestore/Supportticket/Model/Departmententity.php +105 -0
  60. app/code/local/Magestore/Supportticket/Model/Departmentgroup.php +44 -0
  61. app/code/local/Magestore/Supportticket/Model/Departmentgroupentity.php +110 -0
  62. app/code/local/Magestore/Supportticket/Model/Email.php +67 -0
  63. app/code/local/Magestore/Supportticket/Model/Mailbox.php +26 -0
  64. app/code/local/Magestore/Supportticket/Model/Message.php +338 -0
  65. app/code/local/Magestore/Supportticket/Model/Mysql4/Department.php +10 -0
  66. app/code/local/Magestore/Supportticket/Model/Mysql4/Department/Collection.php +10 -0
  67. app/code/local/Magestore/Supportticket/Model/Mysql4/Departmententity.php +10 -0
  68. app/code/local/Magestore/Supportticket/Model/Mysql4/Departmententity/Collection.php +10 -0
  69. app/code/local/Magestore/Supportticket/Model/Mysql4/Departmentgroup.php +10 -0
  70. app/code/local/Magestore/Supportticket/Model/Mysql4/Departmentgroup/Collection.php +10 -0
  71. app/code/local/Magestore/Supportticket/Model/Mysql4/Departmentgroupentity.php +10 -0
  72. app/code/local/Magestore/Supportticket/Model/Mysql4/Departmentgroupentity/Collection.php +10 -0
  73. app/code/local/Magestore/Supportticket/Model/Mysql4/Email.php +9 -0
  74. app/code/local/Magestore/Supportticket/Model/Mysql4/Email/Collection.php +9 -0
  75. app/code/local/Magestore/Supportticket/Model/Mysql4/Message.php +10 -0
  76. app/code/local/Magestore/Supportticket/Model/Mysql4/Message/Collection.php +10 -0
  77. app/code/local/Magestore/Supportticket/Model/Mysql4/Statuslog.php +9 -0
  78. app/code/local/Magestore/Supportticket/Model/Mysql4/Statuslog/Collection.php +10 -0
  79. app/code/local/Magestore/Supportticket/Model/Mysql4/Supportticket.php +10 -0
  80. app/code/local/Magestore/Supportticket/Model/Mysql4/Supportticket/Collection.php +10 -0
  81. app/code/local/Magestore/Supportticket/Model/Mysql4/Template.php +10 -0
  82. app/code/local/Magestore/Supportticket/Model/Mysql4/Template/Collection.php +10 -0
  83. app/code/local/Magestore/Supportticket/Model/Mysql4/Templateentity.php +10 -0
  84. app/code/local/Magestore/Supportticket/Model/Mysql4/Templateentity/Collection.php +10 -0
  85. app/code/local/Magestore/Supportticket/Model/Mysql4/Ticket.php +10 -0
  86. app/code/local/Magestore/Supportticket/Model/Mysql4/Ticket/Collection.php +9 -0
  87. app/code/local/Magestore/Supportticket/Model/Observer.php +160 -0
  88. app/code/local/Magestore/Supportticket/Model/Session.php +12 -0
  89. app/code/local/Magestore/Supportticket/Model/Status.php +15 -0
  90. app/code/local/Magestore/Supportticket/Model/Statuslog.php +11 -0
  91. app/code/local/Magestore/Supportticket/Model/Supportticket.php +10 -0
  92. app/code/local/Magestore/Supportticket/Model/Template.php +43 -0
  93. app/code/local/Magestore/Supportticket/Model/Templateentity.php +108 -0
  94. app/code/local/Magestore/Supportticket/Model/Ticket.php +632 -0
  95. app/code/local/Magestore/Supportticket/controllers/Adminhtml/DepartmentController.php +230 -0
  96. app/code/local/Magestore/Supportticket/controllers/Adminhtml/DepartmentgroupController.php +214 -0
  97. app/code/local/Magestore/Supportticket/controllers/Adminhtml/StatuslogController.php +52 -0
  98. app/code/local/Magestore/Supportticket/controllers/Adminhtml/SupportticketController.php +214 -0
  99. app/code/local/Magestore/Supportticket/controllers/Adminhtml/TemplateController.php +224 -0
  100. app/code/local/Magestore/Supportticket/controllers/Adminhtml/TicketController.php +531 -0
  101. app/code/local/Magestore/Supportticket/controllers/EmailController.php +218 -0
  102. app/code/local/Magestore/Supportticket/controllers/ReadmailController.php +31 -0
  103. app/code/local/Magestore/Supportticket/controllers/TicketController.php +220 -0
  104. app/code/local/Magestore/Supportticket/etc/adminhtml.xml +107 -0
  105. app/code/local/Magestore/Supportticket/etc/config.xml +239 -0
  106. app/code/local/Magestore/Supportticket/etc/system.xml +248 -0
  107. app/code/local/Magestore/Supportticket/sql/supportticket_setup/mysql4-install-0.2.0.php +139 -0
  108. app/code/local/Magestore/Supportticket/sql/supportticket_setup/mysql4-install-0.2.1.php +139 -0
  109. app/code/local/Magestore/Supportticket/sql/supportticket_setup/mysql4-upgrade-0.1.0-0.2.0.php +14 -0
  110. app/code/local/Magestore/Supportticket/sql/supportticket_setup/mysql4-upgrade-0.2.0-0.2.1.php +7 -0
  111. app/design/adminhtml/default/default/layout/supportticket.xml +66 -0
  112. app/design/adminhtml/default/default/template/supportticket/message_history.phtml +61 -0
  113. app/design/adminhtml/default/default/template/supportticket/multiupload.phtml +14 -0
  114. app/design/adminhtml/default/default/template/supportticket/private_message_history.phtml +59 -0
  115. app/design/adminhtml/default/default/template/supportticket/view_ticket.phtml +79 -0
  116. app/design/frontend/default/default/layout/supportticket.xml +100 -0
  117. app/design/frontend/default/default/template/supportticket/activeemail.phtml +40 -0
  118. app/design/frontend/default/default/template/supportticket/list.phtml +75 -0
  119. app/design/frontend/default/default/template/supportticket/setupemail.phtml +118 -0
  120. app/design/frontend/default/default/template/supportticket/sliderbar.phtml +23 -0
  121. app/design/frontend/default/default/template/supportticket/submit.phtml +90 -0
  122. app/design/frontend/default/default/template/supportticket/ticketformcontent.phtml +91 -0
  123. app/design/frontend/default/default/template/supportticket/view.phtml +207 -0
  124. app/etc/modules/Magestore_Supportticket.xml +9 -0
  125. app/locale/en_US/template/email/supportticket/admin_assign_ticket.html +39 -0
  126. app/locale/en_US/template/email/supportticket/admin_submit_email_message_to_customer.html +33 -0
  127. app/locale/en_US/template/email/supportticket/admin_submit_message_to_customer.html +43 -0
  128. app/locale/en_US/template/email/supportticket/admin_submit_ticket_to_customer.html +47 -0
  129. app/locale/en_US/template/email/supportticket/customer_confirm_add_email_address.html +39 -0
  130. app/locale/en_US/template/email/supportticket/customer_submit_message.html +43 -0
  131. app/locale/en_US/template/email/supportticket/customer_submit_ticket.html +41 -0
  132. app/locale/en_US/template/email/supportticket/department_new_message.html +43 -0
  133. app/locale/en_US/template/email/supportticket/department_new_ticket.html +47 -0
  134. app/locale/en_US/template/email/supportticket/moderator_close_ticket.html +39 -0
  135. app/locale/en_US/template/email/supportticket/moderator_public_ticket.html +39 -0
  136. js/magestore/supportticket.js +17 -0
  137. js/tinybox/tinybox.js +126 -0
  138. media/supportticket/Copy of staff_avatar.gif +0 -0
  139. media/supportticket/attachment.jpg +0 -0
  140. media/supportticket/customer_avatar.gif +0 -0
  141. media/supportticket/magglass.gif +0 -0
  142. media/supportticket/staff_avatar.gif +0 -0
  143. package.xml +18 -0
  144. skin/adminhtml/default/default/boxes.css +1466 -0
  145. skin/adminhtml/default/default/css/magestore/supportticket.css +100 -0
  146. skin/adminhtml/default/default/css/tinybox/images/preload.gif +0 -0
  147. skin/adminhtml/default/default/css/tinybox/images/rhino.jpg +0 -0
  148. skin/adminhtml/default/default/css/tinybox/style.css +8 -0
  149. skin/frontend/default/default/css/magestore/supportticket.css +16 -0
app/code/local/Magestore/Supportticket/Block/Activeemail.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Activeemail extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
7
+ $breadcrumbs->addCrumb('home', array('label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Home'), 'link'=>Mage::getBaseUrl()));
8
+ $breadcrumbs->addCrumb('supportticket_view_all', array('label'=>Mage::helper('supportticket')->__('Support Ticket'), 'title'=>'Support Ticket', 'link'=>Mage::getUrl("supportticket/ticket")));
9
+ $breadcrumbs->addCrumb('supportticket', array('label'=>Mage::helper('supportticket')->__('Active Email Address'), 'title'=>'Active Email Address', 'link'=>Mage::getUrl("supportticket/email/active")));
10
+
11
+ $headBlock = $this->getLayout()->getBlock('head');
12
+
13
+ $headBlock->setTitle(Mage::helper('supportticket')->__('Support Ticket - Active Email Address'));
14
+ return parent::_prepareLayout();
15
+ }
16
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Department.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Adminhtml_Department extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_department';
7
+ $this->_blockGroup = 'supportticket';
8
+ $this->_headerText = Mage::helper('supportticket')->__('Department Manager');
9
+ $this->_addButtonLabel = Mage::helper('supportticket')->__('Add Department');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Department/Edit.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Department_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'supportticket';
11
+ $this->_controller = 'adminhtml_department';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('supportticket')->__('Save Department'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('supportticket')->__('Delete Department'));
15
+
16
+ $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);
21
+
22
+ $this->_formScripts[] = "
23
+
24
+ function saveAndContinueEdit(){
25
+ editForm.submit($('edit_form').action+'back/edit/');
26
+ }
27
+ ";
28
+ }
29
+
30
+ public function getHeaderText()
31
+ {
32
+ if( Mage::registry('department_data') && Mage::registry('department_data')->getId() ) {
33
+ return Mage::helper('supportticket')->__("Edit Department '%s'", $this->htmlEscape(Mage::registry('department_data')->getDepartmentName()));
34
+ } else {
35
+ return Mage::helper('supportticket')->__('Add Department');
36
+ }
37
+ }
38
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Department/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Department_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'),'store'=>$this->getRequest()->getParam('store'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Department/Edit/Tab/Form.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Department_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('department_form', array('legend'=>Mage::helper('supportticket')->__('Department information')));
10
+
11
+ $store_id = $this->getRequest()->getParam('store');
12
+ if(!$store_id)
13
+ {
14
+ $store_id = 0;
15
+ }
16
+
17
+ $fieldset->addField('department_name', 'text', array(
18
+ 'label' => Mage::helper('supportticket')->__('Name'),
19
+ 'class' => 'required-entry',
20
+ 'required' => true,
21
+ 'name' => 'department_name',
22
+ ));
23
+
24
+
25
+ $fieldset->addField('status', 'select', array(
26
+ 'label' => Mage::helper('supportticket')->__('Status'),
27
+ 'name' => 'status',
28
+ 'values' => array(
29
+ array(
30
+ 'value' => 1,
31
+ 'label' => Mage::helper('supportticket')->__('Enabled'),
32
+ ),
33
+
34
+ array(
35
+ 'value' => 2,
36
+ 'label' => Mage::helper('supportticket')->__('Disabled'),
37
+ ),
38
+ ),
39
+ ));
40
+
41
+ $fieldset->addField('department_email', 'text', array(
42
+ 'label' => Mage::helper('supportticket')->__('Email'),
43
+ 'class' => 'required-entry',
44
+ 'required' => true,
45
+ 'name' => 'department_email',
46
+ ));
47
+ $fieldset->addField('email_password', 'password', array(
48
+ 'label' => Mage::helper('supportticket')->__('Email Password'),
49
+ 'class' => 'required-entry',
50
+ 'required' => true,
51
+ 'name' => 'email_password',
52
+ ));
53
+
54
+ $fieldset->addField('department_code', 'text', array(
55
+ 'label' => Mage::helper('supportticket')->__('Code'),
56
+ 'class' => 'required-entry',
57
+ 'required' => true,
58
+ 'name' => 'department_code',
59
+ ));
60
+
61
+ $fieldset->addField('customer_group_id', 'multiselect', array(
62
+ 'label' => Mage::helper('supportticket')->__('Customer Group'),
63
+ 'name' => 'customer_group_id',
64
+ 'values' => Mage::helper('supportticket')->getCusstomerGroupOptions(),
65
+ ));
66
+
67
+ $fieldset->addField('department_group_id', 'select', array(
68
+ 'label' => Mage::helper('supportticket')->__('Department Group'),
69
+ 'name' => 'department_group_id',
70
+ 'values' => Mage::helper('supportticket')->getDepartmentGroupOptions($store_id),
71
+ ));
72
+
73
+ $fieldset->addField('department_user', 'multiselect', array(
74
+ 'label' => Mage::helper('supportticket')->__('Department User'),
75
+ 'name' => 'department_user',
76
+ 'values' => Mage::helper('supportticket')->getAdminUserOptions(),
77
+ ));
78
+
79
+ $fieldset->addField('department_moderator', 'multiselect', array(
80
+ 'label' => Mage::helper('supportticket')->__('Department Moderator'),
81
+ 'name' => 'department_moderator',
82
+ 'values' => Mage::helper('supportticket')->getAdminUserOptions(),
83
+ ));
84
+
85
+ $fieldset->addField('description', 'editor', array(
86
+ 'name' => 'description',
87
+ 'label' => Mage::helper('supportticket')->__('Description'),
88
+ 'title' => Mage::helper('supportticket')->__('Description'),
89
+ 'style' => 'width:700px; height:150px;',
90
+ 'wysiwyg' => false,
91
+ 'required' => true,
92
+ ));
93
+
94
+
95
+ if(!$store_id)
96
+ {
97
+ $stores = Mage::app()->getStores();
98
+
99
+ if(count($stores) > 1)
100
+ {
101
+ $fieldset->addField('apply_all', 'select', array(
102
+ 'label' => Mage::helper('supportticket')->__('Apply To All Store'),
103
+ 'name' => 'apply_all',
104
+ 'values' => array(
105
+ array(
106
+ 'value' => 0,
107
+ 'label' => Mage::helper('supportticket')->__('No'),
108
+ ),
109
+
110
+ array(
111
+ 'value' => 1,
112
+ 'label' => Mage::helper('supportticket')->__('yes'),
113
+ ),
114
+ ),
115
+ ));
116
+ }
117
+ }
118
+
119
+ if ( Mage::getSingleton('adminhtml/session')->getDepartmentData() )
120
+ {
121
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getDepartmentData());
122
+ Mage::getSingleton('adminhtml/session')->setDepartmentData(null);
123
+ } elseif ( Mage::registry('department_data') ) {
124
+
125
+ $form->setValues(Mage::registry('department_data')->getData());
126
+ }
127
+ return parent::_prepareForm();
128
+ }
129
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Department/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Department_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('supportticket_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('supportticket')->__('Department Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('supportticket')->__('Department Information'),
18
+ 'title' => Mage::helper('supportticket')->__('Department Information'),
19
+ 'content' => $this->getLayout()->createBlock('supportticket/adminhtml_department_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Department/Grid.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Adminhtml_Department_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId('departmentGrid');
8
+ $this->setDefaultSort('department_id');
9
+ $this->setDefaultDir('ASC');
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ protected function _prepareCollection()
14
+ {
15
+ $department = Mage::getModel('supportticket/department');
16
+ $department->setStoreId(0);
17
+ $collection = $department->getCollection();
18
+ if(count($collection))
19
+ {
20
+ foreach($collection as $item)
21
+ {
22
+ $item->setId($item->getEntityId());
23
+ }
24
+ }
25
+ $this->setCollection($collection);
26
+
27
+
28
+ return parent::_prepareCollection();
29
+ }
30
+
31
+ protected function _prepareColumns()
32
+ {
33
+ $this->addColumn('department_id', array(
34
+ 'header' => Mage::helper('supportticket')->__('ID'),
35
+ 'align' =>'right',
36
+ 'width' => '50px',
37
+ 'index' => 'department_id',
38
+ ));
39
+
40
+ $this->addColumn('department_name', array(
41
+ 'header' => Mage::helper('supportticket')->__('Name'),
42
+ 'align' =>'left',
43
+ 'index' => 'department_name',
44
+ ));
45
+
46
+
47
+ $this->addColumn('department_email', array(
48
+ 'header' => Mage::helper('supportticket')->__('Email'),
49
+ 'align' =>'left',
50
+ 'index' => 'department_email',
51
+ ));
52
+
53
+ $this->addColumn('department_code', array(
54
+ 'header' => Mage::helper('supportticket')->__('Code'),
55
+ 'align' =>'left',
56
+ 'index' => 'department_code',
57
+ ));
58
+
59
+
60
+ $this->addColumn('status', array(
61
+ 'header' => Mage::helper('supportticket')->__('Status'),
62
+ 'align' => 'left',
63
+ 'width' => '80px',
64
+ 'index' => 'status',
65
+ 'type' => 'options',
66
+ 'options' => array(
67
+ 1 => 'Enabled',
68
+ 2 => 'Disabled',
69
+ ),
70
+ ));
71
+
72
+ $this->addColumn('action',
73
+ array(
74
+ 'header' => Mage::helper('supportticket')->__('Action'),
75
+ 'width' => '100',
76
+ 'type' => 'action',
77
+ 'getter' => 'getId',
78
+ 'actions' => array(
79
+ array(
80
+ 'caption' => Mage::helper('supportticket')->__('Edit'),
81
+ 'url' => array('base'=> '*/*/edit'),
82
+ 'field' => 'id'
83
+ )
84
+ ),
85
+ 'filter' => false,
86
+ 'sortable' => false,
87
+ 'index' => 'stores',
88
+ 'is_system' => true,
89
+ ));
90
+
91
+ $this->addExportType('*/*/exportCsv', Mage::helper('supportticket')->__('CSV'));
92
+ $this->addExportType('*/*/exportXml', Mage::helper('supportticket')->__('XML'));
93
+
94
+ return parent::_prepareColumns();
95
+ }
96
+
97
+ protected function _prepareMassaction()
98
+ {
99
+ $this->setMassactionIdField('department_id');
100
+ $this->getMassactionBlock()->setFormFieldName('department');
101
+
102
+ $this->getMassactionBlock()->addItem('delete', array(
103
+ 'label' => Mage::helper('supportticket')->__('Delete'),
104
+ 'url' => $this->getUrl('*/*/massDelete'),
105
+ 'confirm' => Mage::helper('supportticket')->__('Are you sure?')
106
+ ));
107
+
108
+ $statuses = Mage::getSingleton('supportticket/status')->getOptionArray();
109
+
110
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
111
+ $this->getMassactionBlock()->addItem('status', array(
112
+ 'label'=> Mage::helper('supportticket')->__('Change status'),
113
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
114
+ 'additional' => array(
115
+ 'visibility' => array(
116
+ 'name' => 'status',
117
+ 'type' => 'select',
118
+ 'class' => 'required-entry',
119
+ 'label' => Mage::helper('supportticket')->__('Status'),
120
+ 'values' => $statuses
121
+ )
122
+ )
123
+ ));
124
+ return $this;
125
+ }
126
+
127
+ public function getRowUrl($row)
128
+ {
129
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
130
+ }
131
+
132
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Departmentgroup.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Adminhtml_Departmentgroup extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_departmentgroup';
7
+ $this->_blockGroup = 'supportticket';
8
+ $this->_headerText = Mage::helper('supportticket')->__('Department Group Manager');
9
+ $this->_addButtonLabel = Mage::helper('supportticket')->__('Add Department Group');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Departmentgroup/Edit.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Departmentgroup_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'supportticket';
11
+ $this->_controller = 'adminhtml_departmentgroup';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('supportticket')->__('Save Department Group'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('supportticket')->__('Delete Department Group'));
15
+
16
+ $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);
21
+
22
+ $this->_formScripts[] = "
23
+
24
+ function saveAndContinueEdit(){
25
+ editForm.submit($('edit_form').action+'back/edit/');
26
+ }
27
+ ";
28
+ }
29
+
30
+ public function getHeaderText()
31
+ {
32
+ if( Mage::registry('departmentgroup_data') && Mage::registry('departmentgroup_data')->getId() ) {
33
+ return Mage::helper('supportticket')->__("Edit Department Group '%s'", $this->htmlEscape(Mage::registry('departmentgroup_data')->getDepartmentGroupName()));
34
+ } else {
35
+ return Mage::helper('supportticket')->__('Add Department Group');
36
+ }
37
+ }
38
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Departmentgroup/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Departmentgroup_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'),'store'=>$this->getRequest()->getParam('store'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Departmentgroup/Edit/Tab/Form.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Departmentgroup_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('departmentgroup_form', array('legend'=>Mage::helper('supportticket')->__('Department Group information')));
10
+
11
+
12
+ $fieldset->addField('department_group_name', 'text', array(
13
+ 'label' => Mage::helper('supportticket')->__('Name'),
14
+ 'class' => 'required-entry',
15
+ 'required' => true,
16
+ 'name' => 'department_group_name',
17
+ ));
18
+
19
+ $fieldset->addField('status', 'select', array(
20
+ 'label' => Mage::helper('supportticket')->__('Status'),
21
+ 'name' => 'status',
22
+ 'values' => array(
23
+ array(
24
+ 'value' => 1,
25
+ 'label' => Mage::helper('supportticket')->__('Enabled'),
26
+ ),
27
+
28
+ array(
29
+ 'value' => 2,
30
+ 'label' => Mage::helper('supportticket')->__('Disabled'),
31
+ ),
32
+ ),
33
+ ));
34
+
35
+ $fieldset->addField('department_group_description', 'editor', array(
36
+ 'name' => 'department_group_description',
37
+ 'label' => Mage::helper('supportticket')->__('Description'),
38
+ 'title' => Mage::helper('supportticket')->__('Description'),
39
+ 'style' => 'width:500px; height:200px;',
40
+ 'wysiwyg' => false,
41
+ 'required' => false,
42
+ ));
43
+
44
+ $store_id = $this->getRequest()->getParam('store');
45
+
46
+ if(!$store_id)
47
+ {
48
+ $stores = Mage::app()->getStores();
49
+ if(count($stores) > 1)
50
+ {
51
+ $fieldset->addField('apply_all', 'select', array(
52
+ 'label' => Mage::helper('supportticket')->__('Apply To All Store'),
53
+ 'name' => 'apply_all',
54
+ 'values' => array(
55
+ array(
56
+ 'value' => 0,
57
+ 'label' => Mage::helper('supportticket')->__('No'),
58
+ ),
59
+
60
+ array(
61
+ 'value' => 1,
62
+ 'label' => Mage::helper('supportticket')->__('yes'),
63
+ ),
64
+ ),
65
+ ));
66
+ }
67
+ }
68
+
69
+ if ( Mage::getSingleton('adminhtml/session')->getDepartmentgroupData() )
70
+ {
71
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getDepartmentgroupData());
72
+ Mage::getSingleton('adminhtml/session')->setDepartmentgroupData(null);
73
+ } elseif ( Mage::registry('departmentgroup_data') ) {
74
+
75
+ $form->setValues(Mage::registry('departmentgroup_data')->getData());
76
+ }
77
+ return parent::_prepareForm();
78
+ }
79
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Departmentgroup/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Departmentgroup_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('supportticket_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('supportticket')->__('Department Group Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('supportticket')->__('Department Group Information'),
18
+ 'title' => Mage::helper('supportticket')->__('Department Group Information'),
19
+ 'content' => $this->getLayout()->createBlock('supportticket/adminhtml_departmentgroup_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Departmentgroup/Grid.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Adminhtml_Departmentgroup_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId('departmentgroupGrid');
8
+ $this->setDefaultSort('department_group_id');
9
+ $this->setDefaultDir('ASC');
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ protected function _prepareCollection()
14
+ {
15
+ $departmentgroup = Mage::getModel('supportticket/departmentgroup');
16
+ $departmentgroup->setStoreId(0);
17
+ $collection = $departmentgroup->getCollection();
18
+ if(count($collection))
19
+ {
20
+ foreach($collection as $item)
21
+ {
22
+ $item->setId($item->getEntityId());
23
+ }
24
+ }
25
+ $this->setCollection($collection);
26
+
27
+
28
+ return parent::_prepareCollection();
29
+ }
30
+
31
+ protected function _prepareColumns()
32
+ {
33
+ $this->addColumn('department_group_id', array(
34
+ 'header' => Mage::helper('supportticket')->__('ID'),
35
+ 'align' =>'right',
36
+ 'width' => '50px',
37
+ 'index' => 'department_group_id',
38
+ ));
39
+
40
+ $this->addColumn('department_group_name', array(
41
+ 'header' => Mage::helper('supportticket')->__('Name'),
42
+ 'align' =>'left',
43
+ 'index' => 'department_group_name',
44
+ ));
45
+
46
+
47
+ $this->addColumn('department_group_description', array(
48
+ 'header' => Mage::helper('supportticket')->__('Description'),
49
+ 'width' => '150px',
50
+ 'index' => 'department_group_description',
51
+ ));
52
+
53
+
54
+ $this->addColumn('status', array(
55
+ 'header' => Mage::helper('supportticket')->__('Status'),
56
+ 'align' => 'left',
57
+ 'width' => '80px',
58
+ 'index' => 'status',
59
+ 'type' => 'options',
60
+ 'options' => array(
61
+ 1 => 'Enabled',
62
+ 2 => 'Disabled',
63
+ ),
64
+ ));
65
+
66
+ $this->addColumn('action',
67
+ array(
68
+ 'header' => Mage::helper('supportticket')->__('Action'),
69
+ 'width' => '100',
70
+ 'type' => 'action',
71
+ 'getter' => 'getId',
72
+ 'actions' => array(
73
+ array(
74
+ 'caption' => Mage::helper('supportticket')->__('Edit'),
75
+ 'url' => array('base'=> '*/*/edit'),
76
+ 'field' => 'id'
77
+ )
78
+ ),
79
+ 'filter' => false,
80
+ 'sortable' => false,
81
+ 'index' => 'stores',
82
+ 'is_system' => true,
83
+ ));
84
+
85
+ $this->addExportType('*/*/exportCsv', Mage::helper('supportticket')->__('CSV'));
86
+ $this->addExportType('*/*/exportXml', Mage::helper('supportticket')->__('XML'));
87
+
88
+ return parent::_prepareColumns();
89
+ }
90
+
91
+ protected function _prepareMassaction()
92
+ {
93
+ $this->setMassactionIdField('department_group_id');
94
+ $this->getMassactionBlock()->setFormFieldName('departmentgroup');
95
+
96
+ $this->getMassactionBlock()->addItem('delete', array(
97
+ 'label' => Mage::helper('supportticket')->__('Delete'),
98
+ 'url' => $this->getUrl('*/*/massDelete'),
99
+ 'confirm' => Mage::helper('supportticket')->__('Are you sure?')
100
+ ));
101
+
102
+ $statuses = Mage::getSingleton('supportticket/status')->getOptionArray();
103
+
104
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
105
+ $this->getMassactionBlock()->addItem('status', array(
106
+ 'label'=> Mage::helper('supportticket')->__('Change status'),
107
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
108
+ 'additional' => array(
109
+ 'visibility' => array(
110
+ 'name' => 'status',
111
+ 'type' => 'select',
112
+ 'class' => 'required-entry',
113
+ 'label' => Mage::helper('supportticket')->__('Status'),
114
+ 'values' => $statuses
115
+ )
116
+ )
117
+ ));
118
+ return $this;
119
+ }
120
+
121
+ public function getRowUrl($row)
122
+ {
123
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
124
+ }
125
+
126
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Statuslog.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Adminhtml_Statuslog extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_statuslog';
7
+ $this->_blockGroup = 'supportticket';
8
+ $this->_headerText = Mage::helper('supportticket')->__('StatusLog Manager');
9
+ //$this->_addButtonLabel = Mage::helper('supportticket')->__('Add StatusLog');
10
+
11
+ parent::__construct();
12
+ $this->_removeButton('add');
13
+ }
14
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Statuslog/Grid.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Adminhtml_Statuslog_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId('statuslogGrid');
8
+ $this->setDefaultSort('status_log_id');
9
+ $this->setDefaultDir('ASC');
10
+ $this->setSaveParametersInSession(true);
11
+
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $statuslog = Mage::getModel('supportticket/statuslog');
17
+ $collection = $statuslog->getCollection();
18
+ if(count($collection))
19
+ {
20
+ foreach($collection as $item)
21
+ {
22
+ $ticket = Mage::getModel("supportticket/ticket")->load($item->getTicketId());
23
+ $item->setTicketCode($ticket->getTicketCode());
24
+ $item->setTicketTitle($ticket->getTicketTitle());
25
+ }
26
+ }
27
+ $this->setCollection($collection);
28
+
29
+ return parent::_prepareCollection();
30
+ }
31
+
32
+ protected function _prepareColumns()
33
+ {
34
+ $this->addColumn('status_log_id', array(
35
+ 'header' => Mage::helper('supportticket')->__('ID'),
36
+ 'align' =>'right',
37
+ 'width' => '50px',
38
+ 'index' => 'status_log_id',
39
+ ));
40
+
41
+ $this->addColumn('ticket_code', array(
42
+ 'header' => Mage::helper('supportticket')->__('Ticket Code'),
43
+ 'align' =>'left',
44
+ 'index' => 'ticket_code',
45
+ 'filter' => false
46
+ ));
47
+
48
+
49
+ $this->addColumn('ticket_title', array(
50
+ 'header' => Mage::helper('supportticket')->__('Ticket Title'),
51
+ 'align' =>'left',
52
+ 'index' => 'ticket_title',
53
+ 'filter' => false
54
+ ));
55
+
56
+ $this->addColumn('admin_user', array(
57
+ 'header' => Mage::helper('supportticket')->__('Admin User'),
58
+ 'align' =>'left',
59
+ 'index' => 'admin_user',
60
+ ));
61
+
62
+ $this->addColumn('action', array(
63
+ 'header' => Mage::helper('supportticket')->__('Action'),
64
+ 'align' =>'left',
65
+ 'index' => 'action',
66
+ ));
67
+
68
+ $this->addColumn('time', array(
69
+ 'header' => Mage::helper('supportticket')->__('Time'),
70
+ 'align' =>'left',
71
+ 'index' => 'time',
72
+ ));
73
+
74
+ return parent::_prepareColumns();
75
+ }
76
+
77
+ public function getRowUrl($row)
78
+ {
79
+ return $this->getUrl('*/adminhtml_ticket/edit', array('id' => $row->getTicketId()));
80
+ }
81
+
82
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Supportticket.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Adminhtml_Supportticket extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_supportticket';
7
+ $this->_blockGroup = 'supportticket';
8
+ $this->_headerText = Mage::helper('supportticket')->__('Item Manager');
9
+ $this->_addButtonLabel = Mage::helper('supportticket')->__('Add Item');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Supportticket/Edit.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Supportticket_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'supportticket';
11
+ $this->_controller = 'adminhtml_supportticket';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('supportticket')->__('Save Item'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('supportticket')->__('Delete Item'));
15
+
16
+ $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);
21
+
22
+ $this->_formScripts[] = "
23
+ function toggleEditor() {
24
+ if (tinyMCE.getInstanceById('supportticket_content') == null) {
25
+ tinyMCE.execCommand('mceAddControl', false, 'supportticket_content');
26
+ } else {
27
+ tinyMCE.execCommand('mceRemoveControl', false, 'supportticket_content');
28
+ }
29
+ }
30
+
31
+ function saveAndContinueEdit(){
32
+ editForm.submit($('edit_form').action+'back/edit/');
33
+ }
34
+ ";
35
+ }
36
+
37
+ public function getHeaderText()
38
+ {
39
+ if( Mage::registry('supportticket_data') && Mage::registry('supportticket_data')->getId() ) {
40
+ return Mage::helper('supportticket')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('supportticket_data')->getTitle()));
41
+ } else {
42
+ return Mage::helper('supportticket')->__('Add Item');
43
+ }
44
+ }
45
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Supportticket/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Supportticket_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Supportticket/Edit/Tab/Form.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Supportticket_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('supportticket_form', array('legend'=>Mage::helper('supportticket')->__('Item information')));
10
+
11
+ $fieldset->addField('title', 'text', array(
12
+ 'label' => Mage::helper('supportticket')->__('Title'),
13
+ 'class' => 'required-entry',
14
+ 'required' => true,
15
+ 'name' => 'title',
16
+ ));
17
+
18
+ $fieldset->addField('filename', 'file', array(
19
+ 'label' => Mage::helper('supportticket')->__('File'),
20
+ 'required' => false,
21
+ 'name' => 'filename',
22
+ ));
23
+
24
+ $fieldset->addField('status', 'select', array(
25
+ 'label' => Mage::helper('supportticket')->__('Status'),
26
+ 'name' => 'status',
27
+ 'values' => array(
28
+ array(
29
+ 'value' => 1,
30
+ 'label' => Mage::helper('supportticket')->__('Enabled'),
31
+ ),
32
+
33
+ array(
34
+ 'value' => 2,
35
+ 'label' => Mage::helper('supportticket')->__('Disabled'),
36
+ ),
37
+ ),
38
+ ));
39
+
40
+ $fieldset->addField('content', 'editor', array(
41
+ 'name' => 'content',
42
+ 'label' => Mage::helper('supportticket')->__('Content'),
43
+ 'title' => Mage::helper('supportticket')->__('Content'),
44
+ 'style' => 'width:700px; height:500px;',
45
+ 'wysiwyg' => false,
46
+ 'required' => true,
47
+ ));
48
+
49
+ if ( Mage::getSingleton('adminhtml/session')->getSupportticketData() )
50
+ {
51
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getSupportticketData());
52
+ Mage::getSingleton('adminhtml/session')->setSupportticketData(null);
53
+ } elseif ( Mage::registry('supportticket_data') ) {
54
+ $form->setValues(Mage::registry('supportticket_data')->getData());
55
+ }
56
+ return parent::_prepareForm();
57
+ }
58
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Supportticket/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Supportticket_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('supportticket_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('supportticket')->__('Item Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('supportticket')->__('Item Information'),
18
+ 'title' => Mage::helper('supportticket')->__('Item Information'),
19
+ 'content' => $this->getLayout()->createBlock('supportticket/adminhtml_supportticket_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Supportticket/Grid.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Supportticket_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('supportticketGrid');
9
+ $this->setDefaultSort('supportticket_id');
10
+ $this->setDefaultDir('ASC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('supportticket/supportticket')->getCollection();
17
+ $this->setCollection($collection);
18
+ return parent::_prepareCollection();
19
+ }
20
+
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn('supportticket_id', array(
24
+ 'header' => Mage::helper('supportticket')->__('ID'),
25
+ 'align' =>'right',
26
+ 'width' => '50px',
27
+ 'index' => 'supportticket_id',
28
+ ));
29
+
30
+ $this->addColumn('title', array(
31
+ 'header' => Mage::helper('supportticket')->__('Title'),
32
+ 'align' =>'left',
33
+ 'index' => 'title',
34
+ ));
35
+
36
+ /*
37
+ $this->addColumn('content', array(
38
+ 'header' => Mage::helper('supportticket')->__('Item Content'),
39
+ 'width' => '150px',
40
+ 'index' => 'content',
41
+ ));
42
+ */
43
+
44
+ $this->addColumn('status', array(
45
+ 'header' => Mage::helper('supportticket')->__('Status'),
46
+ 'align' => 'left',
47
+ 'width' => '80px',
48
+ 'index' => 'status',
49
+ 'type' => 'options',
50
+ 'options' => array(
51
+ 1 => 'Enabled',
52
+ 2 => 'Disabled',
53
+ ),
54
+ ));
55
+
56
+ $this->addColumn('action',
57
+ array(
58
+ 'header' => Mage::helper('supportticket')->__('Action'),
59
+ 'width' => '100',
60
+ 'type' => 'action',
61
+ 'getter' => 'getId',
62
+ 'actions' => array(
63
+ array(
64
+ 'caption' => Mage::helper('supportticket')->__('Edit'),
65
+ 'url' => array('base'=> '*/*/edit'),
66
+ 'field' => 'id'
67
+ )
68
+ ),
69
+ 'filter' => false,
70
+ 'sortable' => false,
71
+ 'index' => 'stores',
72
+ 'is_system' => true,
73
+ ));
74
+
75
+ $this->addExportType('*/*/exportCsv', Mage::helper('supportticket')->__('CSV'));
76
+ $this->addExportType('*/*/exportXml', Mage::helper('supportticket')->__('XML'));
77
+
78
+ return parent::_prepareColumns();
79
+ }
80
+
81
+ protected function _prepareMassaction()
82
+ {
83
+ $this->setMassactionIdField('supportticket_id');
84
+ $this->getMassactionBlock()->setFormFieldName('supportticket');
85
+
86
+ $this->getMassactionBlock()->addItem('delete', array(
87
+ 'label' => Mage::helper('supportticket')->__('Delete'),
88
+ 'url' => $this->getUrl('*/*/massDelete'),
89
+ 'confirm' => Mage::helper('supportticket')->__('Are you sure?')
90
+ ));
91
+
92
+ $statuses = Mage::getSingleton('supportticket/status')->getOptionArray();
93
+
94
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
95
+ $this->getMassactionBlock()->addItem('status', array(
96
+ 'label'=> Mage::helper('supportticket')->__('Change status'),
97
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
98
+ 'additional' => array(
99
+ 'visibility' => array(
100
+ 'name' => 'status',
101
+ 'type' => 'select',
102
+ 'class' => 'required-entry',
103
+ 'label' => Mage::helper('supportticket')->__('Status'),
104
+ 'values' => $statuses
105
+ )
106
+ )
107
+ ));
108
+ return $this;
109
+ }
110
+
111
+ public function getRowUrl($row)
112
+ {
113
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
114
+ }
115
+
116
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Template.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Adminhtml_Template extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_template';
7
+ $this->_blockGroup = 'supportticket';
8
+ $this->_headerText = Mage::helper('supportticket')->__('Template Manager');
9
+ $this->_addButtonLabel = Mage::helper('supportticket')->__('Add Template');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Template/Edit.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Template_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'supportticket';
11
+ $this->_controller = 'adminhtml_template';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('supportticket')->__('Save Template'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('supportticket')->__('Delete Template'));
15
+
16
+ $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);
21
+
22
+ $this->_formScripts[] = "
23
+
24
+ function saveAndContinueEdit(){
25
+ editForm.submit($('edit_form').action+'back/edit/');
26
+ }
27
+ ";
28
+ }
29
+
30
+ public function getHeaderText()
31
+ {
32
+ if( Mage::registry('template_data') && Mage::registry('template_data')->getId() ) {
33
+ return Mage::helper('supportticket')->__("Edit Template '%s'", $this->htmlEscape(Mage::registry('template_data')->getTemplateName()));
34
+ } else {
35
+ return Mage::helper('supportticket')->__('Add Template');
36
+ }
37
+ }
38
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Template/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Template_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'),'store'=>$this->getRequest()->getParam('store'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Template/Edit/Tab/Form.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Template_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('template_form', array('legend'=>Mage::helper('supportticket')->__('Template information')));
10
+
11
+
12
+ $fieldset->addField('template_name', 'text', array(
13
+ 'label' => Mage::helper('supportticket')->__('Name'),
14
+ 'class' => 'required-entry',
15
+ 'required' => true,
16
+ 'name' => 'template_name',
17
+ ));
18
+
19
+ $fieldset->addField('status', 'select', array(
20
+ 'label' => Mage::helper('supportticket')->__('Status'),
21
+ 'name' => 'status',
22
+ 'values' => array(
23
+ array(
24
+ 'value' => 1,
25
+ 'label' => Mage::helper('supportticket')->__('Enabled'),
26
+ ),
27
+
28
+ array(
29
+ 'value' => 0,
30
+ 'label' => Mage::helper('supportticket')->__('Disabled'),
31
+ ),
32
+ ),
33
+ ));
34
+
35
+ $fieldset->addField('content', 'editor', array(
36
+ 'name' => 'content',
37
+ 'label' => Mage::helper('supportticket')->__('Content'),
38
+ 'title' => Mage::helper('supportticket')->__('Content'),
39
+ 'style' => 'width:700px; height:200px;',
40
+ 'wysiwyg' => false,
41
+ 'required' => false,
42
+ ));
43
+
44
+ $store_id = $this->getRequest()->getParam('store');
45
+
46
+ if(!$store_id)
47
+ {
48
+ $stores = Mage::app()->getStores();
49
+ if(count($stores) > 1)
50
+ {
51
+ $fieldset->addField('apply_all', 'select', array(
52
+ 'label' => Mage::helper('supportticket')->__('Apply To All Store'),
53
+ 'name' => 'apply_all',
54
+ 'values' => array(
55
+ array(
56
+ 'value' => 0,
57
+ 'label' => Mage::helper('supportticket')->__('No'),
58
+ ),
59
+
60
+ array(
61
+ 'value' => 1,
62
+ 'label' => Mage::helper('supportticket')->__('yes'),
63
+ ),
64
+ ),
65
+ ));
66
+ }
67
+ }
68
+
69
+ if ( Mage::getSingleton('adminhtml/session')->getTemplateData() )
70
+ {
71
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getTemplateData());
72
+ Mage::getSingleton('adminhtml/session')->setTemplateData(null);
73
+ } elseif ( Mage::registry('template_data') ) {
74
+
75
+ $form->setValues(Mage::registry('template_data')->getData());
76
+ }
77
+ return parent::_prepareForm();
78
+ }
79
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Template/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Template_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('supportticket_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('supportticket')->__('Template Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('supportticket')->__('Template Information'),
18
+ 'title' => Mage::helper('supportticket')->__('Template Information'),
19
+ 'content' => $this->getLayout()->createBlock('supportticket/adminhtml_template_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Template/Grid.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Adminhtml_Template_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId('templateGrid');
8
+ $this->setDefaultSort('template_id');
9
+ $this->setDefaultDir('DESC');
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ protected function _prepareCollection()
14
+ {
15
+ $template = Mage::getModel('supportticket/template');
16
+ $template->setStoreId(0);
17
+ $collection = $template->getCollection();
18
+ if(count($collection))
19
+ {
20
+ foreach($collection as $item)
21
+ {
22
+ $item->setId($item->getEntityId());
23
+ }
24
+ }
25
+ $this->setCollection($collection);
26
+
27
+
28
+ return parent::_prepareCollection();
29
+ }
30
+
31
+ protected function _prepareColumns()
32
+ {
33
+ $this->addColumn('template_id', array(
34
+ 'header' => Mage::helper('supportticket')->__('ID'),
35
+ 'align' =>'right',
36
+ 'width' => '50px',
37
+ 'index' => 'template_id',
38
+ ));
39
+
40
+ $this->addColumn('template_name', array(
41
+ 'header' => Mage::helper('supportticket')->__('Name'),
42
+ 'align' =>'left',
43
+ 'index' => 'template_name',
44
+ ));
45
+
46
+
47
+ $this->addColumn('status', array(
48
+ 'header' => Mage::helper('supportticket')->__('Status'),
49
+ 'align' => 'left',
50
+ 'width' => '80px',
51
+ 'index' => 'status',
52
+ 'type' => 'options',
53
+ 'options' => array(
54
+ 1 => 'Enabled',
55
+ 0 => 'Disabled',
56
+ ),
57
+ ));
58
+
59
+ $this->addColumn('action',
60
+ array(
61
+ 'header' => Mage::helper('supportticket')->__('Action'),
62
+ 'width' => '100',
63
+ 'type' => 'action',
64
+ 'getter' => 'getId',
65
+ 'actions' => array(
66
+ array(
67
+ 'caption' => Mage::helper('supportticket')->__('Edit'),
68
+ 'url' => array('base'=> '*/*/edit'),
69
+ 'field' => 'id'
70
+ )
71
+ ),
72
+ 'filter' => false,
73
+ 'sortable' => false,
74
+ 'index' => 'stores',
75
+ 'is_system' => true,
76
+ ));
77
+
78
+ $this->addExportType('*/*/exportCsv', Mage::helper('supportticket')->__('CSV'));
79
+ $this->addExportType('*/*/exportXml', Mage::helper('supportticket')->__('XML'));
80
+
81
+ return parent::_prepareColumns();
82
+ }
83
+
84
+ protected function _prepareMassaction()
85
+ {
86
+ $this->setMassactionIdField('template_id');
87
+ $this->getMassactionBlock()->setFormFieldName('template');
88
+
89
+ $this->getMassactionBlock()->addItem('delete', array(
90
+ 'label' => Mage::helper('supportticket')->__('Delete'),
91
+ 'url' => $this->getUrl('*/*/massDelete'),
92
+ 'confirm' => Mage::helper('supportticket')->__('Are you sure?')
93
+ ));
94
+
95
+ $statuses = Mage::getSingleton('supportticket/status')->getOptionArray();
96
+
97
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
98
+ $this->getMassactionBlock()->addItem('status', array(
99
+ 'label'=> Mage::helper('supportticket')->__('Change status'),
100
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
101
+ 'additional' => array(
102
+ 'visibility' => array(
103
+ 'name' => 'status',
104
+ 'type' => 'select',
105
+ 'class' => 'required-entry',
106
+ 'label' => Mage::helper('supportticket')->__('Status'),
107
+ 'values' => $statuses
108
+ )
109
+ )
110
+ ));
111
+ return $this;
112
+ }
113
+
114
+ public function getRowUrl($row)
115
+ {
116
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
117
+ }
118
+
119
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Adminhtml_Ticket extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_ticket';
7
+ $this->_blockGroup = 'supportticket';
8
+ $this->_headerText = Mage::helper('supportticket')->__('Ticket Manager');
9
+ $this->_addButtonLabel = Mage::helper('supportticket')->__('Add Ticket');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Assignuser.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Assignuser extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'supportticket';
11
+ $this->_controller = 'adminhtml_ticket';
12
+
13
+
14
+ $this->_removeButton('delete', 'label');
15
+ $this->_removeButton('save', 'label');
16
+ $this->_removeButton('reset', 'label');
17
+
18
+ $this->_addButton('saveandcontinue', array(
19
+ 'label' => Mage::helper('adminhtml')->__('Save'),
20
+ 'onclick' => 'saveAndContinueEdit()',
21
+ 'class' => 'save',
22
+ ), -100);
23
+ $id = $this->getRequest()->getParam('id');
24
+ $this->_formScripts[] = "
25
+ $('edit_form').action='". $this->getUrl('*/' . $this->_controller . '/assignuser/id/'.$id) ."';
26
+
27
+ function saveAndContinueEdit(){
28
+ editForm.submit($('edit_form').action);
29
+ }
30
+ ";
31
+ }
32
+
33
+ public function getHeaderText()
34
+ {
35
+
36
+ return Mage::helper('supportticket')->__('Ticket\'s User Manager');
37
+
38
+ }
39
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Assignuser/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Assignuser_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/assignuser', array('id' => $this->getRequest()->getParam('id'),'store'=>$this->getRequest()->getParam('store'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Assignuser/Tab/Form.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Assignuser_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('ticket_form', array('legend'=>Mage::helper('supportticket')->__('Assign User')));
10
+
11
+ $fieldset->addField('assigned_user', 'multiselect', array(
12
+ 'label' => Mage::helper('supportticket')->__('Assigned To'),
13
+ 'name' => 'assigned_user',
14
+ 'values' => Mage::helper('supportticket')->getDepartmentModeratorOptions(Mage::registry('ticket_id')),
15
+ ));
16
+
17
+ if ( Mage::getSingleton('adminhtml/session')->getTicketData() )
18
+ {
19
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getTicketData());
20
+ Mage::getSingleton('adminhtml/session')->setTicketData(null);
21
+ } elseif ( Mage::registry('ticket_data') ) {
22
+
23
+ $form->setValues(Mage::registry('ticket_data')->getData());
24
+ }
25
+
26
+ return parent::_prepareForm();
27
+ }
28
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Assignuser/Tab/History.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Message_Tab_History extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate('supportticket/message_history.phtml');
9
+ }
10
+
11
+ /*
12
+
13
+ */
14
+ protected function _prepareForm()
15
+ {
16
+ $form = new Varien_Data_Form();
17
+ $this->setForm($form);
18
+ $fieldset = $form->addFieldset('ticket_form', array('legend'=>Mage::helper('supportticket')->__('View Posted Message')));
19
+
20
+ return parent::_prepareForm();
21
+ }
22
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Assignuser/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Assignuser_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('supportticket_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('supportticket')->__('Ticket\'s User Manager'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('supportticket')->__('User Manager'),
18
+ 'title' => Mage::helper('supportticket')->__('User Manager'),
19
+ 'content' => $this->getLayout()->createBlock('supportticket/adminhtml_ticket_assignuser_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Edit.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'supportticket';
11
+ $this->_controller = 'adminhtml_ticket';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('supportticket')->__('Save Ticket'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('supportticket')->__('Delete Ticket'));
15
+
16
+ $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);
21
+
22
+ $this->_formScripts[] = "
23
+ var update_department_url;
24
+ var insert_template_url;
25
+
26
+ update_department_url = '". $this->getUrl("*/" . $this->_controller . "/updatedepartment") . "';
27
+ insert_template_url = '". $this->getUrl("*/adminhtml_template/inserttemplate") . "';
28
+
29
+ function saveAndContinueEdit(){
30
+ editForm.submit($('edit_form').action+'back/edit/');
31
+ }
32
+
33
+ function updateDepartment()
34
+ {
35
+ var store_id;
36
+ store_id = $('store').value;
37
+ new Ajax.Updater('department_id', update_department_url, {parameters: { store: store_id },method: 'post', onFailure: ''});
38
+ }
39
+
40
+ function insertTemplateToTicket(){
41
+ var template_id;
42
+ template_id = $('template_id').value;
43
+ new Ajax.Updater('content', insert_template_url, {parameters: { template_id: template_id },method: 'post', onFailure: ''});
44
+ }
45
+ ";
46
+ }
47
+
48
+ public function getHeaderText()
49
+ {
50
+ if( Mage::registry('ticket_data') && Mage::registry('ticket_data')->getId() ) {
51
+ return Mage::helper('supportticket')->__("Edit Ticket '%s'", $this->htmlEscape(Mage::registry('ticket_data')->getTicketTitle()));
52
+ } else {
53
+ return Mage::helper('supportticket')->__('Add Ticket');
54
+ }
55
+ }
56
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'),'store'=>$this->getRequest()->getParam('store'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Edit/Tab/Form.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('ticket_form', array('legend'=>Mage::helper('supportticket')->__('Ticket information')));
10
+
11
+ $store_id = $this->getRequest()->getParam('store');
12
+ if(!$store_id)
13
+ {
14
+ $store_id = 0;
15
+ }
16
+ $department_id = 0;
17
+
18
+ $old_attachment = "";
19
+ if ( Mage::getSingleton('adminhtml/session')->getTicketData() )
20
+ {
21
+ $values = Mage::getSingleton('adminhtml/session')->getTicketData();
22
+ if(isset($values['department_id']))
23
+ {
24
+ $department_id = $values['department_id'];
25
+ }
26
+ if(isset($values['attachment']) && $values['attachment'])
27
+ {
28
+ $old_attachment = $values['attachment'];
29
+ $old_attachment = explode(";",$old_attachment);
30
+ if(count($old_attachment) == 2)
31
+ {
32
+ $old_attachment = "<br>" . $old_attachment[0];
33
+ }
34
+ }
35
+
36
+ }
37
+ elseif ( Mage::registry('ticket_data') )
38
+ {
39
+ $values = Mage::registry('ticket_data')->getData();
40
+ if(isset($values['attachment']) && $values['attachment'])
41
+ {
42
+ $old_attachment = " <br> ".$values['attachment'];
43
+ }
44
+ if(isset($values['department_id']))
45
+ {
46
+ $department_id = $values['department_id'];
47
+ }
48
+ }
49
+
50
+ if($department_id)
51
+ {
52
+ $department = Mage::getModel("supportticket/department")->load($department_id);
53
+ if($department->getStoreId())
54
+ {
55
+ $store_id = $department->getStoreId();
56
+ }
57
+ }
58
+
59
+
60
+ $fieldset->addField('is_private', 'select', array(
61
+ 'label' => Mage::helper('supportticket')->__('Is Private'),
62
+ 'name' => 'is_private',
63
+ 'values' => array(
64
+ array(
65
+ 'value' => 0,
66
+ 'label' => Mage::helper('supportticket')->__('No'),
67
+ ),
68
+
69
+ array(
70
+ 'value' => 1,
71
+ 'label' => Mage::helper('supportticket')->__('Yes'),
72
+ ),
73
+ ),
74
+ ));
75
+
76
+
77
+ $fieldset->addField('status', 'select', array(
78
+ 'label' => Mage::helper('supportticket')->__('Status'),
79
+ 'name' => 'status',
80
+ 'values' => Mage::helper('supportticket')->getTicketStatusList()
81
+ ));
82
+
83
+ $fieldset->addField('priority', 'select', array(
84
+ 'label' => Mage::helper('supportticket')->__('Priority'),
85
+ 'name' => 'priority',
86
+ 'values' => Mage::helper('supportticket')->getPriorityOptions()
87
+ ));
88
+
89
+ $fieldset->addField('store', 'select', array(
90
+ 'label' => Mage::helper('supportticket')->__('Store'),
91
+ 'name' => 'store',
92
+ 'onchange' => 'updateDepartment()',
93
+ 'values' => Mage::helper('supportticket')->getStoreOptions(),
94
+ ));
95
+
96
+ $fieldset->addField('department_id', 'select', array(
97
+ 'label' => Mage::helper('supportticket')->__('Department'),
98
+ 'name' => 'department_id',
99
+ 'values' => Mage::helper('supportticket')->getDepartmentOptions($store_id),
100
+ ));
101
+
102
+ $fieldset->addField('ticket_title', 'text', array(
103
+ 'label' => Mage::helper('supportticket')->__('Title'),
104
+ 'class' => 'required-entry',
105
+ 'required' => true,
106
+ 'name' => 'ticket_title',
107
+ ));
108
+
109
+ $fieldset->addField('customer_name', 'text', array(
110
+ 'label' => Mage::helper('supportticket')->__('Customer Name'),
111
+
112
+ 'required' => false,
113
+ 'name' => 'customer_name',
114
+ ));
115
+
116
+ $fieldset->addField('customer_email', 'text', array(
117
+ 'label' => Mage::helper('supportticket')->__('Customer Email'),
118
+
119
+ 'required' => false,
120
+ 'name' => 'customer_email',
121
+ ));
122
+
123
+
124
+ $fieldset->addField('ticket_content', 'editor', array(
125
+ 'name' => 'ticket_content',
126
+ 'label' => Mage::helper('supportticket')->__('Content'),
127
+ 'title' => Mage::helper('supportticket')->__('Content'),
128
+ 'style' => 'width:600px; height:150px;',
129
+ 'wysiwyg' => false,
130
+ 'required' => true,
131
+ ));
132
+
133
+
134
+ $fieldset->addField('attachment', 'note', array(
135
+ 'label' => Mage::helper('supportticket')->__('Attachment'),
136
+ 'required' => false,
137
+ 'name' => 'attachment',
138
+ 'text' => $this->getLayout()->createBlock('core/template')->setTemplate('supportticket/multiupload.phtml')->toHtml(),
139
+ ));
140
+ $fieldset->addField('template_id', 'select', array(
141
+ 'label' => Mage::helper('supportticket')->__('Message Template'),
142
+ 'name' => 'template_id',
143
+ 'onchange' => 'insertTemplateToTicket()',
144
+ 'values' => Mage::helper('supportticket')->getTemplateOptionsByMessage($store_id),
145
+ ));
146
+
147
+ $old_attachment = "";
148
+ if ( Mage::getSingleton('adminhtml/session')->getTicketData() )
149
+ {
150
+ $values = Mage::getSingleton('adminhtml/session')->getTicketData();
151
+
152
+ if(isset($values['attachment']) && $values['attachment'])
153
+ {
154
+ $old_attachment = " - ".$values['attachment'];
155
+ }
156
+
157
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getTicketData());
158
+ Mage::getSingleton('adminhtml/session')->setTicketData(null);
159
+ }
160
+ elseif ( Mage::registry('ticket_data') )
161
+ {
162
+ $values = Mage::registry('ticket_data')->getData();
163
+ if(isset($values['attachment']) && $values['attachment'])
164
+ {
165
+ $old_attachment = " - ".$values['attachment'];
166
+ }
167
+
168
+ $form->setValues(Mage::registry('ticket_data')->getData());
169
+ }
170
+ return parent::_prepareForm();
171
+ }
172
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('supportticket_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('supportticket')->__('Ticket Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('supportticket')->__('Ticket Information'),
18
+ 'title' => Mage::helper('supportticket')->__('Ticket Information'),
19
+ 'content' => $this->getLayout()->createBlock('supportticket/adminhtml_ticket_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Grid.php ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId('ticketGrid');
8
+ $this->setDefaultSort('ticket_id');
9
+ $this->setDefaultDir('DESC');
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ protected function _prepareCollection()
14
+ {
15
+ $collection = Mage::getModel('supportticket/ticket')->getCollectionByLoggedInUser();
16
+
17
+ $this->setCollection($collection);
18
+
19
+ return parent::_prepareCollection();
20
+ }
21
+
22
+ protected function _prepareColumns()
23
+ {
24
+ $this->addColumn('ticket_id', array(
25
+ 'header' => Mage::helper('supportticket')->__('ID'),
26
+ 'align' =>'right',
27
+ 'width' => '50px',
28
+ 'index' => 'ticket_id',
29
+ ));
30
+
31
+ $this->addColumn('ticket_code', array(
32
+ 'header' => Mage::helper('supportticket')->__('Code'),
33
+ 'align' =>'right',
34
+ 'width' => '50px',
35
+ 'index' => 'ticket_code',
36
+ ));
37
+
38
+ $this->addColumn('ticket_title', array(
39
+ 'header' => Mage::helper('supportticket')->__('Title'),
40
+ 'align' =>'left',
41
+ 'index' => 'ticket_title',
42
+ 'renderer' =>'supportticket/adminhtml_ticket_renderer_tooltip'
43
+ ));
44
+
45
+
46
+
47
+ $this->addColumn('customer_email', array(
48
+ 'header' => Mage::helper('supportticket')->__('Customer Email'),
49
+ 'align' =>'left',
50
+ 'index' => 'customer_email',
51
+ ));
52
+
53
+ $this->addColumn('created_user', array(
54
+ 'header' => Mage::helper('supportticket')->__('Created By'),
55
+ 'align' =>'left',
56
+ 'index' => 'created_user',
57
+
58
+ ));
59
+
60
+ $this->addColumn('assigned_user', array(
61
+ 'header' => Mage::helper('supportticket')->__('Assigned To'),
62
+ 'align' =>'left',
63
+ 'index' => 'assigned_user',
64
+
65
+ ));
66
+
67
+ $this->addColumn('created_time', array(
68
+ 'header' => Mage::helper('supportticket')->__('Created Time'),
69
+ 'align' =>'left',
70
+ 'index' => 'created_time',
71
+ 'type' => 'datetime',
72
+ ));
73
+
74
+ $this->addColumn('is_private', array(
75
+ 'header' => Mage::helper('supportticket')->__('Is Private'),
76
+ 'align' =>'left',
77
+ 'type' =>'options',
78
+ 'index' => 'is_private',
79
+ 'options' =>array(
80
+ 0 =>'No',
81
+ 1 =>'Yes',
82
+ ),
83
+ 'renderer' =>'supportticket/adminhtml_ticket_renderer_isprivate'
84
+ ));
85
+
86
+ //Zend_Debug::dump(Mage::helper('supportticket')->getStatusList());
87
+ $this->addColumn('status', array(
88
+ 'header' => Mage::helper('supportticket')->__('Status'),
89
+ 'align' =>'left',
90
+ 'index' => 'status',
91
+ 'type' =>'options',
92
+ 'options' =>Mage::helper('supportticket')->getStatusList(),
93
+ 'renderer' => 'supportticket/adminhtml_ticket_renderer_status',
94
+ ));
95
+
96
+ $this->addColumn('priority', array(
97
+ 'header' => Mage::helper('supportticket')->__('Priority'),
98
+ 'align' =>'left',
99
+ 'index' => 'priority',
100
+ 'type' =>'options',
101
+ 'options' =>Mage::helper('supportticket')->getPriorityList(),
102
+ 'renderer' => 'supportticket/adminhtml_ticket_renderer_priority',
103
+ ));
104
+
105
+ $this->addColumn('action',
106
+ array(
107
+ 'header' => Mage::helper('supportticket')->__('Action'),
108
+ 'width' => '100',
109
+ 'type' => 'action',
110
+ 'getter' => 'getId',
111
+ 'actions' => array(
112
+ array(
113
+ 'caption' => Mage::helper('supportticket')->__('Write Message'),
114
+ 'url' => array('base'=> '*/*/message'),
115
+ 'field' => 'id'
116
+ ),
117
+ array(
118
+ 'caption' => Mage::helper('supportticket')->__('Assign User'),
119
+ 'url' => array('base'=> '*/*/assignuser'),
120
+ 'field' => 'id'
121
+ ),
122
+ array(
123
+ 'caption' => Mage::helper('supportticket')->__('Edit'),
124
+ 'url' => array('base'=> '*/*/edit'),
125
+ 'field' => 'id'
126
+ )
127
+
128
+
129
+ ),
130
+ 'filter' => false,
131
+ 'sortable' => false,
132
+ 'index' => 'stores',
133
+ 'is_system' => true,
134
+ ));
135
+
136
+
137
+
138
+ $this->addExportType('*/*/exportCsv', Mage::helper('supportticket')->__('CSV'));
139
+ $this->addExportType('*/*/exportXml', Mage::helper('supportticket')->__('XML'));
140
+
141
+ return parent::_prepareColumns();
142
+ }
143
+ public function decorateStatus($value, $row, $column, $isExport)
144
+ {
145
+ $class = '';
146
+ switch ($row->getIsPrivate()) {
147
+ case 0 :
148
+ $class = 'grid-severity-notice';
149
+ break;
150
+ case 1:
151
+ $class = 'grid-severity-critical';
152
+ break;
153
+ }
154
+ return '<span class="'.$class.'"><span>'.$value.'</span></span>';
155
+ }
156
+ protected function _prepareMassaction()
157
+ {
158
+ $this->setMassactionIdField('ticket_id');
159
+ $this->getMassactionBlock()->setFormFieldName('ticket');
160
+
161
+ $this->getMassactionBlock()->addItem('delete', array(
162
+ 'label' => Mage::helper('supportticket')->__('Delete'),
163
+ 'url' => $this->getUrl('*/*/massDelete'),
164
+ 'confirm' => Mage::helper('supportticket')->__('Are you sure?')
165
+ ));
166
+
167
+ $types = array(array('label'=>'Public','value'=>'0'),array('label'=>'Private','value'=>'1'));
168
+
169
+ //array_unshift($statuses, array('label'=>'', 'value'=>''));
170
+
171
+ $this->getMassactionBlock()->addItem('is_private', array(
172
+ 'label'=> Mage::helper('supportticket')->__('Change Type'),
173
+ 'url' => $this->getUrl('*/*/massType', array('_current'=>true)),
174
+ 'additional' => array(
175
+ 'visibility' => array(
176
+ 'name' => 'is_private',
177
+ 'type' => 'select',
178
+ 'class' => 'required-entry',
179
+ 'label' => Mage::helper('supportticket')->__('Type'),
180
+ 'values' => $types
181
+ )
182
+ )
183
+ ));
184
+
185
+ $statuses = Mage::helper('supportticket')->getTicketStatusList();
186
+
187
+
188
+ //array_unshift($statuses, array('label'=>'', 'value'=>''));
189
+
190
+ $this->getMassactionBlock()->addItem('status', array(
191
+ 'label'=> Mage::helper('supportticket')->__('Change Status'),
192
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
193
+ 'additional' => array(
194
+ 'visibility' => array(
195
+ 'name' => 'status',
196
+ 'type' => 'select',
197
+ 'class' => 'required-entry',
198
+ 'label' => Mage::helper('supportticket')->__('Status'),
199
+ 'values' => $statuses
200
+ )
201
+ )
202
+ ));
203
+
204
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
205
+
206
+ return $this;
207
+ }
208
+
209
+ public function getRowUrl($row)
210
+ {
211
+ //$department = Mage::getModel("supportticket/department")->load($row->getDepartmentId());
212
+ return $this->getUrl('*/*/message', array('id' => $row->getId()));
213
+ }
214
+
215
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Message.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Message extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'supportticket';
11
+ $this->_controller = 'adminhtml_ticket';
12
+
13
+
14
+ $this->_removeButton('delete', 'label');
15
+ $this->_removeButton('save', 'label');
16
+ $this->_removeButton('reset', 'label');
17
+
18
+ $this->_addButton('assignuser', array(
19
+ 'label' => Mage::helper('adminhtml')->__('AssignUser'),
20
+ 'onclick' => 'assignUser()',
21
+ 'class' => 'save',
22
+ ), -100);
23
+
24
+ $this->_addButton('saveandcontinue', array(
25
+ 'label' => Mage::helper('adminhtml')->__('Post Message'),
26
+ 'onclick' => 'saveAndContinueEdit()',
27
+ 'class' => 'save',
28
+ ), -100);
29
+
30
+
31
+
32
+
33
+ $id = $this->getRequest()->getParam('id');
34
+ $this->_formScripts[] = "
35
+ var insert_template_url;
36
+
37
+ insert_template_url = '". $this->getUrl("*/adminhtml_template/inserttemplate") . "';
38
+
39
+ $('edit_form').action='". $this->getUrl('*/' . $this->_controller . '/message/id/'.$id) ."';
40
+
41
+
42
+ function saveAndContinueEdit(){
43
+ editForm.submit($('edit_form').action);
44
+ }
45
+
46
+ function assignUser()
47
+ {
48
+ window.location = '". $this->getUrl('*/' . $this->_controller . '/assignuser/id/'.$id) ."';
49
+ }
50
+ function insertTemplateToMessage(){
51
+ var template_id;
52
+ template_id = $('template_id').value;
53
+ new Ajax.Updater('message_content', insert_template_url, {parameters: { template_id: template_id },method: 'post', onFailure: ''});
54
+ }
55
+ ";
56
+ }
57
+
58
+ public function getHeaderText()
59
+ {
60
+
61
+ return Mage::helper('supportticket')->__('Ticket Message Manager');
62
+
63
+ }
64
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Message/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Message_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/message', array('id' => $this->getRequest()->getParam('id'),'store'=>$this->getRequest()->getParam('store'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Message/Tab/Form.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Message_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('ticket_form', array('legend'=>Mage::helper('supportticket')->__('Post New Message')));
10
+
11
+ $store_id = $this->getRequest()->getParam('store');
12
+ if(!$store_id)
13
+ {
14
+ $store_id = 0;
15
+ }
16
+ $id = $this->getRequest()->getParam('id');
17
+ $ticket = Mage::getModel('supportticket/ticket')->load($id);
18
+
19
+ if ($ticket->getId()) {
20
+ if($ticket->canPostMessageInAdmin())
21
+ {
22
+ $fieldset->addField('is_private', 'select', array(
23
+ 'label' => Mage::helper('supportticket')->__('Is Private'),
24
+ 'name' => 'is_private',
25
+ 'values' => array(
26
+ array(
27
+ 'value' => 0,
28
+ 'label' => Mage::helper('supportticket')->__('No'),
29
+ ),
30
+
31
+ array(
32
+ 'value' => 1,
33
+ 'label' => Mage::helper('supportticket')->__('Yes'),
34
+ ),
35
+ ),
36
+ ));
37
+
38
+ $fieldset->addField('message_type', 'select', array(
39
+ 'label' => Mage::helper('supportticket')->__('Type of message'),
40
+ 'name' => 'message_type',
41
+ 'values' => array(
42
+ array(
43
+ 'value' => 0,
44
+ 'label' => Mage::helper('supportticket')->__('Message content'),
45
+ ),
46
+
47
+ array(
48
+ 'value' => 1,
49
+ 'label' => Mage::helper('supportticket')->__('Email content'),
50
+ ),
51
+ ),
52
+ ));
53
+
54
+ $fieldset->addField('message_content', 'editor', array(
55
+ 'name' => 'content',
56
+ 'label' => Mage::helper('supportticket')->__('Message Content'),
57
+ 'title' => Mage::helper('supportticket')->__('Message Content'),
58
+ 'style' => 'width:700px; height:150px;',
59
+ 'wysiwyg' => false,
60
+
61
+ 'required' => true,
62
+ ));
63
+
64
+ $fieldset->addField('attachment', 'note', array(
65
+ 'label' => Mage::helper('supportticket')->__('Attachment'),
66
+ 'required' => false,
67
+ 'name' => 'attachment',
68
+ 'text' => $this->getLayout()->createBlock('core/template')->setTemplate('supportticket/multiupload.phtml')->toHtml(),
69
+ ));
70
+ $fieldset->addField('template_id', 'select', array(
71
+ 'label' => Mage::helper('supportticket')->__('Message Template'),
72
+ 'name' => 'template_id',
73
+ 'onchange' => 'insertTemplateToMessage()',
74
+ 'values' => Mage::helper('supportticket')->getTemplateOptionsByMessage($store_id),
75
+ ));
76
+
77
+ }else{
78
+ $fieldset->addField('message_error', 'note', array(
79
+ 'name' => 'error',
80
+ 'label' => Mage::helper('supportticket')->__('Message Error'),
81
+ 'title' => Mage::helper('supportticket')->__('Message Error'),
82
+ 'text' =>'You don\'t have the right permission to post message for the ticket',
83
+ ));
84
+ }
85
+ }
86
+
87
+
88
+ return parent::_prepareForm();
89
+ }
90
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Message/Tab/History.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Message_Tab_History extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate('supportticket/message_history.phtml');
9
+ }
10
+
11
+ /*
12
+
13
+ */
14
+ protected function _prepareForm()
15
+ {
16
+ $form = new Varien_Data_Form();
17
+ $this->setForm($form);
18
+ $fieldset = $form->addFieldset('ticket_form', array('legend'=>Mage::helper('supportticket')->__('View Posted Message')));
19
+
20
+ return parent::_prepareForm();
21
+ }
22
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Message/Tab/Privatehistory.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Message_Tab_Privatehistory extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate('supportticket/private_message_history.phtml');
9
+ }
10
+
11
+ /*
12
+
13
+ */
14
+ protected function _prepareForm()
15
+ {
16
+ $form = new Varien_Data_Form();
17
+ $this->setForm($form);
18
+ $fieldset = $form->addFieldset('ticket_form', array('legend'=>Mage::helper('supportticket')->__('View Private Message')));
19
+
20
+ return parent::_prepareForm();
21
+ }
22
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Message/Tab/View.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Message_Tab_View extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate('supportticket/view_ticket.phtml');
9
+ }
10
+
11
+ /*
12
+
13
+ */
14
+ protected function _prepareForm()
15
+ {
16
+ $form = new Varien_Data_Form();
17
+ $this->setForm($form);
18
+ $fieldset = $form->addFieldset('ticket_form', array('legend'=>Mage::helper('supportticket')->__('View Ticket Detail')));
19
+
20
+ return parent::_prepareForm();
21
+ }
22
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Message/Tabs.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Message_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('supportticket_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('supportticket')->__('Message Manager'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('supportticket')->__('Post Message'),
18
+ 'title' => Mage::helper('supportticket')->__('Post Message'),
19
+ 'content' => $this->getLayout()->createBlock('supportticket/adminhtml_ticket_message_tab_form')->toHtml(),
20
+ ));
21
+
22
+ $this->addTab('view_section', array(
23
+ 'label' => Mage::helper('supportticket')->__('View Ticket Detail'),
24
+ 'title' => Mage::helper('supportticket')->__('View Ticket Detail'),
25
+ 'content' => $this->getLayout()->createBlock('supportticket/adminhtml_ticket_message_tab_view')->toHtml(),
26
+ ));
27
+
28
+ $this->addTab('history_section', array(
29
+ 'label' => Mage::helper('supportticket')->__('View Posted Message'),
30
+ 'title' => Mage::helper('supportticket')->__('View Posted Message'),
31
+ 'content' => $this->getLayout()->createBlock('supportticket/adminhtml_ticket_message_tab_history')->toHtml(),
32
+ ));
33
+
34
+ $this->addTab('private_history_section', array(
35
+ 'label' => Mage::helper('supportticket')->__('View Private Message'),
36
+ 'title' => Mage::helper('supportticket')->__('View Private Message'),
37
+ 'content' => $this->getLayout()->createBlock('supportticket/adminhtml_ticket_message_tab_privatehistory')->toHtml(),
38
+ ));
39
+
40
+ return parent::_beforeToHtml();
41
+ }
42
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Renderer/Isprivate.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Renderer_Isprivate extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ /* Render Grid Column*/
5
+ public function render(Varien_Object $row)
6
+ {
7
+ switch($row->getIsPrivate()){
8
+ case 0:
9
+ $prefix = 'No';
10
+ break;
11
+ case 1:
12
+ $prefix = 'Yes';
13
+ break;
14
+ }
15
+ return '<span class="grid-severity-'.$prefix.'"><span>'.$prefix.'</span></span>';
16
+ }
17
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Renderer/Priority.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Renderer_Priority extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ /* Render Grid Column*/
5
+ public function render(Varien_Object $row)
6
+ {
7
+ $priorities = Mage::helper('supportticket')->getPriorityList();
8
+ $data=$row->getData();
9
+
10
+ switch($row->getPriority()){
11
+ case 'Low':
12
+ $prefix = 'open';
13
+ break;
14
+ case 'Normal':
15
+ $prefix = 'approval';
16
+ break;
17
+ case 'High':
18
+ $prefix='reply';
19
+ break;
20
+ case 'Urgent':
21
+ $prefix = 'needed';
22
+ break;
23
+ }
24
+ return '<span id="priority" class="grid-severity-'.$prefix.'"><span>'.$priorities[$row->getPriority()].'</span></span>';
25
+ }
26
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Renderer/Status.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Renderer_Status extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ /* Render Grid Column*/
5
+ public function render(Varien_Object $row)
6
+ {
7
+ $statuses = Mage::helper('supportticket')->getStatusList();
8
+ //Zend_Debug::dump($statuses);
9
+ switch($row->getStatus()){
10
+ case 'Open':
11
+ $prefix = 'open';
12
+ break;
13
+ case 'Waiting Reply':
14
+ $prefix = 'reply';
15
+ break;
16
+ case 'Support Needed':
17
+ $prefix='needed';
18
+ break;
19
+ case 'Closed':
20
+ $prefix = 'closed';
21
+ break;
22
+ case 'In Progress':
23
+ $prefix = 'progess';
24
+ break;
25
+ case 'Waiting Approval':
26
+ $prefix = 'approval';
27
+ break;
28
+ }
29
+ return '<span class="grid-severity-'.$prefix.'"><span>'.$statuses[$row->getStatus()].'</span></span>';
30
+ }
31
+ }
app/code/local/Magestore/Supportticket/Block/Adminhtml/Ticket/Renderer/Tooltip.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Adminhtml_Ticket_Renderer_Tooltip extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ /* Render Grid Column*/
5
+ public function render(Varien_Object $row)
6
+ {
7
+ return '<div id="wrap_tooltip_'.$row->getTicketId().'">'.$row->getTicketTitle().'</div>'
8
+ .'<div id="detail_'.$row->getTicketId().'" class="tooltip-ticket-detail" style="display: none;">'
9
+ .'<h4><u>'.$row->getTicketCode().'</u></h4>'.$row->getContent().'</div>'
10
+ .'<script type="text/javascript">'
11
+ .'var wrapTip = new Tooltip("wrap_tooltip_'.$row->getTicketId().'", "detail_'.$row->getTicketId().'");'
12
+ .'</script>';
13
+ }
14
+ }
app/code/local/Magestore/Supportticket/Block/List.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_List extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
7
+ $breadcrumbs->addCrumb('home', array('label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Home'), 'link'=>Mage::getBaseUrl()));
8
+ $breadcrumbs->addCrumb('supportticket', array('label'=>Mage::helper('supportticket')->__('View All Ticket'), 'title'=>'View All Ticket', 'link'=>Mage::getUrl("supportticket/ticket")));
9
+
10
+ $headBlock = $this->getLayout()->getBlock('head');
11
+
12
+ $headBlock->setTitle(Mage::helper('supportticket')->__('Support Ticket - View All Ticket'));
13
+ return parent::_prepareLayout();
14
+ }
15
+
16
+ public function getAllTicket()
17
+ {
18
+ if(Mage::getSingleton('customer/session')->getCustomerId())
19
+ {
20
+ $customer_id = Mage::getSingleton('customer/session')->getCustomerId();
21
+ $customer = Mage::getSingleton('customer/customer')->load($customer_id);
22
+
23
+ $customer_email = "'".$customer->getEmail() . "'";
24
+ //get all other added email address from this user
25
+ $added_emails = Mage::getModel("supportticket/email")->getCollection()
26
+ ->addFieldToFilter("status",1)
27
+ ->addFieldToFilter("customer_id",$customer_id);
28
+
29
+ if(count($added_emails))
30
+ {
31
+ foreach($added_emails as $added_email)
32
+ {
33
+ $customer_email = "'".$added_email->getEmail(). "',". $customer_email;
34
+ }
35
+ }
36
+
37
+ $store_id = Mage::app()->getStore()->getId();
38
+ $ticket = Mage::getModel("supportticket/ticket")
39
+ ->setStoreId($store_id);
40
+ $ticket_collection = $ticket->getCollection();
41
+
42
+ $ticket_collection->getSelect()
43
+ ->where("is_private = 0 and customer_email in (".$customer_email.")");
44
+ $ticket_collection->setOrder("created_time", "DESC");
45
+
46
+ return $ticket_collection;
47
+ }
48
+ return null;
49
+ }
50
+
51
+ public function getViewTicketUrl($ticket)
52
+ {
53
+ $ticket_code = $ticket->getTicketCode();
54
+ return $this->getUrl('supportticket/ticket/view', array('id'=>$ticket_code ));
55
+ }
56
+ public function getLastResponder($ticket)
57
+ {
58
+ $message_collection = Mage::getModel("supportticket/message")->getCollection()
59
+ ->addFieldToFilter("ticket_id",$ticket->getId())
60
+ ->addFieldToFilter("customer_email","")
61
+ ->setOrder("created_time","DESC");
62
+
63
+ if(count($message_collection))
64
+ {
65
+
66
+ $mesage = $message_collection->getLastItem();
67
+
68
+ $created_user = Mage::getModel("admin/user")->loadByUsername($mesage->getCreatedUser());
69
+ return $created_user->getName();
70
+ }
71
+ return "";
72
+ }
73
+ }
app/code/local/Magestore/Supportticket/Block/Readmail.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Readmail extends Mage_Core_Block_Template
3
+ {
4
+
5
+ public function getTicketCode($subject)
6
+ {
7
+ $codes=$this->getAllTicketCode();
8
+ $sub=explode('# ',$subject);
9
+ if(in_array($sub[1],$codes))
10
+ {
11
+ return $sub[1];
12
+ }
13
+ return;
14
+ }
15
+ public function getAllDepartmentCode()
16
+ {
17
+ $codes=array();
18
+ $departmentCollection=Mage::getModel('supportticket/department')->getCollection();
19
+ foreach($departmentCollection as $department)
20
+ {
21
+ $codes[]=$department->getDepartmentCode();
22
+ }
23
+ return $codes;
24
+ }
25
+
26
+
27
+
28
+
29
+ }
30
+
31
+
32
+ ?>
app/code/local/Magestore/Supportticket/Block/Setupemail.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Setupemail extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
7
+ $breadcrumbs->addCrumb('home', array('label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Home'), 'link'=>Mage::getBaseUrl()));
8
+ $breadcrumbs->addCrumb('supportticket_view_all', array('label'=>Mage::helper('supportticket')->__('Support Ticket'), 'title'=>'Support Ticket', 'link'=>Mage::getUrl("supportticket/ticket")));
9
+ $breadcrumbs->addCrumb('supportticket', array('label'=>Mage::helper('supportticket')->__('Setup Email Address'), 'title'=>'Setup Email Address', 'link'=>Mage::getUrl("supportticket/email")));
10
+
11
+ $headBlock = $this->getLayout()->getBlock('head');
12
+
13
+ $headBlock->setTitle(Mage::helper('supportticket')->__('Support Ticket - Setup Email Address'));
14
+ return parent::_prepareLayout();
15
+ }
16
+
17
+ public function getAllAddedEmail()
18
+ {
19
+ $customer_id = Mage::getSingleton('customer/session')->getCustomerId();
20
+ if(!$customer_id)
21
+ {
22
+ return;
23
+ }
24
+ $emails = Mage::getModel("supportticket/email")->getCollection()
25
+ ->addFieldToFilter("customer_id",$customer_id);
26
+ return $emails;
27
+ }
28
+
29
+ public function getDeleteEmailUrl($email)
30
+ {
31
+ return $this->getUrl("supportticket/email/delete/id/".$email->getId());
32
+ }
33
+ }
app/code/local/Magestore/Supportticket/Block/Sliderbar.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Customer
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Customer account navigation sidebar
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Customer
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+
35
+ class Magestore_Supportticket_Block_Sliderbar extends Mage_Core_Block_Template
36
+ {
37
+
38
+ protected $_links = array();
39
+
40
+ protected $_activeLink = false;
41
+
42
+ public function addLink($name, $path, $label, $urlParams=array())
43
+ {
44
+ $this->_links[$name] = new Varien_Object(array(
45
+ 'name' => $name,
46
+ 'path' => $path,
47
+ 'label' => $label,
48
+ 'url' => $this->getUrl($path, $urlParams),
49
+ ));
50
+ return $this;
51
+ }
52
+
53
+ public function setActive($path)
54
+ {
55
+ $this->_activeLink = $this->_completePath($path);
56
+ return $this;
57
+ }
58
+
59
+ public function getLinks()
60
+ {
61
+ return $this->_links;
62
+ }
63
+
64
+ public function isActive($link)
65
+ {
66
+ if (empty($this->_activeLink)) {
67
+ $this->_activeLink = $this->getAction()->getFullActionName('/');
68
+ }
69
+ if ($this->_completePath($link->getPath()) == $this->_activeLink) {
70
+ return true;
71
+ }
72
+ return false;
73
+ }
74
+
75
+ protected function _completePath($path)
76
+ {
77
+ $path = rtrim($path, '/');
78
+ switch (sizeof(explode('/', $path))) {
79
+ case 1:
80
+ $path .= '/index';
81
+ // no break
82
+
83
+ case 2:
84
+ $path .= '/index';
85
+ }
86
+ return $path;
87
+ }
88
+
89
+ }
app/code/local/Magestore/Supportticket/Block/Submit.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Submit extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
7
+ $breadcrumbs->addCrumb('home', array('label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Home'), 'link'=>Mage::getBaseUrl()));
8
+ $breadcrumbs->addCrumb('supportticket_view_all', array('label'=>Mage::helper('supportticket')->__('Support Ticket'), 'title'=>'Support Ticket', 'link'=>Mage::getUrl("supportticket/ticket")));
9
+ $breadcrumbs->addCrumb('supportticket', array('label'=>Mage::helper('supportticket')->__('Submit Ticket'), 'title'=>'Submit Ticket', 'link'=>Mage::getUrl("supportticket/ticket/submit")));
10
+
11
+ $headBlock = $this->getLayout()->getBlock('head');
12
+
13
+ $headBlock->setTitle(Mage::helper('supportticket')->__('Support Ticket - Submit a New Ticket'));
14
+ return parent::_prepareLayout();
15
+ }
16
+
17
+ public function getDepartmentList()
18
+ {
19
+ $storeId = Mage::app()->getStore()->getId();
20
+ $department = Mage::getModel("supportticket/department");
21
+ $department->setStoreId($storeId);
22
+ $department_collection = $department->getCollection()
23
+ ->setOrder("department_group_id","ASC");
24
+ return $department_collection;
25
+ }
26
+
27
+ public function getTicketformUrl()
28
+ {
29
+ return $this->getUrl('supportticket/ticket/ticketform');
30
+ }
31
+
32
+
33
+ }
app/code/local/Magestore/Supportticket/Block/Ticketform.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_Ticketform extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ /*
10
+ Check if this customer can submit a ticket or not base on customer group
11
+
12
+ */
13
+ public function canSubmitTicket()
14
+ {
15
+ //get current customer_group_id
16
+ $customer_group_id = Mage::getSingleton('customer/session')->getCustomerGroupId();
17
+
18
+ //get a list of customer group for selected department
19
+ $department_id = Mage::registry("department_id");
20
+ $storeId = Mage::app()->getStore()->getId();
21
+ $department = Mage::getModel("supportticket/department")->load($department_id);
22
+ if(!$department->getId())
23
+ {
24
+ return false;
25
+ }
26
+ $department_customer_group_id = $department->getCustomerGroupId();
27
+ $department_customer_group_id = explode(",",$department_customer_group_id);
28
+
29
+ //if current customer_group_id in the list of department customer group
30
+ if(in_array($customer_group_id,$department_customer_group_id))
31
+ {
32
+ return true;
33
+ }
34
+
35
+ return false;
36
+ }// canSubmitTicket
37
+
38
+ public function getTicket()
39
+ {
40
+ $ticket = Mage::getSingleton('supportticket/session')->getTicket();
41
+ if($ticket)
42
+ {
43
+ return $ticket;
44
+ }
45
+ return Mage::getModel('supportticket/ticket');
46
+ }
47
+
48
+ public function getCustomerEmailOptions()
49
+ {
50
+ $customer_id = Mage::getSingleton('customer/session')->getCustomerId();
51
+ $customer_session = Mage::getSingleton('customer/customer')->load($customer_id);
52
+ $customer_email = $customer_session->getEmail();
53
+
54
+ $emails = Mage::getModel("supportticket/email")->getCollection()
55
+ ->addFieldToFilter("status",1)
56
+ ->addFieldToFilter("customer_id",$customer_id);
57
+
58
+ $options = array();
59
+ $options[] = $customer_email;
60
+ foreach($emails as $email)
61
+ {
62
+ $options[] = $email->getEmail();
63
+ }
64
+ return $options;
65
+ }
66
+
67
+
68
+ }
app/code/local/Magestore/Supportticket/Block/View.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Block_View extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ $ticket_code = $this->getRequest()->getParam('id');
7
+ $ticket = Mage::getModel("supportticket/ticket")->load($ticket_code,"ticket_code");
8
+ $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
9
+ $breadcrumbs->addCrumb('home', array('label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Home'), 'link'=>Mage::getBaseUrl()));
10
+ $breadcrumbs->addCrumb('supportticket_view_all', array('label'=>Mage::helper('supportticket')->__('Support Ticket'), 'title'=>'Support Ticket', 'link'=>Mage::getUrl("supportticket/ticket")));
11
+ $breadcrumbs->addCrumb('supportticket_detail', array('label'=>$ticket->getTicketTitle(), 'title'=>$ticket->getTicketTitle(), 'link'=>Mage::getUrl("supportticket/ticket/view/id/".$ticket_code)));
12
+
13
+ $headBlock = $this->getLayout()->getBlock('head');
14
+
15
+ $headBlock->setTitle(Mage::helper('supportticket')->__('Support Ticket - View Ticket') . " - ".$ticket->getTicketTitle());
16
+ return parent::_prepareLayout();
17
+ }
18
+
19
+ public function getTicket()
20
+ {
21
+ $ticket_code = $this->getRequest()->getParam('id');
22
+ $ticket = Mage::getModel("supportticket/ticket")->load($ticket_code,'ticket_code');
23
+ return $ticket;
24
+ }
25
+
26
+ public function getTicketDepartment($ticket)
27
+ {
28
+ $department = Mage::getModel("supportticket/department")->load($ticket->getDepartmentId());
29
+ if($department)
30
+ {
31
+ return $department->getDepartmentName();
32
+ }
33
+ return "";
34
+ }
35
+
36
+ public function getTicketAllMessage($ticket)
37
+ {
38
+ $message_list = Mage::getModel("supportticket/message")->getCollection()
39
+ ->addFieldToFilter("is_private",0)
40
+ ->addFieldToFilter("ticket_id",$ticket->getId())
41
+ ->setOrder("created_time", "DESC");
42
+ return $message_list;
43
+ }
44
+
45
+
46
+ }
app/code/local/Magestore/Supportticket/Helper/Data.php ADDED
@@ -0,0 +1,680 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ /*
6
+ Load department group for select options
7
+ */
8
+ public function getDepartmentGroupOptions($store_id)
9
+ {
10
+ $department_group = Mage::getModel("supportticket/departmentgroup");
11
+ $department_group->setStoreId($store_id);
12
+ $collection = $department_group->getCollection();
13
+ $options = array();
14
+ if(count($collection))
15
+ {
16
+ foreach($collection as $item)
17
+ {
18
+ $options[] = array("label"=>$item->getDepartmentGroupName(),"value"=>$item->getEntityId());
19
+ }
20
+ }
21
+
22
+ return $options;
23
+ }// end getDepartmentGroupOptions
24
+
25
+ public function getTemplateOptions($store_id)
26
+ {
27
+ $template = Mage::getModel("supportticket/template");
28
+ $template->setStoreId($store_id);
29
+ $collection = $template->getCollection();
30
+ $options = array();
31
+ $options[] = array('label'=>$this->__('Select Template'),'value'=>'');
32
+ if(count($collection))
33
+ {
34
+ foreach($collection as $item)
35
+ {
36
+ $options[] = array("label"=>$item->getTemplateName(),"value"=>$item->getId());
37
+ }
38
+ }
39
+
40
+ return $options;
41
+ }// end getTemplateOptions
42
+ public function getStatusByKey($key)
43
+ {
44
+ $statuses = array("STATUS_OPEN" => "Open",
45
+ "STATUS_WAITING_REPLY" => "Waiting Reply",
46
+ "STATUS_IN_PROGRESS" => "In Progress",
47
+ "STATUS_WAITING_APPROVAL" => "Waiting Approval",
48
+ "STATUS_CLOSED" => "Closed",
49
+ "STATUS_SUPPORT_NEDDED" => "Support Needed"
50
+ );
51
+ return $statuses[$key];
52
+ }
53
+ public function getTemplateOptionsByMessage($ticket_id)
54
+ {
55
+ $ticket = Mage::getModel("supportticket/ticket")->load($ticket_id);
56
+ $department = Mage::getModel("supportticket/department")->load($ticket->getDepartmentId());
57
+ $store_id = $department->getStoreId();
58
+ $options = $this->getTemplateOptions($store_id);
59
+
60
+ return $options;
61
+ }// end getTemplateOptions
62
+
63
+ public function getCusstomerGroupOptions()
64
+ {
65
+ $collection = Mage::getModel("customer/group")->getCollection();
66
+
67
+ $options = array();
68
+ if(count($collection))
69
+ {
70
+ foreach($collection as $item)
71
+ {
72
+ $options[] = array("label"=>$item->getCustomerGroupCode(),"value"=>$item->getCustomerGroupId());
73
+ }
74
+ }
75
+
76
+ return $options;
77
+ }// end getDepartmentGroupOptions
78
+
79
+
80
+ public function getAdminUserOptions()
81
+ {
82
+ $collection = Mage::getModel("admin/user")->getCollection();
83
+
84
+ $options = array();
85
+ if(count($collection))
86
+ {
87
+ foreach($collection as $item)
88
+ {
89
+ $options[] = array("label"=>$item->getUsername(),"value"=>$item->getUsername());
90
+ }
91
+ }
92
+
93
+ return $options;
94
+ }// end getAdminuserOptions
95
+
96
+
97
+ public function getDepartmentModeratorOptions($ticket_id)
98
+ {
99
+ $ticket = Mage::getModel("supportticket/ticket")->load($ticket_id);
100
+ $department = Mage::getModel("supportticket/department")->load($ticket->getDepartmentId());
101
+
102
+ $options = array();
103
+ if($department->getDepartmentUser())
104
+ {
105
+ $list = explode(",",$department->getDepartmentUser());
106
+
107
+ foreach($list as $username)
108
+ {
109
+ $options[] = array("label"=>$username,"value"=>$username);
110
+ }
111
+ }
112
+
113
+ return $options;
114
+ }// end getAdminuserOptions
115
+
116
+ public function getDepartmentOptions($store_id)
117
+ {
118
+ $department = Mage::getModel("supportticket/department");
119
+ $department->setStoreId($store_id);
120
+ $collection = $department->getCollection()
121
+ ->addFieldToFilter("status",1);
122
+ $options = array();
123
+ if(count($collection))
124
+ {
125
+ foreach($collection as $item)
126
+ {
127
+ $options[] = array("label"=>$item->getDepartmentName(),"value"=>$item->getId());
128
+ }
129
+ }
130
+
131
+ return $options;
132
+ }// end getDepartmentOptions
133
+
134
+
135
+ public function getStoreOptions()
136
+ {
137
+ $store_options = array();
138
+ $store_options[] = array('label'=>$this->__('All Store View'), 'value'=>'0');
139
+ $websites = Mage::app()->getWebsites();
140
+
141
+ if(!count($websites))
142
+ {
143
+ return null;
144
+ }
145
+
146
+
147
+ foreach ($websites as $website)
148
+ {
149
+ $option = array();
150
+ $option['label'] = $website->getName();
151
+ $option['value'] = array();
152
+
153
+ foreach ($website->getGroups() as $group)
154
+ {
155
+ foreach ($this->getStores($group) as $store)
156
+ {
157
+ $option['value'][] = array('label'=>$store->getName(),'value'=>$store->getId());
158
+ }
159
+
160
+ }
161
+
162
+ $store_options[] = $option;
163
+ }
164
+ //print_r($store_options);die();
165
+ return $store_options;
166
+ }
167
+
168
+
169
+ public function getStores($group)
170
+ {
171
+ if (!$group instanceof Mage_Core_Model_Store_Group) {
172
+ $group = Mage::app()->getGroup($group);
173
+ }
174
+ $stores = $group->getStores();
175
+
176
+ return $stores;
177
+ }
178
+ /*
179
+ add status log for a ticket based on the action of admin user
180
+ @params:
181
+ ticket_id: int; the id of ticket
182
+ action: string; coresponding action of admin user
183
+ */
184
+ public function addStatuslog($ticket_id, $action)
185
+ {
186
+ $statuslog = Mage::getModel("supportticket/statuslog");
187
+ $statuslog->setTicketId($ticket_id);
188
+ $statuslog->setAction($action);
189
+ $statuslog->setAdminUser(Mage::getSingleton('admin/session')->getUser()->getUsername());
190
+
191
+ try
192
+ {
193
+ $statuslog->save();
194
+ }
195
+ catch (Exception $e)
196
+ {
197
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
198
+ }
199
+ }//end addStatuslog
200
+
201
+ public function authorizeAdminPermission()
202
+ {
203
+
204
+ }
205
+
206
+ /*
207
+ check if an user is the authod of a ticket
208
+ */
209
+ public function isTicketOwner($ticket_id)
210
+ {
211
+ if(Mage::getSingleton('customer/session')->getCustomerId())
212
+ {
213
+ //get ticket
214
+ $ticket = Mage::getModel("supportticket/ticket")->load($ticket_id);
215
+
216
+ if(!$ticket->getId())
217
+ {
218
+ return false;
219
+ }
220
+
221
+ if($ticket->getIsPrivate())
222
+ {
223
+ return false;
224
+ }
225
+
226
+ $customer_email = array();
227
+ $customer_id = Mage::getSingleton('customer/session')->getCustomerId();
228
+ $customer = Mage::getSingleton('customer/customer')->load($customer_id);
229
+ $customer_email[] = $customer->getEmail();
230
+
231
+ //get all other added email address from this user
232
+ $added_emails = Mage::getModel("supportticket/email")->getCollection()
233
+ ->addFieldToFilter("customer_id",$customer_id);
234
+
235
+ if(count($added_emails))
236
+ {
237
+ foreach($added_emails as $added_email)
238
+ {
239
+ $customer_email[] = $added_email->getEmail();
240
+ }
241
+ }
242
+
243
+
244
+ $ticket_customer_email = $ticket->getCustomerEmail();
245
+ if(in_array($ticket_customer_email,$customer_email))
246
+ {
247
+ return true;
248
+ }
249
+
250
+
251
+ }
252
+ return false;
253
+ }//end isTicketOwner($ticket_id)
254
+
255
+
256
+ public function canSubmitTicket($department_id)
257
+ {
258
+ //get current customer_group_id
259
+ $customer_group_id = Mage::getSingleton('customer/session')->getCustomerGroupId();
260
+
261
+ //get a list of customer group for selected department
262
+ $storeId = Mage::app()->getStore()->getId();
263
+ $department = Mage::getModel("supportticket/department")->load($department_id);
264
+ if(!$department->getId())
265
+ {
266
+ return false;
267
+ }
268
+ $department_customer_group_id = $department->getCustomerGroupId();
269
+ $department_customer_group_id = explode(",",$department_customer_group_id);
270
+
271
+ //if current customer_group_id in the list of department customer group
272
+ if(in_array($customer_group_id,$department_customer_group_id))
273
+ {
274
+ return true;
275
+ }
276
+
277
+ return false;
278
+ }// canSubmitTicket
279
+
280
+ /*
281
+ Update attachment for ticket
282
+ */
283
+ public function uploadTicketAttachment($attachmentFile,$index,$ticket_id,$message_id=null)
284
+ {
285
+ $attachment_path = $this->getAttachmentFolder($ticket_id);
286
+ if(!$attachment_path)
287
+ {
288
+ return;
289
+ }
290
+
291
+ $fileName = "";
292
+ $newFileName = "";
293
+ if(isset($attachmentFile['name']) && $attachmentFile['name'] != '') {
294
+ try {
295
+ /* Starting upload */
296
+ $fileName = $attachmentFile['name'] ;
297
+ $fileName = Mage::helper('supportticket')->refineString($fileName);
298
+ $tempName='attachment_'.$index;
299
+ //Zend_Debug::dump($tempName);die();
300
+ $uploader = new Varien_File_Uploader($tempName);
301
+ if($message_id)
302
+ {
303
+ $newFileName = $ticket_id . "_". $message_id . "_". $fileName;
304
+ }
305
+ else
306
+ {
307
+ $newFileName = $ticket_id ."_". $fileName;
308
+ }
309
+ //Zend_Debug::dump($newFileName);die();
310
+ // Any extention would work
311
+ //$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
312
+ $uploader->setAllowRenameFiles(true);
313
+
314
+ $uploader->setFilesDispersion(false);
315
+
316
+ $uploader->save($attachment_path, $fileName );
317
+
318
+ if($fileName != $newFileName){
319
+ //die($attachment_path .DS. $fileName."-".$attachment_path .DS.$newFileName);
320
+ copy($attachment_path .DS. $fileName,$attachment_path .DS.$newFileName);
321
+ unlink($attachment_path.DS.$fileName);
322
+ }
323
+
324
+ } catch (Exception $e) {
325
+ //Zend_Debug::dump($e->getMessage());die();
326
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
327
+ }
328
+
329
+ $fileName = $newFileName;
330
+ }
331
+ return $fileName;
332
+ }
333
+
334
+ /*
335
+ create a folder in media/supportticket based on ticket_id
336
+ */
337
+ public function getAttachmentFolder($ticket_id)
338
+ {
339
+ $attachment_path = Mage::getBaseDir('media') . DS .'supportticket' . DS. $ticket_id;
340
+
341
+ if(!is_dir($attachment_path))
342
+ {
343
+ try{
344
+
345
+ chmod(Mage::getBaseDir('media'),0777);
346
+
347
+ mkdir($attachment_path);
348
+
349
+ chmod($attachment_path,0777);
350
+ return $attachment_path;
351
+
352
+ } catch(Exception $e) {
353
+ Mage::getSingleton('adminhtml/session')->addError($this->getErrorMessage() . $e->getMessage());
354
+ }
355
+ }
356
+ return $attachment_path;
357
+
358
+ }//end createAttachmentFolder($ticket_id)
359
+
360
+
361
+ /*
362
+ delete an attachment of a ticket
363
+ */
364
+ public function deleteImageFile($ticket_id,$attachment)
365
+ {
366
+ if(!$attachment)
367
+ {
368
+ return;
369
+ }
370
+ $attachment_path = $this->getAttachmentFolder($ticket_id) .DS.$attachment;
371
+
372
+ if(file_exists($attachment_path))
373
+ {
374
+ try{
375
+ unlink($attachment_path);
376
+
377
+ } catch(Exception $e){
378
+ Mage::getSingleton('adminhtml/session')->addError($this->getErrorMessage() . $e->getMessage());
379
+ }
380
+ }
381
+ }//deleteImageFile($ticket_id,$attachment)
382
+
383
+ public function getAttachmentUrl($ticket_id, $attachment)
384
+ {
385
+ return Mage::getBaseUrl("media") . "supportticket/". $ticket_id . "/". $attachment;
386
+ }
387
+ public function DownloadFile($mbox,$mid,$id)
388
+ {
389
+ $this->get_attached_file($mbox,$this->getStructure($mbox,$mid),(int)$id,(int)$mid);
390
+ }
391
+
392
+ public function getTicketBySubject($subject)
393
+ {
394
+ $sub = explode('# ',$subject);
395
+ if(isset($sub[1])){
396
+ $ticket = Mage::getModel('supportticket/ticket')
397
+ ->getCollection()->addFieldToFilter('ticket_code',trim($sub[1]))
398
+ ->getFirstItem();
399
+ if(!$ticket->getId()){
400
+ return null;
401
+ }
402
+ return $ticket;
403
+ }
404
+ return null;
405
+ }
406
+ public function getCustomerEmailFromAddress($add)
407
+ {
408
+ $pos1=strpos($add,'<');
409
+ $pos2=strpos($add,'>');
410
+ if($pos1!=0)
411
+ {
412
+ $email=substr($add,$pos1+1,$pos2-$pos1-1);
413
+ }
414
+ else{
415
+ $email=$add;
416
+ }
417
+ return $email;
418
+ }
419
+ public function getNewFileName($fileName,$ticket_id,$message_id)
420
+ {
421
+ $newFileName = $ticket_id.'_'.$message_id.'_'.$fileName;
422
+ return $newFileName;
423
+ }
424
+ public function getAttachFile($mbox,$structure,$k,$mid,$ticket_id,$message_id)
425
+ {
426
+ $attachment_path=$this->getAttachmentFolder($ticket_id);
427
+ $fileName = $structure->parts[$k]->dparameters[0]->value;
428
+ $fileName = $this->refineString($fileName);
429
+ $newFileName=$this->getNewFileName($fileName,$ticket_id,$message_id);
430
+ $fileSource = base64_decode(imap_fetchbody($mbox, $mid, $k+1));
431
+ $f = fopen($attachment_path.DS.$newFileName, 'wb+');
432
+ fwrite($f, $fileSource);
433
+ fclose($f);
434
+ }
435
+ public function getStructure($mbox,$email_number)
436
+ {
437
+ $structure=imap_fetchstructure($mbox,$email_number);
438
+ return $structure;
439
+ }
440
+ public function getStatusList()
441
+ {
442
+ $result=array();
443
+ $statusList=$this->getTicketStatusList();
444
+ foreach($statusList as $status)
445
+ {
446
+ $result[$status['label']]=$status['value'];
447
+ }
448
+ return $result;
449
+ }
450
+ public function getTicketStatusList()
451
+ {
452
+ $statuses = array(
453
+ array('label'=>Mage::helper('supportticket')->getStatusByKey('STATUS_OPEN'),'value'=>Mage::helper('supportticket')->getStatusByKey('STATUS_OPEN')),
454
+ array('label'=>Mage::helper('supportticket')->getStatusByKey('STATUS_WAITING_REPLY'),'value'=>Mage::helper('supportticket')->getStatusByKey('STATUS_WAITING_REPLY')),
455
+ array('label'=>Mage::helper('supportticket')->getStatusByKey('STATUS_IN_PROGRESS'),'value'=>Mage::helper('supportticket')->getStatusByKey('STATUS_IN_PROGRESS')),
456
+ array('label'=>Mage::helper('supportticket')->getStatusByKey('STATUS_WAITING_APPROVAL'),'value'=>Mage::helper('supportticket')->getStatusByKey('STATUS_WAITING_APPROVAL')),
457
+ array('label'=>Mage::helper('supportticket')->getStatusByKey('STATUS_CLOSED'),'value'=>Mage::helper('supportticket')->getStatusByKey('STATUS_CLOSED')),
458
+ array('label'=>Mage::helper('supportticket')->getStatusByKey('STATUS_SUPPORT_NEDDED'),'value'=>Mage::helper('supportticket')->getStatusByKey('STATUS_SUPPORT_NEDDED')),
459
+ );
460
+
461
+ return $statuses;
462
+
463
+ }
464
+ public function getPriorityList()
465
+ {
466
+ $result=array();
467
+ $priorityList=$this->getPriorityOptions();
468
+ foreach($priorityList as $priority)
469
+ {
470
+ $result[$priority['label']]=$priority['value'];
471
+ }
472
+ return $result;
473
+ }
474
+ public function getPriorityOptions()
475
+ {
476
+ $priorities = array(
477
+ array('label'=>$this->getPriorityTextByKey('PRIORITY_LOW'),'value'=>"Low"),
478
+ array('label'=>$this->getPriorityTextByKey('PRIORITY_NORMAL'),'value'=>"Normal"),
479
+ array('label'=>$this->getPriorityTextByKey('PRIORITY_HIGH'),'value'=>"High"),
480
+ array('label'=>$this->getPriorityTextByKey('PRIORITY_URGENT'),'value'=>"Urgent")
481
+ );
482
+ return $priorities;
483
+ }
484
+
485
+ public function getPriorityTextByKey($key)
486
+ {
487
+ $priorities = array("PRIORITY_NORMAL" => "Normal",
488
+ "PRIORITY_URGENT" => "Urgent",
489
+ "PRIORITY_HIGH" => "High",
490
+ "PRIORITY_LOW" => "Low"
491
+ );
492
+ return $priorities[$key];
493
+ }
494
+
495
+ public function isNotifyDepartment()
496
+ {
497
+ if((int) Mage::getStoreConfig('supportticket/emailtemplate/notify_department_email')){
498
+ return true;
499
+ }
500
+ return false;
501
+ }
502
+
503
+ public function getAllTicketCode()
504
+ {
505
+ $codes=array();
506
+ $ticketCollection=Mage::getModel('supportticket/ticket')->getCollection();
507
+ foreach($ticketCollection as $ticket)
508
+ {
509
+ $codes[]=$ticket->getTicketCode();
510
+ }
511
+ return $codes;
512
+ }
513
+
514
+ public function getCreatedTimeOfMessage($dateString)
515
+ {
516
+ $timeZone1 = strpos($dateString,"+");
517
+ $timeZone2 = strpos($dateString,"-");
518
+
519
+ if($timeZone1)
520
+ {
521
+ $date = substr($dateString,0,$timeZone1-1);
522
+ $timeZone = substr($dateString,$timeZone1,5);
523
+ }
524
+
525
+ if($timeZone2){
526
+ $date = substr($dateString,0,$timeZone2-1);
527
+ $timeZone = substr($dateString,$timeZone2,5);
528
+ }
529
+
530
+ $timeZone =(int)substr($timeZone,0,3);
531
+ $d = date_parse($dateString);
532
+ $datetime = $this->getDateTime($d,$timeZone);
533
+
534
+ if($datetime['month']<10)
535
+ {
536
+ $datetime['month']='0'.$datetime['month'];
537
+ }
538
+ if($datetime['day']<10)
539
+ {
540
+ $datetime['day']='0'.$datetime['day'];
541
+ }
542
+ if($datetime['hour']<10)
543
+ {
544
+ $datetime['hour']='0'.$datetime['hour'];
545
+ }
546
+ if($datetime['minute']<10)
547
+ {
548
+ $datetime['minute']='0'.$datetime['minute'];
549
+ }
550
+ if($datetime['second']<10)
551
+ {
552
+ $datetime['second']='0'.$datetime['second'];
553
+ }
554
+ $datetimeString=$datetime['year']."-".$datetime['month']."-".$datetime['day']." ".$datetime['hour'].":".$datetime['minute'].":".$datetime['second'];
555
+ return $datetimeString;
556
+ }
557
+
558
+ public function getDayofMonth($month,$year)
559
+ {
560
+ $numberDay=0;
561
+ switch($month)
562
+ {
563
+ case 1:
564
+ $numberDay=31;
565
+ break;
566
+ case 2:
567
+ if($year % 4 ==0)
568
+ {
569
+ $numberDay=29;
570
+ }else{
571
+ $numberDay=28;
572
+ }
573
+ break;
574
+ case 3:
575
+ $numberDay=31;
576
+ break;
577
+ case 4:
578
+ $numberDay=30;
579
+ break;
580
+ case 5:
581
+ $numberDay=31;
582
+ break;
583
+ case 6:
584
+ $numberDay=30;
585
+ break;
586
+ case 7:
587
+ $numberDay=31;
588
+ break;
589
+ case 8:
590
+ $numberDay=31;
591
+ break;
592
+ case 9:
593
+ $numberDay=30;
594
+ break;
595
+ case 10:
596
+ $numberDay=31;
597
+ break;
598
+ case 11:
599
+ $numberDay=30;
600
+ break;
601
+ case 12:
602
+ $numberDay=31;
603
+ break;
604
+ }
605
+ return $numberDay;
606
+ }
607
+
608
+ public function getDateTime($data,$timeZone)
609
+ {
610
+ $hour=$data['hour']-$timeZone;
611
+ if($hour<0)
612
+ {
613
+ $hour+=10;
614
+ $day=$data['day']-1;
615
+ if($day==0)
616
+ {
617
+ $month=$data['month']-1;
618
+ if($month==0)
619
+ {
620
+ $month==12;
621
+ $data['year']=$data['year']-1;
622
+ }
623
+ $day=$this->getDayofMonth($month,$data['year']);
624
+ $data['mont']=$month;
625
+ }
626
+ $data['day']=$day;
627
+ }
628
+ if($hour>24)
629
+ {
630
+ $hour-=24;
631
+ $day=$data['day']+1;
632
+ if($day>$this->getDayofMonth($data['month']))
633
+ {
634
+ $day=1;
635
+ $month=$data['month']+1;
636
+ if($month>12)
637
+ {
638
+ $month=1;
639
+ $year=$data['year']+1;
640
+ $data['year']=$year;
641
+ }
642
+ $data['month']=$month;
643
+ }
644
+ $data['day']=$day;
645
+ }
646
+ $data['hour']=$hour;
647
+ return $data;
648
+ }
649
+
650
+ public function checkCreatedTimeOfMessageExist($ticketId,$time)
651
+ {
652
+ $messageCollection = Mage::getModel('supportticket/message')
653
+ ->getCollection()
654
+ ->addFieldToFilter('ticket_id',$ticketId)
655
+ ->addFieldToFilter('created_time',$time);
656
+ if($messageCollection->getSize())
657
+ {
658
+ return true;
659
+ }else{
660
+ return false;
661
+ }
662
+ }
663
+
664
+ public function getString2($mail)
665
+ {
666
+ $p1=strpos($mail,'@');
667
+ $host=substr($mail,$p1+1,strlen($mail)-$p1);
668
+ if($host=='gmail.com'){
669
+ return 'gmail';
670
+ }else if($host=='yahoo.com'){
671
+ return 'yahoo';
672
+ }
673
+ }
674
+
675
+ public function refineString($string)
676
+ {
677
+ $refined_string = str_replace(' ','-',strtolower($string));
678
+ return $refined_string;
679
+ }
680
+ }
app/code/local/Magestore/Supportticket/Model/Department.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Department extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $store_id = $this->getStoreId();
9
+ if(!$store_id)
10
+ {
11
+ $this->store_id = 0;
12
+ }
13
+
14
+ $this->_init('supportticket/department');
15
+ }
16
+
17
+ /*
18
+ override getCollection function
19
+ getCollection based on store_id of department group
20
+ */
21
+ public function getCollection()
22
+ {
23
+
24
+ $collection = Mage::getResourceModel("supportticket/department_collection")
25
+ ->addFieldToFilter("store_id",$this->getStoreId());
26
+ return $collection;
27
+ }//end getCollection
28
+
29
+
30
+ /*
31
+ load department object for a department entity and store_id
32
+ */
33
+ public function loadByEntity($entity_id)
34
+ {
35
+ $collection = $this->getCollection()
36
+ ->addFieldToFilter('entity_id',$entity_id);
37
+ return $collection->getFirstItem();
38
+ }//end loadByEntity
39
+
40
+
41
+ }
app/code/local/Magestore/Supportticket/Model/Departmententity.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Departmententity extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportticket/departmententity');
9
+ }
10
+
11
+ public function saveDepartment()
12
+ {
13
+ $store_id = $this->getStoreId();
14
+ $stores = Mage::app()->getStores();
15
+ $department_data = $this->getDepartmentData();
16
+
17
+ $storeIdArray = array();
18
+ $storeIdArray[] = 0;
19
+ foreach($stores as $store)
20
+ {
21
+ $storeIdArray[] = $store->getStoreId();
22
+ }
23
+
24
+ $this->save();
25
+ $entity_id = $this->getEntityId();
26
+
27
+ if($store_id) //just save data for a specific store
28
+ {
29
+ $department = Mage::getModel("supportticket/department");
30
+ $department->setStoreId($store_id);
31
+ $department = $department->loadByEntity($entity_id);
32
+ $department_id = $department->getDepartmentId();
33
+
34
+ $department->addData($this->getDepartmentData());
35
+ $department->setId($department_id);
36
+ try
37
+ {
38
+ $department->save();
39
+ $department->setId(null);
40
+ }
41
+ catch (Exception $e)
42
+ {}
43
+ }
44
+ else //save data for all store
45
+ {
46
+
47
+ foreach($storeIdArray as $store)
48
+ {
49
+ $department = Mage::getModel("supportticket/department");
50
+ $department->setStoreId($store);
51
+ $department = $department->loadByEntity($entity_id);
52
+ $department_id = $department->getDepartmentId();
53
+ if(!$department_id || $store== 0|| $department_data['apply_all'] || (count($storeIdArray)==2)) //if the data for this store doesn't exist, add new data
54
+ {
55
+ $department->addData($this->getDepartmentData());
56
+ $department->setEntityId($entity_id);
57
+ $department->setStoreId($store);
58
+
59
+ $department->setId($department_id);
60
+ try
61
+ {
62
+ $department->save();
63
+ $department->setId(null);
64
+ }
65
+ catch (Exception $e)
66
+ {
67
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
68
+
69
+ }
70
+ }
71
+ }
72
+ }
73
+ }//end saveDepartmentGroup
74
+
75
+ public function changeDepartmentStatus($status)
76
+ {
77
+ $store_id = $this->getStoreId();
78
+ $stores = Mage::app()->getStores();
79
+
80
+ $storeIdArray = array();
81
+ $storeIdArray[] = 0;
82
+ foreach($stores as $store)
83
+ {
84
+ $storeIdArray[] = $store->getStoreId();
85
+ }
86
+
87
+ $entity_id = $this->getId();
88
+ foreach($storeIdArray as $store)
89
+ {
90
+ $department = Mage::getModel("supportticket/department");
91
+ $department->setStoreId($store);
92
+ $department = $department->loadByEntity($entity_id);
93
+ $department->setStatus($status);
94
+ try
95
+ {
96
+ $department->save();
97
+ }
98
+ catch (Exception $e)
99
+ {
100
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
101
+
102
+ }
103
+ }
104
+ }
105
+ }
app/code/local/Magestore/Supportticket/Model/Departmentgroup.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Departmentgroup extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $store_id = $this->getStoreId();
9
+ if(!$store_id)
10
+ {
11
+ $this->store_id = 0;
12
+ }
13
+
14
+ $this->_init('supportticket/departmentgroup');
15
+ }
16
+
17
+ /*
18
+ override getCollection function
19
+ getCollection based on store_id of department group
20
+ */
21
+ public function getCollection()
22
+ {
23
+
24
+ $collection = Mage::getResourceModel("supportticket/departmentgroup_collection")
25
+ ->addFieldToFilter("store_id",$this->getStoreId());
26
+ return $collection;
27
+ }
28
+
29
+ /*
30
+ Load Department Group object with two fields: entity_id and store_id
31
+ */
32
+ public function loadByEntity($entity_id)
33
+ {
34
+ $collection = $this->getCollection()
35
+ ->addFieldToFilter('entity_id',$entity_id);
36
+ // print_r($collection->getFirstItem());
37
+ //die("entity_id=".$entity_id.",store_id=".$this->getStoreId());
38
+ return $collection->getFirstItem();
39
+ }//end loadByEntity
40
+
41
+
42
+
43
+
44
+ }
app/code/local/Magestore/Supportticket/Model/Departmentgroupentity.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Departmentgroupentity extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportticket/departmentgroupentity');
9
+ }
10
+
11
+ public function saveDepartmentGroup()
12
+ {
13
+ $store_id = $this->getStoreId();
14
+ $stores = Mage::app()->getStores();
15
+ $group_data = $this->getGroupData();
16
+
17
+
18
+
19
+ $storeIdArray = array();
20
+ $storeIdArray[] = 0;
21
+ foreach($stores as $store)
22
+ {
23
+ $storeIdArray[] = $store->getStoreId();
24
+ }
25
+
26
+
27
+ $this->save();
28
+ $entity_id = $this->getEntityId();
29
+
30
+ if($store_id) //just save data for a specific store
31
+ {
32
+
33
+ $department_group = Mage::getModel("supportticket/departmentgroup");
34
+ $department_group->setStoreId($store_id);
35
+ $department_group = $department_group->loadByEntity($entity_id);
36
+ $department_group_id = $department_group->getDepartmentGroupId();
37
+
38
+ $department_group->addData($this->getGroupData());
39
+ $department_group->setId($department_group_id);
40
+ try
41
+ {
42
+ $department_group->save();
43
+ $department_group->setId(null);
44
+ }
45
+ catch (Exception $e)
46
+ {}
47
+ }
48
+ else //save data for all store
49
+ {
50
+
51
+ foreach($storeIdArray as $store)
52
+ {
53
+ $department_group = Mage::getModel("supportticket/departmentgroup");
54
+ $department_group->setStoreId($store);
55
+ $department_group = $department_group->loadByEntity($entity_id);
56
+ $department_group_id = $department_group->getDepartmentGroupId();
57
+ if(!$department_group_id || $store== 0 || $group_data['apply_all'] || (count($storeIdArray)==2)) //if the data for this store doesn't exist, add new data
58
+ {
59
+ $department_group->addData($group_data);
60
+ $department_group->setEntityId($entity_id);
61
+ $department_group->setStoreId($store);
62
+
63
+ $department_group->setId($department_group_id);
64
+ try
65
+ {
66
+ $department_group->save();
67
+ $department_group->setId(null);
68
+ }
69
+ catch (Exception $e)
70
+ {
71
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
72
+
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }//end saveDepartmentGroup
78
+
79
+ public function changeDepartmentGroupStatus($status)
80
+ {
81
+ $store_id = $this->getStoreId();
82
+ $stores = Mage::app()->getStores();
83
+
84
+ $storeIdArray = array();
85
+ $storeIdArray[] = 0;
86
+ foreach($stores as $store)
87
+ {
88
+ $storeIdArray[] = $store->getStoreId();
89
+ }
90
+
91
+
92
+ $entity_id = $this->getId();
93
+ foreach($storeIdArray as $store)
94
+ {
95
+ $department_group = Mage::getModel("supportticket/departmentgroup");
96
+ $department_group->setStoreId($store);
97
+ $department_group = $department_group->loadByEntity($entity_id);
98
+ $department_group->setStatus($status);
99
+ try
100
+ {
101
+ $department_group->save();
102
+ }
103
+ catch (Exception $e)
104
+ {
105
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
106
+
107
+ }
108
+ }
109
+ }
110
+ }
app/code/local/Magestore/Supportticket/Model/Email.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Email extends Mage_Core_Model_Abstract
4
+ {
5
+ const XML_PATH_CUSTOMER_CONFIRM_ADD_EMAIL_ADDRESS = "supportticket/emailtemplate/customer_confirm_add_email_address";
6
+ const XML_PATH_EMAIL_FOOTER = "supportticket/general/email_footer";
7
+
8
+ public function _construct()
9
+ {
10
+ parent::_construct();
11
+
12
+ $this->_init('supportticket/email');
13
+ }
14
+
15
+ public function sendEmailConfirmAddEmailAddress(){
16
+
17
+ $store_id = $this->getStoreId();
18
+ $translate = Mage::getSingleton('core/translate');
19
+ $translate->setTranslateInline(false);
20
+
21
+ $template = Mage::getStoreConfig(self::XML_PATH_CUSTOMER_CONFIRM_ADD_EMAIL_ADDRESS,$store_id );
22
+ $email_footer = Mage::getStoreConfig(self::XML_PATH_EMAIL_FOOTER,$store_id );
23
+
24
+ $customer_id = Mage::getSingleton('customer/session')->getCustomerId();
25
+ $customer = Mage::getSingleton('customer/customer')->load($customer_id);
26
+
27
+ //get department email
28
+ $sendTo = array(array('name'=>$customer->getName(),'email'=>$this->getEmail()));
29
+
30
+ $admin_name = trim(Mage::getStoreConfig("supportticket/general/system_admin_name",$store_id ));
31
+ $admin_email = trim(Mage::getStoreConfig("supportticket/general/system_admin_email",$store_id ));
32
+
33
+ $mailTemplate = Mage::getModel('core/email_template');
34
+
35
+ foreach ($sendTo as $recipient) {
36
+ $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$store_id))
37
+ ->sendTransactional(
38
+ $template,
39
+ array('email'=>$admin_email,'name'=>$admin_name ),
40
+ $recipient['email'],
41
+ $recipient['name'],
42
+ array(
43
+ 'customer_name' => $customer->getName(),
44
+ 'active_link' => $this->getActiveLink(),
45
+ 'email_footer' => $email_footer
46
+ )
47
+ );
48
+
49
+
50
+ /*print_r($recipient);echo("<br>admin_email=".$admin_email. ",admin_name=".$admin_name."<br>");
51
+ var_dump($mailTemplate->getProcessedTemplate(array(
52
+ 'customer_name' => $customer->getName(),
53
+ 'active_link' => $this->getActiveLink(),
54
+ 'email_footer' => $email_footer
55
+ ))); die();*/
56
+
57
+ }
58
+
59
+ $translate->setTranslateInline(true);
60
+ return $this;
61
+ }
62
+
63
+ public function getActiveLink()
64
+ {
65
+ return Mage::getBaseUrl() . "supportticket/email/active/hash_code/".$this->getHashCode();
66
+ }
67
+ }
app/code/local/Magestore/Supportticket/Model/Mailbox.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mailbox extends Mage_Core_Model_Abstract
4
+ {
5
+ public function connectMailServer($mail,$pass)
6
+ {
7
+ $hostname = $this->getHostName($mail);
8
+ $mbox=imap_open($hostname,$mail,$pass) or die('Cannot connect to Gmail: ' . imap_last_error());
9
+ return $mbox;
10
+ }
11
+ public function getHostName($mail)
12
+ {
13
+ $host=explode('@',$mail);
14
+ $hostname="";
15
+ if($host[1]=='gmail.com')
16
+ {
17
+ $hostname = "{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX";
18
+ }else if($host[1]=='yahoo.com')
19
+ {
20
+ $hostname = "{imap.mail.yahoo.com:993/imap/ssl/novalidate-cert}INBOX";
21
+ }else{
22
+ $hostname = "{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX";
23
+ }
24
+ return $hostname;
25
+ }
26
+ }
app/code/local/Magestore/Supportticket/Model/Message.php ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Message extends Mage_Core_Model_Abstract
4
+ {
5
+ const XML_PATH_DEPARTMENT_NEW_MESSAGE = "supportticket/emailtemplate/department_new_message";
6
+ const XML_PATH_CUSTOMER_SUBMIT_MESSAGE = "supportticket/emailtemplate/customer_submit_message";
7
+ const XML_PATH_ADMIN_SUBMIT_MESSAGE_TO_CUSTOMER = "supportticket/emailtemplate/admin_submit_message_to_customer";
8
+ const XML_PATH_ADMIN_SUBMIT_MESSAGE_AS_EMAIL_CONTENT_TO_CUSTOMER = "supportticket/emailtemplate/admin_submit_email_message_to_customer";
9
+
10
+ const XML_PATH_EMAIL_FOOTER = "supportticket/general/email_footer";
11
+
12
+ public function _construct()
13
+ {
14
+ parent::_construct();
15
+
16
+ $this->_init('supportticket/message');
17
+ }
18
+
19
+ public function getContent(){
20
+ $content = $this->getData('content');
21
+ $content = str_replace("\n","<br/>",$content);
22
+ return $content;
23
+ }
24
+
25
+ public function save()
26
+ {
27
+ //customer post message
28
+ if(!$this->getCreatedUser()){
29
+ $ticket = Mage::getModel('supportticket/ticket')->load($this->getTicketId());
30
+ $ticket->setStatus(Magestore_Supportticket_Model_Ticket::STATUS_OPEN)
31
+ ->save();
32
+ }
33
+ return parent::save();
34
+ }
35
+
36
+ public function sendEmailSubmitMessageToCustomer()
37
+ {
38
+ if($this->getIsPrivate())
39
+ {
40
+ return;
41
+ }
42
+ $store_id = $this->getStoreId();
43
+ $translate = Mage::getSingleton('core/translate');
44
+ $translate->setTranslateInline(false);
45
+
46
+ $template = Mage::getStoreConfig(self::XML_PATH_CUSTOMER_SUBMIT_MESSAGE,$store_id );
47
+ $email_footer = Mage::getStoreConfig(self::XML_PATH_EMAIL_FOOTER,$store_id );
48
+
49
+ $ticket = Mage::getModel("supportticket/ticket")->load($this->getTicketId());
50
+
51
+ //return if that's a private ticket
52
+ if($ticket->getIsPrivate())
53
+ {
54
+ return;
55
+ }
56
+ //return if $ticket->getCustomerEmail() is null
57
+ if(!$ticket->getCustomerEmail())
58
+ {
59
+ return;
60
+ }
61
+
62
+
63
+
64
+ $sendTo = array(
65
+ array(
66
+ 'name' => $ticket->getCustomerName(),
67
+ 'email' => $ticket->getCustomerEmail(),
68
+ )
69
+ );
70
+
71
+ //get department email
72
+ $department = Mage::getModel("supportticket/department")->load($ticket->getDepartmentId());
73
+ $department_email = $department->getDepartmentEmail();
74
+
75
+
76
+ $mailTemplate = Mage::getModel('core/email_template');
77
+
78
+
79
+
80
+ foreach ($sendTo as $recipient) {
81
+ $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$store_id))
82
+ ->sendTransactional(
83
+ $template,
84
+ array('email'=>$department_email,'name'=>$department_email),
85
+ $recipient['email'],
86
+ $recipient['name'],
87
+ array(
88
+ 'message' => $this,
89
+ 'ticket_url' => $ticket->getTicketUrl(),
90
+ 'ticket_code' => $ticket->getTicketCode(),
91
+ 'email_footer' => $email_footer,
92
+ 'customer_name' => $ticket->getCustomerName(),
93
+ 'attachment' => $this->getAttachmentLink()
94
+ )
95
+ );
96
+ }
97
+
98
+ $translate->setTranslateInline(true);
99
+ return $this;
100
+ }
101
+
102
+ public function sendEmailAdminSubmitMessageToCustomer()
103
+ {
104
+ if($this->getIsPrivate())
105
+ {
106
+ return;
107
+ }
108
+
109
+ $store_id = $this->getStoreId();
110
+ $translate = Mage::getSingleton('core/translate');
111
+ $translate->setTranslateInline(false);
112
+
113
+ // post message as normal
114
+ if(! (int) $this->getMessageType()){
115
+ $template = Mage::getStoreConfig(self::XML_PATH_ADMIN_SUBMIT_MESSAGE_TO_CUSTOMER,$store_id );
116
+ //post message as email content
117
+ } else {
118
+ $template = Mage::getStoreConfig(self::XML_PATH_ADMIN_SUBMIT_MESSAGE_AS_EMAIL_CONTENT_TO_CUSTOMER,$store_id );
119
+ }
120
+
121
+ $email_footer = Mage::getStoreConfig(self::XML_PATH_EMAIL_FOOTER,$store_id );
122
+
123
+ $ticket = Mage::getModel("supportticket/ticket")->load($this->getTicketId());
124
+
125
+ //return if that's a private ticket
126
+ if($ticket->getIsPrivate())
127
+ {
128
+ return;
129
+ }
130
+ //return if $ticket->getCustomerEmail() is null
131
+ if(!$ticket->getCustomerEmail())
132
+ {
133
+ return;
134
+ }
135
+
136
+ $sendTo = array(
137
+ array(
138
+ 'name' => $ticket->getCustomerName(),
139
+ 'email' => $ticket->getCustomerEmail(),
140
+ )
141
+ );
142
+ //Zend_Debug::dump($this->getData());die();
143
+ //get department email
144
+ $department = Mage::getModel("supportticket/department")->load($ticket->getDepartmentId());
145
+ $department_email = $department->getDepartmentEmail();
146
+
147
+
148
+ $mailTemplate = Mage::getModel('core/email_template');
149
+
150
+
151
+
152
+ foreach ($sendTo as $recipient) {
153
+ $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$store_id))
154
+ ->sendTransactional(
155
+ $template,
156
+ array('email'=>$department_email,'name'=>$department_email),
157
+ $recipient['email'],
158
+ $recipient['name'],
159
+ array(
160
+ 'message' => $this,
161
+ 'ticket_url' => $ticket->getTicketUrl(),
162
+ 'ticket_code' => $ticket->getTicketCode(),
163
+ 'email_footer' => $email_footer,
164
+ 'customer_name' => $ticket->getCustomerName(),
165
+ 'attachment' => $this->getAttachmentLink(),
166
+ 'admin_name' => Mage::getSingleton('admin/session')->getUser()->getName()
167
+ )
168
+ );
169
+ /*
170
+ var_dump($mailTemplate->getProcessedTemplate(array(
171
+ 'message' => $this,
172
+ 'ticket_url' => $ticket->getTicketUrl(),
173
+ 'ticket_code' => $ticket->getTicketCode(),
174
+ 'email_footer' => $email_footer,
175
+ 'customer_name' => $ticket->getCustomerName(),
176
+ 'attachment' => $this->getAttachmentLink(),
177
+ 'admin_name' => Mage::getSingleton('admin/session')->getUser()->getName()
178
+ )));die();*/
179
+ }
180
+
181
+ $translate->setTranslateInline(true);
182
+ return $this;
183
+ }
184
+
185
+ public function sendEmailNewMessageToDepartmentModerator()
186
+ {
187
+ if(!Mage::helper('supportticket')->isNotifyDepartment()){
188
+ return;
189
+ }
190
+
191
+ $store_id = $this->getStoreId();
192
+ $translate = Mage::getSingleton('core/translate');
193
+ $translate->setTranslateInline(false);
194
+
195
+ $template = Mage::getStoreConfig(self::XML_PATH_DEPARTMENT_NEW_MESSAGE,$store_id );
196
+ $email_footer = Mage::getStoreConfig(self::XML_PATH_EMAIL_FOOTER,$store_id );
197
+
198
+ $ticket = Mage::getModel("supportticket/ticket")->load($this->getTicketId());
199
+
200
+ $department = Mage::getModel("supportticket/department")->load($ticket->getDepartmentId());
201
+
202
+ //notify to Department
203
+ if(Mage::helper('supportticket')->isNotifyDepartment()){
204
+ $sendTo = array("name"=>$department->getDepartmentEmail(),"email"=>$department->getDepartmentEmail());
205
+ //notify to System Admin
206
+ } else {
207
+ $system_admin_email = Mage::getStoreConfig('supportticket/general/system_admin_email');
208
+ $system_admin_name = Mage::getStoreConfig('supportticket/general/system_admin_name');
209
+ $sendTo = array("name"=>$system_admin_name,"email"=>$system_admin_email);
210
+ }
211
+
212
+ //get department email
213
+ $department_email = $department->getDepartmentEmail();
214
+
215
+ $mailTemplate = Mage::getModel('core/email_template');
216
+
217
+ $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$store_id))
218
+ ->sendTransactional(
219
+ $template,
220
+ array('email'=>$department_email,'name'=>$department_email),
221
+ $sendTo['email'],
222
+ $sendTo['name'],
223
+ array(
224
+ 'message' => $this,
225
+ 'ticket_url' => $ticket->getTicketAdminUrl(),
226
+ 'ticket_code' => $ticket->getTicketCode(),
227
+ 'email_footer' => $email_footer,
228
+ 'moderator_name' => $sendTo['name'],
229
+ 'attachment' => $this->getAttachmentLink()
230
+ )
231
+ );
232
+
233
+ $translate->setTranslateInline(true);
234
+ return $this;
235
+ }
236
+
237
+ public function sendEmailNewMessageToModerator(){
238
+
239
+ $store_id = $this->getStoreId();
240
+ $translate = Mage::getSingleton('core/translate');
241
+ $translate->setTranslateInline(false);
242
+
243
+ $template = Mage::getStoreConfig(self::XML_PATH_DEPARTMENT_NEW_MESSAGE,$store_id );
244
+ $email_footer = Mage::getStoreConfig(self::XML_PATH_EMAIL_FOOTER,$store_id );
245
+
246
+ $ticket = Mage::getModel("supportticket/ticket")->load($this->getTicketId());
247
+
248
+ $department = Mage::getModel("supportticket/department")->load($ticket->getDepartmentId());
249
+ $department_moderators = $department->getDepartmentModerator();
250
+ if($ticket->getAssignedUser())
251
+ {
252
+ if($department_moderators)
253
+ {
254
+ $department_moderators .= ",". $ticket->getAssignedUser();
255
+ }
256
+ else
257
+ {
258
+ $department_moderators = $ticket->getAssignedUser();
259
+ }
260
+ }
261
+
262
+ $sendTo = array();
263
+
264
+ //get email of moderator
265
+ if($department_moderators)
266
+ {
267
+ $department_moderators = explode(",",$department_moderators);
268
+ if(count($department_moderators))
269
+ {
270
+ foreach($department_moderators as $department_moderator)
271
+ {
272
+ $admin_user = Mage::getModel("admin/user")->load($department_moderator,"username");
273
+ $sendTo[] = array("name"=>$admin_user->getUsername(),"email"=>$admin_user->getEmail());
274
+ $admin_user = null;
275
+ }
276
+ }
277
+ }
278
+
279
+
280
+
281
+ //get department email
282
+ $department_email = $department->getDepartmentEmail();
283
+
284
+ $mailTemplate = Mage::getModel('core/email_template');
285
+
286
+ foreach ($sendTo as $recipient) {
287
+ $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$store_id))
288
+ ->sendTransactional(
289
+ $template,
290
+ array('email'=>$department_email,'name'=>$department_email),
291
+ $recipient['email'],
292
+ $recipient['name'],
293
+ array(
294
+ 'message' => $this,
295
+ 'ticket_url' => $ticket->getTicketAdminUrl(),
296
+ 'ticket_code' => $ticket->getTicketCode(),
297
+ 'email_footer' => $email_footer,
298
+ 'moderator_name' => $recipient['name'],
299
+ 'attachment' => $this->getAttachmentLink()
300
+ )
301
+ );
302
+
303
+ }
304
+
305
+ $translate->setTranslateInline(true);
306
+ return $this;
307
+ }
308
+
309
+ public function getAttachmentLink()
310
+ {
311
+ $attachments = explode("*****",$this->getAttachment());
312
+
313
+ $url = "";
314
+ if(is_array($attachments))
315
+ {
316
+ $indexAttach=1;
317
+ foreach($attachments as $attachment)
318
+ {
319
+ if($attachment)
320
+ {
321
+ $attachment = explode(";",$attachment);
322
+ if(count($attachment) == 2)
323
+ {
324
+ $file_name = $attachment[0];
325
+ $file_url = Mage::helper("supportticket")->getAttachmentUrl($this->getTicketId(),$attachment[1]);
326
+ $url.= $indexAttach.". <a href='".$file_url. "' title='". Mage::helper("supportticket")->__('Click here to download') . "' target='_blank'>".$file_name."</a><br/>";
327
+ }
328
+ }
329
+ $indexAttach++;
330
+ }
331
+ }
332
+ if($url){
333
+ $url = '<b>'.Mage::helper('supportticket')->__('Attachment').': </b><br/>'.$url;
334
+ }
335
+
336
+ return $url;
337
+ }
338
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Department.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Department extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the supportticket_id refers to the key field in your database table.
8
+ $this->_init('supportticket/department', 'department_id');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Department/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Department_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportticket/department');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Departmententity.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Departmententity extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the supportticket_id refers to the key field in your database table.
8
+ $this->_init('supportticket/departmententity', 'entity_id');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Departmententity/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Departmententity_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportticket/departmententity');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Departmentgroup.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Departmentgroup extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the supportticket_id refers to the key field in your database table.
8
+ $this->_init('supportticket/departmentgroup', 'department_group_id');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Departmentgroup/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Departmentgroup_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportticket/departmentgroup');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Departmentgroupentity.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Departmentgroupentity extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the supportticket_id refers to the key field in your database table.
8
+ $this->_init('supportticket/departmentgroupentity', 'entity_id');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Departmentgroupentity/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Departmentgroupentity_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportticket/departmentgroupentity');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Email.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Email extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('supportticket/email', 'email_id');
8
+ }
9
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Email/Collection.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Model_Mysql4_Email_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+ public function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->_init('supportticket/email');
8
+ }
9
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Message.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Message extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the supportticket_id refers to the key field in your database table.
8
+ $this->_init('supportticket/message', 'message_id');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Message/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Message_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportticket/message');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Statuslog.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Statuslog extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('supportticket/statuslog', 'status_log_id');
8
+ }
9
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Statuslog/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Statuslog_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportticket/statuslog');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Supportticket.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Supportticket extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the supportticket_id refers to the key field in your database table.
8
+ $this->_init('supportticket/supportticket', 'supportticket_id');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Supportticket/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Supportticket_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportticket/supportticket');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Template.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Template extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the supportticket_id refers to the key field in your database table.
8
+ $this->_init('supportticket/template', 'template_id');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Template/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Template_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportticket/template');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Templateentity.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Templateentity extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+
8
+ $this->_init('supportticket/templateentity', 'entity_id');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Templateentity/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Templateentity_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportticket/templateentity');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Ticket.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Mysql4_Ticket extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the supportticket_id refers to the key field in your database table.
8
+ $this->_init('supportticket/ticket', 'ticket_id');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Mysql4/Ticket/Collection.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Model_Mysql4_Ticket_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+ public function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->_init('supportticket/ticket');
8
+ }
9
+ }
app/code/local/Magestore/Supportticket/Model/Observer.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Model_Observer extends Mage_Core_Model_Abstract {
3
+
4
+ protected $_quote = 'gmail_quote';
5
+
6
+ public function runScheduledFunction()
7
+ {
8
+
9
+ if(!Mage::helper('magenotification')->checkLicenseKey('Supportticket')){
10
+ return;
11
+ }
12
+
13
+ $deparmentCollection = Mage::getModel('supportticket/department')->getCollection();
14
+
15
+ if(!count($deparmentCollection)){
16
+ return;
17
+ }
18
+
19
+ foreach($deparmentCollection as $department)
20
+ {
21
+ //read all new email in mail box of department
22
+ $mbox = Mage::getModel('supportticket/mailbox')->connectMailServer($department->getDepartmentEmail(),$department->getEmailPassword());
23
+ $emails = imap_search($mbox,'UNSEEN');
24
+ $overview = imap_fetch_overview($mbox,1);
25
+
26
+ if(!$emails || !count($emails)){
27
+ continue;
28
+ }
29
+
30
+ //scan all emails for geting message
31
+ foreach($emails as $email_number){
32
+ $overview = imap_fetch_overview($mbox,$email_number,0);
33
+
34
+ $message = imap_body($mbox,$email_number,2);
35
+ $structure = imap_fetchstructure($mbox,$email_number,0);
36
+
37
+ //get ticket by email subject
38
+ $ticket = Mage::helper('supportticket')->getTicketBySubject($overview[0]->subject);
39
+ if(!$ticket){
40
+ continue;
41
+ }
42
+
43
+ //get customer email & recipient email
44
+ $customer_email = Mage::helper('supportticket')->getCustomerEmailFromAddress($overview[0]->from);
45
+ $recipient_email = Mage::helper('supportticket')->getCustomerEmailFromAddress($overview[0]->to);
46
+ if($customer_email != $ticket->getCustomerEmail()){
47
+ continue;
48
+ }
49
+
50
+ //red email content
51
+ $st = imap_fetchstructure($mbox, $email_number);
52
+ if (!empty($st->parts)) {
53
+ for ($i = 0, $j = count($st->parts); $i < $j; $i++) {
54
+
55
+ $part = $st->parts[$i];
56
+
57
+ if ($part->subtype == 'PLAIN') {
58
+ $message = imap_fetchbody($mbox, $email_number, $i+1);
59
+ break;
60
+ }
61
+
62
+ if ($part->subtype == 'ALTERNATIVE') {
63
+ if(count($part->parts)){
64
+ $k=0;
65
+ foreach($part->parts as $sub_part){
66
+ if($sub_part->subtype == 'HTML'){
67
+ $message = imap_fetchbody($mbox, $email_number, ($i+1).'.'.($k+1));
68
+ break;
69
+ } elseif($sub_part->subtype == 'PLAIN') {
70
+ $message = imap_fetchbody($mbox, $email_number, ($i+1).'.'.($k+1));
71
+ }
72
+ $k++;
73
+ }
74
+ break;
75
+ }
76
+ }
77
+
78
+ }
79
+
80
+ } else {
81
+ $message = imap_body($mbox, $email_number,2);
82
+ }
83
+ $contentTemp = imap_qprint($message);
84
+
85
+ //refine email content
86
+ $post1 = strpos($contentTemp,"Content-Transfer-Encoding: quoted-printable");
87
+ //remove quote text
88
+ if($post1){
89
+ $message_content = substr($contentTemp,$post1+47);
90
+ } else {
91
+ $message_content = $contentTemp;
92
+ }
93
+
94
+ $quote_pos = strpos($message_content,$this->_quote);
95
+ if($quote_pos){
96
+ $message_content = substr($message_content,0,$quote_pos);
97
+ } else {
98
+ $customer_email_pos = strpos($message_content,$customer_email);
99
+ if($customer_email_pos){
100
+ $message_content = substr($message_content,0,$customer_email_pos);
101
+ } else {
102
+ $recipient_email_pos = strpos($message_content,$recipient_email);
103
+ if($recipient_email_pos){
104
+ $message_content = substr($message_content,0,$recipient_email_pos);
105
+ }
106
+ }
107
+ }
108
+ $message_content = str_replace('<br>',"\n",$message_content);
109
+ $message_content = str_replace('<br/>',"\n",$message_content);
110
+
111
+ //prepare message data
112
+ $data = array();
113
+ $data['ticket_id'] = $ticket->getId();
114
+ $data['customer_email'] = $customer_email;
115
+ $data['content'] = strip_tags(html_entity_decode($message_content));
116
+ $data['created_time'] = Mage::helper('supportticket')->getCreatedTimeOfMessage($overview[0]->date);
117
+
118
+ //check if message is existed
119
+ if(Mage::helper('supportticket')->checkCreatedTimeOfMessageExist($ticket->getId(),$data['created_time'])){
120
+ continue;
121
+ }
122
+
123
+ //save message
124
+ $message_model = Mage::getModel('supportticket/message');
125
+ $message_model->setData($data)
126
+ ->save();
127
+
128
+ //save attached files
129
+ $numparts = count($structure->parts);
130
+ if ($numparts > 1) {
131
+ $i=1;
132
+ $attachedFiles = array();
133
+ foreach ($structure->parts as $part) {
134
+ try{
135
+ if($part->disposition == "ATTACHMENT"){
136
+ $original_file_name = $part->dparameters[0]->value;
137
+ $original_file_name = Mage::helper('supportticket')->refineString($original_file_name);
138
+ $fileName = Mage::helper('supportticket')->getNewFileName($original_file_name,$ticket->getId(),$message_model->getId());
139
+ $attachedFiles[] = $original_file_name.";".$fileName;
140
+ Mage::helper('supportticket')->getAttachFile($mbox,$structure,$i,$email_number,$ticket->getId(),$message_model->getId());
141
+ $i++;
142
+ }
143
+ }catch(Exception $e){
144
+ continue;
145
+ }
146
+ }
147
+ if(count($attachedFiles)){
148
+ $serialized_attached_files = implode('*****',$attachedFiles);
149
+ $message_model->setData('attachment',$serialized_attached_files);
150
+ $message_model->save();
151
+ }
152
+ }
153
+
154
+ //email to moderator
155
+ $message_model->sendEmailNewMessageToModerator();
156
+ }
157
+ }
158
+ }
159
+ }
160
+ ?>
app/code/local/Magestore/Supportticket/Model/Session.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Session extends Mage_Core_Model_Session_Abstract
4
+ {
5
+ public function __construct()
6
+ {
7
+ $namespace = 'Supportticket';
8
+
9
+ $this->init($namespace);
10
+
11
+ }
12
+ }
app/code/local/Magestore/Supportticket/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Status extends Varien_Object
4
+ {
5
+ const STATUS_ENABLED = 1;
6
+ const STATUS_DISABLED = 2;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_ENABLED => Mage::helper('supportticket')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('supportticket')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/local/Magestore/Supportticket/Model/Statuslog.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Statuslog extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+
9
+ $this->_init('supportticket/statuslog');
10
+ }
11
+ }
app/code/local/Magestore/Supportticket/Model/Supportticket.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Supportticket extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportticket/supportticket');
9
+ }
10
+ }
app/code/local/Magestore/Supportticket/Model/Template.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Template extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $store_id = $this->getStoreId();
9
+ if(!$store_id)
10
+ {
11
+ $this->store_id = 0;
12
+ }
13
+
14
+ $this->_init('supportticket/template');
15
+ }
16
+
17
+ /*
18
+ override getCollection function
19
+ getCollection based on store_id of template
20
+ */
21
+ public function getCollection()
22
+ {
23
+
24
+ $collection = Mage::getResourceModel("supportticket/template_collection")
25
+ ->addFieldToFilter("store_id",$this->getStoreId());
26
+ return $collection;
27
+ }
28
+
29
+ /*
30
+ Load Template object with two fields: entity_id and store_id
31
+ */
32
+ public function loadByEntity($entity_id)
33
+ {
34
+ $collection = $this->getCollection()
35
+ ->addFieldToFilter('entity_id',$entity_id);
36
+
37
+ return $collection->getFirstItem();
38
+ }//end loadByEntity
39
+
40
+
41
+
42
+
43
+ }
app/code/local/Magestore/Supportticket/Model/Templateentity.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Model_Templateentity extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportticket/templateentity');
9
+ }
10
+
11
+ public function saveTemplate()
12
+ {
13
+ $store_id = $this->getStoreId();
14
+ $stores = Mage::app()->getStores();
15
+ $template_data = $this->getTemplateData();
16
+
17
+ $storeIdArray = array();
18
+ $storeIdArray[] = 0;
19
+ foreach($stores as $store)
20
+ {
21
+ $storeIdArray[] = $store->getStoreId();
22
+ }
23
+
24
+
25
+ $this->save();
26
+ $entity_id = $this->getEntityId();
27
+
28
+ if($store_id) //just save data for a specific store
29
+ {
30
+
31
+ $template = Mage::getModel("supportticket/template");
32
+ $template->setStoreId($store_id);
33
+ $template = $template->loadByEntity($entity_id);
34
+ $template_id = $template->getTemplateId();
35
+
36
+ $template->addData($this->getTemplateData());
37
+ $template->setId($template_id);
38
+ try
39
+ {
40
+ $template->save();
41
+ $template->setId(null);
42
+ }
43
+ catch (Exception $e)
44
+ {}
45
+ }
46
+ else //save data for all store
47
+ {
48
+
49
+ foreach($storeIdArray as $store)
50
+ {
51
+ $template = Mage::getModel("supportticket/template");
52
+ $template->setStoreId($store);
53
+ $template = $template->loadByEntity($entity_id);
54
+ $template_id = $template->getTemplateId();
55
+ if(!$template_id || $store== 0 || $template_data['apply_all'] || (count($storeIdArray)==2)) //if the data for this store doesn't exist, add new data
56
+ {
57
+ $template->addData($template_data);
58
+ $template->setEntityId($entity_id);
59
+ $template->setStoreId($store);
60
+
61
+ $template->setId($template_id);
62
+ try
63
+ {
64
+ $template->save();
65
+ $template->setId(null);
66
+ }
67
+ catch (Exception $e)
68
+ {
69
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
70
+
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }//end saveDepartmentGroup
76
+
77
+ public function changeTemplateStatus($status)
78
+ {
79
+ $store_id = $this->getStoreId();
80
+ $stores = Mage::app()->getStores();
81
+
82
+ $storeIdArray = array();
83
+ $storeIdArray[] = 0;
84
+ foreach($stores as $store)
85
+ {
86
+ $storeIdArray[] = $store->getStoreId();
87
+ }
88
+
89
+
90
+ $entity_id = $this->getId();
91
+ foreach($storeIdArray as $store)
92
+ {
93
+ $template = Mage::getModel("supportticket/template");
94
+ $template->setStoreId($store);
95
+ $template = $template->loadByEntity($entity_id);
96
+ $template->setStatus($status);
97
+ try
98
+ {
99
+ $template->save();
100
+ }
101
+ catch (Exception $e)
102
+ {
103
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
104
+
105
+ }
106
+ }
107
+ }
108
+ }
app/code/local/Magestore/Supportticket/Model/Ticket.php ADDED
@@ -0,0 +1,632 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Model_Ticket extends Mage_Core_Model_Abstract
3
+ {
4
+ const XML_PATH_DEPARTMENT_NEW_TICKET = "supportticket/emailtemplate/department_new_ticket";
5
+ const XML_PATH_ADMIN_SUBMIT_TICKET_TO_CUSTOMER = "supportticket/emailtemplate/admin_submit_ticket_to_customer";
6
+ const XML_PATH_CUSTOMER_SUBMIT_TICKET = "supportticket/emailtemplate/customer_submit_ticket";
7
+ const XML_PATH_ADMIN_ASSIGN_TICKET = "supportticket/emailtemplate/admin_assign_ticket";
8
+ const XML_PATH_MODERATOR_CLOSE_TICKET = "supportticket/emailtemplate/moderator_close_ticket";
9
+ const XML_PATH_MODERATOR_PUBLIC_TICKET = "supportticket/emailtemplate/moderator_public_ticket";
10
+ const XML_PATH_EMAIL_FOOTER = "supportticket/general/email_footer";
11
+
12
+ const STATUS_OPEN = "Open";
13
+ const STATUS_WAITING_REPLY = "Waiting Reply";
14
+ const STATUS_IN_PROGRESS = "In Progress";
15
+ const STATUS_WAITING_APPROVAL = "Waiting Approval";
16
+ const STATUS_CLOSED = "Closed";
17
+ const STATUS_SUPPORT_NEDDED = "Support Needed";
18
+
19
+
20
+ public function _construct()
21
+ {
22
+ parent::_construct();
23
+
24
+ $this->_init('supportticket/ticket');
25
+ }
26
+
27
+ public function getContent(){
28
+ $content = $this->getData('ticket_content');
29
+ $content = str_replace("\n","<br/>",$content);
30
+ return $content;
31
+ }
32
+
33
+ public function getTicketContent(){
34
+ $content = $this->getData('ticket_content');
35
+ $content = str_replace("\n","<br/>",$content);
36
+ return $content;
37
+ }
38
+
39
+ /*
40
+ Send email to customer after they submited a ticket
41
+ */
42
+ public function sendEmailNewTiketToCustomer(){
43
+
44
+ //return if that's a private ticket
45
+ if($this->getIsPrivate())
46
+ {
47
+ return;
48
+ }
49
+
50
+ $store_id = $this->getStoreId();
51
+ $translate = Mage::getSingleton('core/translate');
52
+ $translate->setTranslateInline(false);
53
+
54
+
55
+ $template = Mage::getStoreConfig(self::XML_PATH_CUSTOMER_SUBMIT_TICKET,$store_id );
56
+ $email_footer = Mage::getStoreConfig(self::XML_PATH_EMAIL_FOOTER,$store_id );
57
+
58
+ //return if $this->getCustomerEmail() is null
59
+ if(!$this->getCustomerEmail())
60
+ {
61
+ return;
62
+ }
63
+
64
+ if(!$this->getCustomerName())
65
+ {
66
+ $this->setCustomerName($this->getCustomerEmail());
67
+ }
68
+
69
+ $sendTo = array(
70
+ array(
71
+ 'name' => $this->getCustomerName(),
72
+ 'email' => $this->getCustomerEmail(),
73
+ )
74
+ );
75
+
76
+ //get department email
77
+ $department = Mage::getModel("supportticket/department")->load($this->getDepartmentId());
78
+ $department_email = $department->getDepartmentEmail();
79
+
80
+
81
+ $mailTemplate = Mage::getModel('core/email_template');
82
+
83
+ foreach ($sendTo as $recipient) {
84
+ $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$store_id))
85
+ ->sendTransactional(
86
+ $template,
87
+ array('email'=>$department_email,'name'=>$department_email),
88
+ $recipient['email'],
89
+ $recipient['name'],
90
+ array(
91
+ 'ticket' => $this,
92
+ 'ticket_url' => $this->getTicketUrl(),
93
+ 'email_footer' => $email_footer
94
+ )
95
+ );
96
+
97
+ }
98
+ /*var_dump($mailTemplate->getProcessedTemplate(array(
99
+ 'ticket' => $this,
100
+ 'ticket_url' => $this->getTicketUrl()
101
+ )));*/
102
+ $translate->setTranslateInline(true);
103
+ return $this;
104
+ }
105
+
106
+
107
+ public function sendEmailAdminSubmitTiketToCustomer(){
108
+
109
+ //return if that's a private ticket
110
+ if($this->getIsPrivate())
111
+ {
112
+ return;
113
+ }
114
+
115
+ $store_id = $this->getStoreId();
116
+ $translate = Mage::getSingleton('core/translate');
117
+ $translate->setTranslateInline(false);
118
+
119
+
120
+ $template = Mage::getStoreConfig(self::XML_PATH_ADMIN_SUBMIT_TICKET_TO_CUSTOMER,$store_id );
121
+ $email_footer = Mage::getStoreConfig(self::XML_PATH_EMAIL_FOOTER,$store_id );
122
+
123
+ //return if $this->getCustomerEmail() is null
124
+ if(!$this->getCustomerEmail())
125
+ {
126
+ return;
127
+ }
128
+
129
+ if(!$this->getCustomerName())
130
+ {
131
+ $this->setCustomerName($this->getCustomerEmail());
132
+ }
133
+
134
+ $sendTo = array(
135
+ array(
136
+ 'name' => $this->getCustomerName(),
137
+ 'email' => $this->getCustomerEmail(),
138
+ )
139
+ );
140
+
141
+ //get department email
142
+ $department = Mage::getModel("supportticket/department")->load($this->getDepartmentId());
143
+ $department_email = $department->getDepartmentEmail();
144
+
145
+
146
+ $mailTemplate = Mage::getModel('core/email_template');
147
+ //Zend_Debug::dump($this->getData());die();
148
+ //Zend_Debug::dump($this->getData());die();
149
+ foreach ($sendTo as $recipient) {
150
+ $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$store_id))
151
+ ->sendTransactional(
152
+ $template,
153
+ array('email'=>$department_email,'name'=>$department_email),
154
+ $recipient['email'],
155
+ $recipient['name'],
156
+ array(
157
+ 'ticket' => $this,
158
+ 'ticket_url' => $this->getTicketUrl(),
159
+ 'email_footer' => $email_footer,
160
+ 'customer_name' => $this->getCustomerName(),
161
+ 'admin_name' => Mage::getSingleton('admin/session')->getUser()->getName(),
162
+ 'attachment_link' => $this->getAttachmentLink()
163
+ )
164
+ );
165
+
166
+ }
167
+ /*var_dump($mailTemplate->getProcessedTemplate(array(
168
+ 'ticket' => $this,
169
+ 'ticket_url' => $this->getTicketUrl(),
170
+ 'email_footer' => $email_footer,
171
+ 'customer_name' => $this->getCustomerName(),
172
+ 'admin_name' => Mage::getSingleton('admin/session')->getUser()->getName(),
173
+ 'attachment_link' => $this->getAttachmentLink()
174
+ )));*/
175
+ $translate->setTranslateInline(true);
176
+ return $this;
177
+ }
178
+
179
+ /*
180
+ Send email to department's moderator after a customer submited a ticket
181
+ */
182
+ public function sendEmailNewTicketToDepartmentModerator()
183
+ {
184
+ if(!Mage::helper('supportticket')->isNotifyDepartment()){
185
+ return;
186
+ }
187
+
188
+ $store_id = $this->getStoreId();
189
+ $translate = Mage::getSingleton('core/translate');
190
+ $translate->setTranslateInline(false);
191
+
192
+ $template = Mage::getStoreConfig(self::XML_PATH_DEPARTMENT_NEW_TICKET,$store_id );
193
+ $email_footer = Mage::getStoreConfig(self::XML_PATH_EMAIL_FOOTER,$store_id );
194
+
195
+ //get department email
196
+
197
+ $department = Mage::getModel("supportticket/department")->load($this->getDepartmentId());
198
+
199
+ //notify to Department
200
+ if(Mage::helper('supportticket')->isNotifyDepartment()){
201
+ $sendTo = array("name"=>$department->getDepartmentEmail(),"email"=>$department->getDepartmentEmail());
202
+ //notify to System Admin
203
+ } else {
204
+ $system_admin_email = Mage::getStoreConfig('supportticket/general/system_admin_email');
205
+ $system_admin_name = Mage::getStoreConfig('supportticket/general/system_admin_name');
206
+ $sendTo = array("name"=>$system_admin_name,"email"=>$system_admin_email);
207
+ }
208
+
209
+ $mailTemplate = Mage::getModel('core/email_template');
210
+ //Zend_Debug::dump($this->getData());die();
211
+ $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$store_id))
212
+ ->sendTransactional(
213
+ $template,
214
+ array('email'=>$department->getDepartmentEmail(),'name'=>$department->getDepartmentEmail()),
215
+ $sendTo['email'],
216
+ $sendTo['name'],
217
+ array(
218
+ 'ticket' => $this,
219
+ 'ticket_admin_url' => $this->getTicketAdminUrl(),
220
+ 'email_footer' => $email_footer,
221
+ 'department_name' => $recipient['name'],
222
+ 'attachment_link' => $this->getAttachmentLink()
223
+ )
224
+ );
225
+ $translate->setTranslateInline(true);
226
+ return $this;
227
+ }
228
+
229
+ public function sendEmailNewTiketToModerator(){
230
+
231
+ $store_id = $this->getStoreId();
232
+ $translate = Mage::getSingleton('core/translate');
233
+ $translate->setTranslateInline(false);
234
+
235
+
236
+ $template = Mage::getStoreConfig(self::XML_PATH_DEPARTMENT_NEW_TICKET,$store_id );
237
+ $email_footer = Mage::getStoreConfig(self::XML_PATH_EMAIL_FOOTER,$store_id );
238
+
239
+ //get department email
240
+ $sendTo = array();
241
+
242
+ $department = Mage::getModel("supportticket/department")->load($this->getDepartmentId());
243
+ //$sendTo[] = array("name"=>$department->getDepartmentEmail(),"email"=>$department->getDepartmentEmail());
244
+ $department_moderators = $department->getDepartmentModerator();
245
+
246
+ //get email of moderator
247
+ if($department_moderators)
248
+ {
249
+ $department_moderators = explode(",",$department_moderators);
250
+ if(count($department_moderators))
251
+ {
252
+ foreach($department_moderators as $department_moderator)
253
+ {
254
+ $admin_user = Mage::getModel("admin/user")->load($department_moderator,"username");
255
+ $sendTo[] = array("name"=>$admin_user->getEmail(),"email"=>$admin_user->getEmail());
256
+ $admin_user = null;
257
+ }
258
+ }
259
+ }
260
+
261
+ $mailTemplate = Mage::getModel('core/email_template');
262
+ //Zend_Debug::dump($sendTo);die();
263
+ foreach ($sendTo as $recipient) {
264
+ $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$store_id))
265
+ ->sendTransactional(
266
+ $template,
267
+ array('email'=>$department->getDepartmentEmail(),'name'=>$department->getDepartmentEmail()),
268
+ $recipient['email'],
269
+ $recipient['name'],
270
+ array(
271
+ 'ticket' => $this,
272
+ 'ticket_admin_url' => $this->getTicketAdminUrl(),
273
+ 'email_footer' => $email_footer,
274
+ 'department_name' => $recipient['name'],
275
+ 'attachment_link' => $this->getAttachmentLink()
276
+ )
277
+ );
278
+ }
279
+ $translate->setTranslateInline(true);
280
+ return $this;
281
+ }
282
+
283
+ /*
284
+ Send email to department's moderator after a customer submited a ticket
285
+ */
286
+ public function sendEmailModeratorAssignTiketToUser(){
287
+
288
+ $store_id = $this->getStoreId();
289
+ $translate = Mage::getSingleton('core/translate');
290
+ $translate->setTranslateInline(false);
291
+
292
+ $template = Mage::getStoreConfig(self::XML_PATH_ADMIN_ASSIGN_TICKET,$store_id );
293
+ $email_footer = Mage::getStoreConfig(self::XML_PATH_EMAIL_FOOTER,$store_id );
294
+
295
+ //get department email
296
+ $sendTo = array();
297
+
298
+ $department = Mage::getModel("supportticket/department")->load($this->getDepartmentId());
299
+
300
+ $assigned_users = $this->getAssignedUser();
301
+
302
+ //get email of moderator
303
+ if($assigned_users)
304
+ {
305
+ $assigned_users = explode(",",$assigned_users);
306
+
307
+
308
+
309
+ if(count($assigned_users))
310
+ {
311
+ foreach($assigned_users as $assigned_user)
312
+ {
313
+ $admin_user = Mage::getModel("admin/user")->load($assigned_user,"username");
314
+ $sendTo[] = array("name"=>$admin_user->getUsername(),"email"=>$admin_user->getEmail());
315
+ $admin_user = null;
316
+ }
317
+ }
318
+ }
319
+
320
+ $mailTemplate = Mage::getModel('core/email_template');
321
+
322
+ foreach ($sendTo as $recipient) {
323
+ $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$store_id))
324
+ ->sendTransactional(
325
+ $template,
326
+ array('email'=>$department->getDepartmentEmail(),'name'=>$department->getDepartmentEmail()),
327
+ $recipient['email'],
328
+ $recipient['name'],
329
+ array(
330
+ 'ticket' => $this,
331
+ 'moderator_name' => $recipient['name'],
332
+ 'email_footer' => $email_footer,
333
+ 'ticket_admin_url' => $this->getTicketAdminUrl()
334
+ )
335
+ );
336
+
337
+ /*var_dump($mailTemplate->getProcessedTemplate(array(
338
+ ''ticket' => $this,
339
+ 'moderator_name' => $recipient['name'],
340
+ 'email_footer' => $email_footer,
341
+ 'ticket_admin_url' => $this->getTicketAdminUrl()
342
+
343
+ )));*/
344
+ }
345
+
346
+ $translate->setTranslateInline(true);
347
+ return $this;
348
+ }
349
+
350
+ /*
351
+ Send email to department's moderator after a user closed a ticket
352
+ */
353
+ public function sendEmailClosedTiketToModerator(){
354
+
355
+ $store_id = $this->getStoreId();
356
+ $translate = Mage::getSingleton('core/translate');
357
+ $translate->setTranslateInline(false);
358
+
359
+ $template = Mage::getStoreConfig(self::XML_PATH_MODERATOR_CLOSE_TICKET,$store_id );
360
+ $email_footer = Mage::getStoreConfig(self::XML_PATH_EMAIL_FOOTER,$store_id );
361
+
362
+ //get department email
363
+ $sendTo = array();
364
+
365
+ $department = Mage::getModel("supportticket/department")->load($this->getDepartmentId());
366
+
367
+
368
+ $department_moderators = $department->getDepartmentModerator();
369
+
370
+ //get email of moderator
371
+ if($department_moderators)
372
+ {
373
+ $department_moderators = explode(",",$department_moderators);
374
+
375
+
376
+
377
+ if(count($department_moderators))
378
+ {
379
+ foreach($department_moderators as $department_moderator)
380
+ {
381
+ $admin_user = Mage::getModel("admin/user")->load($department_moderator,"username");
382
+ $sendTo[] = array("name"=>$admin_user->getEmail(),"email"=>$admin_user->getEmail());
383
+ $admin_user = null;
384
+ }
385
+ }
386
+ }
387
+
388
+ $mailTemplate = Mage::getModel('core/email_template');
389
+
390
+ foreach ($sendTo as $recipient) {
391
+ $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$store_id))
392
+ ->sendTransactional(
393
+ $template,
394
+ array('email'=>$department->getDepartmentEmail(),'name'=>$department->getDepartmentEmail()),
395
+ $recipient['email'],
396
+ $recipient['name'],
397
+ array(
398
+ 'ticket' => $this,
399
+ 'admin_name' => $recipient['name'],
400
+ 'type' => $this->getStatus()=='Closed'?Mage::helper('supportticket')->__('closed'): Mage::helper('supportticket')->__('Re-opened'),
401
+ 'email_footer' => $email_footer,
402
+ 'ticket_admin_url' => $this->getTicketAdminUrl()
403
+ )
404
+ );
405
+
406
+ /*var_dump($mailTemplate->getProcessedTemplate(array(
407
+ 'ticket' => $this,
408
+ 'admin_name' => $recipient['name'],
409
+ 'type' => $this->getStatus()=='Closed'?Mage::helper('supportticket')->__('closed'): Mage::helper('supportticket')->__('Re-opened')
410
+
411
+ )));die();*/
412
+ }
413
+
414
+ $translate->setTranslateInline(true);
415
+ return $this;
416
+ }
417
+
418
+ public function sendEmailPublicTiketToModerator(){
419
+
420
+ $store_id = $this->getStoreId();
421
+ $translate = Mage::getSingleton('core/translate');
422
+ $translate->setTranslateInline(false);
423
+
424
+ $template = Mage::getStoreConfig(self::XML_PATH_MODERATOR_PUBLIC_TICKET,$store_id );
425
+ $email_footer = Mage::getStoreConfig(self::XML_PATH_EMAIL_FOOTER,$store_id );
426
+
427
+ $department = Mage::getModel("supportticket/department")->load($this->getDepartmentId());
428
+
429
+ //get department email
430
+ $sendTo = array();
431
+
432
+ $department_moderators = $department->getDepartmentModerator();
433
+
434
+ //get email of moderator
435
+ if($department_moderators)
436
+ {
437
+ $department_moderators = explode(",",$department_moderators);
438
+
439
+
440
+
441
+ if(count($department_moderators))
442
+ {
443
+ foreach($department_moderators as $department_moderator)
444
+ {
445
+ $admin_user = Mage::getModel("admin/user")->load($department_moderator,"username");
446
+ $sendTo[] = array("name"=>$admin_user->getEmail(),"email"=>$admin_user->getEmail());
447
+ $admin_user = null;
448
+ }
449
+ }
450
+ }
451
+
452
+ $mailTemplate = Mage::getModel('core/email_template');
453
+
454
+ foreach ($sendTo as $recipient) {
455
+ $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$store_id))
456
+ ->sendTransactional(
457
+ $template,
458
+ array('email'=>$department->getDepartmentEmail(),'name'=>$department->getDepartmentEmail()),
459
+ $recipient['email'],
460
+ $recipient['name'],
461
+ array(
462
+ 'ticket' => $this,
463
+ 'admin_name' => $recipient['name'],
464
+ 'type' => $this->getIsPrivate()?Mage::helper('supportticket')->__('Private'): Mage::helper('supportticket')->__('Public'),
465
+ 'email_footer' => $email_footer,
466
+ 'ticket_admin_url' => $this->getTicketAdminUrl()
467
+ )
468
+ );
469
+
470
+ /*var_dump($mailTemplate->getProcessedTemplate(array(
471
+ 'ticket' => $this,
472
+ 'admin_name' => $recipient['name'],
473
+ 'type' => $this->getIsPrivate()?Mage::helper('supportticket')->__('Private'): Mage::helper('supportticket')->__('Public')
474
+ ))); die();*/
475
+ }
476
+
477
+ $translate->setTranslateInline(true);
478
+ return $this;
479
+ }
480
+
481
+ /*
482
+ get list of ticket for the logged-in user.
483
+ user can see the ticket if they are in the list of department user
484
+ */
485
+ public function getCollectionByLoggedInUser()
486
+ {
487
+ $loggedin_user = Mage::getSingleton('admin/session')->getUser()->getUsername();
488
+ $department_collection = Mage::getResourceModel("supportticket/department_collection");
489
+ $department_collection->getSelect()
490
+ ->where("department_moderator REGEXP '" . $loggedin_user ."'");
491
+ $departmentIds = array();
492
+
493
+ if(count($department_collection))
494
+ {
495
+ foreach($department_collection as $department)
496
+ {
497
+ $departmentIds[] = $department->getId();
498
+ }
499
+ }
500
+
501
+ $sql = "assigned_user REGEXP '".$loggedin_user."' or created_user ='".$loggedin_user."'";
502
+ if(count($departmentIds))
503
+ {
504
+ $departmentIds = implode(",",$departmentIds);
505
+ $sql .= " or department_id in (".$departmentIds.")";
506
+ }
507
+
508
+ $ticket_collection = Mage::getResourceModel("supportticket/ticket_collection");
509
+ $ticket_collection->getSelect()
510
+ ->where($sql);
511
+
512
+ return $ticket_collection;
513
+
514
+ }//end getCollectionByLoggedInUser
515
+
516
+
517
+
518
+
519
+ /*
520
+ check if the logged-in user can post message for this ticket
521
+ */
522
+ public function canPostMessageInAdmin()
523
+ {
524
+ //if this ticket is closed, you can not post message
525
+ if($this->getStatus() == 'Closed')
526
+ {
527
+ return false;
528
+ }
529
+
530
+ $loggedin_user = Mage::getSingleton('admin/session')->getUser()->getUsername();
531
+ //convent assigned user to array
532
+ $assigned_user = $this->getAssignedUser();
533
+ $assigned_user = explode(",",$assigned_user);
534
+
535
+ if(is_array($assigned_user)&& in_array($loggedin_user,$assigned_user))
536
+ {
537
+ return true;
538
+ }
539
+
540
+ //if logged in user is in assigned array
541
+ //check if the logged-in user in the modarator array
542
+ $department = Mage::getModel("supportticket/department")->load($this->getDepartmentId());
543
+ $department_moderator = $department->getDepartmentModerator();
544
+ $department_moderator = explode(",",$department_moderator);
545
+
546
+ if(is_array($department_moderator)&& in_array($loggedin_user,$department_moderator))
547
+ {
548
+ return true;
549
+ }
550
+
551
+ //if logged user is created user
552
+ $created_user = $this->getCreatedUser();
553
+ if($created_user == $loggedin_user)
554
+ {
555
+ return true;
556
+ }
557
+
558
+ return false;
559
+
560
+ }//end canPostMessage
561
+
562
+
563
+ /*
564
+ check if the logged-in user can post message for this ticket
565
+ */
566
+ public function canAssignUser()
567
+ {
568
+ //if this ticket is closed, you can not assign
569
+ if($this->getStatus() == 'Closed')
570
+ {
571
+ return false;
572
+ }
573
+
574
+ $loggedin_user = Mage::getSingleton('admin/session')->getUser()->getUsername();
575
+
576
+ //check if the logged-in user in the modarator array
577
+ $department = Mage::getModel("supportticket/department")->load($this->getDepartmentId());
578
+ $department_moderator = $department->getDepartmentModerator();
579
+ $department_moderator = explode(",",$department_moderator);
580
+
581
+ if(is_array($department_moderator)&& in_array($loggedin_user,$department_moderator))
582
+ {
583
+ return true;
584
+ }
585
+ //check if the logged-in user is ticket owner
586
+ $created_user = $this->getCreatedUser();
587
+ if($created_user == $loggedin_user)
588
+ {
589
+ return true;
590
+ }
591
+
592
+ return false;
593
+
594
+ }//end canPostMessage
595
+
596
+ public function getTicketUrl()
597
+ {
598
+ return Mage::getBaseUrl() . "supportticket/ticket/view/id/". $this->getTicketCode();
599
+ }
600
+
601
+ public function getTicketAdminUrl()
602
+ {
603
+ //return Mage::getBaseUrl() . "supportticket/adminhtml_ticket/message/id/". $this->getTicketId();
604
+ return Mage::getModel("adminhtml/url")->getUrl("supportticket/adminhtml_ticket/message", array("id"=>$this->getTicketId()));
605
+ }
606
+
607
+ public function getAttachmentLink()
608
+ {
609
+ $attachments = explode("*****",$this->getAttachment());
610
+ $url = "";
611
+ $file_index = 0;
612
+ if(is_array($attachments))
613
+ {
614
+ foreach($attachments as $attachment)
615
+ {
616
+ if($attachment)
617
+ {
618
+ $attachment = explode(";",$attachment);
619
+ if(count($attachment) == 2)
620
+ {
621
+ $file_index++;
622
+ $file_name = $attachment[0];
623
+ $file_url = Mage::helper("supportticket")->getAttachmentUrl($this->getId(),$attachment[1]);
624
+ $url .= $file_index.'. '. "<a href='".$file_url. "' title='". Mage::helper("supportticket")->__('Click here to download') . "' target='_blank'>".$file_name."</a><br/>";
625
+ }
626
+ }
627
+ }
628
+ }
629
+ //Zend_Debug::dump($url);die();
630
+ return $url;
631
+ }
632
+ }
app/code/local/Magestore/Supportticket/controllers/Adminhtml/DepartmentController.php ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Adminhtml_DepartmentController extends Mage_Adminhtml_Controller_action
3
+ {
4
+ protected function _initAction() {
5
+ $this->loadLayout()
6
+ ->_setActiveMenu('magestore/supportticket/department')
7
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Department Manager'), Mage::helper('adminhtml')->__('Department Manager'));
8
+
9
+ return $this;
10
+ }
11
+
12
+ public function indexAction() {
13
+ $this->_initAction()
14
+ ->renderLayout();
15
+ }
16
+
17
+ public function editAction() {
18
+ $id = $this->getRequest()->getParam('id');
19
+ $store_id = $this->getRequest()->getParam('store');
20
+ $department = Mage::getModel('supportticket/department');
21
+ $department->setStoreId($store_id);
22
+
23
+ $department = $department->loadByEntity($id);
24
+ $department->setId($id);
25
+ //print_r($department);
26
+
27
+ if ($department->getId() || $id == 0) {
28
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
29
+ if (!empty($data)) {
30
+ $department->setData($data);
31
+ }
32
+
33
+
34
+ Mage::register('department_data', $department);
35
+
36
+ $this->loadLayout();
37
+ $this->_setActiveMenu('magestore/supportticket/department');
38
+
39
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Department Manager'), Mage::helper('adminhtml')->__('Department Manager'));
40
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Department News'), Mage::helper('adminhtml')->__('Department News'));
41
+
42
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
43
+
44
+ $this->_addContent($this->getLayout()->createBlock('supportticket/adminhtml_department_edit'))
45
+ ->_addLeft($this->getLayout()->createBlock('supportticket/adminhtml_department_edit_tabs'));
46
+
47
+ $this->renderLayout();
48
+ } else {
49
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportticket')->__('Department does not exist'));
50
+ $this->_redirect('*/*/');
51
+ }
52
+ }
53
+
54
+ public function newAction() {
55
+ $this->_forward('edit');
56
+ }
57
+
58
+ public function saveAction() {
59
+
60
+
61
+ if ($data = $this->getRequest()->getPost()) {
62
+ $stores = Mage::app()->getStores();
63
+ if(count($stores)==1)
64
+ {
65
+ $data["apply_all"]=1;
66
+ }
67
+ $customer_group_id = $data['customer_group_id'];
68
+
69
+ if(is_array($customer_group_id))
70
+ {
71
+ $customer_group_id = implode(",",$customer_group_id);
72
+ }
73
+ $data['customer_group_id'] = $customer_group_id;
74
+
75
+
76
+ //convert department user array to string, separately by comma symbol
77
+ $department_user = $data['department_user'];
78
+ if(is_array($department_user))
79
+ {
80
+ $department_user = implode(",",$department_user);
81
+ }
82
+ $data['department_user'] = $department_user;
83
+
84
+ //convert department moderator array to string, separately by comma symbol
85
+ $department_moderator = $data['department_moderator'];
86
+ if(is_array($department_moderator))
87
+ {
88
+ $department_moderator = implode(",",$department_moderator);
89
+ }
90
+ $data['department_moderator'] = $department_moderator;
91
+
92
+
93
+ $id = $this->getRequest()->getParam('id');
94
+ $department_entity = Mage::getModel('supportticket/departmententity');
95
+ $department_entity->setEntityId($id);
96
+ $store_id = $this->getRequest()->getParam('store');
97
+ if(!$store_id)
98
+ {
99
+ $store_id = 0;
100
+ }
101
+ $department_entity->setStoreId($store_id);
102
+ $department_entity->setDepartmentData($data);
103
+
104
+ try {
105
+ $department_entity->saveDepartment();
106
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('supportticket')->__('Department was successfully saved'));
107
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
108
+
109
+ if ($this->getRequest()->getParam('back')) {
110
+ $params = array();
111
+ $params['id'] = $department_entity->getId();
112
+ if($store_id)
113
+ {
114
+ $params['store'] = $store_id;
115
+ }
116
+ //print_r($params);die();
117
+ $this->_redirect('*/*/edit', $params);
118
+ return;
119
+ }
120
+ $this->_redirect('*/*/');
121
+ return;
122
+ } catch (Exception $e) {
123
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
124
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
125
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
126
+ return;
127
+ }
128
+ }
129
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportticket')->__('Unable to find department to save'));
130
+ $this->_redirect('*/*/');
131
+ }
132
+
133
+ public function deleteAction() {
134
+ if( $this->getRequest()->getParam('id') > 0 ) {
135
+ try {
136
+ $model = Mage::getModel('supportticket/departmententity');
137
+
138
+ $model->setId($this->getRequest()->getParam('id'))
139
+ ->delete();
140
+
141
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Department was successfully deleted'));
142
+ $this->_redirect('*/*/');
143
+ } catch (Exception $e) {
144
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
145
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
146
+ }
147
+ }
148
+ $this->_redirect('*/*/');
149
+ }
150
+
151
+ public function massDeleteAction() {
152
+ $departmentIds = $this->getRequest()->getParam('department');
153
+ if(!is_array($departmentIds)) {
154
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
155
+ } else {
156
+ try {
157
+ foreach ($departmentIds as $departmentId) {
158
+ $department = Mage::getModel('supportticket/departmententity')->load($departmentId);
159
+ $department->delete();
160
+ }
161
+ Mage::getSingleton('adminhtml/session')->addSuccess(
162
+ Mage::helper('adminhtml')->__(
163
+ 'Total of %d record(s) were successfully deleted', count($departmentIds)
164
+ )
165
+ );
166
+ } catch (Exception $e) {
167
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
168
+ }
169
+ }
170
+ $this->_redirect('*/*/index');
171
+ }
172
+
173
+ public function massStatusAction()
174
+ {
175
+ $departmentIds = $this->getRequest()->getParam('department');
176
+ if(!is_array($departmentIds)) {
177
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
178
+ } else {
179
+ try {
180
+ foreach ($departmentIds as $departmentId) {
181
+ $department = Mage::getSingleton('supportticket/departmententity')
182
+ ->load($departmentId)
183
+ ->setStatus($this->getRequest()->getParam('status'))
184
+ ->setIsMassupdate(true)
185
+ ->save();
186
+ }
187
+ $this->_getSession()->addSuccess(
188
+ $this->__('Total of %d record(s) were successfully updated', count($departmentIds))
189
+ );
190
+ } catch (Exception $e) {
191
+ $this->_getSession()->addError($e->getMessage());
192
+ }
193
+ }
194
+ $this->_redirect('*/*/index');
195
+ }
196
+
197
+ public function exportCsvAction()
198
+ {
199
+ $fileName = 'department.csv';
200
+ $content = $this->getLayout()->createBlock('supportticket/adminhtml_department_grid')
201
+ ->getCsv();
202
+
203
+ $this->_sendUploadResponse($fileName, $content);
204
+ }
205
+
206
+ public function exportXmlAction()
207
+ {
208
+ $fileName = 'department.xml';
209
+ $content = $this->getLayout()->createBlock('supportticket/adminhtml_department_grid')
210
+ ->getXml();
211
+
212
+ $this->_sendUploadResponse($fileName, $content);
213
+ }
214
+
215
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
216
+ {
217
+ $response = $this->getResponse();
218
+ $response->setHeader('HTTP/1.1 200 OK','');
219
+ $response->setHeader('Pragma', 'public', true);
220
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
221
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
222
+ $response->setHeader('Last-Modified', date('r'));
223
+ $response->setHeader('Accept-Ranges', 'bytes');
224
+ $response->setHeader('Content-Length', strlen($content));
225
+ $response->setHeader('Content-type', $contentType);
226
+ $response->setBody($content);
227
+ $response->sendResponse();
228
+ die;
229
+ }
230
+ }
app/code/local/Magestore/Supportticket/controllers/Adminhtml/DepartmentgroupController.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Adminhtml_DepartmentgroupController extends Mage_Adminhtml_Controller_action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('magestore/supportticket/departmentgroup')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Department Groups Manager'), Mage::helper('adminhtml')->__('Department Group Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+ }
18
+
19
+ public function editAction() {
20
+ $id = $this->getRequest()->getParam('id');
21
+ $store_id = $this->getRequest()->getParam('store');
22
+ $department_group = Mage::getModel('supportticket/departmentgroup');
23
+ $department_group->setStoreId($store_id);
24
+
25
+ $department_group = $department_group->loadByEntity($id);
26
+ $department_group->setId($id);
27
+ //print_r($department_group);
28
+
29
+ if ($department_group->getId() || $id == 0) {
30
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
31
+ if (!empty($data)) {
32
+ $department_group->setData($data);
33
+ }
34
+
35
+
36
+
37
+ Mage::register('departmentgroup_data', $department_group);
38
+
39
+ $this->loadLayout();
40
+ $this->_setActiveMenu('magestore/supportticket/departmentgroup');
41
+
42
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Department Groups Manager'), Mage::helper('adminhtml')->__('Department Groups Manager'));
43
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Department Group News'), Mage::helper('adminhtml')->__('Department Group News'));
44
+
45
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
46
+
47
+ $this->_addContent($this->getLayout()->createBlock('supportticket/adminhtml_departmentgroup_edit'))
48
+ ->_addLeft($this->getLayout()->createBlock('supportticket/adminhtml_departmentgroup_edit_tabs'));
49
+
50
+ $this->renderLayout();
51
+ } else {
52
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportticket')->__('Department Group does not exist'));
53
+ $this->_redirect('*/*/');
54
+ }
55
+ }
56
+
57
+ public function newAction() {
58
+ $this->_forward('edit');
59
+ }
60
+
61
+ public function saveAction() {
62
+
63
+
64
+ if ($data = $this->getRequest()->getPost()) {
65
+ $stores = Mage::app()->getStores();
66
+ if(count($stores)==1)
67
+ {
68
+ $data['apply_all'] = 1;
69
+ }
70
+
71
+
72
+ $id = $this->getRequest()->getParam('id');
73
+ $department_group_entity = Mage::getModel('supportticket/departmentgroupentity');
74
+ $department_group_entity->setEntityId($id);
75
+ $store_id = $this->getRequest()->getParam('store');
76
+ if(!$store_id)
77
+ {
78
+ $store_id = 0;
79
+ }
80
+ $department_group_entity->setStoreId($store_id);
81
+ $department_group_entity->setGroupData($data);
82
+
83
+ try {
84
+ $department_group_entity->saveDepartmentGroup();
85
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('supportticket')->__('Department Group was successfully saved'));
86
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
87
+
88
+ if ($this->getRequest()->getParam('back')) {
89
+ $params = array();
90
+ $params['id'] = $department_group_entity->getId();
91
+ if($store_id)
92
+ {
93
+ $params['store'] = $store_id;
94
+ }
95
+ //print_r($params);die();
96
+ $this->_redirect('*/*/edit', $params);
97
+ return;
98
+ }
99
+ $this->_redirect('*/*/');
100
+ return;
101
+ } catch (Exception $e) {
102
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
103
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
104
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
105
+ return;
106
+ }
107
+ }
108
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportticket')->__('Unable to find department group to save'));
109
+ $this->_redirect('*/*/');
110
+ }
111
+
112
+ public function deleteAction() {
113
+ if( $this->getRequest()->getParam('id') > 0 ) {
114
+ try {
115
+ $model = Mage::getModel('supportticket/departmentgroup');
116
+
117
+ $model->setId($this->getRequest()->getParam('id'))
118
+ ->delete();
119
+
120
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Department Group was successfully deleted'));
121
+ $this->_redirect('*/*/');
122
+ } catch (Exception $e) {
123
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
124
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
125
+ }
126
+ }
127
+ $this->_redirect('*/*/');
128
+ }
129
+
130
+ public function massDeleteAction() {
131
+ $departmentgroupIds = $this->getRequest()->getParam('departmentgroup');
132
+ if(!is_array($departmentgroupIds)) {
133
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
134
+ } else {
135
+ try {
136
+ foreach ($departmentgroupIds as $departmentgroupId) {
137
+ $departmentgroup = Mage::getModel('supportticket/departmentgroup')->load($departmentgroupId);
138
+ $departmentgroup->delete();
139
+ }
140
+ Mage::getSingleton('adminhtml/session')->addSuccess(
141
+ Mage::helper('adminhtml')->__(
142
+ 'Total of %d record(s) were successfully deleted', count($departmentgroupIds)
143
+ )
144
+ );
145
+ } catch (Exception $e) {
146
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
147
+ }
148
+ }
149
+ $this->_redirect('*/*/index');
150
+ }
151
+
152
+ public function massStatusAction()
153
+ {
154
+ $entityIds = $this->getRequest()->getParam('departmentgroup');
155
+
156
+
157
+ if(!is_array($entityIds)) {
158
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
159
+ } else {
160
+ try {
161
+ foreach ($entityIds as $entityId) {
162
+ $departmentgroupentity = Mage::getSingleton('supportticket/departmentgroupentity')
163
+ ->load($entityId)
164
+ ->setStatus($this->getRequest()->getParam('status'))
165
+ ->setIsMassupdate(true)
166
+ ->save();
167
+
168
+ $departmentgroupentity->changeDepartmentGroupStatus($this->getRequest()->getParam('status'));
169
+
170
+ }
171
+ $this->_getSession()->addSuccess(
172
+ $this->__('Total of %d record(s) were successfully updated', count($entityIds))
173
+ );
174
+ } catch (Exception $e) {
175
+ $this->_getSession()->addError($e->getMessage());
176
+ }
177
+ }
178
+ $this->_redirect('*/*/index');
179
+ }
180
+
181
+ public function exportCsvAction()
182
+ {
183
+ $fileName = 'departmentgroup.csv';
184
+ $content = $this->getLayout()->createBlock('supportticket/adminhtml_departmentgroup_grid')
185
+ ->getCsv();
186
+
187
+ $this->_sendUploadResponse($fileName, $content);
188
+ }
189
+
190
+ public function exportXmlAction()
191
+ {
192
+ $fileName = 'departmentgroup.xml';
193
+ $content = $this->getLayout()->createBlock('supportticket/adminhtml_departmentgroup_grid')
194
+ ->getXml();
195
+
196
+ $this->_sendUploadResponse($fileName, $content);
197
+ }
198
+
199
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
200
+ {
201
+ $response = $this->getResponse();
202
+ $response->setHeader('HTTP/1.1 200 OK','');
203
+ $response->setHeader('Pragma', 'public', true);
204
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
205
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
206
+ $response->setHeader('Last-Modified', date('r'));
207
+ $response->setHeader('Accept-Ranges', 'bytes');
208
+ $response->setHeader('Content-Length', strlen($content));
209
+ $response->setHeader('Content-type', $contentType);
210
+ $response->setBody($content);
211
+ $response->sendResponse();
212
+ die;
213
+ }
214
+ }
app/code/local/Magestore/Supportticket/controllers/Adminhtml/StatuslogController.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Adminhtml_StatuslogController extends Mage_Adminhtml_Controller_action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('magestore/supportticket/statuslog')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Status Log View'), Mage::helper('adminhtml')->__('Status Log View'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+ }
18
+
19
+ public function exportCsvAction()
20
+ {
21
+ $fileName = 'statuslog.csv';
22
+ $content = $this->getLayout()->createBlock('supportticket/adminhtml_statuslog_grid')
23
+ ->getCsv();
24
+
25
+ $this->_sendUploadResponse($fileName, $content);
26
+ }
27
+
28
+ public function exportXmlAction()
29
+ {
30
+ $fileName = 'statuslog.xml';
31
+ $content = $this->getLayout()->createBlock('supportticket/adminhtml_statuslog_grid')
32
+ ->getXml();
33
+
34
+ $this->_sendUploadResponse($fileName, $content);
35
+ }
36
+
37
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
38
+ {
39
+ $response = $this->getResponse();
40
+ $response->setHeader('HTTP/1.1 200 OK','');
41
+ $response->setHeader('Pragma', 'public', true);
42
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
43
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
44
+ $response->setHeader('Last-Modified', date('r'));
45
+ $response->setHeader('Accept-Ranges', 'bytes');
46
+ $response->setHeader('Content-Length', strlen($content));
47
+ $response->setHeader('Content-type', $contentType);
48
+ $response->setBody($content);
49
+ $response->sendResponse();
50
+ die;
51
+ }
52
+ }
app/code/local/Magestore/Supportticket/controllers/Adminhtml/SupportticketController.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Adminhtml_SupportticketController extends Mage_Adminhtml_Controller_action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('supportticket/items')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+ }
18
+
19
+ public function editAction() {
20
+ $id = $this->getRequest()->getParam('id');
21
+ $model = Mage::getModel('supportticket/supportticket')->load($id);
22
+
23
+ if ($model->getId() || $id == 0) {
24
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
25
+ if (!empty($data)) {
26
+ $model->setData($data);
27
+ }
28
+
29
+ Mage::register('supportticket_data', $model);
30
+
31
+ $this->loadLayout();
32
+ $this->_setActiveMenu('supportticket/items');
33
+
34
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
35
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
36
+
37
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
38
+
39
+ $this->_addContent($this->getLayout()->createBlock('supportticket/adminhtml_supportticket_edit'))
40
+ ->_addLeft($this->getLayout()->createBlock('supportticket/adminhtml_supportticket_edit_tabs'));
41
+
42
+ $this->renderLayout();
43
+ } else {
44
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportticket')->__('Item does not exist'));
45
+ $this->_redirect('*/*/');
46
+ }
47
+ }
48
+
49
+ public function newAction() {
50
+ $this->_forward('edit');
51
+ }
52
+
53
+ public function saveAction() {
54
+ if ($data = $this->getRequest()->getPost()) {
55
+
56
+ if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
57
+ try {
58
+ /* Starting upload */
59
+ $uploader = new Varien_File_Uploader('filename');
60
+
61
+ // Any extention would work
62
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
63
+ $uploader->setAllowRenameFiles(false);
64
+
65
+ // Set the file upload mode
66
+ // false -> get the file directly in the specified folder
67
+ // true -> get the file in the product like folders
68
+ // (file.jpg will go in something like /media/f/i/file.jpg)
69
+ $uploader->setFilesDispersion(false);
70
+
71
+ // We set media as the upload dir
72
+ $path = Mage::getBaseDir('media') . DS ;
73
+ $uploader->save($path, $_FILES['filename']['name'] );
74
+
75
+ } catch (Exception $e) {
76
+
77
+ }
78
+
79
+ //this way the name is saved in DB
80
+ $data['filename'] = $_FILES['filename']['name'];
81
+ }
82
+
83
+
84
+ $model = Mage::getModel('supportticket/supportticket');
85
+ $model->setData($data)
86
+ ->setId($this->getRequest()->getParam('id'));
87
+
88
+ try {
89
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
90
+ $model->setCreatedTime(now())
91
+ ->setUpdateTime(now());
92
+ } else {
93
+ $model->setUpdateTime(now());
94
+ }
95
+
96
+ $model->save();
97
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('supportticket')->__('Item was successfully saved'));
98
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
99
+
100
+ if ($this->getRequest()->getParam('back')) {
101
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
102
+ return;
103
+ }
104
+ $this->_redirect('*/*/');
105
+ return;
106
+ } catch (Exception $e) {
107
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
108
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
109
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
110
+ return;
111
+ }
112
+ }
113
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportticket')->__('Unable to find item to save'));
114
+ $this->_redirect('*/*/');
115
+ }
116
+
117
+ public function deleteAction() {
118
+ if( $this->getRequest()->getParam('id') > 0 ) {
119
+ try {
120
+ $model = Mage::getModel('supportticket/supportticket');
121
+
122
+ $model->setId($this->getRequest()->getParam('id'))
123
+ ->delete();
124
+
125
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
126
+ $this->_redirect('*/*/');
127
+ } catch (Exception $e) {
128
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
129
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
130
+ }
131
+ }
132
+ $this->_redirect('*/*/');
133
+ }
134
+
135
+ public function massDeleteAction() {
136
+ $supportticketIds = $this->getRequest()->getParam('supportticket');
137
+ if(!is_array($supportticketIds)) {
138
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
139
+ } else {
140
+ try {
141
+ foreach ($supportticketIds as $supportticketId) {
142
+ $supportticket = Mage::getModel('supportticket/supportticket')->load($supportticketId);
143
+ $supportticket->delete();
144
+ }
145
+ Mage::getSingleton('adminhtml/session')->addSuccess(
146
+ Mage::helper('adminhtml')->__(
147
+ 'Total of %d record(s) were successfully deleted', count($supportticketIds)
148
+ )
149
+ );
150
+ } catch (Exception $e) {
151
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
152
+ }
153
+ }
154
+ $this->_redirect('*/*/index');
155
+ }
156
+
157
+ public function massStatusAction()
158
+ {
159
+ $supportticketIds = $this->getRequest()->getParam('supportticket');
160
+ if(!is_array($supportticketIds)) {
161
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
162
+ } else {
163
+ try {
164
+ foreach ($supportticketIds as $supportticketId) {
165
+ $supportticket = Mage::getSingleton('supportticket/supportticket')
166
+ ->load($supportticketId)
167
+ ->setStatus($this->getRequest()->getParam('status'))
168
+ ->setIsMassupdate(true)
169
+ ->save();
170
+ }
171
+ $this->_getSession()->addSuccess(
172
+ $this->__('Total of %d record(s) were successfully updated', count($supportticketIds))
173
+ );
174
+ } catch (Exception $e) {
175
+ $this->_getSession()->addError($e->getMessage());
176
+ }
177
+ }
178
+ $this->_redirect('*/*/index');
179
+ }
180
+
181
+ public function exportCsvAction()
182
+ {
183
+ $fileName = 'supportticket.csv';
184
+ $content = $this->getLayout()->createBlock('supportticket/adminhtml_supportticket_grid')
185
+ ->getCsv();
186
+
187
+ $this->_sendUploadResponse($fileName, $content);
188
+ }
189
+
190
+ public function exportXmlAction()
191
+ {
192
+ $fileName = 'supportticket.xml';
193
+ $content = $this->getLayout()->createBlock('supportticket/adminhtml_supportticket_grid')
194
+ ->getXml();
195
+
196
+ $this->_sendUploadResponse($fileName, $content);
197
+ }
198
+
199
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
200
+ {
201
+ $response = $this->getResponse();
202
+ $response->setHeader('HTTP/1.1 200 OK','');
203
+ $response->setHeader('Pragma', 'public', true);
204
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
205
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
206
+ $response->setHeader('Last-Modified', date('r'));
207
+ $response->setHeader('Accept-Ranges', 'bytes');
208
+ $response->setHeader('Content-Length', strlen($content));
209
+ $response->setHeader('Content-type', $contentType);
210
+ $response->setBody($content);
211
+ $response->sendResponse();
212
+ die;
213
+ }
214
+ }
app/code/local/Magestore/Supportticket/controllers/Adminhtml/TemplateController.php ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportticket_Adminhtml_TemplateController extends Mage_Adminhtml_Controller_action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('magestore/supportticket/template')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Template Manager'), Mage::helper('adminhtml')->__('Template Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+ }
18
+
19
+ public function inserttemplateAction()
20
+ {
21
+ $html = "";
22
+ $data = $this->getRequest()->getPost();
23
+ $template_id = $data['template_id'];
24
+ $template = Mage::getModel("supportticket/template")->load($template_id);
25
+ $html = $template->getContent();
26
+ //echo("template_id=".$html);
27
+ $this->getResponse()->setHeader('Content-type', 'application/x-json');
28
+ $this->getResponse()->setBody($html);
29
+ }
30
+
31
+ public function editAction() {
32
+ $id = $this->getRequest()->getParam('id');
33
+ $store_id = $this->getRequest()->getParam('store');
34
+ $template = Mage::getModel('supportticket/template');
35
+ $template->setStoreId($store_id);
36
+
37
+ $template = $template->loadByEntity($id);
38
+ $template->setId($id);
39
+
40
+
41
+ if ($template->getId() || $id == 0) {
42
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
43
+ if (!empty($data)) {
44
+ $template->setData($data);
45
+ }
46
+
47
+
48
+
49
+ Mage::register('template_data', $template);
50
+
51
+ $this->loadLayout();
52
+ $this->_setActiveMenu('magestore/supportticket/template');
53
+
54
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Template Manager'), Mage::helper('adminhtml')->__('Template Manager'));
55
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Template News'), Mage::helper('adminhtml')->__('Template News'));
56
+
57
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
58
+
59
+ $this->_addContent($this->getLayout()->createBlock('supportticket/adminhtml_template_edit'))
60
+ ->_addLeft($this->getLayout()->createBlock('supportticket/adminhtml_template_edit_tabs'));
61
+
62
+ $this->renderLayout();
63
+ } else {
64
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportticket')->__('Template does not exist'));
65
+ $this->_redirect('*/*/');
66
+ }
67
+ }
68
+
69
+ public function newAction() {
70
+ $this->_forward('edit');
71
+ }
72
+
73
+ public function saveAction() {
74
+ if ($data = $this->getRequest()->getPost()) {
75
+ $stores = Mage::app()->getStores();
76
+ if(count($stores)==1)
77
+ {
78
+ $data['apply_all'] = 1;
79
+ }
80
+
81
+
82
+ $id = $this->getRequest()->getParam('id');
83
+ $template_entity = Mage::getModel('supportticket/templateentity');
84
+ $template_entity->setEntityId($id);
85
+ $store_id = $this->getRequest()->getParam('store');
86
+ if(!$store_id)
87
+ {
88
+ $store_id = 0;
89
+ }
90
+ $template_entity->setStoreId($store_id);
91
+ $template_entity->setTemplateData($data);
92
+
93
+ try {
94
+ $template_entity->saveTemplate();
95
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('supportticket')->__('Template was successfully saved'));
96
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
97
+
98
+ if ($this->getRequest()->getParam('back')) {
99
+ $params = array();
100
+ $params['id'] = $template_entity->getId();
101
+ if($store_id)
102
+ {
103
+ $params['store'] = $store_id;
104
+ }
105
+
106
+ $this->_redirect('*/*/edit', $params);
107
+ return;
108
+ }
109
+ $this->_redirect('*/*/');
110
+ return;
111
+ } catch (Exception $e) {
112
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
113
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
114
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
115
+ return;
116
+ }
117
+ }
118
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportticket')->__('Unable to find template to save'));
119
+ $this->_redirect('*/*/');
120
+ }
121
+
122
+ public function deleteAction() {
123
+ if( $this->getRequest()->getParam('id') > 0 ) {
124
+ try {
125
+ $model = Mage::getModel('supportticket/template');
126
+
127
+ $model->setId($this->getRequest()->getParam('id'))
128
+ ->delete();
129
+
130
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Template was successfully deleted'));
131
+ $this->_redirect('*/*/');
132
+ } catch (Exception $e) {
133
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
134
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
135
+ }
136
+ }
137
+ $this->_redirect('*/*/');
138
+ }
139
+
140
+ public function massDeleteAction() {
141
+ $templateIds = $this->getRequest()->getParam('template');
142
+ if(!is_array($templateIds)) {
143
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
144
+ } else {
145
+ try {
146
+ foreach ($templateIds as $templateId) {
147
+ $template = Mage::getModel('supportticket/template')->load($templateId);
148
+ $template->delete();
149
+ }
150
+ Mage::getSingleton('adminhtml/session')->addSuccess(
151
+ Mage::helper('adminhtml')->__(
152
+ 'Total of %d record(s) were successfully deleted', count($templateIds)
153
+ )
154
+ );
155
+ } catch (Exception $e) {
156
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
157
+ }
158
+ }
159
+ $this->_redirect('*/*/index');
160
+ }
161
+
162
+ public function massStatusAction()
163
+ {
164
+ $entityIds = $this->getRequest()->getParam('template');
165
+
166
+
167
+ if(!is_array($entityIds)) {
168
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
169
+ } else {
170
+ try {
171
+ foreach ($entityIds as $entityId) {
172
+ $templateentity = Mage::getSingleton('supportticket/templateentity')
173
+ ->load($entityId)
174
+ ->setStatus($this->getRequest()->getParam('status'))
175
+ ->setIsMassupdate(true)
176
+ ->save();
177
+
178
+ $templateentity->changeTemplateStatus($this->getRequest()->getParam('status'));
179
+
180
+ }
181
+ $this->_getSession()->addSuccess(
182
+ $this->__('Total of %d record(s) were successfully updated', count($entityIds))
183
+ );
184
+ } catch (Exception $e) {
185
+ $this->_getSession()->addError($e->getMessage());
186
+ }
187
+ }
188
+ $this->_redirect('*/*/index');
189
+ }
190
+
191
+ public function exportCsvAction()
192
+ {
193
+ $fileName = 'template.csv';
194
+ $content = $this->getLayout()->createBlock('supportticket/adminhtml_template_grid')
195
+ ->getCsv();
196
+
197
+ $this->_sendUploadResponse($fileName, $content);
198
+ }
199
+
200
+ public function exportXmlAction()
201
+ {
202
+ $fileName = 'template.xml';
203
+ $content = $this->getLayout()->createBlock('supportticket/adminhtml_template_grid')
204
+ ->getXml();
205
+
206
+ $this->_sendUploadResponse($fileName, $content);
207
+ }
208
+
209
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
210
+ {
211
+ $response = $this->getResponse();
212
+ $response->setHeader('HTTP/1.1 200 OK','');
213
+ $response->setHeader('Pragma', 'public', true);
214
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
215
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
216
+ $response->setHeader('Last-Modified', date('r'));
217
+ $response->setHeader('Accept-Ranges', 'bytes');
218
+ $response->setHeader('Content-Length', strlen($content));
219
+ $response->setHeader('Content-type', $contentType);
220
+ $response->setBody($content);
221
+ $response->sendResponse();
222
+ die;
223
+ }
224
+ }
app/code/local/Magestore/Supportticket/controllers/Adminhtml/TicketController.php ADDED
@@ -0,0 +1,531 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_Adminhtml_TicketController extends Mage_Adminhtml_Controller_action
3
+ {
4
+
5
+ protected function _initAction() {
6
+ $this->loadLayout()
7
+ ->_setActiveMenu('magestore/supportticket/ticket')
8
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Ticket Manager'), Mage::helper('adminhtml')->__('Ticket Manager'));
9
+
10
+ return $this;
11
+ }
12
+
13
+ public function indexAction() {
14
+ //automatically close ticket.
15
+ $days_close = Mage::getStoreConfig("supportticket/general/days_close");
16
+ $auto_close_ticket = Mage::getStoreConfig("supportticket/general/auto_close_ticket");
17
+
18
+ if($auto_close_ticket)
19
+ {
20
+ $minutes_close = $days_close * 24 * 60;
21
+ $tickets = Mage::getResourceModel("supportticket/ticket_collection");
22
+ $tickets->getSelect()
23
+ ->where("status <> 'Closed' and TIMESTAMPDIFF(MINUTE,last_updated,now()) >=" .$minutes_close);
24
+
25
+ try
26
+ {
27
+
28
+ if(count($tickets))
29
+ {
30
+ foreach($tickets as $ticket)
31
+ {
32
+ $ticket->setStatus('Closed');
33
+ $ticket->save();
34
+ $ticket->sendEmailClosedTiketToModerator();
35
+ }
36
+ }
37
+ $this->_getSession()->addSuccess(
38
+ $this->__('Total of %d ticket(s) were successfully closed', count($tickets))
39
+ );
40
+ } catch (Exception $e)
41
+ {
42
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
43
+ }
44
+ }
45
+
46
+ $this->_initAction()
47
+ ->renderLayout();
48
+ }
49
+
50
+ public function editAction() {
51
+ $id = $this->getRequest()->getParam('id');
52
+ $ticket = Mage::getModel('supportticket/ticket')->load($id);
53
+
54
+ if ($ticket->getId() || $id == 0) {
55
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
56
+ if (!empty($data)) {
57
+ $ticket->setData($data);
58
+ }
59
+
60
+ Mage::register('ticket_data', $ticket);
61
+
62
+ $this->loadLayout();
63
+ $this->_setActiveMenu('magestore/supportticket/ticket');
64
+
65
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Ticket Manager'), Mage::helper('adminhtml')->__('Ticket Manager'));
66
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Ticket News'), Mage::helper('adminhtml')->__('Ticket News'));
67
+
68
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
69
+
70
+ $this->_addContent($this->getLayout()->createBlock('supportticket/adminhtml_ticket_edit'))
71
+ ->_addLeft($this->getLayout()->createBlock('supportticket/adminhtml_ticket_edit_tabs'));
72
+
73
+ $this->renderLayout();
74
+ } else {
75
+
76
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportticket')->__('Ticket does not exist'));
77
+ $this->_redirect('*/*/');
78
+
79
+ }
80
+ }
81
+
82
+ public function newAction() {
83
+ $this->_forward('edit');
84
+ }
85
+
86
+ public function saveAction() {
87
+ if ($data = $this->getRequest()->getPost()) {
88
+ $data['created_user'] = Mage::getSingleton('admin/session')->getUser()->getUsername();
89
+
90
+ $id = $this->getRequest()->getParam('id');
91
+ $ticket = Mage::getModel('supportticket/ticket')->load($id);
92
+ $old_attachments = explode(" ",$ticket->getAttachment());
93
+ $attachments=array();
94
+ if(is_array($old_attachments) && $old_attachments != array(''))
95
+ {
96
+ foreach($old_attachments as $old_attachment)
97
+ {
98
+ $old_attachment = explode(";",$old_attachment);
99
+ if(count($old_attachment))
100
+ {
101
+ $attachments[] = $old_attachment[1];
102
+ }
103
+ }
104
+ }
105
+ $ticket->addData($data);
106
+ if(isset($old_attachment)){
107
+ $ticket->setAttachment($old_attachment);
108
+ }
109
+ $ticket->setId($id);
110
+
111
+ if ($ticket->getId())
112
+ {
113
+ Mage::helper("supportticket")->addStatuslog($ticket->getId(),"EDIT");
114
+ }
115
+
116
+ try {
117
+ $ticket->save();
118
+ //upload file
119
+ if(is_array($_FILES))
120
+ {
121
+ $index=1;
122
+ $attachmentFile="";
123
+ foreach($_FILES as $file)
124
+ {
125
+ $attachment = Mage::helper('supportticket')->uploadTicketAttachment($file,$index,$ticket->getId());
126
+ //Zend_Debug::dump($attachment);die();
127
+ if($attachment)
128
+ {
129
+ $attachmentFile .= Mage::helper('supportticket')->refineString($file['name']) . ";" . $attachment."*****";
130
+ }
131
+ $index++;
132
+ }
133
+ $ticket->setAttachment($attachmentFile);
134
+ if(is_array($attachments))
135
+ {
136
+ foreach($attachments as $attach)
137
+ Mage::helper('supportticket')->deleteImageFile($ticket->getId(),$attach);
138
+ }
139
+ //Zend_Debug::dump($message_model->getAttachment());die();
140
+ }
141
+
142
+ $department_id = $ticket->getDepartmentId();
143
+ $department = Mage::getModel('supportticket/department')->load($department_id);
144
+ $ticket->setTicketCode($department->getDepartmentCode(). "-". $ticket->getId());
145
+ $ticket->setLastUpdated($ticket->getCreatedTime());
146
+ $ticket->save();
147
+
148
+ //send confirm email to customer and moderator
149
+ $ticket->sendEmailAdminSubmitTiketToCustomer(); //send to customer
150
+ $ticket->sendEmailNewTiketToModerator(); //send to all department moderators
151
+ $ticket->sendEmailNewTicketToDepartmentModerator();
152
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('supportticket')->__('Ticket was successfully saved'));
153
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
154
+
155
+ if ($this->getRequest()->getParam('back')) {
156
+ $params = array();
157
+ $params['id'] = $ticket->getId();
158
+ $store_id = $this->getRequest()->getParam('store');
159
+ if($store_id)
160
+ {
161
+ $params['store'] = $store_id;
162
+ }
163
+
164
+ $this->_redirect('*/*/edit', $params);
165
+ return;
166
+ }
167
+ $this->_redirect('*/*/');
168
+ return;
169
+ } catch (Exception $e) {
170
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
171
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
172
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
173
+ return;
174
+ }
175
+ }
176
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportticket')->__('Unable to find department group to save'));
177
+ $this->_redirect('*/*/');
178
+ }
179
+
180
+ public function messageAction() {
181
+ $id = $this->getRequest()->getParam('id');
182
+ $ticket = Mage::getModel('supportticket/ticket')->load($id);
183
+
184
+ if ($ticket->getId()) {
185
+ if($ticket->canPostMessageInAdmin())
186
+ {
187
+ if ($data = $this->getRequest()->getPost()) //if has post data, save message
188
+ {
189
+ try {
190
+ $data['ticket_id']= $ticket->getId();
191
+ $data['created_user'] = Mage::getSingleton('admin/session')->getUser()->getUsername();
192
+ $tempDateTime=new DateTime();
193
+ $data['created_time']=$tempDateTime->format("Y:m:d H:i:s");
194
+ $message_model = Mage::getModel('supportticket/message')->setData($data);
195
+
196
+ $message_model->save();
197
+
198
+ //upload file
199
+ if(is_array($_FILES))
200
+ {
201
+ $index=1;
202
+ $message_model = Mage::getModel('supportticket/message')->load($message_model->getId());
203
+ $attachmentFile="";
204
+ foreach($_FILES as $file)
205
+ {
206
+ $attachment = Mage::helper('supportticket')->uploadTicketAttachment($file,$index,$ticket->getId(),$message_model->getId());
207
+ //Zend_Debug::dump($attachment);die();
208
+ if($attachment)
209
+ {
210
+ $attachmentFile .= Mage::helper('supportticket')->refineString($file['name']) . ";" . $attachment."*****";
211
+ }
212
+ $index++;
213
+ }
214
+ $message_model->setData('attachment',$attachmentFile);
215
+ $message_model->save();
216
+ //Zend_Debug::dump($message_model->getAttachment());die();
217
+ }//end upload file
218
+
219
+ $message_model = Mage::getModel('supportticket/message')->load($message_model->getId());
220
+ $message_model->setMessageType($this->getRequest()->getPost('message_type'));
221
+
222
+ //send confirm email to customer and moderator
223
+ $message_model->sendEmailAdminSubmitMessageToCustomer();
224
+ $message_model->sendEmailNewMessageToModerator();
225
+ //die("toi roi");
226
+ $message_model->sendEmailNewMessageToDepartmentModerator();
227
+
228
+ //change status of ticket
229
+ if(!$ticket->getIsPrivate())
230
+ {
231
+ $ticket->setStatus(Mage::helper('supportticket')->getStatusByKey('STATUS_WAITING_REPLY'));
232
+ }
233
+ $ticket->setLastUpdated($message_model->getCreatedTime());
234
+ $ticket->save();
235
+
236
+ //add log
237
+ Mage::helper("supportticket")->addStatuslog($ticket->getId(),"POST MESSAGE");
238
+
239
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('supportticket')->__('Message was successfully sent'));
240
+ }
241
+ catch (Exception $e)
242
+ {
243
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
244
+ $this->_redirect('*/*/message', array('id' => $this->getRequest()->getParam('id')));
245
+ }
246
+ }
247
+ }
248
+
249
+
250
+ else
251
+ {
252
+ //add to log
253
+ Mage::helper("supportticket")->addStatuslog($ticket->getId(),"VIEW");
254
+ }
255
+
256
+ $message_collection = Mage::getModel('supportticket/message')->getCollection()
257
+ ->addFieldToFilter("is_private",0)
258
+ ->addFieldToFilter("ticket_id",$ticket->getId())
259
+ ->setOrder("created_time","DESC");
260
+
261
+ $private_message_collection = Mage::getModel('supportticket/message')->getCollection()
262
+ ->addFieldToFilter("is_private",1)
263
+ ->addFieldToFilter("ticket_id",$ticket->getId())
264
+ ->setOrder("created_time","DESC");
265
+
266
+ Mage::register('message_collection', $message_collection);
267
+ Mage::register('private_message_collection', $private_message_collection);
268
+
269
+ //Mage::register('message_data', $message_collection);
270
+ Mage::register('ticket', $ticket);
271
+
272
+
273
+
274
+
275
+ $this->loadLayout();
276
+ $this->_setActiveMenu('magestore/supportticket/ticket');
277
+
278
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Message Manager'), Mage::helper('adminhtml')->__('Ticket Message Manager'));
279
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Post Message'), Mage::helper('adminhtml')->__('Post Message'));
280
+
281
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
282
+
283
+ $this ->_addContent($this->getLayout()->createBlock('supportticket/adminhtml_ticket_message'))
284
+ ->_addLeft($this->getLayout()->createBlock('supportticket/adminhtml_ticket_message_tabs'));
285
+
286
+ $this->renderLayout();
287
+ } else {
288
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportticket')->__('Ticket does not exist'));
289
+ $this->_redirect('*/*/');
290
+ }
291
+ }
292
+
293
+
294
+ public function assignuserAction() {
295
+ $id = $this->getRequest()->getParam('id');
296
+ $ticket = Mage::getModel('supportticket/ticket')->load($id);
297
+
298
+ if ($ticket->getId()) {
299
+ if(!$ticket->canAssignUser())
300
+ {
301
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportticket')->__('You don\'t have the right permission to assign user for the ticket'));
302
+ $this->_redirect('*/*');
303
+ return;
304
+ }
305
+
306
+
307
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
308
+ if (!empty($data)) {
309
+ $ticket->setAssignedUser($data['assigned_user']);
310
+ }
311
+
312
+ Mage::register('ticket_data', $ticket);
313
+ Mage::register('ticket_id', $ticket->getId());
314
+
315
+ if ($data = $this->getRequest()->getPost()) //if has post data, save message
316
+ {
317
+ try {
318
+ $assigned_user = $data['assigned_user'];
319
+ if(is_array($assigned_user))
320
+ {
321
+ $assigned_user = implode(",",$assigned_user);
322
+ }
323
+
324
+ if(!$assigned_user)
325
+ {
326
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportticket')->__('You must select a least one user'));
327
+ $this->_redirect('*/*/assignuser', array('id' => $this->getRequest()->getParam('id')));
328
+ return;
329
+ }
330
+
331
+ $ticket->setAssignedUser($assigned_user);
332
+ $ticket->setLastUpdated(time());
333
+
334
+ $ticket->save();
335
+ //send email to admin user
336
+ $ticket->sendEmailModeratorAssignTiketToUser();
337
+
338
+ //add log
339
+ Mage::helper("supportticket")->addStatuslog($ticket->getId(),"ASSIGNED TO USER: ".$assigned_user);
340
+
341
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('supportticket')->__('You have assigned user successfully'));
342
+ }
343
+ catch (Exception $e)
344
+ {
345
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
346
+ $this->_redirect('*/*/assignuser', array('id' => $this->getRequest()->getParam('id')));
347
+ }
348
+ }
349
+
350
+ $this->loadLayout();
351
+ $this->_setActiveMenu('magestore/supportticket/ticket');
352
+
353
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Assign User For A Ticket'), Mage::helper('adminhtml')->__('Assign User For A Ticket'));
354
+
355
+
356
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
357
+
358
+ $this ->_addContent($this->getLayout()->createBlock('supportticket/adminhtml_ticket_assignuser'))
359
+ ->_addLeft($this->getLayout()->createBlock('supportticket/adminhtml_ticket_assignuser_tabs'));
360
+
361
+ $this->renderLayout();
362
+ } else {
363
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportticket')->__('Ticket does not exist'));
364
+ $this->_redirect('*/*/');
365
+ }
366
+ }
367
+
368
+ public function deleteAction() {
369
+ if( $this->getRequest()->getParam('id') > 0 ) {
370
+ try {
371
+ //add log
372
+ Mage::helper("supportticket")->addStatuslog($this->getRequest()->getParam('id'),"DELETE");
373
+
374
+ $model = Mage::getModel('supportticket/ticket');
375
+ $model->setId($this->getRequest()->getParam('id'))
376
+ ->delete();
377
+
378
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Ticket was successfully deleted'));
379
+ $this->_redirect('*/*/');
380
+ } catch (Exception $e) {
381
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
382
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
383
+ }
384
+ }
385
+ $this->_redirect('*/*/');
386
+ }
387
+
388
+
389
+
390
+ public function massDeleteAction() {
391
+ $ticketIds = $this->getRequest()->getParam('ticket');
392
+ if(!is_array($ticketIds)) {
393
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
394
+ } else {
395
+ try {
396
+ foreach ($ticketIds as $ticketId) {
397
+ //add log
398
+ Mage::helper("supportticket")->addStatuslog($ticketId,"delete");
399
+ //delete ticket
400
+ $ticket = Mage::getModel('supportticket/ticket')->load($ticketId);
401
+ $ticket->delete();
402
+ }
403
+ Mage::getSingleton('adminhtml/session')->addSuccess(
404
+ Mage::helper('adminhtml')->__(
405
+ 'Total of %d record(s) were successfully deleted', count($ticketIds)
406
+ )
407
+ );
408
+ } catch (Exception $e) {
409
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
410
+ }
411
+ }
412
+ $this->_redirect('*/*/index');
413
+ }
414
+
415
+ public function massTypeAction()
416
+ {
417
+ $ticketIds = $this->getRequest()->getParam('ticket');
418
+
419
+ if(!is_array($ticketIds)) {
420
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
421
+ } else {
422
+ try {
423
+ foreach ($ticketIds as $ticketId) {
424
+ //add log
425
+ Mage::helper("supportticket")->addStatuslog($ticketId,"Change Privacy Type");
426
+
427
+ $ticket = Mage::getSingleton('supportticket/ticket')
428
+ ->load($ticketId)
429
+ ->setIsPrivate($this->getRequest()->getParam('is_private'))
430
+ ->setLastUpdated(time())
431
+ ->setIsMassupdate(true)
432
+ ->save();
433
+
434
+ //send email
435
+ $ticket->sendEmailNewTiketToCustomer();
436
+ $ticket->sendEmailPublicTiketToModerator();
437
+ }
438
+ $this->_getSession()->addSuccess(
439
+ $this->__('Total of %d record(s) were successfully updated', count($ticketIds))
440
+ );
441
+ } catch (Exception $e) {
442
+ $this->_getSession()->addError($e->getMessage());
443
+ }
444
+ }
445
+ $this->_redirect('*/*/index');
446
+ }
447
+
448
+ public function massStatusAction()
449
+ {
450
+ $ticketIds = $this->getRequest()->getParam('ticket');
451
+
452
+ if(!is_array($ticketIds)) {
453
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
454
+ } else {
455
+ try {
456
+ foreach ($ticketIds as $ticketId) {
457
+ //add log
458
+ Mage::helper("supportticket")->addStatuslog($ticketId,$this->getRequest()->getParam('status'));
459
+
460
+ $ticket = Mage::getSingleton('supportticket/ticket')
461
+ ->load($ticketId)
462
+ ->setStatus($this->getRequest()->getParam('status'))
463
+ ->setLastUpdated(time())
464
+ ->setIsMassupdate(true)
465
+ ->save();
466
+
467
+ //$ticket->sendEmailClosedTiketToModerator();
468
+ }
469
+ $this->_getSession()->addSuccess(
470
+ $this->__('Total of %d record(s) were successfully updated', count($ticketIds))
471
+ );
472
+ } catch (Exception $e) {
473
+ $this->_getSession()->addError($e->getMessage());
474
+ }
475
+ }
476
+ $this->_redirect('*/*/index');
477
+ }
478
+
479
+ public function updatedepartmentAction()
480
+ {
481
+ $html = "";
482
+ $data = $this->getRequest()->getPost();
483
+ $store_id = $data['store'];
484
+ $department_options = Mage::helper('supportticket')->getDepartmentOptions($store_id);
485
+ if(count($department_options))
486
+ {
487
+ foreach($department_options as $department_option)
488
+ {
489
+ $html .= "<option value='".$department_option['value']."'>".$department_option['label']."</option>";
490
+ }
491
+ }
492
+
493
+
494
+ $this->getResponse()->setHeader('Content-type', 'application/x-json');
495
+ $this->getResponse()->setBody($html);
496
+ }
497
+
498
+ public function exportCsvAction()
499
+ {
500
+ $fileName = 'ticket.csv';
501
+ $content = $this->getLayout()->createBlock('supportticket/adminhtml_ticket_grid')
502
+ ->getCsv();
503
+
504
+ $this->_sendUploadResponse($fileName, $content);
505
+ }
506
+
507
+ public function exportXmlAction()
508
+ {
509
+ $fileName = 'ticket.xml';
510
+ $content = $this->getLayout()->createBlock('supportticket/adminhtml_ticket_grid')
511
+ ->getXml();
512
+
513
+ $this->_sendUploadResponse($fileName, $content);
514
+ }
515
+
516
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
517
+ {
518
+ $response = $this->getResponse();
519
+ $response->setHeader('HTTP/1.1 200 OK','');
520
+ $response->setHeader('Pragma', 'public', true);
521
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
522
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
523
+ $response->setHeader('Last-Modified', date('r'));
524
+ $response->setHeader('Accept-Ranges', 'bytes');
525
+ $response->setHeader('Content-Length', strlen($content));
526
+ $response->setHeader('Content-type', $contentType);
527
+ $response->setBody($content);
528
+ $response->sendResponse();
529
+ die;
530
+ }
531
+ }
app/code/local/Magestore/Supportticket/controllers/EmailController.php ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_EmailController extends Mage_Core_Controller_Front_Action
3
+ {
4
+
5
+
6
+ public function indexAction()
7
+ {
8
+ if(!Mage::getSingleton('customer/session')->authenticate($this))
9
+ {
10
+ return;
11
+ }
12
+
13
+ $email = Mage::getModel("supportticket/email");
14
+ $data = $this->_getSession()->getFormData(true);
15
+ if (!empty($data)) {
16
+ $email->setData($data);
17
+ }
18
+ Mage::register("email_data",$email);
19
+
20
+ $this->loadLayout();
21
+ $this->_initLayoutMessages('supportticket/session');
22
+ $this->renderLayout();
23
+ }
24
+
25
+ public function activeAction()
26
+ {
27
+ if($data = $this->getRequest()->getPost())
28
+ {
29
+
30
+ $hash_code = $this->getRequest()->getParam('hash_code');
31
+
32
+ $email = Mage::getModel("supportticket/email")->load($hash_code,"hash_code");
33
+
34
+ $primary_email = $data['primary_email'];
35
+ $customer = Mage::getSingleton('customer/customer')->load($email->getCustomerId());
36
+
37
+ if($primary_email == $customer->getEmail())
38
+ {
39
+ try
40
+ {
41
+ $email->setStatus(1);
42
+ $email->setHashCode("");
43
+ $email->save();
44
+
45
+ $this->_getSession()->addSuccess($this->__('You added an email successfully'));
46
+ if(Mage::getSingleton('customer/session')->getCustomerId())
47
+ {
48
+ $this->_redirect('*/email');
49
+ }
50
+ else
51
+ {
52
+ $this->_redirect('*/ticket/submit');
53
+ }
54
+ return;
55
+ }
56
+ catch (Exception $e)
57
+ {
58
+ $this->_getSession()->addError($e->getMessage());
59
+ $this->_redirect('*/*');
60
+ return;
61
+ }
62
+ }
63
+ else
64
+ {
65
+ $this->_getSession()->addError("Hash code is invalid");
66
+ }
67
+ }
68
+
69
+ $hash_code = $this->getRequest()->getParam('hash_code');
70
+
71
+ Mage::register("hash_code",$hash_code);
72
+
73
+ $this->loadLayout();
74
+ $this->_initLayoutMessages('supportticket/session');
75
+ $this->renderLayout();
76
+ }
77
+
78
+ /*
79
+
80
+ */
81
+
82
+ public function addAction()
83
+ {
84
+ Mage::getSingleton('customer/session')->authenticate($this);
85
+
86
+ if($data = $this->getRequest()->getPost())
87
+ {
88
+ $this->_getSession()->setFormData($data);
89
+
90
+ $customer_id = Mage::getSingleton('customer/session')->getCustomerId();
91
+ $customer_session = Mage::getSingleton('customer/customer')->load($customer_id);
92
+ $customer_email = $customer_session->getEmail();
93
+ //check if the email is already exist
94
+ if($customer_email == $data['email'])
95
+ {
96
+ $this->_getSession()->addError(Mage::helper("supportticket")->__("The email is already exist"));
97
+ $this->_redirect('*/*');
98
+ return;
99
+ }
100
+ else
101
+ {
102
+ $old_email = Mage::getModel("supportticket/email")->getCollection()
103
+ ->addFieldToFilter("email",$data['email']);
104
+
105
+ if(count($old_email))
106
+ {
107
+ $this->_getSession()->addError(Mage::helper("supportticket")->__("The email is already exist"));
108
+ $this->_redirect('*/*');
109
+ return;
110
+ }
111
+
112
+ $old_email = Mage::getModel("admin/user")->getCollection()
113
+ ->addFieldToFilter("email",$data['email']);
114
+
115
+ if(count($old_email))
116
+ {
117
+ $this->_getSession()->addError(Mage::helper("supportticket")->__("The email is already exist"));
118
+ $this->_redirect('*/*');
119
+ return;
120
+ }
121
+ }
122
+ //chec password
123
+
124
+
125
+ $customer = Mage::getModel('customer/customer')
126
+ ->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
127
+ try
128
+ {
129
+ if (!$customer->authenticate($customer_email, $data['password']))
130
+ {
131
+ $this->_getSession()->addError($this->__('Password is not valid'));
132
+ $this->_redirect('*/*');
133
+ return;
134
+ }
135
+ }
136
+ catch (Exception $e)
137
+ {
138
+ $this->_getSession()->addError($this->__('Password is not valid'));
139
+ $this->_redirect('*/*');
140
+ return;
141
+ }
142
+ //init new email object
143
+
144
+ $email = Mage::getModel("supportticket/email");
145
+ $email->setCustomerId($customer_id);
146
+ $email->setEmail($data['email']);
147
+ $email->setStatus(0);
148
+ $email->setHashCode(rand(10001,32000));
149
+
150
+ try {
151
+ $email->save();
152
+
153
+ $email->sendEmailConfirmAddEmailAddress();
154
+
155
+ $this->_getSession()->addSuccess($this->__('You added an Email successfully!'));
156
+ $this->_redirect('*/*');
157
+ return;
158
+ }
159
+ catch (Exception $e)
160
+ {
161
+ $this->_getSession()->addError($e->getMessage());
162
+ $this->_redirect('*/*');
163
+ return;
164
+ }
165
+ }
166
+ else
167
+ {
168
+ $this->_getSession()->addError(Mage::helper("supportticket")->__("Unable to Add Email"));
169
+ $this->_redirect('*/*');
170
+ }
171
+
172
+ }
173
+
174
+
175
+ protected function _getSession()
176
+ {
177
+ return Mage::getSingleton('supportticket/session');
178
+ }
179
+
180
+ public function deleteAction()
181
+ {
182
+ $id = $this->getRequest()->getParam('id');
183
+ $customer_id = Mage::getSingleton('customer/session')->getCustomerId();
184
+
185
+ $old_email = Mage::getModel("supportticket/email")->load($id);
186
+ $customer_email = $old_email->getEmail();
187
+
188
+ $emails = Mage::getModel("supportticket/email")->getCollection()
189
+ ->addFieldToFilter("customer_id",$customer_id)
190
+ ->addFieldToFilter("email",$customer_email);
191
+ if(count($emails))
192
+ {
193
+ try
194
+ {
195
+ foreach($emails as $email)
196
+ {
197
+ $email->delete();
198
+ }
199
+ $this->_getSession()->addSuccess($this->__('You deleted an Email successfully!'));
200
+ $this->_redirect('*/*');
201
+ return;
202
+
203
+ }
204
+ catch (Exception $e)
205
+ {
206
+ $this->_getSession()->addError($e->getMessage());
207
+ $this->_redirect('*/*');
208
+ return;
209
+ }
210
+ }
211
+ else
212
+ {
213
+ $this->_getSession()->addError($this->__('The email does not exist!'));
214
+ $this->_redirect('*/*');
215
+ }
216
+
217
+ }
218
+ }
app/code/local/Magestore/Supportticket/controllers/ReadmailController.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_ReadmailController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ Mage::getSingleton('customer/session')->authenticate($this);
7
+
8
+ $this->loadLayout();
9
+
10
+ $this->_initLayoutMessages('supportticket/session');
11
+ $this->renderLayout();
12
+ }
13
+
14
+ public function downloadAction()
15
+ {
16
+ if($this->getRequest()->getParam('id'))
17
+ {
18
+ $id=$this->getRequest()->getParam('id');
19
+ $mid=$this->getRequest()->getParam('mid');
20
+ $mailbox=Mage::getModel('supportticket/mailbox')->_construct();
21
+ $data=Mage::helper('supportticket');
22
+ $data->DownloadFile($mailbox,$mid,$id);
23
+ }
24
+ }
25
+
26
+ public function remindAction()
27
+ {
28
+ Mage::getSingleton('supportticket/observer')->runScheduledFunction();
29
+ }
30
+ }
31
+ ?>
app/code/local/Magestore/Supportticket/controllers/TicketController.php ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportticket_TicketController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+
7
+ Mage::getSingleton('customer/session')->authenticate($this);
8
+
9
+ $this->loadLayout();
10
+
11
+ $this->_initLayoutMessages('supportticket/session');
12
+ $this->renderLayout();
13
+ }
14
+
15
+ /*
16
+ View detail a ticket
17
+ */
18
+ public function viewAction()
19
+ {
20
+ Mage::getSingleton('customer/session')->authenticate($this);
21
+
22
+
23
+ $ticket_code = $this->getRequest()->getParam('id');//id in this case is the ticket_code
24
+ $ticket = Mage::getModel('supportticket/ticket')->load($ticket_code,'ticket_code');
25
+
26
+ if(!Mage::helper("supportticket")->isTicketOwner($ticket->getId()))
27
+ {
28
+ $this->_getSession()->addError(Mage::helper("supportticket")->__("You can not view the ticket."));
29
+ $this->_redirect('*/*');
30
+ return;
31
+ }
32
+
33
+ if($data = $this->getRequest()->getPost())
34
+ {
35
+ if ($ticket->getId())
36
+ {
37
+
38
+ try {
39
+ $data['ticket_id']= $ticket->getId();
40
+ //get current customer from session
41
+ $customer_id = Mage::getSingleton('customer/session')->getCustomerId();
42
+ $customer = Mage::getSingleton('customer/customer')->load($customer_id);
43
+ $customer_email = $customer->getEmail();
44
+ $data['customer_email']= $customer_email;
45
+ $tempDateTime=new DateTime();
46
+ $data['created_time']=$tempDateTime->format("Y:m:d H:i:s");
47
+ //create message
48
+ $message_model = Mage::getModel('supportticket/message')->setData($data);
49
+ $message_model->save();
50
+
51
+ //upload file
52
+ if(is_array($_FILES)){
53
+ $index=1;
54
+ $message_model = Mage::getModel('supportticket/message')->load($message_model->getId());
55
+ $attachmentFile="";
56
+ foreach($_FILES as $file){
57
+ $attachment = Mage::helper('supportticket')->uploadTicketAttachment($file,$index,$ticket->getId(),$message_model->getId());
58
+ if($attachment){
59
+ $attachmentFile .= Mage::helper('supportticket')->refineString($file['name']).";".$attachment."*****";
60
+ }
61
+ $index++;
62
+ }
63
+ $message_model->setData('attachment',$attachmentFile);
64
+ $message_model->save();
65
+ }//end upload file
66
+
67
+ $message_model = Mage::getModel('supportticket/message')->load($message_model->getId());
68
+ //send confirm email to customer and moderator
69
+ $message_model->sendEmailSubmitMessageToCustomer();
70
+ $message_model->sendEmailNewMessageToModerator();
71
+
72
+ $message_model->sendEmailNewTicketToDepartmentModerator();
73
+ //change status of ticket
74
+
75
+ $ticket->setStatus(Mage::helper("supportticket")->getStatusByKey('STATUS_OPEN'));
76
+ $ticket->setLastUpdated($message_model->getCreatedTime());
77
+ $ticket->save();
78
+ $this->_getSession()->addSuccess($this->__('Your response was successfully sent.'));
79
+
80
+ }
81
+ catch (Exception $e)
82
+ {
83
+ $this->_getSession()->addError($e->getMessage());
84
+ $this->_redirect('*/*/view', array('id' => $this->getRequest()->getParam('id')));
85
+ }
86
+ }
87
+ else
88
+ {
89
+ $this->_getSession()->addError(Mage::helper("supportticket")->__("Ticket not found"));
90
+ $this->_redirect('*/*');
91
+ }
92
+ }
93
+
94
+ $this->loadLayout();
95
+ $this->_initLayoutMessages('supportticket/session');
96
+ $this->renderLayout();
97
+ }
98
+
99
+ /*
100
+ submit a new ticket
101
+ */
102
+ public function submitAction()
103
+ {
104
+ if($data = $this->getRequest()->getPost())
105
+ {
106
+ $department_id = $data['department_id'];
107
+ //check if customer can submit ticket
108
+ if(!Mage::helper("supportticket")->canSubmitTicket($department_id))
109
+ {
110
+ $this->_getSession()->addError(Mage::helper("supportticket")->__("You don't have the right permission to submit ticket"));
111
+ $this->_redirect('*/*/submit');
112
+ return;
113
+ }
114
+
115
+ if(Mage::getSingleton('customer/session')->getCustomerId())
116
+ {
117
+ $customer_id = Mage::getSingleton('customer/session')->getCustomerId();
118
+ $customer = Mage::getSingleton('customer/customer')->load($customer_id);
119
+ $data['customer_name'] = $customer->getName();
120
+
121
+ }
122
+
123
+ $data['status']= Mage::helper("supportticket")->getStatusByKey('STATUS_OPEN');
124
+
125
+ $ticket = Mage::getModel("supportticket/ticket");
126
+ $ticket->setData($data);
127
+ try
128
+ {
129
+ $ticket->save();
130
+
131
+ if(is_array($_FILES))
132
+ {
133
+ $index=1;
134
+ $attachmentFile="";
135
+ foreach($_FILES as $file)
136
+ {
137
+ $attachment = Mage::helper('supportticket')->uploadTicketAttachment($file,$index,$ticket->getId());
138
+ if($attachment)
139
+ {
140
+ $attachmentFile .= Mage::helper('supportticket')->refineString($file['name']) . ";" . $attachment."*****";
141
+ }
142
+ $index++;
143
+ }
144
+ $ticket->setAttachment($attachmentFile);
145
+ // if(is_array($attachments))
146
+ // {
147
+ // foreach($attachments as $attach)
148
+ // Mage::helper('supportticket')->deleteImageFile($ticket->getId(),$attach);
149
+ // }
150
+ }
151
+
152
+ $department = Mage::getModel("supportticket/department")->load($department_id);
153
+ $ticket->setTicketCode($department->getDepartmentCode() . "-". $ticket->getId());
154
+ $ticket->setLastUpdated($ticket->getCreatedTime());
155
+ $ticket->save();
156
+
157
+ //send email
158
+ $ticket->sendEmailNewTiketToCustomer(); //send to customer
159
+ $ticket->sendEmailNewTiketToModerator(); //send to all department moderators
160
+ $ticket->sendEmailNewTicketToDepartmentModerator();
161
+ $this->_getSession()->addSuccess($this->__('The ticket has been sent.'));
162
+
163
+ if(Mage::getSingleton('customer/session')->getCustomerId())
164
+ {
165
+ $this->_redirect('*/*/');
166
+ }
167
+ }
168
+ catch (Mage_Core_Exception $e) {
169
+ $this->_getSession()->addError($e->getMessage());
170
+ }
171
+ catch (Exception $e) {
172
+ $this->_getSession()->addException($e, $this->__('Cannot send the ticket.'));
173
+ }
174
+ }
175
+ else
176
+ {
177
+ if(Mage::getSingleton('customer/session')->getCustomerId())
178
+ {
179
+ $customer_id = Mage::getSingleton('customer/session')->getCustomerId();
180
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
181
+ $customer_name = $customer->getName();
182
+ $customer_email = $customer->getEmail();
183
+ $ticket = Mage::getModel("supportticket/ticket");
184
+ $ticket->setCustomerName($customer_name);
185
+ $ticket->setCustomerEmail($customer_email);
186
+ Mage::getSingleton('supportticket/session')->setTicket($ticket);
187
+ }
188
+ }
189
+
190
+ $this->loadLayout();
191
+ $this->_initLayoutMessages('supportticket/session');
192
+ $this->renderLayout();
193
+ }//end submitAction()
194
+
195
+ public function ticketformAction()
196
+ {
197
+ $department_id = (string) $this->getRequest()->getParam('department_id');
198
+ Mage::register("department_id",$department_id);
199
+
200
+ $ticketformHtml = $this->_getTicketformHtml();
201
+ $this->getResponse()->setHeader('Content-type', 'application/x-json');
202
+ $this->getResponse()->setBody($ticketformHtml);
203
+ }
204
+
205
+ protected function _getTicketformHtml()
206
+ {
207
+ $layout = $this->getLayout();
208
+ $update = $layout->getUpdate();
209
+ $update->load('supportticket_ticket_ticketformcontent');
210
+ $layout->generateXml();
211
+ $layout->generateBlocks();
212
+ $output = $layout->getOutput();
213
+ return $output;
214
+ }
215
+
216
+ protected function _getSession()
217
+ {
218
+ return Mage::getSingleton('supportticket/session');
219
+ }
220
+ }
app/code/local/Magestore/Supportticket/etc/adminhtml.xml ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <supportticket module="supportticket">
5
+ <title>Support Ticket</title>
6
+ <sort_order>71</sort_order>
7
+ <children>
8
+ <departmentgroup module="supportticket">
9
+ <title>Manage Department Group</title>
10
+ <sort_order>1</sort_order>
11
+ <action>adminsupportticket/adminhtml_departmentgroup</action>
12
+ </departmentgroup>
13
+
14
+ <department module="supportticket">
15
+ <title>Manage Department</title>
16
+ <sort_order>2</sort_order>
17
+ <action>adminsupportticket/adminhtml_department</action>
18
+ </department>
19
+
20
+ <ticket module="supportticket">
21
+ <title>Manage Ticket</title>
22
+ <sort_order>3</sort_order>
23
+ <action>adminsupportticket/adminhtml_ticket</action>
24
+ </ticket>
25
+
26
+ <template module="supportticket">
27
+ <title>Manage Template</title>
28
+ <sort_order>4</sort_order>
29
+ <action>adminsupportticket/adminhtml_template</action>
30
+ </template>
31
+
32
+ <statuslog module="supportticket">
33
+ <title>View Status Log</title>
34
+ <sort_order>5</sort_order>
35
+ <action>adminsupportticket/adminhtml_statuslog</action>
36
+ </statuslog>
37
+
38
+ <settings module="supportticket">
39
+ <title>Settings</title>
40
+ <sort_order>6</sort_order>
41
+ <action>adminhtml/system_config/edit/section/supportticket</action>
42
+ </settings>
43
+ </children>
44
+ </supportticket>
45
+ </menu>
46
+ <acl>
47
+ <resources>
48
+ <admin>
49
+ <children>
50
+ <system>
51
+ <children>
52
+ <config>
53
+ <children>
54
+ <supportticket translate="title">
55
+ <title>Support Ticket</title>
56
+ <sort_order>50</sort_order>
57
+ </supportticket>
58
+ </children>
59
+ </config>
60
+ </children>
61
+ </system>
62
+ <supportticket module="supportticket">
63
+ <title>Support Ticket</title>
64
+ <sort_order>71</sort_order>
65
+ <children>
66
+ <departmentgroup module="supportticket">
67
+ <title>Manage Department Group</title>
68
+ <sort_order>1</sort_order>
69
+ <action>adminsupportticket/adminhtml_departmentgroup</action>
70
+ </departmentgroup>
71
+
72
+ <department module="supportticket">
73
+ <title>Manage Department</title>
74
+ <sort_order>2</sort_order>
75
+ <action>adminsupportticket/adminhtml_department</action>
76
+ </department>
77
+
78
+ <ticket module="supportticket">
79
+ <title>Manage Ticket</title>
80
+ <sort_order>3</sort_order>
81
+ <action>adminsupportticket/adminhtml_ticket</action>
82
+ </ticket>
83
+
84
+ <template module="supportticket">
85
+ <title>Manage Template</title>
86
+ <sort_order>4</sort_order>
87
+ <action>adminsupportticket/adminhtml_template</action>
88
+ </template>
89
+
90
+ <statuslog module="supportticket">
91
+ <title>View Status Log</title>
92
+ <sort_order>5</sort_order>
93
+ <action>adminsupportticket/adminhtml_statuslog</action>
94
+ </statuslog>
95
+
96
+ <settings module="supportticket">
97
+ <title>Settings</title>
98
+ <sort_order>6</sort_order>
99
+ <action>adminhtml/system_config/edit/section/supportticket</action>
100
+ </settings>
101
+ </children>
102
+ </supportticket>
103
+ </children>
104
+ </admin>
105
+ </resources>
106
+ </acl>
107
+ </config>
app/code/local/Magestore/Supportticket/etc/config.xml ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <default>
4
+ <supportticket>
5
+ <general>
6
+ <submit_hint>While we try very hard to meet your expectations, it is helpful for our customers to only create one ticket per issue. Multiple tickets about the same problem hurt our ability to help you quickly.</submit_hint>
7
+ <email_manager_hint>The purpose of this form is to add an existing ticket system email address to your home overview. In order for us to ensure the security of your tickets, we require you to provide both your email address and ticket system password below. You only need to do this once.Disclaimer: Any email address added will be considered verified and can be used to make changes to your account through the ticket system. Please do not add any email address you do not want to have authority to make changes to your account.</email_manager_hint>
8
+ <customer_avatar>customer_avatar.gif</customer_avatar>
9
+ <staff_avatar>staff_avatar.gif</staff_avatar>
10
+ <days_close>4</days_close>
11
+ <auto_close_ticket>1</auto_close_ticket>
12
+ </general>
13
+ <emailtemplate>
14
+ <notify_department_email>0</notify_department_email>
15
+ <department_new_ticket>supportticket_emailtemplate_department_new_ticket</department_new_ticket>
16
+ <department_new_message>supportticket_emailtemplate_department_new_message</department_new_message>
17
+ <customer_submit_ticket>supportticket_emailtemplate_customer_submit_ticket</customer_submit_ticket>
18
+ <customer_submit_message>supportticket_emailtemplate_customer_submit_message</customer_submit_message>
19
+ <admin_assign_ticket>supportticket_emailtemplate_admin_assign_ticket</admin_assign_ticket>
20
+ <moderator_close_ticket>supportticket_emailtemplate_moderator_close_ticket</moderator_close_ticket>
21
+ <moderator_public_ticket>supportticket_emailtemplate_moderator_public_ticket</moderator_public_ticket>
22
+ <customer_confirm_add_email_address>supportticket_emailtemplate_customer_confirm_add_email_address</customer_confirm_add_email_address>
23
+ <admin_submit_message_to_customer>supportticket_emailtemplate_admin_submit_message_to_customer</admin_submit_message_to_customer>
24
+ <admin_submit_email_message_to_customer>supportticket_emailtemplate_admin_submit_email_message_to_customer</admin_submit_email_message_to_customer>
25
+ <admin_submit_ticket_to_customer>supportticket_emailtemplate_admin_submit_ticket_to_customer</admin_submit_ticket_to_customer>
26
+ </emailtemplate>
27
+ </supportticket>
28
+ </default>
29
+ <modules>
30
+ <Magestore_Supportticket>
31
+ <version>0.2.1</version>
32
+ </Magestore_Supportticket>
33
+ </modules>
34
+ <frontend>
35
+ <routers>
36
+ <supportticket>
37
+ <use>standard</use>
38
+ <args>
39
+ <module>Magestore_Supportticket</module>
40
+ <frontName>supportticket</frontName>
41
+ </args>
42
+ </supportticket>
43
+ </routers>
44
+ <layout>
45
+ <updates>
46
+ <supportticket>
47
+ <file>supportticket.xml</file>
48
+ </supportticket>
49
+ </updates>
50
+ </layout>
51
+ </frontend>
52
+ <admin>
53
+ <routers>
54
+ <adminsupportticket>
55
+ <use>admin</use>
56
+ <args>
57
+ <module>Magestore_Supportticket</module>
58
+ <frontName>adminsupportticket</frontName>
59
+ </args>
60
+ </adminsupportticket>
61
+ </routers>
62
+ </admin>
63
+ <adminhtml>
64
+ <layout>
65
+ <updates>
66
+ <supportticket>
67
+ <file>supportticket.xml</file>
68
+ </supportticket>
69
+ </updates>
70
+ </layout>
71
+ </adminhtml>
72
+ <global>
73
+ <models>
74
+ <supportticket>
75
+ <class>Magestore_Supportticket_Model</class>
76
+ <resourceModel>supportticket_mysql4</resourceModel>
77
+ </supportticket>
78
+ <supportticket_mysql4>
79
+ <class>Magestore_Supportticket_Model_Mysql4</class>
80
+ <entities>
81
+ <ticket>
82
+ <table>st_ticket</table>
83
+ </ticket>
84
+
85
+ <departmentgroup>
86
+ <table>st_department_group</table>
87
+ </departmentgroup>
88
+
89
+ <departmentgroupentity>
90
+ <table>st_department_group_entity</table>
91
+ </departmentgroupentity>
92
+
93
+ <template>
94
+ <table>st_template</table>
95
+ </template>
96
+
97
+ <templateentity>
98
+ <table>st_template_entity</table>
99
+ </templateentity>
100
+
101
+ <department>
102
+ <table>st_department</table>
103
+ </department>
104
+
105
+ <departmententity>
106
+ <table>st_department_entity</table>
107
+ </departmententity>
108
+
109
+ <departmentuser>
110
+ <table>st_department_user</table>
111
+ </departmentuser>
112
+
113
+ <message>
114
+ <table>st_message</table>
115
+ </message>
116
+
117
+ <statuslog>
118
+ <table>st_status_log</table>
119
+ </statuslog>
120
+
121
+ <email>
122
+ <table>st_email</table>
123
+ </email>
124
+ </entities>
125
+ </supportticket_mysql4>
126
+ </models>
127
+ <resources>
128
+ <supportticket_setup>
129
+ <setup>
130
+ <module>Magestore_Supportticket</module>
131
+ </setup>
132
+ <connection>
133
+ <use>core_setup</use>
134
+ </connection>
135
+ </supportticket_setup>
136
+ <supportticket_write>
137
+ <connection>
138
+ <use>core_write</use>
139
+ </connection>
140
+ </supportticket_write>
141
+ <supportticket_read>
142
+ <connection>
143
+ <use>core_read</use>
144
+ </connection>
145
+ </supportticket_read>
146
+ </resources>
147
+ <blocks>
148
+ <supportticket>
149
+ <class>Magestore_Supportticket_Block</class>
150
+ </supportticket>
151
+ </blocks>
152
+ <helpers>
153
+ <supportticket>
154
+ <class>Magestore_Supportticket_Helper</class>
155
+ </supportticket>
156
+ </helpers>
157
+ <template>
158
+ <email>
159
+ <supportticket_emailtemplate_department_new_ticket translate="label" module="supportticket">
160
+ <label>New Ticket Email Send To Department</label>
161
+ <file>supportticket/department_new_ticket.html</file>
162
+ <type>html</type>
163
+ </supportticket_emailtemplate_department_new_ticket>
164
+
165
+ <supportticket_emailtemplate_department_new_message translate="label" module="supportticket">
166
+ <label>New Message Email Send To Department</label>
167
+ <file>supportticket/department_new_message.html</file>
168
+ <type>html</type>
169
+ </supportticket_emailtemplate_department_new_message>
170
+
171
+ <supportticket_emailtemplate_customer_submit_ticket translate="label" module="supportticket">
172
+ <label>Email Template Confirm Submit Ticket</label>
173
+ <file>supportticket/customer_submit_ticket.html</file>
174
+ <type>html</type>
175
+ </supportticket_emailtemplate_customer_submit_ticket>
176
+
177
+ <supportticket_emailtemplate_customer_submit_message translate="label" module="supportticket">
178
+ <label>Email Template Confirm Submit Message</label>
179
+ <file>supportticket/customer_submit_message.html</file>
180
+ <type>html</type>
181
+ </supportticket_emailtemplate_customer_submit_message>
182
+
183
+ <supportticket_emailtemplate_admin_assign_ticket translate="label" module="supportticket">
184
+ <label>Email Send to Admin User afer they're assigned a Ticket</label>
185
+ <file>supportticket/admin_assign_ticket.html</file>
186
+ <type>html</type>
187
+ </supportticket_emailtemplate_admin_assign_ticket>
188
+
189
+ <supportticket_emailtemplate_moderator_close_ticket translate="label" module="supportticket">
190
+ <label>Email Send to Admin User afer Someone closed a Ticket</label>
191
+ <file>supportticket/moderator_close_ticket.html</file>
192
+ <type>html</type>
193
+ </supportticket_emailtemplate_moderator_close_ticket>
194
+
195
+ <supportticket_emailtemplate_moderator_public_ticket translate="label" module="supportticket">
196
+ <label>Email Send to Admin User afer Someone closed a Ticket</label>
197
+ <file>supportticket/moderator_public_ticket.html</file>
198
+ <type>html</type>
199
+ </supportticket_emailtemplate_moderator_public_ticket>
200
+
201
+ <supportticket_emailtemplate_customer_confirm_add_email_address translate="label" module="supportticket">
202
+ <label>Email Send to Customer to Active Email Address</label>
203
+ <file>supportticket/customer_confirm_add_email_address.html</file>
204
+ <type>html</type>
205
+ </supportticket_emailtemplate_customer_confirm_add_email_address>
206
+
207
+ <supportticket_emailtemplate_admin_submit_message_to_customer>
208
+ <label>Email Send to Customer when Admin Response Message</label>
209
+ <file>supportticket/admin_submit_message_to_customer.html</file>
210
+ <type>html</type>
211
+ </supportticket_emailtemplate_admin_submit_message_to_customer>
212
+
213
+ <supportticket_emailtemplate_admin_submit_email_message_to_customer>
214
+ <label>Email Send to Customer when Admin Response Message (using message as email content)</label>
215
+ <file>supportticket/admin_submit_email_message_to_customer.html</file>
216
+ <type>html</type>
217
+ </supportticket_emailtemplate_admin_submit_email_message_to_customer>
218
+
219
+ <supportticket_emailtemplate_admin_submit_ticket_to_customer>
220
+ <label>Email Send to Customer when Admin Submit a Ticket for Them</label>
221
+ <file>supportticket/admin_submit_ticket_to_customer.html</file>
222
+ <type>html</type>
223
+ </supportticket_emailtemplate_admin_submit_ticket_to_customer>
224
+ </email>
225
+ </template>
226
+ </global>
227
+ <crontab>
228
+ <jobs>
229
+ <supportticket>
230
+ <schedule>
231
+ <cron_expr>*/10 * * * *</cron_expr>
232
+ </schedule>
233
+ <run>
234
+ <model>supportticket/observer::runScheduledFunction</model>
235
+ </run>
236
+ </supportticket>
237
+ </jobs>
238
+ </crontab>
239
+ </config>
app/code/local/Magestore/Supportticket/etc/system.xml ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <magestore translate="label">
5
+ <label>Magestore Extension</label>
6
+ <sort_order>400</sort_order>
7
+ </magestore>
8
+ </tabs>
9
+
10
+ <sections>
11
+ <supportticket translate="label" module="supportticket">
12
+ <class>separator-top</class>
13
+ <label>Support Ticket</label>
14
+ <tab>magestore</tab>
15
+ <frontend_type>text</frontend_type>
16
+ <sort_order>300</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
+ <groups>
21
+ <general translate="label">
22
+ <label>Gereral Configuration</label>
23
+ <frontend_type>text</frontend_type>
24
+ <sort_order>1</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>0</show_in_store>
28
+ <fields>
29
+ <auto_close_ticket translate="label">
30
+ <label>Auto Close Ticket</label>
31
+ <frontend_type>select</frontend_type>
32
+ <source_model>adminhtml/system_config_source_yesno</source_model>
33
+ <sort_order>1</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </auto_close_ticket>
38
+ <days_close translate="label comment">
39
+ <label>Days to close ticket</label>
40
+ <frontend_type>text</frontend_type>
41
+ <sort_order>2</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ </days_close>
46
+
47
+ <submit_hint translate="label comment">
48
+ <label>Hint on Submit Ticket Page</label>
49
+ <frontend_type>textarea</frontend_type>
50
+ <sort_order>3</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ </submit_hint>
55
+
56
+ <email_manager_hint translate="label comment">
57
+ <label>Hint on Add Email Address Page</label>
58
+ <frontend_type>textarea</frontend_type>
59
+ <sort_order>4</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>1</show_in_store>
63
+ </email_manager_hint>
64
+
65
+ <staff_avatar translate="label">
66
+ <label>Icon</label>
67
+ <frontend_type>image</frontend_type>
68
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
69
+ <upload_dir config="system/filesystem/media" scope_info="1">supportticket</upload_dir>
70
+ <sort_order>5</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ </staff_avatar>
75
+
76
+ <customer_avatar translate="label">
77
+ <label>Icon</label>
78
+ <frontend_type>image</frontend_type>
79
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
80
+ <upload_dir config="system/filesystem/media" scope_info="1">supportticket</upload_dir>
81
+ <sort_order>6</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ </customer_avatar>
86
+
87
+ <email_footer translate="label comment">
88
+ <label>Email Footer</label>
89
+ <frontend_type>textarea</frontend_type>
90
+ <sort_order>7</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ </email_footer>
95
+
96
+ <system_admin_name translate="label comment">
97
+ <label>Admin Name of Tiecket System</label>
98
+ <frontend_type>text</frontend_type>
99
+ <sort_order>8</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ </system_admin_name>
104
+
105
+ <system_admin_email translate="label comment">
106
+ <label>Admin Email of Tiecket System</label>
107
+ <frontend_type>text</frontend_type>
108
+ <sort_order>9</sort_order>
109
+ <show_in_default>1</show_in_default>
110
+ <show_in_website>1</show_in_website>
111
+ <show_in_store>1</show_in_store>
112
+ </system_admin_email>
113
+ </fields>
114
+ </general>
115
+
116
+ <emailtemplate translate="label">
117
+ <label>Email Configuration</label>
118
+ <frontend_type>text</frontend_type>
119
+ <sort_order>10</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_website>1</show_in_website>
122
+ <show_in_store>0</show_in_store>
123
+ <fields>
124
+ <notify_department_email translate="label">
125
+ <label>Send notify email to department</label>
126
+ <frontend_type>select</frontend_type>
127
+ <source_model>adminhtml/system_config_source_yesno</source_model>
128
+ <sort_order>0</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>1</show_in_store>
132
+ </notify_department_email>
133
+
134
+ <department_new_ticket translate="label">
135
+ <label>New Ticket Email Send To Department</label>
136
+ <frontend_type>select</frontend_type>
137
+ <source_model>adminhtml/system_config_source_email_template</source_model>
138
+ <sort_order>1</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>1</show_in_store>
142
+ </department_new_ticket>
143
+
144
+ <department_new_message translate="label">
145
+ <label>New Message Email Send To Department</label>
146
+ <frontend_type>select</frontend_type>
147
+ <source_model>adminhtml/system_config_source_email_template</source_model>
148
+ <sort_order>2</sort_order>
149
+ <show_in_default>1</show_in_default>
150
+ <show_in_website>1</show_in_website>
151
+ <show_in_store>1</show_in_store>
152
+ </department_new_message>
153
+
154
+ <customer_submit_ticket translate="label">
155
+ <label>Email Template Confirm Submit Ticket</label>
156
+ <frontend_type>select</frontend_type>
157
+ <source_model>adminhtml/system_config_source_email_template</source_model>
158
+ <sort_order>3</sort_order>
159
+ <show_in_default>1</show_in_default>
160
+ <show_in_website>1</show_in_website>
161
+ <show_in_store>1</show_in_store>
162
+ </customer_submit_ticket>
163
+
164
+ <customer_submit_message translate="label">
165
+ <label>Email Template Confirm Submit Message</label>
166
+ <frontend_type>select</frontend_type>
167
+ <source_model>adminhtml/system_config_source_email_template</source_model>
168
+ <sort_order>4</sort_order>
169
+ <show_in_default>1</show_in_default>
170
+ <show_in_website>1</show_in_website>
171
+ <show_in_store>1</show_in_store>
172
+ </customer_submit_message>
173
+
174
+ <admin_assign_ticket translate="label">
175
+ <label>Email Send to Admin User afer they're assigned a Ticket</label>
176
+ <frontend_type>select</frontend_type>
177
+ <source_model>adminhtml/system_config_source_email_template</source_model>
178
+ <sort_order>5</sort_order>
179
+ <show_in_default>1</show_in_default>
180
+ <show_in_website>1</show_in_website>
181
+ <show_in_store>1</show_in_store>
182
+ </admin_assign_ticket>
183
+
184
+ <moderator_close_ticket translate="label">
185
+ <label>Closed a Ticket</label>
186
+ <frontend_type>select</frontend_type>
187
+ <source_model>adminhtml/system_config_source_email_template</source_model>
188
+ <sort_order>6</sort_order>
189
+ <show_in_default>1</show_in_default>
190
+ <show_in_website>1</show_in_website>
191
+ <show_in_store>1</show_in_store>
192
+ </moderator_close_ticket>
193
+
194
+ <moderator_public_ticket translate="label">
195
+ <label>Public a ticket</label>
196
+ <frontend_type>select</frontend_type>
197
+ <source_model>adminhtml/system_config_source_email_template</source_model>
198
+ <sort_order>6</sort_order>
199
+ <show_in_default>1</show_in_default>
200
+ <show_in_website>1</show_in_website>
201
+ <show_in_store>1</show_in_store>
202
+ </moderator_public_ticket>
203
+
204
+ <customer_confirm_add_email_address translate="label">
205
+ <label>Public a ticket</label>
206
+ <frontend_type>select</frontend_type>
207
+ <source_model>adminhtml/system_config_source_email_template</source_model>
208
+ <sort_order>7</sort_order>
209
+ <show_in_default>1</show_in_default>
210
+ <show_in_website>1</show_in_website>
211
+ <show_in_store>1</show_in_store>
212
+ </customer_confirm_add_email_address>
213
+
214
+ <admin_submit_message_to_customer>
215
+ <label>Email To Customer when Admin Reponse Message</label>
216
+ <frontend_type>select</frontend_type>
217
+ <source_model>adminhtml/system_config_source_email_template</source_model>
218
+ <sort_order>8</sort_order>
219
+ <show_in_default>1</show_in_default>
220
+ <show_in_website>1</show_in_website>
221
+ <show_in_store>1</show_in_store>
222
+ </admin_submit_message_to_customer>
223
+
224
+ <admin_submit_email_message_to_customer>
225
+ <label>Email To Customer when Admin Reponse Message (using message as email template)</label>
226
+ <frontend_type>select</frontend_type>
227
+ <source_model>adminhtml/system_config_source_email_template</source_model>
228
+ <sort_order>9</sort_order>
229
+ <show_in_default>1</show_in_default>
230
+ <show_in_website>1</show_in_website>
231
+ <show_in_store>1</show_in_store>
232
+ </admin_submit_email_message_to_customer>
233
+
234
+ <admin_submit_ticket_to_customer>
235
+ <label>Email To Customer when Admin Submit a Message for Them</label>
236
+ <frontend_type>select</frontend_type>
237
+ <source_model>adminhtml/system_config_source_email_template</source_model>
238
+ <sort_order>10</sort_order>
239
+ <show_in_default>1</show_in_default>
240
+ <show_in_website>1</show_in_website>
241
+ <show_in_store>1</show_in_store>
242
+ </admin_submit_ticket_to_customer>
243
+ </fields>
244
+ </emailtemplate>
245
+ </groups>
246
+ </supportticket>
247
+ </sections>
248
+ </config>
app/code/local/Magestore/Supportticket/sql/supportticket_setup/mysql4-install-0.2.0.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ -- DROP TABLE IF EXISTS {$this->getTable('st_department_group_entity')};
10
+ CREATE TABLE {$this->getTable('st_department_group_entity')} (
11
+ `entity_id` int(11) unsigned NOT NULL auto_increment,
12
+ `status` tinyint(1) NOT NULL default '1',
13
+ PRIMARY KEY (`entity_id`)
14
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
15
+
16
+ -- DROP TABLE IF EXISTS {$this->getTable('st_department_group')};
17
+ CREATE TABLE {$this->getTable('st_department_group')} (
18
+ `department_group_id` int(11) unsigned NOT NULL auto_increment,
19
+ `entity_id` int(11) unsigned NOT NULL default 0,
20
+ `store_id` int(11) unsigned NOT NULL default 0,
21
+ `department_group_name` varchar(255) NOT NULL,
22
+ `department_group_description` varchar(255) NULL,
23
+ `status` tinyint(1) NOT NULL default '1',
24
+ FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('st_department_group_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
25
+ PRIMARY KEY (`department_group_id`)
26
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
27
+
28
+
29
+
30
+ -- DROP TABLE IF EXISTS {$this->getTable('st_department_entity')};
31
+ CREATE TABLE {$this->getTable('st_department_entity')} (
32
+ `entity_id` int(11) unsigned NOT NULL auto_increment,
33
+ `status` tinyint(1) NOT NULL default '1',
34
+ PRIMARY KEY (`entity_id`)
35
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
36
+
37
+ -- DROP TABLE IF EXISTS {$this->getTable('st_department')};
38
+ CREATE TABLE {$this->getTable('st_department')} (
39
+ `department_id` int(11) unsigned NOT NULL auto_increment,
40
+ `entity_id` int(11) unsigned NOT NULL default '0',
41
+ `store_id` int(11) unsigned NOT NULL default '0',
42
+ `customer_group_id` varchar(255) NOT NULL default '0',
43
+ `department_user` varchar(255) NOT NULL default 'admin',
44
+ `department_moderator` varchar(255) NOT NULL default 'admin',
45
+ `department_group_id` int(11) unsigned NOT NULL default '0',
46
+ `department_name` varchar(255) NOT NULL default '',
47
+ `department_email` varchar(255) NOT NULL default '',
48
+ `email_password` varchar(30) NOT NULL default '',
49
+ `department_code` varchar(20) NOT NULL default 'SALE',
50
+ `description` text NOT NULL,
51
+ `status` tinyint(1) NOT NULL default '1',
52
+ FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('st_department_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
53
+ PRIMARY KEY (`department_id`)
54
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
55
+
56
+
57
+ -- DROP TABLE IF EXISTS {$this->getTable('st_ticket')};
58
+ CREATE TABLE {$this->getTable('st_ticket')} (
59
+ `ticket_id` int(11) unsigned NOT NULL auto_increment,
60
+ `ticket_title` varchar(255) NOT NULL default '',
61
+ `ticket_code` varchar(20) NULL,
62
+ `department_id` int(11) unsigned NOT NULL,
63
+ `created_user` varchar(255) NOT NULL default '',
64
+ `assigned_user` varchar(255) NOT NULL default '',
65
+ `customer_name` varchar(255) NOT NULL,
66
+ `customer_email` varchar(255) NOT NULL,
67
+ `status` varchar(255) NOT NULL default 'OPEN',
68
+ `priority` varchar(255) NOT NULL default 'Low',
69
+ `ticket_content` text NOT NULL,
70
+ `created_time` timestamp default now(),
71
+ `last_updated` datetime NULL,
72
+ `total_reply` int(11) unsigned NOT NULL DEFAULT '0',
73
+ `attachment` varchar(255) NOT NULL,
74
+ `is_private` tinyint(1) NOT NULL default '0',
75
+ FOREIGN KEY (`department_id`) REFERENCES {$this->getTable('st_department')} (`department_id`) ON DELETE CASCADE ON UPDATE CASCADE,
76
+
77
+ PRIMARY KEY (`ticket_id`)
78
+
79
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
80
+
81
+ -- DROP TABLE IF EXISTS {$this->getTable('st_message')};
82
+ CREATE TABLE {$this->getTable('st_message')} (
83
+ `message_id` int(11) unsigned NOT NULL auto_increment,
84
+ `ticket_id` int(11) unsigned NOT NULL,
85
+ `content` text NOT NULL,
86
+ `created_time` timestamp default now(),
87
+ `customer_email` varchar(255) NOT NULL,
88
+ `created_user` varchar(255) NOT NULL default '',
89
+ `attachment` varchar(255) NOT NULL,
90
+ `is_private` tinyint(1) NOT NULL default '0',
91
+ FOREIGN KEY (`ticket_id`) REFERENCES {$this->getTable('st_ticket')} (`ticket_id`) ON DELETE CASCADE ON UPDATE CASCADE,
92
+ PRIMARY KEY (`message_id`)
93
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
94
+
95
+ -- DROP TABLE IF EXISTS {$this->getTable('st_status_log')};
96
+ CREATE TABLE {$this->getTable('st_status_log')} (
97
+ `status_log_id` int(11) unsigned NOT NULL auto_increment,
98
+ `ticket_id` int(11) unsigned NOT NULL DEFAULT '0',
99
+ `admin_user` varchar(255) NOT NULL default 'admin',
100
+ `action` varchar(255) NOT NULL default 'VIEW',
101
+ `time` timestamp default now(),
102
+ PRIMARY KEY (`status_log_id`),
103
+ FOREIGN KEY (`ticket_id`) REFERENCES {$this->getTable('st_ticket')} (`ticket_id`) ON DELETE CASCADE ON UPDATE CASCADE
104
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
105
+
106
+
107
+ -- DROP TABLE IF EXISTS {$this->getTable('st_email')};
108
+ CREATE TABLE {$this->getTable('st_email')} (
109
+ `email_id` int(11) unsigned NOT NULL auto_increment,
110
+ `customer_id` int(11) unsigned NOT NULL DEFAULT '0',
111
+ `email` varchar(255) NOT NULL,
112
+ `status` tinyint(1) NOT NULL default '0',
113
+ `hash_code` varchar(255) NULL,
114
+ PRIMARY KEY (`email_id`),
115
+ FOREIGN KEY (`customer_id`) REFERENCES {$this->getTable('customer_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
116
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
117
+
118
+ -- DROP TABLE IF EXISTS {$this->getTable('st_template_entity')};
119
+ CREATE TABLE {$this->getTable('st_template_entity')} (
120
+ `entity_id` int(11) unsigned NOT NULL auto_increment,
121
+ `status` tinyint(1) NOT NULL default '1',
122
+ PRIMARY KEY (`entity_id`)
123
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
124
+
125
+ -- DROP TABLE IF EXISTS {$this->getTable('st_template')};
126
+ CREATE TABLE {$this->getTable('st_template')} (
127
+ `template_id` int(11) unsigned NOT NULL auto_increment,
128
+ `entity_id` int(11) unsigned NOT NULL default 0,
129
+ `store_id` int(11) unsigned NOT NULL default 0,
130
+ `template_name` varchar(255) NOT NULL,
131
+ `content` text NOT NULL,
132
+ `status` tinyint(1) NOT NULL default '1',
133
+ FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('st_template_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
134
+ PRIMARY KEY (`template_id`)
135
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
136
+
137
+ ");
138
+
139
+ $installer->endSetup();
app/code/local/Magestore/Supportticket/sql/supportticket_setup/mysql4-install-0.2.1.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ -- DROP TABLE IF EXISTS {$this->getTable('st_department_group_entity')};
10
+ CREATE TABLE {$this->getTable('st_department_group_entity')} (
11
+ `entity_id` int(11) unsigned NOT NULL auto_increment,
12
+ `status` tinyint(1) NOT NULL default '1',
13
+ PRIMARY KEY (`entity_id`)
14
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
15
+
16
+ -- DROP TABLE IF EXISTS {$this->getTable('st_department_group')};
17
+ CREATE TABLE {$this->getTable('st_department_group')} (
18
+ `department_group_id` int(11) unsigned NOT NULL auto_increment,
19
+ `entity_id` int(11) unsigned NOT NULL default 0,
20
+ `store_id` int(11) unsigned NOT NULL default 0,
21
+ `department_group_name` varchar(255) NOT NULL,
22
+ `department_group_description` varchar(255) NULL,
23
+ `status` tinyint(1) NOT NULL default '1',
24
+ FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('st_department_group_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
25
+ PRIMARY KEY (`department_group_id`)
26
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
27
+
28
+
29
+
30
+ -- DROP TABLE IF EXISTS {$this->getTable('st_department_entity')};
31
+ CREATE TABLE {$this->getTable('st_department_entity')} (
32
+ `entity_id` int(11) unsigned NOT NULL auto_increment,
33
+ `status` tinyint(1) NOT NULL default '1',
34
+ PRIMARY KEY (`entity_id`)
35
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
36
+
37
+ -- DROP TABLE IF EXISTS {$this->getTable('st_department')};
38
+ CREATE TABLE {$this->getTable('st_department')} (
39
+ `department_id` int(11) unsigned NOT NULL auto_increment,
40
+ `entity_id` int(11) unsigned NOT NULL default '0',
41
+ `store_id` int(11) unsigned NOT NULL default '0',
42
+ `customer_group_id` varchar(255) NOT NULL default '0',
43
+ `department_user` varchar(255) NOT NULL default 'admin',
44
+ `department_moderator` varchar(255) NOT NULL default 'admin',
45
+ `department_group_id` int(11) unsigned NOT NULL default '0',
46
+ `department_name` varchar(255) NOT NULL default '',
47
+ `department_email` varchar(255) NOT NULL default '',
48
+ `email_password` varchar(30) NOT NULL default '',
49
+ `department_code` varchar(20) NOT NULL default 'SALE',
50
+ `description` text NOT NULL,
51
+ `status` tinyint(1) NOT NULL default '1',
52
+ FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('st_department_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
53
+ PRIMARY KEY (`department_id`)
54
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
55
+
56
+
57
+ -- DROP TABLE IF EXISTS {$this->getTable('st_ticket')};
58
+ CREATE TABLE {$this->getTable('st_ticket')} (
59
+ `ticket_id` int(11) unsigned NOT NULL auto_increment,
60
+ `ticket_title` varchar(255) NOT NULL default '',
61
+ `ticket_code` varchar(20) NULL,
62
+ `department_id` int(11) unsigned NOT NULL,
63
+ `created_user` varchar(255) NOT NULL default '',
64
+ `assigned_user` varchar(255) NOT NULL default '',
65
+ `customer_name` varchar(255) NOT NULL,
66
+ `customer_email` varchar(255) NOT NULL,
67
+ `status` varchar(255) NOT NULL default 'OPEN',
68
+ `priority` varchar(255) NOT NULL default 'Low',
69
+ `ticket_content` text NOT NULL,
70
+ `created_time` timestamp default now(),
71
+ `last_updated` datetime NULL,
72
+ `total_reply` int(11) unsigned NOT NULL DEFAULT '0',
73
+ `attachment` varchar(255) NOT NULL,
74
+ `is_private` tinyint(1) NOT NULL default '0',
75
+ FOREIGN KEY (`department_id`) REFERENCES {$this->getTable('st_department')} (`department_id`) ON DELETE CASCADE ON UPDATE CASCADE,
76
+
77
+ PRIMARY KEY (`ticket_id`)
78
+
79
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
80
+
81
+ -- DROP TABLE IF EXISTS {$this->getTable('st_message')};
82
+ CREATE TABLE {$this->getTable('st_message')} (
83
+ `message_id` int(11) unsigned NOT NULL auto_increment,
84
+ `ticket_id` int(11) unsigned NOT NULL,
85
+ `content` text NOT NULL,
86
+ `created_time` timestamp default now(),
87
+ `customer_email` varchar(255) NOT NULL,
88
+ `created_user` varchar(255) NOT NULL default '',
89
+ `attachment` varchar(255) NOT NULL,
90
+ `is_private` tinyint(1) NOT NULL default '0',
91
+ FOREIGN KEY (`ticket_id`) REFERENCES {$this->getTable('st_ticket')} (`ticket_id`) ON DELETE CASCADE ON UPDATE CASCADE,
92
+ PRIMARY KEY (`message_id`)
93
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
94
+
95
+ -- DROP TABLE IF EXISTS {$this->getTable('st_status_log')};
96
+ CREATE TABLE {$this->getTable('st_status_log')} (
97
+ `status_log_id` int(11) unsigned NOT NULL auto_increment,
98
+ `ticket_id` int(11) unsigned NOT NULL DEFAULT '0',
99
+ `admin_user` varchar(255) NOT NULL default 'admin',
100
+ `action` varchar(255) NOT NULL default 'VIEW',
101
+ `time` timestamp default now(),
102
+ PRIMARY KEY (`status_log_id`),
103
+ FOREIGN KEY (`ticket_id`) REFERENCES {$this->getTable('st_ticket')} (`ticket_id`) ON DELETE CASCADE ON UPDATE CASCADE
104
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
105
+
106
+
107
+ -- DROP TABLE IF EXISTS {$this->getTable('st_email')};
108
+ CREATE TABLE {$this->getTable('st_email')} (
109
+ `email_id` int(11) unsigned NOT NULL auto_increment,
110
+ `customer_id` int(11) unsigned NOT NULL DEFAULT '0',
111
+ `email` varchar(255) NOT NULL,
112
+ `status` tinyint(1) NOT NULL default '0',
113
+ `hash_code` varchar(255) NULL,
114
+ PRIMARY KEY (`email_id`),
115
+ FOREIGN KEY (`customer_id`) REFERENCES {$this->getTable('customer_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
116
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
117
+
118
+ -- DROP TABLE IF EXISTS {$this->getTable('st_template_entity')};
119
+ CREATE TABLE {$this->getTable('st_template_entity')} (
120
+ `entity_id` int(11) unsigned NOT NULL auto_increment,
121
+ `status` tinyint(1) NOT NULL default '1',
122
+ PRIMARY KEY (`entity_id`)
123
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
124
+
125
+ -- DROP TABLE IF EXISTS {$this->getTable('st_template')};
126
+ CREATE TABLE {$this->getTable('st_template')} (
127
+ `template_id` int(11) unsigned NOT NULL auto_increment,
128
+ `entity_id` int(11) unsigned NOT NULL default 0,
129
+ `store_id` int(11) unsigned NOT NULL default 0,
130
+ `template_name` varchar(255) NOT NULL,
131
+ `content` text NOT NULL,
132
+ `status` tinyint(1) NOT NULL default '1',
133
+ FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('st_template_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
134
+ PRIMARY KEY (`template_id`)
135
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
136
+
137
+ ");
138
+
139
+ $installer->endSetup();
app/code/local/Magestore/Supportticket/sql/supportticket_setup/mysql4-upgrade-0.1.0-0.2.0.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ ALTER TABLE {$this->getTable('st_department')}
10
+ ADD COLUMN `email_password` varchar(30) NOT NULL default '';
11
+
12
+ ");
13
+
14
+ $installer->endSetup();
app/code/local/Magestore/Supportticket/sql/supportticket_setup/mysql4-upgrade-0.2.0-0.2.1.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/supportticket.xml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss"><styleSheet>css/magestore/supportticket.css</styleSheet></action>
6
+ </reference>
7
+ </default>
8
+
9
+ <adminsupportticket_adminhtml_departmentgroup_index>
10
+ <reference name="content">
11
+ <block type="supportticket/adminhtml_departmentgroup" name="departmentgroup" />
12
+ </reference>
13
+ </adminsupportticket_adminhtml_departmentgroup_index>
14
+
15
+ <adminsupportticket_adminhtml_template_index>
16
+ <reference name="content">
17
+ <block type="supportticket/adminhtml_template" name="template" />
18
+ </reference>
19
+ </adminsupportticket_adminhtml_template_index>
20
+
21
+ <adminsupportticket_adminhtml_template_edit>
22
+ <reference name="left">
23
+ <block type="adminhtml/store_switcher" name="store_switcher" before="-"></block>
24
+ </reference>
25
+ </adminsupportticket_adminhtml_template_edit>
26
+
27
+ <adminsupportticket_adminhtml_departmentgroup_edit>
28
+ <reference name="left">
29
+ <block type="adminhtml/store_switcher" name="store_switcher" before="-"></block>
30
+ </reference>
31
+ </adminsupportticket_adminhtml_departmentgroup_edit>
32
+
33
+ <adminsupportticket_adminhtml_department_index>
34
+ <reference name="content">
35
+ <block type="supportticket/adminhtml_department" name="department" />
36
+ </reference>
37
+ </adminsupportticket_adminhtml_department_index>
38
+
39
+ <adminsupportticket_adminhtml_department_edit>
40
+ <reference name="left">
41
+ <block type="adminhtml/store_switcher" name="store_switcher" before="-"></block>
42
+ </reference>
43
+ </adminsupportticket_adminhtml_department_edit>
44
+
45
+ <adminsupportticket_adminhtml_ticket_index>
46
+ <reference name="head">
47
+ <action method="addJs"><script>prototype/tooltip.js</script></action>
48
+ </reference>
49
+ <reference name="content">
50
+ <block type="supportticket/adminhtml_ticket" name="ticket" />
51
+ </reference>
52
+ </adminsupportticket_adminhtml_ticket_index>
53
+
54
+
55
+ <adminsupportticket_adminhtml_ticket_edit>
56
+ <reference name="left">
57
+ <!--<block type="adminhtml/store_switcher" name="store_switcher" before="-"></block> -->
58
+ </reference>
59
+ </adminsupportticket_adminhtml_ticket_edit>
60
+
61
+ <adminsupportticket_adminhtml_statuslog_index>
62
+ <reference name="content">
63
+ <block type="supportticket/adminhtml_statuslog" name="statuslog" />
64
+ </reference>
65
+ </adminsupportticket_adminhtml_statuslog_index>
66
+ </layout>
app/design/adminhtml/default/default/template/supportticket/message_history.phtml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $message_collection = Mage::registry("message_collection");
3
+ $mesage_count = count($message_collection);
4
+ //Zend_Debug::dump($message_collection);die("rong");
5
+ $ticket = Mage::registry("ticket");
6
+ if($mesage_count)
7
+ {
8
+ $i = 0;
9
+ foreach($message_collection as $message)
10
+ {
11
+ $i++;
12
+ if($message->getCreatedUser())
13
+ {
14
+ echo("<b>".$this->__("From Admin")." - ". $message->getCreatedUser() ." </b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $this->formatDate($message->getCreatedTime(),'medium',true));
15
+ }
16
+ else
17
+ {
18
+
19
+ echo("<b>".$this->__("From Customer")." - ". $ticket->getCustomerEmail() ." </b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $this->formatDate($message->getCreatedTime(),'medium',true));
20
+ }
21
+ echo("<br>");
22
+ echo("".$message->getContent()."");
23
+ $attachments = explode("*****",$message->getAttachment());
24
+ if(is_array($attachments))
25
+ {
26
+ $index=1;
27
+ foreach($attachments as $attachment)
28
+ {
29
+ if($attachment)
30
+ {
31
+ if($index==1)
32
+ {
33
+ echo "<br><br><b>".$this->__("Attachment")."</b><br/>";
34
+ }
35
+ $attachment = explode(";",$attachment);
36
+ if(count($attachment) == 2)
37
+ {
38
+ $file_name = $attachment[0];
39
+ $file_url = Mage::helper("supportticket")->getAttachmentUrl($message->getTicketId(),$attachment[1]);
40
+
41
+ echo($index.". &nbsp <a href='".$file_url. "' title='". $this->__('Click here to download') . "' target='_blank'>".$file_name."</a><br/>");
42
+ }
43
+ }
44
+ $index++;
45
+ }
46
+ }
47
+
48
+ if($i < $mesage_count)
49
+ {
50
+
51
+ echo("<br><br><hr style='border:1px dashed #CCCCCC;'>");
52
+ }
53
+
54
+ }
55
+
56
+ }
57
+ else
58
+ {
59
+ echo($this->__("There is no message!"));
60
+ }
61
+ ?>
app/design/adminhtml/default/default/template/supportticket/multiupload.phtml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div id="myDiv">
3
+ <input type="file" name="attachment_1" id="file" /><br/>
4
+ </div>
5
+ <button type="button" onclick="addFile()"><?php echo $this->__('Add More')?> </button>
6
+ <br />
7
+ <script type="text/javascript">
8
+ var index=2;
9
+ function addFile(){
10
+ var inputFile = "<input type='file' name='attachment_"+index+"' id='file' /><br/>";
11
+ $('myDiv').insert(inputFile);
12
+ index++;
13
+ }
14
+ </script>
app/design/adminhtml/default/default/template/supportticket/private_message_history.phtml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $message_collection = Mage::registry("private_message_collection");
3
+ $mesage_count = count($message_collection);
4
+ $ticket = Mage::registry("ticket");
5
+ if($mesage_count)
6
+ {
7
+ $i = 0;
8
+ foreach($message_collection as $message)
9
+ {
10
+ $i++;
11
+ if($message->getCreatedUser())
12
+ {
13
+ echo("<b>".$this->__("From Admin")." - ". $message->getCreatedUser() ." </b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $this->formatDate($message->getCreatedTime(),'medium',true));
14
+ }
15
+ else
16
+ {
17
+
18
+ echo("<b>".$this->__("From Customer")." - ". $ticket->getCustomerEmail() ." </b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $this->formatDate($message->getCreatedTime(),'medium',true));
19
+ }
20
+ echo("<br>");
21
+ echo("".$message->getContent()."");
22
+ $attachments = explode("*****",$message->getAttachment());
23
+ if(is_array($attachments))
24
+ {
25
+ $index=1;
26
+ foreach($attachments as $attachment)
27
+ {
28
+ if($attachment)
29
+ {
30
+ if($index==1)
31
+ {
32
+ echo "<br><br><b>".$this->__("Attachment")."</b><br/>";
33
+ }
34
+ $attachment = explode(";",$attachment);
35
+ if(count($attachment) == 2)
36
+ {
37
+ $file_name = $attachment[0];
38
+ $file_url = Mage::helper("supportticket")->getAttachmentUrl($message->getTicketId(),$attachment[1]);
39
+
40
+ echo($index.". &nbsp <a href='".$file_url. "' title='". $this->__('Click here to download') . "' target='_blank'>".$file_name."</a><br/>");
41
+ }
42
+ }
43
+ $index++;
44
+ }
45
+ }
46
+ if($i < $mesage_count)
47
+ {
48
+
49
+ echo("<br><br><hr style='border:1px dashed #CCCCCC;'>");
50
+ }
51
+
52
+ }
53
+
54
+ }
55
+ else
56
+ {
57
+ echo($this->__("There is no message!"));
58
+ }
59
+ ?>
app/design/adminhtml/default/default/template/supportticket/view_ticket.phtml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $ticket = Mage::registry("ticket");
3
+ $department = Mage::getModel("supportticket/department")->load($ticket->getDepartmentId());
4
+ if($ticket)
5
+ {
6
+ $is_private = $ticket->getIsPrivate()?$this->__("Private Ticket"):$this->__("Public Ticket");
7
+ }
8
+ ?>
9
+ <div class="grid">
10
+ <table class="data" cellspacing="0">
11
+ <thead>
12
+ <tr class="headings">
13
+ <th colspan="4"><?php echo $is_private;?></th>
14
+ </tr>
15
+ </thead>
16
+ <tbody>
17
+ <tr>
18
+ <td width="20%"><b><?php echo $this->__("Subject");?></b></td>
19
+ <td colspan="3"><?php echo($ticket->getTicketTitle());?></td>
20
+ </tr>
21
+ <tr>
22
+ <td width="20%"><b><?php echo $this->__("Ticket ID"); ?></b></td>
23
+ <td width="20%"><?php echo($ticket->getTicketCode());?></td>
24
+ <td width="20%"><b><?php echo($this->__("Status"));?></b></td>
25
+ <td><?php echo($ticket->getStatus());?></td>
26
+ </tr>
27
+ <tr>
28
+ <td width="20%"><b><?php echo $this->__("Created Date");?></b></td>
29
+ <td width="20%"><?php echo($this->formatDate($ticket->getCreatedTime(),'medium',true));?></td>
30
+ <td width="20%"><b><?php echo $this->__("Department");?></b></td>
31
+ <td><?php echo($department->getDepartmentName());?></td>
32
+ </tr>
33
+ <tr>
34
+ <td width="20%"><b><?php echo $this->__("Created User");?></b></td>
35
+ <td width="20%"><?php echo($ticket->getCreatedUser());?></td>
36
+ <td width="20%"><b><?php echo $this->__("Assigned User");?></b></td>
37
+ <td><?php echo($ticket->getAssignedUser());?></td>
38
+ </tr>
39
+ <tr>
40
+ <td width="20%"><b><?php echo $this->__("Customer Name");?></b></td>
41
+ <td width="20%"><?php echo($ticket->getCustomerName());?></td>
42
+ <td width="20%"><b><?php echo $this->__("Customer Email");?></b></td>
43
+ <td>**************<?php //echo($ticket->getCustomerEmail());?></td>
44
+ </tr>
45
+ <tr>
46
+ <td width="20%"><b><?php echo $this->__("Attachment");?></b></td>
47
+ <td colspan="3">
48
+ <?php
49
+ $attachments = explode("*****",$ticket->getAttachment());
50
+ if(is_array($attachments))
51
+ {
52
+ $file_index = 0;
53
+ foreach($attachments as $attachment)
54
+ {
55
+ if($attachment)
56
+ {
57
+ $attachment = explode(";",$attachment);
58
+ if(count($attachment) == 2)
59
+ {
60
+ $file_index++;
61
+ $file_name = $attachment[0];
62
+ $file_url = Mage::helper("supportticket")->getAttachmentUrl($ticket->getId(),$attachment[1]);
63
+ echo($file_index.'. '."<a href='".$file_url. "' title='". $this->__('Click here to download') . "' target='_blank'>".$file_name."</a><br/>");
64
+ }
65
+ }
66
+ }
67
+ }
68
+ ?>
69
+ </td>
70
+ </tr>
71
+ <tr>
72
+ <td width="20%"><b><?php echo $this->__("Content");?></b></td>
73
+ <td colspan="3">
74
+ <?php echo($ticket->getContent());?>
75
+ </td>
76
+ </tr>
77
+ </tbody>
78
+ </table>
79
+ </div>
app/design/frontend/default/default/layout/supportticket.xml ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <supportticket_ticket_submit>
6
+ <update handle="customer_account"/>
7
+ <reference name="root">
8
+ <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
9
+ </reference>
10
+ <reference name="head">
11
+ <action method="addJs"><script>magestore/supportticket.js</script></action>
12
+ <action method="addCss"><script>css/magestore/supportticket.css</script></action>
13
+ </reference>
14
+ <reference name="content">
15
+ <block type="supportticket/submit" name="supportticket.submit" template="supportticket/submit.phtml" />
16
+ </reference>
17
+
18
+ </supportticket_ticket_submit>
19
+
20
+ <supportticket_email_index>
21
+ <update handle="customer_account"/>
22
+ <reference name="root">
23
+ <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
24
+ </reference>
25
+ <reference name="head">
26
+ <action method="addJs"><script>magestore/supportticket.js</script></action>
27
+ <action method="addCss"><script>css/magestore/supportticket.css</script></action>
28
+ </reference>
29
+ <reference name="content">
30
+ <block type="supportticket/setupemail" name="supportticket.setupemail" template="supportticket/setupemail.phtml" />
31
+ </reference>
32
+ </supportticket_email_index>
33
+
34
+ <supportticket_email_active>
35
+ <update handle="customer_account"/>
36
+ <reference name="root">
37
+ <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
38
+ </reference>
39
+ <reference name="head">
40
+ <action method="addJs"><script>magestore/supportticket.js</script></action>
41
+ <action method="addCss"><script>css/magestore/supportticket.css</script></action>
42
+ </reference>
43
+ <reference name="content">
44
+ <block type="supportticket/activeemail" name="supportticket.activeemail" template="supportticket/activeemail.phtml" />
45
+ </reference>
46
+ </supportticket_email_active>
47
+
48
+ <supportticket_ticket_index>
49
+ <update handle="customer_account"/>
50
+ <reference name="root">
51
+ <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
52
+ </reference>
53
+ <reference name="head">
54
+ <action method="addJs"><script>magestore/supportticket.js</script></action>
55
+ <action method="addCss"><script>css/magestore/supportticket.css</script></action>
56
+ </reference>
57
+
58
+ <reference name="content">
59
+ <block type="supportticket/list" name="supportticket.list" template="supportticket/list.phtml" />
60
+ </reference>
61
+
62
+ </supportticket_ticket_index>
63
+
64
+ <supportticket_ticket_view>
65
+ <update handle="customer_account"/>
66
+ <reference name="root">
67
+ <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
68
+ </reference>
69
+ <reference name="head">
70
+ <action method="addJs"><script>magestore/supportticket.js</script></action>
71
+ <action method="addCss"><script>css/magestore/supportticket.css</script></action>
72
+ </reference>
73
+ <reference name="content">
74
+ <block type="supportticket/view" name="supportticket.view" template="supportticket/view.phtml" />
75
+ </reference>
76
+
77
+
78
+ </supportticket_ticket_view>
79
+
80
+ <customer_account>
81
+ <reference name="left">
82
+ <reference name="customer_account_navigation" before="-" template="customer/account/navigation.phtml"/>
83
+ <block type="supportticket/sliderbar" name="supportticket.sliderbar" template="supportticket/sliderbar.phtml" after="customer_account_navigation">
84
+ <action method="addLink" translate="label" module="supportticket"><name>supportticket_list</name><path>supportticket/ticket/</path><label>View All Past Ticket</label></action>
85
+ <action method="addLink" translate="label" module="supportticket"><name>supportticket_submit</name><path>supportticket/ticket/submit/</path><label>Submit a Ticket</label></action>
86
+ <action method="addLink" translate="label" module="supportticket"><name>supportticket_email</name><path>supportticket/email/</path><label>Setup Email Address</label></action>
87
+ </block>
88
+ </reference>
89
+ </customer_account>
90
+
91
+ <supportticket_ticket_ticketformcontent>
92
+ <!-- Mage_Checkout -->
93
+ <remove name="right"/>
94
+ <remove name="left"/>
95
+
96
+ <block type="supportticket/ticketform" name="supportticket.ticketform" output="toHtml" template="supportticket/ticketformcontent.phtml"/>
97
+ </supportticket_ticket_ticketformcontent>
98
+
99
+
100
+ </layout>
app/design/frontend/default/default/template/supportticket/activeemail.phtml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="page-title">
2
+ <h1><?php echo $this->__('Support Ticket >> Setup Email Address');?></h1>
3
+ </div>
4
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
5
+ <?php
6
+ $hash_code = Mage::registry("hash_code");
7
+
8
+ ?>
9
+ <div class="supportticket">
10
+ <form action="<?php echo $this->getUrl('supportticket/email/active/hash_code/'.$hash_code) ?>" method="post" id="ticket-form">
11
+ <div class="fieldset">
12
+ <h2 class="legend"><?php echo $this->__('Active an Email Address') ?></h2>
13
+
14
+ <div class="box-account box-info">
15
+ <div class="box-head">
16
+ <h2><?php echo $this->__('Type Your Primary Email of Your Account') ?></h2>
17
+ </div>
18
+ <ul class="form-list">
19
+ <li>
20
+ <label for="primary_email" class="required"><em>*</em><?php echo $this->__('Primary Email Address') ?></label>
21
+ <div class="input-box">
22
+ <input type="text" name="primary_email" id="primary_email" title="<?php echo $this->__('Primary Email Address') ?>" class="input-text required-entry" />
23
+ </div>
24
+ </li>
25
+ </ul>
26
+ <div class="buttons-set">
27
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
28
+ <button type="submit" title="<?php echo $this->__('Active Email Address') ?>" class="button"><span><span><?php echo $this->__('Active Email Address') ?></span></span></button>
29
+ </div>
30
+ </div>
31
+
32
+ </div>
33
+ </form>
34
+
35
+ </div>
36
+ <script type="text/javascript">
37
+ //<![CDATA[
38
+ var dataForm = new VarienForm('ticket-form', true);
39
+ //]]>
40
+ </script>
app/design/frontend/default/default/template/supportticket/list.phtml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="page-title">
2
+ <h1><?php echo $this->__('Support Ticket >> View All Ticket') ?></h1>
3
+ </div>
4
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
5
+
6
+ <div class="supportticket">
7
+ <fieldset>
8
+ <table id="wishlist-table" class="data-table">
9
+ <thead>
10
+ <tr class="first last">
11
+ <th width="100px" colspan="2"><?php echo($this->__("Ticket"))?> #</th>
12
+ <th><?php echo($this->__("Subject"))?></th>
13
+ <th><?php echo($this->__("Last Updated"))?></th>
14
+ <th><?php echo($this->__("Last Responder"))?></th>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <?php
19
+ $tickets = $this->getAllTicket();
20
+
21
+ if(count($tickets))
22
+ {
23
+ ?>
24
+
25
+
26
+ <?php
27
+ $i = 0;
28
+ foreach($tickets as $ticket)
29
+ {
30
+ $i++;
31
+ $tr_class ="";
32
+ if($i % 2 == 0)
33
+ {
34
+ $tr_class .= "odd";
35
+ }
36
+ else
37
+ {
38
+ $tr_class .= "even";
39
+ }
40
+ if($i==1)
41
+ {
42
+ $tr_class .= " first";
43
+ }
44
+ if($i==count($tickets))
45
+ {
46
+ $tr_class .= " last";
47
+ }
48
+
49
+ ?>
50
+ <tr class="<?php echo($tr_class);?>">
51
+ <td width="5%"><a href="<?php echo($this->getViewTicketUrl($ticket)) ?>"><img src="<?php echo Mage::getBaseUrl('media'). "supportticket/magglass.gif"?>"/></a></td>
52
+ <td width="15%"><a href="<?php echo($this->getViewTicketUrl($ticket)) ?>"><b><?php echo($ticket->getTicketCode());?></b></a></td>
53
+ <td width="40%"><?php echo($ticket->getTicketTitle());?></td>
54
+ <td width="18%"><?php echo($this->formatDate($ticket->getLastUpdated(),'medium',true));?></td>
55
+ <td width="18%"><?php echo($this->getLastResponder($ticket)) ?></td>
56
+ </tr>
57
+ <?php
58
+ }//end foreach($tickets as $ticket)
59
+ ?>
60
+
61
+ <?php
62
+ } //end if(count($tickets))
63
+ else
64
+ {
65
+ ?>
66
+ <tr class="first odd">
67
+ <td colspan="5"><?php echo($this->__("You do not submit any ticket yet."))?></td>
68
+ </tr>
69
+ <?php
70
+ }
71
+ ?>
72
+ </tbody>
73
+ </table>
74
+ </fieldset>
75
+ </div>
app/design/frontend/default/default/template/supportticket/setupemail.phtml ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ //<![CDATA[
3
+ function confirmDelete()
4
+ {
5
+ var delete_email = confirm("<?php echo $this->__('Are You Sure?');?>");
6
+ if(delete_email == true)
7
+ {
8
+ return true;
9
+ }
10
+ return false;
11
+ }
12
+ //]]>
13
+ </script>
14
+ <div class="page-title">
15
+ <h1><?php echo $this->__('Support Ticket >> Setup Email Address');?></h1>
16
+ </div>
17
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
18
+ <?php
19
+ $email_data = Mage::registry("email_data");
20
+ Mage::getSingleton('supportticket/session')->setFormData(null);
21
+ ?>
22
+ <div class="supportticket">
23
+ <div style="width:300px">
24
+
25
+ <fieldset>
26
+ <table id="reply-table" class="data-table">
27
+ <thead>
28
+ <tr class="first last">
29
+ <th width="100%" colspan="3"><?php echo($this->__("Your Added Email Address"));?></th>
30
+ </tr>
31
+ </thead>
32
+ <tbody>
33
+ <?php
34
+ $emails = $this->getAllAddedEmail();
35
+ if(count($emails))
36
+ {
37
+ $i =0;
38
+ foreach($emails as $email)
39
+ {
40
+ $i++;
41
+ $tr_class ="";
42
+ if($i % 2 == 0)
43
+ {
44
+ $tr_class .= "odd";
45
+ }
46
+ else
47
+ {
48
+ $tr_class .= "even";
49
+ }
50
+ if($i==1)
51
+ {
52
+ $tr_class .= " first";
53
+ }
54
+ if($i==count($emails))
55
+ {
56
+ $tr_class .= " last";
57
+ }
58
+ ?>
59
+ <tr class="<?php echo($tr_class);?>">
60
+ <td width="200px"><?php echo($email->getEmail()); ?></td>
61
+ <td width="50px"><?php echo($email->getStatus()?$this->__("Active"):$this->__("Pending")); ?></td>
62
+ <td><a href="<?php echo($this->getDeleteEmailUrl($email))?>" onclick="return confirmDelete();"><?php echo($this->__("Delete")); ?></a></td>
63
+ </tr>
64
+ <?php
65
+ }
66
+ }//end if(count($emails))
67
+ else
68
+ {
69
+ ?>
70
+ <tr>
71
+ <td colspan="2"><?php echo($this->__("You don't have any email addresses")); ?></td>
72
+ </tr>
73
+ <?php
74
+ }//end else if(count($emails))
75
+ ?>
76
+ </tbody>
77
+ </table>
78
+ </fieldset>
79
+ </div>
80
+
81
+
82
+ <form action="<?php echo $this->getUrl('supportticket/email/add') ?>" method="post" id="ticket-form">
83
+ <div class="fieldset">
84
+ <h2 class="legend"><?php echo $this->__('Add an Email Address') ?></h2>
85
+ <?php echo(Mage::getStoreConfig('supportticket/general/email_manager_hint'));?>
86
+ <div class="box-account box-info">
87
+ <div class="box-head">
88
+ <h2><?php echo $this->__('Type an Email and Your Account Password') ?></h2>
89
+ </div>
90
+ <ul class="form-list">
91
+ <li>
92
+ <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
93
+ <div class="input-box">
94
+ <input type="text" name="email" id="email" title="<?php echo $this->__('Email Address') ?>" class="input-text required-entry" value="<?php echo($email_data->getEmail());?>"/>
95
+ </div>
96
+ </li>
97
+ <li>
98
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Account Password') ?></label>
99
+ <div class="input-box">
100
+ <input type="password" name="password" id="password" title="<?php echo $this->__('Account Password') ?>" class="input-text required-entry" />
101
+ </div>
102
+ </li>
103
+ </ul>
104
+ <div class="buttons-set">
105
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
106
+ <button type="submit" title="<?php echo $this->__('Add Email Address') ?>" class="button"><span><span><?php echo $this->__('Add Email Address') ?></span></span></button>
107
+ </div>
108
+ </div>
109
+
110
+ </div>
111
+ </form>
112
+
113
+ </div>
114
+ <script type="text/javascript">
115
+ //<![CDATA[
116
+ var dataForm = new VarienForm('ticket-form', true);
117
+ //]]>
118
+ </script>
app/design/frontend/default/default/template/supportticket/sliderbar.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ ?>
4
+ <div class="block block-account">
5
+ <div class="block-title">
6
+ <strong><span><?php echo $this->__('Support Tickets'); ?></span></strong>
7
+ </div>
8
+ <div class="block-content">
9
+ <ul>
10
+ <?php $_links = $this->getLinks(); ?>
11
+ <?php $_index = 1; ?>
12
+ <?php $_count = count($_links); ?>
13
+ <?php foreach ($_links as $_link): ?>
14
+ <?php $_last = ($_index++ >= $_count); ?>
15
+ <?php if ($this->isActive($_link)): ?>
16
+ <li class="current<?php echo ($_last ? ' last' : '') ?>"><strong><?php echo $_link->getLabel() ?></strong></li>
17
+ <?php else: ?>
18
+ <li<?php echo ($_last ? ' class="last"' : '') ?>><a href="<?php echo $_link->getUrl() ?>"><?php echo $_link->getLabel() ?></a></li>
19
+ <?php endif; ?>
20
+ <?php endforeach; ?>
21
+ </ul>
22
+ </div>
23
+ </div>
app/design/frontend/default/default/template/supportticket/submit.phtml ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ //<![CDATA[
3
+ var Supportticket = new Supportticket('<?php echo $this->getTicketformUrl(); ?>');
4
+ //]]>
5
+ var index=2;
6
+ function addFile(){
7
+ var inputFile = "<input type='file' name='attachment_"+index+"' id='file' /><br/>";
8
+ $('myDiv').insert(inputFile);
9
+ index++;
10
+ }
11
+
12
+ </script>
13
+ <div class="page-title">
14
+ <h1><?php echo $this->__('Support Ticket >> Submit a New Ticket') ?></h1>
15
+ </div>
16
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
17
+ <div class="supportticket">
18
+ <form action="<?php echo $this->getUrl('supportticket/ticket/submit') ?>" method="post" id="ticket-form" enctype="multipart/form-data">
19
+ <div class="fieldset">
20
+ <h2 class="legend"><?php echo $this->__('Submit a New Ticket') ?></h2>
21
+ <?php echo(Mage::getStoreConfig('supportticket/email_template/submit_hint'));?>
22
+
23
+ <div class="box-account box-info">
24
+ <div class="box-head">
25
+ <h2><?php echo $this->__('Please Select Type of Request') ?></h2>
26
+ </div>
27
+ <ul class="form-list" >
28
+ <?php
29
+ if($this->getDepartmentList())
30
+ {
31
+ ?>
32
+ <select id="department_id" name="department_id">
33
+ <option value=""><?php echo($this->__("Please Select")); ?></option>
34
+
35
+ <?php
36
+ $departments = $this->getDepartmentList();
37
+ $department_group_id = 0;
38
+ foreach( $departments as $department)
39
+ {
40
+ if($department_group_id != $department->getDepartmentGroupId())
41
+ {
42
+ $department_group_id = $department->getDepartmentGroupId();
43
+ $department_group = Mage::getModel("supportticket/departmentgroup")
44
+ ->setStoreId(Mage::app()->getStore()->getId())
45
+ ->loadByEntity($department_group_id);
46
+
47
+ echo("<optgroup label='---". $department_group->getDepartmentGroupName()."---'> </optgroup> ");
48
+ }
49
+ echo("<option value='". $department->getDepartmentId()."'>".$department->getDepartmentName()."</option>");
50
+ }
51
+ ?>
52
+ </select>
53
+ <?php
54
+
55
+ }
56
+ ?>
57
+ </ul>
58
+ <div id="department_description" name="department_description"></div>
59
+ </div>
60
+
61
+ <div id="ticketform" name="ticketform">
62
+
63
+ </div>
64
+ </div>
65
+ </form>
66
+ </div>
67
+ <script type="text/javascript">
68
+ //<![CDATA[
69
+ var dataForm = new VarienForm('ticket-form', true);
70
+ var department_descriptions = new Array();
71
+ <?php
72
+ foreach($departments as $department)
73
+ {
74
+ echo('department_descriptions['.$department->getId().']="'. $department->getDescription() . '";');
75
+ }
76
+ ?>
77
+
78
+ Event.observe('department_id', 'change', function(event){
79
+
80
+ var department_id;
81
+ var description;
82
+ Supportticket.ticketform();
83
+ department_id = $('department_id').value;
84
+ description = department_descriptions[department_id];
85
+
86
+ $("department_description").update(description);
87
+
88
+ });
89
+ //]]>
90
+ </script>
app/design/frontend/default/default/template/supportticket/ticketformcontent.phtml ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="box-account box-info">
3
+ <div class="box-head">
4
+ <h2><?php echo $this->__('Ticket Information') ?></h2>
5
+ </div>
6
+ <?php
7
+ if($this->canSubmitTicket())
8
+ {
9
+ ?>
10
+ <ul class="form-list">
11
+ <?php if(!Mage::getSingleton('customer/session')->isLoggedIn()){ ?>
12
+ <li>
13
+ <label for="customer_name" class="required"><em>*</em><?php echo $this->__('Your Name') ?></label>
14
+ <div class="input-box">
15
+ <input type="text" name="customer_name" id="customer_name" title="<?php echo $this->__('Your Name') ?>" value="<?php echo $this->htmlEscape($this->getTicket()->getCustomerName()) ?>" class="input-text required-entry" />
16
+ </div>
17
+ </li>
18
+
19
+ <li>
20
+ <label for="customer_email" class="required"><em>*</em><?php echo $this->__('Your Email') ?></label>
21
+ <div class="input-box">
22
+ <input type="text" name="customer_email" id="customer_email" title="<?php echo $this->__('Your Email') ?>" value="<?php echo $this->htmlEscape($this->getTicket()->getCustomerEmail()) ?>" class="input-text required-entry" />
23
+ </div>
24
+ </li>
25
+ <?php
26
+ }
27
+ else
28
+ {
29
+ $emails = $this->getCustomerEmailOptions();
30
+ ?>
31
+ <li>
32
+ <label for="customer_email" class="required"><em>*</em><?php echo $this->__('Your Email') ?></label>
33
+ <div class="input-box">
34
+ <select name="customer_email" id="customer_email" title="<?php echo $this->__('Your Email') ?>">
35
+ <?php
36
+ foreach($emails as $email)
37
+ {
38
+ echo("<option value='". $email. "'>".$email."</option>");
39
+ }
40
+ ?>
41
+ </select>
42
+ </div>
43
+ </li>
44
+ <?php
45
+ }
46
+ ?>
47
+ <li>
48
+ <label for="ticket_title" class="required"><em>*</em><?php echo $this->__('Subject') ?></label>
49
+ <div class="input-box">
50
+ <input type="text" name="ticket_title" id="ticket_title" title="<?php echo $this->__('Subject') ?>" value="<?php echo $this->htmlEscape($this->getTicket()->getTicketTitle()) ?>" class="input-text required-entry" />
51
+ </div>
52
+ </li>
53
+
54
+ <li class="wide">
55
+ <label for="content" class="required"><em>*</em><?php echo $this->__('Content') ?></label>
56
+ <div class="input-box">
57
+ <textarea name="ticket_content" id="content" rows="10" class="input-text required-entry"><?php echo $this->htmlEscape($this->getTicket()->getTicketTitle()) ?></textarea>
58
+ </div>
59
+ </li>
60
+ <li class="wide">
61
+ <label for="attachment"><?php echo $this->__('Attachment') ?></label>
62
+ <br />
63
+ <div id="myDiv">
64
+ <input type="file" name="attachment_1" id="file" /><br/>
65
+ </div>
66
+ <button type="button" class="button" onclick="addFile()">
67
+ <span><?php echo $this->__('Add More')?></span>
68
+ </button>
69
+
70
+
71
+
72
+ </li>
73
+ </ul>
74
+ <div class="buttons-set">
75
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
76
+ <button type="submit" title="<?php echo $this->__('Create New Ticket') ?>" class="button"><span><span><?php echo $this->__('Create New Ticket') ?></span></span></button>
77
+ </div>
78
+ <?php
79
+
80
+ }
81
+ else
82
+ {
83
+ echo("Your customer group is unable to submit a ticket. Please try to login to submit a new ticket ");
84
+ ?>
85
+
86
+ <button type="button" title="<?php echo $this->__('Login') ?>" class="button" onclick="javascript:window.location.href ='<?php echo(Mage::getUrl('customer/account/login'));?>'"><span><span><?php echo $this->__('Login') ?></span></span></button>
87
+ <?php
88
+ }
89
+ ?>
90
+ </div>
91
+
app/design/frontend/default/default/template/supportticket/view.phtml ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $ticket = $this->getTicket();
3
+ ?>
4
+ <div class="page-title">
5
+ <h1><?php echo $this->__('Support Ticket >> View Ticket')." : ". $ticket->getTicketTitle() ?></h1>
6
+ </div>
7
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
8
+
9
+ <div class="supportticket">
10
+
11
+ <fieldset>
12
+ <table id="ticket-table" class="data-table">
13
+ <thead>
14
+ <tr class="first last">
15
+ <th width="100%" colspan="4"><?php echo($this->__("Ticket Information"));?></th>
16
+ </tr>
17
+ </thead>
18
+ <tbody>
19
+ <tr class="first odd">
20
+ <td width="20%"><b><?php echo $this->__('Subject'); ?></b></td>
21
+ <td colspan="3"><?php echo($ticket->getTicketTitle()); ?></td>
22
+ </tr>
23
+ <tr class="even">
24
+ <td width="20%"><b><?php echo $this->__('Ticket ID'); ?></b></td>
25
+ <td width="20%"><?php echo($ticket->getTicketCode()); ?></td>
26
+ <td width="20%"><b><?php echo $this->__('Status') ?></b></td>
27
+ <td><?php echo($ticket->getStatus()); ?></td>
28
+ </tr>
29
+ <tr class="odd">
30
+ <td width="20%"><b><?php echo $this->__('Created Date'); ?></b></td>
31
+ <td width="20%"><?php echo($this->formatDate($ticket->getCreatedTime(),'medium',true));?></td>
32
+ <td width="20%"><b><?php echo $this->__('Department'); ?></b></td>
33
+ <td><?php echo($this->getTicketDepartment($ticket)); ?></td>
34
+ </tr>
35
+
36
+ <?php
37
+ $attachments = explode("*****",$ticket->getAttachment());
38
+ if(is_array($attachments))
39
+ {
40
+ $i=1;
41
+ foreach($attachments as $attachment)
42
+ {
43
+ if($attachment)
44
+ {
45
+ $attachment = explode(";",$attachment);
46
+ if(count($attachment) == 2)
47
+ {
48
+ ?>
49
+ <tr class="first odd">
50
+ <td width="20%"><b><?php if($i==1){ echo $this->__('Attachment');} ?></b></td>
51
+ <td colspan="3">
52
+ <?php
53
+ $file_name = $attachment[0];
54
+ $file_url = Mage::helper("supportticket")->getAttachmentUrl($ticket->getId(),$attachment[1]);
55
+ echo("<a href='".$file_url. "' title='". $this->__('Click here to download') . "' target='_blank'>".$file_name."</a>");
56
+ ?>
57
+ </td>
58
+ </tr>
59
+ <?php
60
+ }
61
+ }
62
+ $i++;
63
+ }
64
+ }
65
+
66
+ ?>
67
+
68
+ <tr class="last even">
69
+ <td colspan="4">
70
+ <?php echo($ticket->getContent()); ?><br><br>
71
+ <form action="<?php echo $this->getUrl('supportticket/ticket/view/id/'. $ticket->getTicketCode()) ?>" method="post" id="message-form" enctype="multipart/form-data">
72
+ <ul class="form-list">
73
+ <li>
74
+ <label for="content" class="required"><em>*</em><?php echo $this->__('Response To This Ticket') ?></label><br>
75
+ <textarea name="content" id="content" class="input-text required-entry" rows="15px" style="width:100%"></textarea>
76
+ </li>
77
+ <li>
78
+ <label for="attachment"><?php echo $this->__('Attachment') ?></label>
79
+ <br/>
80
+ <div id="myDiv">
81
+ <input type="file" name="attachment_1" id="file" /><br/>
82
+ </div>
83
+ <button type="button" class="button" onclick="addFile()">
84
+ <span><?php echo $this->__('Add More')?></span>
85
+ </button>
86
+ <br />
87
+ <script type="text/javascript">
88
+ var index=2;
89
+ function addFile(){
90
+ var inputFile = "<input type='file' name='attachment_"+index+"' id='file' /><br/>";
91
+ $('myDiv').insert(inputFile);
92
+ index++;
93
+ }
94
+ </script>
95
+
96
+ </li>
97
+ </ul>
98
+ <div class="buttons-set">
99
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
100
+ <button type="submit" title="<?php echo $this->__('Post Your Response') ?>" class="button"><span><span><?php echo $this->__('Post Your Response') ?></span></span></button>
101
+ </div>
102
+ </form>
103
+ <br><br>
104
+ </td>
105
+ </tr>
106
+ </tbody>
107
+ </table>
108
+ <br><br>
109
+ <?php
110
+ $messages = $this->getTicketAllMessage($ticket);
111
+ if(count($messages))
112
+ {
113
+ ?>
114
+ <table id="reply-table" class="data-table">
115
+ <thead>
116
+ <tr class="first last">
117
+ <th width="100%" colspan="2"><?php echo($this->__("Responses For This Ticket"));?></th>
118
+ </tr>
119
+ </thead>
120
+ <?php
121
+ $i = 0;
122
+ foreach($messages as $message)
123
+ {
124
+ $i++;
125
+ $tr_class ="";
126
+ if($i % 2 == 0)
127
+ {
128
+ $tr_class .= "odd";
129
+ }
130
+ else
131
+ {
132
+ $tr_class .= "even";
133
+ }
134
+ if($i==1)
135
+ {
136
+ $tr_class .= " first";
137
+ }
138
+ if($i==count($messages))
139
+ {
140
+ $tr_class .= " last";
141
+ }
142
+ ?>
143
+ <tr class="<?php echo($tr_class); ?>">
144
+ <td width="30%" align="center" style="text-align:center">
145
+ <?php
146
+
147
+ if($message->getCustomerEmail())
148
+ {
149
+ $customer_avatar = Mage::getStoreConfig('supportticket/general/customer_avatar');
150
+ $img_src = Mage::getBaseUrl("media"). "supportticket/".$customer_avatar;
151
+ echo("<b>".$this->__("Customer Reponse") . "</b><br>");
152
+ echo("<img src='".$img_src . "' title='Customer Reponse' alt='Customer Response' align='center'/>");
153
+ }
154
+ else
155
+ {
156
+ $staff_avatar = Mage::getStoreConfig('supportticket/general/staff_avatar');
157
+ $img_src = Mage::getBaseUrl("media"). "supportticket/".$staff_avatar;
158
+ echo("<b>".$this->__("Staff Response") . "</b><br>");
159
+ echo("<img src='".$img_src . "' title='Staff Response' alt='Staff Response' align='center'/>");
160
+ }
161
+ echo("<br>".$this->formatDate($message->getCreatedTime(),'meidum',true));
162
+ ?>
163
+ </td>
164
+ <td>
165
+ <?php
166
+ $attachments = explode("*****",$message->getAttachment());
167
+ if(is_array($attachments)){
168
+ $j=1;
169
+ $file_index = 0;
170
+ foreach($attachments as $attachment){
171
+ if($attachment){
172
+ $attachment = explode(";",$attachment);
173
+ if(count($attachment) == 2){
174
+ $file_index++;
175
+ $file_name = $attachment[0];
176
+ $file_url = Mage::helper("supportticket")->getAttachmentUrl($ticket->getId(),$attachment[1]);
177
+ if($j == 1){
178
+ echo "<b>".$this->__("Attachment(s)")."</b><br/>";
179
+ }
180
+ echo($file_index.'. '."<a href='".$file_url. "' title='". $this->__('Click here to download') . "' target='_blank'>".$file_name."</a>");
181
+ echo("<br/>");
182
+ }
183
+ }
184
+ $j++;
185
+ }
186
+ }
187
+ echo("<br/>");
188
+ echo($message->getContent());
189
+ ?>
190
+ </td>
191
+ </tr>
192
+ <?php
193
+ }//end foreach($messages as $message)
194
+ ?>
195
+ </table>
196
+
197
+ <?php
198
+
199
+ }//end if(count($messages))
200
+ ?>
201
+ </fieldset>
202
+ </div>
203
+ <script type="text/javascript">
204
+ //<![CDATA[
205
+ var dataForm = new VarienForm('message-form', true);
206
+ //]]>
207
+ </script>
app/etc/modules/Magestore_Supportticket.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magestore_Supportticket>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Magestore_Supportticket>
8
+ </modules>
9
+ </config>
app/locale/en_US/template/email/supportticket/admin_assign_ticket.html ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject You Have Assigned on Ticket # {{var ticket.getTicketCode()}}@-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "skin url=\"images/logo_email.gif\" _area='frontend'":"Email Logo Image"}
5
+ @-->
6
+ <!--@styles
7
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
8
+ @-->
9
+
10
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
11
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
12
+ <tr>
13
+ <td align="center" valign="top">
14
+ <!-- [ header starts here] -->
15
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
16
+ <tr>
17
+ <td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
18
+ </tr>
19
+ </table>
20
+ <!-- [ middle starts here] -->
21
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
22
+ <tr>
23
+ <td valign="top">
24
+ <p>
25
+ <strong>Hello {{var moderator_name}}</strong>,<br/>
26
+ This email informs that you have assigned on ticket {{var ticket.getTicketCode()}}.<br>
27
+ You can view the ticket online at anytime by going to: <br><br>
28
+ <a href='{{var ticket_admin_url}}'>Admin Section</a>
29
+ </p>
30
+
31
+ {{var email_footer}}
32
+ </p>
33
+ </td>
34
+ </tr>
35
+ </table>
36
+ </td>
37
+ </tr>
38
+ </table>
39
+ </div>
app/locale/en_US/template/email/supportticket/admin_submit_email_message_to_customer.html ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject New Response on Ticket # {{var ticket_code}}@-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "skin url=\"images/logo_email.gif\" _area='frontend'":"Email Logo Image"}
5
+ @-->
6
+ <!--@styles
7
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; text-align:lelf; }
8
+ @-->
9
+
10
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
11
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
12
+ <tr>
13
+ <td align="center" valign="top">
14
+ <!-- [ header starts here] -->
15
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
16
+ <tr>
17
+ <td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
18
+ </tr>
19
+ </table>
20
+ <!-- [ middle starts here] -->
21
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
22
+ <tr>
23
+ <td valign="top">
24
+ <p>{{var message.getContent()}}</p>
25
+ <p>{{var attachment}}</p>
26
+ <p>{{var email_footer}}</p>
27
+ </td>
28
+ </tr>
29
+ </table>
30
+ </td>
31
+ </tr>
32
+ </table>
33
+ </div>
app/locale/en_US/template/email/supportticket/admin_submit_message_to_customer.html ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject New Response on Ticket # {{var ticket_code}}@-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "skin url=\"images/logo_email.gif\" _area='frontend'":"Email Logo Image"}
5
+ @-->
6
+ <!--@styles
7
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; text-align:lelf; }
8
+ @-->
9
+
10
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
11
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
12
+ <tr>
13
+ <td align="center" valign="top">
14
+ <!-- [ header starts here] -->
15
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
16
+ <tr>
17
+ <td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
18
+ </tr>
19
+ </table>
20
+ <!-- [ middle starts here] -->
21
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
22
+ <tr>
23
+ <td valign="top">
24
+ <p>
25
+ <strong>Hello {{var customer_name}}</strong>,<br/>
26
+ This email confirms that {{var admin_name}} replied to ticket {{var ticket_code}}.<br>
27
+ You can view the ticket online at anytime by going to: <br><br>
28
+ <a href="{{var ticket_url}}">{{var ticket_url}}</a>
29
+ </p>
30
+ <p>Below is the response content: <br><br>
31
+ ----------------------------------------------<br>
32
+ {{var attachment}}<br>
33
+ {{var message.getContent()}}<br>
34
+ ----------------------------------------------<br><br>
35
+ {{var email_footer}}
36
+ </p>
37
+ </td>
38
+ </tr>
39
+ </table>
40
+ </td>
41
+ </tr>
42
+ </table>
43
+ </div>
app/locale/en_US/template/email/supportticket/admin_submit_ticket_to_customer.html ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject New Ticket #{{htmlescape var=$ticket.getTicketCode()}}# {{htmlescape var=$ticket.getTicketTitle()}}@-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "skin url=\"images/logo_email.gif\" _area='frontend'":"Email Logo Image"}
5
+ @-->
6
+ <!--@styles
7
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
8
+ @-->
9
+
10
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
11
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
12
+ <tr>
13
+ <td align="center" valign="top">
14
+ <!-- [ header starts here] -->
15
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
16
+ <tr>
17
+ <td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
18
+ </tr>
19
+ </table>
20
+ <!-- [ middle starts here] -->
21
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
22
+ <tr>
23
+ <td valign="top">
24
+ <p>
25
+ <strong>Hello {{var customer_name}}</strong>,<br/>
26
+ This email confirms that {{var admin_name}} created a ticket for you with ID:{{var ticket.getTicketCode()}}.<br>
27
+ You can view the ticket online at anytime by going to: <br><br>
28
+ <a href="{{var ticket_url}}">{{var ticket_url}}</a>
29
+ </p>
30
+ <p>Below is the ticket content: <br><br>
31
+ ----------------------------------------------<br>
32
+ <b>Suject:</b> {{var ticket.getTicketTitle()}}<br>
33
+ <b>Customer Name:</b> {{var ticket.getCustomerName()}}<br>
34
+ <b>Customer Email:</b> {{var ticket.getCustomerEmail()}}<br>
35
+ <b>Attachment: </b> {{var attachment_link}}<br>
36
+ <b>Content:</b><br>
37
+ {{var ticket.getTicketContent()}}<br>
38
+ ----------------------------------------------<br><br>
39
+ {{var email_footer}}
40
+ </p>
41
+ </td>
42
+ </tr>
43
+ </table>
44
+ </td>
45
+ </tr>
46
+ </table>
47
+ </div>
app/locale/en_US/template/email/supportticket/customer_confirm_add_email_address.html ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Confirm Email Address @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "skin url=\"images/logo_email.gif\" _area='frontend'":"Email Logo Image"}
5
+ @-->
6
+ <!--@styles
7
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
8
+ @-->
9
+
10
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
11
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
12
+ <tr>
13
+ <td align="center" valign="top">
14
+ <!-- [ header starts here] -->
15
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
16
+ <tr>
17
+ <td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
18
+ </tr>
19
+ </table>
20
+ <!-- [ middle starts here] -->
21
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
22
+ <tr>
23
+ <td valign="top">
24
+ <p>
25
+ <strong>Hello {{var customer_name}}</strong>,<br/>
26
+ This email confirms that you added an email address on our ticket system.<br>
27
+ Please click on the link below to active that email: <br><br>
28
+ <a href="{{var active_link}}">{{var active_link}}</a>
29
+ </p>
30
+
31
+ {{var email_footer}}
32
+ </p>
33
+ </td>
34
+ </tr>
35
+ </table>
36
+ </td>
37
+ </tr>
38
+ </table>
39
+ </div>
app/locale/en_US/template/email/supportticket/customer_submit_message.html ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject New Response on Ticket # {{var ticket_code}}@-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "skin url=\"images/logo_email.gif\" _area='frontend'":"Email Logo Image"}
5
+ @-->
6
+ <!--@styles
7
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; text-align:lelf; }
8
+ @-->
9
+
10
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
11
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
12
+ <tr>
13
+ <td align="center" valign="top">
14
+ <!-- [ header starts here] -->
15
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
16
+ <tr>
17
+ <td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
18
+ </tr>
19
+ </table>
20
+ <!-- [ middle starts here] -->
21
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
22
+ <tr>
23
+ <td valign="top">
24
+ <p>
25
+ <strong>Hello {{var customer_name}}</strong>,<br/>
26
+ Thank you for contacting {{var store.getFrontendName()}}. This email confirms that your reply to ticket {{var ticket_code}} has been received. We will get back to you as soon as possible.<br>
27
+ You can view the ticket online at anytime by going to: <br><br>
28
+ <a href="{{var ticket_url}}">{{var ticket_url}}</a>
29
+ </p>
30
+ <p>Below is the response content: <br><br>
31
+ ----------------------------------------------<br>
32
+ {{var attachment}}<br>
33
+ {{var message.getContent()}}<br>
34
+ ----------------------------------------------<br><br>
35
+ {{var email_footer}}
36
+ </p>
37
+ </td>
38
+ </tr>
39
+ </table>
40
+ </td>
41
+ </tr>
42
+ </table>
43
+ </div>
app/locale/en_US/template/email/supportticket/customer_submit_ticket.html ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject New Ticket # {{htmlescape var=$ticket.getTicketTitle()}}@-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "skin url=\"images/logo_email.gif\" _area='frontend'":"Email Logo Image"}
5
+ @-->
6
+ <!--@styles
7
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
8
+ @-->
9
+
10
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
11
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
12
+ <tr>
13
+ <td align="center" valign="top">
14
+ <!-- [ header starts here] -->
15
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
16
+ <tr>
17
+ <td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
18
+ </tr>
19
+ </table>
20
+ <!-- [ middle starts here] -->
21
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
22
+ <tr>
23
+ <td valign="top">
24
+ <p>
25
+ <strong>Hello {{htmlescape var=$ticket.getCustomerName()}}</strong>,<br/>
26
+ Thank you for contacting {{var store.getFrontendName()}}. This email confirms that we have received your email and that a ticket has been created for you. Someone from our team will be in touch with you as quickly as possible.<br><br>
27
+ Your ticket ID is {{htmlescape var=$ticket.getTicketCode()}}. You can view your ticket(s) online at anytime by going to: <br><br>
28
+ <a href="{{var ticket_url}}">{{var ticket_url}}</a>
29
+ </p>
30
+ <p>Please note that is only necessary to submit one ticket for each issue. Submitting multiple tickets for the same issue actually increases our response times. If you have any additional information to add to this ticket, feel free to reply to this email at any time and include it.</p>
31
+
32
+ <p>
33
+ {{var email_footer}}
34
+ </p>
35
+ </td>
36
+ </tr>
37
+ </table>
38
+ </td>
39
+ </tr>
40
+ </table>
41
+ </div>
app/locale/en_US/template/email/supportticket/department_new_message.html ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject New Response on Ticket # {{var ticket_code}}@-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "skin url=\"images/logo_email.gif\" _area='frontend'":"Email Logo Image"}
5
+ @-->
6
+ <!--@styles
7
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
8
+ @-->
9
+
10
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
11
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
12
+ <tr>
13
+ <td align="center" valign="top">
14
+ <!-- [ header starts here] -->
15
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
16
+ <tr>
17
+ <td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
18
+ </tr>
19
+ </table>
20
+ <!-- [ middle starts here] -->
21
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
22
+ <tr>
23
+ <td valign="top">
24
+ <p>
25
+ <strong>Hello {{var moderator_name}}</strong>,<br/>
26
+ This email informs that someone replied to ticket {{var ticket_code}}.<br>
27
+ You can view the ticket online at anytime by going to: <br><br>
28
+ <a href='{{var ticket_url}}'>Admin Section</a>
29
+ </p>
30
+ <p>Below is the response content: <br><br>
31
+ ----------------------------------------------<br>
32
+ {{var attachment}}<br>
33
+ {{var message.getContent()}}<br>
34
+ ----------------------------------------------<br><br>
35
+ {{var email_footer}}
36
+ </p>
37
+ </td>
38
+ </tr>
39
+ </table>
40
+ </td>
41
+ </tr>
42
+ </table>
43
+ </div>
app/locale/en_US/template/email/supportticket/department_new_ticket.html ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject New Ticket #{{htmlescape var=$ticket.getTicketCode()}}# {{htmlescape var=$ticket.getTicketTitle()}}@-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "skin url=\"images/logo_email.gif\" _area='frontend'":"Email Logo Image"}
5
+ @-->
6
+ <!--@styles
7
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
8
+ @-->
9
+
10
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
11
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
12
+ <tr>
13
+ <td align="center" valign="top">
14
+ <!-- [ header starts here] -->
15
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
16
+ <tr>
17
+ <td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
18
+ </tr>
19
+ </table>
20
+ <!-- [ middle starts here] -->
21
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
22
+ <tr>
23
+ <td valign="top">
24
+ <p>
25
+ <strong>Hello {{htmlescape var=$department_name}}</strong>,<br/>
26
+ The new ticket with ID {{htmlescape var=$ticket.getTicketCode()}} is submited<br>
27
+ You can view the ticket online at anytime by going to: <br><br>
28
+ <a href='{{var ticket_admin_url}}'>Admin Section</a>
29
+ </p>
30
+ <p>Below is the ticket content: <br><br>
31
+ ----------------------------------------------<br>
32
+ <b>Suject:</b> {{var ticket.getTicketTitle()}}<br>
33
+ <b>Customer Name:</b> {{var ticket.getCustomerName()}}<br>
34
+ <b>Customer Email:</b> {{var ticket.getCustomerEmail()}}<br>
35
+ <b>Attachment: </b> {{var attachment_link}}<br>
36
+ <b>Content:</b><br>
37
+ {{var ticket.getTicketContent()}}<br>
38
+ ----------------------------------------------<br><br>
39
+ {{var email_footer}}
40
+ </p>
41
+ </td>
42
+ </tr>
43
+ </table>
44
+ </td>
45
+ </tr>
46
+ </table>
47
+ </div>
app/locale/en_US/template/email/supportticket/moderator_close_ticket.html ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Ticket # {{var ticket_code}} {{var type}}@-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "skin url=\"images/logo_email.gif\" _area='frontend'":"Email Logo Image"}
5
+ @-->
6
+ <!--@styles
7
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
8
+ @-->
9
+
10
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
11
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
12
+ <tr>
13
+ <td align="center" valign="top">
14
+ <!-- [ header starts here] -->
15
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
16
+ <tr>
17
+ <td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
18
+ </tr>
19
+ </table>
20
+ <!-- [ middle starts here] -->
21
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
22
+ <tr>
23
+ <td valign="top">
24
+ <p>
25
+ <strong>Hello {{var admin_name}}</strong>,<br/>
26
+ This email informs that someone {{var type}} ticket with ID:{{var ticket.getTicketCode()}}.<br>
27
+ You can view the ticket online at anytime by going to: <br><br>
28
+ <a href='{{var ticket_admin_url}}'>Admin Section</a>
29
+ </p>
30
+
31
+ {{var email_footer}}
32
+ </p>
33
+ </td>
34
+ </tr>
35
+ </table>
36
+ </td>
37
+ </tr>
38
+ </table>
39
+ </div>
app/locale/en_US/template/email/supportticket/moderator_public_ticket.html ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Ticket # {{var ticket_code}} {{var type}}@-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "skin url=\"images/logo_email.gif\" _area='frontend'":"Email Logo Image"}
5
+ @-->
6
+ <!--@styles
7
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
8
+ @-->
9
+
10
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
11
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
12
+ <tr>
13
+ <td align="center" valign="top">
14
+ <!-- [ header starts here] -->
15
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
16
+ <tr>
17
+ <td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
18
+ </tr>
19
+ </table>
20
+ <!-- [ middle starts here] -->
21
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
22
+ <tr>
23
+ <td valign="top">
24
+ <p>
25
+ <strong>Hello {{var admin_name}}</strong>,<br/>
26
+ This email informs that someone made {{var type}} ticket with ID:{{var ticket.getTicketCode()}}.<br>
27
+ You can view the ticket online at anytime by going to: <br><br>
28
+ <a href='{{var ticket_admin_url}}'>Admin Section</a>
29
+ </p>
30
+
31
+ {{var email_footer}}
32
+ </p>
33
+ </td>
34
+ </tr>
35
+ </table>
36
+ </td>
37
+ </tr>
38
+ </table>
39
+ </div>
js/magestore/supportticket.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var Supportticket = Class.create();
2
+ Supportticket.prototype = {
3
+ initialize: function(ticketformUrl){
4
+ this.ticketformUrl = ticketformUrl;
5
+ },
6
+
7
+ ticketform: function()
8
+ {
9
+ var department_id;
10
+ var url;
11
+
12
+ department_id = $('department_id').value;
13
+ url = this.ticketformUrl+"department_id/" + department_id;
14
+ new Ajax.Updater("ticketform", url, {method: 'post', onFailure: ""});
15
+ }
16
+
17
+ }
js/tinybox/tinybox.js ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var TINY={};
2
+
3
+ function T$(i){return document.getElementById(i)}
4
+
5
+ TINY.box=function(){
6
+ var p,m,b,fn,ic,iu,iw,ih,ia,f=0;
7
+ return{
8
+ show:function(c,u,w,h,a,t){
9
+ if(!f){
10
+ p=document.createElement('div'); p.id='tinybox';
11
+ m=document.createElement('div'); m.id='tinymask';
12
+ b=document.createElement('div'); b.id='tinycontent';
13
+ document.body.appendChild(m); document.body.appendChild(p); p.appendChild(b);
14
+ m.onclick=TINY.box.hide; window.onresize=TINY.box.resize; f=1
15
+ }
16
+ if(!a&&!u){
17
+ p.style.width=w?w+'px':'auto'; p.style.height=h?h+'px':'auto';
18
+ p.style.backgroundImage='none'; b.innerHTML=c
19
+ }else{
20
+ b.style.display='none'; p.style.width=p.style.height='100px'
21
+ }
22
+ this.mask();
23
+ ic=c; iu=u; iw=w; ih=h; ia=a; this.alpha(m,1,80,3);
24
+ if(t){setTimeout(function(){TINY.box.hide()},1000*t)}
25
+ },
26
+ fill:function(c,u,w,h,a){
27
+ if(u){
28
+ p.style.backgroundImage='';
29
+ var x=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
30
+ x.onreadystatechange=function(){
31
+ if(x.readyState==4&&x.status==200){TINY.box.psh(x.responseText,w,h,a)}
32
+ };
33
+ x.open('GET',c,1); x.send(null)
34
+ }else{
35
+ this.psh(c,w,h,a)
36
+ }
37
+ },
38
+ psh:function(c,w,h,a){
39
+ if(a){
40
+ if(!w||!h){
41
+ var x=p.style.width, y=p.style.height; b.innerHTML=c;
42
+ p.style.width=w?w+'px':''; p.style.height=h?h+'px':'';
43
+ b.style.display='';
44
+ w=parseInt(b.offsetWidth); h=parseInt(b.offsetHeight);
45
+ b.style.display='none'; p.style.width=x; p.style.height=y;
46
+ }else{
47
+ b.innerHTML=c
48
+ }
49
+ this.size(p,w,h)
50
+ }else{
51
+ p.style.backgroundImage='none'
52
+ }
53
+ },
54
+ hide:function(){
55
+ TINY.box.alpha(p,-1,0,3)
56
+ },
57
+ resize:function(){
58
+ TINY.box.pos(); TINY.box.mask()
59
+ },
60
+ mask:function(){
61
+ m.style.height=TINY.page.total(1)+'px';
62
+ m.style.width=''; m.style.width=TINY.page.total(0)+'px'
63
+ },
64
+ pos:function(){
65
+ var t=(TINY.page.height()/2)-(p.offsetHeight/2); t=t<10?10:t;
66
+ p.style.top=(t+TINY.page.top())+'px';
67
+ p.style.left=(TINY.page.width()/2)-(p.offsetWidth/2)+'px'
68
+ },
69
+ alpha:function(e,d,a){
70
+ clearInterval(e.ai);
71
+ if(d==1){
72
+ e.style.opacity=0; e.style.filter='alpha(opacity=0)';
73
+ e.style.display='block'; this.pos()
74
+ }
75
+ e.ai=setInterval(function(){TINY.box.ta(e,a,d)},20)
76
+ },
77
+ ta:function(e,a,d){
78
+ var o=Math.round(e.style.opacity*100);
79
+ if(o==a){
80
+ clearInterval(e.ai);
81
+ if(d==-1){
82
+ e.style.display='none';
83
+ e==p?TINY.box.alpha(m,-1,0,2):b.innerHTML=p.style.backgroundImage=''
84
+ }else{
85
+ e==m?this.alpha(p,1,100):TINY.box.fill(ic,iu,iw,ih,ia)
86
+ }
87
+ }else{
88
+ var n=Math.ceil((o+((a-o)*.5))); n=n==1?0:n;
89
+ e.style.opacity=n/100; e.style.filter='alpha(opacity='+n+')'
90
+ }
91
+ },
92
+ size:function(e,w,h){
93
+ e=typeof e=='object'?e:T$(e); clearInterval(e.si);
94
+ var ow=e.offsetWidth, oh=e.offsetHeight,
95
+ wo=ow-parseInt(e.style.width), ho=oh-parseInt(e.style.height);
96
+ var wd=ow-wo>w?0:1, hd=(oh-ho>h)?0:1;
97
+ e.si=setInterval(function(){TINY.box.ts(e,w,wo,wd,h,ho,hd)},20)
98
+ },
99
+ ts:function(e,w,wo,wd,h,ho,hd){
100
+ var ow=e.offsetWidth-wo, oh=e.offsetHeight-ho;
101
+ if(ow==w&&oh==h){
102
+ clearInterval(e.si); p.style.backgroundImage='none'; b.style.display='block'
103
+ }else{
104
+ if(ow!=w){var n=ow+((w-ow)*.5); e.style.width=wd?Math.ceil(n)+'px':Math.floor(n)+'px'}
105
+ if(oh!=h){var n=oh+((h-oh)*.5); e.style.height=hd?Math.ceil(n)+'px':Math.floor(n)+'px'}
106
+ this.pos()
107
+ }
108
+ }
109
+ }
110
+ }();
111
+
112
+ TINY.page=function(){
113
+ return{
114
+ top:function(){return document.documentElement.scrollTop||document.body.scrollTop},
115
+ width:function(){return self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth},
116
+ height:function(){return self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight},
117
+ total:function(d){
118
+ var b=document.body, e=document.documentElement;
119
+ return d?Math.max(Math.max(b.scrollHeight,e.scrollHeight),Math.max(b.clientHeight,e.clientHeight)):
120
+ Math.max(Math.max(b.scrollWidth,e.scrollWidth),Math.max(b.clientWidth,e.clientWidth))
121
+ }
122
+ }
123
+ }();
124
+
125
+
126
+
media/supportticket/Copy of staff_avatar.gif ADDED
Binary file
media/supportticket/attachment.jpg ADDED
Binary file
media/supportticket/customer_avatar.gif ADDED
Binary file
media/supportticket/magglass.gif ADDED
Binary file
media/supportticket/staff_avatar.gif ADDED
Binary file
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Magestore_Supportticket</name>
4
+ <version>0.2.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Supportticket</summary>
10
+ <description>Supportticket</description>
11
+ <notes>Supportticket</notes>
12
+ <authors><author><name>Magestore</name><user>Magestore</user><email>magento.subscription@magestore.com</email></author></authors>
13
+ <date>2011-12-05</date>
14
+ <time>05:02:59</time>
15
+ <contents><target name="magelocal"><dir name="Magestore"><dir name="Supportticket"><dir name="Block"><file name="Activeemail.php" hash="39e137b0d05ba0ffdc30db3f211b10ad"/><dir name="Adminhtml"><dir name="Department"><dir name="Edit"><file name="Form.php" hash="9e734fc41b94f5c4c9be7d9dadba9554"/><dir name="Tab"><file name="Form.php" hash="63a9fe1ef6b5d23c478df46c7f7e65a7"/></dir><file name="Tabs.php" hash="30b3f2f532d8e72b4734759c1ac40438"/></dir><file name="Edit.php" hash="68bc4d211fa748109f7283c07d6aaff8"/><file name="Grid.php" hash="179ea40d43760a5dab59291db982cd65"/></dir><file name="Department.php" hash="f3697951fe8b129edf8ff269efc5ece5"/><dir name="Departmentgroup"><dir name="Edit"><file name="Form.php" hash="c4e290fd5f051b8b50b1012f390275cb"/><dir name="Tab"><file name="Form.php" hash="9115017c7ce829589538b1dc79b6e0c8"/></dir><file name="Tabs.php" hash="01711d9c5a4af210b22afc1e55c8d112"/></dir><file name="Edit.php" hash="bb076b0f4faefac28af67986b16722e0"/><file name="Grid.php" hash="8ca07320fa8e5d50e7b70257566fbde9"/></dir><file name="Departmentgroup.php" hash="60b7aa8dd62bdc3fea32ee0ff6e395be"/><dir name="Statuslog"><file name="Grid.php" hash="65eda4cdfe1892571c4d9ec154511695"/></dir><file name="Statuslog.php" hash="89ef126a070863609acf60299c66df8e"/><dir name="Supportticket"><dir name="Edit"><file name="Form.php" hash="084db3f1b14f8487c4e33a5ec844fb07"/><dir name="Tab"><file name="Form.php" hash="b1b977126e1adeade8fca32f69784191"/></dir><file name="Tabs.php" hash="e83753d5d53ee77019f3ab6ce7fb0d0c"/></dir><file name="Edit.php" hash="7d8f44140de648778fa3ba3c4e6eed59"/><file name="Grid.php" hash="fe6cbd95b104246c4f95c03923baa9c5"/></dir><file name="Supportticket.php" hash="62663e47da6edc01feb2a82f09da0cf1"/><dir name="Template"><dir name="Edit"><file name="Form.php" hash="7116d7fdbb3f9cb5ee3e9e6ba878758b"/><dir name="Tab"><file name="Form.php" hash="9d659d53c077f2a3c35bf01aeb1ec45a"/></dir><file name="Tabs.php" hash="594a91b4c9769b1ba1a0adc3aeba3bae"/></dir><file name="Edit.php" hash="fd4c4af5b2e92ad6d750e974ff09b45f"/><file name="Grid.php" hash="0527b1d91306179bdd65334c441517ad"/></dir><file name="Template.php" hash="a81717ad10a45790438c193f6968cd22"/><dir name="Ticket"><dir name="Assignuser"><file name="Form.php" hash="2fbe65ee0e5aac6eaa2f861c9d082488"/><dir name="Tab"><file name="Form.php" hash="9ece8ef9bb3edb234f0f495263292e84"/><file name="History.php" hash="94a89b9da528ac6866731f98face4c10"/></dir><file name="Tabs.php" hash="9168f634646db311a69c60b67a9ecb86"/></dir><file name="Assignuser.php" hash="87b6428faa398567b1cf9091c10375dd"/><dir name="Edit"><file name="Form.php" hash="fc24164260bf3aec0c637a0465866a2f"/><dir name="Tab"><file name="Form.php" hash="56ce22b7e6490e4d51910f2be6d7ac68"/></dir><file name="Tabs.php" hash="a625cbce70ed783da9144ded1ab20337"/></dir><file name="Edit.php" hash="41c719785b5982337eb04095e74d909b"/><file name="Grid.php" hash="525abf595f16c226e55cff4095a5fd7a"/><dir name="Message"><file name="Form.php" hash="3709e3fe51779d30481c3de5f1f0b5fb"/><dir name="Tab"><file name="Form.php" hash="3ae24a7d466801207d9d63becb78e4d9"/><file name="History.php" hash="94a89b9da528ac6866731f98face4c10"/><file name="Privatehistory.php" hash="92349e3933b0997ebbd9943d7a498ae5"/><file name="View.php" hash="96bd86321c6bba8b38ac8049b0f08da1"/></dir><file name="Tabs.php" hash="a59eb56d4194405dcd7c0beb8b708174"/></dir><file name="Message.php" hash="155855fe36fbd951502a4fca31ef4164"/><dir name="Renderer"><file name="Isprivate.php" hash="b67e2e318a2508f3b474dcb652eca66f"/><file name="Priority.php" hash="3661a2005024800a1fcfa86f99579f1f"/><file name="Status.php" hash="9a085fca26881c921027ec2b5399c0be"/><file name="Tooltip.php" hash="80bbaa1c50ebc34ce859410e91d26fdf"/></dir></dir><file name="Ticket.php" hash="53064e488c25368dd5943538b4f2dd55"/></dir><file name="List.php" hash="c6a244190e4c8c6a9fbe1a3b324527fc"/><file name="Readmail.php" hash="a33bfd2b56e31c929d1f9c5a6492e137"/><file name="Setupemail.php" hash="271ceb3630f2e40250a78f7b63a7608e"/><file name="Sliderbar.php" hash="3a8eea597f2374868c34b33497e8c29d"/><file name="Submit.php" hash="14142fe8d72b6161a8b9bcde7d76fa72"/><file name="Ticketform.php" hash="e782a6416e327881bf5816266d724ed1"/><file name="View.php" hash="d01dc7fc63ed77003418f88f7279c9eb"/></dir><dir name="Helper"><file name="Data.php" hash="15953268c70e8014bdccc982293cda74"/></dir><dir name="Model"><file name="Department.php" hash="88e1c584157ffd968226286328ad564b"/><file name="Departmententity.php" hash="304b0eee0d782abd85a6f141e88cc1f9"/><file name="Departmentgroup.php" hash="87518e280f4bdd5f90044398534b5836"/><file name="Departmentgroupentity.php" hash="a45e7d37faa9bbb9fdbf10f5e231b7ed"/><file name="Email.php" hash="42b7bf9187db299b308b8a7a2985f8e2"/><file name="Mailbox.php" hash="9482ac6e88db631d2db4ef64a4b26d6e"/><file name="Message.php" hash="3d6a0487d0e0773fbefee1aabb49de03"/><dir name="Mysql4"><dir name="Department"><file name="Collection.php" hash="d1e3924f883aec9eb20aaa69987970fc"/></dir><file name="Department.php" hash="b0c053f956eab307f7a37672b60ea60d"/><dir name="Departmententity"><file name="Collection.php" hash="d7faad5e0e808301b6d99ac698e2f254"/></dir><file name="Departmententity.php" hash="7e1e1688d4b03dfb7969c390544609c5"/><dir name="Departmentgroup"><file name="Collection.php" hash="0f81e411eb17dff466a76536f1d85f7e"/></dir><file name="Departmentgroup.php" hash="e90fecc7d89fdda0f77027ae30c7790b"/><dir name="Departmentgroupentity"><file name="Collection.php" hash="1cbcd7c4a4b8f3bde5283f3b9af854fa"/></dir><file name="Departmentgroupentity.php" hash="5d9267fe34e24e3dad4196d704b98562"/><dir name="Email"><file name="Collection.php" hash="b9583ef7cdbd3f3d06a688cf2dce4654"/></dir><file name="Email.php" hash="990db09887077fdd2770e1796bef6856"/><dir name="Message"><file name="Collection.php" hash="5896ff900e58963fc72f4b205473eac9"/></dir><file name="Message.php" hash="1033dd06c8d999fb7fcd3831717c6f9e"/><dir name="Statuslog"><file name="Collection.php" hash="e9cdb9b713c4e847bcc38e4b60edc281"/></dir><file name="Statuslog.php" hash="7af2aea6cda94d22a1f460aa22f05c06"/><dir name="Supportticket"><file name="Collection.php" hash="079616bb157ff3dfe5cfbe1cbebf8520"/></dir><file name="Supportticket.php" hash="8863ba77ea986e9b4bcfdf5993f07894"/><dir name="Template"><file name="Collection.php" hash="09da1e35653c3a5b2eca4b18b6971259"/></dir><file name="Template.php" hash="9085f2b11269ca7ad9c9f686e2ae671c"/><dir name="Templateentity"><file name="Collection.php" hash="52162109318993c1219ea0b4889e08d5"/></dir><file name="Templateentity.php" hash="fab802ad7a6a9ea5b97a9ca567fe67d8"/><dir name="Ticket"><file name="Collection.php" hash="affd5777f5aad5580373ce49537aa92a"/></dir><file name="Ticket.php" hash="cbdb596153e177f0c02fa1588cfa37b1"/></dir><file name="Observer.php" hash="63d43a373e9f3c8c15a97213558c4a1d"/><file name="Session.php" hash="7b80a02197d0117cda769f46b7f3dcf7"/><file name="Status.php" hash="8bbb6df5c4e925ebed95507315ea9089"/><file name="Statuslog.php" hash="eab09d0a58b8a8845546e38de948efaa"/><file name="Supportticket.php" hash="8a1ea26b60daada058963f3c64862b28"/><file name="Template.php" hash="88cea867672b36933295c16eaa377b2b"/><file name="Templateentity.php" hash="0d07929d43cd2e17b32271227d964693"/><file name="Ticket.php" hash="92c06729b3ca9ecc3800dff27191dd5a"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="DepartmentController.php" hash="d0ab0a86f0decaeb06405f5d1062fc8a"/><file name="DepartmentgroupController.php" hash="2351f4a4f880b595df0a4839cafec9fe"/><file name="StatuslogController.php" hash="80a4a370511bb9fea07cd53a1179d55c"/><file name="SupportticketController.php" hash="f93df87fc7a6d1f55f3e93f631bab600"/><file name="TemplateController.php" hash="8d35b71c88dd984c38a5c11afff4b784"/><file name="TicketController.php" hash="b6d1d50882315b4a5c4a196d00fd98f0"/></dir><file name="EmailController.php" hash="c44dcc58a850bc5e294c44a789b04a1b"/><file name="ReadmailController.php" hash="fdfe5c9fbb617ca2272483234bc4f3c9"/><file name="TicketController.php" hash="4782763fa9f3c65cf53353ac909e6864"/></dir><dir name="etc"><file name="adminhtml.xml" hash="e10fb9845ff6ed1878486ddabff706e9"/><file name="config.xml" hash="08377bf8c47cd894c37ac3c247617fe0"/><file name="system.xml" hash="c3d7474ea06afdbb00a1ca3f67c301d6"/></dir><dir name="sql"><dir name="supportticket_setup"><file name="mysql4-install-0.2.0.php" hash="44d2c2c19f79b948d7ba2c4a688608e5"/><file name="mysql4-install-0.2.1.php" hash="44d2c2c19f79b948d7ba2c4a688608e5"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="14275e4860c6388e39b361a83b3dcd11"/><file name="mysql4-upgrade-0.2.0-0.2.1.php" hash="8c8ea981a81cf84c52b864438a10db1a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magestore_Supportticket.xml" hash="f7f6bc073642401a85e182dc0786d087"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="supportticket.xml" hash="bcc053fc688fa6b71dd4d05d6486b769"/></dir><dir name="template"><dir name="supportticket"><file name="message_history.phtml" hash="d65e67628c22661dec6baf667e5ed1ed"/><file name="multiupload.phtml" hash="d1ea429679086f1e652eaf34410a1b84"/><file name="private_message_history.phtml" hash="93a058c3e15195cf67f3835ca755a2a0"/><file name="view_ticket.phtml" hash="7427c7e9c315487d70482005342643d9"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="supportticket.xml" hash="33453a4026688f5e78910a0b9112160b"/></dir><dir name="template"><dir name="supportticket"><file name="activeemail.phtml" hash="a3b8fb4a0c653496cb99bdaf0fb94feb"/><file name="list.phtml" hash="e77796b0ced5c7567953271f282cdb03"/><file name="setupemail.phtml" hash="35ba55dad03f3ad2323d7411487c72ec"/><file name="sliderbar.phtml" hash="aee209d92305c032e7e2d0173848d1ca"/><file name="submit.phtml" hash="0b315cb560eb5bcdce09ca7c55aa056d"/><file name="ticketformcontent.phtml" hash="9918e432fa95e3adf763c6508ada0bf1"/><file name="view.phtml" hash="c07acd7ef6dd6b60cebe5e7fd8a51a26"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="supportticket"><file name="admin_assign_ticket.html" hash="b7ff84fdb0b6f05804bbadc00e79b7be"/><file name="admin_submit_email_message_to_customer.html" hash="9de1265cf9b73e0bf37c675bfc2bc74d"/><file name="admin_submit_message_to_customer.html" hash="5d7152abbcbc43830529a843d593791c"/><file name="admin_submit_ticket_to_customer.html" hash="5ffef0397720810f9c058215eb4d7644"/><file name="customer_confirm_add_email_address.html" hash="4ba5f7dee49013c0066272370e62db28"/><file name="customer_submit_message.html" hash="5f93072c876a188f0bd1d4c2c4230250"/><file name="customer_submit_ticket.html" hash="d0ed5dcf35f612df8faf4493e8594194"/><file name="department_new_message.html" hash="62305495a9e868336d03bb6b43bbcc18"/><file name="department_new_ticket.html" hash="d132abe4a5a57c062ffb47622b009b4d"/><file name="moderator_close_ticket.html" hash="7badac7887a6101d8ef8a25f57d36a27"/><file name="moderator_public_ticket.html" hash="4d012b285bcd717a1da452f6a897c534"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><file name="boxes.css" hash="968d2ae825fe0ad8efd42fa1013eee3b"/><dir name="css"><dir name="tinybox"><dir name="images"><file name="preload.gif" hash="bf3ec68db23e93ba2ec795ef558e96da"/><file name="rhino.jpg" hash="d00bad1ec05584e10a5601ec103aff72"/></dir><file name="style.css" hash="e3016ee232fbf3c6f780255002703237"/></dir><dir name="magestore"><file name="supportticket.css" hash="fe2ed739e18a3b586fa76073bd343ba6"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="magestore"><file name="supportticket.css" hash="fc4beb4893c3e618745855975410946b"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="tinybox"><file name="tinybox.js" hash="2ca7fcb7fefc5e8d85887f3c6dc6e315"/></dir><dir name="magestore"><file name="supportticket.js" hash="c3562da78e26b159fac4aab45af10ecd"/></dir></dir></target><target name="magemedia"><dir name="supportticket"><file name="Copy of staff_avatar.gif" hash="57f0bdb8bc5d5e8d7e0584776d252215"/><file name="attachment.jpg" hash="bb6963f2a2d44d6532ff02e3fe1894d8"/><file name="customer_avatar.gif" hash="07e827b6bd51685172245b11c3370d68"/><file name="magglass.gif" hash="b89ec5e969831b8f86fd8362dfb38116"/><file name="staff_avatar.gif" hash="cdd6b1f3e24bba188f9cc57a8492eba7"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/boxes.css ADDED
@@ -0,0 +1,1466 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magentocommerce.com for more information.
19
+ *
20
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ /***************** WIDGETS ******************
25
+ Loading Indicator
26
+ Tables
27
+ Grid ( ubiquitous, massaction and dynamic)
28
+ Accordion
29
+ Tabs ( vertical and horizontal )
30
+ Messages
31
+ Forms ( setter and elements)
32
+ Switcher
33
+ Space
34
+ Boxes
35
+ Scroller
36
+ */
37
+
38
+ /**************** STRUCTURE *****************
39
+ Layout
40
+ Header & Footer
41
+ Columns
42
+ Headings
43
+ */
44
+
45
+ /************** PAGE-SPECIFIC ***************
46
+ Login
47
+ Sales
48
+ Catalog
49
+ Customers
50
+ Newsletter
51
+ System
52
+ */
53
+
54
+ /********** ALIGNMENT AND CLEARS ***********/
55
+
56
+
57
+ /******************************************************************/
58
+ /**************************** WIDGETS *****************************/
59
+ /******************************************************************/
60
+
61
+
62
+ /* LOADING INDICATOR
63
+ *******************************************************************/
64
+ #loading-process {
65
+ position:absolute;
66
+ top:45%;
67
+ left:50%;
68
+ margin-left:-60px;
69
+ border:2px solid #f1af73;
70
+ padding:15px 60px;
71
+ background:#fff4e9;
72
+ color:#d85909;
73
+ font-size:1.1em;
74
+ font-weight:bold;
75
+ text-align:center;
76
+ z-index:501;
77
+ }
78
+ #loading-mask {
79
+ position:absolute;
80
+ color:#d85909;
81
+ font-size:1.1em;
82
+ font-weight:bold;
83
+ text-align:center;
84
+ opacity:0.80;
85
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; /* IE8 */
86
+ z-index:500;
87
+ }
88
+ #loading-mask .loader {
89
+ position:fixed;
90
+ top:45%;
91
+ left:50%;
92
+ width:120px;
93
+ margin-left:-60px;
94
+ padding:15px 60px;
95
+ background:#fff4e9;
96
+ border:2px solid #f1af73;
97
+ color:#d85909;
98
+ font-weight:bold;
99
+ text-align:center;
100
+ z-index:1000;
101
+ }
102
+
103
+ #message-popup-window-mask { position:absolute; top:0; right:0; bottom:0; left:0; width:100%; height:100%; z-index:9999; background-color:#efefef; opacity:.5; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";/*IE8*/ }
104
+ .message-popup { position:absolute; z-index:99999; width:407px; top:-9999em; left:50%; margin:0 0 0 -203px; background:#f3bf8f; padding:0 4px 4px; }
105
+ .message-popup.show { top:280px; }
106
+ .message-popup .message-popup-head { padding:1px 0; }
107
+ .message-popup .message-popup-head h2 { padding:0 10px; margin:0; font:bold 12px/19px Arial, Helvetica, sans-serif; color:#644f3b; }
108
+ .message-popup .message-popup-head a { float:right; border:1px solid #ea7601; padding:0 12px 0 7px; background:url(images/bkg_btn-close.gif) 0 50% repeat-x !important; font:normal 12px/17px Arial, Helvetica, sans-serif; color:#fff; text-decoration:none !important; cursor:pointer; }
109
+ .message-popup .message-popup-head a span { float:left; background:url(images/bkg_btn-close2.gif) 0 50% no-repeat; padding-left:19px; }
110
+ .message-popup .message-popup-content { background:#fdf4eb; padding:21px 21px 10px; }
111
+ .message-popup .message-popup-content .message-icon { float:left; width:50px; padding:47px 0 0; background-position:50% 0; background-repeat:no-repeat; font-size:10px; line-height:12px; text-transform:uppercase; text-align:center; overflow:hidden; }
112
+ .message-popup .message-popup-content .message-critical { background-image:url(images/severity_critical.gif); color:#e41101; }
113
+ .message-popup .message-popup-content .message-major { /*background-image:url(images/severity_major.gif);*/ color:#f55600; }
114
+ .message-popup .message-popup-content .message-minor { /*background-image:url(images/severity_minor.gif);*/ color:#ff9e22; }
115
+ .message-popup .message-popup-content .message-notice { /*background-image:url(images/severity_notice.gif);*/ color:#659601; }
116
+ .message-popup .message-popup-content .message-text { float:right; width:295px; min-height:4.5em; overflow:hidden; color:#644f3b; }
117
+ .message-popup .message-popup-content .read-more { margin:7px 0 0; text-align:right; }
118
+ .message-popup .message-popup-content .read-more a { background:url(images/more_arrow.gif) 0 50% no-repeat; padding-left:14px; text-decoration:underline; }
119
+ .message-popup .message-popup-content .read-more a:hover { text-decoration:none; }
120
+
121
+ /* TABLES
122
+ *******************************************************************************/
123
+
124
+ /* Grid - General */
125
+ .grid { border-bottom:0; padding-bottom:.5em; }
126
+ .grid table { width:100%; border:1px solid #cbd3d4; border-bottom:none; }
127
+ .grid table.border { border:1px solid #cbd3d4; }
128
+ .grid tbody { background:#fff; } /* Zebra odd-row */
129
+ .grid tr.even, .grid tr.even tr { background:#f6f6f6; } /* Zebra even-row */
130
+ .grid tr.on-mouse { background:#fcf5dd; cursor:pointer; } /* Rows mouse-over */
131
+ .grid tr.invalid { background-color:#f5d6c7; }
132
+ .grid th, .grid td { padding:2px 4px 2px 4px; }
133
+ .grid th { white-space:nowrap; }
134
+ .grid td.editable input.input-text { width:50px !important; margin-left:4px !important; }
135
+ .grid td input.input-text { width:86%; }
136
+ .grid table td { border-width:0 1px 1px 0; border-color:#dadfe0; border-style:solid; }
137
+ .grid table.border td { background:#fff !important; }
138
+ .grid table td.last { border-right:0; }
139
+ .grid table td.product { text-align:right; }
140
+ .grid table td.empty-text { padding:15px; }
141
+ .grid table td .action-select { width:100%; }
142
+ .grid .separator { padding:0 4px; color:#b9b9b9; }
143
+
144
+ .grid tbody.odd tr { background:#fff !important; }
145
+ .grid tbody.even tr { background:#f6f6f6 !important; }
146
+ .grid tbody.odd tr td,
147
+ .grid tbody.even tr td { border-bottom:0; }
148
+ .grid tbody.odd tr.border td,
149
+ .grid tbody.even tr.border td { border-bottom:1px solid #dadfe0; }
150
+
151
+
152
+ /* Grid - Pager and Buttons row */
153
+ table.actions { width:100%; margin:.5em 0; }
154
+ table.actions td { vertical-align:top; }
155
+ .pager select { width:4em!important; margin:0 4px; }
156
+ .pager input.page { width:2em !important; }
157
+ .pager .arrow { margin:0 3px; vertical-align:middle; }
158
+
159
+
160
+ /* Grid - Headings */
161
+ .grid tr.headings { background:url(images/sort_row_bg.gif) 0 50% repeat-x; }
162
+ .grid tr.headings th { border-width:1px; border-color:#f9f9f9 #d1cfcf #f9f9f9 #f9f9f9; border-style:solid; padding-top:1px; padding-bottom:0; font-size:.9em; }
163
+ .grid tr.headings th.last { border-right:0; }
164
+ .grid tr.headings th.no-link { /* Grid th with no sorting functionality */ padding-top:2px; padding-bottom:1px; color:#67767e; }
165
+ .grid tr.headings th span.nobr { display:block; /* FF3 fix */ }
166
+ .grid tr.headings th a { display:block; padding:2px 4px 1px 0; color:#2d444f; text-decoration:none; }
167
+ .grid tr.headings th a:hover { color:#d85909; text-decoration:none; }
168
+ .grid tr.headings th a.sort-arrow-desc,
169
+ .grid tr.headings th a.sort-arrow-asc { background:url(images/sort_on_bg.gif) 0 0 no-repeat; border-bottom:1px solid #fff; border-right:1px solid #fff; padding-bottom:2px; }
170
+ .grid tr.headings th span.sort-title { display:block; padding:3px 12px 4px 0; line-height:1; }
171
+ .grid tr.headings th a.sort-arrow-desc span.sort-title,
172
+ .grid tr.headings th a.sort-arrow-asc span.sort-title { background-position:right 50%; background-repeat:no-repeat; padding:3px 12px 2px 8px; }
173
+ .grid tr.headings th a.sort-arrow-desc span.sort-title { background-image:url(images/grid_sort_desc.gif); }
174
+ .grid tr.headings th a.sort-arrow-asc span.sort-title { background-image:url(images/grid_sort_asc.gif); }
175
+
176
+
177
+ /* Grid - Mass Action */
178
+ .massaction { width:100%; height:26px; border:1px solid #d1cfcf; border-bottom:none; background:url(images/massaction_bg.gif) repeat-x 0 100% #ebebeb; font-size:.9em; }
179
+ .massaction td { width:50%; border-top:1px solid #fff; padding:1px 8px; vertical-align:middle; }
180
+ .massaction .entry-edit fieldset .select { width:auto; /*width:120px;*/ display:inline; }
181
+ .massaction .entry-edit fieldset select.validation-failed { border:1px dashed #eb340a !important; background:#faebe7 !important }
182
+ .massaction .entry-edit fieldset { margin:0; padding:0; background:none; border:none; }
183
+ .massaction .entry-edit fieldset .field-row { display:inline; }
184
+ .massaction .entry-edit .field-row label { float:none; width:auto; margin-left:13px; }
185
+ .massaction .entry-edit { margin:0 !important; padding:0; }
186
+ .massaction .entry-edit .validation-advice { display:none !important; }
187
+ .massaction a { text-decoration:none; }
188
+ .massaction .entry-edit fieldset span.form_row,
189
+ .massaction .entry-edit fieldset span.field-row { clear:none !important; display:inline; float:left !important; margin:0; padding:0 5px 0 0; }
190
+
191
+ .massaction .entry-edit .outer-span { float:left; }
192
+
193
+ /* Grid - Filter */
194
+ .grid tr.filter { background:url(images/filter_row_bg.gif) repeat-x #e3eff1; cursor:default; }
195
+ .grid tr.filter th { padding-top:5px; padding-bottom:5px; border:1px solid #bdbdbd; border-width:0 1px 1px 0; white-space:normal; }
196
+ .grid tr.filter th.last { border-right:0; }
197
+ .grid tr.filter input.input-text { width:85%; }
198
+ .grid tr.filter select { width:100%; }
199
+ .grid tr.filter .range .range-line { margin-bottom:3px; width:100px; }
200
+ .grid tr.filter .range div.date { min-width:121px; }
201
+ .grid tr.filter .range input { float:right; width:50px !important; margin-top:0; }
202
+ .grid tr.filter .range select { float:right; width:56px !important; margin-top:0; }
203
+ .grid tr.filter .range .label { display:block; width:36px; float:left; padding-left:2px; }
204
+ .grid tr.filter .date img { width:15px; height:15px; cursor:pointer; vertical-align:middle; }
205
+ .grid .head-massaction select { width:50px !important; }
206
+
207
+ /* Grid Footer */
208
+ .grid table tfoot tr { background:#D7E5EF; }
209
+ .grid table tfoot tr td { border-top:1px solid #9babb9; background:#e5ecf2; line-height:1.7em; }
210
+ .grid table.border tfoot tr td { background:#D7E5EF !important; }
211
+
212
+
213
+ /* Dynamic Grid */ /* Used in pages like Catalog -> Attributes */
214
+ .dynamic-grid th { padding:2px;width:100px; }
215
+ .dynamic-grid td { padding:2px; }
216
+ .dynamic-grid td input { width:94px; }
217
+ tr.dynamic-grid td,
218
+ tr.dynamic-grid th { padding:2px 10px 2px 0; width:auto; }
219
+ tr.dynamic-grid input.input-text { width:154px; }
220
+ .available { color:#080; font-weight:bold; }
221
+ .not-available { color:#800; }
222
+
223
+
224
+ /* ACCORDION
225
+ *******************************************************************************/
226
+ dl.accordion .grid { margin-bottom:0; }
227
+ dl.accordion dt,
228
+ .entry-edit .entry-edit-head { background:#6f8992; padding:2px 10px; }
229
+ dl.accordion dt, div.collapseable { margin-top:1px; }
230
+ dl.accordion dt a, div.collapseable a { background:url(images/entry_edit_head_arrow_down.gif) 100% 50% no-repeat; color:#fff; display:block; font-weight:bold; text-decoration:none; }
231
+ div.disabled { background:#c6cbc9 !important; }
232
+ div.disabled a { background-image:url(images/entry_edit_head_arrow_down2.gif) !important; color:#f6f6f6 !important; }
233
+
234
+ .entry-edit fieldset.collapseable { margin-bottom:10px; }
235
+
236
+ dl.accordion dt a:hover, div.collapseable a:hover { color:#fff; text-decoration:none; }
237
+ dl.accordion dt.open a, div.collapseable a.open { background:url(images/entry_edit_head_arrow_up.gif) 100% 50% no-repeat; }
238
+ dl.accordion dd { display:none; }
239
+ dl.accordion dd.open { display:block; }
240
+ img.accordion-btn { float:right; margin-top:1px; margin-right:5px; }
241
+
242
+ /* TABS
243
+ *******************************************************************************/
244
+
245
+ /* Vertical Tabs */
246
+ ul.tabs { border-top:1px solid #bebebe; background-color:#e7efef; }
247
+ ul.tabs a, ul.tabs span { display:block; }
248
+ ul.tabs a, ul.tabs a:hover { text-decoration:none; }
249
+ /* ul.tabs a.notloaded { color:#999; } */
250
+ ul.tabs a, ul.tabs a:hover { color:#000; }
251
+ ul.tabs, ul.tabs a { background:url(images/tabs_link_bg.gif) repeat-y 100% #E7EFEF; }
252
+ ul.tabs a:hover { background-color:#D8E6E6; background-image:url(images/tabs_link_over_bg.gif); }
253
+ ul.tabs a.active { padding:0; border-bottom:1px solid #bebebe; background:none; }
254
+ ul.tabs a:hover.active { padding:0; }
255
+ ul.tabs span { background:url(images/tabs_span_bg.gif) repeat-x 0 100%; padding:.3em 0.5em .28em 1.5em; cursor:pointer; }
256
+ ul.tabs span em { float:right; }
257
+ ul.tabs a.active span,
258
+ ul.tabs a:hover.active span { background:#fff; font-weight:bold; }
259
+ ul.tabs a.subitem { padding-left:2.2em; }
260
+ ul.tabs span.changed,
261
+ ul.tabs span.error { float:right; background:0; padding:0; }
262
+ ul.tabs a.changed span.changed { background:url(images/fam_bullet_disk.gif) 0 0 no-repeat !important; width:16px; height:16px; }
263
+ ul.tabs a.error span.error { background:url(images/fam_bullet_error.gif) 0 0 no-repeat !important; width:16px; height:16px; }
264
+ ul.tabs a.changed { font-style:italic; }
265
+
266
+ /* Horizontal Tabs */
267
+ ul.tabs-horiz { margin:0 0 18px 0; background:url(images/horiz_tabs_ul_bg.gif) repeat-x 0 100% #f8f8f8; padding:8px 0 0 5px; }
268
+ ul.tabs-horiz li { float:left; margin:0 4px; }
269
+ ul.tabs-horiz li a { display:block; background:#e2e2e2; border:1px solid #ccc; padding:2px 10px; color:#333 !important; text-decoration:none !important; }
270
+ ul.tabs-horiz li a.notloaded { color:#999 !important; }
271
+ ul.tabs-horiz li a.active { border-bottom:1px solid #fff; background:#fff; }
272
+
273
+
274
+
275
+ /* MESSAGES
276
+ *******************************************************************************/
277
+ .notification-global { padding:5px 27px 5px 47px; background:#fff9e9 url(images/error_msg_icon.gif) 27px 5px no-repeat; border-bottom:1px solid #eee2be; border-top:1px solid #eee2be; font-size:11px; line-height:16px; margin:0 0 -3px; color:#444; position:relative; }
278
+ .notification-global-notice { background-image:url(images/note_msg_icon.gif); }
279
+ .notification-global .label { color:#eb5e00; }
280
+ .notification-global .clickable { cursor:pointer; }
281
+ .notification-global span.critical { color:#d20000; }
282
+ .notification-global a:hover { text-decoration:none; }
283
+
284
+ .error,
285
+ a.error span,
286
+ .required,
287
+ .validation-advice { color:#D40707 !important; font-weight:bold !important; }
288
+ .notice { color:#ea7601}
289
+ .messages ul { border:0 !important; }
290
+ .messages li { min-height:23px !important; margin-bottom:11px !important; padding:8px 8px 2px 32px !important; font-size:.95em !important; font-weight:bold !important; }
291
+ .messages ul li { margin:0 0 3px 0 !important; border:0 !important; padding:0 !important; }
292
+ .error-msg { border:1px solid #f16048 !important; color:#df280a !important; background:#faebe7 url(images/error_msg_icon.gif) no-repeat 10px 10px !important; }
293
+ .success-msg { border:1px solid #95a486 !important; color:#3d6611 !important; background:#eff5ea url(images/success_msg_icon.gif) no-repeat 10px 10px !important; }
294
+ .notice-msg { border:1px solid #ffd967 !important; background:#fffbf0 url(images/note_msg_icon.gif) no-repeat 10px 10px !important; color:#3d6611 !important; }
295
+ .warning-msg { border:1px solid #666e73 !important; background:#e6e6e6 url(images/warning_msg_icon.gif) no-repeat 10px 10px !important; color:#000000 !important; }
296
+ .validation-advice { clear:both; min-height:15px; margin:3px 0 0 9px; background:url(images/validation_advice_bg.gif) no-repeat 2px 1px; padding-left:16px; font-size:.95em; font-weight:bold; line-height:1.25em; }
297
+ .staging-datetime-advice .validation-advice { background-position:right center; padding:0 16px 0 0; }
298
+ input.validation-failed, textarea.validation-failed { background:#fef0ed; border:1px dashed #d6340e; }
299
+
300
+ /* Noscript Notice */
301
+ .noscript { border:1px solid #000; border-width:0 0 1px; background:#ffff90; font-size:12px; line-height:1.25; text-align:center; color:#2f2f2f; }
302
+ .noscript .noscript-inner { width:900px; margin:0 auto; padding:12px 0 12px; background:url(images/i_notice.gif) 20px 50% no-repeat; }
303
+ .noscript p { margin:0; }
304
+
305
+ /* For Demo store only */
306
+ .demo-notice { margin:0; background:#d75f07; padding:5px 10px 6px 10px; color:#fff; line-height:1em; text-align:center; }
307
+
308
+
309
+ /* FORMS
310
+ *******************************************************************************/
311
+ select.countries option { background-repeat:no-repeat; }
312
+ .entry-edit .fieldset .tree li,
313
+ .entry-edit .tree li { margin:0; }
314
+
315
+
316
+ /* Entry Edit */ /* Site-wide form fieldset */
317
+ table.form-edit { width:100%; }
318
+ .box,
319
+ .entry-edit fieldset,
320
+ .entry-edit .fieldset { padding:10px 15px; margin-bottom:15px; }
321
+ .entry-edit .entry-edit-head h4 { float:left; padding:0; background:none; margin:0; color:#fff; font-size:1em; line-height:18px; min-height:0; }
322
+ .entry-edit .entry-edit-head strong,
323
+ .entry-edit .entry-edit-head a { color:#fff; font-size:1em; line-height:18px; min-height:0; font-weight:bold}
324
+ .entry-edit .content { margin-left:0 !important; padding:10px 15px; }
325
+ .entry-edit fieldset li,
326
+ .entry-edit .fieldset li { margin:4px 0; }
327
+ .entry-edit fieldset span.form_row,
328
+ .entry-edit .fieldset span.form_row,
329
+ .entry-edit fieldset .field-row .hint,
330
+ .entry-edit .fieldset .field-row .hint { float:left; color:#999; padding-left:12em; }
331
+ .entry-edit .form-buttons { float:right; margin:2px -3px 2px 0pt; }
332
+ label.inline { float:none !important; width:auto !important; }
333
+ .nested-content .entry-edit { margin-left:2em; }
334
+ .nested-content .entry-edit .entry-edit { margin-left:0; }
335
+
336
+ /* Form Elements */
337
+ input.input-text,textarea,select { border-width:1px; border-style:solid; border-color:#aaa #c8c8c8 #c8c8c8 #aaa; background:#fff; font:12px arial, helvetica, sans-serif; }
338
+ select { min-height:17px; /* to set the height for empty selects */ }
339
+ input.input-text,textarea { padding:2px; }
340
+ input.qty { width:40px !important; }
341
+ input.item-qty { width:22px !important; }
342
+ input.price { width:50px !important; text-align:right; }
343
+ select optgroup { font-style:normal; }
344
+ select optgroup option { padding-left:10px; }
345
+ select optgroup option.even { background:#f6f6f6; } /* Zebra even-row */
346
+ select.multiselect option { padding:3px 4px; border-bottom:1px solid #ddd; }
347
+ .checkboxes li { margin:0 0 5px !important; }
348
+ .field-100 { background-color:#fff; border-width:1px; border-style:solid; border-color:#aaa #c8c8c8 #c8c8c8 #aaa; padding:2px; }
349
+ .field-100 textarea,
350
+ .field-100 input.input-text { float:left; width:100% !important; border:0 !important; padding:0 !important; }
351
+
352
+
353
+ /* Form List */ /* Table for default form data */
354
+ .form-list { width:auto; border:0 !important; }
355
+ .form-list td.label,
356
+ .form-list td.value,
357
+ .form-list td.value2,
358
+ .form-list td.note,
359
+ .form-list td.scope-label,
360
+ .form-list td.use-default { border:0 !important; padding-top:5px !important; padding-bottom:5px !important; padding-left:5px !important; background:0 !important; }
361
+ .form-list td.hidden { border:0 !important; padding:0 !important; background:0 !important; }
362
+ .form-list td.label { width:200px; }
363
+ .form-list td.label label { display:block; width:185px; padding-right:15px; }
364
+ .form-list td.value input.input-text,
365
+ .form-list td.value textarea { width:274px; }
366
+ .form-list td.value textarea { height:15em; }
367
+ .form-list td.value select { width:280px; }
368
+ .form-list td.note { background:url(images/note_cell_bg.gif) 6px 10px no-repeat !important; padding-left:18px; }
369
+ .form-list td.scope-label { padding-left:5px; color:#6f8992; font-size:.9em; }
370
+ .form-list p.note { margin:0; padding:0 0 0 13px; background:url(images/note_bg.gif) 1px 6px no-repeat; font-size:11px; }
371
+
372
+ .columns .form-list { width:auto; }
373
+ .columns .form-list td.value { width:280px; padding-right:5px !important; }
374
+ .columns .form-list td.value .next-toinput { width:75px; display:inline; margin-right:5px; }
375
+ .columns .form-list td.value .next-toselect input.input-text { width:180px; display:inline; }
376
+
377
+ .fieldset-wide .form-list { width:100% !important; }
378
+ .fieldset-wide .form-list td.value { width:auto !important; }
379
+ .fieldset-wide .form-list td.value input.input-text,
380
+ .fieldset-wide .form-list td.value textarea { width:98% !important; }
381
+ .fieldset-wide .form-list td.value select { display:block; }
382
+ .fieldset-wide .form-list td.scope-label { white-space:nowrap; width:1px; }
383
+ .fieldset-wide .form-list td.note { width:120px; }
384
+
385
+ .multi-input { margin-bottom:8px; } /* Example: Address fields with 2 input lines */
386
+ .grid tr .form-list tr { background:#fff !important; } /* Follows grid row background-color */
387
+ .grid tr.even .form-list tr { background:#f6f6f6 !important; } /* Follows grid row background-color */
388
+ .grid tr.on-mouse .form-list tr { background:#fcf5dd !important; } /* Follows grid row background-color */
389
+ .grid tr .form-list { margin:8px 0; }
390
+ .field-row { display:block; margin-bottom:5px; }
391
+ span.delete-image { display:block; white-space:nowrap; padding-left:25px; }
392
+
393
+ /* Back compatibility with span forms */
394
+ .entry-edit .field-row { display:block; }
395
+ .entry-edit .field-row label { float:left; width:150px; }
396
+
397
+ /* Form Button */
398
+ .content-buttons.form-buttons,
399
+ .content-header .form-buttons { text-align:right; margin-bottom:0; white-space:nowrap; }
400
+ .content-header .content-buttons-placeholder { display:inline !important; }
401
+ .content-header .form-buttons { float:right; }
402
+ .content-header td.form-buttons { float:none; }
403
+ .content-header .form-buttons button { margin-bottom:3px; }
404
+ .sub-btn-set { border:1px solid #ddd; border-width:0 1px; background:url(images/sub_button_bg.gif) repeat; padding:3px 10px; text-align:right; }
405
+ button,
406
+ .form-button { border-width:1px; border-style:solid; border-color:#ed6502 #a04300 #a04300 #ed6502; padding:0 7px 1px 7px; background:#ffac47 url(images/btn_bg.gif) repeat-x 0 100%; color:#fff; font:bold 12px arial, helvetica, sans-serif; cursor:pointer; text-align:center !important; white-space:nowrap; }
407
+ button:hover { background:#f77c16 url(images/btn_over_bg.gif) repeat-x 0 0; }
408
+ button:active { background:#f77c16 url(images/btn_on_bg.gif) repeat-x 0 0; }
409
+ button span { line-height:1.35em; background-repeat:no-repeat; background-position:0 50%; }
410
+ button.delete,
411
+ button.save,
412
+ button.add { padding-left:6px; }
413
+ button.cancel span,
414
+ button.delete span,
415
+ button.save span,
416
+ button.add span,
417
+ button.back span,
418
+ button.add-image span,
419
+ button.add-widget span { padding-left:20px; }
420
+ button.back { border-color:#ccc #aaa #aaa #ccc; background-color:#fff; background-image:url(images/btn_back_bg.gif); color:#555; }
421
+ button.back span { background-image:url(images/icon_btn_back.gif); }
422
+ button.cancel,
423
+ button.delete { border-color:#d24403 #a92000 #a92000 #d24403; background-image:url(images/cancel_btn_bg.gif); background-color:#fcaf81; color:#fff; }
424
+ button.cancel:hover,
425
+ button.delete:hover { background-image:url(images/cancel_btn_over_bg.gif); }
426
+ button.cancel:active,
427
+ button.delete:active { background-image:url(images/cancel_btn_active_bg.gif); background-color:#e0612f; }
428
+ button.cancel span,
429
+ button.delete span { background-image:url(images/cancel_btn_icon.gif); }
430
+ button.add span { background-image:url(images/add_btn_icon.gif); }
431
+ button.save span { background-image:url(images/save_btn_icon.gif); }
432
+ button.show-hide span { background-image:url(images/btn_show-hide_icon.gif); padding-left:26px; }
433
+ button.add-image span { background-image:url(images/btn_add-image_icon.gif); }
434
+ button.add-widget span { background-image:url(images/btn_add-widget_icon2.gif); padding-left:24px; }
435
+ button.add-variable span { background-image:url(images/btn_add-variable_icon.gif); padding-left:26px; }
436
+ button.go span { background-image:url(images/btn_go.gif); padding-left:16px; }
437
+ button.btn-chooser { display:block; margin:0 0 10px; }
438
+
439
+ button.disabled,
440
+ button.disabled:hover,
441
+ button.disabled:active { border-color:#777 #505050 #505050 #777; background:#919191 url(images/btn_bg-disabled.gif) 0 0 repeat-x; color:#fff; cursor:default; opacity:.8; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=20)"; }
442
+ button.add.disabled span { background-image:url(images/add_btn_icon-disabled.gif); }
443
+
444
+ button.icon-btn { width:32px !important; }
445
+ button.icon-btn span { text-indent:-999em; display:block; width:16px; padding:0; overflow:hidden; }
446
+
447
+ .buttons-set { margin:0 0 10px; }
448
+ .buttons-set button { margin-right:5px; }
449
+
450
+
451
+ /* SWITCHER
452
+ *******************************************************************************/
453
+ .switcher { margin-bottom:10px; border:1px solid #cddddd; background:#e7efef; padding:10px; }
454
+ .side-col .switcher select { width:100%; }
455
+ /*.side-col .switcher { margin-right:20px; margin-bottom:20px; }*/
456
+ .catalog-categories .side-col .switcher { margin-right:0; margin-bottom:15px; }
457
+
458
+
459
+ /* SPACE
460
+ *******************************************************************************/
461
+ .box-left, .box-right { width:48.5%; }
462
+ .box-left { float:left; }
463
+ .box-right { float:right; }
464
+ .box-left .content,
465
+ .box-right .content { padding:6px 14px; }
466
+ .separator, .pipe { padding:0 6px; font-size:.9em; } /* vertical pipe */
467
+ .divider { display:block; height:1px; margin:8px 0; background:#ddd; overflow:hidden; } /* horizontal pipe */
468
+ td.divider { font-size:1px; line-height:0; }
469
+ .box,
470
+ .entry-edit fieldset,
471
+ .entry-edit .fieldset { border:1px solid #d6d6d6; background:#fafafa; }
472
+
473
+
474
+ /* SCOLLER */ /* Used primarily in Sales -> Order -> Create Order */ /*
475
+ *******************************************************************************/
476
+ .scroll-cont {
477
+ position:absolute;
478
+ top:-25px;
479
+ left:503px;
480
+ width:16px;
481
+ height:265px;
482
+ background:transparent url(images/db-scroll-bg.gif) no-repeat top;
483
+ z-index:10000;
484
+ }
485
+ .auto-scroll { overflow:auto; height:11em; }
486
+ .root { position:relative; height:260px; margin:0; width:1px; }
487
+ .thumb { position:absolute; height:40px; width:16px; margin-top:-28px; z-index:11000; }
488
+ .up { margin-top:254px; height:16px; }
489
+ .dn { margin-top:0; padding:0; height:15px; }
490
+ .up a, .up a img,
491
+ .dn a, .dn a img,
492
+ .thumb a ,
493
+ .thumb a img { border:0; }
494
+ .up a:active, .dn a:active { outline:none; }
495
+ .scrollContainer {
496
+ position:absolute;
497
+ left:0;
498
+ top:19px;
499
+ clip:rect(0 467px 200px 0);
500
+ overflow:auto;
501
+ border:0;
502
+ }
503
+ .scrollContent { position:absolute; left:0; top:0; }
504
+
505
+ /* Horizontal scroll */
506
+ .hor-scroll { width:100%; overflow:auto; padding-bottom:4px; margin-bottom:-4px; } /* IE has personal style, see iestyles.css */
507
+
508
+
509
+ /**/
510
+ .note-list { width:100%; overflow:hidden; }
511
+ .note-list li { border-top:1px solid #e3e3e3; margin-top:9px !important; background:url(images/icon_note_list.gif) no-repeat 0 4px; padding-bottom:9px; padding-left:18px; }
512
+
513
+
514
+
515
+ /******************************************************************************/
516
+ /********************************** STRUCTURE *********************************/
517
+ /******************************************************************************/
518
+
519
+ /* LAYOUT
520
+ *******************************************************************************/
521
+ .wrapper { min-width:960px; }
522
+ .wrapper-popup { min-width:750px; }
523
+ .header { background:url(images/header_top_bg.gif) repeat-x #425e66; text-align:right; }
524
+ .middle { min-height:450px; background:url(images/simple_container_bg.gif) repeat-x #fff; padding:23px 27px 0 27px; }
525
+ .middle-popup { border-bottom:3px solid #fff; background:url(images/middle_bg.gif) repeat-x 0 100% #fff; padding:0 0 0 0; background:yellow; }
526
+ .container-collapsed { padding:1.8em 2.2em 1.8em 2em; padding-top:0; }
527
+ .columns {background:url(images/side_col_bg.gif) repeat-y 217px 0; }
528
+
529
+ div.side-col { float:left; width:220px; margin-right:-220px; padding-bottom:25px; }
530
+ div.main-col { margin-left:220px; min-height:450px; padding:0 0 25px 25px; }
531
+ div.main-col-inner { float:left; /* Fixes some inner clears in the liquid main-col */ width:100%; }
532
+
533
+ .footer { clear:both; background:url(images/footer_bg.gif) repeat-x #e6e6e6; padding:105px 2.8em 2.8em 2.8em; font-size:.95em; text-align:center; }
534
+ .simple-container-popup { min-height:50px !important; padding:1.8em 2.3em 6em 2.3em; background:url(images/simple_container_bg.gif) repeat-x; }
535
+
536
+ .page-popup { background:#fff; }
537
+
538
+
539
+ /******************************************************************************/
540
+ /************************************* BOXES **********************************/
541
+ /******************************************************************************/
542
+
543
+ /* HEADER & FOOTER
544
+ *******************************************************************************/
545
+
546
+ .logo { float:left; margin:5px 20px 5px 27px; height:43px; }
547
+ .header-top { border-bottom:1px solid #5F767F; }
548
+
549
+ /* Header right */
550
+ .header-right { padding:10px 25px 0 15px; font-size:.95em; color:#fff; }
551
+ .header-right a, .header-right a:hover { color:#fcce77; }
552
+ .header-right .separator { color:#999; }
553
+ .header-right fieldset { display:inline; padding-left:10px; }
554
+ .header-right fieldset input.input-text { width:18em; }
555
+ .header-right .super {
556
+ float:right;
557
+ line-height:1.8em;
558
+ margin-bottom:14px;
559
+ margin-left:1.3em;
560
+ }
561
+
562
+ /* Search autocomplete */
563
+ div.autocomplete {
564
+ z-index:10000;
565
+ position:absolute;
566
+ width:250px;
567
+ background-color:white;
568
+ border:1px solid #888;
569
+ margin:0;
570
+ padding:0;
571
+ }
572
+ div.autocomplete ul { margin:0; padding:0; }
573
+ div.autocomplete ul li.selected { background-color:#dcebf0; }
574
+ div.autocomplete ul li { padding:.5em .7em; min-height:32px; cursor:pointer; text-align:left; color:#2f2f2f; line-height:1.3em; }
575
+
576
+ /* Footer */
577
+ .footer .bug-report { float:left; width:35%; text-align:left; }
578
+ .footer .legality { float:right; width:35%; min-height:19px; padding-left:22px; text-align:right; }
579
+
580
+ /* COLUMNS
581
+ ********************************************************************************************/
582
+
583
+ .catalog-categories .side-col { width:25em; padding-right:25px; } /* Catalog/Categories */
584
+ .catalog-categories .main-col { padding-left:25px; margin-left:25em; } /* Catalog/Categories */
585
+ .order-summary .side-col { padding-right:25px; } /* Order/Create */
586
+ .order-summary .main-col { padding-left:25px; } /* Order/Create */
587
+
588
+
589
+ /* HEADINGS
590
+ ********************************************************************************************/
591
+
592
+ /* Content Header */
593
+ .content-header {
594
+ margin-bottom:18px;
595
+ border-bottom:4px solid #dfdfdf;
596
+ padding-bottom:.25em;
597
+ }
598
+ .content-header table { width:100%; }
599
+ .content-header h3 { float:left; margin:.3em .5em 0 0; color:#eb5e00; font-size:1.25em; line-height:1.2em; }
600
+ .content-header .head h3 { float:none; }
601
+ .content-header .button-set { white-space:nowrap; text-align:right; }
602
+ .content-header .content-buttons { white-space:nowrap!important; margin:0; }
603
+ .content-header td.content-buttons { width:13%;white-space:nowrap!important; margin:0; }
604
+ .content-buttons button,
605
+ .content-header button,
606
+ .filter-actions button { margin:0 0 0 5px; }
607
+ .side-col .content-header { border-bottom:0; margin-right:12px; margin-bottom:.6em; }
608
+ .catalog-categories .side-col .content-header { margin-right:0; } /* Catalog/Categories */
609
+
610
+ .left-col-block { width:200px; }
611
+
612
+ /* Floating Content Header */ /* Used to make action buttons always within reach */
613
+ .content-header-floating { display:none; position:fixed; left:0; top:0; width:100%; border-bottom:solid 1px #988753; z-index:100; background:#fdfaa4; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=85)"/* IE8 */; opacity:.85; }
614
+ .content-header-floating .content-header { padding:6px 8px 4px 8px; margin-bottom:0; border:0; }
615
+ .content-header-floating td { padding-right:20px; }
616
+ .content-header-floating button { margin-top:3px; }
617
+ .content-header-floating .content-buttons { float:right; /* margin:12px 25px 0 0;*/ }
618
+ .content-buttons { margin-bottom:5px; float:right; display:inline; white-space:nowrap; }
619
+ .content-header-floating .form-buttons {padding-right:20px; }
620
+ .content-header-floating h3 {margin-left:20px; display:inline; }
621
+
622
+
623
+
624
+ /* Box Head */
625
+ .box-head { margin-bottom:.6em; text-align:right; }
626
+ .box-head h4 { float:left; margin-bottom:0; }
627
+
628
+
629
+ /* Icon Head */ /* Headings with icon preceding text*/
630
+ .icon-head { min-height:18px; background-repeat:no-repeat; background-position:0 0; padding-left:22px; }
631
+ .head-customer-address-list { background-image:url(images/fam_house.gif); }
632
+ .head-edit-form { background-image:url(images/fam_page_white.gif); }
633
+ .head-customer-view { background-image:url(images/fam_status_online.gif); padding-left:18px; }
634
+ .head-customer,
635
+ .head-customer-groups { background-image:url(images/fam_group.gif); }
636
+ .head-user { background-image:url(images/fam_user.gif); }
637
+ .head-user-edit { background-image:url(images/fam_user_edit.gif); }
638
+ .head-user-comment { background-image:url(images/fam_user_comment.gif); }
639
+ .head-comment { background-image:url(images/fam_comment.gif); }
640
+ .head-cart { background-image:url(images/fam_cart.gif); }
641
+ .head-account { background-image:url(images/fam_account.gif); }
642
+ .head-online-visitors { background-image:url(images/fam_monitor.gif); }
643
+ .head-products { background-image:url(images/fam_package.gif); }
644
+ .head-catalog-product { background-image:url(images/fam_package.gif); }
645
+ .head-newsletter-queue { background-image:url(images/fam_newspaper_go.gif); }
646
+ .head-newsletter-list { background-image:url(images/fam_newspaper.gif); }
647
+ .head-newsletter-report { background-image:url(images/fam_newspaper_error.gif); }
648
+ .head-tag, .head-tag-product { background-image:url(images/fam_tag_orange.gif); }
649
+ .head-sales-order,
650
+ .head-sales-invoice { background-image:url(images/fam_folder_table.gif); }
651
+ .head-categories { background-image:url(images/fam_folder_database.gif); padding-left:20px; color:#253033 !important; }
652
+ .head-catalog-product-attribute { background-image:url(images/fam_rainbow.gif); padding-left:24px; }
653
+ .head-product-attribute-sets { background-image:url(images/fam_folder_palette.gif); padding-left:23px; }
654
+ .head-tax { background-image:url(images/fam_money_add.gif); }
655
+ .head-cms-page, .head-cms-block { background-image:url(images/application_view_tile.gif); }
656
+ .head-backups-control { background-image:url(images/fam_server_database.gif); }
657
+ .head-money, .head-promo-quote { background-image:url(images/fam_money.gif); }
658
+ .head-shipping-address,
659
+ .head-billing-address { background-image:url(images/fam_house.gif); }
660
+ .head-shipping-method { background-image:url(images/fam_lorry.gif); }
661
+ .head-payment-method { background-image:url(images/fam_creditcards.gif); }
662
+ .head-order-date { background-image:url(images/fam_calendar.gif); }
663
+ .head-customer-sales-statistics { background-image:url(images/fam_money.gif); }
664
+ .head-notification { background-image:url(images/fam_folder_table.gif); }
665
+ .head-compilation { background-image:url(images/fam_package_go.gif); }
666
+
667
+
668
+
669
+ /******************************************************************************/
670
+ /********************************* PAGE SPECIFIC ******************************/
671
+ /******************************************************************************/
672
+
673
+
674
+ /* LOGIN
675
+ *******************************************************************************/
676
+ #page-login { background:#f8f8f8; text-align:center; }
677
+ .login-container { width:581px; margin:170px auto; padding-left:32px; background:url(images/login_logo.gif) no-repeat; }
678
+ .login-form { padding:27px 57px 35px 57px; background:url(images/login_box_bg.jpg) no-repeat; text-align:left; }
679
+ .login-form .input-left { float:left; }
680
+ .login-form .input-right { float:right; }
681
+ .login-form .input-box input.input-text { width:224px; }
682
+ .login-form h2 { font-size:1.7em; font-weight:normal; }
683
+ .login-form label { font-weight:bold; }
684
+ .login-form .form-buttons { margin:12px 0 0 0; clear:both; text-align:right; }
685
+ .login-box .bottom { width:581px; height:5px; background:url(images/login_box_bottom.jpg) no-repeat; overflow:hidden; }
686
+ .login-container .legal { margin:0; background:url(images/login_box_legal_bg.gif) no-repeat; padding:8px 8px 5px 8px; font-size:.95em; }
687
+ .login-form .validation-advice { margin:3px 0 0 0; }
688
+ .login-form .forgot-link { margin:0 17px 0 0; text-align:right; }
689
+
690
+
691
+
692
+ /* DASHBOARD
693
+ *******************************************************************************/
694
+ .dashboard-container { border:1px solid #ccc; }
695
+ .dashboard-container .switcher { margin-bottom:0; border:0; }
696
+
697
+ /* STORE MANAGEMENT
698
+ *******************************************************************************/
699
+ .adminhtml-system-store-deletestore .content-footer .content-buttons,
700
+ .adminhtml-system-store-deletegroup .content-footer .content-buttons,
701
+ .adminhtml-system-store-deletewebsite .content-footer .content-buttons { float:left; }
702
+
703
+
704
+ /* SALES
705
+ *******************************************************************************/
706
+
707
+ /* Disabled block */
708
+ .overlay span { display:block; width:100%; text-align:center; position:absolute; top:50%; margin:-5px 0 0; color:#000; }
709
+
710
+ /* Prices */
711
+ .price { white-space:nowrap !important; }
712
+
713
+ /* Incl tax (for order tables) */
714
+ .price-incl-tax { display:block; }
715
+ .price-incl-tax .label { display:block; white-space:nowrap; }
716
+ .price-incl-tax .price { /*display:block;*/ font-weight:bold; }
717
+
718
+ /* Excl tax (for order tables) */
719
+ .price-excl-tax { display:block; }
720
+ .price-excl-tax .label { display:block; white-space:nowrap; }
721
+ .price-excl-tax .price { /*display:block;*/ font-weight:bold; }
722
+
723
+ /* Orders / Invoices / Shipments / Credit Memos Table */
724
+ .order-tables td h5.title { font-size:1em; font-weight:bold; }
725
+ .order-tables td .option-label { font-weight:bold; font-style:italic; }
726
+ .order-tables td .option-value { padding-left:10px; }
727
+ .order-tables td .qty-table { border:0 !important; width:100% }
728
+ .order-tables td .qty-table td { border:0 !important; padding:0 4px !important; }
729
+
730
+ dl.item-options dt { font-weight:bold; font-style:italic; }
731
+ dl.item-options dd { padding-left:10px; }
732
+
733
+ ul.item-options li { padding-left:.7em; }
734
+
735
+
736
+ /* Create Order */
737
+ .page-create-order .side-col { width:260px; background:none; padding:0; }
738
+ .page-create-order .main-col { padding-left:28px; }
739
+ .page-create-order .switcher { margin-bottom:25px; }
740
+ .create-order-sidebar-container { border:1px solid #d6d6d6; background:#fafafa; }
741
+ .create-order-sidebar-block .content { margin:0 !important; padding:4px 6px; }
742
+ .create-order-sidebar-block .head { border-top:1px solid #ddd; background:#ececec; padding:2px 6px 1px; font-size:.9em; text-align:right; }
743
+ .create-order-sidebar-block .head h5 { float:left; margin:0; color:#2c464f; text-align:left; }
744
+ .create-order-sidebar-block .content table td,
745
+ .create-order-sidebar-block table th { padding:0 3px 0 0; }
746
+ .create-order-sidebar-block select { width:170px; }
747
+ .create-order-sidebar-block ul { margin-left:20px; }
748
+ .order-choose-address { margin:0 0 10px 0;padding:8px 15px;background:#e7efef; } /*Address Selector */
749
+ .order-save-in-address-book { margin:0 0 0 0;padding:8px 15px;background:#e7efef; } /* Save in Address Book Checkbox */
750
+ .entry-edit .content .form-list { width:100%; }
751
+
752
+ .entry-edit .order-address td.label label { width:100px; }
753
+ .entry-edit .order-address input.input-text,
754
+ .entry-edit .order-address .textarea { width:95% !important; }
755
+ .entry-edit .order-address .select { width:96.5%; }
756
+ .order-search-items .entry-edit .grid { height:610px; overflow:auto; }
757
+ .order-search-items .entry-edit .grid table { width:99.9%; }
758
+ /* .create-order-totals { background:url(images/bg_create_order_totals.gif) repeat-y 50% 0 !important; } */
759
+
760
+ /* Order Totals */
761
+ .order-totals { margin-left:auto; border:1px solid #d7c699 !important; padding:12px 0; background:#fcfac9; text-align:right; }
762
+ .order-totals table { border:none; background:none; margin-left:auto; }
763
+ .order-totals table td { padding:3px 20px 3px 10px; }
764
+ .order-totals table td.label { white-space:normal; padding:3px 10px 3px 20px; }
765
+ .order-totals table td.last { padding:2px 6px; }
766
+ .order-totals-bottom { padding:0 20px; }
767
+ .order-totals table .validation-advice { text-align:right; white-space:nowrap; background-position:100% 1px; padding-right:14px; padding-left:0; }
768
+ .grand-total, .grand_total { font-size:1.2em; font-weight:bold; color:#eb4d00 !important; }
769
+
770
+ /* Shopping cart total summary row expandable to details */
771
+ .summary-total { cursor:pointer; }
772
+ .summary-total td { padding-top:5px !important; padding-bottom:5px !important; }
773
+ .summary-total .summary-collapse { float:right; padding-left:20px; background:url(images/bg_collapse.gif) 0 4px no-repeat; text-align:right; cursor:pointer; }
774
+ .show-details .summary-collapse { background-position:0 -52px; }
775
+ .show-details td { border-top:1px solid #eae1b2; }
776
+ .summary-details td { font-size:11px; background-color:#fdfcdf; }
777
+ .summary-details-first td { border-top:1px solid #eae1b2; }
778
+
779
+ /* Order Constants */
780
+ .payment-methods dt { margin-bottom:3px; }
781
+ .payment-methods dd { margin-left:20px; }
782
+ .payment-methods .validation-advice { margin-left:2px; }
783
+
784
+ /* Centinel */
785
+ .centinel .authentication { background:#fff; }
786
+ .centinel .authentication iframe { width:99%; height:400px; background:transparent !important; margin:0 0 7px !important; padding:0 !important; border:1px solid #ddd !important; }
787
+
788
+ /* Gift Messages */
789
+ .giftmessage-order-create .entire-order,
790
+ .giftmessage-order-create .each-order-item { background-color:#eee; padding:6px 14px; height:275px; }
791
+ .giftmessage-order-create .entire-order .entry-edit,
792
+ .giftmessage-order-create .each-order-item .scroll { height:250px; overflow:auto; }
793
+ .giftmessage-order-create .single { width:100%; float:left; padding:1.2em 1.5em; }
794
+ .giftmessage-order-create h5 { font-size:12px; font-weight:normal; line-height:1.5; margin-bottom:10px; }
795
+ .giftmessage-order-create h6 { font-size:11px; font-weight:normal; line-height:1.55; background-color:#cfcfcf; margin-bottom:10px; padding:2px 6px; width:95%; }
796
+ .giftmessage-order-create .fieldset { padding:0; }
797
+ .giftmessage-order-create .form-list { width:100%; }
798
+ .giftmessage-order-create .form-list td.label label { width:100px; }
799
+ .giftmessage-order-create .form-list td.value input.input-text,
800
+ .giftmessage-order-create .form-list td.value textarea { width:95%; }
801
+
802
+ .giftmessage-single-item { padding:0 !important; }
803
+ .giftmessage-single-item .item-container { cursor:auto; }
804
+ .giftmessage-single-item .item-text { padding:2px 4px; }
805
+ .giftmessage-single-item .gift-form { margin-top:3px; background:#f7f6f4 url(images/gift-message-grid-column-bg.gif) 0 0 repeat-x; }
806
+ .giftmessage-single-item .gift-form .entry-edit fieldset { border:none !important; margin-bottom:0; background:none !important; padding:15px; }
807
+ .giftmessage-single-item .gift-form .entry-edit fieldset .last { margin-bottom:0; }
808
+ .giftmessage-single-item .gift-form .entry-edit input.input-text { width:75% !important; }
809
+ .giftmessage-single-item .gift-form .entry-edit textarea { width:96% !important; }
810
+ .giftmessage-single-item .action-link-holder {}
811
+ .giftmessage-single-item .action-link { padding-right:10px; background:url(images/gift-message-expand.gif) 100% 50% no-repeat; cursor:pointer; }
812
+ .giftmessage-single-item .open { background:url(images/gift-message-collapse.gif) 100% 50% no-repeat; }
813
+
814
+ .giftmessage-whole-order-container .entry-edit input.input-text { width:280px !important; }
815
+ .giftmessage-whole-order-container .entry-edit textarea { width:99% !important; padding:2px 3px; }
816
+ .giftmessage-whole-order-container .entry-edit label { width:121px; }
817
+
818
+ /* PayPal */
819
+ .paypal-payment-notice { background:url(images/paypal_logo.gif) no-repeat 5px center #eaf0ee; border:1px solid #ccc; margin-bottom:10px; padding:10px 5px 5px 115px; }
820
+ .paypal-payment-notice h4,
821
+ .paypal-payment-notice p { margin:0; }
822
+ .paypal-payment-notice h2 { color:#444; font-size:1.4em; line-height:1em; }
823
+ .paypal-payment-notice a { text-decoration:none; }
824
+
825
+ h3.paypal-header { background:url(images/paypal_section.png) no-repeat 0 0; height:0; overflow:hidden; padding:14px 0 0; width:53px; }
826
+
827
+ ul.tabs a.paypal-section,
828
+ ul.tabs a.paypal-section:hover { background:url(images/tabs_span_bg.gif) repeat-x 0 100%; border-bottom:none; padding:0.5em 0.5em 0.28em 1.5em; }
829
+ ul.tabs a.paypal-section:hover { background-color:#d8e6e6; }
830
+ ul.tabs a.paypal-section.active, ul.tabs a.paypal-section.active:hover { background-color:#fff; }
831
+ ul.tabs a.paypal-section span,
832
+ ul.tabs a.paypal-section:hover span { background:url(images/paypal_section.png) no-repeat 0 0; height:0; overflow:hidden; padding:14px 0 0; width:53px; }
833
+
834
+ .paypal-selection { border-collapse:collapse; width:100%; }
835
+ .paypal-selection .paypal-selection-info { text-align:right; }
836
+ .paypal-selection th { font-size:13px; padding:5px 0; text-align:left; vertical-align:middle; }
837
+ .paypal-selection td { background:#f2f2f2; border-bottom:5px solid #fff; padding:5px; vertical-align:top; }
838
+ .paypal-selection .paypal-selection-simplified { background:#fff; padding-left:35px; }
839
+ .paypal-selection td a { color:#2997d8; }
840
+ .paypal-selection td strong { color:#3c616a; }
841
+ .paypal-selection td label { display:block; padding-left:30px; text-indent:-30px; }
842
+ .paypal-selection td div label { display:inline; padding:0; text-indent:0; }
843
+ .paypal-selection td input { height:13px; overflow:hidden; margin-right:15px; position:relative; top:-1px; width:13px; vertical-align:middle; }
844
+
845
+ .paypal-config .form-list { width:100%; }
846
+ .paypal-config tr.hover { background:#f7f7f7; }
847
+ .paypal-config tr.hover label { cursor:help; }
848
+
849
+ .paypal-credentials { border:1px solid #f2f2f2; }
850
+ .paypal-credentials caption { padding:5px; text-align:left; }
851
+ .paypal-credentials .value { color:#ccc; }
852
+
853
+ /* CATALOG
854
+ *******************************************************************************/
855
+
856
+ /* Category */
857
+ .categories-side-col .content-header { padding:0; }
858
+ .categories-side-col .content-header h3 { float:none; }
859
+ .categories-side-col .content-header button { margin:5px 0 0; }
860
+ .categories-side-col .switcher { margin:10px 20px 0 0; }
861
+ .categories-side-col .tree-actions { text-align:center; margin:10px 20px 10px 0; }
862
+ .categories-side-col .tree-holder { margin-right:20px; }
863
+
864
+ .no-active-category a span { color:#aaa !important; }
865
+
866
+ #tree-div { overflow:auto!important; padding-bottom:15px; width:200px; }
867
+
868
+ .x-tree-node { margin:0 !important; }
869
+ .x-tree-node .leaf .x-tree-node-icon { background-image:url(images/fam_leaf.png); }
870
+ .x-tree-node .system-leaf .x-tree-node-icon { background-image:url(images/fam_application_form_delete.png); }
871
+
872
+ /* Product - Websites */
873
+ .webiste-groups { padding:10px 20px; }
874
+ .group-stores { padding:2px 10px; }
875
+
876
+ /* Products - Bundles */
877
+ .bundle-option-row table tbody td { white-space:nowrap; }
878
+ .bundle-option-row table tbody td label { float:left; }
879
+ .bundle-option-row input.option-label { width:50% !important; }
880
+ .bundle-option-row input.option-position{ width:70px !important; }
881
+ .catalog-categories .side-col { width:240px; }
882
+
883
+ /* Products - Tier Price */
884
+ .tier-price-input { margin-bottom:8px; }
885
+ .tier-price-input input.price { width:80px; margin-right:10px; }
886
+ .tier-price-input input.qty { width:80px; }
887
+ .tier-price-input .tier-container { position:relative; clear:both; }
888
+ .tier-price-input .tier-container div { float:left; }
889
+ .tier-price-input .tier-container label { width:30px; margin:0; padding:0; }
890
+ .tier-price-input .validation-advice { margin:0; height:25px; }
891
+ .tier-price-input .custgroup-div select { width:auto; padding:0; }
892
+ .tier-price-input .qty-div { padding-left:20px; }
893
+ .tier-price-input .price-div { padding-left:20px; }
894
+ .tier-price-input .price-div .validation-advice { margin:0; }
895
+ .btn-remove-tier-group { float:right; right:24px; top:5px; }
896
+
897
+ /* Product - Gallery */
898
+ .image-preview { position:absolute; cursor:pointer; }
899
+
900
+ /* Attributes */
901
+ .edit-attribute-set .form-list td.label { width:105px; }
902
+ .edit-attribute-set .form-list td.label label { width:105px; }
903
+ .edit-attribute-set .entry-edit fieldset input.input-text { width:200px; }
904
+ /* Review & Ratings */
905
+ .ratings { margin:0; }
906
+ .rating-box {
907
+ float:left;
908
+ position:relative;
909
+ width:69px;
910
+ height:16px;
911
+ margin:0 5px 3px 0;
912
+ background:url(images/product_rating_blank_star.gif) repeat-x;
913
+ }
914
+ .rating-box .rating {
915
+ position:absolute;
916
+ top:0;
917
+ left:0;
918
+ height:16px;
919
+ background:url(images/product_rating_full_star.gif) repeat-x;
920
+ }
921
+ .field-row .ratings { width:120px; float:left; clear:right; }
922
+ .field-row .ratings-container { width:250px; float:left; }
923
+ .product-review-box { width:450px; }
924
+ .product-review-box table { width:100%; }
925
+ .product-review-box td,
926
+ .product-review-box th { text-align:center; padding-right:5px; }
927
+ .product-review-box td.label { width:100px; text-align:left; }
928
+
929
+
930
+ /* Price Rules */
931
+ .rule-tree ul { padding-left:16px !important; border-left:dotted 1px #888; }
932
+ .rule-tree .x-tree ul { padding-left:0 !important; border-left:none !important; }
933
+ .rule-param .label { font-weight:bold; color:black; }
934
+ .rule-param .label:hover { font-weight:bold; color:blue; }
935
+ .rule-param .element { display:none; }
936
+ .rule-param input,
937
+ .rule-param select { width:auto !important; min-width:170px; }
938
+ .rule-param select.multiselect { vertical-align:top; }
939
+ .rule-param-edit .label { display:none; }
940
+ .rule-param-edit .element { display:inline; }
941
+ .rule-param-add { font-weight:normal; color:green; text-decoration:none; }
942
+ .rule-param-add:hover { font-weight:normal; color:blue; text-decoration:none; }
943
+ .rule-param-apply { font-weight:normal; color:green; text-decoration:none; }
944
+ .rule-param-apply:hover { font-weight:normal; color:blue; text-decoration:none; }
945
+ .rule-param-remove { font-weight:normal; color:red; text-decoration:none; }
946
+ .rule-param-remove:hover { font-weight:normal; color:blue; text-decoration:none; }
947
+ .rule-chooser { border:solid 1px #CCC; margin:5px; padding:5px; display:none; }
948
+ .rule-param-wait { padding-left:20px; background-image:url(images/rule-ajax-loader.gif); background-repeat:no-repeat; background-position:0 50%; }
949
+
950
+ /* Product Customer Defined options */
951
+ .custom-options .box {padding:0 1.5em; }
952
+ .custom-options .option-box {border:1px solid #cddddd; padding:1em; background:#e7efef; margin:1.5em 0; }
953
+
954
+ .custom-options .option-header {border:0; width:100%; background:#e7efef; border-bottom:1em solid #e7efef; }
955
+ .custom-options .option-header .input-text,
956
+ .custom-options .option-header .select {width:95%; }
957
+ .custom-options .option-header th {padding:2px; }
958
+ .custom-options .option-header td {padding:5px 2px; }
959
+
960
+ .custom-options .opt-title {width:175px; }
961
+ .custom-options .opt-type {width:150px; }
962
+ .custom-options .opt-req {width:80px; }
963
+ .custom-options .opt-order {width:60px; }
964
+
965
+ .custom-options .option-box .border {width:615px; }
966
+
967
+ .custom-options th {white-space:nowrap; }
968
+ .custom-options .type-title {width:auto; }
969
+ .custom-options .type-price {width:60px; }
970
+ .custom-options .type-type {width:80px; }
971
+ .custom-options .type-uqty {width:100px; }
972
+ .custom-options .type-sku {width:150px; }
973
+ .custom-options .type-order {width:60px; }
974
+ .custom-options .type-butt {width:33px; }
975
+ .custom-options .type-last {width:auto; }
976
+
977
+ .custom-options .option-box .border input.input-text,
978
+ .custom-options .option-box .border select.select { width:90% !important; }
979
+
980
+ .custom-options .option-box .border .type-last input.input-text { width:60px !important; }
981
+ .custom-options .option-box .border input.type-sku {width:150px !important; }
982
+
983
+ /* Bundle product */
984
+ .bundle .option-box {padding-bottom:2em; }
985
+ .bundle .option-box .border {width:100%; border-bottom:0; }
986
+ .bundle .option-box .border td {border-bottom:1px solid #dce5e6!important; }
987
+ .bundle .option-title {padding:0 0 10px; border-bottom:1px solid #cddddd; }
988
+ .bundle .option-title button {float:right; }
989
+ .bundle .option-title label {font-weight:bold; line-height:21px; padding-right:1em; float:left; }
990
+ .bundle .option-title .input-text {float:left; width:260px; vertical-align:middle; }
991
+ .bundle .option-header {clear:both; margin-top:5px; }
992
+
993
+ .bundle .border .last {width:33px; }
994
+
995
+ /* Downloadable Product */
996
+ .files { width:195px; }
997
+ .files input.input-text { float:left; width:134px !important; }
998
+ .files-wide { width:355px; }
999
+ .files-wide input.input-text { float:left; width:294px !important; }
1000
+ .files label,
1001
+ .files-wide label { float:left; width:55px; }
1002
+ .files .row,
1003
+ .files-wide .row { margin-bottom:5px; }
1004
+ /* Files Uploader */
1005
+ .files .flex,
1006
+ .files-wide .flex { float:right !important; position:static !important; }
1007
+ .files .uploader,
1008
+ .files-wide .uploader { float:left; overflow:hidden; }
1009
+ .files .uploader { width:100px; }
1010
+ .files-wide .uploader { width:260px; }
1011
+ .files .uploader .file-row-info,
1012
+ .files-wide .uploader .file-row-info,
1013
+ .files .uploader .file-row-narrow,
1014
+ .files-wide .uploader .file-row-narrow { margin:0 !important; }
1015
+
1016
+ td.input-price { white-space:nowrap; }
1017
+ td.input-price .validation-advice { white-space:normal; }
1018
+ td.input-price input.input-text { width:4em !important; }
1019
+
1020
+ input.sort { width:4em !important; }
1021
+ input.downloads { width:6.5em !important; }
1022
+
1023
+ /* CUSTOMER
1024
+ *******************************************************************************/
1025
+
1026
+ /* Addresses */
1027
+ .address-list { width:28em; padding-right:22px; }
1028
+ .address-list address { width:100%; overflow:hidden; }
1029
+ .address-list .btn-edit-address,
1030
+ .address-list .btn-remove-address { position:absolute; top:8px; }
1031
+ .address-list .btn-edit-address { right:8px; }
1032
+ .address-list .btn-remove-address { right:27px; }
1033
+ .address-list li { position:relative; padding:12px 14px; cursor:pointer; border-top:1px solid #e6e6e6; background:url(images/address_list_li.gif) repeat; }
1034
+ .address-list li.on { background:#e7efef; }
1035
+ .address-list li.over { background-color:#fcf5dd; }
1036
+ .address-list li table { width:100%; }
1037
+ .delete-address { float:right; margin:0 0 10px 10px; }
1038
+ .address-type .address-type-line { display:block; margin:2px 0; }
1039
+ .address-type .address-type-line input { margin-right:3px; }
1040
+
1041
+
1042
+
1043
+ /* NEWSLETTER
1044
+ *******************************************************************************/
1045
+ .template-preview { width:100%; height:200px; background-color:#fff; }
1046
+
1047
+
1048
+ /* SYSTEM
1049
+ *******************************************************************************/
1050
+ .stores-tree td { padding-top:3px !important; padding-bottom:3px !important; }
1051
+ .stores-tree td.label label { display:inline; width:auto; padding-right:10px; }
1052
+ .stores-tree td.website-label label { font-weight:bold; }
1053
+ .stores-tree td.store-group-label label { font-weight:bold; padding-left:15px; }
1054
+ .stores-tree td.store-label label { padding-left:30px; }
1055
+ .stores-tree .buttons-set { margin:10px 0; }
1056
+
1057
+ .log-details { border:1px solid #d6d6d6; padding:15px; background:#fafafa; margin:0 0 15px; }
1058
+ .log-details table { width:100%; }
1059
+ .log-details table th,
1060
+ .log-details table td { padding-top:4px; padding-bottom:4px; vertical-align:middle; }
1061
+ .log-details table th { font-weight:bold; padding-right:30px; white-space:nowrap; }
1062
+
1063
+ /* Configuration */
1064
+ /*fieldset.config td { padding-top:5px; padding-bottom:5px; }
1065
+ fieldset.config input.input-text { width:250px; }
1066
+ fieldset.config select.select { width:256px; }*/
1067
+ div.tree_item,
1068
+ div.tree_item_last { background-position:left; background-repeat:no-repeat; padding-left:20px; }
1069
+ div.tree_item { background-image:url(images/tree_icons/join.gif); }
1070
+ div.tree_item_last { background-image:url(images/tree_icons/joinbottom.gif); }
1071
+ div.tree_line { position:absolute; left:0; background-image:url(images/tree_icons/line.gif); }
1072
+ img.attribute-global { width:16px; height:16px; vertical-align:middle; }
1073
+
1074
+ ul.config-tabs { border-top:none; }
1075
+ ul.config-tabs dt {
1076
+ border-top:1px solid #849ba3;
1077
+ background:#d1dedf url(images/config_tab_dt_bg.gif) no-repeat 0 50%;
1078
+ padding:2px 0 2px 1.5em;
1079
+ font-weight:bold;
1080
+ text-transform:uppercase;
1081
+ color:#306375;
1082
+ }
1083
+ ul.config-tabs dl { margin-bottom:16px; }
1084
+ ul.config-tabs a.last span { background-image:none; }
1085
+
1086
+ .inline-table { border:0 !important; }
1087
+ .inline-table td { border:0 !important; padding:0 5px 5px !important; }
1088
+
1089
+ .system-fieldset-sub-head td { padding:20px 5px 5px 5px; }
1090
+ .system-fieldset-sub-head h4 { border-bottom:1px solid #ccc; margin:0; }
1091
+
1092
+ .system-tooltip-wrap { float:left; }
1093
+ .system-tooltip-box { border-left:1px solid #ccc; float:left; line-height:16px; margin-left:5px; padding-left:5px; width:180px; }
1094
+ .system-tooltip-small { clear:both; border:none; margin:0; padding:5px; width:100%; }
1095
+
1096
+ .comment { padding:5px; }
1097
+
1098
+ /* Import/export */
1099
+
1100
+ #profile-generator select { width:207px; }
1101
+ #profile-generator input.input-text { width:200px; }
1102
+ .field-row .with-tip {display:block; margin-left:150px; }
1103
+ .field-row .with-tip input {float:none; }
1104
+ .field-row .with-tip small {display:block;padding-top:2px; }
1105
+
1106
+ #profile-generator .field-row button.delete {vertical-align:middle; }
1107
+ #profile-generator fieldset button.add {display:inline; margin:0; }
1108
+
1109
+ /** Product mass attribute update **/
1110
+
1111
+ .attribute-change-checkbox { white-space:nowrap; clear:none; margin-left:5px; }
1112
+
1113
+ .attribute-change-checkbox label{ margin-left:5px; float:none !important; }
1114
+
1115
+ /* PopUp Calendar */
1116
+ .calendar { z-index:105; }
1117
+
1118
+ /** Order view **/
1119
+ .order-history { width:70%; margin-right:27px; }
1120
+
1121
+ ul.super-product-attributes { padding-left:15px; }
1122
+
1123
+ /** Media Library **/
1124
+ .uploader .file-row { width:600px; padding:0.5em 0.6em; margin:0.5em 0.6em; border:1px solid #ccc; background-color:#f9f9f9; /*vertical-align:middle;*/ }
1125
+ .uploader .file-row-narrow { width: auto; margin: 0 0 2px 40px; }
1126
+ .uploader .file-row .file-info { float:left; }
1127
+ /*.uploader .file-row .file-info-name { with: 80%; overflow: hidden; }
1128
+ .uploader .file-row .file-info-size { width: 20%; }*/
1129
+ .uploader .file-row-info { margin: 0 0 0 10px; }
1130
+ .uploader .file-row-info .file-info-name { font-weight:bold; }
1131
+ .uploader .file-row .progress-text { float:right; font-weight:bold; }
1132
+ .uploader .file-row .delete-button { float:right; }
1133
+ .uploader .buttons { float:left; }
1134
+ .uploader .flex { float:right; }
1135
+ .uploader .progress { border:1px solid #f0e6b7; background-color:#feffcc; }
1136
+ .uploader .error { border:1px solid #aa1717; background-color:#ffe6de; }
1137
+ .uploader .error .progress-text { padding-right:10px; }
1138
+ .uploader .complete { border:1px solid #90c898; background-color:#e5ffed; }
1139
+
1140
+ .grid tr.read { background:#fff !important; }
1141
+ .grid tr.unread { background:#fcf6f5 !important; }
1142
+ .grid-row-title { color:#444; font-weight:bold; }
1143
+ .grid-severity-closed{
1144
+ background:#A1A1A1;
1145
+ color:#FFFFFF;
1146
+ display:block;
1147
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
1148
+ height:16px;
1149
+ margin:1px 0;
1150
+ padding:0 0 0 7px;
1151
+ text-align:center;
1152
+ text-transform:uppercase;
1153
+ white-space:nowrap;
1154
+ }
1155
+ .grid-severity-progess{
1156
+ background:#5589C5;
1157
+ color:#FFFFFF;
1158
+ display:block;
1159
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
1160
+ height:16px;
1161
+ margin:1px 0;
1162
+ padding:0 0 0 7px;
1163
+ text-align:center;
1164
+ text-transform:uppercase;
1165
+ white-space:nowrap;
1166
+ }
1167
+ .grid-severity-approval{
1168
+ background:#FF9C00;
1169
+ color:#FFFFFF;
1170
+ display:block;
1171
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
1172
+ height:16px;
1173
+ margin:1px 0;
1174
+ padding:0 0 0 7px;
1175
+ text-align:center;
1176
+ text-transform:uppercase;
1177
+ white-space:nowrap;
1178
+ }
1179
+ .grid-severity-Yes{
1180
+ background:#E41101;
1181
+ color:#FFFFFF;
1182
+ display:block;
1183
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
1184
+ height:16px;
1185
+ margin:1px 0;
1186
+ padding:0 0 0 7px;
1187
+ text-align:center;
1188
+ text-transform:uppercase;
1189
+ white-space:nowrap;
1190
+ }
1191
+ .grid-severity-No{
1192
+ background:#3CB861;
1193
+ color:#FFFFFF;
1194
+ display:block;
1195
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
1196
+ height:16px;
1197
+ margin:1px 0;
1198
+ padding:0 0 0 7px;
1199
+ text-align:center;
1200
+ text-transform:uppercase;
1201
+ white-space:nowrap;
1202
+ }
1203
+ .grid-severity-needed{
1204
+ background:#E41101;
1205
+ color:#FFFFFF;
1206
+ display:block;
1207
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
1208
+ height:16px;
1209
+ margin:1px 0;
1210
+ padding:0 0 0 7px;
1211
+ text-align:center;
1212
+ text-transform:uppercase;
1213
+ white-space:nowrap;
1214
+ }
1215
+ .grid-severity-open{
1216
+ background:#3CB861;
1217
+ color:#FFFFFF;
1218
+ display:block;
1219
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
1220
+ height:16px;
1221
+ margin:1px 0;
1222
+ padding:0 0 0 7px;
1223
+ text-align:center;
1224
+ text-transform:uppercase;
1225
+ white-space:nowrap;
1226
+ }
1227
+ .grid-severity-reply{
1228
+ background:#F55600;
1229
+ color:#FFFFFF;
1230
+ display:block;
1231
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
1232
+ height:16px;
1233
+ margin:1px 0;
1234
+ padding:0 0 0 7px;
1235
+ text-align:center;
1236
+ text-transform:uppercase;
1237
+ white-space:nowrap;
1238
+ }
1239
+ .grid-severity-critical,
1240
+ .grid-severity-critical span,
1241
+ .grid-severity-major,
1242
+ .grid-severity-major span,
1243
+ .grid-severity-minor,
1244
+ .grid-severity-minor span,
1245
+ .grid-severity-notice,
1246
+ .grid-severity-notice span { display:block; height:16px; background-image:url(images/bg_notifications.gif); background-repeat:no-repeat; font:bold 10px/16px Arial, Helvetica, sans-serif; text-transform:uppercase; text-align:center; padding:0 0 0 7px; margin:1px 0; white-space:nowrap; color:#fff; }
1247
+ .grid-severity-critical { background-position:0 0; }
1248
+ .grid-severity-critical span { background-position:100% 0; padding:0 7px 0 0; }
1249
+ .grid-severity-major { background-position:0 -16px; }
1250
+ .grid-severity-major span { background-position:100% -16px; padding:0 7px 0 0; }
1251
+ .grid-severity-minor { background-position:0 -32px; }
1252
+ .grid-severity-minor span { background-position:100% -32px; padding:0 7px 0 0; }
1253
+ .grid-severity-notice { background-position:0 -48px; }
1254
+ .grid-severity-notice span { background-position:100% -48px; padding:0 7px 0 0; }
1255
+
1256
+ .super-attributes { margin:0; padding:0; }
1257
+ .super-attributes li.attribute { border:1px solid #dfdfdf; background-color:#ededed; margin:1px 0; }
1258
+ .super-attributes li.attribute ul.attribute-values { margin:0; padding:0; }
1259
+ .super-attributes li.attribute div.values-container { width:80%; margin-top:2px; margin-bottom:2px; }
1260
+ .super-attributes li.attribute-value { display:block; margin:1px 0; }
1261
+ .super-attributes li.attribute-value .validation-advice { margin:0; white-space:normal; }
1262
+ .super-attributes li.attribute-value .attribute-value-label-container { width:200px; }
1263
+
1264
+ .super-attributes div.attribute-name-container,
1265
+ .super-attributes li.attribute div.values-container,
1266
+ .configurable-simple-product div.values-container,
1267
+ .super-attributes li.attribute-value .attribute-values-container,
1268
+ .configurable-simple-product .attribute-values-container,
1269
+ .super-attributes li.attribute-value .attribute-values-container-main,
1270
+ .configurable-simple-product .attribute-values-container-main,
1271
+ .super-attributes li.attribute-value .attribute-value-label-container { display:block; }
1272
+
1273
+ .super-attributes li.attribute-value .attribute-price,
1274
+ .configurable-simple-product .attribute-price { width:70px !important; }
1275
+
1276
+ .super-attributes li.attribute-value .attribute-price-type,
1277
+ .configurable-simple-product .attribute-price-type { width:70px !important; }
1278
+
1279
+ .super-attributes div.attribute-name-container {
1280
+ cursor:move;
1281
+ background-image:url(images/arrow_sort_move.gif);
1282
+ background-repeat:no-repeat;
1283
+ background-position:4px 50%;
1284
+ font-weight:bold;
1285
+ padding-left:15px;
1286
+ margin-top:2px;
1287
+ margin-bottom:2px;
1288
+ }
1289
+
1290
+
1291
+ /** Product Gallery Image Previews **/
1292
+ .preview .cell-image .place-holder { border:1px solid #AEAEAE; width:100px; height:100px; text-align:center; }
1293
+ .preview .cell-image .place-holder span { margin-top:30px;display:block; }
1294
+ .preview .cell-position input.input-text { width:90% !important; }
1295
+ .fieldset-wide .data .preview .cell-position input.input-text { width:90% !important; }
1296
+
1297
+ .tier .data { width:465px; }
1298
+ .tier .data select { width:99%; }
1299
+ .tier .data input.qty { width:20px !important; }
1300
+
1301
+ .weee .data { width:465px; }
1302
+ .weee .data select { width:99%; }
1303
+
1304
+ .giftcard-amounts .data { width:465px; }
1305
+ .giftcard-amounts .data select { width:99%; }
1306
+
1307
+ /* Links */
1308
+ .link-feed { background:url(images/icon_feed.gif) no-repeat left 2px; padding-left:18px; }
1309
+
1310
+ #page-help-link {
1311
+ line-height:26px;
1312
+ padding-left:20px;
1313
+ color:#ebebff;
1314
+ background:url(images/fam_help.gif) no-repeat 0 50%;
1315
+ }
1316
+ #page-help-link:link, #page-help-link:visited { text-decoration:none; }
1317
+ #page-help-link:hover { color:white; }
1318
+
1319
+ /* Magento Connect Package Extensions */
1320
+ .table-editable { border:solid 1px #ccc; background:#fafafa; padding:5px; margin-bottom:5px; }
1321
+ .table-editable th { border-bottom:solid 1px #ccc; text-align:center; }
1322
+ .table-editable th, .table-editable td { padding:1px 3px; vertical-align:middle; }
1323
+ .table-editable select { height:19px; }
1324
+
1325
+
1326
+ /* CMS
1327
+ *******************************************************************************/
1328
+ .breadcrumbs { margin: 0 0 10px; }
1329
+ .breadcrumbs li { display:inline; }
1330
+ .breadcrumbs li span { margin:0 2px; }
1331
+
1332
+ /*table.mceLayout { width:100% !important; }*/
1333
+
1334
+ /* CMS Widgets Instance */
1335
+ .options-box .option-box { border:1px solid #cddddd; padding:1em; background:#e7efef; margin:1.5em 0; }
1336
+ .options-box .option-title { padding:0 0 10px; border-bottom:1px solid #cddddd; }
1337
+ .options-box .option-title button { float:right; }
1338
+ .options-box .option-title label {font-weight:bold; line-height:21px; padding-right:1em; float:left; }
1339
+ .options-box .option-title select { float:left; width:260px; vertical-align:middle; }
1340
+ .options-box .option-header { margin:5px 0 0; width:100%; border:0; background:#e7efef; border-bottom:1em solid #e7efef; }
1341
+ .options-box .option-header .input-text,
1342
+ .options-box .option-header select { width:95%; }
1343
+ .options-box .option-header th { padding:2px; }
1344
+ .options-box .option-header td { padding:5px 2px; }
1345
+ .options-box .option-header .tree { margin:5px 0 0; }
1346
+
1347
+ /* CMS Popup Window */
1348
+ .popup-window .table_window { border:none; }
1349
+ .popup-window .magento_nw,
1350
+ .popup-window .magento_n,
1351
+ .popup-window .magento_ne { height:28px; }
1352
+ .popup-window { border:1px solid #555; }
1353
+ .popup-window .bot { display:none; }
1354
+ .popup-window .top { background-color:#fff; background-image:none; }
1355
+ .popup-window .top td { background:url(images/window_top.png) repeat-x; border-bottom:1px solid #e6e6e6; }
1356
+ .popup-window .magento_w,
1357
+ .popup-window .magento_e,
1358
+ .popup-window .magento_content { background:url(images/window_content.png) repeat-x 0 0 #fafafa; }
1359
+ .popup-window .title_window { color:#fff; font-family:Arial, Helvetica, sans-serif; font-size:12px; height:auto; line-height:28px; margin:0; }
1360
+ .popup-window .magento_close { background-image:url(images/window_close.png); height:16px; right:7px; top:5px; width:16px; }
1361
+ .popup-window .magento_message { padding:0 18px; }
1362
+ .popup-window .content-header { font-family:Arial, Helvetica, sans-serif; padding-top:9px; }
1363
+ .popup-window .content-header h3 { color:#eb5e00; padding:0; }
1364
+ .popup-window { height:auto !important; }
1365
+ .popup-window .grid { position:static; }
1366
+ .popup-window .table_window td.value2 .grid td,
1367
+ .popup-window .table_window td.value2 .grid th { padding:2px 4px !important; }
1368
+ .popup-window .table_window td.value2 .grid tr.headings th { padding:1px 4px 2px !important; }
1369
+ .popup-window .columns { background-image:none; }
1370
+ .popup-window .middle { background:none; padding:10px 0; }
1371
+
1372
+ .popup-window .uploader .file-row { margin:16px 0; width:auto; }
1373
+ .popup-window #contents-uploader { margin-bottom:10px; background:#d7e5ef; padding:5px 10px; }
1374
+ .popup-window #contents-uploader .flex { font-size:0; line-height:0; height:20px; }
1375
+ .popup-window #contents { margin-left:-3px; height:400px; overflow:auto; position:relative; }
1376
+ .popup-window #contents .filecnt { float:left; border:1px solid #ccc; cursor:pointer; padding:3px; display:inline; margin:0 0 15px 4px; overflow:hidden; position:relative; width:100px; }
1377
+ .popup-window #contents .selected { border:1px solid #f1af73; background:#f0f0f0; cursor:default; }
1378
+ .popup-window #contents .nm { text-align:center; }
1379
+ .popup-window #contents .nm img { vertical-align:bottom; }
1380
+
1381
+ /* Widget Insert */
1382
+ #widget_window .magento_content { height:auto !important; min-height:450px; }
1383
+
1384
+ /* CMS Widget Chooser */
1385
+ #widget-chooser .columns { background-image:none; }
1386
+ #widget-chooser .magento_message { padding:10px 18px; }
1387
+ #widget-chooser .grid th,
1388
+ #widget-chooser .grid td { padding:2px 4px 2px 4px; }
1389
+ #widget-chooser .grid tr.filter th { padding-top:5px; padding-bottom:5px; }
1390
+ #widget-chooser .side-col { padding-top:0.5em; }
1391
+ #widget-chooser .main-col { padding-right:4px; }
1392
+
1393
+ /* CMS Variables Popup */
1394
+ #variables-chooser .magento_message { padding:10px 18px; }
1395
+
1396
+ /* Product description WYSIWYG editor */
1397
+ #catalog-wysiwyg-editor .buttons-set { margin-top:10px; }
1398
+ #catalog-wysiwyg-editor .magento_content { height:auto !important; overflow:hidden; }
1399
+ #catalog-wysiwyg-editor .textarea { width:930px !important; }
1400
+ #catalog-wysiwyg-editor .magento_message { padding:0 7px; }
1401
+ #catalog-wysiwyg-editor .magento_buttons { padding-left:7px; padding-right:7px; }
1402
+
1403
+
1404
+ /*****************************************/
1405
+ /******** ALIGNMENTS AND CLEARS **********/
1406
+ /*****************************************/
1407
+
1408
+ /* Directional and spacial */
1409
+ .f-left, .left { float:left; }
1410
+ .f-right, .right { float:right; }
1411
+ .v-top { vertical-align:top; }
1412
+ .v-middle { vertical-align:middle !important; }
1413
+ .v-bottom { vertical-align:bottom; }
1414
+ .a-left { text-align:left !important; }
1415
+ .a-center { text-align:center !important; }
1416
+ .a-right { text-align:right !important; }
1417
+ .nm { margin:0 !important; }
1418
+ .np { padding:0 !important; }
1419
+ .no-display { display:none; }
1420
+ .no-show { display:none; }
1421
+ .nowrap, .nobr { white-space:nowrap; }
1422
+ .wrap { white-space:normal !important; }
1423
+ .no-float { float:none !important; }
1424
+ .pointer { cursor:pointer; }
1425
+
1426
+ /* Color */
1427
+ .emph, .accent { color:#eb5e00 !important; }
1428
+ .subdue { color:#306375; }
1429
+
1430
+ /* Font */
1431
+ .bold { font-weight:bold !important; }
1432
+ .normal { font-weight:normal !important; }
1433
+
1434
+ /* Clear */ /* This keeps our HTML free of buncha clearing elements */
1435
+ .message-popup .message-popup-head:after,
1436
+ .message-popup .message-popup-content .message:after,
1437
+ .login-form .form-buttons:after,
1438
+ .wrapper:after,
1439
+ .option-title:after,
1440
+ .columns:after,
1441
+ .main-col:after,
1442
+ .content-header-floating:after,
1443
+ .entry-edit .entry-edit-head:after,
1444
+ .content-header:after,
1445
+ .login-box .button-set:after,
1446
+ ul.tabs-horiz:after,
1447
+ .header-top:after,
1448
+ dl.accordion dt:after,
1449
+ .field-100:after,
1450
+ .entry-edit fieldset li:after,
1451
+ .entry-edit fieldset span.field-row:after,
1452
+ .content:after,
1453
+ #topnav:after,
1454
+ .main:after,
1455
+ .container:after,
1456
+ .footer:after,
1457
+ .middle:after,
1458
+ .header:after,
1459
+ .box-head:after,
1460
+ div.actions:after,
1461
+ .tier-container:after,
1462
+ .clear:after,
1463
+ .notification-global:after,
1464
+ .files .row:after,
1465
+ .files-wide .row:after,
1466
+ .grid tr.filter .range .range-line:after { display:block; clear:both; content:"."; font-size:0; line-height:0; height:0; overflow:hidden; }
skin/adminhtml/default/default/css/magestore/supportticket.css ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ .grid-severity-closed{
4
+ background:#A1A1A1;
5
+ color:#FFFFFF;
6
+ display:block;
7
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
8
+ height:16px;
9
+ margin:1px 0;
10
+ padding:0 0 0 7px;
11
+ text-align:center;
12
+ text-transform:uppercase;
13
+ white-space:nowrap;
14
+ }
15
+ .grid-severity-progess{
16
+ background:#5589C5;
17
+ color:#FFFFFF;
18
+ display:block;
19
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
20
+ height:16px;
21
+ margin:1px 0;
22
+ padding:0 0 0 7px;
23
+ text-align:center;
24
+ text-transform:uppercase;
25
+ white-space:nowrap;
26
+ }
27
+ .grid-severity-approval{
28
+ background:#FF9C00;
29
+ color:#FFFFFF;
30
+ display:block;
31
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
32
+ height:16px;
33
+ margin:1px 0;
34
+ padding:0 0 0 7px;
35
+ text-align:center;
36
+ text-transform:uppercase;
37
+ white-space:nowrap;
38
+ }
39
+ .grid-severity-Yes{
40
+ background:#E41101;
41
+ color:#FFFFFF;
42
+ display:block;
43
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
44
+ height:16px;
45
+ margin:1px 0;
46
+ padding:0 0 0 7px;
47
+ text-align:center;
48
+ text-transform:uppercase;
49
+ white-space:nowrap;
50
+ }
51
+ .grid-severity-No{
52
+ background:#3CB861;
53
+ color:#FFFFFF;
54
+ display:block;
55
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
56
+ height:16px;
57
+ margin:1px 0;
58
+ padding:0 0 0 7px;
59
+ text-align:center;
60
+ text-transform:uppercase;
61
+ white-space:nowrap;
62
+ }
63
+ .grid-severity-needed{
64
+ background:#E41101;
65
+ color:#FFFFFF;
66
+ display:block;
67
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
68
+ height:16px;
69
+ margin:1px 0;
70
+ padding:0 0 0 7px;
71
+ text-align:center;
72
+ text-transform:uppercase;
73
+ white-space:nowrap;
74
+ }
75
+ .grid-severity-open{
76
+ background:#3CB861;
77
+ color:#FFFFFF;
78
+ display:block;
79
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
80
+ height:16px;
81
+ margin:1px 0;
82
+ padding:0 0 0 7px;
83
+ text-align:center;
84
+ text-transform:uppercase;
85
+ white-space:nowrap;
86
+ }
87
+ .grid-severity-reply{
88
+ background:#F55600;
89
+ color:#FFFFFF;
90
+ display:block;
91
+ font:bold 10px/16px Arial,Helvetica,sans-serif;
92
+ height:16px;
93
+ margin:1px 0;
94
+ padding:0 0 0 7px;
95
+ text-align:center;
96
+ text-transform:uppercase;
97
+ white-space:nowrap;
98
+ }
99
+
100
+ .tooltip-ticket-detail{width:800px;min-height:100px;padding:10px 20px 10px 20px;border:2px solid #ED6502;background:#FCF5DD}
skin/adminhtml/default/default/css/tinybox/images/preload.gif ADDED
Binary file
skin/adminhtml/default/default/css/tinybox/images/rhino.jpg ADDED
Binary file
skin/adminhtml/default/default/css/tinybox/style.css ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ body {height:100%; margin:0px; padding:0}
2
+
3
+ #tinybox {position:absolute; display:none; padding:10px; background:#fff url(images/preload.gif) no-repeat 50% 50%; border:10px solid #e3e3e3; z-index:2000}
4
+ #tinymask {position:absolute; display:none; top:0; left:0; height:100%; width:100%; background:#000; z-index:1500}
5
+ #tinycontent {background:#fff}
6
+
7
+ .button {margin-bottom:10px; padding:8px 10px 9px; border:1px solid #ccc; background:#eee; cursor:pointer}
8
+ .button:hover {border:1px solid #bbb; background:#e3e3e3}
skin/frontend/default/default/css/magestore/supportticket.css ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .supportticket .box-account
2
+ {
3
+ margin-top:15px;
4
+ }
5
+
6
+ .supportticket .box-account .box-head h2
7
+ {
8
+ padding-left:0;
9
+ text-transform:none;
10
+ }
11
+ .supportticket #department_description
12
+ {
13
+ margin-top:10px;
14
+ }
15
+
16
+ .tooltip-ticket-detail{width:800px;min-height:100px;padding:10px 20px 10px 20px;border:2px solid #ED6502;background:#FCF5DD}