straker-translations-easy-translation-platform - Version 0.2.0

Version Notes

Initial development version

Download this release

Release Info

Developer Chris
Extension straker-translations-easy-translation-platform
Version 0.2.0
Comparing to
See all releases


Version 0.2.0

Files changed (127) hide show
  1. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job.php +19 -0
  2. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Category.php +30 -0
  3. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Category/Grid.php +188 -0
  4. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Grid.php +116 -0
  5. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Product.php +30 -0
  6. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Product/Grid.php +188 -0
  7. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute.php +6 -0
  8. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Attribute.php +6 -0
  9. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Confirm.php +40 -0
  10. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Confirm/Grid.php +108 -0
  11. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Tree.php +252 -0
  12. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Confirm.php +42 -0
  13. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Confirm/Grid.php +150 -0
  14. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products.php +53 -0
  15. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Attribute.php +6 -0
  16. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Confirm.php +41 -0
  17. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Confirm/Grid.php +150 -0
  18. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Grid.php +199 -0
  19. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Register.php +31 -0
  20. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Selectstore.php +6 -0
  21. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Setupstore.php +24 -0
  22. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Type.php +20 -0
  23. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Backupbutton.php +50 -0
  24. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Button.php +50 -0
  25. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Restorebutton.php +50 -0
  26. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Action.php +15 -0
  27. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Backend.php +37 -0
  28. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Dispute.php +11 -0
  29. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Frontend.php +32 -0
  30. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Path.php +17 -0
  31. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Quote.php +22 -0
  32. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Refresh.php +12 -0
  33. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Status.php +32 -0
  34. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Update.php +12 -0
  35. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Version.php +14 -0
  36. app/code/community/StrakerTranslations/EasyTranslationPlatform/Helper/Data.php +23 -0
  37. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Actionlog.php +39 -0
  38. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Api.php +236 -0
  39. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Category/Attributes.php +16 -0
  40. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Category/Translate.php +45 -0
  41. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job.php +470 -0
  42. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Category.php +16 -0
  43. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Product.php +16 -0
  44. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Status.php +16 -0
  45. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Type.php +16 -0
  46. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Product/Attributes.php +16 -0
  47. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Product/Translate.php +45 -0
  48. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Actionlog.php +16 -0
  49. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Actionlog/Collection.php +17 -0
  50. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Attributes.php +16 -0
  51. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Attributes/Collection.php +16 -0
  52. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Translate.php +16 -0
  53. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Translate/Collection.php +16 -0
  54. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job.php +45 -0
  55. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Category.php +16 -0
  56. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Category/Collection.php +16 -0
  57. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Collection.php +16 -0
  58. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Product.php +16 -0
  59. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Product/Collection.php +16 -0
  60. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Status.php +16 -0
  61. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Status/Collection.php +16 -0
  62. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Type.php +16 -0
  63. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Type/Collection.php +16 -0
  64. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Attributes.php +16 -0
  65. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Attributes/Collection.php +16 -0
  66. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Translate.php +16 -0
  67. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Translate/Collection.php +16 -0
  68. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/JobController.php +123 -0
  69. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/NewController.php +196 -0
  70. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/ProductController.php +63 -0
  71. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/CategoryController.php +197 -0
  72. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/JobController.php +123 -0
  73. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/NewController.php +211 -0
  74. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/ProductController.php +185 -0
  75. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/CallbackController.php +45 -0
  76. app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/adminhtml.xml +67 -0
  77. app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/config.xml +126 -0
  78. app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/system.xml +141 -0
  79. app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/mysql4-install-0.1.0.php +132 -0
  80. app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/mysql4-upgrade-0.1.0-0.2.0.php +63 -0
  81. app/design/adminhtml/default/straker/layout/straker.xml +64 -0
  82. app/design/adminhtml/default/straker/template/straker/job.phtml +33 -0
  83. app/design/adminhtml/default/straker/template/straker/job/category.phtml +36 -0
  84. app/design/adminhtml/default/straker/template/straker/job/category/massaction.phtml +87 -0
  85. app/design/adminhtml/default/straker/template/straker/job/product.phtml +36 -0
  86. app/design/adminhtml/default/straker/template/straker/job/product/massaction.phtml +87 -0
  87. app/design/adminhtml/default/straker/template/straker/new/attributes.phtml +31 -0
  88. app/design/adminhtml/default/straker/template/straker/new/category/attributes.phtml +34 -0
  89. app/design/adminhtml/default/straker/template/straker/new/category/confirm.phtml +37 -0
  90. app/design/adminhtml/default/straker/template/straker/new/category/tree.phtml +134 -0
  91. app/design/adminhtml/default/straker/template/straker/new/confirm.phtml +35 -0
  92. app/design/adminhtml/default/straker/template/straker/new/products.phtml +30 -0
  93. app/design/adminhtml/default/straker/template/straker/new/products/attributes.phtml +31 -0
  94. app/design/adminhtml/default/straker/template/straker/new/products/confirm.phtml +37 -0
  95. app/design/adminhtml/default/straker/template/straker/new/products/massaction.phtml +87 -0
  96. app/design/adminhtml/default/straker/template/straker/new/register.phtml +38 -0
  97. app/design/adminhtml/default/straker/template/straker/new/selectstore.phtml +34 -0
  98. app/design/adminhtml/default/straker/template/straker/new/setupstore.phtml +59 -0
  99. app/design/adminhtml/default/straker/template/straker/new/type.phtml +7 -0
  100. app/design/adminhtml/default/straker/template/straker/system/config/button.phtml +2 -0
  101. app/etc/modules/StrakerTranslations_EasyTranslationPlatform.xml +9 -0
  102. js/straker/livepipe/livepipe.js +181 -0
  103. js/straker/livepipe/window.js +947 -0
  104. js/straker/translations.js +6 -0
  105. package.xml +18 -0
  106. skin/adminhtml/default/straker/css/straker.css +434 -0
  107. skin/adminhtml/default/straker/css/straker.less +360 -0
  108. skin/adminhtml/default/straker/images/default/bottom_left.gif +0 -0
  109. skin/adminhtml/default/straker/images/default/bottom_mid.gif +0 -0
  110. skin/adminhtml/default/straker/images/default/bottom_right.gif +0 -0
  111. skin/adminhtml/default/straker/images/default/bottom_right_resize.gif +0 -0
  112. skin/adminhtml/default/straker/images/default/center_left.gif +0 -0
  113. skin/adminhtml/default/straker/images/default/center_right.gif +0 -0
  114. skin/adminhtml/default/straker/images/default/clear.gif +0 -0
  115. skin/adminhtml/default/straker/images/default/close.gif +0 -0
  116. skin/adminhtml/default/straker/images/default/inspect.gif +0 -0
  117. skin/adminhtml/default/straker/images/default/maximize.gif +0 -0
  118. skin/adminhtml/default/straker/images/default/minimize.gif +0 -0
  119. skin/adminhtml/default/straker/images/default/overlay.png +0 -0
  120. skin/adminhtml/default/straker/images/default/resize.gif +0 -0
  121. skin/adminhtml/default/straker/images/default/sizer.gif +0 -0
  122. skin/adminhtml/default/straker/images/default/top_left.gif +0 -0
  123. skin/adminhtml/default/straker/images/default/top_mid.gif +0 -0
  124. skin/adminhtml/default/straker/images/default/top_right.gif +0 -0
  125. skin/adminhtml/default/straker/images/magento-banner.jpg +0 -0
  126. skin/adminhtml/default/straker/images/refresh_32.png +0 -0
  127. skin/adminhtml/default/straker/images/straker-translations-logo.png +0 -0
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job extends Mage_Adminhtml_Block_Widget_Container{
3
+ public function __construct()
4
+ {
5
+ parent::__construct();
6
+ $this->setTemplate('straker/job.phtml');
7
+ }
8
+
9
+ protected function _prepareLayout()
10
+ {
11
+ $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_grid', 'job.grid'));
12
+ return parent::_prepareLayout();
13
+ }
14
+
15
+ public function getGridHtml()
16
+ {
17
+ return $this->getChildHtml('grid');
18
+ }
19
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Category.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Category extends Mage_Adminhtml_Block_Widget_Container{
3
+ public function __construct()
4
+ {
5
+ parent::__construct();
6
+ $this->setTemplate('straker/job/category.phtml');
7
+ }
8
+
9
+ protected function _prepareLayout()
10
+ {
11
+ $jobId = $this->getRequest()->getParam('job_id');
12
+ $jobStatus = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId)->getStatusId();
13
+ if ( $jobStatus == '4'){
14
+ $this->_addButton('publish', array(
15
+ 'label' => Mage::helper('catalog')->__('Publish Translation'),
16
+ 'onclick' => "setLocation('{$this->getUrl('*/*/copyAll',array('job_id'=>$jobId))}');",
17
+ 'class' => 'task'
18
+ ));
19
+ }
20
+
21
+ $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_category_grid', 'job_category.grid'));
22
+ $this->getChild('grid')->setStatusId($jobStatus);
23
+ return parent::_prepareLayout();
24
+ }
25
+
26
+ public function getGridHtml()
27
+ {
28
+ return $this->getChildHtml('grid');
29
+ }
30
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Category/Grid.php ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Category_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId('strakerJobCategoryGrid');
8
+ $this->setSaveParametersInSession(true);
9
+ }
10
+
11
+ protected function _prepareLayout()
12
+ {
13
+ $this->setChild('dispute_button',
14
+ $this->getLayout()->createBlock('adminhtml/widget_button')
15
+ ->setData(array(
16
+ 'label' => Mage::helper('catalog')->__('Feedback'),
17
+ 'onclick' => 'disputeForm.show(\''.$this->getRequest()->getParam('job_id').'\')',
18
+ 'class' => 'feedback'
19
+ ))
20
+ );
21
+
22
+ $this->setChild('grid', $this->getLayout()->createBlock('adminhtml/catalog_category_grid', 'category.grid'));
23
+ return parent::_prepareLayout();
24
+ }
25
+
26
+ protected function _prepareCollection() {
27
+
28
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
29
+ $jobAttributes = Mage::getModel('strakertranslations_easytranslationplatform/category_attributes')->getCollection()->addFieldToFilter('job_id', $job->getId());
30
+ $collection = Mage::getModel('strakertranslations_easytranslationplatform/job_category')->getCollection()->addFieldToFilter('main_table.job_id', $job->getId());
31
+
32
+ //loop through this job's attributes and join them to the collection
33
+ foreach($jobAttributes as $jobAttribute){
34
+ $attributeCode = Mage::getModel('eav/entity_attribute')->load($jobAttribute->getAttributeId())->getAttributeCode();
35
+ $collection->getSelect()->joinLeft(
36
+ array($attributeCode => 'straker_category_translate'),
37
+ $attributeCode.'.category_id = main_table.category_id AND '.$attributeCode.'.attribute_id = '.$jobAttribute->getAttributeId(). ' AND '
38
+ .$attributeCode.'.job_id = '.$job->getId(),
39
+ array($attributeCode.'_original' => 'original', $attributeCode.'_translate' => 'translate')
40
+ );
41
+ }
42
+ //echo $collection->getSelect()->__toString();
43
+ //die();
44
+ $this->setCollection($collection);
45
+ return parent::_prepareCollection();
46
+ }
47
+
48
+ protected function _prepareColumns() {
49
+ // $this->addColumn('id', array(
50
+ // 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('ID'),
51
+ // 'align' => 'right',
52
+ // 'width' => '50px',
53
+ // 'index' => 'id',
54
+ // ));
55
+
56
+ $this->addColumn('category_id', array(
57
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Category ID'),
58
+ 'align' => 'left',
59
+ 'index' => 'category_id',
60
+ ));
61
+
62
+ // $this->addColumn('job_id', array(
63
+ // 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Job ID'),
64
+ // 'align' => 'left',
65
+ // 'index' => 'job_id',
66
+ // ));
67
+
68
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
69
+ $jobAttributes = Mage::getModel('strakertranslations_easytranslationplatform/category_attributes')->getCollection()->addFieldToFilter('job_id', $job->getId());
70
+
71
+ //loop through this job's attributes and add columns to the grid
72
+ foreach($jobAttributes as $jobAttribute){
73
+ $attributeCode = Mage::getModel('eav/entity_attribute')->load($jobAttribute->getAttributeId())->getAttributeCode();
74
+ $attrModel = Mage::getModel('eav/entity_attribute')->loadByCode(3, $attributeCode);
75
+ $this->addColumn($attributeCode.'_original', array(
76
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('%s Original', $attrModel->getFrontendLabel()),
77
+ 'align' => 'left',
78
+ 'index' => $attributeCode.'_original',
79
+ ));
80
+
81
+ $this->addColumn($attributeCode.'_translate', array(
82
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('%s Translate', $attrModel->getFrontendLabel()),
83
+ 'align' => 'left',
84
+ 'index' => $attributeCode.'_translate',
85
+ ));
86
+ }
87
+
88
+ if ($this->getStatusId() == '4'){
89
+ $this->addColumn('version', array(
90
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
91
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Version',
92
+ 'align' => 'center',
93
+ 'index' => false,
94
+ 'filter' => false,
95
+ ));
96
+ }
97
+
98
+ $this->addColumn('view_frontend', array(
99
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('View Frontend'),
100
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Frontend',
101
+ 'align' => 'center',
102
+ 'index' => false,
103
+ 'filter' => false,
104
+ ));
105
+
106
+ $this->addColumn('view_backend', array(
107
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('View Backend'),
108
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Backend',
109
+ 'align' => 'center',
110
+ 'index' => false,
111
+ 'filter' => false,
112
+ ));
113
+
114
+ return parent::_prepareColumns();
115
+ }
116
+
117
+ public function getRowUrl($row) {
118
+ // return $this->getUrl('*/*/edit', array('id' => $row->getId()));
119
+ return '';
120
+ }
121
+
122
+ protected function _prepareMassaction()
123
+ {
124
+ if ($this->getStatusId() == '4') {
125
+
126
+ $this->setMassactionIdField('category_id');
127
+ $this->getMassactionBlock()->setFormFieldName('category');
128
+
129
+ $this->getMassactionBlock()->addItem('add', array(
130
+ 'label' => Mage::helper('catalog')->__('Publish Translation'),
131
+ 'url' => $this->getUrl('*/*/applyTranslation'),
132
+ 'selected' => 1
133
+ ));
134
+ $this->getMassactionBlock()->setTemplate('straker/job/category/massaction.phtml');
135
+
136
+ $hiddenParams = '<input type="hidden" name="job_id" value="' . $this->getRequest()->getParam('job_id') . '" />';
137
+ $this->getMassactionBlock()->setHiddenParams($hiddenParams);
138
+
139
+
140
+ Mage::dispatchEvent('adminhtml_strakertranslation_job_category_grid_prepare_massaction', array('block' => $this));
141
+ return $this;
142
+ }
143
+ }
144
+
145
+ protected function _prepareMassactionColumn()
146
+ {
147
+ if ($this->getStatusId() == '4') {
148
+ $columnId = 'massaction';
149
+ $massactionColumn = $this->getLayout()->createBlock('adminhtml/widget_grid_column')
150
+ ->setData(array(
151
+ 'index' => $this->getMassactionIdField(),
152
+ 'use_index' => $this->getMassactionIdField(),
153
+ 'filter_index' => $this->getMassactionIdFilter(),
154
+ 'type' => 'massaction',
155
+ 'name' => $this->getMassactionBlock()->getFormFieldName(),
156
+ 'align' => 'center',
157
+ 'is_system' => true
158
+ ));
159
+
160
+ if ($this->getNoFilterMassactionColumn()) {
161
+ $massactionColumn->setData('filter', false);
162
+ }
163
+
164
+ $massactionColumn->setSelected($this->getMassactionBlock()->getSelected())
165
+ ->setGrid($this)
166
+ ->setId($columnId);
167
+
168
+ $oldColumns = $this->_columns;
169
+ $this->_columns = array();
170
+ $this->_columns[$columnId] = $massactionColumn;
171
+ $this->_columns = array_merge($this->_columns, $oldColumns);
172
+ return $this;
173
+ }
174
+ }
175
+
176
+ public function getMainButtonsHtml()
177
+ {
178
+ $html = '';
179
+ if ($this->getStatusId() == '4') {
180
+ $html .= $this->getChildHtml('dispute_button');
181
+ }
182
+ if($this->getFilterVisibility()){
183
+ $html.= $this->getResetFilterButtonHtml();
184
+ $html.= $this->getSearchButtonHtml();
185
+ }
186
+ return $html;
187
+ }
188
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Grid.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId('strakerJobGrid');
8
+ $this->setDefaultSort('id');
9
+ $this->setDefaultDir('DESC');
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ protected function _prepareCollection() {
14
+ $collection = Mage::getModel('strakertranslations_easytranslationplatform/job')->getCollection();
15
+ $collection->getSelect()->joinLeft(
16
+ 'straker_job_type',
17
+ 'straker_job_type.type_id = main_table.type_id',
18
+ 'type_name'
19
+ );
20
+ $collection->getSelect()->joinLeft(
21
+ 'straker_job_status',
22
+ 'straker_job_status.status_id = main_table.status_id',
23
+ 'status_name'
24
+
25
+ );
26
+ $collection->getSelect()->joinLeft(
27
+ 'core_store',
28
+ 'core_store.store_id = main_table.store_id',
29
+ 'name'
30
+ );
31
+ $this->setCollection($collection);
32
+ return parent::_prepareCollection();
33
+ }
34
+
35
+ protected function _prepareColumns() {
36
+ $this->addColumn('id', array(
37
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('ID'),
38
+ 'align' => 'right',
39
+ 'width' => '50px',
40
+ 'index' => 'id',
41
+ ));
42
+
43
+ $this->addColumn('tj_number', array(
44
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Straker Ref.'),
45
+ 'align' => 'left',
46
+ 'index' => 'tj_number',
47
+ ));
48
+
49
+ $this->addColumn('created_at', array(
50
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Created At'),
51
+ 'align' => 'left',
52
+ 'type' => 'datetime',
53
+ 'index' => 'created_at',
54
+ ));
55
+
56
+ $this->addColumn('updated_at', array(
57
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Updated At'),
58
+ 'align' => 'left',
59
+ 'type' => 'datetime',
60
+ 'index' => 'updated_at',
61
+ ));
62
+
63
+ $this->addColumn('type_name', array(
64
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Type'),
65
+ 'align' => 'left',
66
+ 'index' => 'type_name',
67
+ ));
68
+
69
+ $this->addColumn('name', array(
70
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Store'),
71
+ 'align' => 'left',
72
+ 'index' => 'name',
73
+ 'filter_index' =>'core_store.name',
74
+ ));
75
+
76
+ $this->addColumn('sl', array(
77
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Language From'),
78
+ 'align' => 'left',
79
+ 'index' => 'sl',
80
+ ));
81
+
82
+ $this->addColumn('tl', array(
83
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Language To'),
84
+ 'align' => 'left',
85
+ 'index' => 'tl',
86
+ ));
87
+
88
+ $this->addColumn('refresh', array(
89
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Refresh'),
90
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Refresh',
91
+ 'align' => 'center',
92
+ 'filter' => false,
93
+ ));
94
+
95
+ $this->addColumn('status', array(
96
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Status'),
97
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Status',
98
+ 'align' => 'center',
99
+ 'filter' => false,
100
+ ));
101
+
102
+ $this->addColumn('action', array(
103
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Action'),
104
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Action',
105
+ 'align' => 'center',
106
+ 'filter' => false,
107
+ ));
108
+
109
+ return parent::_prepareColumns();
110
+ }
111
+
112
+ public function getRowUrl($row) {
113
+ return '';
114
+ }
115
+
116
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Product.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Product extends Mage_Adminhtml_Block_Widget_Container{
3
+ public function __construct()
4
+ {
5
+ parent::__construct();
6
+ $this->setTemplate('straker/job/product.phtml');
7
+ }
8
+
9
+ protected function _prepareLayout()
10
+ {
11
+ $jobId = $this->getRequest()->getParam('job_id');
12
+ $jobStatus = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId)->getStatusId();
13
+ if ( $jobStatus == '4'){
14
+ $this->_addButton('publish', array(
15
+ 'label' => Mage::helper('catalog')->__('Publish Translation'),
16
+ 'onclick' => "setLocation('{$this->getUrl('*/*/copyAll',array('job_id'=>$jobId))}');",
17
+ 'class' => 'task'
18
+ ));
19
+ }
20
+
21
+ $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_product_grid', 'job_product.grid'));
22
+ $this->getChild('grid')->setStatusId($jobStatus);
23
+ return parent::_prepareLayout();
24
+ }
25
+
26
+ public function getGridHtml()
27
+ {
28
+ return $this->getChildHtml('grid');
29
+ }
30
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Product/Grid.php ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Product_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId('strakerJobProductGrid');
8
+ $this->setSaveParametersInSession(true);
9
+ }
10
+
11
+ protected function _prepareLayout()
12
+ {
13
+ $this->setChild('dispute_button',
14
+ $this->getLayout()->createBlock('adminhtml/widget_button')
15
+ ->setData(array(
16
+ 'label' => Mage::helper('catalog')->__('Feedback'),
17
+ 'onclick' => 'disputeForm.show(\''.$this->getRequest()->getParam('job_id').'\')',
18
+ 'class' => 'feedback'
19
+ ))
20
+ );
21
+
22
+ $this->setChild('grid', $this->getLayout()->createBlock('adminhtml/catalog_product_grid', 'product.grid'));
23
+ return parent::_prepareLayout();
24
+ }
25
+
26
+ protected function _prepareCollection() {
27
+
28
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
29
+ $jobAttributes = Mage::getModel('strakertranslations_easytranslationplatform/product_attributes')->getCollection()->addFieldToFilter('job_id', $job->getId());
30
+ $collection = Mage::getModel('strakertranslations_easytranslationplatform/job_product')->getCollection()->addFieldToFilter('main_table.job_id', $job->getId());
31
+
32
+ //loop through this job's attributes and join them to the collection
33
+ foreach($jobAttributes as $jobAttribute){
34
+ $attributeCode = Mage::getModel('eav/entity_attribute')->load($jobAttribute->getAttributeId())->getAttributeCode();
35
+ $collection->getSelect()->joinLeft(
36
+ array($attributeCode => 'straker_product_translate'),
37
+ $attributeCode.'.product_id = main_table.product_id AND '.$attributeCode.'.attribute_id = '.$jobAttribute->getAttributeId(). ' AND '
38
+ .$attributeCode.'.job_id = '.$job->getId(),
39
+ array($attributeCode.'_original' => 'original', $attributeCode.'_translate' => 'translate')
40
+ );
41
+ }
42
+ //echo $collection->getSelect()->__toString();
43
+ //die();
44
+ $this->setCollection($collection);
45
+ return parent::_prepareCollection();
46
+ }
47
+
48
+ protected function _prepareColumns() {
49
+ // $this->addColumn('id', array(
50
+ // 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('ID'),
51
+ // 'align' => 'right',
52
+ // 'width' => '50px',
53
+ // 'index' => 'id',
54
+ // ));
55
+
56
+ $this->addColumn('product_id', array(
57
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Product ID'),
58
+ 'align' => 'left',
59
+ 'index' => 'product_id',
60
+ ));
61
+
62
+ // $this->addColumn('job_id', array(
63
+ // 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Job ID'),
64
+ // 'align' => 'left',
65
+ // 'index' => 'job_id',
66
+ // ));
67
+
68
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
69
+ $jobAttributes = Mage::getModel('strakertranslations_easytranslationplatform/product_attributes')->getCollection()->addFieldToFilter('job_id', $job->getId());
70
+
71
+ //loop through this job's attributes and add columns to the grid
72
+ foreach($jobAttributes as $jobAttribute){
73
+ $attributeCode = Mage::getModel('eav/entity_attribute')->load($jobAttribute->getAttributeId())->getAttributeCode();
74
+ $attrModel = Mage::getModel('eav/entity_attribute')->loadByCode(4, $attributeCode);
75
+ $this->addColumn($attributeCode.'_original', array(
76
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('%s Original', $attrModel->getFrontendLabel()),
77
+ 'align' => 'left',
78
+ 'index' => $attributeCode.'_original',
79
+ ));
80
+
81
+ $this->addColumn($attributeCode.'_translate', array(
82
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('%s Translate', $attrModel->getFrontendLabel()),
83
+ 'align' => 'left',
84
+ 'index' => $attributeCode.'_translate',
85
+ ));
86
+ }
87
+
88
+ if ($this->getStatusId() == '4'){
89
+ $this->addColumn('version', array(
90
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
91
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Version',
92
+ 'align' => 'center',
93
+ 'index' => false,
94
+ 'filter' => false,
95
+ ));
96
+ }
97
+
98
+ $this->addColumn('view_frontend', array(
99
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('View Frontend'),
100
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Frontend',
101
+ 'align' => 'center',
102
+ 'index' => false,
103
+ 'filter' => false,
104
+ ));
105
+
106
+ $this->addColumn('view_backend', array(
107
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('View Backend'),
108
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Backend',
109
+ 'align' => 'center',
110
+ 'index' => false,
111
+ 'filter' => false,
112
+ ));
113
+
114
+ return parent::_prepareColumns();
115
+ }
116
+
117
+ public function getRowUrl($row) {
118
+ // return $this->getUrl('*/*/edit', array('id' => $row->getId()));
119
+ return '';
120
+ }
121
+
122
+ protected function _prepareMassaction()
123
+ {
124
+ if ($this->getStatusId() == '4') {
125
+
126
+ $this->setMassactionIdField('product_id');
127
+ $this->getMassactionBlock()->setFormFieldName('product');
128
+
129
+ $this->getMassactionBlock()->addItem('add', array(
130
+ 'label' => Mage::helper('catalog')->__('Publish Translation'),
131
+ 'url' => $this->getUrl('*/*/applyTranslation'),
132
+ 'selected' => 1
133
+ ));
134
+ $this->getMassactionBlock()->setTemplate('straker/job/product/massaction.phtml');
135
+
136
+ $hiddenParams = '<input type="hidden" name="job_id" value="' . $this->getRequest()->getParam('job_id') . '" />';
137
+ $this->getMassactionBlock()->setHiddenParams($hiddenParams);
138
+
139
+
140
+ Mage::dispatchEvent('adminhtml_strakertranslation_job_product_grid_prepare_massaction', array('block' => $this));
141
+ return $this;
142
+ }
143
+ }
144
+
145
+ protected function _prepareMassactionColumn()
146
+ {
147
+ if ($this->getStatusId() == '4') {
148
+ $columnId = 'massaction';
149
+ $massactionColumn = $this->getLayout()->createBlock('adminhtml/widget_grid_column')
150
+ ->setData(array(
151
+ 'index' => $this->getMassactionIdField(),
152
+ 'use_index' => $this->getMassactionIdField(),
153
+ 'filter_index' => $this->getMassactionIdFilter(),
154
+ 'type' => 'massaction',
155
+ 'name' => $this->getMassactionBlock()->getFormFieldName(),
156
+ 'align' => 'center',
157
+ 'is_system' => true
158
+ ));
159
+
160
+ if ($this->getNoFilterMassactionColumn()) {
161
+ $massactionColumn->setData('filter', false);
162
+ }
163
+
164
+ $massactionColumn->setSelected($this->getMassactionBlock()->getSelected())
165
+ ->setGrid($this)
166
+ ->setId($columnId);
167
+
168
+ $oldColumns = $this->_columns;
169
+ $this->_columns = array();
170
+ $this->_columns[$columnId] = $massactionColumn;
171
+ $this->_columns = array_merge($this->_columns, $oldColumns);
172
+ return $this;
173
+ }
174
+ }
175
+
176
+ public function getMainButtonsHtml()
177
+ {
178
+ $html = '';
179
+ if ($this->getStatusId() == '4') {
180
+ $html .= $this->getChildHtml('dispute_button');
181
+ }
182
+ if($this->getFilterVisibility()){
183
+ $html.= $this->getResetFilterButtonHtml();
184
+ $html.= $this->getSearchButtonHtml();
185
+ }
186
+ return $html;
187
+ }
188
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute extends Mage_Adminhtml_Block_Widget_Container{
3
+ protected function _beforeToHtml(){
4
+ $this->setTemplate('straker/new/attributes.phtml');
5
+ }
6
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Attribute.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Category_Attribute extends Mage_Adminhtml_Block_Widget_Container{
3
+ protected function _beforeToHtml(){
4
+ $this->setTemplate('straker/new/category/attributes.phtml');
5
+ }
6
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Confirm.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Category_Confirm extends Mage_Adminhtml_Block_Widget_Container{
3
+ /**
4
+ * Set template
5
+ */
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setTemplate('straker/new/category/confirm.phtml');
10
+ }
11
+
12
+ /**
13
+ * Prepare button and grid
14
+ *
15
+ * @return Mage_Adminhtml_Block_Catalog_Product
16
+ */
17
+ protected function _prepareLayout()
18
+ {
19
+ $this->_addButton('submit', array(
20
+ 'label' => Mage::helper('catalog')->__('Submit'),
21
+ 'onclick' => "$('submit-new-job-form').submit();",
22
+ 'class' => 'task'
23
+ ));
24
+
25
+ $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_category_confirm_grid', 'category.grid', array('store' => $this->getStore(), 'attr' => $this->getAttr(), 'category' => $this->getCategory())));
26
+ return parent::_prepareLayout();
27
+ }
28
+
29
+
30
+ /**
31
+ * Render grid
32
+ *
33
+ * @return string
34
+ */
35
+ public function getGridHtml()
36
+ {
37
+ return $this->getChildHtml('grid');
38
+ }
39
+
40
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Confirm/Grid.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Category_Confirm_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('strakerCategories');
9
+ $this->setDefaultSort('entity_id');
10
+ $this->setDefaultDir('DESC');
11
+ $this->setSaveParametersInSession(true);
12
+ $this->setUseAjax(false);
13
+ $this->setVarNameFilter('category_filter');
14
+ }
15
+
16
+ protected function _getStore()
17
+ {
18
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
19
+ return Mage::app()->getStore($storeId);
20
+ }
21
+ protected function _prepareLayout()
22
+ {
23
+ return $this;
24
+ }
25
+ protected function _prepareCollection()
26
+ {
27
+ $collection = Mage::getModel('catalog/category')->getCollection()
28
+ ->addAttributeToSelect('path')
29
+ ->addAttributeToSelect('name');
30
+ $collection->addAttributeToFilter('entity_id', array('in' => $this->getCategory()));
31
+
32
+ foreach ($this->getAttrArray() as $attr){
33
+ $collection->addAttributeToSelect($attr);
34
+ }
35
+
36
+ $this->setCollection($collection);
37
+
38
+ parent::_prepareCollection();
39
+ // $this->getCollection()->addWebsiteNamesToResult();
40
+ return $this;
41
+ }
42
+
43
+ protected function _prepareColumns()
44
+ {
45
+
46
+ $this->addColumn('entity_id',
47
+ array(
48
+ 'header'=> Mage::helper('catalog')->__('ID'),
49
+ 'width' => '50px',
50
+ 'type' => 'number',
51
+ 'index' => 'entity_id',
52
+ 'filter' => false,
53
+ ));
54
+
55
+ if (in_array('name',$this->getAttrArray())) {
56
+ $this->addColumn('name',
57
+ array(
58
+ 'header' => Mage::helper('catalog')->__('Name to translate'),
59
+ 'index' => 'name',
60
+ 'filter' => false,
61
+ ));
62
+ }
63
+ else{
64
+ $this->addColumn('name',
65
+ array(
66
+ 'header' => Mage::helper('catalog')->__('Name'),
67
+ 'index' => 'name',
68
+ 'filter' => false,
69
+ ));
70
+ }
71
+
72
+ $this->addColumn('path',
73
+ array(
74
+ 'header' => Mage::helper('catalog')->__('Path'),
75
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Path',
76
+ 'index' => 'path',
77
+ 'filter' => false,
78
+ ));
79
+
80
+ foreach ($this->getAttrArray() as $attr){
81
+ if ($attr != 'name' && $attr != '') {
82
+ $attrModel = Mage::getModel('eav/entity_attribute')->loadByCode(3, $attr);
83
+ $this->addColumn($attr,
84
+ array(
85
+ 'header' => Mage::helper('catalog')->__($attrModel->getFrontendLabel()) .' to Translate',
86
+ 'index' => $attr,
87
+ 'filter' => false,
88
+ ));
89
+ }
90
+ }
91
+
92
+ return parent::_prepareColumns();
93
+ }
94
+
95
+ public function getGridUrl()
96
+ {
97
+ return $this->getUrl('*/*/confirmCategory', array('_current'=>true));
98
+ }
99
+
100
+ public function getRowUrl($row)
101
+ {
102
+ return '';
103
+ }
104
+
105
+ public function getAttrArray(){
106
+ return explode(',', $this->getAttr());
107
+ }
108
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Tree.php ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Category_Tree extends Mage_Adminhtml_Block_Catalog_Category_Tree{
3
+ public function __construct()
4
+ {
5
+ parent::__construct();
6
+ $this->setTemplate('straker/new/category/tree.phtml');
7
+ }
8
+
9
+ protected $_categoryIds;
10
+ protected $_selectedNodes = null;
11
+
12
+ /**
13
+ * Checks when this block is readonly
14
+ *
15
+ * @return boolean
16
+ */
17
+ public function isReadonly()
18
+ {
19
+ return false;
20
+ // return $this->getProduct()->getCategoriesReadonly();
21
+ }
22
+
23
+ /**
24
+ * Return array with category IDs which the product is assigned to
25
+ *
26
+ * @return array
27
+ */
28
+ protected function getCategoryIds()
29
+ {
30
+ $categories = $this->getRequest()->getParam('internal_category');
31
+ if (empty($categories)){
32
+ return array();
33
+ }
34
+ else {
35
+ return explode(',', $categories);
36
+ }
37
+ // return $this->getProduct()->getCategoryIds();
38
+ }
39
+
40
+ /**
41
+ * Forms string out of getCategoryIds()
42
+ *
43
+ * @return string
44
+ */
45
+ public function getIdsString()
46
+ {
47
+ return implode(',', $this->getCategoryIds());
48
+ }
49
+
50
+ /**
51
+ * Returns root node and sets 'checked' flag (if necessary)
52
+ *
53
+ * @return Varien_Data_Tree_Node
54
+ */
55
+ public function getRootNode()
56
+ {
57
+ $root = $this->getRoot();
58
+ if ($root && in_array($root->getId(), $this->getCategoryIds())) {
59
+ $root->setChecked(true);
60
+ }
61
+ return $root;
62
+ }
63
+
64
+ /**
65
+ * Returns root node
66
+ *
67
+ * @param Mage_Catalog_Model_Category|null $parentNodeCategory
68
+ * @param int $recursionLevel
69
+ * @return Varien_Data_Tree_Node
70
+ */
71
+ public function getRoot($parentNodeCategory = null, $recursionLevel = 3)
72
+ {
73
+ if (!is_null($parentNodeCategory) && $parentNodeCategory->getId()) {
74
+ return $this->getNode($parentNodeCategory, $recursionLevel);
75
+ }
76
+ $root = Mage::registry('root');
77
+ if (is_null($root)) {
78
+ $storeId = (int) $this->getRequest()->getParam('store');
79
+
80
+ if ($storeId) {
81
+ $store = Mage::app()->getStore($storeId);
82
+ $rootId = $store->getRootCategoryId();
83
+ }
84
+ else {
85
+ $rootId = Mage_Catalog_Model_Category::TREE_ROOT_ID;
86
+ }
87
+
88
+ $ids = $this->getSelectedCategoriesPathIds($rootId);
89
+ $tree = Mage::getResourceSingleton('catalog/category_tree')
90
+ ->loadByIds($ids, false, false);
91
+
92
+ if ($this->getCategory()) {
93
+ $tree->loadEnsuredNodes($this->getCategory(), $tree->getNodeById($rootId));
94
+ }
95
+
96
+ $tree->addCollectionData($this->getCategoryCollection());
97
+
98
+ $root = $tree->getNodeById($rootId);
99
+
100
+ if ($root && $rootId != Mage_Catalog_Model_Category::TREE_ROOT_ID) {
101
+ $root->setIsVisible(true);
102
+ if ($this->isReadonly()) {
103
+ $root->setDisabled(true);
104
+ }
105
+ }
106
+ elseif($root && $root->getId() == Mage_Catalog_Model_Category::TREE_ROOT_ID) {
107
+ $root->setName(Mage::helper('catalog')->__('Root'));
108
+ }
109
+
110
+ Mage::register('root', $root);
111
+ }
112
+
113
+ return $root;
114
+ }
115
+
116
+ /**
117
+ * Returns array with configuration of current node
118
+ *
119
+ * @param Varien_Data_Tree_Node $node
120
+ * @param int $level How deep is the node in the tree
121
+ * @return array
122
+ */
123
+ protected function _getNodeJson($node, $level = 1)
124
+ {
125
+ $item = parent::_getNodeJson($node, $level);
126
+
127
+ if ($this->_isParentSelectedCategory($node)) {
128
+ $item['expanded'] = true;
129
+ }
130
+
131
+ if (in_array($node->getId(), $this->getCategoryIds())) {
132
+ $item['checked'] = true;
133
+ }
134
+
135
+ if ($this->isReadonly()) {
136
+ $item['disabled'] = true;
137
+ }
138
+
139
+ return $item;
140
+ }
141
+
142
+ /**
143
+ * Returns whether $node is a parent (not exactly direct) of a selected node
144
+ *
145
+ * @param Varien_Data_Tree_Node $node
146
+ * @return bool
147
+ */
148
+ protected function _isParentSelectedCategory($node)
149
+ {
150
+ foreach ($this->_getSelectedNodes() as $selected) {
151
+ if ($selected) {
152
+ $pathIds = explode('/', $selected->getPathId());
153
+ if (in_array($node->getId(), $pathIds)) {
154
+ return true;
155
+ }
156
+ }
157
+ }
158
+
159
+ return false;
160
+ }
161
+
162
+ /**
163
+ * Returns array with nodes those are selected (contain current product)
164
+ *
165
+ * @return array
166
+ */
167
+ protected function _getSelectedNodes()
168
+ {
169
+ if ($this->_selectedNodes === null) {
170
+ $this->_selectedNodes = array();
171
+ $root = $this->getRoot();
172
+ foreach ($this->getCategoryIds() as $categoryId) {
173
+ if ($root) {
174
+ $this->_selectedNodes[] = $root->getTree()->getNodeById($categoryId);
175
+ }
176
+ }
177
+ }
178
+
179
+ return $this->_selectedNodes;
180
+ }
181
+
182
+ /**
183
+ * Returns JSON-encoded array of category children
184
+ *
185
+ * @param int $categoryId
186
+ * @return string
187
+ */
188
+ public function getCategoryChildrenJson($categoryId)
189
+ {
190
+ $category = Mage::getModel('catalog/category')->load($categoryId);
191
+ $node = $this->getRoot($category, 1)->getTree()->getNodeById($categoryId);
192
+
193
+ if (!$node || !$node->hasChildren()) {
194
+ return '[]';
195
+ }
196
+
197
+ $children = array();
198
+ foreach ($node->getChildren() as $child) {
199
+ $children[] = $this->_getNodeJson($child);
200
+ }
201
+
202
+ return Mage::helper('core')->jsonEncode($children);
203
+ }
204
+
205
+ /**
206
+ * Returns URL for loading tree
207
+ *
208
+ * @param null $expanded
209
+ * @return string
210
+ */
211
+ public function getLoadTreeUrl($expanded = null)
212
+ {
213
+ return $this->getUrl('*/*/categoriesJson', array('_current' => true));
214
+ }
215
+
216
+ /**
217
+ * Return distinct path ids of selected categories
218
+ *
219
+ * @param mixed $rootId Root category Id for context
220
+ * @return array
221
+ */
222
+ public function getSelectedCategoriesPathIds($rootId = false)
223
+ {
224
+ $ids = array();
225
+ $categoryIds = $this->getCategoryIds();
226
+ if (empty($categoryIds)) {
227
+ return array();
228
+ }
229
+ $collection = Mage::getResourceModel('catalog/category_collection');
230
+
231
+ if ($rootId) {
232
+ $collection->addFieldToFilter(array(
233
+ array('attribute' => 'parent_id', 'eq' => $rootId),
234
+ array('attribute' => 'entity_id', 'in' => $categoryIds)
235
+ ));
236
+ } else {
237
+ $collection->addFieldToFilter('entity_id', array('in' => $categoryIds));
238
+ }
239
+
240
+ foreach ($collection as $item) {
241
+ if ($rootId && !in_array($rootId, $item->getPathIds())) {
242
+ continue;
243
+ }
244
+ foreach ($item->getPathIds() as $id) {
245
+ if (!in_array($id, $ids)) {
246
+ $ids[] = $id;
247
+ }
248
+ }
249
+ }
250
+ return $ids;
251
+ }
252
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Confirm.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Confirm extends Mage_Adminhtml_Block_Widget_Container
3
+ {
4
+ /**
5
+ * Set template
6
+ */
7
+ public function __construct()
8
+ {
9
+ parent::__construct();
10
+ $this->setTemplate('straker/new/confirm.phtml');
11
+ }
12
+
13
+ /**
14
+ * Prepare button and grid
15
+ *
16
+ * @return Mage_Adminhtml_Block_Catalog_Product
17
+ */
18
+ protected function _prepareLayout()
19
+ {
20
+ $this->_addButton('submit', array(
21
+ 'label' => Mage::helper('catalog')->__('Submit'),
22
+ 'onclick' => "$('submit-new-job-form').submit();",
23
+ // 'onclick' => "setLocation('{$this->getUrl('*/*/submit')}')",
24
+ 'class' => 'task'
25
+ ));
26
+
27
+ $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_confirm_grid', 'product.grid', array('store' => $this->getStore(), 'attr' => $this->getAttr(), 'product' => $this->getProduct())));
28
+ return parent::_prepareLayout();
29
+ }
30
+
31
+
32
+ /**
33
+ * Render grid
34
+ *
35
+ * @return string
36
+ */
37
+ public function getGridHtml()
38
+ {
39
+ return $this->getChildHtml('grid');
40
+ }
41
+
42
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Confirm/Grid.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Confirm_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('strakerProducts');
9
+ $this->setDefaultSort('entity_id');
10
+ $this->setDefaultDir('DESC');
11
+ $this->setSaveParametersInSession(true);
12
+ $this->setUseAjax(false);
13
+ $this->setVarNameFilter('product_filter');
14
+ }
15
+
16
+ protected function _getStore()
17
+ {
18
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
19
+ return Mage::app()->getStore($storeId);
20
+ }
21
+ protected function _prepareLayout()
22
+ {
23
+ return $this;
24
+ }
25
+ protected function _prepareCollection()
26
+ {
27
+ $store = $this->_getStore();
28
+ $collection = Mage::getModel('catalog/product')->getCollection()
29
+ ->addAttributeToSelect('sku')
30
+ ->addAttributeToSelect('name')
31
+ ->addAttributeToSelect('type_id');
32
+ $collection->addAttributeToFilter('entity_id', array('in' => $this->getProduct()));
33
+
34
+ foreach ($this->getAttrArray() as $attr){
35
+ $collection->addAttributeToSelect($attr);
36
+ }
37
+ if ($store->getId()) {
38
+ //$collection->setStoreId($store->getId());
39
+ $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
40
+ $collection->addStoreFilter($store);
41
+ $collection->joinAttribute(
42
+ 'name',
43
+ 'catalog_product/name',
44
+ 'entity_id',
45
+ null,
46
+ 'inner',
47
+ $adminStore
48
+ );
49
+ $collection->joinAttribute(
50
+ 'status',
51
+ 'catalog_product/status',
52
+ 'entity_id',
53
+ null,
54
+ 'inner',
55
+ $store->getId()
56
+ );
57
+ $collection->joinAttribute(
58
+ 'visibility',
59
+ 'catalog_product/visibility',
60
+ 'entity_id',
61
+ null,
62
+ 'inner',
63
+ $store->getId()
64
+ );
65
+ }
66
+ else {
67
+ $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
68
+ $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
69
+ }
70
+
71
+ $this->setCollection($collection);
72
+
73
+ parent::_prepareCollection();
74
+ $this->getCollection()->addWebsiteNamesToResult();
75
+ return $this;
76
+ }
77
+
78
+ protected function _addColumnFilterToCollection($column)
79
+ {
80
+ if ($this->getCollection()) {
81
+ if ($column->getId() == 'websites') {
82
+ $this->getCollection()->joinField('websites',
83
+ 'catalog/product_website',
84
+ 'website_id',
85
+ 'product_id=entity_id',
86
+ null,
87
+ 'left');
88
+ }
89
+ }
90
+ return parent::_addColumnFilterToCollection($column);
91
+ }
92
+
93
+ protected function _prepareColumns()
94
+ {
95
+
96
+ $this->addColumn('entity_id',
97
+ array(
98
+ 'header'=> Mage::helper('catalog')->__('ID'),
99
+ 'width' => '50px',
100
+ 'type' => 'number',
101
+ 'index' => 'entity_id',
102
+ 'filter' => false,
103
+ ));
104
+
105
+ if (in_array('name',$this->getAttrArray())) {
106
+ $this->addColumn('name',
107
+ array(
108
+ 'header' => Mage::helper('catalog')->__('Name to translate'),
109
+ 'index' => 'name',
110
+ 'filter' => false,
111
+ ));
112
+ }
113
+ else{
114
+ $this->addColumn('name',
115
+ array(
116
+ 'header' => Mage::helper('catalog')->__('Name'),
117
+ 'index' => 'name',
118
+ 'filter' => false,
119
+ ));
120
+ }
121
+
122
+ foreach ($this->getAttrArray() as $attr){
123
+ if ($attr!='name') {
124
+ $attrModel = Mage::getModel('eav/entity_attribute')->loadByCode(4, $attr);
125
+ $this->addColumn($attr,
126
+ array(
127
+ 'header' => Mage::helper('catalog')->__($attrModel->getFrontendLabel()) .' to Translate',
128
+ 'index' => $attr,
129
+ 'filter' => false,
130
+ ));
131
+ }
132
+ }
133
+
134
+ return parent::_prepareColumns();
135
+ }
136
+
137
+ public function getGridUrl()
138
+ {
139
+ return $this->getUrl('*/*/addtoconfirm', array('_current'=>true));
140
+ }
141
+
142
+ public function getRowUrl($row)
143
+ {
144
+ return '';
145
+ }
146
+
147
+ public function getAttrArray(){
148
+ return explode(',', $this->getAttr());
149
+ }
150
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products extends Mage_Adminhtml_Block_Widget_Container
3
+ {
4
+ /**
5
+ * Set template
6
+ */
7
+ public function __construct()
8
+ {
9
+ parent::__construct();
10
+ $this->setTemplate('straker/new/products.phtml');
11
+ }
12
+
13
+ /**
14
+ * Prepare button and grid
15
+ *
16
+ * @return Mage_Adminhtml_Block_Catalog_Product
17
+ */
18
+ protected function _prepareLayout()
19
+ {
20
+ // $this->_addButton('add_new', array(
21
+ // 'label' => Mage::helper('catalog')->__('Add Product'),
22
+ // 'onclick' => "setLocation('{$this->getUrl('*/*/new')}')",
23
+ // 'class' => 'add'
24
+ // ));
25
+
26
+ $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_products_grid', 'product.grid', array('setup_store_id' => $this->getSetupStoreId(), 'attr' => $this->getAttr())));
27
+ return parent::_prepareLayout();
28
+ }
29
+
30
+
31
+ /**
32
+ * Render grid
33
+ *
34
+ * @return string
35
+ */
36
+ public function getGridHtml()
37
+ {
38
+ return $this->getChildHtml('grid');
39
+ }
40
+
41
+ /**
42
+ * Check whether it is single store mode
43
+ *
44
+ * @return bool
45
+ */
46
+ public function isSingleStoreMode()
47
+ {
48
+ if (!Mage::app()->isSingleStoreMode()) {
49
+ return false;
50
+ }
51
+ return true;
52
+ }
53
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Attribute.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_Attribute extends Mage_Adminhtml_Block_Widget_Container{
3
+ protected function _beforeToHtml(){
4
+ $this->setTemplate('straker/new/products/attributes.phtml');
5
+ }
6
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Confirm.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_Confirm extends Mage_Adminhtml_Block_Widget_Container
3
+ {
4
+ /**
5
+ * Set template
6
+ */
7
+ public function __construct()
8
+ {
9
+ parent::__construct();
10
+ $this->setTemplate('straker/new/products/confirm.phtml');
11
+ }
12
+
13
+ /**
14
+ * Prepare button and grid
15
+ *
16
+ * @return Mage_Adminhtml_Block_Catalog_Product
17
+ */
18
+ protected function _prepareLayout()
19
+ {
20
+ $this->_addButton('submit', array(
21
+ 'label' => Mage::helper('catalog')->__('Submit'),
22
+ 'onclick' => "$('submit-new-job-form').submit();",
23
+ 'class' => 'task'
24
+ ));
25
+
26
+ $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_products_confirm_grid', 'product.grid', array('store' => $this->getStore(), 'attr' => $this->getAttr(), 'product' => $this->getProduct())));
27
+ return parent::_prepareLayout();
28
+ }
29
+
30
+
31
+ /**
32
+ * Render grid
33
+ *
34
+ * @return string
35
+ */
36
+ public function getGridHtml()
37
+ {
38
+ return $this->getChildHtml('grid');
39
+ }
40
+
41
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Confirm/Grid.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_Confirm_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('strakerProducts');
9
+ $this->setDefaultSort('entity_id');
10
+ $this->setDefaultDir('DESC');
11
+ $this->setSaveParametersInSession(true);
12
+ $this->setUseAjax(false);
13
+ $this->setVarNameFilter('product_filter');
14
+ }
15
+
16
+ protected function _getStore()
17
+ {
18
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
19
+ return Mage::app()->getStore($storeId);
20
+ }
21
+ protected function _prepareLayout()
22
+ {
23
+ return $this;
24
+ }
25
+ protected function _prepareCollection()
26
+ {
27
+ $store = $this->_getStore();
28
+ $collection = Mage::getModel('catalog/product')->getCollection()
29
+ ->addAttributeToSelect('sku')
30
+ ->addAttributeToSelect('name')
31
+ ->addAttributeToSelect('type_id');
32
+ $collection->addAttributeToFilter('entity_id', array('in' => $this->getProduct()));
33
+
34
+ foreach ($this->getAttrArray() as $attr){
35
+ $collection->addAttributeToSelect($attr);
36
+ }
37
+ if ($store->getId()) {
38
+ //$collection->setStoreId($store->getId());
39
+ $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
40
+ $collection->addStoreFilter($store);
41
+ $collection->joinAttribute(
42
+ 'name',
43
+ 'catalog_product/name',
44
+ 'entity_id',
45
+ null,
46
+ 'inner',
47
+ $adminStore
48
+ );
49
+ $collection->joinAttribute(
50
+ 'status',
51
+ 'catalog_product/status',
52
+ 'entity_id',
53
+ null,
54
+ 'inner',
55
+ $store->getId()
56
+ );
57
+ $collection->joinAttribute(
58
+ 'visibility',
59
+ 'catalog_product/visibility',
60
+ 'entity_id',
61
+ null,
62
+ 'inner',
63
+ $store->getId()
64
+ );
65
+ }
66
+ else {
67
+ $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
68
+ $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
69
+ }
70
+
71
+ $this->setCollection($collection);
72
+
73
+ parent::_prepareCollection();
74
+ $this->getCollection()->addWebsiteNamesToResult();
75
+ return $this;
76
+ }
77
+
78
+ protected function _addColumnFilterToCollection($column)
79
+ {
80
+ if ($this->getCollection()) {
81
+ if ($column->getId() == 'websites') {
82
+ $this->getCollection()->joinField('websites',
83
+ 'catalog/product_website',
84
+ 'website_id',
85
+ 'product_id=entity_id',
86
+ null,
87
+ 'left');
88
+ }
89
+ }
90
+ return parent::_addColumnFilterToCollection($column);
91
+ }
92
+
93
+ protected function _prepareColumns()
94
+ {
95
+
96
+ $this->addColumn('entity_id',
97
+ array(
98
+ 'header'=> Mage::helper('catalog')->__('ID'),
99
+ 'width' => '50px',
100
+ 'type' => 'number',
101
+ 'index' => 'entity_id',
102
+ 'filter' => false,
103
+ ));
104
+
105
+ if (in_array('name',$this->getAttrArray())) {
106
+ $this->addColumn('name',
107
+ array(
108
+ 'header' => Mage::helper('catalog')->__('Name to translate'),
109
+ 'index' => 'name',
110
+ 'filter' => false,
111
+ ));
112
+ }
113
+ else{
114
+ $this->addColumn('name',
115
+ array(
116
+ 'header' => Mage::helper('catalog')->__('Name'),
117
+ 'index' => 'name',
118
+ 'filter' => false,
119
+ ));
120
+ }
121
+
122
+ foreach ($this->getAttrArray() as $attr){
123
+ if ($attr!='name') {
124
+ $attrModel = Mage::getModel('eav/entity_attribute')->loadByCode(4, $attr);
125
+ $this->addColumn($attr,
126
+ array(
127
+ 'header' => Mage::helper('catalog')->__($attrModel->getFrontendLabel()) .' to Translate',
128
+ 'index' => $attr,
129
+ 'filter' => false,
130
+ ));
131
+ }
132
+ }
133
+
134
+ return parent::_prepareColumns();
135
+ }
136
+
137
+ public function getGridUrl()
138
+ {
139
+ return $this->getUrl('*/*/addtoconfirm', array('_current'=>true));
140
+ }
141
+
142
+ public function getRowUrl($row)
143
+ {
144
+ return '';
145
+ }
146
+
147
+ public function getAttrArray(){
148
+ return explode(',', $this->getAttr());
149
+ }
150
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Grid.php ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('strakerProducts');
9
+ $this->setDefaultSort('entity_id');
10
+ $this->setDefaultDir('DESC');
11
+ $this->setSaveParametersInSession(true);
12
+ $this->setUseAjax(false);
13
+ $this->setVarNameFilter('product_filter');
14
+ }
15
+
16
+ protected function _getStore()
17
+ {
18
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
19
+ return Mage::app()->getStore($storeId);
20
+ }
21
+
22
+ protected function _prepareCollection()
23
+ {
24
+ $store = $this->_getStore();
25
+ $collection = Mage::getModel('catalog/product')->getCollection()
26
+ ->addAttributeToSelect('sku')
27
+ ->addAttributeToSelect('name')
28
+ ->addAttributeToSelect('type_id');
29
+
30
+ foreach ($this->getAttrArray() as $attr){
31
+ $collection->addAttributeToSelect($attr);
32
+ }
33
+ if ($store->getId()) {
34
+ //$collection->setStoreId($store->getId());
35
+ $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
36
+ $collection->addStoreFilter($store);
37
+ $collection->joinAttribute(
38
+ 'name',
39
+ 'catalog_product/name',
40
+ 'entity_id',
41
+ null,
42
+ 'inner',
43
+ $adminStore
44
+ );
45
+ $collection->joinAttribute(
46
+ 'status',
47
+ 'catalog_product/status',
48
+ 'entity_id',
49
+ null,
50
+ 'inner',
51
+ $store->getId()
52
+ );
53
+ $collection->joinAttribute(
54
+ 'visibility',
55
+ 'catalog_product/visibility',
56
+ 'entity_id',
57
+ null,
58
+ 'inner',
59
+ $store->getId()
60
+ );
61
+ }
62
+ else {
63
+ $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
64
+ $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
65
+ }
66
+
67
+ $this->setCollection($collection);
68
+
69
+ parent::_prepareCollection();
70
+ $this->getCollection()->addWebsiteNamesToResult();
71
+ return $this;
72
+ }
73
+
74
+ protected function _addColumnFilterToCollection($column)
75
+ {
76
+ if ($this->getCollection()) {
77
+ if ($column->getId() == 'websites') {
78
+ $this->getCollection()->joinField('websites',
79
+ 'catalog/product_website',
80
+ 'website_id',
81
+ 'product_id=entity_id',
82
+ null,
83
+ 'left');
84
+ }
85
+ }
86
+ return parent::_addColumnFilterToCollection($column);
87
+ }
88
+
89
+ protected function _prepareColumns()
90
+ {
91
+ $this->addColumn('entity_id',
92
+ array(
93
+ 'header'=> Mage::helper('catalog')->__('ID'),
94
+ 'width' => '50px',
95
+ 'type' => 'number',
96
+ 'index' => 'entity_id',
97
+ ));
98
+ if (in_array('name',$this->getAttrArray())) {
99
+ $this->addColumn('name',
100
+ array(
101
+ 'header' => Mage::helper('catalog')->__('Name to translate'),
102
+ 'index' => 'name',
103
+ ));
104
+ }
105
+ else{
106
+ $this->addColumn('name',
107
+ array(
108
+ 'header' => Mage::helper('catalog')->__('Name'),
109
+ 'index' => 'name',
110
+ ));
111
+ }
112
+ foreach ($this->getAttrArray() as $attr){
113
+ if ($attr!='name') {
114
+ $attrModel = Mage::getModel('eav/entity_attribute')->loadByCode(4, $attr);
115
+ $this->addColumn($attr,
116
+ array(
117
+ 'header' => Mage::helper('catalog')->__($attrModel->getFrontendLabel()).' To translate',
118
+ 'index' => $attr,
119
+ ));
120
+ }
121
+ }
122
+
123
+ $this->addColumn('type',
124
+ array(
125
+ 'header'=> Mage::helper('catalog')->__('Type'),
126
+ 'width' => '60px',
127
+ 'index' => 'type_id',
128
+ 'type' => 'options',
129
+ 'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
130
+ ));
131
+ $this->addColumn('visibility',
132
+ array(
133
+ 'header'=> Mage::helper('catalog')->__('Visibility'),
134
+ 'width' => '70px',
135
+ 'index' => 'visibility',
136
+ 'type' => 'options',
137
+ 'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
138
+ ));
139
+
140
+ $this->addColumn('status',
141
+ array(
142
+ 'header'=> Mage::helper('catalog')->__('Status'),
143
+ 'width' => '70px',
144
+ 'index' => 'status',
145
+ 'type' => 'options',
146
+ 'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
147
+ ));
148
+
149
+ if (!Mage::app()->isSingleStoreMode()) {
150
+ $this->addColumn('websites',
151
+ array(
152
+ 'header'=> Mage::helper('catalog')->__('Websites'),
153
+ 'width' => '100px',
154
+ 'sortable' => false,
155
+ 'index' => 'websites',
156
+ 'type' => 'options',
157
+ 'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
158
+ ));
159
+ }
160
+
161
+ return parent::_prepareColumns();
162
+ }
163
+
164
+ protected function _prepareMassaction()
165
+ {
166
+ $this->setMassactionIdField('entity_id');
167
+ $this->getMassactionBlock()->setFormFieldName('product');
168
+
169
+ $this->getMassactionBlock()->addItem('add', array(
170
+ 'label'=> Mage::helper('catalog')->__('Add to Confirm Page'),
171
+ 'url' => $this->getUrl('*/*/addtoconfirm'),
172
+ 'selected' => 1
173
+ ));
174
+ $this->getMassactionBlock()->setTemplate('straker/new/products/massaction.phtml');
175
+
176
+ //todo: refine this
177
+ $hiddenParams = '<input type="hidden" name="store" value="'.$this->_getStore()->getId().'" />';
178
+ $hiddenParams .= '<input type="hidden" name="attr" value="'.$this->getAttr().'" />';
179
+ $this->getMassactionBlock()->setHiddenParams($hiddenParams);
180
+
181
+
182
+ Mage::dispatchEvent('adminhtml_strakertranslation_new_products_grid_prepare_massaction', array('block' => $this));
183
+ return $this;
184
+ }
185
+
186
+ public function getGridUrl()
187
+ {
188
+ return $this->getUrl('*/*/new', array('_current'=>true));
189
+ }
190
+
191
+ public function getRowUrl($row)
192
+ {
193
+ return '';
194
+ }
195
+
196
+ public function getAttrArray(){
197
+ return explode(',', $this->getAttr());
198
+ }
199
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Register.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Register extends Mage_Adminhtml_Block_Widget_Container{
3
+
4
+ protected $_countires;
5
+
6
+ protected function _beforeToHtml(){
7
+ $this->setTemplate('straker/new/register.phtml');
8
+ }
9
+
10
+ public function renderWelcomeIframe(){
11
+ // return '<div id="white-iframe" style="background: white; border: 5px solid black; min-height: 200px; padding:20px; margin-bottom: 20px;">
12
+ // <h3>First time iFrame provided by Straker</h3>
13
+ // </div>';
14
+ return '<div class="magento-banner-wrap"><img src="/skin/adminhtml/default/straker/images/magento-banner.jpg"></div>';
15
+ }
16
+
17
+ public function renderCountriesSelect($name){
18
+ if (!$this->_countires) {
19
+ $this->_countires = Mage::getModel('strakertranslations_easytranslationplatform/api')->getCountries();
20
+ }
21
+ $html = '<select class="validate-select" name="'.$name.'">';
22
+ $html .= '<option value="">' . $this->__('Select a country') . '</option>';
23
+ if ($this->_countires) {
24
+ foreach ($this->_countires as $country) {
25
+ $html .= '<option value="' . $country->code . '">' . $country->name . '</option>';
26
+ }
27
+ }
28
+ $html .= '</select>';
29
+ return $html;
30
+ }
31
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Selectstore.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Selectstore extends Mage_Adminhtml_Block_Widget_Container{
3
+ protected function _beforeToHtml(){
4
+ $this->setTemplate('straker/new/selectstore.phtml');
5
+ }
6
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Setupstore.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Setupstore extends Mage_Adminhtml_Block_Widget_Container{
3
+
4
+ protected $_languages;
5
+
6
+ protected function _beforeToHtml(){
7
+ $this->setTemplate('straker/new/setupstore.phtml');
8
+ }
9
+
10
+ public function renderLanguageSelect($name){
11
+ if (!$this->_languages) {
12
+ $this->_languages = Mage::getModel('strakertranslations_easytranslationplatform/api', array('store' => $this->getSetupStoreId()))->getLanguages();
13
+ }
14
+ $html = '<select class="validate-select" name="'.$name.'">';
15
+ $html .= '<option value="">' . $this->__('Select a language') . '</option>';
16
+ if ($this->_languages) {
17
+ foreach ($this->_languages as $language) {
18
+ $html .= '<option value="' . $language->code . '">' . $language->name . '</option>';
19
+ }
20
+ }
21
+ $html .= '</select>';
22
+ return $html;
23
+ }
24
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Type.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Type extends Mage_Adminhtml_Block_Widget_Container{
3
+
4
+ protected $_languages;
5
+
6
+ protected function _beforeToHtml(){
7
+ $this->setTemplate('straker/new/type.phtml');
8
+ }
9
+
10
+ public function renderTypes(){
11
+ $storeId = $this->getRequest()->getParam('store');
12
+ $types = Mage::getModel('strakertranslations_easytranslationplatform/job_type')->getCollection();
13
+ $html = '';
14
+ foreach ($types as $type){
15
+ $html .= '<div><a class="job-type-btn" href="' . Mage::helper("adminhtml")->getUrl("adminhtml/straker_".strtolower($type->getTypeName())."/new", array("store" => $storeId)) . '">' . $type->getTypeName() . '</a></div>';
16
+
17
+ }
18
+ return $html;
19
+ }
20
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Backupbutton.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_System_Config_Form_BackupButton extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /*
5
+ * Set template
6
+ */
7
+ protected function _construct()
8
+ {
9
+ parent::_construct();
10
+ $this->setTemplate('straker/system/config/button.phtml');
11
+ }
12
+
13
+ /**
14
+ * Return element html
15
+ *
16
+ * @param Varien_Data_Form_Element_Abstract $element
17
+ * @return string
18
+ */
19
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
20
+ {
21
+ return $this->_toHtml();
22
+ }
23
+
24
+ /**
25
+ * Return ajax url for button
26
+ *
27
+ * @return string
28
+ */
29
+ public function getAjaxCheckUrl()
30
+ {
31
+ return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_atwixtweaks/check');
32
+ }
33
+
34
+ /**
35
+ * Generate button html
36
+ *
37
+ * @return string
38
+ */
39
+ public function getButtonHtml()
40
+ {
41
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
42
+ ->setData(array(
43
+ 'id' => 'straker_clear_button',
44
+ 'label' => $this->helper('adminhtml')->__('Backup Product Data'),
45
+ 'onclick' => 'setLocation(\''.Mage::helper('adminhtml')->getUrl('adminhtml/straker_new/copyProdcutTable').'\');'
46
+ ));
47
+
48
+ return $button->toHtml();
49
+ }
50
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Button.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_System_Config_Form_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /*
5
+ * Set template
6
+ */
7
+ protected function _construct()
8
+ {
9
+ parent::_construct();
10
+ $this->setTemplate('straker/system/config/button.phtml');
11
+ }
12
+
13
+ /**
14
+ * Return element html
15
+ *
16
+ * @param Varien_Data_Form_Element_Abstract $element
17
+ * @return string
18
+ */
19
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
20
+ {
21
+ return $this->_toHtml();
22
+ }
23
+
24
+ /**
25
+ * Return ajax url for button
26
+ *
27
+ * @return string
28
+ */
29
+ public function getAjaxCheckUrl()
30
+ {
31
+ return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_atwixtweaks/check');
32
+ }
33
+
34
+ /**
35
+ * Generate button html
36
+ *
37
+ * @return string
38
+ */
39
+ public function getButtonHtml()
40
+ {
41
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
42
+ ->setData(array(
43
+ 'id' => 'straker_clear_button',
44
+ 'label' => $this->helper('adminhtml')->__('Clear All Settings'),
45
+ 'onclick' => 'setLocation(\''.Mage::helper('adminhtml')->getUrl('adminhtml/straker_new/clearSettings').'\');'
46
+ ));
47
+
48
+ return $button->toHtml();
49
+ }
50
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Restorebutton.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_System_Config_Form_RestoreButton extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /*
5
+ * Set template
6
+ */
7
+ protected function _construct()
8
+ {
9
+ parent::_construct();
10
+ $this->setTemplate('straker/system/config/button.phtml');
11
+ }
12
+
13
+ /**
14
+ * Return element html
15
+ *
16
+ * @param Varien_Data_Form_Element_Abstract $element
17
+ * @return string
18
+ */
19
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
20
+ {
21
+ return $this->_toHtml();
22
+ }
23
+
24
+ /**
25
+ * Return ajax url for button
26
+ *
27
+ * @return string
28
+ */
29
+ public function getAjaxCheckUrl()
30
+ {
31
+ return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_atwixtweaks/check');
32
+ }
33
+
34
+ /**
35
+ * Generate button html
36
+ *
37
+ * @return string
38
+ */
39
+ public function getButtonHtml()
40
+ {
41
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
42
+ ->setData(array(
43
+ 'id' => 'straker_clear_button',
44
+ 'label' => $this->helper('adminhtml')->__('Restore Product Data'),
45
+ 'onclick' => 'setLocation(\''.Mage::helper('adminhtml')->getUrl('adminhtml/straker_new/restoreProdcutTable').'\');'
46
+ ));
47
+
48
+ return $button->toHtml();
49
+ }
50
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Action.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Action
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ public function render(Varien_Object $row)
6
+ {
7
+ if (get_class($row) == get_class(Mage::getModel('strakertranslations_easytranslationplatform/job'))) {
8
+
9
+ $buttonText = $row->getStatusId() == 4 ? $this->__('Publish') : $this->__('View Order');
10
+
11
+ $out = '<button id="button-update-'.$row->getId().'" style="margin: 5px; display: block;" onclick="event.stopPropagation(); setLocation(\'' . Mage::helper("adminhtml")->getUrl("adminhtml/straker_".strtolower($row->getTypeName()).'/', array('job_id' => $row->getId())) . '\')" title="View Order" type="button" style="">'.$buttonText.'</button>';
12
+ return $out;
13
+ }
14
+ }
15
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Backend.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Backend
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ protected $_storeId;
6
+
7
+ public function render(Varien_Object $row){
8
+ $html = '';
9
+ if ($row->getProductId()) {
10
+ $product = Mage::getModel('catalog/product')->load($row->getProductId());
11
+ $url = $this->getUrl('adminhtml/catalog_product/edit', array(
12
+ 'store' => $this->getStoreId($row),
13
+ 'id' => $product->getId())
14
+ );
15
+ $html .= '<a target="_blank" href="' . $url . '">' . $this->__('View Product in Backend') . '</a>';
16
+ }
17
+ elseif($row->getCategoryId()) {
18
+ $category = Mage::getModel('catalog/category')->load($row->getCategoryId());
19
+ $url = $this->getUrl('adminhtml/catalog_category/edit', array(
20
+ 'store' => $this->getStoreId($row),
21
+ 'id' => $category->getId())
22
+ );
23
+ $html .= '<a target="_blank" href="' . $url . '">' . $this->__('View Category in Backend') . '</a>';
24
+ }
25
+ return $html;
26
+ }
27
+
28
+ protected function getStoreId($row){
29
+ if (!$this->_storeId){
30
+ $this->_storeId = Mage::getModel('strakertranslations_easytranslationplatform/job')
31
+ ->load($row->getjobId())
32
+ ->getStoreId();
33
+ }
34
+ return $this->_storeId;
35
+ }
36
+
37
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Dispute.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Dispute
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ public function render(Varien_Object $row){
6
+ $quotes = json_decode($row->getQuote(), true);
7
+ $html = '<button style="margin: 5px; display: block;" onclick="disputeForm.show(\''.$row->getJobId().'\',\''.$row->getProductId().'\')" title="Update" type="button" style=""><span><span><span>Dispute</span></span></span></button>';
8
+ return $html;
9
+ }
10
+
11
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Frontend.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Frontend
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ protected $_storeId;
6
+
7
+ public function render(Varien_Object $row){
8
+ $html = '';
9
+ if ($row->getProductId()) {
10
+ $product = Mage::getModel('catalog/product')->setStoreId($this->getStoreId($row))->load($row->getProductId());
11
+ if (!$product->isDisabled() && $product->isVisibleInSiteVisibility()) {
12
+ $html .= '<a target="_blank" href="' . $product->getProductUrl() . '">' . $this->__('View Product in Frontend') . '</a>';
13
+ } else {
14
+ $html .= 'Product is not visible in frontend';
15
+ }
16
+ }
17
+ elseif($row->getCategoryId()){
18
+ $category = Mage::getModel('catalog/category')->setStoreId($this->getStoreId($row))->load($row->getCategoryId());
19
+ $html .= '<a target="_blank" href="' . $category->getUrl() . '">' . $this->__('View Category in Frontend') . '</a>';
20
+ }
21
+ return $html;
22
+ }
23
+
24
+ protected function getStoreId($row){
25
+ if (!$this->_storeId){
26
+ $this->_storeId = Mage::getModel('strakertranslations_easytranslationplatform/job')
27
+ ->load($row->getjobId())
28
+ ->getStoreId();
29
+ }
30
+ return $this->_storeId;
31
+ }
32
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Path.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Path
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ public function render(Varien_Object $row)
6
+ {
7
+ $cats = explode('/',$row->getPath());
8
+ $catNames = array();
9
+ foreach($cats as $catId){
10
+ if ($catId == '1'){
11
+ continue;
12
+ }
13
+ $catNames[] = Mage::getModel('catalog/category')->load($catId)->getName();
14
+ }
15
+ return implode(' / ', $catNames);
16
+ }
17
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Quote.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Quote
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ public function render(Varien_Object $row){
6
+ $html = '';
7
+ if (get_class($row) == get_class(Mage::getModel('strakertranslations_easytranslationplatform/job') )) {
8
+ $quotes = json_decode($row->getQuote(), true);
9
+ if(is_array($quotes)) {
10
+ foreach ($quotes as $quote) {
11
+ $html .= "<div class='quote-workflow'>";
12
+ foreach ($quote as $k => $v) {
13
+ $html .= ($k == 'workflow') ? "<h4>{$v}</h4>" : "<label>{$k}: </label><span>{$v}</span><br />";
14
+ }
15
+ $html .= "</div>";
16
+ }
17
+ }
18
+ }
19
+ return $html;
20
+ }
21
+
22
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Refresh.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Refresh
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ public function render(Varien_Object $row)
6
+ {
7
+ if (get_class($row) == get_class(Mage::getModel('strakertranslations_easytranslationplatform/job'))) {
8
+ $out = '<button class="straker-refresh-button" id="button-update-'.$row->getId().'" onclick="event.stopPropagation(); setLocation(\'' . Mage::helper("adminhtml")->getUrl("adminhtml/straker_job/updateJob", array('job_id' => $row->getId())) . '\')" title="Refresh" type="button">Refresh</button>';
9
+ return $out;
10
+ }
11
+ }
12
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Status.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Status
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ public function render(Varien_Object $row){
6
+ if (get_class($row) == get_class(Mage::getModel('strakertranslations_easytranslationplatform/job') )) {
7
+ //if status is QUEUED
8
+ if ($row->getStatusName() == 'QUEUED') {
9
+ $quotes = json_decode($row->getQuote(), true);
10
+ $html = $this->__('Waiting for Quote');
11
+ if (!empty($quotes) && $row->getStatusId() == 2) {
12
+ foreach ($quotes as $quote) {
13
+ if ($quote['quote']) {
14
+ $html = '<button onclick="viewStrakerQuote('.$row->getId().',\'' . $row->getJobKey() . '\')" style="margin: 5px;" title="View Quote" type="button" style="">'.$this->__('View Quote').'</button>';
15
+ break;
16
+ }
17
+ }
18
+ }
19
+ }
20
+ //else if status is IN_PROGRESS
21
+ elseif ($row->getStatusName() == 'IN_PROGRESS') {
22
+ $html = $this->__('In Progress');
23
+ }
24
+ //else if status is COMPLETED
25
+ elseif ($row->getStatusName() == 'COMPLETED') {
26
+ $html = $this->__('Ready to Publish');
27
+ }
28
+ return $html;
29
+ }
30
+
31
+ }
32
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Update.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Update
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ public function render(Varien_Object $row)
6
+ {
7
+ if (get_class($row) == get_class(Mage::getModel('strakertranslations_easytranslationplatform/job'))) {
8
+ $out = '<button id="button-update-'.$row->getId().'" style="margin: 5px; display: block;" onclick="event.stopPropagation(); setLocation(\'' . Mage::helper("adminhtml")->getUrl("straker/adminhtml_job/updateJob", array('job_id' => $row->getId())) . '\')" title="Update" type="button" style=""><span><span><span>Update</span></span></span></button>';
9
+ return $out;
10
+ }
11
+ }
12
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Version.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Version
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ public function render(Varien_Object $row)
6
+ {
7
+ if($row->getVersion()){
8
+ return 'Published';
9
+ }
10
+ else{
11
+ return 'Not Published';
12
+ }
13
+ }
14
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Helper/Data.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Helper_Data extends Mage_Core_Helper_Abstract {
3
+ public function getAppKey($store = null){
4
+ return Mage::getStoreConfig('straker/general/application_key') ? Mage::getStoreConfig('straker/general/application_key') : false;
5
+ }
6
+
7
+ public function getAccessToken($store = null){
8
+ return Mage::getStoreConfig('straker/general/access_token') ? Mage::getStoreConfig('straker/general/access_token') : false;
9
+ }
10
+
11
+ public function saveStoreSetup($storeId, $source, $from, $to){
12
+ Mage::getModel('core/config')->saveConfig('straker/general/source', $source, 'stores', $storeId);
13
+ Mage::getModel('core/config')->saveConfig('straker/general/from', $from, 'stores', $storeId);
14
+ Mage::getModel('core/config')->saveConfig('straker/general/to', $to, 'stores', $storeId);
15
+ }
16
+
17
+ public function getStoreSetup($storeId){
18
+ $result['source'] = Mage::getStoreConfig('straker/general/source', $storeId);
19
+ $result['from'] = Mage::getStoreConfig('straker/general/from', $storeId);
20
+ $result['to'] = Mage::getStoreConfig('straker/general/to', $storeId);
21
+ return ($result['source'] && $result['from'] && $result['to']) ? $result : false;
22
+ }
23
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Actionlog.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 4:06 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Actionlog extends Mage_Core_Model_Abstract
9
+ {
10
+ private $_added = false;
11
+
12
+ protected function _construct()
13
+ {
14
+ $this->_init('strakertranslations_easytranslationplatform/actionlog');
15
+ }
16
+
17
+ public function addLog($action='', $message='', $extra='' ) {
18
+
19
+ if (!$this->_added) { // should be only one log per action
20
+
21
+ $_action = $action ? $action : Mage::app()->getRequest()->getControllerName() . ':' . Mage::app()->getRequest()->getActionName();
22
+
23
+ $this->setUserId($this->_getAdminUser())
24
+ ->setAction($_action)
25
+ ->setMessage($message)
26
+ ->setExtra($extra)
27
+ ->save();
28
+ $this->_added = true;
29
+ }
30
+
31
+ }
32
+
33
+ protected function _getAdminUser(){
34
+
35
+ return Mage::getSingleton('admin/session')->getUser()->getId();
36
+ }
37
+
38
+
39
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Api.php ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Model_Api extends Mage_Core_Model_Abstract
3
+ {
4
+ /**
5
+ * Error codes recollected after each API call
6
+ *
7
+ * @var array
8
+ */
9
+ protected $_callErrors = array();
10
+
11
+ protected $_storeId;
12
+
13
+ /**
14
+ * Headers for each API call
15
+ *
16
+ * @var array
17
+ */
18
+ protected $_headers = array();
19
+
20
+ protected $_options = array();
21
+
22
+ protected function _construct()
23
+ {
24
+
25
+ $this->_storeId = ($this->getStore()) ? $this->getStore() : 0;
26
+ $this->_init('strakertranslations_easytranslationplatform/api');
27
+ $this->_headers[] = 'Authorization: Bearer '. Mage::getStoreConfig('straker/general/access_token', $this->_storeId);
28
+ $this->_headers[] = 'X-Auth-App: '. Mage::getStoreConfig('straker/general/application_key', $this->_storeId);
29
+ }
30
+
31
+ protected function _call($url, $method = 'get', array $request = array(), $raw = false)
32
+ {
33
+ switch ($method) {
34
+ case 'post':
35
+ $method = Zend_Http_Client::POST;
36
+ break;
37
+
38
+ case 'get' :
39
+ $method = Zend_Http_Client::GET;
40
+ break;
41
+ }
42
+
43
+ try {
44
+ $http = new Varien_Http_Adapter_Curl();
45
+ $config = array(
46
+ 'timeout' => 60,
47
+ 'verifypeer' => 0,
48
+ );
49
+
50
+ $http->setConfig($config);
51
+ $http->write(
52
+ $method,
53
+ $url,
54
+ '1.1',
55
+ $this->_headers,
56
+ $request //$this->_buildQuery($request)
57
+ );
58
+ $response = $http->read();
59
+
60
+ } catch (Exception $e) {
61
+ $debugData['http_error'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
62
+ $this->_debug($debugData);
63
+ throw $e;
64
+ }
65
+
66
+ $debugData['response'] = $response;
67
+
68
+
69
+ // handle transport error
70
+ if ($http->getErrno()) {
71
+ Mage::logException(new Exception(
72
+ sprintf('CURL connection error #%s: %s', $http->getErrno(), $http->getError())
73
+ ));
74
+ $http->close();
75
+
76
+ Mage::throwException(Mage::helper('strakertranslations_easytranslationplatform')->__('Unable to communicate with the Straker Translations Api.'));
77
+ }
78
+
79
+ // cUrl resource must be closed after checking it for errors
80
+ $http->close();
81
+
82
+ $response = preg_split('/^\r?$/m', $response, 2);
83
+ $response = trim($response[1]);
84
+
85
+ if ($raw) {
86
+ return $response;
87
+ }
88
+
89
+ $response = json_decode($response);
90
+ $this->_callErrors = array();
91
+ if ($this->_isCallSuccessful($response)) {
92
+ return $response;
93
+ }
94
+ $this->_handleCallErrors($response);
95
+ return $response;
96
+ }
97
+
98
+ protected function _buildQuery($request)
99
+ {
100
+ return http_build_query($request);
101
+ }
102
+
103
+ /**
104
+ * Set array of additional cURL options
105
+ *
106
+ * @param array $options
107
+ * @return Varien_Http_Adapter_Curl
108
+ */
109
+ public function setOptions(array $options = array())
110
+ {
111
+ $this->_options = $options;
112
+ return $this;
113
+ }
114
+
115
+ protected function _debug($debugData){
116
+
117
+ // to be added
118
+
119
+ }
120
+
121
+ protected function _isCallSuccessful($response)
122
+ {
123
+ if (isset($response->code)) {
124
+ return false;
125
+ }
126
+
127
+ if (isset($response->success) || isset($response->languages) || isset($response->country)) {
128
+ return true;
129
+ }
130
+ return false;
131
+ }
132
+
133
+ /**
134
+ * Handle logical errors
135
+ *
136
+ * @param array $response
137
+ * @throws Mage_Core_Exception
138
+ */
139
+ protected function _handleCallErrors($response)
140
+ {
141
+ if(empty($response)){
142
+ return;
143
+ }
144
+ if (isset($response->message) && strpos($response->message,'Authentication failed') !== false){
145
+ $response->magentoMessage = $response->message;
146
+ }
147
+ return;
148
+ // to be added
149
+ }
150
+
151
+ protected function _getRegisterUrl(){
152
+ return Mage::getStoreConfig('straker/api_url/register');
153
+ }
154
+
155
+ protected function _getLanguagesUrl(){
156
+ return Mage::getStoreConfig('straker/api_url/languages');
157
+ }
158
+
159
+ protected function _getCountiresUrl(){
160
+ return Mage::getStoreConfig('straker/api_url/countries');
161
+ }
162
+
163
+ protected function _getTranslateUrl(){
164
+ return Mage::getStoreConfig('straker/api_url/translate');
165
+ }
166
+
167
+ protected function _getQuoteUrl(){
168
+ return Mage::getStoreConfig('straker/api_url/quote');
169
+ }
170
+
171
+ protected function _getPaymentUrl(){
172
+ return Mage::getStoreConfig('straker/api_url/payment');
173
+ }
174
+
175
+ protected function _getSupportUrl(){
176
+ return Mage::getStoreConfig('straker/api_url/support');
177
+ }
178
+
179
+ public function callRegister($data){
180
+ return $this->_call($this->_getRegisterUrl(), 'post', $data);
181
+ }
182
+
183
+ public function callTranslate($data){
184
+ $this->_headers[] = 'Content-Type:multipart/form-data';
185
+ return $this->_call($this->_getTranslateUrl(), 'post', $data);
186
+ }
187
+
188
+ public function callSupport($data){
189
+ return $this->_call($this->_getSupportUrl(), 'post', $data);
190
+ }
191
+
192
+ public function getQuote($data){
193
+ return $this->_call($this->_getQuoteUrl().'?'. $this->_buildQuery($data));
194
+ }
195
+
196
+ public function getPayment($data){
197
+ return $this->_call($this->_getPaymentUrl().'?'. $this->_buildQuery($data));
198
+ }
199
+
200
+ public function getTranslation($data){
201
+ return $this->_call($this->_getTranslateUrl().'?'. $this->_buildQuery($data));
202
+ }
203
+
204
+ public function getTranslatedFile($downloadUrl){
205
+ return $this->_call($downloadUrl,'get',array(),true);
206
+ }
207
+
208
+ public function getCountries(){
209
+ $result = $this->_call($this->_getCountiresUrl());
210
+ return $result->country ? $result->country : false;
211
+ }
212
+
213
+ public function getLanguages(){
214
+ $result = $this->_call($this->_getLanguagesUrl());
215
+ return $result->languages ? $result->languages : false;
216
+ }
217
+
218
+ public function saveAppKey($appKey){
219
+ if ($this->_storeId === 0) {
220
+ Mage::getModel('core/config')->saveConfig('straker/general/application_key', $appKey);
221
+ }
222
+ else {
223
+ Mage::getModel('core/config')->saveConfig('straker/general/application_key', $appKey, 'website', $this->_storeId);
224
+ }
225
+ }
226
+
227
+ public function saveAccessToken($accessToken){
228
+ if ($this->_storeId === 0) {
229
+ Mage::getModel('core/config')->saveConfig('straker/general/access_token', $accessToken);
230
+ }
231
+ else {
232
+ Mage::getModel('core/config')->saveConfig('straker/general/access_token', $accessToken, 'website', $this->_storeId);
233
+ }
234
+ }
235
+
236
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Category/Attributes.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 12/11/15
6
+ * Time: 8:55 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Category_Attributes extends Mage_Core_Model_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/category_attributes');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Category/Translate.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 12/11/15
6
+ * Time: 8:53 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Category_Translate extends Mage_Core_Model_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/category_translate');
14
+ }
15
+
16
+ public function importTranslation(){
17
+
18
+ $category = Mage::getModel('catalog/category')->setStoreId($this->getStoreId())->load($this->getCategoryId());
19
+
20
+ $categoryAttributeCode = $this->_getAttributeCode($this->getAttributeId());
21
+
22
+ $this->setBackup($category->getData($categoryAttributeCode));
23
+
24
+ $category->setData($categoryAttributeCode, $this->getTranslate())
25
+ ->getResource()
26
+ ->saveAttribute($category, $categoryAttributeCode);
27
+ $this->setIsImported(1)->save();
28
+
29
+ $category->clearInstance();
30
+
31
+ }
32
+
33
+ protected function _getAttributeCode($attributeId){
34
+
35
+ if (!Mage::registry('attributeCodeCache_'.$attributeId)){
36
+ $categoryAttributeCode = Mage::getModel('eav/entity_attribute')->load($attributeId)->getAttributeCode();
37
+ Mage::register('attributeCodeCache_'.$attributeId,$categoryAttributeCode);
38
+ }else{
39
+ $categoryAttributeCode = Mage::registry('attributeCodeCache_'.$attributeId);
40
+ }
41
+ return $categoryAttributeCode;
42
+
43
+ }
44
+
45
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job.php ADDED
@@ -0,0 +1,470 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 4:37 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Job extends Mage_Core_Model_Abstract
9
+ {
10
+ protected $_attributes = array();
11
+
12
+ protected $_translateFilePath = '/var/straker/';
13
+
14
+ protected function _construct()
15
+ {
16
+ $this->_init('strakertranslations_easytranslationplatform/job');
17
+ }
18
+
19
+ protected function addProductAttributes($productAttributeIds){
20
+
21
+ foreach ($productAttributeIds as $productAttributeId) {
22
+ $this->_attributes[] =
23
+ Mage::getModel('strakertranslations_easytranslationplatform/product_attributes')
24
+ ->setJobId($this->getId())
25
+ ->setAttributeId((int) $productAttributeId)
26
+ ->save();
27
+ }
28
+ return $this;
29
+ }
30
+
31
+
32
+ protected function addProductIds($productIds){
33
+
34
+ $writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
35
+
36
+ $query = 'INSERT INTO `straker_job_product` (`product_id`, `job_id`) VALUES ';
37
+ $queryVals = array();
38
+ foreach ($productIds as $productId) {
39
+ $queryVals[] = '(' . (int) $productId . ', ' . $this->getId() . ')';
40
+ }
41
+
42
+ $writeConnection->query( $query . implode(',', $queryVals));
43
+
44
+ return $this;
45
+
46
+ }
47
+
48
+ protected function addProductTranslateOriginal($productAttributeId, $productCollection){
49
+
50
+
51
+ $writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
52
+
53
+ $query = 'INSERT INTO `straker_product_translate` (`job_id`, `product_id`, `attribute_id`, `original`) VALUES ';
54
+ $queryVals = array();
55
+ $productAttributeCode = Mage::getModel('eav/entity_attribute')->load($productAttributeId)->getAttributeCode();
56
+ foreach ($productCollection as $product) {
57
+ $queryVals[] = '(' . $this->getId() . ', ' . $product->getId() . ', ' . $productAttributeId . ', \'' . addslashes($product->getData($productAttributeCode)). '\')';
58
+ }
59
+
60
+ $writeConnection->query( $query . implode(',', $queryVals));
61
+
62
+ return $this;
63
+ }
64
+
65
+ protected function addCategoryAttributes($categoryAttributeIds){
66
+
67
+ foreach ($categoryAttributeIds as $categoryAttributeId) {
68
+ $this->_attributes[] =
69
+ Mage::getModel('strakertranslations_easytranslationplatform/category_attributes')
70
+ ->setJobId($this->getId())
71
+ ->setAttributeId((int) $categoryAttributeId)
72
+ ->save();
73
+ }
74
+ return $this;
75
+ }
76
+
77
+
78
+ protected function addCategoryIds($categoryIds){
79
+
80
+ $writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
81
+
82
+ $query = 'INSERT INTO `straker_job_category` (`category_id`, `job_id`) VALUES ';
83
+ $queryVals = array();
84
+ foreach ($categoryIds as $categoryId) {
85
+ $queryVals[] = '(' . (int) $categoryId . ', ' . $this->getId() . ')';
86
+ }
87
+
88
+ $writeConnection->query( $query . implode(',', $queryVals));
89
+
90
+ return $this;
91
+
92
+ }
93
+
94
+ protected function addCategoryTranslateOriginal($categoryAttributeId, $categoryCollection){
95
+
96
+
97
+ $writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
98
+
99
+ $query = 'INSERT INTO `straker_category_translate` (`job_id`, `category_id`, `attribute_id`, `original`) VALUES ';
100
+ $queryVals = array();
101
+ $categoryAttributeCode = Mage::getModel('eav/entity_attribute')->load($categoryAttributeId)->getAttributeCode();
102
+ foreach ($categoryCollection as $category) {
103
+ $queryVals[] = '(' . $this->getId() . ', ' . $category->getId() . ', ' . $categoryAttributeId . ', \'' . addslashes($category->getData($categoryAttributeCode)). '\')';
104
+ }
105
+
106
+ $writeConnection->query( $query . implode(',', $queryVals));
107
+
108
+ return $this;
109
+ }
110
+
111
+ public function addProducts($productAttributeIds,$productIds){
112
+
113
+ if (!$this->getId()){
114
+ if (!$this->getStoreId()){
115
+ Mage::throwException('Error: Missing Store Id');
116
+ }
117
+ $this->setSourceStore(Mage::getStoreConfig('straker/general/source',$this->getStoreId()));
118
+ $this->save();
119
+ }
120
+
121
+ $this->addProductAttributes($productAttributeIds);
122
+
123
+ $countProducts = sizeof($productIds);
124
+ $buffer = 1000;
125
+ $_productIdSet = array();
126
+ for ($i = 0; $i < $countProducts; $i = $i + $buffer){
127
+ $_productIdSet[] = array_slice($productIds,$i,$buffer);
128
+ }
129
+
130
+ foreach ($_productIdSet as $_productIds) {
131
+ $this->addProductIds($_productIds);
132
+ }
133
+
134
+ foreach ($_productIdSet as $_productIds) {
135
+
136
+ $productCollection = Mage::getModel('catalog/product')->getCollection()->setStore($this->getSourceStore());
137
+
138
+ foreach ($productAttributeIds as $productAttributeId) {
139
+
140
+ $productAttributeCode = Mage::getModel('eav/entity_attribute')->load($productAttributeId)->getAttributeCode();
141
+ $productCollection->addAttributeToSelect($productAttributeCode);
142
+ }
143
+
144
+ $productCollection->addFieldToFilter('entity_id', array('in'=> $_productIds));
145
+
146
+ foreach ( $productAttributeIds as $productAttributeId){
147
+ $this->addProductTranslateOriginal($productAttributeId, $productCollection);
148
+ }
149
+ }
150
+ return $this;
151
+ }
152
+
153
+ public function addCategories($categoryAttributeIds,$categoryIds){
154
+
155
+ if (!$this->getId()){
156
+ if (!$this->getStoreId()){
157
+ Mage::throwException('Error: Missing Store Id');
158
+ }
159
+ $this->setSourceStore(Mage::getStoreConfig('straker/general/source',$this->getStoreId()));
160
+ $this->save();
161
+ }
162
+
163
+ $this->addCategoryAttributes($categoryAttributeIds);
164
+
165
+ $countCategories = sizeof($categoryIds);
166
+ $buffer = 1000;
167
+ $_categoryIdSet = array();
168
+ for ($i = 0; $i < $countCategories; $i = $i + $buffer){
169
+ $_categoryIdSet[] = array_slice($categoryIds,$i,$buffer);
170
+ }
171
+
172
+ foreach ($_categoryIdSet as $_categoryIds) {
173
+ $this->addCategoryIds($_categoryIds);
174
+ }
175
+
176
+ foreach ($_categoryIdSet as $_categoryIds) {
177
+
178
+ $categoryCollection = Mage::getModel('catalog/category')->getCollection()->setStore($this->getSourceStore());
179
+
180
+ foreach ($categoryAttributeIds as $categoryAttributeId) {
181
+
182
+ $categoryAttributeCode = Mage::getModel('eav/entity_attribute')->load($categoryAttributeId)->getAttributeCode();
183
+ $categoryCollection->addAttributeToSelect($categoryAttributeCode);
184
+ }
185
+
186
+ $categoryCollection->addFieldToFilter('entity_id', array('in'=> $_categoryIds));
187
+
188
+ foreach ( $categoryAttributeIds as $categoryAttributeId){
189
+ $this->addCategoryTranslateOriginal($categoryAttributeId, $categoryCollection);
190
+ }
191
+ }
192
+ return $this;
193
+ }
194
+
195
+ protected function _createProductTranslateFile() {
196
+
197
+ $_xml = '<?xml version="1.0" encoding="utf-8"?><root>';
198
+
199
+ $productTranslateCollection = Mage::getModel('strakertranslations_easytranslationplatform/product_translate')->getCollection();
200
+ $productTranslateCollection->addFieldToFilter('job_id',$this->getId());
201
+
202
+ $attributeFrontLabel = array();
203
+
204
+ foreach ($productTranslateCollection as $productTranslate ){
205
+ if (!isset($attributeFrontLabel[$productTranslate->getAttributeId()])){
206
+ $attributeFrontLabel[$productTranslate->getAttributeId()] =
207
+ Mage::getModel('eav/entity_attribute')->load($productTranslate->getAttributeId())->getFrontendLabel();
208
+ }
209
+
210
+ $_xml .= '<data name="' .$this->getTypeId(). '_' . $this->getStoreId().'_'. $productTranslate->getAttributeId().'_'. $productTranslate->getProductId().'" ' ;
211
+ $_xml .= 'content_context="' . $attributeFrontLabel[$productTranslate->getAttributeId()] . '" ';
212
+ $_xml .= 'content_context_url="'.Mage::getStoreConfig('web/unsecure/base_link_url',$this->getStoreId()).'catalog/category/view/id/'.$productTranslate->getProductId().'" ';
213
+ $_xml .= 'content_id="'. $productTranslate->getId() .'">';
214
+ $_xml .= '<value><![CDATA['.$productTranslate->getOriginal().']]></value></data>';
215
+ }
216
+ $_xml .='</root>';
217
+
218
+ file_put_contents(MAGENTO_ROOT.$this->_translateFilePath.'job'.$this->getId().'.xml',$_xml);
219
+ $this->setSourceFile('job'.$this->getId().'.xml')->save() ;
220
+
221
+ return $this;
222
+ }
223
+
224
+ protected function _createCategoryTranslateFile() {
225
+
226
+ $_xml = '<?xml version="1.0" encoding="utf-8"?><root>';
227
+
228
+ $categoryTranslateCollection = Mage::getModel('strakertranslations_easytranslationplatform/category_translate')->getCollection();
229
+ $categoryTranslateCollection->addFieldToFilter('job_id',$this->getId());
230
+
231
+ $attributeFrontLabel = array();
232
+
233
+ foreach ($categoryTranslateCollection as $categoryTranslate ){
234
+ if (!isset($attributeFrontLabel[$categoryTranslate->getAttributeId()])){
235
+ $attributeFrontLabel[$categoryTranslate->getAttributeId()] =
236
+ Mage::getModel('eav/entity_attribute')->load($categoryTranslate->getAttributeId())->getFrontendLabel();
237
+ }
238
+
239
+ $_xml .= '<data name="' .$this->getTypeId(). '_' . $this->getStoreId().'_'. $categoryTranslate->getAttributeId().'_'. $categoryTranslate->getCategoryId().'" ' ;
240
+ $_xml .= 'content_context="' . $attributeFrontLabel[$categoryTranslate->getAttributeId()] . '" ';
241
+ $_xml .= 'content_context_url="'.Mage::getStoreConfig('web/unsecure/base_link_url',$this->getStoreId()).'catalog/category/view/id/'.$categoryTranslate->getCategoryId().'" ';
242
+ $_xml .= 'content_id="'. $categoryTranslate->getId() .'">';
243
+ $_xml .= '<value><![CDATA['.$categoryTranslate->getOriginal().']]></value></data>';
244
+ }
245
+ $_xml .='</root>';
246
+
247
+ file_put_contents(Mage::getBaseDir().$this->_translateFilePath.'job'.$this->getId().'.xml',$_xml);
248
+ $this->setSourceFile('job'.$this->getId().'.xml')->save() ;
249
+
250
+ return $this;
251
+ }
252
+
253
+ protected function _summitJob(){
254
+
255
+ $request = array();
256
+
257
+ $request['title'] = $this->getTitle();
258
+ $request['sl'] = $this->getSl();
259
+ $request['tl'] = $this->getTl();
260
+
261
+ $filePath = MAGENTO_ROOT.$this->_translateFilePath.$this->getSourceFile();
262
+
263
+ $request['source_file'] = function_exists('curl_file_create') ? curl_file_create($filePath) :'@'.$filePath;
264
+ $request['callback_uri'] = Mage::getStoreConfig('web/unsecure/base_link_url',$this->getStoreId()) . 'straker/callback';
265
+ $request['token'] = $this->getId();
266
+
267
+ $api = $this->_getApi();
268
+ $response = $api->callTranslate($request);
269
+ if($response->job_key) {
270
+ $this->setStatusId(2)
271
+ ->setJobKey($response->job_key)
272
+ ->setTjNumber($response->tj_number)
273
+ ->save();
274
+ $this->setLastStatus(1);
275
+ }
276
+ else{
277
+ $this->setLastStatus(0);
278
+ $message = $response->magentoMessage?$response->magentoMessage:'Unknown Error.';
279
+ $this->setLastMessage($message);
280
+ }
281
+ return $this;
282
+
283
+ }
284
+
285
+ public function submitProducts($productAttributeIds,$productIds){
286
+
287
+ //product
288
+ $this->setTypeId(1);
289
+ $this->addProducts($productAttributeIds, $productIds)
290
+ ->_createProductTranslateFile()
291
+ ->_summitJob();
292
+ return $this;
293
+ }
294
+
295
+ public function submitCategories($categoryAttributeIds,$categoryIds){
296
+
297
+ //category
298
+ $this->setTypeId(3);
299
+ $this->addCategories($categoryAttributeIds, $categoryIds)
300
+ ->_createCategoryTranslateFile()
301
+ ->_summitJob();
302
+ return $this;
303
+ }
304
+
305
+ public function updateQuote(){
306
+
307
+ if ($this->getJobKey()){
308
+ $request = array();
309
+ $request['job_key'] = $this->getJobKey();
310
+ $api = $this->_getApi();
311
+ $response = $api->getQuote($request);
312
+ $quote = json_encode($response->quote);
313
+
314
+ if($quote && $quote != $this->getQuote()){
315
+ $this->setQuote($quote)->save();
316
+ return true;
317
+ }
318
+ }
319
+ return false;
320
+
321
+ }
322
+
323
+ public function updateTranslation(){
324
+
325
+ if ($this->getJobKey()){
326
+ $request = array();
327
+ $request['job_key'] = $this->getJobKey();
328
+ $api = $this->_getApi();
329
+ $response = $api->getTranslation($request);
330
+ if ($response->job) {
331
+ foreach ($response->job as $job) {
332
+
333
+ if ($job->token == $this->getId()) {
334
+ $jobStatusId = $this->_getStatusId($job->status);
335
+
336
+ if ($jobStatusId && $job->status <> $this->getStatusName()) {
337
+ $this->setStatusId($jobStatusId)->save();
338
+ }
339
+
340
+ if ($job->tj_number && $job->tj_number <> $this->getTjNumber()) {
341
+ $this->setTjNumber($job->tj_number)->save();
342
+ }
343
+
344
+ if ($job->workflow && $job->workflow <> $this->getWorkFlow()) {
345
+ $this->setWorkFlow($job->workflow)->save();
346
+ }
347
+ }
348
+
349
+ foreach ($job->translated_file as $file) {
350
+
351
+ if ($file->download_url && !$this->getDownloadUrl()) {
352
+ $this->setDownloadUrl($file->download_url)->save();
353
+
354
+ $this->_importTranslation();
355
+ }
356
+ }
357
+ }
358
+ $this->setLastStatus(1);
359
+ }
360
+ else{
361
+ $this->setLastStatus(0);
362
+ $message = $response->magentoMessage?$this->setLastMessage($response->magentoMessage):'Unknown Error.';
363
+ $this->setLastMessage($message);
364
+ }
365
+
366
+ }
367
+ return false;
368
+
369
+ }
370
+
371
+ protected function _getApi(){
372
+
373
+ return Mage::getModel('strakertranslations_easytranslationplatform/api',array('store'=>$this->getStoreId()));
374
+ }
375
+
376
+ protected function _getStatusId($statusName) {
377
+
378
+ return Mage::getModel('strakertranslations_easytranslationplatform/job_status')->load($statusName,'status_name')->getId();
379
+ }
380
+
381
+ protected function _importTranslation() {
382
+
383
+ $xml = $this->_getApi()->getTranslatedFile($this->getDownloadUrl());
384
+
385
+ file_put_contents(Mage::getBaseDir().$this->_translateFilePath.'translated_job'.$this->getId().'.xml',$xml, LOCK_EX);
386
+
387
+ $data = simplexml_load_string($xml);
388
+
389
+ foreach ($data->children() as $_translation) {
390
+
391
+ $_entityTranslationId = (string) $_translation->attributes()->content_id;
392
+ $_entityTranslation = Mage::getModel('strakertranslations_easytranslationplatform/'.$this->_getType().'_translate')->load($_entityTranslationId);
393
+ $_entityTranslation->setTranslate((string) $_translation->value);
394
+ $_entityTranslation->save();
395
+ $_entityTranslation->clearInstance();
396
+ }
397
+
398
+ return $this->setDownloadedVersion(1)->save();
399
+
400
+ }
401
+
402
+ protected function _getType(){
403
+ return strtolower($this->getTypeName());
404
+ }
405
+
406
+ public function updatePayment(){
407
+
408
+ if ($this->getJobKey()){
409
+ $request = array();
410
+ $request['job_key'] = $this->getJobKey();
411
+ $api = $this->_getApi();
412
+ $response = $api->getPayment($request);
413
+
414
+ if(!empty($response) && $response->status == "Paid"){ ///////waiting for payment api
415
+ $this->setPaymentStatus(1)->save();
416
+ return true;
417
+ }
418
+ }
419
+ return false;
420
+ }
421
+
422
+ public function applyTranslation( $entityIds = array()) {
423
+
424
+ $collection = Mage::getModel('strakertranslations_easytranslationplatform/'.$this->_getType().'_translate')->getCollection()->addFieldToFilter('job_id',$this->getId());
425
+
426
+ if ($entityIds) {
427
+ $collection->addFieldToFilter($this->_getType().'_id', array('in' => $entityIds));
428
+ }
429
+
430
+ $updatedIds = array();
431
+ $writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
432
+
433
+ foreach ($collection as $translation) {
434
+ $translation->setStoreId($this->getStoreId())->importTranslation();
435
+
436
+ $entityId= call_user_func(array($translation, 'get'.$this->getTypeName().'Id'));
437
+
438
+ if (!$updatedIds[$entityId]){
439
+ $updatedIds[$entityId] = true;
440
+ $writeConnection->update('straker_job_'.$this->_getType() ,array('version' => 1), $this->_getType()."_id = {$entityId} and job_id ={$this->getId()}" );
441
+ }
442
+ }
443
+
444
+ return true;
445
+ }
446
+
447
+ public function submitSupport(array $data){
448
+
449
+ $res = $this->_getApi()->callSupport($data);
450
+
451
+ return $res->success;
452
+
453
+ }
454
+
455
+ public function checkAndCreateFolder(){
456
+
457
+ $ioAdapter = new Varien_Io_File();
458
+ try {
459
+ $ioAdapter->checkAndCreateFolder(Mage::getBaseDir('var').DS.'straker');
460
+ }
461
+ catch (Exception $e) {
462
+ Mage::throwException($e->getMessage());
463
+ }
464
+
465
+ return $this;
466
+
467
+ }
468
+
469
+
470
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Category.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 12/11/15
6
+ * Time: 8:52 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Job_Category extends Mage_Core_Model_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/job_category');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Product.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 4:38 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Job_Product extends Mage_Core_Model_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/job_product');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Status.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 8:43 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Job_Status extends Mage_Core_Model_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/job_status');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Type.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 8:41 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Job_Type extends Mage_Core_Model_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/job_type');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Product/Attributes.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 8:43 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Product_Attributes extends Mage_Core_Model_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/product_attributes');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Product/Translate.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 8:46 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Product_Translate extends Mage_Core_Model_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/product_translate');
14
+ }
15
+
16
+ public function importTranslation(){
17
+
18
+ $product = Mage::getModel('catalog/product')->setStoreId($this->getStoreId())->load($this->getProductId());
19
+
20
+ $productAttributeCode = $this->_getAttributeCode($this->getAttributeId());
21
+
22
+ $this->setBackup($product->getData($productAttributeCode));
23
+
24
+ $product->setData($productAttributeCode, $this->getTranslate())
25
+ ->getResource()
26
+ ->saveAttribute($product, $productAttributeCode);
27
+ $this->setIsImported(1)->save();
28
+
29
+ $product->clearInstance();
30
+
31
+ }
32
+
33
+ protected function _getAttributeCode($attributeId){
34
+
35
+ if (!Mage::registry('attributeCodeCache_'.$attributeId)){
36
+ $productAttributeCode = Mage::getModel('eav/entity_attribute')->load($attributeId)->getAttributeCode();
37
+ Mage::register('attributeCodeCache_'.$attributeId,$productAttributeCode);
38
+ }else{
39
+ $productAttributeCode = Mage::registry('attributeCodeCache_'.$attributeId);
40
+ }
41
+ return $productAttributeCode;
42
+
43
+ }
44
+
45
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Actionlog.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 4:06 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Actionlog extends Mage_Core_Model_Resource_Db_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/actionlog', 'id');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Actionlog/Collection.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 4:06 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Actionlog_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/actionlog');
14
+ }
15
+
16
+
17
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Attributes.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 12/11/15
6
+ * Time: 8:55 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Category_Attributes extends Mage_Core_Model_Resource_Db_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/category_attributes', 'id');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Attributes/Collection.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 12/11/15
6
+ * Time: 8:55 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Category_Attributes_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/category_attributes');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Translate.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 12/11/15
6
+ * Time: 8:53 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Category_Translate extends Mage_Core_Model_Resource_Db_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/category_translate', 'id');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Translate/Collection.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 12/11/15
6
+ * Time: 8:53 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Category_Translate_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/category_translate');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Created by PhpStorm.
5
+ * User: WlliamZhao
6
+ * Date: 30/09/15
7
+ * Time: 4:37 PM
8
+ */
9
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job extends Mage_Core_Model_Resource_Db_Abstract {
10
+
11
+ protected function _construct() {
12
+ $this->_init('strakertranslations_easytranslationplatform/job', 'id');
13
+ }
14
+
15
+ protected function _getLoadSelect($field, $value, $object) {
16
+ $select = parent::_getLoadSelect($field, $value, $object)
17
+ ->join(array('t' => $this->getTable('strakertranslations_easytranslationplatform/job_type')),
18
+ 'straker_job.type_id=t.type_id',
19
+ array('type_name')
20
+ )
21
+ ->join(array('s' => $this->getTable('strakertranslations_easytranslationplatform/job_status')),
22
+ 'straker_job.status_id=s.status_id',
23
+ array('status_name')
24
+ );
25
+
26
+ return $select;
27
+ }
28
+
29
+ /**
30
+ * Prepare data for save
31
+ *
32
+ * @param Mage_Core_Model_Abstract $object
33
+ * @return array
34
+ */
35
+ protected function _prepareDataForSave(Mage_Core_Model_Abstract $object) {
36
+ $currentTime = Varien_Date::now();
37
+ if ((!$object->getId() || $object->isObjectNew()) && !$object->getCreatedAt()) {
38
+ $object->setCreatedAt($currentTime);
39
+ }
40
+ $object->setUpdatedAt($currentTime);
41
+ $data = parent::_prepareDataForSave($object);
42
+ return $data;
43
+ }
44
+
45
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Category.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 12/11/15
6
+ * Time: 8:52 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Category extends Mage_Core_Model_Resource_Db_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/job_category', 'id');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Category/Collection.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 12/11/15
6
+ * Time: 8:52 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Category_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/job_category');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Collection.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 4:37 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/job');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Product.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 4:38 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Product extends Mage_Core_Model_Resource_Db_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/job_product', 'id');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Product/Collection.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 4:38 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Product_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/job_product');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Status.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 8:43 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Status extends Mage_Core_Model_Resource_Db_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/job_status', 'status_id');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Status/Collection.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 8:43 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Status_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/job_status');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Type.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 8:41 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Type extends Mage_Core_Model_Resource_Db_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/job_type', 'type_id');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Type/Collection.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 8:41 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Type_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/job_type');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Attributes.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 8:44 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Product_Attributes extends Mage_Core_Model_Resource_Db_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/product_attributes', 'id');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Attributes/Collection.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 8:44 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Product_Attributes_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/product_attributes');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Translate.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 8:46 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Product_Translate extends Mage_Core_Model_Resource_Db_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/product_translate', 'id');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Translate/Collection.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: WlliamZhao
5
+ * Date: 30/09/15
6
+ * Time: 8:46 PM
7
+ */
8
+ class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Product_Translate_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
+ {
10
+
11
+ protected function _construct()
12
+ {
13
+ $this->_init('strakertranslations_easytranslationplatform/product_translate');
14
+ }
15
+
16
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/JobController.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ Class StrakerTranslations_EasyTranslationPlatform_Adminhtml_JobController extends Mage_Adminhtml_Controller_Action{
3
+ protected function _isAllowed()
4
+ {
5
+ return Mage::getSingleton('admin/session')->isAllowed('admin/straker/job');
6
+ }
7
+
8
+ protected function _initAction()
9
+ {
10
+ $this
11
+ ->loadLayout()
12
+ ->_setActiveMenu('straker/job')
13
+ ;
14
+
15
+ return $this;
16
+ }
17
+
18
+ public function indexAction(){
19
+ $this->_title($this->__('Straker Translations'))
20
+ ->_title($this->__('Manage Jobs'));
21
+
22
+ $this->loadLayout();
23
+ $this->renderLayout();
24
+ }
25
+
26
+ public function updateJobAction() {
27
+
28
+ $data = $this->getRequest()->getParams();
29
+ if($data['job_id']){
30
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load((int) $data['job_id']);
31
+
32
+ if(!$job->getJobKey()){
33
+ return false;
34
+ }
35
+
36
+
37
+ switch ($job->getStatusName()){
38
+
39
+ Case 'QUEUED' :
40
+
41
+ if ($job->getPaymentStatus()){
42
+ if( $job->updateTranslation() ){
43
+ Mage::getSingleton('core/session')->addSuccess($this->__('Job %s has been updated.', $job->getId()));
44
+ }
45
+ } else {
46
+
47
+ if($job->updatePayment()){
48
+ if( $job->updateTranslation() ){
49
+ Mage::getSingleton('core/session')->addSuccess($this->__('Job %s has been updated.', $job->getId()));
50
+ }
51
+
52
+ }elseif($job->updateQuote()){
53
+ Mage::getSingleton('core/session')->addSuccess($this->__('Job %s has been updated.', $job->getId()));
54
+ }
55
+
56
+ }
57
+
58
+ $this->_redirect('*/*/');
59
+ return;
60
+ break;
61
+
62
+ default:
63
+ if( $job->updateTranslation() ){
64
+ Mage::getSingleton('core/session')->addSuccess($this->__('Job %s has been updated.', $job->getId()));
65
+ }
66
+ $this->_redirect('*/*/');
67
+ return;
68
+
69
+ }
70
+
71
+ }
72
+
73
+ return false;
74
+
75
+ }
76
+
77
+
78
+ public function disputeAction() {
79
+ $data = $this->getRequest()->getParams();
80
+ if($data['job_id'] && $data['message']){
81
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load((int) $data['job_id']);
82
+
83
+
84
+ $response = $job->submitSupport(array(
85
+ 'title' => 'Dispute for '.$job->getTjNumber(),
86
+ 'message' => $data['message']
87
+ ));
88
+
89
+ //Send out email
90
+
91
+ $mail = new Zend_Mail(); //class for mail
92
+ $mail->setBodyHtml($data['message']); //for sending message containing html code
93
+ $mail->setFrom(Mage::getStoreConfig('trans_email/ident_general/email'), Mage::getStoreConfig('trans_email/ident_general/name'));
94
+ $mail->addTo('processing@strakertranslations.com', 'Straker Support');
95
+ $mail->setSubject('Dispute for '.$job->getTjNumber());
96
+ $msg ='';
97
+ Mage::log(print_r($mail,true), null , 'debugging.log' , true);
98
+ try {
99
+ if($mail->send())
100
+ {
101
+ $msg = true;
102
+ }
103
+ }
104
+ catch(Exception $ex) {
105
+ $msg = false;
106
+ }
107
+ if($msg){
108
+ Mage::getSingleton('adminhtml/session')->addSuccess('Dispute has been submitted.');
109
+ }
110
+ else{
111
+ Mage::getSingleton('adminhtml/session')->addError('Unkown error when sending email to processing@strakertranslations.com.');
112
+ }
113
+ }
114
+ else{
115
+ Mage::getSingleton('adminhtml/session')->addError('Required parameters missing when submitting a dispute.');
116
+ }
117
+ $this->_redirect('straker/adminhtml_product/index', array(
118
+ 'job_id' => $data['job_id']
119
+ ));
120
+ return;
121
+ }
122
+
123
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/NewController.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ Class StrakerTranslations_EasyTranslationPlatform_Adminhtml_NewController extends Mage_Adminhtml_Controller_Action{
3
+ protected function _isAllowed()
4
+ {
5
+ return Mage::getSingleton('admin/session')->isAllowed('admin/straker/new');
6
+ }
7
+
8
+ protected function _initAction()
9
+ {
10
+ $this
11
+ ->loadLayout()
12
+ ->_setActiveMenu('straker/new')
13
+ ;
14
+ $this->_title($this->__('Create New Job'));
15
+ return $this;
16
+ }
17
+
18
+ public function indexAction(){
19
+ $params = $this->getRequest()->getParams();
20
+ if (Mage::helper('strakertranslations_easytranslationplatform')->getAppKey() === false || Mage::helper('strakertranslations_easytranslationplatform')->getAccessToken() === false){
21
+ return $this->_initAction()
22
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_register'))
23
+ ->renderLayout();
24
+ }
25
+ elseif (empty($params['store'])){
26
+ return $this->_initAction()
27
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_selectstore'))
28
+ ->renderLayout();
29
+ }
30
+ elseif ( Mage::helper('strakertranslations_easytranslationplatform')->getStoreSetup($params['store']) === false
31
+ ){
32
+ return $this->_initAction()
33
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_setupstore', 'strakertranslations_easytranslationplatform_new_setupstore', array('setup_store_id' => $params['store'])))
34
+ ->renderLayout();
35
+ }
36
+ elseif (empty($params['attr'])) {
37
+ return $this->_initAction()
38
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_attribute','strakertranslations_easytranslationplatform_new_attribute',array('setup_store_id' => $params['store'])))
39
+ ->renderLayout();
40
+ }
41
+ else{
42
+ return $this->_initAction()
43
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_products','strakertranslations_easytranslationplatform_new_products',array('setup_store_id' => $params['store'], 'attr' => $params['attr'])))
44
+ ->renderLayout();
45
+ }
46
+ }
47
+
48
+ public function registerAction(){
49
+
50
+ $data = $this->getRequest()->getPost();
51
+ if (array_key_exists('form_key', $data)){
52
+ unset($data['form_key']);
53
+ }
54
+ if ($data['first_name'] && $data['last_name'] && $data['email'] && $data['terms']) {
55
+ if ($data['company'] == ''){
56
+ $data['company'] = $data['first_name'] .' '. $data['last_name'];
57
+ }
58
+ $apiModel = Mage::getModel('strakertranslations_easytranslationplatform/api');
59
+ $response = $apiModel->callRegister($data);
60
+ if($response->access_token && $response->application_key) {
61
+ $apiModel->saveAccessToken($response->access_token);
62
+ $apiModel->saveAppKey($response->application_key);
63
+ Mage::getSingleton('adminhtml/session')->addSuccess('Registration success.');
64
+ }
65
+ elseif($response->magentoMessage){
66
+ Mage::getSingleton('adminhtml/session')->addError($response->magentoMessage);
67
+ }
68
+ else{
69
+ Mage::getSingleton('adminhtml/session')->addError('Registration unsuccessful.');
70
+ }
71
+ }
72
+ $this->_redirect('*/*/');
73
+ }
74
+
75
+ public function selectstoreAction(){
76
+ $store = $this->getRequest()->getParam('store');
77
+ if($store){
78
+ $this->_redirect('*/*/', array('store' => $store));
79
+ }
80
+ else {
81
+ $this->_redirect('*/*/');
82
+ }
83
+ }
84
+
85
+ public function setupstoreAction(){
86
+ $data = $this->getRequest()->getParams();
87
+ if ($data['store'] && $data['source'] && $data['from'] && $data['to']) {
88
+ /** @var $session Mage_Admin_Model_Session */
89
+ $session = Mage::getSingleton('adminhtml/session');
90
+ try {
91
+ //save the source, language from and to in stystem config
92
+ $helper = Mage::helper('strakertranslations_easytranslationplatform');
93
+
94
+ if ($helper->saveStoreSetup($data['store'], $data['source'], $data['from'], $data['to']) !== false ){
95
+ $this->_redirect('*/*/', array('store' => $data['store']));
96
+ return;
97
+ }
98
+ else {
99
+ Mage::throwException(Mage::helper('strakertranslations_easytranslationplatform')->__('Unable to save store configurations.'));
100
+ }
101
+ } catch (Exception $e) {
102
+ $session->addError($e->getMessage());
103
+ $this->_redirect('*/*/');
104
+ return;
105
+ }
106
+ }
107
+ $this->_redirect('*/*/');
108
+ }
109
+
110
+ public function attributeAction(){
111
+ $data = $this->getRequest()->getParams();
112
+ if($data['attr'] && $data['store']){
113
+ $this->_redirect('*/*/', array('store' => $data['store'], 'attr' => implode(",",array_keys($data['attr']))));
114
+ }
115
+ else {
116
+ $this->_redirect('*/*/');
117
+ }
118
+ }
119
+
120
+ public function addtoconfirmAction(){
121
+ $data = $this->getRequest()->getParams();
122
+ if($data['attr'] && $data['store'] && $data['product']){
123
+ return $this->_initAction()
124
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_confirm', 'strakertranslations_easytranslationplatform_new_confirm', array('store' => $data['store'], 'attr' => $data['attr'], 'product' => $data['product'])))
125
+ ->renderLayout();
126
+ }
127
+ else {
128
+ $this->_redirect('*/*/', $data);
129
+ }
130
+ }
131
+
132
+ public function submitjobAction(){
133
+ $data = $this->getRequest()->getParams();
134
+ if($data['attr'] && $data['store'] && $data['product']){
135
+ //todo: refine attribute code and id procedure
136
+ $jobModel = Mage::getModel('strakertranslations_easytranslationplatform/job');
137
+ try {
138
+ $jobModel->checkAndCreateFolder();
139
+ }
140
+ catch (Mage_Core_Exception $e){
141
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
142
+ $this->_redirect('*/*/', array(
143
+ 'store' => $data['store'],
144
+ 'attr' => $data['attr']
145
+ ));
146
+ return;
147
+ }
148
+ foreach(explode(',', $data['attr']) as $attributeCode){
149
+ $attr_ids[] = $attribute = Mage::getSingleton('eav/config')
150
+ ->getAttribute(Mage_Catalog_Model_Product::ENTITY, $attributeCode)->getAttributeId();
151
+ }
152
+ $helper = Mage::helper('strakertranslations_easytranslationplatform');
153
+ $storeSetup = $helper->getStoreSetup($data['store']);
154
+ $jobModel->setStoreId($data['store']);
155
+ $jobModel->setSl($storeSetup['from']);
156
+ $jobModel->setTl($storeSetup['to']);
157
+ $jobModel->setTitle('Title');
158
+ $jobModel->setToken('Token');
159
+ $jobModel->submitProducts($attr_ids, explode(',',$data['product']));
160
+ if ($jobModel->getLastStatus()) {
161
+ Mage::getSingleton('adminhtml/session')->addSuccess('New job created');
162
+ $this->_redirect('*/adminhtml_job/');
163
+ }
164
+ else{
165
+ Mage::getSingleton('adminhtml/session')->addError($jobModel->getLastMessage());
166
+ $this->_redirect('*/*/');
167
+ }
168
+ }
169
+ else {
170
+ $this->_redirect('*/*/', $data);
171
+ }
172
+ }
173
+
174
+ public function clearSettingsAction()
175
+ {
176
+ $session = Mage::getSingleton('adminhtml/session');
177
+
178
+ try {
179
+ $apiModel = Mage::getModel('strakertranslations_easytranslationplatform/api');
180
+
181
+ $apiModel->saveAccessToken('');
182
+ $apiModel->saveAppKey('');
183
+
184
+ $helper = Mage::helper('strakertranslations_easytranslationplatform');
185
+ foreach (Mage::app()->getStores() as $store) {
186
+ $helper->saveStoreSetup($store->getId(), '', '', '');
187
+ }
188
+ $session->addSuccess('Straker Settings has been cleared.');
189
+
190
+ } catch (Exception $e) {
191
+ $session->addError($e->getMessage());
192
+ }
193
+ $this->_redirect('adminhtml/system_config/edit/section/straker');
194
+ return;
195
+ }
196
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/ProductController.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ Class StrakerTranslations_EasyTranslationPlatform_Adminhtml_ProductController extends Mage_Adminhtml_Controller_Action{
3
+ protected function _isAllowed()
4
+ {
5
+ return Mage::getSingleton('admin/session')->isAllowed('admin/straker/job');
6
+ }
7
+
8
+ protected function _initAction()
9
+ {
10
+ $this
11
+ ->loadLayout()
12
+ ->_setActiveMenu('straker/job')
13
+ ;
14
+
15
+ return $this;
16
+ }
17
+
18
+ public function indexAction(){
19
+
20
+ if (!$this->getRequest()->getParam('job_id')){
21
+ Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
22
+ $this->_redirect('*/adminhtml_job/');
23
+ return;
24
+ }
25
+
26
+ $this->_title($this->__('Straker Translations'))
27
+ ->_title($this->__('Manage Jobs'));
28
+
29
+ $this->loadLayout();
30
+ $this->renderLayout();
31
+
32
+ // try {
33
+ // $this->_title($this->__('Manage Jobs'));
34
+ // return $this->_initAction()
35
+ // ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_grid'))
36
+ // ->renderLayout();
37
+ // } catch (Exception $e) {
38
+ // Mage::getSingleton('core/session')->addError($this->__('Error occurred. Please contact service administrator.'));
39
+ // $this->_redirect('adminhtml/dashboard');
40
+ // }
41
+ }
42
+ public function copyAllAction(){
43
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
44
+
45
+ if (empty($job)){
46
+ Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
47
+ $this->_redirect('*/adminhtml_job/');
48
+ return;
49
+ }
50
+
51
+ if($job->applyTranslation()) {
52
+ Mage::getSingleton('adminhtml/session')->addSuccess('Translation has been copied.');
53
+ $this->_redirect('*/adminhtml_job/');
54
+ return;
55
+ } else {
56
+ Mage::getSingleton('adminhtml/session')->addError('Error when copying translation.');
57
+ $this->_redirect('*/adminhtml_job/');
58
+ return;
59
+ }
60
+
61
+
62
+ }
63
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/CategoryController.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ Class StrakerTranslations_EasyTranslationPlatform_Adminhtml_Straker_CategoryController extends Mage_Adminhtml_Controller_Action{
3
+
4
+ protected function _isAllowed()
5
+ {
6
+ return Mage::getSingleton('admin/session')->isAllowed('admin/straker/job');
7
+ }
8
+
9
+ protected function _initAction()
10
+ {
11
+ $this
12
+ ->loadLayout()
13
+ ->_setActiveMenu('straker/job')
14
+ ;
15
+
16
+ return $this;
17
+ }
18
+
19
+ protected function _initNewAction()
20
+ {
21
+ $this
22
+ ->loadLayout()
23
+ ->_setActiveMenu('straker/new')
24
+ ;
25
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
26
+ $this->_title($this->__('Create New Job'));
27
+ return $this;
28
+ }
29
+
30
+ public function newAction(){
31
+ $params = $this->getRequest()->getParams();
32
+ if (empty($params['store'])) {
33
+ $this->_redirect('*/straker_new');
34
+ return;
35
+ }
36
+ elseif (empty($params['attr'])) {
37
+ return $this->_initNewAction()
38
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_category_attribute', 'strakertranslations_easytranslationplatform_new_categories_attribute', array('setup_store_id' => $params['store'])))
39
+ ->renderLayout();
40
+ }
41
+ else{
42
+ return $this->_initNewAction()
43
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_category_tree', 'strakertranslations_easytranslationplatform_l_new_category_tree', array('setup_store_id' => $params['store'], 'attr' => $params['attr'])))
44
+ ->renderLayout();
45
+ }
46
+ }
47
+
48
+ public function attributeAction(){
49
+ $data = $this->getRequest()->getParams();
50
+ if($data['attr'] && $data['store']){
51
+ $this->_redirect('*/*/new', array('store' => $data['store'], 'attr' => implode(",",array_keys($data['attr']))));
52
+ }
53
+ else {
54
+ $this->_redirect('*/straker_new/');
55
+ }
56
+ }
57
+
58
+ public function confirmCategoryAction(){
59
+ $data = $this->getRequest()->getParams();
60
+ //format category
61
+ $categoryIds = array_filter(array_unique(explode(',', $data['category'])));
62
+ if($data['attr'] && $data['store'] && !empty($categoryIds)) {
63
+ return $this->_initNewAction()
64
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_category_confirm', 'strakertranslations_easytranslationplatform__new_category_confirm', array('store' => $data['store'], 'attr' => $data['attr'], 'category' => $categoryIds)))
65
+ ->renderLayout();
66
+ }
67
+ else{
68
+ $this->_redirect('*/*/new', array('attr'=>$data['attr'],'store'=>$data['store']));
69
+ }
70
+ }
71
+
72
+ public function submitjobAction()
73
+ {
74
+ $data = $this->getRequest()->getParams();
75
+ if($data['attr'] && $data['store'] && $data['category']){
76
+ $jobModel = Mage::getModel('strakertranslations_easytranslationplatform/job');
77
+ try {
78
+ $jobModel->checkAndCreateFolder();
79
+ }
80
+ catch (Mage_Core_Exception $e){
81
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
82
+ $this->_redirect('*/*/', array(
83
+ 'store' => $data['store'],
84
+ 'attr' => $data['attr']
85
+ ));
86
+ return;
87
+ }
88
+ foreach(explode(',', $data['attr']) as $attributeCode){
89
+ $attr_ids[] = $attribute = Mage::getSingleton('eav/config')
90
+ ->getAttribute(Mage_Catalog_Model_Category::ENTITY, $attributeCode)->getAttributeId();
91
+ }
92
+ $helper = Mage::helper('strakertranslations_easytranslationplatform');
93
+ $storeSetup = $helper->getStoreSetup($data['store']);
94
+ $jobModel->setStoreId($data['store']);
95
+ $jobModel->setSl($storeSetup['from']);
96
+ $jobModel->setTl($storeSetup['to']);
97
+ $jobModel->setTitle('Title');
98
+ $jobModel->setToken('Token');
99
+ $jobModel->submitCategories($attr_ids, explode(',',$data['category']));
100
+ if ($jobModel->getLastStatus()) {
101
+ Mage::getSingleton('adminhtml/session')->addSuccess('New job created');
102
+ $this->_redirect('*/straker_job/');
103
+ }
104
+ else{
105
+ Mage::getSingleton('adminhtml/session')->addError($jobModel->getLastMessage());
106
+ $this->_redirect('*/*/new');
107
+ }
108
+ }
109
+ else {
110
+ $this->_redirect('*/*/new', $data);
111
+ }
112
+
113
+ }
114
+
115
+ public function categoriesJsonAction()
116
+ {
117
+ $this->getResponse()->setBody(
118
+ $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_category_tree')
119
+ ->getCategoryChildrenJson($this->getRequest()->getParam('category'))
120
+ );
121
+ }
122
+
123
+ public function indexAction(){
124
+
125
+ if (!$this->getRequest()->getParam('job_id')){
126
+ Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
127
+ $this->_redirect('*/straker_job/');
128
+ return;
129
+ }
130
+
131
+ $this->_title($this->__('Straker Translations'))
132
+ ->_title($this->__('Manage Jobs'));
133
+
134
+ $this->loadLayout()->_setActiveMenu('straker/job');
135
+ $this->renderLayout();
136
+
137
+ // try {
138
+ // $this->_title($this->__('Manage Jobs'));
139
+ // return $this->_initAction()
140
+ // ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_grid'))
141
+ // ->renderLayout();
142
+ // } catch (Exception $e) {
143
+ // Mage::getSingleton('core/session')->addError($this->__('Error occurred. Please contact service administrator.'));
144
+ // $this->_redirect('adminhtml/dashboard');
145
+ // }
146
+ }
147
+
148
+ public function copyAllAction(){
149
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
150
+
151
+ if (!$job->getId()){
152
+ Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
153
+ $this->_redirect('*/straker_job/');
154
+ return;
155
+ }
156
+
157
+ if($job->applyTranslation()) {
158
+ Mage::getSingleton('adminhtml/session')->addSuccess('Translation has been applied.');
159
+ $this->_redirect('*/straker_job/');
160
+ return;
161
+ } else {
162
+ Mage::getSingleton('adminhtml/session')->addError('Error when applying translation.');
163
+ $this->_redirect('*/straker_job/');
164
+ return;
165
+ }
166
+
167
+ }
168
+
169
+ public function applyTranslationAction(){
170
+ $jobId = $this->getRequest()->getParam('job_id');
171
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId);
172
+
173
+ if (!$job->getId()){
174
+ Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
175
+ $this->_redirect('*/straker_job/');
176
+ return;
177
+ }
178
+ $categoryIds = $this->getRequest()->getParam('category');
179
+ if(!empty($categoryIds)) {
180
+ if ($job->applyTranslation($categoryIds)) {
181
+ Mage::getSingleton('adminhtml/session')->addSuccess('Translation has been applied.');
182
+ $this->_redirect('*/straker_category/',array('job_id' => $jobId));
183
+ return;
184
+ } else {
185
+ Mage::getSingleton('adminhtml/session')->addError('Error when applying translation.');
186
+ $this->_redirect('*/straker_category/',array('job_id' => $jobId));
187
+ return;
188
+ }
189
+ }
190
+ else{
191
+ Mage::getSingleton('adminhtml/session')->addError('Please select categorys to apply the translation.');
192
+ $this->_redirect('*/straker_category/',array('job_id' => $jobId));
193
+ return;
194
+ }
195
+
196
+ }
197
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/JobController.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ Class StrakerTranslations_EasyTranslationPlatform_Adminhtml_Straker_JobController extends Mage_Adminhtml_Controller_Action{
3
+ protected function _isAllowed()
4
+ {
5
+ return Mage::getSingleton('admin/session')->isAllowed('admin/straker/job');
6
+ }
7
+
8
+ protected function _initAction()
9
+ {
10
+ $this
11
+ ->loadLayout()
12
+ ->_setActiveMenu('straker/job')
13
+ ;
14
+
15
+ return $this;
16
+ }
17
+
18
+ public function indexAction(){
19
+ $this->_title($this->__('Straker Translations'))
20
+ ->_title($this->__('Manage Jobs'));
21
+
22
+ $this->loadLayout();
23
+ $this->renderLayout();
24
+ }
25
+
26
+ public function updateJobAction() {
27
+
28
+ $data = $this->getRequest()->getParams();
29
+ if($data['job_id']){
30
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load((int) $data['job_id']);
31
+
32
+ if(!$job->getJobKey()){
33
+ return false;
34
+ }
35
+
36
+
37
+ switch ($job->getStatusName()){
38
+
39
+ Case 'QUEUED' :
40
+
41
+ if ($job->getPaymentStatus()){
42
+ if( $job->updateTranslation() ){
43
+ Mage::getSingleton('core/session')->addSuccess($this->__('Job %s has been updated.', $job->getId()));
44
+ }
45
+ } else {
46
+
47
+ if($job->updatePayment()){
48
+ if( $job->updateTranslation() ){
49
+ Mage::getSingleton('core/session')->addSuccess($this->__('Job %s has been updated.', $job->getId()));
50
+ }
51
+
52
+ }elseif($job->updateQuote()){
53
+ Mage::getSingleton('core/session')->addSuccess($this->__('Job %s has been updated.', $job->getId()));
54
+ }
55
+
56
+ }
57
+
58
+ $this->_redirect('*/*/');
59
+ return;
60
+ break;
61
+
62
+ default:
63
+ if( $job->updateTranslation() ){
64
+ Mage::getSingleton('core/session')->addSuccess($this->__('Job %s has been updated.', $job->getId()));
65
+ }
66
+ $this->_redirect('*/*/');
67
+ return;
68
+
69
+ }
70
+
71
+ }
72
+
73
+ return false;
74
+
75
+ }
76
+
77
+
78
+ public function disputeAction() {
79
+ $data = $this->getRequest()->getParams();
80
+ if($data['job_id'] && $data['message']){
81
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load((int) $data['job_id']);
82
+
83
+
84
+ $response = $job->submitSupport(array(
85
+ 'title' => 'Dispute for '.$job->getTjNumber(),
86
+ 'message' => $data['message']
87
+ ));
88
+
89
+ //Send out email
90
+
91
+ $mail = new Zend_Mail(); //class for mail
92
+ $mail->setBodyHtml($data['message']); //for sending message containing html code
93
+ $mail->setFrom(Mage::getStoreConfig('trans_email/ident_general/email'), Mage::getStoreConfig('trans_email/ident_general/name'));
94
+ $mail->addTo('processing@strakertranslations.com', 'Straker Support');
95
+ $mail->setSubject('Dispute for '.$job->getTjNumber());
96
+ $msg ='';
97
+ Mage::log(print_r($mail,true), null , 'debugging.log' , true);
98
+ try {
99
+ if($mail->send())
100
+ {
101
+ $msg = true;
102
+ }
103
+ }
104
+ catch(Exception $ex) {
105
+ $msg = false;
106
+ }
107
+ if($msg){
108
+ Mage::getSingleton('adminhtml/session')->addSuccess('Feedback has been submitted.');
109
+ }
110
+ else{
111
+ Mage::getSingleton('adminhtml/session')->addError('Unkown error when sending email to processing@strakertranslations.com.');
112
+ }
113
+ }
114
+ else{
115
+ Mage::getSingleton('adminhtml/session')->addError('Required parameters missing when submitting a feedback.');
116
+ }
117
+ $this->_redirect('adminhtml/straker_product/index', array(
118
+ 'job_id' => $data['job_id']
119
+ ));
120
+ return;
121
+ }
122
+
123
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/NewController.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ Class StrakerTranslations_EasyTranslationPlatform_Adminhtml_Straker_NewController extends Mage_Adminhtml_Controller_Action{
3
+ protected function _isAllowed()
4
+ {
5
+ return Mage::getSingleton('admin/session')->isAllowed('admin/straker/new');
6
+ }
7
+
8
+ protected function _initAction()
9
+ {
10
+ $this
11
+ ->loadLayout()
12
+ ->_setActiveMenu('straker/new')
13
+ ;
14
+ $this->_title($this->__('Create New Job'));
15
+ return $this;
16
+ }
17
+
18
+ public function indexAction(){
19
+ $params = $this->getRequest()->getParams();
20
+ if (Mage::helper('strakertranslations_easytranslationplatform')->getAppKey() === false || Mage::helper('strakertranslations_easytranslationplatform')->getAccessToken() === false){
21
+ return $this->_initAction()
22
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_register'))
23
+ ->renderLayout();
24
+ }
25
+ elseif (empty($params['store'])){
26
+ return $this->_initAction()
27
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_selectstore'))
28
+ ->renderLayout();
29
+ }
30
+ elseif ( Mage::helper('strakertranslations_easytranslationplatform')->getStoreSetup($params['store']) === false
31
+ ){
32
+ return $this->_initAction()
33
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_setupstore', 'strakertranslations_easytranslationplatform_new_setupstore', array('setup_store_id' => $params['store'])))
34
+ ->renderLayout();
35
+ }
36
+ else{
37
+ return $this->_initAction()
38
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_type','strakertranslations_easytranslationplatform_new_type',array('setup_store_id' => $params['store'])))
39
+ ->renderLayout();
40
+ }
41
+ // elseif (empty($params['attr'])) {
42
+ // return $this->_initAction()
43
+ // ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_attribute','strakertranslations_easytranslationplatform_new_attribute',array('setup_store_id' => $params['store'])))
44
+ // ->renderLayout();
45
+ // }
46
+ // else{
47
+ // return $this->_initAction()
48
+ // ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_products','strakertranslations_easytranslationplatform_new_products',array('setup_store_id' => $params['store'], 'attr' => $params['attr'])))
49
+ // ->renderLayout();
50
+ // }
51
+ }
52
+
53
+ public function registerAction(){
54
+
55
+ $data = $this->getRequest()->getPost();
56
+ if (array_key_exists('form_key', $data)){
57
+ unset($data['form_key']);
58
+ }
59
+ if ($data['first_name'] && $data['last_name'] && $data['email'] && $data['terms']) {
60
+ if ($data['company'] == ''){
61
+ $data['company'] = $data['first_name'] .' '. $data['last_name'];
62
+ }
63
+ $apiModel = Mage::getModel('strakertranslations_easytranslationplatform/api');
64
+ $response = $apiModel->callRegister($data);
65
+ if($response->access_token && $response->application_key) {
66
+ $apiModel->saveAccessToken($response->access_token);
67
+ $apiModel->saveAppKey($response->application_key);
68
+ Mage::getSingleton('adminhtml/session')->addSuccess('Registration success.');
69
+ }
70
+ elseif($response->magentoMessage){
71
+ Mage::getSingleton('adminhtml/session')->addError($response->magentoMessage);
72
+ }
73
+ else{
74
+ Mage::getSingleton('adminhtml/session')->addError('Registration unsuccessful.');
75
+ }
76
+ }
77
+ $this->_redirect('*/*/');
78
+ }
79
+
80
+ public function selectstoreAction(){
81
+ $store = $this->getRequest()->getParam('store');
82
+ if($store){
83
+ $this->_redirect('*/*/', array('store' => $store));
84
+ }
85
+ else {
86
+ $this->_redirect('*/*/');
87
+ }
88
+ }
89
+
90
+ public function setupstoreAction(){
91
+ $data = $this->getRequest()->getParams();
92
+ if ($data['store'] && $data['source'] && $data['from'] && $data['to']) {
93
+ /** @var $session Mage_Admin_Model_Session */
94
+ $session = Mage::getSingleton('adminhtml/session');
95
+ try {
96
+ //save the source, language from and to in stystem config
97
+ $helper = Mage::helper('strakertranslations_easytranslationplatform');
98
+
99
+ if ($helper->saveStoreSetup($data['store'], $data['source'], $data['from'], $data['to']) !== false ){
100
+ $this->_redirect('*/*/', array('store' => $data['store']));
101
+ return;
102
+ }
103
+ else {
104
+ Mage::throwException(Mage::helper('strakertranslations_easytranslationplatform')->__('Unable to save store configurations.'));
105
+ }
106
+ } catch (Exception $e) {
107
+ $session->addError($e->getMessage());
108
+ $this->_redirect('*/*/');
109
+ return;
110
+ }
111
+ }
112
+ $this->_redirect('*/*/');
113
+ }
114
+
115
+ public function clearSettingsAction()
116
+ {
117
+ $session = Mage::getSingleton('adminhtml/session');
118
+
119
+ try {
120
+ $apiModel = Mage::getModel('strakertranslations_easytranslationplatform/api');
121
+
122
+ $apiModel->saveAccessToken('');
123
+ $apiModel->saveAppKey('');
124
+
125
+ $helper = Mage::helper('strakertranslations_easytranslationplatform');
126
+ foreach (Mage::app()->getStores() as $store) {
127
+ $helper->saveStoreSetup($store->getId(), '', '', '');
128
+ }
129
+ $session->addSuccess('Straker Settings has been cleared.');
130
+
131
+ } catch (Exception $e) {
132
+ $session->addError($e->getMessage());
133
+ }
134
+ $this->_redirect('adminhtml/system_config/edit/section/straker');
135
+ return;
136
+ }
137
+
138
+ public function copyProdcutTableAction()
139
+ {
140
+ $session = Mage::getSingleton('adminhtml/session');
141
+
142
+ try {
143
+
144
+ $writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
145
+
146
+ $sql = 'CREATE TABLE catalog_product_entity_varchar_back AS SELECT * FROM catalog_product_entity_varchar;';
147
+
148
+ $writeConnection->query($sql);
149
+
150
+ $sql = 'CREATE TABLE catalog_product_entity_text_back AS SELECT * FROM catalog_product_entity_text;';
151
+
152
+ $writeConnection->query($sql);
153
+
154
+ $sql = 'CREATE TABLE catalog_category_entity_varchar_back AS SELECT * FROM catalog_category_entity_varchar;';
155
+
156
+ $writeConnection->query($sql);
157
+
158
+ $sql = 'CREATE TABLE catalog_category_entity_text_back AS SELECT * FROM catalog_category_entity_text;';
159
+
160
+ $writeConnection->query($sql);
161
+
162
+ $session->addSuccess('product and category entity tables has been duplicated ');
163
+
164
+ } catch (Exception $e) {
165
+ $session->addError($e->getMessage());
166
+ }
167
+ $this->_redirect('adminhtml/system_config/edit/section/straker');
168
+ return;
169
+ }
170
+
171
+ public function restoreProdcutTableAction()
172
+ {
173
+ $session = Mage::getSingleton('adminhtml/session');
174
+
175
+ try {
176
+
177
+ $writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
178
+
179
+ if ($writeConnection->query("SELECT 1 FROM catalog_product_entity_varchar_back LIMIT 1")){
180
+
181
+ $sql = 'DELETE FROM straker_job';
182
+ $writeConnection->query($sql);
183
+
184
+ $sql = 'TRUNCATE catalog_product_entity_varchar; INSERT INTO catalog_product_entity_varchar SELECT * FROM catalog_product_entity_varchar_back;';
185
+
186
+ $writeConnection->query($sql);
187
+
188
+ $sql = 'TRUNCATE catalog_product_entity_text; INSERT INTO catalog_product_entity_text SELECT * FROM catalog_product_entity_text_back;';
189
+
190
+ $writeConnection->query($sql);
191
+
192
+ $sql = 'TRUNCATE catalog_category_entity_varchar; INSERT INTO catalog_category_entity_varchar SELECT * FROM catalog_category_entity_varchar_back;';
193
+
194
+ $writeConnection->query($sql);
195
+
196
+ $sql = 'TRUNCATE catalog_category_entity_text; INSERT INTO catalog_category_entity_text SELECT * FROM catalog_category_entity_text_back;';
197
+
198
+ $writeConnection->query($sql);
199
+
200
+ $session->addSuccess('product and category entity tables has been restored ');
201
+ }
202
+
203
+ } catch (Exception $e) {
204
+ $session->addError($e->getMessage());
205
+ }
206
+ $this->_redirect('adminhtml/system_config/edit/section/straker');
207
+ return;
208
+ }
209
+
210
+
211
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/ProductController.php ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ Class StrakerTranslations_EasyTranslationPlatform_Adminhtml_Straker_ProductController extends Mage_Adminhtml_Controller_Action{
3
+ protected function _isAllowed()
4
+ {
5
+ return Mage::getSingleton('admin/session')->isAllowed('admin/straker/job');
6
+ }
7
+
8
+ protected function _initAction()
9
+ {
10
+ $this
11
+ ->loadLayout()
12
+ ->_setActiveMenu('straker/job')
13
+ ;
14
+
15
+ return $this;
16
+ }
17
+
18
+ protected function _initNewAction()
19
+ {
20
+ $this
21
+ ->loadLayout()
22
+ ->_setActiveMenu('straker/new')
23
+ ;
24
+
25
+ return $this;
26
+ }
27
+
28
+
29
+ public function indexAction(){
30
+
31
+ if (!$this->getRequest()->getParam('job_id')){
32
+ Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
33
+ $this->_redirect('*/straker_job/');
34
+ return;
35
+ }
36
+
37
+ $this->_title($this->__('Straker Translations'))
38
+ ->_title($this->__('Manage Jobs'));
39
+
40
+ $this->loadLayout()->_setActiveMenu('straker/job');
41
+ $this->renderLayout();
42
+
43
+ // try {
44
+ // $this->_title($this->__('Manage Jobs'));
45
+ // return $this->_initAction()
46
+ // ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_grid'))
47
+ // ->renderLayout();
48
+ // } catch (Exception $e) {
49
+ // Mage::getSingleton('core/session')->addError($this->__('Error occurred. Please contact service administrator.'));
50
+ // $this->_redirect('adminhtml/dashboard');
51
+ // }
52
+ }
53
+
54
+ public function newAction(){
55
+ $params = $this->getRequest()->getParams();
56
+ if (empty($params['store'])) {
57
+ $this->_redirect('*/straker_new');
58
+ return;
59
+ }
60
+ elseif (empty($params['attr'])) {
61
+ return $this->_initNewAction()
62
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_products_attribute','strakertranslations_easytranslationplatform_new_products_attribute',array('setup_store_id' => $params['store'])))
63
+ ->renderLayout();
64
+ }
65
+ else{
66
+ return $this->_initNewAction()
67
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_products','strakertranslations_easytranslationplatform_new_products',array('setup_store_id' => $params['store'], 'attr' => $params['attr'])))
68
+ ->renderLayout();
69
+ }
70
+ }
71
+
72
+
73
+ public function attributeAction(){
74
+ $data = $this->getRequest()->getParams();
75
+ if($data['attr'] && $data['store']){
76
+ $this->_redirect('*/*/new', array('store' => $data['store'], 'attr' => implode(",",array_keys($data['attr']))));
77
+ }
78
+ else {
79
+ $this->_redirect('*/straker_new/');
80
+ }
81
+ }
82
+
83
+ public function addtoconfirmAction(){
84
+ $data = $this->getRequest()->getParams();
85
+ if($data['attr'] && $data['store'] && $data['product']){
86
+ return $this->_initAction()
87
+ ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_products_confirm', 'strakertranslations_easytranslationplatform_new_products_confirm', array('store' => $data['store'], 'attr' => $data['attr'], 'product' => $data['product'])))
88
+ ->renderLayout();
89
+ }
90
+ else {
91
+ $this->_redirect('*/straker_new/', $data);
92
+ }
93
+ }
94
+
95
+ public function submitjobAction(){
96
+ $data = $this->getRequest()->getParams();
97
+ if($data['attr'] && $data['store'] && $data['product']){
98
+ $jobModel = Mage::getModel('strakertranslations_easytranslationplatform/job');
99
+ try {
100
+ $jobModel->checkAndCreateFolder();
101
+ }
102
+ catch (Mage_Core_Exception $e){
103
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
104
+ $this->_redirect('*/*/', array(
105
+ 'store' => $data['store'],
106
+ 'attr' => $data['attr']
107
+ ));
108
+ return;
109
+ }
110
+ foreach(explode(',', $data['attr']) as $attributeCode){
111
+ $attr_ids[] = $attribute = Mage::getSingleton('eav/config')
112
+ ->getAttribute(Mage_Catalog_Model_Product::ENTITY, $attributeCode)->getAttributeId();
113
+ }
114
+ $helper = Mage::helper('strakertranslations_easytranslationplatform');
115
+ $storeSetup = $helper->getStoreSetup($data['store']);
116
+ $jobModel->setStoreId($data['store']);
117
+ $jobModel->setSl($storeSetup['from']);
118
+ $jobModel->setTl($storeSetup['to']);
119
+ $jobModel->setTitle('Title');
120
+ $jobModel->setToken('Token');
121
+ $jobModel->submitProducts($attr_ids, explode(',',$data['product']));
122
+ if ($jobModel->getLastStatus()) {
123
+ Mage::getSingleton('adminhtml/session')->addSuccess('New job created');
124
+ $this->_redirect('*/straker_job/');
125
+ }
126
+ else{
127
+ Mage::getSingleton('adminhtml/session')->addError($jobModel->getLastMessage());
128
+ $this->_redirect('*/*/new');
129
+ }
130
+ }
131
+ else {
132
+ $this->_redirect('*/*/new', $data);
133
+ }
134
+ }
135
+
136
+ public function copyAllAction(){
137
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
138
+
139
+ if (!$job->getId()){
140
+ Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
141
+ $this->_redirect('*/straker_job/');
142
+ return;
143
+ }
144
+
145
+ if($job->applyTranslation()) {
146
+ Mage::getSingleton('adminhtml/session')->addSuccess('Translation has been applied.');
147
+ $this->_redirect('*/straker_job/');
148
+ return;
149
+ } else {
150
+ Mage::getSingleton('adminhtml/session')->addError('Error when applying translation.');
151
+ $this->_redirect('*/straker_job/');
152
+ return;
153
+ }
154
+
155
+ }
156
+
157
+ public function applyTranslationAction(){
158
+ $jobId = $this->getRequest()->getParam('job_id');
159
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId);
160
+
161
+ if (!$job->getId()){
162
+ Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
163
+ $this->_redirect('*/straker_job/');
164
+ return;
165
+ }
166
+ $productIds = $this->getRequest()->getParam('product');
167
+ if(!empty($productIds)) {
168
+ if ($job->applyTranslation($productIds)) {
169
+ Mage::getSingleton('adminhtml/session')->addSuccess('Translation has been applied.');
170
+ $this->_redirect('*/straker_product/',array('job_id' => $jobId));
171
+ return;
172
+ } else {
173
+ Mage::getSingleton('adminhtml/session')->addError('Error when applying translation.');
174
+ $this->_redirect('*/straker_product/',array('job_id' => $jobId));
175
+ return;
176
+ }
177
+ }
178
+ else{
179
+ Mage::getSingleton('adminhtml/session')->addError('Please select products to apply the translation.');
180
+ $this->_redirect('*/straker_product/',array('job_id' => $jobId));
181
+ return;
182
+ }
183
+
184
+ }
185
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/CallbackController.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_CallbackController extends Mage_Core_Controller_Front_Action{
3
+ function indexAction(){
4
+ $data = $this->getRequest()->getPost();
5
+ Mage::log(print_r($data,true), null , 'straker_callback.log' , true);
6
+
7
+ $this->getResponse()->setHeader('Content-type', 'application/json');
8
+
9
+ if ($data['token'] && $data['event'] ){
10
+
11
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load((int) $data['token']);
12
+
13
+ switch ($data['event']){
14
+
15
+ case 'quote_ready' :
16
+
17
+ if ($job->getJobKey() && $job->updateQuote()){
18
+ $this->getResponse()->setBody('{status: success}');
19
+ }
20
+
21
+ break;
22
+
23
+ case 'translation_ready' :
24
+
25
+ if ($job->getJobKey() && $job->updateTranslation()){
26
+ $this->getResponse()->setBody('{status: success}');
27
+ }
28
+
29
+ break;
30
+
31
+ }
32
+
33
+ } else{
34
+ $this->getResponse()->setHeader('HTTP/1.0', '400', true);
35
+ $this->getResponse()->setBody('{status: error, message: parameter missing, token: '.$data['token'].', event: '.$data['event'].'}');
36
+ }
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+ }
45
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/adminhtml.xml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <menu>
4
+ <straker>
5
+ <title>Straker Translations</title>
6
+ <class>test</class>
7
+ <label><![CDATA[<div style="position: absolute;"><img id="straker_logo" src="" alt="" border="0" /></div>&nbsp;<script>
8
+ var n = SKIN_URL.indexOf("adminhtml");
9
+ $('straker_logo').src = SKIN_URL.substring(0, n) + "adminhtml/default/straker/images/straker/straker-translations-logo.png";
10
+ </script>]]></label>
11
+ <sort_order>71</sort_order>
12
+ <children>
13
+ <new translate="title">
14
+ <title>Create New Job</title>
15
+ <sort_order>0</sort_order>
16
+ <action>adminhtml/straker_new/index</action>
17
+ </new>
18
+ <job translate="title">
19
+ <title>Manage Jobs</title>
20
+ <sort_order>0</sort_order>
21
+ <action>adminhtml/straker_job/index</action>
22
+ </job>
23
+ <settings translate="title">
24
+ <title>Settings</title>
25
+ <action>adminhtml/system_config/edit/section/straker</action>
26
+ <sort_order>40</sort_order>
27
+ </settings>
28
+ </children>
29
+ </straker>
30
+ </menu>
31
+ <acl>
32
+ <resources>
33
+ <all>
34
+ <title>Allow Everything</title>
35
+ </all>
36
+ <admin>
37
+ <children>
38
+ <straker>
39
+ <title>Easy Translation Platform</title>
40
+ <sort_order>70</sort_order>
41
+ <children>
42
+ <new>
43
+ <title>Create a Translation Job</title>
44
+ <sort_order>0</sort_order>
45
+ </new>
46
+ <job>
47
+ <title>Manage Jobs</title>
48
+ <sort_order>1</sort_order>
49
+ </job>
50
+ </children>
51
+ </straker>
52
+ <system>
53
+ <children>
54
+ <config>
55
+ <children>
56
+ <straker>
57
+ <title>Easy Translation Platform</title>
58
+ </straker>
59
+ </children>
60
+ </config>
61
+ </children>
62
+ </system>
63
+ </children>
64
+ </admin>
65
+ </resources>
66
+ </acl>
67
+ </config>
app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/config.xml ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <StrakerTranslations_EasyTranslationPlatform>
5
+ <version>0.2.0</version>
6
+ </StrakerTranslations_EasyTranslationPlatform>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <strakertranslations_easytranslationplatform>
11
+ <class>StrakerTranslations_EasyTranslationPlatform_Model</class>
12
+ <resourceModel>strakertranslations_easytranslationplatform_resource</resourceModel>
13
+ </strakertranslations_easytranslationplatform>
14
+ <strakertranslations_easytranslationplatform_resource>
15
+ <class>StrakerTranslations_EasyTranslationPlatform_Model_Resource</class>
16
+ <entities>
17
+ <actionlog>
18
+ <table>straker_actionlog</table>
19
+ </actionlog>
20
+ <job>
21
+ <table>straker_job</table>
22
+ </job>
23
+ <job_product>
24
+ <table>straker_job_product</table>
25
+ </job_product>
26
+ <job_type>
27
+ <table>straker_job_type</table>
28
+ </job_type>
29
+ <job_status>
30
+ <table>straker_job_status</table>
31
+ </job_status>
32
+ <product_attributes>
33
+ <table>straker_product_attributes</table>
34
+ </product_attributes>
35
+ <product_translate>
36
+ <table>straker_product_translate</table>
37
+ </product_translate>
38
+ <job_category>
39
+ <table>straker_job_category</table>
40
+ </job_category>
41
+ <category_translate>
42
+ <table>straker_category_translate</table>
43
+ </category_translate>
44
+ <category_attributes>
45
+ <table>straker_category_attributes</table>
46
+ </category_attributes>
47
+ </entities>
48
+ </strakertranslations_easytranslationplatform_resource>
49
+ </models>
50
+ <blocks>
51
+ <strakertranslations_easytranslationplatform>
52
+ <class>StrakerTranslations_EasyTranslationPlatform_Block</class>
53
+ </strakertranslations_easytranslationplatform>
54
+ </blocks>
55
+ <helpers>
56
+ <strakertranslations_easytranslationplatform>
57
+ <class>StrakerTranslations_EasyTranslationPlatform_Helper</class>
58
+ </strakertranslations_easytranslationplatform>
59
+ </helpers>
60
+ <resources>
61
+ <strakertranslations_easytranslationplatform_setup>
62
+ <setup>
63
+ <module>StrakerTranslations_EasyTranslationPlatform</module>
64
+ </setup>
65
+ </strakertranslations_easytranslationplatform_setup>
66
+ </resources>
67
+ </global>
68
+ <admin>
69
+ <routers>
70
+ <adminhtml>
71
+ <args>
72
+ <modules>
73
+ <StrakerTranslations before="Mage_Adminhtml">StrakerTranslations_EasyTranslationPlatform_Adminhtml</StrakerTranslations>
74
+ </modules>
75
+ </args>
76
+ </adminhtml>
77
+ </routers>
78
+ </admin>
79
+ <frontend>
80
+ <routers>
81
+ <StrakerTranslations>
82
+ <use>standard</use>
83
+ <args>
84
+ <module>StrakerTranslations_EasyTranslationPlatform</module>
85
+ <frontName>straker</frontName>
86
+ </args>
87
+ </StrakerTranslations>
88
+ </routers>
89
+ </frontend>
90
+ <stores>
91
+ <admin>
92
+ <design>
93
+ <package>
94
+ <name>default</name>
95
+ </package>
96
+ <theme>
97
+ <default>straker</default>
98
+ </theme>
99
+ </design>
100
+ </admin>
101
+ </stores>
102
+ <adminhtml>
103
+ <layout>
104
+ <updates>
105
+ <StrakerTranslations_EasyTranslationPlatform>
106
+ <file>straker.xml</file>
107
+ </StrakerTranslations_EasyTranslationPlatform>
108
+ </updates>
109
+ </layout>
110
+ </adminhtml>
111
+ <default>
112
+ <straker>
113
+ <api_url>
114
+ <register>https://uat-magento-api.strakertranslations.com/v1/register</register>
115
+ <languages>https://uat-magento-api.strakertranslations.com/v1/languages</languages>
116
+ <translate>https://uat-magento-api.strakertranslations.com/v1/translate</translate>
117
+ <quote>https://uat-magento-api.strakertranslations.com/v1/quote</quote>
118
+ <payment>https://uat-magento-api.strakertranslations.com/v1/payment</payment>
119
+ <countries>https://uat-magento-api.strakertranslations.com/v1/countries</countries>
120
+ <payment>https://uat-magento-api.strakertranslations.com/v1/payment</payment>
121
+ <payment_page>http://uat-api-myaccount.strakertranslations.com/o/?action=api.quote</payment_page>
122
+ <support>https://uat-magento-api.strakertranslations.com/v1/support</support>
123
+ </api_url>
124
+ </straker>
125
+ </default>
126
+ </config>
app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/system.xml ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <straker translate="label">
5
+ <label>Straker Translations</label>
6
+ <sort_order>10</sort_order>
7
+ </straker>
8
+ </tabs>
9
+ <sections>
10
+ <straker>
11
+ <label>Easy Translation Platform</label>
12
+ <tab>straker</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>20</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <general translate="label">
20
+ <label>Account</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>100</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <access_token translate="label comment" >
28
+ <label>Access Token</label>
29
+ <frontend_type>text</frontend_type>
30
+ <sort_order>10</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ </access_token>
35
+ <application_key translate="label comment" >
36
+ <label>Application Key</label>
37
+ <frontend_type>text</frontend_type>
38
+ <sort_order>20</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
+ </application_key>
43
+ <clear translate="label">
44
+ <label>Clear All Settings</label>
45
+ <frontend_type>button</frontend_type>
46
+ <frontend_model>strakertranslations_easytranslationplatform/adminhtml_system_config_form_button</frontend_model>
47
+ <sort_order>30</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ </clear>
52
+ <backup translate="label">
53
+ <label>Backup Product Data</label>
54
+ <frontend_type>button</frontend_type>
55
+ <frontend_model>strakertranslations_easytranslationplatform/adminhtml_system_config_form_backupbutton</frontend_model>
56
+ <sort_order>40</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ </backup>
61
+ <restore translate="label">
62
+ <label>Backup Product Data</label>
63
+ <frontend_type>button</frontend_type>
64
+ <frontend_model>strakertranslations_easytranslationplatform/adminhtml_system_config_form_restorebutton</frontend_model>
65
+ <sort_order>50</sort_order>
66
+ <show_in_default>1</show_in_default>
67
+ <show_in_website>1</show_in_website>
68
+ <show_in_store>1</show_in_store>
69
+ </restore>
70
+ </fields>
71
+ </general>
72
+ <api_url translate="label">
73
+ <label>Api Url</label>
74
+ <frontend_type>text</frontend_type>
75
+ <sort_order>100</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>1</show_in_store>
79
+ <fields>
80
+ <register translate="label comment" >
81
+ <label>Register</label>
82
+ <frontend_type>text</frontend_type>
83
+ <sort_order>10</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>1</show_in_store>
87
+ </register>
88
+ <languages translate="label comment" >
89
+ <label>Languages</label>
90
+ <frontend_type>text</frontend_type>
91
+ <sort_order>30</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
+ </languages>
96
+ <translate translate="label comment" >
97
+ <label>Translate</label>
98
+ <frontend_type>text</frontend_type>
99
+ <sort_order>40</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
+ </translate>
104
+ <countries translate="label comment" >
105
+ <label>Countries</label>
106
+ <frontend_type>text</frontend_type>
107
+ <sort_order>20</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>1</show_in_store>
111
+ </countries>
112
+ <quote translate="label comment" >
113
+ <label>Quote</label>
114
+ <frontend_type>text</frontend_type>
115
+ <sort_order>20</sort_order>
116
+ <show_in_default>1</show_in_default>
117
+ <show_in_website>1</show_in_website>
118
+ <show_in_store>1</show_in_store>
119
+ </quote>
120
+ <payment translate="label comment" >
121
+ <label>Payment</label>
122
+ <frontend_type>text</frontend_type>
123
+ <sort_order>50</sort_order>
124
+ <show_in_default>1</show_in_default>
125
+ <show_in_website>1</show_in_website>
126
+ <show_in_store>1</show_in_store>
127
+ </payment>
128
+ <payment_page translate="label comment" >
129
+ <label>Payment Page</label>
130
+ <frontend_type>text</frontend_type>
131
+ <sort_order>50</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>1</show_in_store>
135
+ </payment_page>
136
+ </fields>
137
+ </api_url>
138
+ </groups>
139
+ </straker>
140
+ </sections>
141
+ </config>
app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: stevenyang
5
+ * Date: 18/09/15
6
+ * Time: 9:46 AM
7
+ */
8
+ /* @var $installer Mage_Core_Model_Resource_Setup */
9
+ $installer = $this;
10
+
11
+ $installer->startSetup();
12
+
13
+ try {
14
+ $installer->run(" CREATE TABLE `straker_actionlog` (
15
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
16
+ `user_id` int(10) NOT NULL,
17
+ `action` varchar(255) DEFAULT NULL,
18
+ `message` text,
19
+ `extra` text,
20
+ `log_at` timestamp NULL DEFAULT NULL,
21
+ PRIMARY KEY (`id`),
22
+ KEY `user_id` (`user_id`),
23
+ CONSTRAINT `straker_actionlog_ibfk_1` FOREIGN KEY (`id`) REFERENCES `admin_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
24
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
25
+
26
+ CREATE TABLE `straker_apilog` (
27
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
28
+ `method` varchar(255) NOT NULL DEFAULT '',
29
+ `request` text,
30
+ `response` text,
31
+ `timestamp` timestamp NULL DEFAULT NULL,
32
+ PRIMARY KEY (`id`)
33
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
34
+
35
+ CREATE TABLE `straker_job` (
36
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
37
+ `type_id` tinyint(3) unsigned NOT NULL,
38
+ `source_store` smallint(5) unsigned NOT NULL,
39
+ `store_id` smallint(5) unsigned NOT NULL,
40
+ `title` varchar(255) DEFAULT NULL,
41
+ `tj_number` varchar(255) DEFAULT NULL,
42
+ `sl` varchar(255) DEFAULT NULL,
43
+ `tl` varchar(255) DEFAULT NULL,
44
+ `job_key` varchar(255) DEFAULT NULL,
45
+ `quote` varchar(255) DEFAULT NULL,
46
+ `status_id` tinyint(3) unsigned NOT NULL DEFAULT '1',
47
+ `work_flow` varchar(255) DEFAULT NULL,
48
+ `payment_status` varchar(255) DEFAULT NULL,
49
+ `source_file` varchar(255) DEFAULT NULL,
50
+ `download_url` varchar(255) DEFAULT NULL,
51
+ `remote_version` varchar(255) DEFAULT NULL,
52
+ `downloaded_version` varchar(255) DEFAULT '0',
53
+ `created_at` timestamp NULL DEFAULT NULL,
54
+ `updated_at` timestamp NULL DEFAULT NULL,
55
+ PRIMARY KEY (`id`),
56
+ UNIQUE KEY `job_key` (`job_key`),
57
+ KEY `store_id` (`store_id`),
58
+ KEY `type_id` (`type_id`),
59
+ KEY `status_id` (`status_id`),
60
+ CONSTRAINT `straker_job_ibfk_1` FOREIGN KEY (`store_id`) REFERENCES `core_store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE,
61
+ CONSTRAINT `straker_job_ibfk_2` FOREIGN KEY (`type_id`) REFERENCES `straker_job_type` (`type_id`) ON DELETE CASCADE ON UPDATE CASCADE,
62
+ CONSTRAINT `straker_job_ibfk_3` FOREIGN KEY (`status_id`) REFERENCES `straker_job_status` (`status_id`) ON DELETE CASCADE ON UPDATE CASCADE
63
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
64
+
65
+ CREATE TABLE `straker_job_product` (
66
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
67
+ `product_id` int(10) unsigned NOT NULL,
68
+ `job_id` int(11) unsigned NOT NULL,
69
+ `version` varchar(255) DEFAULT NULL,
70
+ PRIMARY KEY (`id`),
71
+ KEY `product_id` (`product_id`),
72
+ KEY `job_id` (`job_id`),
73
+ CONSTRAINT `straker_job_product_ibfk_1` FOREIGN KEY (`job_id`) REFERENCES `straker_job` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
74
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
75
+
76
+ CREATE TABLE `straker_job_status` (
77
+ `status_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
78
+ `status_name` varchar(255) NOT NULL DEFAULT '',
79
+ PRIMARY KEY (`status_id`)
80
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
81
+
82
+ INSERT INTO `straker_job_status` (`status_id`, `status_name`)
83
+ VALUES
84
+ (1,'INIT'),
85
+ (2,'QUEUED'),
86
+ (3,'IN_PROGRESS'),
87
+ (4,'COMPLETED');
88
+
89
+ CREATE TABLE `straker_job_type` (
90
+ `type_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
91
+ `type_name` varchar(255) NOT NULL DEFAULT '',
92
+ PRIMARY KEY (`type_id`)
93
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
94
+
95
+ INSERT INTO `straker_job_type` (`type_id`, `type_name`)
96
+ VALUES
97
+ (1,'Product');
98
+
99
+ CREATE TABLE `straker_product_attributes` (
100
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
101
+ `job_id` int(10) unsigned NOT NULL,
102
+ `attribute_id` smallint(5) unsigned NOT NULL,
103
+ PRIMARY KEY (`id`),
104
+ KEY `job_id` (`job_id`),
105
+ KEY `attribute_id` (`attribute_id`),
106
+ CONSTRAINT `straker_product_attributes_ibfk_1` FOREIGN KEY (`job_id`) REFERENCES `straker_job` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
107
+ CONSTRAINT `straker_product_attributes_ibfk_2` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE
108
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
109
+
110
+ CREATE TABLE `straker_product_translate` (
111
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
112
+ `job_id` int(11) unsigned NOT NULL,
113
+ `product_id` int(10) unsigned NOT NULL,
114
+ `attribute_id` smallint(5) unsigned NOT NULL,
115
+ `original` text,
116
+ `translate` text,
117
+ `backup` text,
118
+ `is_imported` tinyint(3) unsigned NOT NULL DEFAULT '0',
119
+ PRIMARY KEY (`id`),
120
+ KEY `product_id` (`product_id`),
121
+ KEY `job_id` (`job_id`),
122
+ KEY `attribute_id` (`attribute_id`),
123
+ CONSTRAINT `straker_product_translate_ibfk_3` FOREIGN KEY (`job_id`) REFERENCES `straker_job` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
124
+ CONSTRAINT `straker_product_translate_ibfk_4` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE
125
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
126
+
127
+ ");
128
+ } catch (Exception $e) {
129
+ Mage::logException($e);
130
+ }
131
+
132
+ $installer->endSetup();
app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/mysql4-upgrade-0.1.0-0.2.0.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: stevenyang
5
+ * Date: 18/09/15
6
+ * Time: 9:46 AM
7
+ */
8
+ /* @var $installer Mage_Core_Model_Resource_Setup */
9
+ $installer = $this;
10
+
11
+ $installer->startSetup();
12
+
13
+ try {
14
+ $installer->run("
15
+ INSERT INTO `straker_job_type` (`type_id`, `type_name`)
16
+ VALUES (2,'Category');
17
+
18
+ CREATE TABLE `straker_job_category` (
19
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
20
+ `category_id` int(10) unsigned NOT NULL,
21
+ `job_id` int(11) unsigned NOT NULL,
22
+ `version` tinyint(3) DEFAULT NULL,
23
+ PRIMARY KEY (`id`),
24
+ KEY `category_id` (`category_id`),
25
+ KEY `job_id` (`job_id`),
26
+ CONSTRAINT `straker_job_category_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
27
+ CONSTRAINT `straker_job_category_ibfk_2` FOREIGN KEY (`job_id`) REFERENCES `straker_job` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
28
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
29
+
30
+ CREATE TABLE `straker_category_attributes` (
31
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
32
+ `job_id` int(10) unsigned NOT NULL,
33
+ `attribute_id` smallint(5) unsigned NOT NULL,
34
+ PRIMARY KEY (`id`),
35
+ KEY `job_id` (`job_id`),
36
+ KEY `attribute_id` (`attribute_id`),
37
+ CONSTRAINT `straker_category_attributes_ibfk_1` FOREIGN KEY (`job_id`) REFERENCES `straker_job` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
38
+ CONSTRAINT `straker_category_attributes_ibfk_2` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE
39
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
40
+
41
+ CREATE TABLE `straker_category_translate` (
42
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
43
+ `job_id` int(11) unsigned NOT NULL,
44
+ `category_id` int(10) unsigned NOT NULL,
45
+ `attribute_id` smallint(5) unsigned NOT NULL,
46
+ `original` text,
47
+ `translate` text,
48
+ `backup` text,
49
+ `is_imported` tinyint(3) unsigned NOT NULL DEFAULT '0',
50
+ PRIMARY KEY (`id`),
51
+ KEY `job_id` (`job_id`),
52
+ KEY `attribute_id` (`attribute_id`),
53
+ KEY `category_id` (`category_id`),
54
+ CONSTRAINT `straker_category_translate_ibfk_1` FOREIGN KEY (`job_id`) REFERENCES `straker_job` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
55
+ CONSTRAINT `straker_category_translate_ibfk_2` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE
56
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
57
+
58
+ ");
59
+ } catch (Exception $e) {
60
+ Mage::logException($e);
61
+ }
62
+
63
+ $installer->endSetup();
app/design/adminhtml/default/straker/layout/straker.xml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss">
6
+ <name>css/straker.css</name>
7
+ </action>
8
+ <action method="addJs">
9
+ <name>straker/translations.js</name>
10
+ </action>
11
+ </reference>
12
+ </default>
13
+ <adminhtml_straker_job_index>
14
+ <referense name="head">
15
+ <action method="setTitle" translate="title"><title>Manage Jobs</title></action>
16
+ <!--<action method="addJs">-->
17
+ <!--<name>straker/livepipe/livepipe.js</name>-->
18
+ <!--</action>-->
19
+ <!--<action method="addJs">-->
20
+ <!--<name>straker/livepipe/window.js</name>-->
21
+ <!--</action>-->
22
+ </referense>
23
+ <reference name="menu">
24
+ <action method="setActive"><menupath>straker/job</menupath></action>
25
+ </reference>
26
+ <reference name="content">
27
+ <block type="strakertranslations_easytranslationplatform/adminhtml_job" name="strakertranslations_easytranslationplatform_job" />
28
+ </reference>
29
+ </adminhtml_straker_job_index>
30
+ <adminhtml_straker_product_index>
31
+ <referense name="head">
32
+ <action method="setTitle" translate="title"><title>Manage Jobs</title></action>
33
+ <!--<action method="addJs">-->
34
+ <!--<name>straker/livepipe/livepipe.js</name>-->
35
+ <!--</action>-->
36
+ <!--<action method="addJs">-->
37
+ <!--<name>straker/livepipe/window.js</name>-->
38
+ <!--</action>-->
39
+ </referense>
40
+ <reference name="menu">
41
+ <action method="setActive"><menupath>straker/job</menupath></action>
42
+ </reference>
43
+ <reference name="content">
44
+ <block type="strakertranslations_easytranslationplatform/adminhtml_job_product" name="strakertranslations_easytranslationplatform_job_product" />
45
+ </reference>
46
+ </adminhtml_straker_product_index>
47
+ <adminhtml_straker_category_index>
48
+ <referense name="head">
49
+ <action method="setTitle" translate="title"><title>Manage Jobs</title></action>
50
+ <!--<action method="addJs">-->
51
+ <!--<name>straker/livepipe/livepipe.js</name>-->
52
+ <!--</action>-->
53
+ <!--<action method="addJs">-->
54
+ <!--<name>straker/livepipe/window.js</name>-->
55
+ <!--</action>-->
56
+ </referense>
57
+ <reference name="menu">
58
+ <action method="setActive"><menupath>straker/job</menupath></action>
59
+ </reference>
60
+ <reference name="content">
61
+ <block type="strakertranslations_easytranslationplatform/adminhtml_job_category" name="strakertranslations_easytranslationplatform_job_category" />
62
+ </reference>
63
+ </adminhtml_straker_category_index>
64
+ </layout>
app/design/adminhtml/default/straker/template/straker/job.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <table cellspacing="0">
3
+ <tr>
4
+ <td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('strakertranslations_easytranslationplatform')->__('Manage Jobs') ?></h3></td>
5
+ <td class="a-right">
6
+ <?php echo $this->getButtonsHtml() ?>
7
+ </td>
8
+ </tr>
9
+ </table>
10
+ </div>
11
+ <div>
12
+ <?php echo $this->getGridHtml() ?>
13
+ </div>
14
+ <div class="straker-quote-container" id="straker-quote-container" style="display: none">
15
+ <a id="straker-quote-back-link">Go Back to Jobs Grid</a>
16
+ <div id="straker-quote-iframe-container"></div>
17
+ </div>
18
+ <script>
19
+ viewStrakerQuote = function(jobId, jobKey) {
20
+ event.stopPropagation();
21
+ var paymentPageUrl = "<?php echo Mage::getStoreConfig('straker/api_url/payment_page') ?>";
22
+ var iframe = '<iframe src="'+paymentPageUrl+'&job_key='+jobKey+'" width="100%" height="600"></iframe>';
23
+ console.log(iframe);
24
+ $('straker-quote-iframe-container'). update(iframe);
25
+ //$('button-update-'+jobId).click();
26
+ $('strakerJobGrid').hide();
27
+ $('straker-quote-container').show();
28
+ }
29
+ Event.observe($('straker-quote-back-link'), 'click', function(){
30
+ $('straker-quote-container').hide();
31
+ $('strakerJobGrid').show();
32
+ });
33
+ </script>
app/design/adminhtml/default/straker/template/straker/job/category.phtml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <table cellspacing="0">
3
+ <tr>
4
+ <td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('strakertranslations_easytranslationplatform')->__('Manage Jobs') ?></h3></td>
5
+ <td class="a-right">
6
+ <?php echo $this->getButtonsHtml() ?>
7
+ </td>
8
+ </tr>
9
+ </table>
10
+ </div>
11
+ <div>
12
+ <?php echo $this->getGridHtml() ?>
13
+ </div>
14
+ <div id="dispute-container" style="display: none">
15
+ <a id="dispute-container-close">X</a>
16
+ <form id="straker-dispute-form" action="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/straker_job/dispute") ?>" method="post">
17
+ <h4 id="dispute-form-title"><?php echo $this->__('If you have any issues, please provide comments below. You must provide specific examples of the source and translation. You can edit translations after you published them to your site.') ?></h4>
18
+ <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" >
19
+ <input type="hidden" name="job_id">
20
+ <div class="input-box"><label for="message">Message</label><em class="required">*</em><br />
21
+ <textarea id="message" name="message" value="" class="required-entry input-text" rows="16" cols="90"></textarea></div>
22
+ <div class="form-buttons">
23
+ <input type="submit" onclick="disputeForm.submit()" class="form-button" value="Submit" title="Submit">
24
+ </div>
25
+ </form>
26
+ <script>
27
+ var disputeForm = new varienForm('straker-dispute-form');
28
+ disputeForm.show = function(jobId){
29
+ $$('#straker-dispute-form input[name=\'job_id\']')[0].value = jobId;
30
+ $('dispute-container').show();
31
+ };
32
+ $('dispute-container-close').observe('click', function(){
33
+ $('dispute-container').hide();
34
+ });
35
+ </script>
36
+ </div>
app/design/adminhtml/default/straker/template/straker/job/category/massaction.phtml ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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@magento.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.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <div id="<?php echo $this->getHtmlId() ?>">
28
+ <table cellspacing="0" cellpadding="0" class="massaction">
29
+ <tr>
30
+ <td><?php if ($this->getUseSelectAll()):?>
31
+ <a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.selectAll()"><?php echo $this->__('Select All') ?></a>
32
+ <span class="separator">|</span>
33
+ <a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.unselectAll()"><?php echo $this->__('Unselect All') ?></a>
34
+ <span class="separator">|</span>
35
+ <?php endif; ?>
36
+ <a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.selectVisible()"><?php echo $this->__('Select Visible') ?></a>
37
+ <span class="separator">|</span>
38
+ <a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.unselectVisible()"><?php echo $this->__('Unselect Visible') ?></a>
39
+ <span class="separator">|</span>
40
+ <strong id="<?php echo $this->getHtmlId() ?>-count">0</strong> <?php echo $this->__('items selected') ?>
41
+ </td>
42
+ <td>
43
+ <div class="right">
44
+ <div class="entry-edit">
45
+ <?php if ($this->getHideFormElement() !== true):?>
46
+ <form action="" id="<?php echo $this->getHtmlId() ?>-form" method="post">
47
+ <?php endif ?>
48
+ <?php echo $this->getBlockHtml('formkey')?>
49
+ <?php echo $this->getHiddenParams() ?>
50
+ <fieldset>
51
+ <span class="field-row">
52
+ <label><?php echo $this->__('Actions') ?></label>
53
+ <select id="<?php echo $this->getHtmlId() ?>-select" class="required-entry select absolute-advice local-validation">
54
+ <option value=""></option>
55
+ <?php foreach($this->getItems() as $_item): ?>
56
+ <option value="<?php echo $_item->getId() ?>"<?php echo ($_item->getSelected() ? ' selected="selected"' : '')?>><?php echo $_item->getLabel() ?></option>
57
+ <?php endforeach; ?>
58
+ </select>
59
+ </span>
60
+ <span class="outer-span" id="<?php echo $this->getHtmlId() ?>-form-hiddens"></span>
61
+ <span class="outer-span" id="<?php echo $this->getHtmlId() ?>-form-additional"></span>
62
+ <span class="field-row">
63
+ <?php echo $this->getApplyButtonHtml() ?>
64
+ </span>
65
+ </fieldset>
66
+ <?php if ($this->getHideFormElement() !== true):?>
67
+ </form>
68
+ <?php endif ?>
69
+ </div>
70
+
71
+ <div class="no-display">
72
+ <?php foreach($this->getItems() as $_item): ?>
73
+ <div id="<?php echo $this->getHtmlId() ?>-item-<?php echo $_item->getId() ?>-block">
74
+ <?php echo $_item->getAdditionalActionBlockHtml() ?>
75
+ </div>
76
+ <?php endforeach; ?>
77
+ </div>
78
+ </div>
79
+ </td>
80
+ </tr>
81
+ </table>
82
+ <?php if(!$this->getParentBlock()->canDisplayContainer()): ?>
83
+ <script type="text/javascript">
84
+ <?php echo $this->getJsObjectName() ?>.setGridIds('<?php echo $this->getGridIdsJson() ?>');
85
+ </script>
86
+ <?php endif; ?>
87
+ </div>
app/design/adminhtml/default/straker/template/straker/job/product.phtml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <table cellspacing="0">
3
+ <tr>
4
+ <td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('strakertranslations_easytranslationplatform')->__('Manage Jobs') ?></h3></td>
5
+ <td class="a-right">
6
+ <?php echo $this->getButtonsHtml() ?>
7
+ </td>
8
+ </tr>
9
+ </table>
10
+ </div>
11
+ <div>
12
+ <?php echo $this->getGridHtml() ?>
13
+ </div>
14
+ <div id="dispute-container" style="display: none">
15
+ <a id="dispute-container-close">X</a>
16
+ <form id="straker-dispute-form" action="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/straker_job/dispute") ?>" method="post">
17
+ <h4 id="dispute-form-title"><?php echo $this->__('If you have any issues, please provide comments below. You must provide specific examples of the source and translation. You can edit translations after you published them to your site.') ?></h4>
18
+ <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" >
19
+ <input type="hidden" name="job_id">
20
+ <div class="input-box"><label for="message">Message</label><em class="required">*</em><br />
21
+ <textarea id="message" name="message" value="" class="required-entry input-text" rows="16" cols="90"></textarea></div>
22
+ <div class="form-buttons">
23
+ <input type="submit" onclick="disputeForm.submit()" class="form-button" value="Submit" title="Submit">
24
+ </div>
25
+ </form>
26
+ <script>
27
+ var disputeForm = new varienForm('straker-dispute-form');
28
+ disputeForm.show = function(jobId){
29
+ $$('#straker-dispute-form input[name=\'job_id\']')[0].value = jobId;
30
+ $('dispute-container').show();
31
+ };
32
+ $('dispute-container-close').observe('click', function(){
33
+ $('dispute-container').hide();
34
+ });
35
+ </script>
36
+ </div>
app/design/adminhtml/default/straker/template/straker/job/product/massaction.phtml ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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@magento.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.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <div id="<?php echo $this->getHtmlId() ?>">
28
+ <table cellspacing="0" cellpadding="0" class="massaction">
29
+ <tr>
30
+ <td><?php if ($this->getUseSelectAll()):?>
31
+ <a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.selectAll()"><?php echo $this->__('Select All') ?></a>
32
+ <span class="separator">|</span>
33
+ <a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.unselectAll()"><?php echo $this->__('Unselect All') ?></a>
34
+ <span class="separator">|</span>
35
+ <?php endif; ?>
36
+ <a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.selectVisible()"><?php echo $this->__('Select Visible') ?></a>
37
+ <span class="separator">|</span>
38
+ <a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.unselectVisible()"><?php echo $this->__('Unselect Visible') ?></a>
39
+ <span class="separator">|</span>
40
+ <strong id="<?php echo $this->getHtmlId() ?>-count">0</strong> <?php echo $this->__('items selected') ?>
41
+ </td>
42
+ <td>
43
+ <div class="right">
44
+ <div class="entry-edit">
45
+ <?php if ($this->getHideFormElement() !== true):?>
46
+ <form action="" id="<?php echo $this->getHtmlId() ?>-form" method="post">
47
+ <?php endif ?>
48
+ <?php echo $this->getBlockHtml('formkey')?>
49
+ <?php echo $this->getHiddenParams() ?>
50
+ <fieldset>
51
+ <span class="field-row">
52
+ <label><?php echo $this->__('Actions') ?></label>
53
+ <select id="<?php echo $this->getHtmlId() ?>-select" class="required-entry select absolute-advice local-validation">
54
+ <option value=""></option>
55
+ <?php foreach($this->getItems() as $_item): ?>
56
+ <option value="<?php echo $_item->getId() ?>"<?php echo ($_item->getSelected() ? ' selected="selected"' : '')?>><?php echo $_item->getLabel() ?></option>
57
+ <?php endforeach; ?>
58
+ </select>
59
+ </span>
60
+ <span class="outer-span" id="<?php echo $this->getHtmlId() ?>-form-hiddens"></span>
61
+ <span class="outer-span" id="<?php echo $this->getHtmlId() ?>-form-additional"></span>
62
+ <span class="field-row">
63
+ <?php echo $this->getApplyButtonHtml() ?>
64
+ </span>
65
+ </fieldset>
66
+ <?php if ($this->getHideFormElement() !== true):?>
67
+ </form>
68
+ <?php endif ?>
69
+ </div>
70
+
71
+ <div class="no-display">
72
+ <?php foreach($this->getItems() as $_item): ?>
73
+ <div id="<?php echo $this->getHtmlId() ?>-item-<?php echo $_item->getId() ?>-block">
74
+ <?php echo $_item->getAdditionalActionBlockHtml() ?>
75
+ </div>
76
+ <?php endforeach; ?>
77
+ </div>
78
+ </div>
79
+ </td>
80
+ </tr>
81
+ </table>
82
+ <?php if(!$this->getParentBlock()->canDisplayContainer()): ?>
83
+ <script type="text/javascript">
84
+ <?php echo $this->getJsObjectName() ?>.setGridIds('<?php echo $this->getGridIdsJson() ?>');
85
+ </script>
86
+ <?php endif; ?>
87
+ </div>
app/design/adminhtml/default/straker/template/straker/new/attributes.phtml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <h3><?php echo $this->__('Create New Job') ?></h3>
3
+ </div>
4
+ <ol class="wizard" data-wizard-steps="3">
5
+ <li class="wizard-todo">Select Product Details</li>
6
+ <li class="wizard-todo">Select Products</li>
7
+ <li class="wizard-todo">Confirm Products</li>
8
+ </ol>
9
+ <div class="straker-main-container border">
10
+ <h1><?php echo $this->__('Product Details') ?></h1>
11
+ <p><?php echo $this->__('What product details would you like to translate?') ?></p>
12
+ <form action="<?php echo Mage::helper("adminhtml")->getUrl("straker/adminhtml_new/attribute") ?>" >
13
+ <div style="padding:0; margin-bottom: 30px;">
14
+ <div style="text-align: left;">
15
+ <input name="store" type="hidden" value="<?php echo $this->getSetupStoreId() ?>" />
16
+ <input type="checkbox" name="attr[name]" id="name" value="1">
17
+ <label for="name"><?php echo $this->__('Title') ?></label>
18
+ <br>
19
+ <input type="checkbox" name="attr[short_description]" id="short_description" value="1">
20
+ <label for="short_description"><?php echo $this->__('Short Description') ?></label>
21
+ <br>
22
+ <input type="checkbox" name="attr[description]" id="description" value="1">
23
+ <label for="description"><?php echo $this->__('Description') ?></label>
24
+ <br>
25
+ <input type="checkbox" name="attr[meta_title]" id="meta_title" value="1">
26
+ <label for="meta_title"><?php echo $this->__('Meta Title') ?></label><br></div>
27
+ <div class="clear"></div>
28
+ <input type="submit" class="form-button right" value="Next" title="Next">
29
+ </div>
30
+ </form>
31
+ </div>
app/design/adminhtml/default/straker/template/straker/new/category/attributes.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <h3><?php echo $this->__('Create New Job') ?></h3>
3
+ </div>
4
+ <ol class="wizard" data-wizard-steps="3">
5
+ <li class="wizard-todo">Select Category Details</li>
6
+ <li class="wizard-todo">Select Categories</li>
7
+ <li class="wizard-todo">Confirm Categories</li>
8
+ </ol>
9
+ <div class="straker-main-container border">
10
+ <h1><?php echo $this->__('Categories Details') ?></h1>
11
+ <p><?php echo $this->__('What category details would you like to translate?') ?></p>
12
+ <form action="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/straker_category/attribute") ?>" >
13
+ <div class="category-attr" style="padding:0; margin-bottom: 30px;">
14
+ <div style="text-align: left;">
15
+ <input name="store" type="hidden" value="<?php echo $this->getSetupStoreId() ?>" />
16
+ <input type="checkbox" name="attr[name]" id="name" value="1" checked="checked">
17
+ <label for="name"><?php echo $this->__('Title') ?></label>
18
+ <br>
19
+ <input type="checkbox" name="attr[description]" id="description" value="1" checked="checked">
20
+ <label for="description"><?php echo $this->__('Description') ?></label>
21
+ <br>
22
+ <input type="checkbox" name="attr[meta_keywords]" id="meta_keywords" value="1" checked="checked">
23
+ <label for="meta_keywords"><?php echo $this->__('Meta Keywords') ?></label>
24
+ <br>
25
+ <input type="checkbox" name="attr[meta_description]" id="meta_description" value="1" checked="checked">
26
+ <label for="meta_description"><?php echo $this->__('Meta Description') ?></label>
27
+ <br>
28
+ <input type="checkbox" name="attr[meta_title]" id="meta_title" value="1" checked="checked">
29
+ <label for="meta_title"><?php echo $this->__('Meta Title') ?></label><br></div>
30
+ <div class="clear"></div>
31
+ <input type="submit" class="form-button right" value="Next" title="Next">
32
+ </div>
33
+ </form>
34
+ </div>
app/design/adminhtml/default/straker/template/straker/new/category/confirm.phtml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @see StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products
4
+ */
5
+ ?>
6
+ <div class="content-header">
7
+ <table cellspacing="0">
8
+ <tr>
9
+ <td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('strakertranslations_easytranslationplatform')->__('Confirm Categories to be translated') ?></h3></td>
10
+ <td class="a-right">
11
+ <?php echo $this->getButtonsHtml() ?>
12
+ </td>
13
+ </tr>
14
+ </table>
15
+ </div>
16
+ <ol class="wizard" data-wizard-steps="3">
17
+ <li class="wizard-done">Select Category Details</li>
18
+ <li class="wizard-done">Select Categories</li>
19
+ <li class="wizard-todo">Confirm Categories</li>
20
+ </ol>
21
+ <?php $params = Mage::app()->getRequest()->getParams(); ?>
22
+ <a href="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/straker_category/new", array('store'=>$params['store'], 'attr'=>$params['attr'], 'internal_category'=> implode(',', $this->getCategory()))) ?>"><?php echo $this->__('Edit Categories') ?></a>
23
+ <form id="submit-new-job-form" action="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/straker_category/submitjob") ?>" method="post">
24
+ <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" >
25
+ <input type="hidden" name="category" value="<?php echo implode(',', $this->getCategory()) ?>" >
26
+ <input type="hidden" name="attr" value="<?php echo $this->getAttr() ?>" >
27
+ <input type="hidden" name="store" value="<?php echo $this->getStore() ?>" >
28
+ </form>
29
+ <div>
30
+ <?php echo $this->getGridHtml() ?>
31
+ </div>
32
+ <script>
33
+ Event.observe(window, "load", function() {
34
+ var buttonHtml = '<button title="Submit" type="button" class="right" onclick="$(\'submit-new-job-form\').submit();" style=""><span><span><span>Submit</span></span></span></button>';
35
+ $('strakerProducts').insert({after: buttonHtml});
36
+ });
37
+ </script>
app/design/adminhtml/default/straker/template/straker/new/category/tree.phtml ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <h3><?php echo $this->__('Create New Job') ?></h3>
3
+ </div>
4
+ <ol class="wizard" data-wizard-steps="3">
5
+ <li class="wizard-done">Select Category Details</li>
6
+ <li class="wizard-todo">Select Categories</li>
7
+ <li class="wizard-todo">Confirm Categories</li>
8
+ </ol>
9
+ <div class="straker-main-container border">
10
+ <h1><?php echo $this->__('Select Categories') ?></h1>
11
+ <p><?php echo $this->__('Select categories to be translated') ?></p>
12
+ <form method="post" action="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/straker_category/confirmCategory") ?>" >
13
+ <div style="padding:0; margin-bottom: 30px;">
14
+ <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" >
15
+ <input type="hidden" name="store" value="<?php echo $this->getRequest()->getParam('store') ?>" />
16
+ <input type="hidden" name="attr" value="<?php echo $this->getRequest()->getParam('attr')?>" />
17
+ <input type="hidden" name="category" id="product_categories" value="<?php echo $this->getIdsString() ?>" />
18
+ <div id="product-categories" class="tree"></div>
19
+ <div class="clear"></div>
20
+ <input type="submit" class="form-button right" value="Next" title="Next">
21
+ </div>
22
+ </form>
23
+ </div>
24
+ <script type="text/javascript">
25
+ Ext.EventManager.onDocumentReady(function() {
26
+ var categoryLoader = new Ext.tree.TreeLoader({
27
+ dataUrl: '<?php echo $this->getLoadTreeUrl()?>'
28
+ });
29
+
30
+ categoryLoader.createNode = function(config) {
31
+ config.uiProvider = Ext.tree.CheckboxNodeUI;
32
+ var node;
33
+ if (config.children && !config.children.length) {
34
+ delete(config.children);
35
+ node = new Ext.tree.AsyncTreeNode(config);
36
+
37
+ } else {
38
+ node = new Ext.tree.TreeNode(config);
39
+ }
40
+ return node;
41
+ };
42
+
43
+ categoryLoader.on("beforeload", function(treeLoader, node) {
44
+ treeLoader.baseParams.category = node.attributes.id;
45
+ });
46
+
47
+ categoryLoader.on("load", function(treeLoader, node, config) {
48
+ varienWindowOnload();
49
+ });
50
+
51
+ var tree = new Ext.tree.TreePanel('product-categories', {
52
+ animate:true,
53
+ loader: categoryLoader,
54
+ enableDD:false,
55
+ containerScroll: true,
56
+ rootUIProvider: Ext.tree.CheckboxNodeUI,
57
+ selModel: new Ext.tree.CheckNodeMultiSelectionModel(),
58
+ rootVisible: '<?php echo $this->getRootNode()->getIsVisible() ?>'
59
+ });
60
+
61
+ tree.on('check', function(node) {
62
+ if(node.attributes.checked) {
63
+ categoryAdd(node.id);
64
+ } else {
65
+ categoryRemove(node.id);
66
+ }
67
+ varienElementMethods.setHasChanges(node.getUI().checkbox);
68
+ }, tree);
69
+
70
+ // set the root node
71
+ var root = new Ext.tree.TreeNode({
72
+ text: '<?php echo $this->jsQuoteEscape($this->getRootNode()->getName()) ?>',
73
+ draggable:false,
74
+ checked:'<?php echo $this->getRootNode()->getChecked() ?>',
75
+ id:'<?php echo $this->getRootNode()->getId() ?>',
76
+ disabled: <?php echo ($this->getRootNode()->getDisabled() ? 'true' : 'false') ?>,
77
+ uiProvider: Ext.tree.CheckboxNodeUI
78
+ });
79
+
80
+ tree.setRootNode(root);
81
+ bildCategoryTree(root, <?php echo $this->getTreeJson() ?>);
82
+ tree.addListener('click', categoryClick.createDelegate(this));
83
+
84
+ // render the tree
85
+ tree.render();
86
+ root.expand();
87
+ //tree.expandAll();
88
+ });
89
+
90
+ function bildCategoryTree(parent, config){
91
+ if (!config) return null;
92
+
93
+ if (parent && config && config.length){
94
+ for (var i = 0; i < config.length; i++){
95
+ config[i].uiProvider = Ext.tree.CheckboxNodeUI;
96
+ var node;
97
+ var _node = Object.clone(config[i]);
98
+ if (_node.children && !_node.children.length) {
99
+ delete(_node.children);
100
+ node = new Ext.tree.AsyncTreeNode(_node);
101
+
102
+ } else {
103
+ node = new Ext.tree.TreeNode(config[i]);
104
+ }
105
+ parent.appendChild(node);
106
+ node.loader = node.getOwnerTree().loader;
107
+ if(config[i].children){
108
+ bildCategoryTree(node, config[i].children);
109
+ }
110
+ }
111
+ }
112
+ }
113
+
114
+ function categoryClick(node, e){
115
+ if (node.disabled) {
116
+ return;
117
+ }
118
+ node.getUI().check(!node.getUI().checked());
119
+ varienElementMethods.setHasChanges(Event.element(e), e);
120
+ };
121
+ function categoryAdd(id) {
122
+ var ids = $('product_categories').value.split(',');
123
+ ids.push(id);
124
+ $('product_categories').value = ids.join(',');
125
+ }
126
+ function categoryRemove(id) {
127
+ var ids = $('product_categories').value.split(',');
128
+ // bug #7654 fixed
129
+ while (-1 != ids.indexOf(id)) {
130
+ ids.splice(ids.indexOf(id), 1);
131
+ }
132
+ $('product_categories').value = ids.join(',');
133
+ }
134
+ </script>
app/design/adminhtml/default/straker/template/straker/new/confirm.phtml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @see StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products
4
+ */
5
+ ?>
6
+ <div class="content-header">
7
+ <table cellspacing="0">
8
+ <tr>
9
+ <td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('strakertranslations_easytranslationplatform')->__('Confirm Products to be translated') ?></h3></td>
10
+ <td class="a-right">
11
+ <?php echo $this->getButtonsHtml() ?>
12
+ </td>
13
+ </tr>
14
+ </table>
15
+ </div>
16
+ <ol class="wizard" data-wizard-steps="3">
17
+ <li class="wizard-done">Select Product Details</li>
18
+ <li class="wizard-done">Select Products</li>
19
+ <li class="wizard-todo">Confirm Products</li>
20
+ </ol>
21
+ <form id="submit-new-job-form" action="<?php echo Mage::helper("adminhtml")->getUrl("straker/adminhtml_new/submitjob") ?>" method="post">
22
+ <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" >
23
+ <input type="hidden" name="product" value="<?php echo implode(',', $this->getProduct()) ?>" >
24
+ <input type="hidden" name="attr" value="<?php echo $this->getAttr() ?>" >
25
+ <input type="hidden" name="store" value="<?php echo $this->getStore() ?>" >
26
+ </form>
27
+ <div>
28
+ <?php echo $this->getGridHtml() ?>
29
+ </div>
30
+ <script>
31
+ Event.observe(window, "load", function() {
32
+ var buttonHtml = '<button title="Submit" type="button" class="right" onclick="$(\'submit-new-job-form\').submit();" style=""><span><span><span>Submit</span></span></span></button>';
33
+ $('strakerProducts').insert({after: buttonHtml});
34
+ });
35
+ </script>
app/design/adminhtml/default/straker/template/straker/new/products.phtml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @see StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products
4
+ */
5
+ ?>
6
+ <div class="content-header">
7
+ <table cellspacing="0">
8
+ <tr>
9
+ <td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('strakertranslations_easytranslationplatform')->__('Select Products to Translate') ?></h3></td>
10
+ <td class="a-right">
11
+ <?php echo $this->getButtonsHtml() ?>
12
+ </td>
13
+ </tr>
14
+ </table>
15
+ </div>
16
+ <ol class="wizard" data-wizard-steps="3">
17
+ <li class="wizard-done">Select Product Details</li>
18
+ <li class="wizard-todo">Select Products</li>
19
+ <li class="wizard-todo">Confirm Products</li>
20
+ </ol>
21
+ <div>
22
+ <?php echo $this->getGridHtml() ?>
23
+ </div>
24
+ <script>
25
+ Event.observe(window, "load", function() {
26
+ var buttonHtml = '<button title="Submit" type="button" class="right" onclick="strakerProducts_massactionJsObject.apply()" style=""><span><span><span>Submit</span></span></span></button>';
27
+ $('strakerProducts').insert({after: buttonHtml});
28
+ $$('.content-header-floating .content-header td.a-right')[0].insert(buttonHtml);
29
+ });
30
+ </script>
app/design/adminhtml/default/straker/template/straker/new/products/attributes.phtml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <h3><?php echo $this->__('Create New Job') ?></h3>
3
+ </div>
4
+ <ol class="wizard" data-wizard-steps="3">
5
+ <li class="wizard-todo">Select Product Details</li>
6
+ <li class="wizard-todo">Select Products</li>
7
+ <li class="wizard-todo">Confirm Products</li>
8
+ </ol>
9
+ <div class="straker-main-container border">
10
+ <h1><?php echo $this->__('Product Details') ?></h1>
11
+ <p><?php echo $this->__('What product details would you like to translate?') ?></p>
12
+ <form action="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/straker_product/attribute") ?>" >
13
+ <div style="padding:0; margin-bottom: 30px;">
14
+ <div style="text-align: left;">
15
+ <input name="store" type="hidden" value="<?php echo $this->getSetupStoreId() ?>" />
16
+ <input type="checkbox" name="attr[name]" id="name" value="1" checked="checked">
17
+ <label for="name"><?php echo $this->__('Title') ?></label>
18
+ <br>
19
+ <input type="checkbox" name="attr[short_description]" id="short_description" value="1" checked="checked">
20
+ <label for="short_description"><?php echo $this->__('Short Description') ?></label>
21
+ <br>
22
+ <input type="checkbox" name="attr[description]" id="description" value="1" checked="checked">
23
+ <label for="description"><?php echo $this->__('Description') ?></label>
24
+ <br>
25
+ <input type="checkbox" name="attr[meta_title]" id="meta_title" value="1" checked="checked">
26
+ <label for="meta_title"><?php echo $this->__('Meta Title') ?></label><br></div>
27
+ <div class="clear"></div>
28
+ <input type="submit" class="form-button right" value="Next" title="Next">
29
+ </div>
30
+ </form>
31
+ </div>
app/design/adminhtml/default/straker/template/straker/new/products/confirm.phtml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @see StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products
4
+ */
5
+ ?>
6
+ <div class="content-header">
7
+ <table cellspacing="0">
8
+ <tr>
9
+ <td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('strakertranslations_easytranslationplatform')->__('Confirm Products to be translated') ?></h3></td>
10
+ <td class="a-right">
11
+ <?php echo $this->getButtonsHtml() ?>
12
+ </td>
13
+ </tr>
14
+ </table>
15
+ </div>
16
+ <ol class="wizard" data-wizard-steps="3">
17
+ <li class="wizard-done">Select Product Details</li>
18
+ <li class="wizard-done">Select Products</li>
19
+ <li class="wizard-todo">Confirm Products</li>
20
+ </ol>
21
+ <?php $params = $this->getRequest()->getParams(); ?>
22
+ <a href="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/straker_product/new", array('store'=>$params['store'], 'attr'=>$params['attr'], 'internal_product'=>implode(',', $params['product']))) ?>"><?php echo $this->__('Edit Products') ?></a>
23
+ <form id="submit-new-job-form" action="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/straker_product/submitjob") ?>" method="post">
24
+ <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" >
25
+ <input type="hidden" name="product" value="<?php echo implode(',', $this->getProduct()) ?>" >
26
+ <input type="hidden" name="attr" value="<?php echo $this->getAttr() ?>" >
27
+ <input type="hidden" name="store" value="<?php echo $this->getStore() ?>" >
28
+ </form>
29
+ <div>
30
+ <?php echo $this->getGridHtml() ?>
31
+ </div>
32
+ <script>
33
+ Event.observe(window, "load", function() {
34
+ var buttonHtml = '<button title="Submit" type="button" class="right" onclick="$(\'submit-new-job-form\').submit();" style=""><span><span><span>Submit</span></span></span></button>';
35
+ $('strakerProducts').insert({after: buttonHtml});
36
+ });
37
+ </script>
app/design/adminhtml/default/straker/template/straker/new/products/massaction.phtml ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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@magento.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.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <div id="<?php echo $this->getHtmlId() ?>">
28
+ <table cellspacing="0" cellpadding="0" class="massaction">
29
+ <tr>
30
+ <td><?php if ($this->getUseSelectAll()):?>
31
+ <a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.selectAll()"><?php echo $this->__('Select All') ?></a>
32
+ <span class="separator">|</span>
33
+ <a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.unselectAll()"><?php echo $this->__('Unselect All') ?></a>
34
+ <span class="separator">|</span>
35
+ <?php endif; ?>
36
+ <a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.selectVisible()"><?php echo $this->__('Select Visible') ?></a>
37
+ <span class="separator">|</span>
38
+ <a href="#" onclick="return <?php echo $this->getJsObjectName() ?>.unselectVisible()"><?php echo $this->__('Unselect Visible') ?></a>
39
+ <span class="separator">|</span>
40
+ <strong id="<?php echo $this->getHtmlId() ?>-count">0</strong> <?php echo $this->__('items selected') ?>
41
+ </td>
42
+ <td>
43
+ <div class="right">
44
+ <div class="entry-edit">
45
+ <?php if ($this->getHideFormElement() !== true):?>
46
+ <form action="" id="<?php echo $this->getHtmlId() ?>-form" method="post">
47
+ <?php endif ?>
48
+ <?php echo $this->getBlockHtml('formkey')?>
49
+ <?php echo $this->getHiddenParams() ?>
50
+ <fieldset>
51
+ <span class="field-row">
52
+ <label><?php echo $this->__('Actions') ?></label>
53
+ <select id="<?php echo $this->getHtmlId() ?>-select" class="required-entry select absolute-advice local-validation">
54
+ <option value=""></option>
55
+ <?php foreach($this->getItems() as $_item): ?>
56
+ <option value="<?php echo $_item->getId() ?>"<?php echo ($_item->getSelected() ? ' selected="selected"' : '')?>><?php echo $_item->getLabel() ?></option>
57
+ <?php endforeach; ?>
58
+ </select>
59
+ </span>
60
+ <span class="outer-span" id="<?php echo $this->getHtmlId() ?>-form-hiddens"></span>
61
+ <span class="outer-span" id="<?php echo $this->getHtmlId() ?>-form-additional"></span>
62
+ <span class="field-row">
63
+ <?php echo $this->getApplyButtonHtml() ?>
64
+ </span>
65
+ </fieldset>
66
+ <?php if ($this->getHideFormElement() !== true):?>
67
+ </form>
68
+ <?php endif ?>
69
+ </div>
70
+
71
+ <div class="no-display">
72
+ <?php foreach($this->getItems() as $_item): ?>
73
+ <div id="<?php echo $this->getHtmlId() ?>-item-<?php echo $_item->getId() ?>-block">
74
+ <?php echo $_item->getAdditionalActionBlockHtml() ?>
75
+ </div>
76
+ <?php endforeach; ?>
77
+ </div>
78
+ </div>
79
+ </td>
80
+ </tr>
81
+ </table>
82
+ <?php if(!$this->getParentBlock()->canDisplayContainer()): ?>
83
+ <script type="text/javascript">
84
+ <?php echo $this->getJsObjectName() ?>.setGridIds('<?php echo $this->getGridIdsJson() ?>');
85
+ </script>
86
+ <?php endif; ?>
87
+ </div>
app/design/adminhtml/default/straker/template/straker/new/register.phtml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <h3><?php echo $this->__('Create New Job') ?></h3>
3
+ </div>
4
+ <div class="straker-main-container">
5
+ <?php echo $this->renderWelcomeIframe(); ?>
6
+ <form id="straker-create-account-form" action="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/straker_new/register") ?>" method="post">
7
+ <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" >
8
+ <div id="register-content" style="padding:0; margin-bottom: 30px;">
9
+ <h3><?php echo $this->__('Register new account') ?></h3>
10
+ <p><?php echo $this->__('As it is your first time using Easy Translation Platform, you will need to create a new account.') ?></p>
11
+ <div class="col-left">
12
+ <div class="input-box"><label for="first_name">First Name</label><em class="required">*</em><br>
13
+ <input type="text" id="first_name" name="first_name" value="" class="required-entry input-text"></div>
14
+ <div class="input-box"><label for="last_name">Last Name</label><em class="required">*</em><br>
15
+ <input type="text" id="last_name" name="last_name" value="" class="required-entry input-text"></div>
16
+ <div class="input-box"><label for="email">Email</label><em class="required">*</em><br>
17
+ <input type="email" id="email" name="email" value="" class="required-entry validate-email input-text"></div>
18
+ <div class="input-box"><label for="country">Country</label><em class="required">*</em><?php echo $this->renderCountriesSelect('country') ?></div>
19
+ </div>
20
+ <div class="col-right">
21
+ <div class="input-box"><label for="company">Company Name</label><br>
22
+ <input type="text" id="company" name="company" value="" class="input-text"></div>
23
+ <div class="input-box"><label for="phone">Phone Number</label><br>
24
+ <input type="text" id="phone" name="phone" value="" class="input-text"></div>
25
+ <div class="input-box"><label for="website">Website URL</label><br>
26
+ <input type="text" id="website" name="website" value="" class="input-text"></div>
27
+ </div>
28
+ <div class="clear"></div>
29
+ <label class="terms-label"><input type="checkbox" name="terms" value="1" class="required-entry">I have read and agreed to the <a href="https://www.strakertranslations.com/about-us/terms-and-conditions-of-service.cfm">terms and conditions</a></label>
30
+ <div class="form-buttons">
31
+ <input type="submit" onclick="registerForm.submit()" class="form-button" value="Register" title="Register">
32
+ </div>
33
+ </div>
34
+ </form>
35
+ <script>
36
+ var registerForm = new varienForm('straker-create-account-form');
37
+ </script>
38
+ </div>
app/design/adminhtml/default/straker/template/straker/new/selectstore.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <h3><?php echo $this->__('Create New Job') ?></h3>
3
+ </div>
4
+ <div class="straker-main-container">
5
+ <h1><?php echo $this->__('Select Destination Store') ?></h1>
6
+ <p><?php echo $this->__('Please select the destination store for this translation job.') ?></p>
7
+ <form action="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/straker_new/selectstore") ?>" >
8
+ <div class="destination-container input-box input-left"><label for="store"><?php echo $this->__('Destination Store') ?></label>
9
+ <select class="validate-select" name="store" onchange="this.form.submit()">
10
+ <option value=""><?php echo $this->__('Pick a store') ?></option>
11
+ <?php foreach (Mage::app()->getWebsites() as $website): ?>
12
+ <?php $showWebsite = false; ?>
13
+ <?php foreach ($website->getGroups() as $group): ?>
14
+ <?php $showGroup = false; ?>
15
+ <?php foreach ($group->getStores() as $store): ?>
16
+ <?php if ($showWebsite == false): ?>
17
+ <?php $showWebsite = true; ?>
18
+ <optgroup label="<?php echo $this->escapeHtml($website->getName()) ?>"></optgroup>
19
+ <?php endif; ?>
20
+ <?php if ($showGroup == false): ?>
21
+ <?php $showGroup = true; ?>
22
+ <optgroup label="&nbsp;&nbsp;&nbsp;<?php echo $this->escapeHtml($group->getName()) ?>">
23
+ <?php endif; ?>
24
+ <option value="<?php echo $this->escapeHtml($store->getId()) ?>">&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $this->escapeHtml($store->getName()) ?></option>
25
+ <?php endforeach; ?>
26
+ <?php if ($showGroup): ?>
27
+ </optgroup>
28
+ <?php endif; ?>
29
+ <?php endforeach; ?>
30
+ <?php endforeach; ?>
31
+ </select>
32
+ </div>
33
+ </form>
34
+ </div>
app/design/adminhtml/default/straker/template/straker/new/setupstore.phtml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <h3><?php echo $this->__('Create New Job') ?></h3>
3
+ </div>
4
+ <div class="straker-main-container">
5
+ <h1><?php echo $this->__('Select Languages') ?></h1>
6
+ <p><?php echo $this->__('Tell us your source and destination store and languages') ?></p>
7
+ <form id="setupstore-form" action="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/straker_new/setupstore") ?>" >
8
+ <div class="store-select-container">
9
+ <h2><?php echo $this->__('Source') ?></h2>
10
+ <p><?php echo $this->__('Where would you like us to take your content from?') ?></p>
11
+ <div class="input-box"><label for="source"><?php echo $this->__('Source Store:') ?></label>
12
+ <select name="source" class="validate-select">
13
+ <option value=""><?php echo $this->__('Pick a store') ?></option>
14
+ <?php foreach (Mage::app()->getWebsites() as $website): ?>
15
+ <?php $showWebsite = false; ?>
16
+ <?php foreach ($website->getGroups() as $group): ?>
17
+ <?php $showGroup = false; ?>
18
+ <?php foreach ($group->getStores() as $store): ?>
19
+ <?php if ($showWebsite == false): ?>
20
+ <?php $showWebsite = true; ?>
21
+ <optgroup label="<?php echo $this->escapeHtml($website->getName()) ?>"></optgroup>
22
+ <?php endif; ?>
23
+ <?php if ($showGroup == false): ?>
24
+ <?php $showGroup = true; ?>
25
+ <optgroup label="&nbsp;&nbsp;&nbsp;<?php echo $this->escapeHtml($group->getName()) ?>">
26
+ <?php endif; ?>
27
+ <option value="<?php echo $this->escapeHtml($store->getId()) ?>"<?php if($this->getStoreId() == $store->getId()): ?> selected="selected"<?php endif; ?>>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $this->escapeHtml($store->getName()) ?></option>
28
+ <?php endforeach; ?>
29
+ <?php if ($showGroup): ?>
30
+ </optgroup>
31
+ <?php endif; ?>
32
+ <?php endforeach; ?>
33
+ <?php endforeach; ?>
34
+ </select>
35
+ </div>
36
+ <div class="input-box"><label for="from"><?php echo $this->__('Source Language:') ?></label>
37
+ <?php echo $this->renderLanguageSelect('from') ?></div>
38
+ </div>
39
+ <div class="down-arrow"></div>
40
+ <div class="store-select-container">
41
+ <h2><?php echo $this->__('Destination') ?></h2>
42
+ <p><?php echo $this->__('Where would you like us to put the translated content?') ?></p>
43
+ <div class="input-box"><label for="destination"><?php echo $this->__('Destination Store:') ?></label>
44
+ <select name="destination" disabled class="disabled">
45
+ <option value=""><?php echo Mage::getModel('core/store')->load($this->getSetupStoreId())->getName() ?></option>
46
+ </select>
47
+ <input name="store" type="hidden" value="<?php echo $this->getSetupStoreId() ?>" />
48
+ </div>
49
+ <div class="input-box"><label for="to"><?php echo $this->__('Destination Language:') ?></label>
50
+ <?php echo $this->renderLanguageSelect('to') ?></div>
51
+ </div>
52
+ <div class="form-buttons">
53
+ <input type="submit" class="form-button right" value="Next" title="Next" onclick="setupstoreForm.submit()">
54
+ </div>
55
+ </form>
56
+ </div>
57
+ <script>
58
+ var setupstoreForm = new varienForm('setupstore-form');
59
+ </script>
app/design/adminhtml/default/straker/template/straker/new/type.phtml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <div class="straker-main-container border">
2
+ <h1><?php echo $this->__('Job Type') ?></h1>
3
+ <p><?php echo $this->__('What type of job do you want to create?') ?></p>
4
+ <div class="job-type-btn-wrap" style="padding:0; margin-bottom: 30px;">
5
+ <?php echo $this->renderTypes(); ?>
6
+ </div>
7
+ </div>
app/design/adminhtml/default/straker/template/straker/system/config/button.phtml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ echo $this->getButtonHtml();
app/etc/modules/StrakerTranslations_EasyTranslationPlatform.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <StrakerTranslations_EasyTranslationPlatform>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </StrakerTranslations_EasyTranslationPlatform>
8
+ </modules>
9
+ </config>
js/straker/livepipe/livepipe.js ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author Ryan Johnson <http://syntacticx.com/>
3
+ * @copyright 2008 PersonalGrid Corporation <http://personalgrid.com/>
4
+ * @package LivePipe UI
5
+ * @license MIT
6
+ * @url http://livepipe.net/core
7
+ * @require prototype.js
8
+ */
9
+
10
+ if(typeof(Control) == 'undefined')
11
+ Control = {};
12
+
13
+ var $proc = function(proc){
14
+ return typeof(proc) == 'function' ? proc : function(){return proc};
15
+ };
16
+
17
+ var $value = function(value){
18
+ return typeof(value) == 'function' ? value() : value;
19
+ };
20
+
21
+ Object.Event = {
22
+ extend: function(object){
23
+ object._objectEventSetup = function(event_name){
24
+ this._observers = this._observers || {};
25
+ this._observers[event_name] = this._observers[event_name] || [];
26
+ };
27
+ object.observe = function(event_name,observer){
28
+ if(typeof(event_name) == 'string' && typeof(observer) != 'undefined'){
29
+ this._objectEventSetup(event_name);
30
+ if(!this._observers[event_name].include(observer))
31
+ this._observers[event_name].push(observer);
32
+ }else
33
+ for(var e in event_name)
34
+ this.observe(e,event_name[e]);
35
+ };
36
+ object.stopObserving = function(event_name,observer){
37
+ this._objectEventSetup(event_name);
38
+ if(event_name && observer)
39
+ this._observers[event_name] = this._observers[event_name].without(observer);
40
+ else if(event_name)
41
+ this._observers[event_name] = [];
42
+ else
43
+ this._observers = {};
44
+ };
45
+ object.observeOnce = function(event_name,outer_observer){
46
+ var inner_observer = function(){
47
+ outer_observer.apply(this,arguments);
48
+ this.stopObserving(event_name,inner_observer);
49
+ }.bind(this);
50
+ this._objectEventSetup(event_name);
51
+ this._observers[event_name].push(inner_observer);
52
+ };
53
+ object.notify = function(event_name){
54
+ this._objectEventSetup(event_name);
55
+ var collected_return_values = [];
56
+ var args = $A(arguments).slice(1);
57
+ try{
58
+ for(var i = 0; i < this._observers[event_name].length; ++i)
59
+ collected_return_values.push(this._observers[event_name][i].apply(this,args) || null);
60
+ }catch(e){
61
+ if(e == $break)
62
+ return false;
63
+ else
64
+ throw e;
65
+ }
66
+ return collected_return_values;
67
+ };
68
+ if(object.prototype){
69
+ object.prototype._objectEventSetup = object._objectEventSetup;
70
+ object.prototype.observe = object.observe;
71
+ object.prototype.stopObserving = object.stopObserving;
72
+ object.prototype.observeOnce = object.observeOnce;
73
+ object.prototype.notify = function(event_name){
74
+ if(object.notify){
75
+ var args = $A(arguments).slice(1);
76
+ args.unshift(this);
77
+ args.unshift(event_name);
78
+ object.notify.apply(object,args);
79
+ }
80
+ this._objectEventSetup(event_name);
81
+ var args = $A(arguments).slice(1);
82
+ var collected_return_values = [];
83
+ try{
84
+ if(this.options && this.options[event_name] && typeof(this.options[event_name]) == 'function')
85
+ collected_return_values.push(this.options[event_name].apply(this,args) || null);
86
+ var callbacks_copy = this._observers[event_name]; // since original array will be modified after observeOnce calls
87
+ for(var i = 0; i < callbacks_copy.length; ++i)
88
+ collected_return_values.push(callbacks_copy[i].apply(this,args) || null);
89
+ }catch(e){
90
+ if(e == $break)
91
+ return false;
92
+ else
93
+ throw e;
94
+ }
95
+ return collected_return_values;
96
+ };
97
+ }
98
+ }
99
+ };
100
+
101
+ /* Begin Core Extensions */
102
+
103
+ //Element.observeOnce
104
+ Element.addMethods({
105
+ observeOnce: function(element,event_name,outer_callback){
106
+ var inner_callback = function(){
107
+ outer_callback.apply(this,arguments);
108
+ Element.stopObserving(element,event_name,inner_callback);
109
+ };
110
+ Element.observe(element,event_name,inner_callback);
111
+ }
112
+ });
113
+
114
+ //mouse:wheel
115
+ (function(){
116
+ function wheel(event){
117
+ var delta, element, custom_event;
118
+ // normalize the delta
119
+ if (event.wheelDelta) { // IE & Opera
120
+ delta = event.wheelDelta / 120;
121
+ } else if (event.detail) { // W3C
122
+ delta =- event.detail / 3;
123
+ }
124
+ if (!delta) { return; }
125
+ element = Event.extend(event).target;
126
+ element = Element.extend(element.nodeType === Node.TEXT_NODE ? element.parentNode : element);
127
+ custom_event = element.fire('mouse:wheel',{ delta: delta });
128
+ if (custom_event.stopped) {
129
+ Event.stop(event);
130
+ return false;
131
+ }
132
+ }
133
+ document.observe('mousewheel',wheel);
134
+ document.observe('DOMMouseScroll',wheel);
135
+ })();
136
+
137
+ /* End Core Extensions */
138
+
139
+ //from PrototypeUI
140
+ var IframeShim = Class.create({
141
+ initialize: function() {
142
+ this.element = new Element('iframe',{
143
+ style: 'position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none',
144
+ src: 'javascript:void(0);',
145
+ frameborder: 0
146
+ });
147
+ $(document.body).insert(this.element);
148
+ },
149
+ hide: function() {
150
+ this.element.hide();
151
+ return this;
152
+ },
153
+ show: function() {
154
+ this.element.show();
155
+ return this;
156
+ },
157
+ positionUnder: function(element) {
158
+ var element = $(element);
159
+ var offset = element.cumulativeOffset();
160
+ var dimensions = element.getDimensions();
161
+ this.element.setStyle({
162
+ left: offset[0] + 'px',
163
+ top: offset[1] + 'px',
164
+ width: dimensions.width + 'px',
165
+ height: dimensions.height + 'px',
166
+ zIndex: element.getStyle('zIndex') - 1
167
+ }).show();
168
+ return this;
169
+ },
170
+ setBounds: function(bounds) {
171
+ for(prop in bounds)
172
+ bounds[prop] += 'px';
173
+ this.element.setStyle(bounds);
174
+ return this;
175
+ },
176
+ destroy: function() {
177
+ if(this.element)
178
+ this.element.remove();
179
+ return this;
180
+ }
181
+ });
js/straker/livepipe/window.js ADDED
@@ -0,0 +1,947 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author Ryan Johnson <http://syntacticx.com/>
3
+ * @copyright 2008 PersonalGrid Corporation <http://personalgrid.com/>
4
+ * @package LivePipe UI
5
+ * @license MIT
6
+ * @url http://livepipe.net/control/window
7
+ * @require prototype.js, effects.js, draggable.js, resizable.js, livepipe.js
8
+ */
9
+
10
+ //adds onDraw and constrainToViewport option to draggable
11
+ if(typeof(Draggable) != 'undefined'){
12
+ //allows the point to be modified with an onDraw callback
13
+ Draggable.prototype.draw = function(point) {
14
+ var pos = Position.cumulativeOffset(this.element);
15
+ if(this.options.ghosting) {
16
+ var r = Position.realOffset(this.element);
17
+ pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
18
+ }
19
+
20
+ var d = this.currentDelta();
21
+ pos[0] -= d[0]; pos[1] -= d[1];
22
+
23
+ if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
24
+ pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
25
+ pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
26
+ }
27
+
28
+ var p = [0,1].map(function(i){
29
+ return (point[i]-pos[i]-this.offset[i])
30
+ }.bind(this));
31
+
32
+ if(this.options.snap) {
33
+ if(typeof this.options.snap == 'function') {
34
+ p = this.options.snap(p[0],p[1],this);
35
+ } else {
36
+ if(this.options.snap instanceof Array) {
37
+ p = p.map( function(v, i) {return Math.round(v/this.options.snap[i])*this.options.snap[i] }.bind(this))
38
+ } else {
39
+ p = p.map( function(v) {return Math.round(v/this.options.snap)*this.options.snap }.bind(this))
40
+ }
41
+ }
42
+ }
43
+
44
+ if(this.options.onDraw)
45
+ this.options.onDraw.bind(this)(p);
46
+ else{
47
+ var style = this.element.style;
48
+ if(this.options.constrainToViewport){
49
+ var viewport_dimensions = document.viewport.getDimensions();
50
+ var container_dimensions = this.element.getDimensions();
51
+ var margin_top = parseInt(this.element.getStyle('margin-top'));
52
+ var margin_left = parseInt(this.element.getStyle('margin-left'));
53
+ var boundary = [[
54
+ 0 - margin_left,
55
+ 0 - margin_top
56
+ ],[
57
+ (viewport_dimensions.width - container_dimensions.width) - margin_left,
58
+ (viewport_dimensions.height - container_dimensions.height) - margin_top
59
+ ]];
60
+ if((!this.options.constraint) || (this.options.constraint=='horizontal')){
61
+ if((p[0] >= boundary[0][0]) && (p[0] <= boundary[1][0]))
62
+ this.element.style.left = p[0] + "px";
63
+ else
64
+ this.element.style.left = ((p[0] < boundary[0][0]) ? boundary[0][0] : boundary[1][0]) + "px";
65
+ }
66
+ if((!this.options.constraint) || (this.options.constraint=='vertical')){
67
+ if((p[1] >= boundary[0][1] ) && (p[1] <= boundary[1][1]))
68
+ this.element.style.top = p[1] + "px";
69
+ else
70
+ this.element.style.top = ((p[1] <= boundary[0][1]) ? boundary[0][1] : boundary[1][1]) + "px";
71
+ }
72
+ }else{
73
+ if((!this.options.constraint) || (this.options.constraint=='horizontal'))
74
+ style.left = p[0] + "px";
75
+ if((!this.options.constraint) || (this.options.constraint=='vertical'))
76
+ style.top = p[1] + "px";
77
+ }
78
+ if(style.visibility=="hidden")
79
+ style.visibility = ""; // fix gecko rendering
80
+ }
81
+ };
82
+ }
83
+
84
+ if(typeof(Prototype) == "undefined")
85
+ throw "Control.Window requires Prototype to be loaded.";
86
+ if(typeof(IframeShim) == "undefined")
87
+ throw "Control.Window requires IframeShim to be loaded.";
88
+ if(typeof(Object.Event) == "undefined")
89
+ throw "Control.Window requires Object.Event to be loaded.";
90
+ /*
91
+ known issues:
92
+ - when iframe is clicked is does not gain focus
93
+ - safari can't open multiple iframes properly
94
+ - constrainToViewport: body must have no margin or padding for this to work properly
95
+ - iframe will be mis positioned during fade in
96
+ - document.viewport does not account for scrollbars (this will eventually be fixed in the prototype core)
97
+ notes
98
+ - setting constrainToViewport only works when the page is not scrollable
99
+ - setting draggable: true will negate the effects of position: center
100
+ */
101
+ Control.Window = Class.create({
102
+ initialize: function(container,options){
103
+ Control.Window.windows.push(this);
104
+
105
+ //attribute initialization
106
+ this.container = false;
107
+ this.isOpen = false;
108
+ this.href = false;
109
+ this.sourceContainer = false; //this is optionally the container that will open the window
110
+ this.ajaxRequest = false;
111
+ this.remoteContentLoaded = false; //this is set when the code to load the remote content is run, onRemoteContentLoaded is fired when the connection is closed
112
+ this.numberInSequence = Control.Window.windows.length + 1; //only useful for the effect scoping
113
+ this.indicator = false;
114
+ this.effects = {
115
+ fade: false,
116
+ appear: false
117
+ };
118
+ this.indicatorEffects = {
119
+ fade: false,
120
+ appear: false
121
+ };
122
+
123
+ //options
124
+ this.options = Object.extend({
125
+ //lifecycle
126
+ beforeOpen: Prototype.emptyFunction,
127
+ afterOpen: Prototype.emptyFunction,
128
+ beforeClose: Prototype.emptyFunction,
129
+ afterClose: Prototype.emptyFunction,
130
+ //dimensions and modes
131
+ height: null,
132
+ width: null,
133
+ className: false,
134
+ position: 'center', //'center', 'center_once', 'relative', [x,y], [function(){return x;},function(){return y;}]
135
+ offsetLeft: 0, //available only for anchors opening the window, or windows set to position: hover
136
+ offsetTop: 0, //""
137
+ iframe: false, //if the window has an href, this will display the href as an iframe instead of requesting the url as an an Ajax.Request
138
+ hover: false, //element object to hover over, or if "true" only available for windows with sourceContainer (an anchor or any element already on the page with an href attribute)
139
+ indicator: false, //element to show or hide when ajax requests, images and iframes are loading
140
+ closeOnClick: false, //does not work with hover,can be: true (click anywhere), 'container' (will refer to this.container), or element (a specific element)
141
+ iframeshim: true, //whether or not to position an iFrameShim underneath the window
142
+ //effects
143
+ fade: false,
144
+ fadeDuration: 0.75,
145
+ //draggable
146
+ draggable: false,
147
+ onDrag: Prototype.emptyFunction,
148
+ //resizable
149
+ resizable: false,
150
+ minHeight: false,
151
+ minWidth: false,
152
+ maxHeight: false,
153
+ maxWidth: false,
154
+ onResize: Prototype.emptyFunction,
155
+ //draggable and resizable
156
+ constrainToViewport: false,
157
+ //ajax
158
+ method: 'post',
159
+ parameters: {},
160
+ onComplete: Prototype.emptyFunction,
161
+ onSuccess: Prototype.emptyFunction,
162
+ onFailure: Prototype.emptyFunction,
163
+ onException: Prototype.emptyFunction,
164
+ //any element with an href (image,iframe,ajax) will call this after it is done loading
165
+ onRemoteContentLoaded: Prototype.emptyFunction,
166
+ insertRemoteContentAt: false //false will set this to this.container, can be string selector (first returned will be selected), or an Element that must be a child of this.container
167
+ },options || {});
168
+
169
+ //container setup
170
+ this.indicator = this.options.indicator ? $(this.options.indicator) : false;
171
+ if(container){
172
+ if(typeof(container) == "string" && container.match(Control.Window.uriRegex))
173
+ this.href = container;
174
+ else{
175
+ this.container = $(container);
176
+ //need to create the container now for tooltips (or hover: element with no container already on the page)
177
+ //second call made below will not create the container since the check is done inside createDefaultContainer()
178
+ this.createDefaultContainer(container);
179
+ //if an element with an href was passed in we use it to activate the window
180
+ if(this.container && ((this.container.readAttribute('href') && this.container.readAttribute('href') != '') || (this.options.hover && this.options.hover !== true))){
181
+ if(this.options.hover && this.options.hover !== true)
182
+ this.sourceContainer = $(this.options.hover);
183
+ else{
184
+ this.sourceContainer = this.container;
185
+ this.href = this.container.readAttribute('href');
186
+ var rel = this.href.match(/^#(.+)$/);
187
+ if(rel && rel[1]){
188
+ this.container = $(rel[1]);
189
+ this.href = false;
190
+ }else
191
+ this.container = false;
192
+ }
193
+ //hover or click handling
194
+ this.sourceContainerOpenHandler = function(event){
195
+ this.open(event);
196
+ event.stop();
197
+ return false;
198
+ }.bindAsEventListener(this);
199
+ this.sourceContainerCloseHandler = function(event){
200
+ this.close(event);
201
+ }.bindAsEventListener(this);
202
+ this.sourceContainerMouseMoveHandler = function(event){
203
+ this.position(event);
204
+ }.bindAsEventListener(this);
205
+ if(this.options.hover){
206
+ this.sourceContainer.observe('mouseenter',this.sourceContainerOpenHandler);
207
+ this.sourceContainer.observe('mouseleave',this.sourceContainerCloseHandler);
208
+ if(this.options.position == 'mouse')
209
+ this.sourceContainer.observe('mousemove',this.sourceContainerMouseMoveHandler);
210
+ }else
211
+ this.sourceContainer.observe('click',this.sourceContainerOpenHandler);
212
+ }
213
+ }
214
+ }
215
+ this.createDefaultContainer(container);
216
+ if(this.options.insertRemoteContentAt === false)
217
+ this.options.insertRemoteContentAt = this.container;
218
+ var styles = {
219
+ margin: 0,
220
+ position: 'absolute',
221
+ zIndex: Control.Window.initialZIndexForWindow()
222
+ };
223
+ if(this.options.width)
224
+ styles.width = $value(this.options.width) + 'px';
225
+ if(this.options.height)
226
+ styles.height = $value(this.options.height) + 'px';
227
+ this.container.setStyle(styles);
228
+ if(this.options.className)
229
+ this.container.addClassName(this.options.className);
230
+ this.positionHandler = this.position.bindAsEventListener(this);
231
+ this.outOfBoundsPositionHandler = this.ensureInBounds.bindAsEventListener(this);
232
+ this.bringToFrontHandler = this.bringToFront.bindAsEventListener(this);
233
+ this.container.observe('mousedown',this.bringToFrontHandler);
234
+ this.container.hide();
235
+ this.closeHandler = this.close.bindAsEventListener(this);
236
+ //iframeshim setup
237
+ if(this.options.iframeshim){
238
+ this.iFrameShim = new IframeShim();
239
+ this.iFrameShim.hide();
240
+ }
241
+ //resizable support
242
+ this.applyResizable();
243
+ //draggable support
244
+ this.applyDraggable();
245
+
246
+ //makes sure the window can't go out of bounds
247
+ Event.observe(window,'resize',this.outOfBoundsPositionHandler);
248
+
249
+ this.notify('afterInitialize');
250
+ },
251
+ open: function(event){
252
+ if(this.isOpen){
253
+ this.bringToFront();
254
+ return false;
255
+ }
256
+ if(this.notify('beforeOpen') === false)
257
+ return false;
258
+ //closeOnClick
259
+ if(this.options.closeOnClick){
260
+ if(this.options.closeOnClick === true)
261
+ this.closeOnClickContainer = $(document.body);
262
+ else if(this.options.closeOnClick == 'container')
263
+ this.closeOnClickContainer = this.container;
264
+ else if (this.options.closeOnClick == 'overlay'){
265
+ Control.Overlay.load();
266
+ this.closeOnClickContainer = Control.Overlay.container;
267
+ }else
268
+ this.closeOnClickContainer = $(this.options.closeOnClick);
269
+ this.closeOnClickContainer.observe('click',this.closeHandler);
270
+ }
271
+ if(this.href && !this.options.iframe && !this.remoteContentLoaded){
272
+ //link to image
273
+ this.remoteContentLoaded = true;
274
+ if(this.href.match(/\.(jpe?g|gif|png|tiff?)$/i)){
275
+ var img = new Element('img');
276
+ img.observe('load',function(img){
277
+ this.getRemoteContentInsertionTarget().insert(img);
278
+ this.position();
279
+ if(this.notify('onRemoteContentLoaded') !== false){
280
+ if(this.options.indicator)
281
+ this.hideIndicator();
282
+ this.finishOpen();
283
+ }
284
+ }.bind(this,img));
285
+ img.writeAttribute('src',this.href);
286
+ }else{
287
+ //if this is an ajax window it will only open if the request is successful
288
+ if(!this.ajaxRequest){
289
+ if(this.options.indicator)
290
+ this.showIndicator();
291
+ this.ajaxRequest = new Ajax.Request(this.href,{
292
+ method: this.options.method,
293
+ parameters: this.options.parameters,
294
+ onComplete: function(request){
295
+ this.notify('onComplete',request);
296
+ this.ajaxRequest = false;
297
+ }.bind(this),
298
+ onSuccess: function(request){
299
+ this.getRemoteContentInsertionTarget().insert(request.responseText);
300
+ this.notify('onSuccess',request);
301
+ if(this.notify('onRemoteContentLoaded') !== false){
302
+ if(this.options.indicator)
303
+ this.hideIndicator();
304
+ this.finishOpen();
305
+ }
306
+ }.bind(this),
307
+ onFailure: function(request){
308
+ this.notify('onFailure',request);
309
+ if(this.options.indicator)
310
+ this.hideIndicator();
311
+ }.bind(this),
312
+ onException: function(request,e){
313
+ this.notify('onException',request,e);
314
+ if(this.options.indicator)
315
+ this.hideIndicator();
316
+ }.bind(this)
317
+ });
318
+ }
319
+ }
320
+ return true;
321
+ }else if(this.options.iframe && !this.remoteContentLoaded){
322
+ //iframe
323
+ this.remoteContentLoaded = true;
324
+ if(this.options.indicator)
325
+ this.showIndicator();
326
+ this.getRemoteContentInsertionTarget().insert(Control.Window.iframeTemplate.evaluate({
327
+ href: this.href
328
+ }));
329
+ var iframe = this.container.down('iframe');
330
+ iframe.onload = function(){
331
+ this.notify('onRemoteContentLoaded');
332
+ if(this.options.indicator)
333
+ this.hideIndicator();
334
+ iframe.onload = null;
335
+ }.bind(this);
336
+ }
337
+ this.finishOpen(event);
338
+ return true
339
+ },
340
+ close: function(event){ //event may or may not be present
341
+ if(!this.isOpen || this.notify('beforeClose',event) === false)
342
+ return false;
343
+ if(this.options.closeOnClick)
344
+ this.closeOnClickContainer.stopObserving('click',this.closeHandler);
345
+ if(this.options.fade){
346
+ this.effects.fade = new Effect.Fade(this.container,{
347
+ queue: {
348
+ position: 'front',
349
+ scope: 'Control.Window' + this.numberInSequence
350
+ },
351
+ from: 1,
352
+ to: 0,
353
+ duration: this.options.fadeDuration / 2,
354
+ afterFinish: function(){
355
+ if(this.iFrameShim)
356
+ this.iFrameShim.hide();
357
+ this.isOpen = false;
358
+ this.notify('afterClose');
359
+ }.bind(this)
360
+ });
361
+ }else{
362
+ this.container.hide();
363
+ if(this.iFrameShim)
364
+ this.iFrameShim.hide();
365
+ }
366
+ if(this.ajaxRequest)
367
+ this.ajaxRequest.transport.abort();
368
+ if(!(this.options.draggable || this.options.resizable) && this.options.position == 'center')
369
+ Event.stopObserving(window,'resize',this.positionHandler);
370
+ if(!this.options.draggable && this.options.position == 'center')
371
+ Event.stopObserving(window,'scroll',this.positionHandler);
372
+ if(this.options.indicator)
373
+ this.hideIndicator();
374
+ if(!this.options.fade){
375
+ this.isOpen = false;
376
+ this.notify('afterClose');
377
+ }
378
+ return true;
379
+ },
380
+ position: function(event){
381
+ //this is up top for performance reasons
382
+ if(this.options.position == 'mouse'){
383
+ var xy = [Event.pointerX(event),Event.pointerY(event)];
384
+ this.container.setStyle({
385
+ top: xy[1] + $value(this.options.offsetTop) + 'px',
386
+ left: xy[0] + $value(this.options.offsetLeft) + 'px'
387
+ });
388
+ return;
389
+ }
390
+ var container_dimensions = this.container.getDimensions();
391
+ var viewport_dimensions = document.viewport.getDimensions();
392
+ Position.prepare();
393
+ var offset_left = (Position.deltaX + Math.floor((viewport_dimensions.width - container_dimensions.width) / 2));
394
+ var offset_top = (Position.deltaY + ((viewport_dimensions.height > container_dimensions.height) ? Math.floor((viewport_dimensions.height - container_dimensions.height) / 2) : 0));
395
+ if(this.options.position == 'center' || this.options.position == 'center_once'){
396
+ this.container.setStyle({
397
+ top: (container_dimensions.height <= viewport_dimensions.height) ? ((offset_top != null && offset_top > 0) ? offset_top : 0) + 'px' : 0,
398
+ left: (container_dimensions.width <= viewport_dimensions.width) ? ((offset_left != null && offset_left > 0) ? offset_left : 0) + 'px' : 0
399
+ });
400
+ }else if(this.options.position == 'relative'){
401
+ var xy = this.sourceContainer.cumulativeOffset();
402
+ var top = xy[1] + $value(this.options.offsetTop);
403
+ var left = xy[0] + $value(this.options.offsetLeft);
404
+ this.container.setStyle({
405
+ top: (container_dimensions.height <= viewport_dimensions.height) ? (this.options.constrainToViewport ? Math.max(0,Math.min(viewport_dimensions.height - (container_dimensions.height),top)) : top) + 'px' : 0,
406
+ left: (container_dimensions.width <= viewport_dimensions.width) ? (this.options.constrainToViewport ? Math.max(0,Math.min(viewport_dimensions.width - (container_dimensions.width),left)) : left) + 'px' : 0
407
+ });
408
+ }else if(this.options.position.length){
409
+ var top = $value(this.options.position[1]) + $value(this.options.offsetTop);
410
+ var left = $value(this.options.position[0]) + $value(this.options.offsetLeft);
411
+ this.container.setStyle({
412
+ top: (container_dimensions.height <= viewport_dimensions.height) ? (this.options.constrainToViewport ? Math.max(0,Math.min(viewport_dimensions.height - (container_dimensions.height),top)) : top) + 'px' : 0,
413
+ left: (container_dimensions.width <= viewport_dimensions.width) ? (this.options.constrainToViewport ? Math.max(0,Math.min(viewport_dimensions.width - (container_dimensions.width),left)) : left) + 'px' : 0
414
+ });
415
+ }
416
+ if(this.iFrameShim)
417
+ this.updateIFrameShimZIndex();
418
+ },
419
+ ensureInBounds: function(){
420
+ if(!this.isOpen)
421
+ return;
422
+ var viewport_dimensions = document.viewport.getDimensions();
423
+ var container_offset = this.container.cumulativeOffset();
424
+ var container_dimensions = this.container.getDimensions();
425
+ if(container_offset.left + container_dimensions.width > viewport_dimensions.width){
426
+ this.container.setStyle({
427
+ left: (Math.max(0,viewport_dimensions.width - container_dimensions.width)) + 'px'
428
+ });
429
+ }
430
+ if(container_offset.top + container_dimensions.height > viewport_dimensions.height){
431
+ this.container.setStyle({
432
+ top: (Math.max(0,viewport_dimensions.height - container_dimensions.height)) + 'px'
433
+ });
434
+ }
435
+ },
436
+ bringToFront: function(){
437
+ Control.Window.bringToFront(this);
438
+ this.notify('bringToFront');
439
+ },
440
+ destroy: function(){
441
+ this.container.stopObserving('mousedown',this.bringToFrontHandler);
442
+ if(this.draggable){
443
+ Draggables.removeObserver(this.container);
444
+ this.draggable.handle.stopObserving('mousedown',this.bringToFrontHandler);
445
+ this.draggable.destroy();
446
+ }
447
+ if(this.resizable){
448
+ Resizables.removeObserver(this.container);
449
+ this.resizable.handle.stopObserving('mousedown',this.bringToFrontHandler);
450
+ this.resizable.destroy();
451
+ }
452
+ if(this.container && !this.sourceContainer)
453
+ this.container.remove();
454
+ if(this.sourceContainer){
455
+ if(this.options.hover){
456
+ this.sourceContainer.stopObserving('mouseenter',this.sourceContainerOpenHandler);
457
+ this.sourceContainer.stopObserving('mouseleave',this.sourceContainerCloseHandler);
458
+ if(this.options.position == 'mouse')
459
+ this.sourceContainer.stopObserving('mousemove',this.sourceContainerMouseMoveHandler);
460
+ }else
461
+ this.sourceContainer.stopObserving('click',this.sourceContainerOpenHandler);
462
+ }
463
+ if(this.iFrameShim)
464
+ this.iFrameShim.destroy();
465
+ Event.stopObserving(window,'resize',this.outOfBoundsPositionHandler);
466
+ Control.Window.windows = Control.Window.windows.without(this);
467
+ this.notify('afterDestroy');
468
+ },
469
+ //private
470
+ applyResizable: function(){
471
+ if(this.options.resizable){
472
+ if(typeof(Resizable) == "undefined")
473
+ throw "Control.Window requires resizable.js to be loaded.";
474
+ var resizable_handle = null;
475
+ if(this.options.resizable === true){
476
+ resizable_handle = new Element('div',{
477
+ className: 'resizable_handle'
478
+ });
479
+ this.container.insert(resizable_handle);
480
+ }else
481
+ resizable_handle = $(this.options.resziable);
482
+ this.resizable = new Resizable(this.container,{
483
+ handle: resizable_handle,
484
+ minHeight: this.options.minHeight,
485
+ minWidth: this.options.minWidth,
486
+ maxHeight: this.options.constrainToViewport ? function(element){
487
+ //viewport height - top - total border height
488
+ return (document.viewport.getDimensions().height - parseInt(element.style.top || 0)) - (element.getHeight() - parseInt(element.style.height || 0));
489
+ } : this.options.maxHeight,
490
+ maxWidth: this.options.constrainToViewport ? function(element){
491
+ //viewport width - left - total border width
492
+ return (document.viewport.getDimensions().width - parseInt(element.style.left || 0)) - (element.getWidth() - parseInt(element.style.width || 0));
493
+ } : this.options.maxWidth
494
+ });
495
+ this.resizable.handle.observe('mousedown',this.bringToFrontHandler);
496
+ Resizables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){
497
+ if(this.iFrameShim)
498
+ this.updateIFrameShimZIndex();
499
+ this.notify('onResize');
500
+ }.bind(this)));
501
+ }
502
+ },
503
+ applyDraggable: function(){
504
+ if(this.options.draggable){
505
+ if(typeof(Draggables) == "undefined")
506
+ throw "Control.Window requires dragdrop.js to be loaded.";
507
+ var draggable_handle = null;
508
+ if(this.options.draggable === true){
509
+ draggable_handle = new Element('div',{
510
+ className: 'draggable_handle'
511
+ });
512
+ this.container.insert(draggable_handle);
513
+ }else
514
+ draggable_handle = $(this.options.draggable);
515
+ this.draggable = new Draggable(this.container,{
516
+ handle: draggable_handle,
517
+ constrainToViewport: this.options.constrainToViewport,
518
+ zindex: this.container.getStyle('z-index'),
519
+ starteffect: function(){
520
+ if(Prototype.Browser.IE){
521
+ this.old_onselectstart = document.onselectstart;
522
+ document.onselectstart = function(){
523
+ return false;
524
+ };
525
+ }
526
+ }.bind(this),
527
+ endeffect: function(){
528
+ document.onselectstart = this.old_onselectstart;
529
+ }.bind(this)
530
+ });
531
+ this.draggable.handle.observe('mousedown',this.bringToFrontHandler);
532
+ Draggables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){
533
+ if(this.iFrameShim)
534
+ this.updateIFrameShimZIndex();
535
+ this.notify('onDrag');
536
+ }.bind(this)));
537
+ }
538
+ },
539
+ createDefaultContainer: function(container){
540
+ if(!this.container){
541
+ //no container passed or found, create it
542
+ this.container = new Element('div',{
543
+ id: 'control_window_' + this.numberInSequence
544
+ });
545
+ $(document.body).insert(this.container);
546
+ if(typeof(container) == "string" && $(container) == null && !container.match(/^#(.+)$/) && !container.match(Control.Window.uriRegex))
547
+ this.container.update(container);
548
+ }
549
+ },
550
+ finishOpen: function(event){
551
+ this.bringToFront();
552
+ if(this.options.fade){
553
+ if(typeof(Effect) == "undefined")
554
+ throw "Control.Window requires effects.js to be loaded."
555
+ if(this.effects.fade)
556
+ this.effects.fade.cancel();
557
+ this.effects.appear = new Effect.Appear(this.container,{
558
+ queue: {
559
+ position: 'end',
560
+ scope: 'Control.Window.' + this.numberInSequence
561
+ },
562
+ from: 0,
563
+ to: 1,
564
+ duration: this.options.fadeDuration / 2,
565
+ afterFinish: function(){
566
+ if(this.iFrameShim)
567
+ this.updateIFrameShimZIndex();
568
+ this.isOpen = true;
569
+ this.notify('afterOpen');
570
+ }.bind(this)
571
+ });
572
+ }else
573
+ this.container.show();
574
+ this.position(event);
575
+ if(!(this.options.draggable || this.options.resizable) && this.options.position == 'center')
576
+ Event.observe(window,'resize',this.positionHandler,false);
577
+ if(!this.options.draggable && this.options.position == 'center')
578
+ Event.observe(window,'scroll',this.positionHandler,false);
579
+ if(!this.options.fade){
580
+ this.isOpen = true;
581
+ this.notify('afterOpen');
582
+ }
583
+ return true;
584
+ },
585
+ showIndicator: function(){
586
+ this.showIndicatorTimeout = window.setTimeout(function(){
587
+ if(this.options.fade){
588
+ this.indicatorEffects.appear = new Effect.Appear(this.indicator,{
589
+ queue: {
590
+ position: 'front',
591
+ scope: 'Control.Window.indicator.' + this.numberInSequence
592
+ },
593
+ from: 0,
594
+ to: 1,
595
+ duration: this.options.fadeDuration / 2
596
+ });
597
+ }else
598
+ this.indicator.show();
599
+ }.bind(this),Control.Window.indicatorTimeout);
600
+ },
601
+ hideIndicator: function(){
602
+ if(this.showIndicatorTimeout)
603
+ window.clearTimeout(this.showIndicatorTimeout);
604
+ this.indicator.hide();
605
+ },
606
+ getRemoteContentInsertionTarget: function(){
607
+ return typeof(this.options.insertRemoteContentAt) == "string" ? this.container.down(this.options.insertRemoteContentAt) : $(this.options.insertRemoteContentAt);
608
+ },
609
+ updateIFrameShimZIndex: function(){
610
+ if(this.iFrameShim)
611
+ this.iFrameShim.positionUnder(this.container);
612
+ }
613
+ });
614
+ //class methods
615
+ Object.extend(Control.Window,{
616
+ windows: [],
617
+ baseZIndex: 9999,
618
+ indicatorTimeout: 250,
619
+ iframeTemplate: new Template('<iframe src="#{href}" width="100%" height="100%" frameborder="0"></iframe>'),
620
+ uriRegex: /^(\/|\#|https?\:\/\/|[\w]+\/)/,
621
+ bringToFront: function(w){
622
+ Control.Window.windows = Control.Window.windows.without(w);
623
+ Control.Window.windows.push(w);
624
+ Control.Window.windows.each(function(w,i){
625
+ var z_index = Control.Window.baseZIndex + i;
626
+ w.container.setStyle({
627
+ zIndex: z_index
628
+ });
629
+ if(w.isOpen){
630
+ if(w.iFrameShim)
631
+ w.updateIFrameShimZIndex();
632
+ }
633
+ if(w.options.draggable)
634
+ w.draggable.options.zindex = z_index;
635
+ });
636
+ },
637
+ open: function(container,options){
638
+ var w = new Control.Window(container,options);
639
+ w.open();
640
+ return w;
641
+ },
642
+ //protected
643
+ initialZIndexForWindow: function(w){
644
+ return Control.Window.baseZIndex + (Control.Window.windows.length - 1);
645
+ }
646
+ });
647
+ Object.Event.extend(Control.Window);
648
+
649
+ //this is the observer for both Resizables and Draggables
650
+ Control.Window.LayoutUpdateObserver = Class.create({
651
+ initialize: function(w,observer){
652
+ this.w = w;
653
+ this.element = $(w.container);
654
+ this.observer = observer;
655
+ },
656
+ onStart: Prototype.emptyFunction,
657
+ onEnd: function(event_name,instance){
658
+ if(instance.element == this.element && this.iFrameShim)
659
+ this.w.updateIFrameShimZIndex();
660
+ },
661
+ onResize: function(event_name,instance){
662
+ if(instance.element == this.element)
663
+ this.observer(this.element);
664
+ },
665
+ onDrag: function(event_name,instance){
666
+ if(instance.element == this.element)
667
+ this.observer(this.element);
668
+ }
669
+ });
670
+
671
+ //overlay for Control.Modal
672
+ Control.Overlay = {
673
+ id: 'control_overlay',
674
+ loaded: false,
675
+ container: false,
676
+ lastOpacity: 0,
677
+ getStyles: function() {
678
+ return {
679
+ position: 'fixed',
680
+ top: 0,
681
+ left: 0,
682
+ width: '100%',
683
+ height: '100%',
684
+ zIndex: Control.Window.baseZIndex - 1
685
+ };
686
+ },
687
+ getIeStyles: function() {
688
+ return {
689
+ position: 'absolute',
690
+ top: 0,
691
+ left: 0,
692
+ zIndex: Control.Window.baseZIndex - 1
693
+ };
694
+ },
695
+ effects: {
696
+ fade: false,
697
+ appear: false
698
+ },
699
+ load: function(){
700
+ if(Control.Overlay.loaded)
701
+ return false;
702
+ Control.Overlay.loaded = true;
703
+ Control.Overlay.container = new Element('div',{
704
+ id: Control.Overlay.id
705
+ });
706
+ $(document.body).insert(Control.Overlay.container);
707
+ if(Prototype.Browser.IE){
708
+ Control.Overlay.container.setStyle(Control.Overlay.getIeStyles());
709
+ Event.observe(window,'scroll',Control.Overlay.positionOverlay);
710
+ Event.observe(window,'resize',Control.Overlay.positionOverlay);
711
+ Control.Overlay.observe('beforeShow',Control.Overlay.positionOverlay);
712
+ }else
713
+ Control.Overlay.container.setStyle(Control.Overlay.getStyles());
714
+ Control.Overlay.iFrameShim = new IframeShim();
715
+ Control.Overlay.iFrameShim.hide();
716
+ Event.observe(window,'resize',Control.Overlay.positionIFrameShim);
717
+ Control.Overlay.container.hide();
718
+ return true;
719
+ },
720
+ unload: function(){
721
+ if(!Control.Overlay.loaded)
722
+ return false;
723
+ Event.stopObserving(window,'resize',Control.Overlay.positionOverlay);
724
+ Control.Overlay.stopObserving('beforeShow',Control.Overlay.positionOverlay);
725
+ Event.stopObserving(window,'resize',Control.Overlay.positionIFrameShim);
726
+ Control.Overlay.iFrameShim.destroy();
727
+ Control.Overlay.container.remove();
728
+ Control.Overlay.loaded = false;
729
+ return true;
730
+ },
731
+ show: function(opacity,fade){
732
+ if(Control.Overlay.notify('beforeShow') === false)
733
+ return false;
734
+ Control.Overlay.lastOpacity = opacity;
735
+ Control.Overlay.positionIFrameShim();
736
+ Control.Overlay.iFrameShim.show();
737
+ if(fade){
738
+ if(typeof(Effect) == "undefined")
739
+ throw "Control.Window requires effects.js to be loaded."
740
+ if(Control.Overlay.effects.fade)
741
+ Control.Overlay.effects.fade.cancel();
742
+ Control.Overlay.effects.appear = new Effect.Appear(Control.Overlay.container,{
743
+ queue: {
744
+ position: 'end',
745
+ scope: 'Control.Overlay'
746
+ },
747
+ afterFinish: function(){
748
+ Control.Overlay.notify('afterShow');
749
+ },
750
+ from: 0,
751
+ to: Control.Overlay.lastOpacity,
752
+ duration: (fade === true ? 0.75 : fade) / 2
753
+ });
754
+ }else{
755
+ Control.Overlay.container.setStyle({
756
+ opacity: opacity || 1
757
+ });
758
+ Control.Overlay.container.show();
759
+ Control.Overlay.notify('afterShow');
760
+ }
761
+ return true;
762
+ },
763
+ hide: function(fade){
764
+ if(Control.Overlay.notify('beforeHide') === false)
765
+ return false;
766
+ if(Control.Overlay.effects.appear)
767
+ Control.Overlay.effects.appear.cancel();
768
+ Control.Overlay.iFrameShim.hide();
769
+ if(fade){
770
+ Control.Overlay.effects.fade = new Effect.Fade(Control.Overlay.container,{
771
+ queue: {
772
+ position: 'front',
773
+ scope: 'Control.Overlay'
774
+ },
775
+ afterFinish: function(){
776
+ Control.Overlay.notify('afterHide');
777
+ },
778
+ from: Control.Overlay.lastOpacity,
779
+ to: 0,
780
+ duration: (fade === true ? 0.75 : fade) / 2
781
+ });
782
+ }else{
783
+ Control.Overlay.container.hide();
784
+ Control.Overlay.notify('afterHide');
785
+ }
786
+ return true;
787
+ },
788
+ positionIFrameShim: function(){
789
+ if(Control.Overlay.container.visible())
790
+ Control.Overlay.iFrameShim.positionUnder(Control.Overlay.container);
791
+ },
792
+ //IE only
793
+ positionOverlay: function(){
794
+ Control.Overlay.container.setStyle({
795
+ width: document.body.clientWidth + 'px',
796
+ height: document.body.clientHeight + 'px'
797
+ });
798
+ }
799
+ };
800
+ Object.Event.extend(Control.Overlay);
801
+
802
+ Control.ToolTip = Class.create(Control.Window,{
803
+ initialize: function($super,container,tooltip,options){
804
+ $super(tooltip,Object.extend(Object.extend(Object.clone(Control.ToolTip.defaultOptions),options || {}),{
805
+ position: 'mouse',
806
+ hover: container
807
+ }));
808
+ }
809
+ });
810
+ Object.extend(Control.ToolTip,{
811
+ defaultOptions: {
812
+ offsetLeft: 10
813
+ }
814
+ });
815
+
816
+ Control.Modal = Class.create(Control.Window,{
817
+ initialize: function($super,container,options){
818
+ Control.Modal.InstanceMethods.beforeInitialize.bind(this)();
819
+ $super(container,Object.extend(Object.clone(Control.Modal.defaultOptions),options || {}));
820
+ },
821
+ closeWithoutOverlay: function(){
822
+ this.keepOverlay = true;
823
+ this.close();
824
+ }
825
+ });
826
+ Object.extend(Control.Modal,{
827
+ defaultOptions: {
828
+ overlayOpacity: 0.5,
829
+ closeOnClick: 'overlay'
830
+ },
831
+ current: false,
832
+ open: function(container,options){
833
+ var modal = new Control.Modal(container,options);
834
+ modal.open();
835
+ return modal;
836
+ },
837
+ close: function(){
838
+ if(Control.Modal.current)
839
+ Control.Modal.current.close();
840
+ },
841
+ InstanceMethods: {
842
+ beforeInitialize: function(){
843
+ Control.Overlay.load();
844
+ this.observe('beforeOpen',Control.Modal.Observers.beforeOpen.bind(this));
845
+ this.observe('afterOpen',Control.Modal.Observers.afterOpen.bind(this));
846
+ this.observe('afterClose',Control.Modal.Observers.afterClose.bind(this));
847
+ }
848
+ },
849
+ Observers: {
850
+ beforeOpen: function(){
851
+ Control.Window.windows.without(this).each(function(w){
852
+ if(w.closeWithoutOverlay && w.isOpen){
853
+ w.closeWithoutOverlay();
854
+ }else{
855
+ w.close();
856
+ }
857
+ });
858
+ if(!Control.Overlay.overlayFinishedOpening){
859
+ Control.Overlay.observeOnce('afterShow',function(){
860
+ Control.Overlay.overlayFinishedOpening = true;
861
+ this.open();
862
+ }.bind(this));
863
+ Control.Overlay.show(this.options.overlayOpacity,this.options.fade ? this.options.fadeDuration : false);
864
+ throw $break;
865
+ }
866
+ },
867
+ afterOpen: function(){
868
+ Control.Overlay.show(this.options.overlayOpacity);
869
+ Control.Overlay.overlayFinishedOpening = true;
870
+ Control.Modal.current = this;
871
+ },
872
+ afterClose: function(){
873
+ if(!this.keepOverlay){
874
+ Control.Overlay.hide(this.options.fade ? this.options.fadeDuration : false);
875
+ Control.Overlay.overlayFinishedOpening = false;
876
+ }
877
+ this.keepOverlay = false;
878
+ Control.Modal.current = false;
879
+ }
880
+ }
881
+ });
882
+
883
+ Control.LightBox = Class.create(Control.Window,{
884
+ initialize: function($super,container,options){
885
+ this.allImagesLoaded = false;
886
+ if(options.modal){
887
+ var options = Object.extend(Object.clone(Control.LightBox.defaultOptions),options || {});
888
+ options = Object.extend(Object.clone(Control.Modal.defaultOptions),options);
889
+ options = Control.Modal.InstanceMethods.beforeInitialize.bind(this)(options);
890
+ $super(container,options);
891
+ }else
892
+ $super(container,Object.extend(Object.clone(Control.LightBox.defaultOptions),options || {}));
893
+ this.hasRemoteContent = this.href && !this.options.iframe;
894
+ if(this.hasRemoteContent)
895
+ this.observe('onRemoteContentLoaded',Control.LightBox.Observers.onRemoteContentLoaded.bind(this));
896
+ else
897
+ this.applyImageObservers();
898
+ this.observe('beforeOpen',Control.LightBox.Observers.beforeOpen.bind(this));
899
+ },
900
+ applyImageObservers:function(){
901
+ var images = this.getImages();
902
+ this.numberImagesToLoad = images.length;
903
+ this.numberofImagesLoaded = 0;
904
+ images.each(function(image){
905
+ image.observe('load',function(image){
906
+ ++this.numberofImagesLoaded;
907
+ if(this.numberImagesToLoad == this.numberofImagesLoaded){
908
+ this.allImagesLoaded = true;
909
+ this.onAllImagesLoaded();
910
+ }
911
+ }.bind(this,image));
912
+ image.hide();
913
+ }.bind(this));
914
+ },
915
+ onAllImagesLoaded: function(){
916
+ this.getImages().each(function(image){
917
+ this.showImage(image);
918
+ }.bind(this));
919
+ if(this.hasRemoteContent){
920
+ if(this.options.indicator)
921
+ this.hideIndicator();
922
+ this.finishOpen();
923
+ }else
924
+ this.open();
925
+ },
926
+ getImages: function(){
927
+ return this.container.select(Control.LightBox.imageSelector);
928
+ },
929
+ showImage: function(image){
930
+ image.show();
931
+ }
932
+ });
933
+ Object.extend(Control.LightBox,{
934
+ imageSelector: 'img',
935
+ defaultOptions: {},
936
+ Observers: {
937
+ beforeOpen: function(){
938
+ if(!this.hasRemoteContent && !this.allImagesLoaded)
939
+ throw $break;
940
+ },
941
+ onRemoteContentLoaded: function(){
942
+ this.applyImageObservers();
943
+ if(!this.allImagesLoaded)
944
+ throw $break;
945
+ }
946
+ }
947
+ });
js/straker/translations.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ Event.observe(window, "load", function() {
2
+ var strakerMenu = $$("#nav LI.level0:has(A[href*=admin/straker])")[0];
3
+ var n = SKIN_URL.indexOf("adminhtml");
4
+ var imageElement = '<img style="height: 23px;margin-right: 3px;line-height: 27px;vertical-align: middle;margin-top: -2px;" id="amasty_block" src="'+SKIN_URL.substring(0, n)+'adminhtml/default/straker/images/straker-translations-logo.png"." alt="" border="0" />';
5
+ $(strakerMenu.select(' > a > span'))[0].setStyle({display: 'inline-block'}).insert({before: imageElement});
6
+ });
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>straker-translations-easy-translation-platform</name>
4
+ <version>0.2.0</version>
5
+ <stability>devel</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Multilingual eCommerce extensions from the award-winning global translation company. </summary>
10
+ <description>Total automation of the translation process, simple installation and setup, quality human translation at cost-effective rates, scalable to more than 80 languages and 1000s of projects and powerful dashboard reporting.</description>
11
+ <notes>Initial development version</notes>
12
+ <authors><author><name>Chris </name><user>Straker_support</user><email>extensions@strakertranslations.com</email></author></authors>
13
+ <date>2015-12-01</date>
14
+ <time>04:59:48</time>
15
+ <contents><target name="magecommunity"><dir name="StrakerTranslations"><dir name="EasyTranslationPlatform"><dir name="Block"><dir name="Adminhtml"><dir name="Job"><dir name="Category"><file name="Grid.php" hash="85c8665aae723ab004dcdce4f38d8eb3"/></dir><file name="Category.php" hash="76a4cfea25b28c12c5156ccccea11e1c"/><file name="Grid.php" hash="68f3942d4ed11070c66fd3b0629ce320"/><dir name="Product"><file name="Grid.php" hash="70253de55da33dae98c812e130e48426"/></dir><file name="Product.php" hash="b03bcde5309ebc604e4b73d2a18f974c"/></dir><file name="Job.php" hash="bf5ad4cd596a3a93a54447ee112c0a23"/><dir name="New"><file name="Attribute.php" hash="f7705a1fc16c7844a0cffd3e237dbb7a"/><dir name="Category"><file name="Attribute.php" hash="b6698a36ee449853edff1815fca6a56f"/><dir name="Confirm"><file name="Grid.php" hash="8ae2189b1d9b4449d1babb19c28d4944"/></dir><file name="Confirm.php" hash="b710371dceb26866857a62f9d19425e7"/><file name="Tree.php" hash="b405b4bf4969812e13d63d752cd89c23"/></dir><dir name="Confirm"><file name="Grid.php" hash="49a048fe7340150dc387a30355951385"/></dir><file name="Confirm.php" hash="a903a2f53c3b44fb8c72dc70716ff0d3"/><dir name="Products"><file name="Attribute.php" hash="4aab6c02b883d138205db19c021dba1f"/><dir name="Confirm"><file name="Grid.php" hash="a00382ca90618800d6be0e889521d14a"/></dir><file name="Confirm.php" hash="d4dddb499ff29d646fcd48246666126a"/><file name="Grid.php" hash="dfdf0052b447f9b65cdaf1eba545c05a"/></dir><file name="Products.php" hash="cd0c2de765d91c4c7a82cc74bb1797c9"/><file name="Register.php" hash="7f43aee445980708a6cb8510eec21e78"/><file name="Selectstore.php" hash="42553d67a4e14ca8f754ea096ddf9cf6"/><file name="Setupstore.php" hash="bc1ca941654f47f763d0e7605fc7b050"/><file name="Type.php" hash="9552bdb41b0dd5acd20f4e5c5928393a"/></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Backupbutton.php" hash="8bfae419ddceed0553db1f5dc5322356"/><file name="Button.php" hash="9604001bfb931ce0674785937a5766c2"/><file name="Restorebutton.php" hash="e98058e6769f5308fa9f48fa19a22704"/></dir></dir></dir><dir name="Template"><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="7973fea548f4160d38010f62ea120b4e"/><file name="Backend.php" hash="66fa7d4689b2d5ec0bd492f38d39825e"/><file name="Dispute.php" hash="3bae4a4bbf43890a53a8c2698315430e"/><file name="Frontend.php" hash="b390c2395807ba7db0f8121775f1eedd"/><file name="Path.php" hash="5d9e268bde77a5e1d6d435a48d9f60b7"/><file name="Quote.php" hash="728f3e53af9619760a3921993a823ca6"/><file name="Refresh.php" hash="28db5556c4dad64f4d3aa808758673dd"/><file name="Status.php" hash="2503f30bb8fc73f059816b1f0676897d"/><file name="Update.php" hash="43a114983b2c00af3432e664512b1704"/><file name="Version.php" hash="908c1697bd48848a2ebf00cd38aa8dc1"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="e4ebcaf86721cfa7b2c699ec844e3460"/></dir><dir name="Model"><file name="Actionlog.php" hash="bd8a61e14712e32937e0622376b07ae7"/><file name="Api.php" hash="28967043b3073fb37fc3cbdc69c3bd99"/><dir name="Category"><file name="Attributes.php" hash="31639770ebe8f2aa4b320d686786f716"/><file name="Translate.php" hash="63888c2d229d1cc860b2d3555470f597"/></dir><dir name="Job"><file name="Category.php" hash="37079e7131a4d10a9577afb499c6d7b6"/><file name="Product.php" hash="9f02ce34f909df6dd26c3414356ad565"/><file name="Status.php" hash="64c766deaf33bd0460c739f04544f8db"/><file name="Type.php" hash="c5010524e83e0c3c56595bcd72bba97d"/></dir><file name="Job.php" hash="e3a302dacd67eb3280604d5cf8bf0ac7"/><dir name="Product"><file name="Attributes.php" hash="f8539bb8a73a59017b811bea7d99835b"/><file name="Translate.php" hash="b2d3d28d48dbeebafb9406d5b2920290"/></dir><dir name="Resource"><dir name="Actionlog"><file name="Collection.php" hash="a60fb59aa09d55b5e5d4f41d58e20e6f"/></dir><file name="Actionlog.php" hash="5742408ecac5dce23b3492d118d6ca41"/><dir name="Category"><dir name="Attributes"><file name="Collection.php" hash="d0d1bdb74c8b6d3ebcd00e986bbda5ac"/></dir><file name="Attributes.php" hash="438aefd7fd4768a18dea3835e592d020"/><dir name="Translate"><file name="Collection.php" hash="6f9b263579ba9c988dbf476a9a8d5254"/></dir><file name="Translate.php" hash="3493c3a5f4dff5278e61cf758b58f09e"/></dir><dir name="Job"><dir name="Category"><file name="Collection.php" hash="bfaf21e4fb96e9144ac0339af6290888"/></dir><file name="Category.php" hash="5cb332770a4600be8d82d5440a42a2a6"/><file name="Collection.php" hash="26b821d388a969c048418254c702767d"/><dir name="Product"><file name="Collection.php" hash="3e56b98a2b8198a78faebef6fb6ad72f"/></dir><file name="Product.php" hash="8b0dfa9ce28bc4292021055f9253ea5d"/><dir name="Status"><file name="Collection.php" hash="84dd6c9d32fda84ea11102692b5359a9"/></dir><file name="Status.php" hash="5e29fbf619c9b1278273266fb2ce2afa"/><dir name="Type"><file name="Collection.php" hash="625b61447aee152376c19f36a347d5d8"/></dir><file name="Type.php" hash="36b8ec250e3bc2377c1fb755459fad95"/></dir><file name="Job.php" hash="b0b4460e3ca9dd9493cbc2548b43f052"/><dir name="Product"><dir name="Attributes"><file name="Collection.php" hash="3f479577ce23ba9f264125439c1d1099"/></dir><file name="Attributes.php" hash="93c962dc76384771d9139574796c16b5"/><dir name="Translate"><file name="Collection.php" hash="4dc7e3a0a44edd6acea4b8cf45b40d05"/></dir><file name="Translate.php" hash="f88f7ea6f6e1dfdc55ef648ddea2ca38"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="JobController.php" hash="d4c9b7b302bf5d8c33764ccefcb4a713"/><file name="NewController.php" hash="d02df7fe360aa8f7e08030e7d1a120d5"/><file name="ProductController.php" hash="5ad93e2dd8a46bd6b8a74c5e5446c80e"/><dir name="Straker"><file name="CategoryController.php" hash="910a02d1c27af7178584311f57705646"/><file name="JobController.php" hash="8fb3b3bced0b90cad7a1f0518a8de2d9"/><file name="NewController.php" hash="beadea79b9cad9a9aeaa27f4e03126f5"/><file name="ProductController.php" hash="f4742ae9e313f6fcf080a953a3251c75"/></dir></dir><file name="CallbackController.php" hash="c9abd6304f6f071940735a47ab658633"/></dir><dir name="etc"><file name="adminhtml.xml" hash="30c57a0cd1a47ef81334cb26a512720c"/><file name="config.xml" hash="dc3a04cc12370761a44224aaa27cc572"/><file name="system.xml" hash="93dcdae11b03b287ecb9e267cd197cf5"/></dir><dir name="sql"><dir name="strakertranslations_easytranslationplatform_setup"><file name="mysql4-install-0.1.0.php" hash="b1d51eaaa6816baf8b984bb4951a86ba"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="fc4eb48d6f7000319507cedcd903debb"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="straker"><dir name="layout"><file name="straker.xml" hash="d1faabffeea1fc63a922a22c059ef832"/></dir><dir name="template"><dir name="straker"><dir name="job"><dir name="category"><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="category.phtml" hash="b291de6217ced6b7cc9df49f90506fe5"/><dir name="product"><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="product.phtml" hash="b291de6217ced6b7cc9df49f90506fe5"/></dir><file name="job.phtml" hash="63c7a5b66b969635ee9996638878d63c"/><dir name="new"><file name="attributes.phtml" hash="a2b5136923f2afad369185077a3c4c53"/><dir name="category"><file name="attributes.phtml" hash="f8a91a330273d18e168d75d460c920c4"/><file name="confirm.phtml" hash="651d98be32a0fd2f768cbeee1907a843"/><file name="tree.phtml" hash="376c21aa034258af888dc03d8f9f5dd8"/></dir><file name="confirm.phtml" hash="defc2a26d6eb659a312e83c884270c4d"/><dir name="products"><file name="attributes.phtml" hash="6f53969076d404bc0fafe71c3ea0de72"/><file name="confirm.phtml" hash="a46c670c32070216772cc8108ef834d0"/><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="products.phtml" hash="faf17e8b26f9270758c5cc19d77f4384"/><file name="register.phtml" hash="3fbc5e22e54cfc98000c14cfbd824a75"/><file name="selectstore.phtml" hash="beb08c491221afca55d4c7cf7525d6d4"/><file name="setupstore.phtml" hash="86954fb6c02e62dee9e17e71b074e585"/><file name="type.phtml" hash="65089368178025d6a164cc5c34884950"/></dir><dir name="system"><dir name="config"><file name="button.phtml" hash="9725dd1eea9e0a5c6ff9a34a31d5e433"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="straker"><dir name="css"><file name="straker.css" hash="83deaa2bbb4feddf9ef6ea1a4d744836"/><file name="straker.less" hash="b738070f73fcdde73410b8bd51f4dee3"/></dir><dir name="images"><dir name="default"><file name="bottom_left.gif" hash="fb99ffa815a8648f95f42698fe5dfaa1"/><file name="bottom_mid.gif" hash="49b9ca7025562ea7f070a9111282364b"/><file name="bottom_right.gif" hash="e46768f632765cd86c5fe5d0166dcf2c"/><file name="bottom_right_resize.gif" hash="1b35a4ec3b734dfe37e31ba87bcc7d99"/><file name="center_left.gif" hash="bd567580b4ee16a7a2734057cfbbe219"/><file name="center_right.gif" hash="eef184d5d89d1710313581a2ccf408e8"/><file name="clear.gif" hash="7af1206eeb0e7834a75e69d70676060d"/><file name="close.gif" hash="8a08f243c37a8e25a88d4ac135b2f07d"/><file name="inspect.gif" hash="aa2a0961067aad5c54b8634919af863b"/><file name="maximize.gif" hash="e73cd71c4979ebeadeb9e27d40a9e8fb"/><file name="minimize.gif" hash="2d2f4b1bd0506f342425f80ab76c49a3"/><file name="overlay.png" hash="536d40e87cda0c7ae7b11f1721aa52d0"/><file name="resize.gif" hash="320f534b5d444b39701e0b679529e779"/><file name="sizer.gif" hash="1b35a4ec3b734dfe37e31ba87bcc7d99"/><file name="top_left.gif" hash="9c5e5920bfc189a45cc618099af93aa8"/><file name="top_mid.gif" hash="a12ff2b944025ad2d127d033dae5e9e1"/><file name="top_right.gif" hash="0cf1ec5b93f8ac8fcce0e2f72cf7f45e"/></dir><file name="magento-banner.jpg" hash="b3105fd2dd00004ab903db4fbb81b61e"/><file name="refresh_32.png" hash="96e793bcbcc2dc48768b8e124beea378"/><file name="straker-translations-logo.png" hash="7cb5e29f562420142f918147d95ed232"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="StrakerTranslations_EasyTranslationPlatform.xml" hash="eb61fdaac7559a75e39bc01206165d0c"/></dir></target><target name="mage"><dir name="js"><dir name="straker"><dir name="livepipe"><file name="livepipe.js" hash="417ba064736fed2772778641f66555c0"/><file name="window.js" hash="f6eba488d6a80e05f59d97a0cef59730"/></dir><file name="translations.js" hash="69717bb0023ff1516cefa1ef483789b4"/></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/straker/css/straker.css ADDED
@@ -0,0 +1,434 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .straker-main-container {
2
+ padding: 30px;
3
+ max-width: 600px;
4
+ margin: 0 auto;
5
+ }
6
+ .straker-main-container.border {
7
+ border: 1px solid #000000;
8
+ padding: 20px;
9
+ }
10
+ .straker-main-container .destination-container {
11
+ margin-top: 10px;
12
+ }
13
+ .straker-main-container label.terms-label {
14
+ margin-top: 10px;
15
+ display: inline-block;
16
+ }
17
+ .straker-main-container label.terms-label > input {
18
+ margin-right: 5px;
19
+ }
20
+ .straker-main-container input.input-text,
21
+ .straker-main-container textarea {
22
+ width: 100%;
23
+ box-sizing: border-box;
24
+ margin-bottom: 5px;
25
+ }
26
+ .straker-main-container .col-left,
27
+ .straker-main-container .col-right {
28
+ margin-top: 20px;
29
+ padding-bottom: 10px;
30
+ }
31
+ .straker-main-container .col-left {
32
+ float: left;
33
+ width: 43%;
34
+ padding-right: 7%;
35
+ border-right: 2px solid #000000;
36
+ }
37
+ .straker-main-container .col-right {
38
+ float: right;
39
+ padding-left: 5%;
40
+ width: 43%;
41
+ }
42
+ .straker-main-container .store-select-container {
43
+ margin-top: 20px;
44
+ padding: 20px;
45
+ border: 1px solid #000000;
46
+ }
47
+ .straker-main-container .store-select-container .input-box {
48
+ width: 100%;
49
+ margin-bottom: 5px;
50
+ }
51
+ .straker-main-container .store-select-container .input-box label {
52
+ text-align: right;
53
+ display: inline-block;
54
+ }
55
+ .straker-main-container .store-select-container .validation-advice {
56
+ margin-left: 49%;
57
+ }
58
+ .straker-main-container .form-buttons {
59
+ margin-top: 20px;
60
+ }
61
+ .strakertranslations-adminhtml-job-index {
62
+ /* DO NOT CHANGE THESE VALUES*/
63
+ }
64
+ .strakertranslations-adminhtml-job-index .overlay_dialog {
65
+ background-color: #666666;
66
+ filter: alpha(opacity=60);
67
+ -moz-opacity: 0.6;
68
+ opacity: 0.6;
69
+ }
70
+ .strakertranslations-adminhtml-job-index .overlay___invisible__ {
71
+ background-color: #666666;
72
+ filter: alpha(opacity=0);
73
+ -moz-opacity: 0;
74
+ opacity: 0;
75
+ }
76
+ .strakertranslations-adminhtml-job-index .dialog_nw {
77
+ width: 9px;
78
+ height: 23px;
79
+ background: transparent url(../images/default/top_left.gif) no-repeat 0 0;
80
+ }
81
+ .strakertranslations-adminhtml-job-index .dialog_n {
82
+ background: transparent url(../images/default/top_mid.gif) repeat-x 0 0;
83
+ height: 23px;
84
+ }
85
+ .strakertranslations-adminhtml-job-index .dialog_ne {
86
+ width: 9px;
87
+ height: 23px;
88
+ background: transparent url(../images/default/top_right.gif) no-repeat 0 0;
89
+ }
90
+ .strakertranslations-adminhtml-job-index .dialog_e {
91
+ width: 2px;
92
+ background: transparent url(../images/default/center_right.gif) repeat-y 0 0;
93
+ }
94
+ .strakertranslations-adminhtml-job-index .dialog_w {
95
+ width: 2px;
96
+ background: transparent url(../images/default/center_left.gif) repeat-y 0 0;
97
+ }
98
+ .strakertranslations-adminhtml-job-index .dialog_sw {
99
+ width: 9px;
100
+ height: 19px;
101
+ background: transparent url(../images/default/bottom_left.gif) no-repeat 0 0;
102
+ }
103
+ .strakertranslations-adminhtml-job-index .dialog_s {
104
+ background: transparent url(../images/default/bottom_mid.gif) repeat-x 0 0;
105
+ height: 19px;
106
+ }
107
+ .strakertranslations-adminhtml-job-index .dialog_se {
108
+ width: 9px;
109
+ height: 19px;
110
+ background: transparent url(../images/default/bottom_right.gif) no-repeat 0 0;
111
+ }
112
+ .strakertranslations-adminhtml-job-index .dialog_sizer {
113
+ width: 9px;
114
+ height: 19px;
115
+ background: transparent url(../images/default/sizer.gif) no-repeat 0 0;
116
+ cursor: se-resize;
117
+ }
118
+ .strakertranslations-adminhtml-job-index .dialog_close {
119
+ width: 14px;
120
+ height: 14px;
121
+ background: transparent url(../images/default/close.gif) no-repeat 0 0;
122
+ position: absolute;
123
+ top: 5px;
124
+ left: 8px;
125
+ cursor: pointer;
126
+ z-index: 2000;
127
+ }
128
+ .strakertranslations-adminhtml-job-index .dialog_minimize {
129
+ width: 14px;
130
+ height: 15px;
131
+ background: transparent url(../images/default/minimize.gif) no-repeat 0 0;
132
+ position: absolute;
133
+ top: 5px;
134
+ left: 28px;
135
+ cursor: pointer;
136
+ z-index: 2000;
137
+ }
138
+ .strakertranslations-adminhtml-job-index .dialog_maximize {
139
+ width: 14px;
140
+ height: 15px;
141
+ background: transparent url(../images/default/maximize.gif) no-repeat 0 0;
142
+ position: absolute;
143
+ top: 5px;
144
+ left: 49px;
145
+ cursor: pointer;
146
+ z-index: 2000;
147
+ }
148
+ .strakertranslations-adminhtml-job-index .dialog_title {
149
+ float: left;
150
+ height: 14px;
151
+ font-family: Tahoma, Arial, sans-serif;
152
+ font-size: 12px;
153
+ text-align: center;
154
+ width: 100%;
155
+ color: #000;
156
+ }
157
+ .strakertranslations-adminhtml-job-index .dialog_content {
158
+ overflow: auto;
159
+ color: #DDD;
160
+ font-family: Tahoma, Arial, sans-serif;
161
+ font-size: 10px;
162
+ background-color: #123;
163
+ }
164
+ .strakertranslations-adminhtml-job-index .top_draggable,
165
+ .strakertranslations-adminhtml-job-index .bottom_draggable {
166
+ cursor: move;
167
+ }
168
+ .strakertranslations-adminhtml-job-index .status_bar {
169
+ font-size: 12px;
170
+ }
171
+ .strakertranslations-adminhtml-job-index .status_bar input {
172
+ font-size: 12px;
173
+ }
174
+ .strakertranslations-adminhtml-job-index .wired_frame {
175
+ display: block;
176
+ position: absolute;
177
+ border: 1px #000 dashed;
178
+ }
179
+ .strakertranslations-adminhtml-job-index .dialog {
180
+ display: block;
181
+ position: absolute;
182
+ }
183
+ .strakertranslations-adminhtml-job-index .dialog table.table_window {
184
+ border-collapse: collapse;
185
+ border-spacing: 0;
186
+ width: 100%;
187
+ margin: 0px;
188
+ padding: 0px;
189
+ }
190
+ .strakertranslations-adminhtml-job-index .dialog table.table_window td,
191
+ .strakertranslations-adminhtml-job-index .dialog table.table_window th {
192
+ padding: 0;
193
+ }
194
+ .strakertranslations-adminhtml-job-index .dialog .title_window {
195
+ -moz-user-select: none;
196
+ }
197
+ .adminhtml-straker-job-index .quote-workflow {
198
+ margin-bottom: 5px;
199
+ border: 1px solid #999999;
200
+ padding: 5px;
201
+ }
202
+ .adminhtml-straker-job-index .straker-refresh-button {
203
+ display: inline-block;
204
+ margin-top: 7px;
205
+ width: 16px;
206
+ height: 16px;
207
+ background: url('../images/refresh_32.png');
208
+ background-size: 100% 100%;
209
+ text-indent: -9999px;
210
+ overflow: hidden;
211
+ border: none;
212
+ }
213
+ .adminhtml-straker-job-index .straker-refresh-button:hover {
214
+ filter: progid:DXImageTransform.Microsoft.Alpha(opacity=80);
215
+ opacity: 0.8;
216
+ -moz-opacity: 0.8;
217
+ }
218
+ .adminhtml-straker-job-index #straker-quote-back-link {
219
+ cursor: pointer;
220
+ margin-bottom: 20px;
221
+ display: block;
222
+ }
223
+ .adminhtml-straker-product-index #dispute-container,
224
+ .adminhtml-straker-category-index #dispute-container {
225
+ position: fixed;
226
+ background: #fff;
227
+ margin-left: -300px;
228
+ margin-top: -200px;
229
+ height: 400px;
230
+ width: 600px;
231
+ left: 50%;
232
+ top: 50%;
233
+ border: 2px solid;
234
+ padding: 40px;
235
+ z-index: 10;
236
+ }
237
+ .adminhtml-straker-product-index #dispute-container #dispute-container-close,
238
+ .adminhtml-straker-category-index #dispute-container #dispute-container-close {
239
+ height: 20px;
240
+ width: 20px;
241
+ display: block;
242
+ position: absolute;
243
+ right: -10px;
244
+ top: -10px;
245
+ background: #ffffff;
246
+ border: 1px solid #000000;
247
+ cursor: pointer;
248
+ text-align: center;
249
+ text-decoration: none;
250
+ }
251
+ .adminhtml-straker-product-index #strakerJobProductGrid button.feedback,
252
+ .adminhtml-straker-category-index #strakerJobProductGrid button.feedback,
253
+ .adminhtml-straker-product-index #strakerJobCategoryGrid button.feedback,
254
+ .adminhtml-straker-category-index #strakerJobCategoryGrid button.feedback {
255
+ background: none;
256
+ color: #ea7601;
257
+ border: none;
258
+ font-weight: normal;
259
+ text-decoration: underline;
260
+ }
261
+ ol.wizard {
262
+ margin-bottom: 30px;
263
+ }
264
+ ol.wizard[data-wizard-steps="2"] li {
265
+ width: 49%;
266
+ }
267
+ ol.wizard[data-wizard-steps="3"] li {
268
+ width: 33%;
269
+ }
270
+ ol.wizard[data-wizard-steps="4"] li {
271
+ width: 24%;
272
+ }
273
+ ol.wizard[data-wizard-steps="5"] li {
274
+ width: 19%;
275
+ }
276
+ ol.wizard[data-wizard-steps="6"] li {
277
+ width: 16%;
278
+ }
279
+ ol.wizard[data-wizard-steps="7"] li {
280
+ width: 14%;
281
+ }
282
+ ol.wizard[data-wizard-steps="8"] li {
283
+ width: 12%;
284
+ }
285
+ ol.wizard[data-wizard-steps="9"] li {
286
+ width: 11%;
287
+ }
288
+ ol.wizard li {
289
+ display: inline-block;
290
+ text-align: center;
291
+ line-height: 3em;
292
+ }
293
+ ol.wizard li.wizard-done {
294
+ color: black;
295
+ border-bottom: 4px solid yellowgreen;
296
+ }
297
+ ol.wizard li.wizard-todo {
298
+ color: silver;
299
+ border-bottom: 4px solid silver;
300
+ }
301
+ ol.wizard li:after {
302
+ content: "\00a0\00a0";
303
+ }
304
+ ol.wizard li:before {
305
+ position: relative;
306
+ bottom: -2.5em;
307
+ float: left;
308
+ left: 50%;
309
+ line-height: 1em;
310
+ }
311
+ ol.wizard li.wizard-done:before {
312
+ content: "\2713";
313
+ color: white;
314
+ background-color: yellowgreen;
315
+ height: 1.2em;
316
+ width: 1.2em;
317
+ line-height: 1.2em;
318
+ border: none;
319
+ border-radius: 1.2em;
320
+ }
321
+ ol.wizard li.wizard-todo:before {
322
+ content: "\039F";
323
+ color: silver;
324
+ background-color: white;
325
+ font-size: 1.5em;
326
+ bottom: -1.6em;
327
+ }
328
+ /*
329
+ Temp UI Updates : Yogi
330
+ */
331
+ .straker-main-container, .straker-main-container.border, .store-select-container {
332
+ border: 1px solid #31BBEA;
333
+ padding: 20px;
334
+ overflow: hidden;
335
+ border-radius: 5px;
336
+ }
337
+ .straker-main-container .store-select-container{
338
+ border: 1px solid #B0EBFF;
339
+ }
340
+ .store-select-container .input-box{
341
+ margin-top: 10px;
342
+ }
343
+ .store-select-container{
344
+ color: #EB5E00;
345
+ }
346
+ .store-select-container label{
347
+ width: 130px;
348
+ text-align: left !important;
349
+ display: inline-block;
350
+ }
351
+ .straker-main-container h2{
352
+ font-size: 18px;
353
+ }
354
+ .straker-main-container input.form-button{
355
+ padding: 5px 15px;
356
+ border-radius: 2px;
357
+ border: 1px solid #FF8E3C;
358
+ font-size: 13px;
359
+ color: #fff !important;
360
+ }
361
+ .straker-main-container label{
362
+ color: #565656;
363
+ font-size: 13px;
364
+ line-height: 26px;
365
+ }
366
+ .straker-main-container select.validate-select, .store-select-container select.disabled{
367
+ border: 1px solid #ccc;
368
+ width: 258px;
369
+ height: 29px;
370
+ margin-top: 5px;
371
+ }
372
+ .store-select-container select.disabled{
373
+ border: 1px solid #E7E7E7;
374
+ }
375
+ .straker-main-container .col-left{
376
+ border-right: 1px solid #A4A4A4;
377
+ }
378
+ .straker-main-container .input-text{
379
+ border: 1px solid #ADADAD;
380
+ border-radius: 2px;
381
+ padding: 6px;
382
+ margin-bottom: 10px;
383
+ }
384
+ .straker-main-container h1{
385
+ color: #595959;
386
+ font-size: 20px;
387
+ }
388
+ .straker-main-container h3, .straker-main-container h2{
389
+ color: #595959;
390
+ }
391
+ .straker-main-container p {
392
+ font-size: 20px;
393
+ font-size: 15px;
394
+ color: #8A8A8A;
395
+ }
396
+ .job-type-btn-wrap{
397
+ width: 410px;
398
+ margin-top: 20px;
399
+ overflow: hidden;
400
+ }
401
+ .job-type-btn-wrap a.job-type-btn {
402
+ color: #fff;
403
+ background: #02A3DB;
404
+ padding: 9px 12px;
405
+ overflow: hidden;
406
+ float: left;
407
+ display: block;
408
+ width: 130px;
409
+ text-align: center;
410
+ text-decoration: none;
411
+ margin-bottom: 10px;
412
+ margin-right: 15px;
413
+ border-radius: 3px;
414
+ font-weight: bold;
415
+ font-size: 14px;
416
+ }
417
+ .category-attr{
418
+ margin-top: 18px;
419
+ }
420
+ .category-attr input {
421
+ color: #595959;
422
+ font-size: 16px;
423
+ margin-bottom: 10px;
424
+ }
425
+ ol.wizard{
426
+ width: 700px;
427
+ }
428
+ .magento-banner-wrap{
429
+ overflow: hidden;
430
+ margin-bottom: 20px;
431
+ }
432
+ .destination-container label[for=store]{
433
+ padding-right: 15px;
434
+ }
skin/adminhtml/default/straker/css/straker.less ADDED
@@ -0,0 +1,360 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .straker-main-container{
2
+ padding: 30px;
3
+ border: 1px solid #000000;
4
+ max-width: 600px;
5
+ margin:0 auto;
6
+ &.border{
7
+ border: 1px solid #000000;
8
+ padding: 20px;
9
+ }
10
+ .destination-container{
11
+ margin-top: 10px;
12
+ }
13
+ label.terms-label{
14
+ margin-top: 10px;
15
+ display: inline-block;
16
+ > input{
17
+ margin-right: 5px;
18
+ }
19
+ }
20
+ input.input-text, textarea{
21
+ width: 100%;
22
+ box-sizing: border-box;
23
+ margin-bottom: 5px;
24
+ }
25
+ .col-left, .col-right{
26
+ margin-top: 20px;
27
+ padding-bottom: 10px;
28
+ }
29
+ .col-left{
30
+ float: left;
31
+ width: 43%;
32
+ padding-right: 7%;
33
+ border-right: 2px solid #000000;
34
+ }
35
+ .col-right{
36
+ float: right;
37
+ padding-left: 5%;
38
+ width: 43%;
39
+ }
40
+ .store-select-container{
41
+ margin-top: 20px;
42
+ padding: 20px;
43
+ border: 1px solid #000000;
44
+ .input-box{
45
+ width: 100%;
46
+ margin-bottom: 5px;
47
+ label{
48
+ text-align: right;
49
+ display: inline-block;
50
+ // width: 48%;
51
+ }
52
+ }
53
+ .validation-advice{
54
+ margin-left: 49%;
55
+ }
56
+ }
57
+ .form-buttons{
58
+ margin-top: 20px;
59
+ }
60
+ }
61
+ .strakertranslations-adminhtml-job-index{
62
+ .overlay_dialog {
63
+ background-color: #666666;
64
+ filter:alpha(opacity=60);
65
+ -moz-opacity: 0.6;
66
+ opacity: 0.6;
67
+ }
68
+
69
+ .overlay___invisible__ {
70
+ background-color: #666666;
71
+ filter:alpha(opacity=0);
72
+ -moz-opacity: 0;
73
+ opacity: 0;
74
+ }
75
+
76
+ .dialog_nw {
77
+ width: 9px;
78
+ height: 23px;
79
+ background: transparent url(../images/default/top_left.gif) no-repeat 0 0;
80
+ }
81
+
82
+ .dialog_n {
83
+ background: transparent url(../images/default/top_mid.gif) repeat-x 0 0;
84
+ height: 23px;
85
+ }
86
+
87
+ .dialog_ne {
88
+ width: 9px;
89
+ height: 23px;
90
+ background: transparent url(../images/default/top_right.gif) no-repeat 0 0;
91
+ }
92
+
93
+ .dialog_e {
94
+ width: 2px;
95
+ background: transparent url(../images/default/center_right.gif) repeat-y 0 0;
96
+ }
97
+
98
+ .dialog_w {
99
+ width: 2px;
100
+ background: transparent url(../images/default/center_left.gif) repeat-y 0 0;
101
+ }
102
+
103
+ .dialog_sw {
104
+ width: 9px;
105
+ height: 19px;
106
+ background: transparent url(../images/default/bottom_left.gif) no-repeat 0 0;
107
+ }
108
+
109
+ .dialog_s {
110
+ background: transparent url(../images/default/bottom_mid.gif) repeat-x 0 0;
111
+ height: 19px;
112
+ }
113
+
114
+ .dialog_se {
115
+ width: 9px;
116
+ height: 19px;
117
+ background: transparent url(../images/default/bottom_right.gif) no-repeat 0 0;
118
+ }
119
+
120
+ .dialog_sizer {
121
+ width: 9px;
122
+ height: 19px;
123
+ background: transparent url(../images/default/sizer.gif) no-repeat 0 0;
124
+ cursor:se-resize;
125
+ }
126
+
127
+ .dialog_close {
128
+ width: 14px;
129
+ height: 14px;
130
+ background: transparent url(../images/default/close.gif) no-repeat 0 0;
131
+ position:absolute;
132
+ top:5px;
133
+ left:8px;
134
+ cursor:pointer;
135
+ z-index:2000;
136
+ }
137
+
138
+ .dialog_minimize {
139
+ width: 14px;
140
+ height: 15px;
141
+ background: transparent url(../images/default/minimize.gif) no-repeat 0 0;
142
+ position:absolute;
143
+ top:5px;
144
+ left:28px;
145
+ cursor:pointer;
146
+ z-index:2000;
147
+ }
148
+
149
+ .dialog_maximize {
150
+ width: 14px;
151
+ height: 15px;
152
+ background: transparent url(../images/default/maximize.gif) no-repeat 0 0;
153
+ position:absolute;
154
+ top:5px;
155
+ left:49px;
156
+ cursor:pointer;
157
+ z-index:2000;
158
+ }
159
+
160
+ .dialog_title {
161
+ float:left;
162
+ height:14px;
163
+ font-family: Tahoma, Arial, sans-serif;
164
+ font-size:12px;
165
+ text-align:center;
166
+ width:100%;
167
+ color:#000;
168
+ }
169
+
170
+ .dialog_content {
171
+ overflow:auto;
172
+ color: #DDD;
173
+ font-family: Tahoma, Arial, sans-serif;
174
+ font-size: 10px;
175
+ background-color:#123;
176
+ }
177
+
178
+ .top_draggable, .bottom_draggable {
179
+ cursor:move;
180
+ }
181
+
182
+ .status_bar {
183
+ font-size:12px;
184
+ }
185
+ .status_bar input{
186
+ font-size:12px;
187
+ }
188
+
189
+ .wired_frame {
190
+ display: block;
191
+ position: absolute;
192
+ border: 1px #000 dashed;
193
+ }
194
+
195
+ /* DO NOT CHANGE THESE VALUES*/
196
+ .dialog {
197
+ display: block;
198
+ position: absolute;
199
+ }
200
+
201
+ .dialog table.table_window {
202
+ border-collapse: collapse;
203
+ border-spacing: 0;
204
+ width: 100%;
205
+ margin: 0px;
206
+ padding:0px;
207
+ }
208
+
209
+ .dialog table.table_window td , .dialog table.table_window th {
210
+ padding: 0;
211
+ }
212
+
213
+ .dialog .title_window {
214
+ -moz-user-select:none;
215
+ }
216
+
217
+
218
+ }
219
+
220
+ //manage jobs grid page
221
+ .adminhtml-straker-job-index{
222
+ .quote-workflow {
223
+ margin-bottom: 5px;
224
+ border: 1px solid #999999;
225
+ padding: 5px;
226
+ }
227
+ .straker-refresh-button{
228
+ display: inline-block;
229
+ margin-top: 7px;
230
+ width: 16px;
231
+ height: 16px;
232
+ background: url('../images/refresh_32.png');
233
+ background-size: 100% 100%;
234
+ text-indent: -9999px;
235
+ overflow: hidden;
236
+ border: none;
237
+ &:hover{
238
+ filter:progid:DXImageTransform.Microsoft.Alpha(opacity=80);
239
+ opacity: 0.8;
240
+ -moz-opacity: 0.8;
241
+ }
242
+ }
243
+ #straker-quote-back-link{
244
+ cursor: pointer;
245
+ margin-bottom: 20px;
246
+ display: block;
247
+ }
248
+ }
249
+
250
+ //job detail grid
251
+ .adminhtml-straker-product-index,
252
+ .adminhtml-straker-category-index{
253
+ #dispute-container{
254
+ position: fixed;
255
+ background: #fff;
256
+ margin-left: -300px;
257
+ margin-top: -200px;
258
+ height: 400px;
259
+ width: 600px;
260
+ left: 50%;
261
+ top: 50%;
262
+ border: 2px solid;
263
+ padding: 40px;
264
+ z-index: 10;
265
+ #dispute-container-close{
266
+ height: 20px;
267
+ width: 20px;
268
+ display: block;
269
+ position: absolute;
270
+ right: -10px;
271
+ top: -10px;
272
+ background: #ffffff;
273
+ border: 1px solid #000000;
274
+ cursor: pointer;
275
+ text-align: center;
276
+ text-decoration: none;
277
+ }
278
+ }
279
+ #strakerJobProductGrid,
280
+ #strakerJobCategoryGrid{
281
+ button.feedback{
282
+ background: none;
283
+ color: #ea7601;
284
+ border: none;
285
+ font-weight: normal;
286
+ text-decoration: underline;
287
+ }
288
+ }
289
+ }
290
+
291
+ //Wizard progress bar
292
+ ol.wizard {
293
+ margin-bottom: 30px;
294
+
295
+ &[data-wizard-steps="2"] li {
296
+ width: 49%;
297
+ }
298
+ &[data-wizard-steps="3"] li {
299
+ width: 33%;
300
+ }
301
+ &[data-wizard-steps="4"] li {
302
+ width: 24%;
303
+ }
304
+ &[data-wizard-steps="5"] li {
305
+ width: 19%;
306
+ }
307
+ &[data-wizard-steps="6"] li {
308
+ width: 16%;
309
+ }
310
+ &[data-wizard-steps="7"] li {
311
+ width: 14%;
312
+ }
313
+ &[data-wizard-steps="8"] li {
314
+ width: 12%;
315
+ }
316
+ &[data-wizard-steps="9"] li {
317
+ width: 11%;
318
+ }
319
+ li {
320
+ display: inline-block;
321
+ text-align: center;
322
+ line-height: 3em;
323
+ &.wizard-done {
324
+ color: black;
325
+ border-bottom: 4px solid yellowgreen;
326
+ }
327
+ &.wizard-todo {
328
+ color: silver;
329
+ border-bottom: 4px solid silver;
330
+ }
331
+
332
+ &:after {
333
+ content: "\00a0\00a0";
334
+ }
335
+ &:before {
336
+ position: relative;
337
+ bottom: -2.5em;
338
+ float: left;
339
+ left: 50%;
340
+ line-height: 1em;
341
+ }
342
+ &.wizard-done:before {
343
+ content: "\2713";
344
+ color: white;
345
+ background-color: yellowgreen;
346
+ height: 1.2em;
347
+ width: 1.2em;
348
+ line-height: 1.2em;
349
+ border: none;
350
+ border-radius: 1.2em;
351
+ }
352
+ &.wizard-todo:before {
353
+ content: "\039F";
354
+ color: silver;
355
+ background-color: white;
356
+ font-size: 1.5em;
357
+ bottom: -1.6em;
358
+ }
359
+ }
360
+ }
skin/adminhtml/default/straker/images/default/bottom_left.gif ADDED
Binary file
skin/adminhtml/default/straker/images/default/bottom_mid.gif ADDED
Binary file
skin/adminhtml/default/straker/images/default/bottom_right.gif ADDED
Binary file
skin/adminhtml/default/straker/images/default/bottom_right_resize.gif ADDED
Binary file
skin/adminhtml/default/straker/images/default/center_left.gif ADDED
Binary file
skin/adminhtml/default/straker/images/default/center_right.gif ADDED
Binary file
skin/adminhtml/default/straker/images/default/clear.gif ADDED
Binary file
skin/adminhtml/default/straker/images/default/close.gif ADDED
Binary file
skin/adminhtml/default/straker/images/default/inspect.gif ADDED
Binary file
skin/adminhtml/default/straker/images/default/maximize.gif ADDED
Binary file
skin/adminhtml/default/straker/images/default/minimize.gif ADDED
Binary file
skin/adminhtml/default/straker/images/default/overlay.png ADDED
Binary file
skin/adminhtml/default/straker/images/default/resize.gif ADDED
Binary file
skin/adminhtml/default/straker/images/default/sizer.gif ADDED
Binary file
skin/adminhtml/default/straker/images/default/top_left.gif ADDED
Binary file
skin/adminhtml/default/straker/images/default/top_mid.gif ADDED
Binary file
skin/adminhtml/default/straker/images/default/top_right.gif ADDED
Binary file
skin/adminhtml/default/straker/images/magento-banner.jpg ADDED
Binary file
skin/adminhtml/default/straker/images/refresh_32.png ADDED
Binary file
skin/adminhtml/default/straker/images/straker-translations-logo.png ADDED
Binary file