Capita_TI - Version 1.0.0

Version Notes

Production release for Magento Connect

Download this release

Release Info

Developer Daniel Deady
Extension Capita_TI
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (330) hide show
  1. app/code/community/Capita/LICENSE.txt +63 -0
  2. app/code/community/Capita/TI/Block/Adminhtml/Cron/Messages.php +98 -0
  3. app/code/community/Capita/TI/Block/Adminhtml/Grid/Column/Filter/Languages.php +134 -0
  4. app/code/community/Capita/TI/Block/Adminhtml/Grid/Column/Renderer/Include.php +84 -0
  5. app/code/community/Capita/TI/Block/Adminhtml/Grid/Column/Renderer/Languages.php +90 -0
  6. app/code/community/Capita/TI/Block/Adminhtml/Grid/Translatable.php +165 -0
  7. app/code/community/Capita/TI/Block/Adminhtml/Request.php +87 -0
  8. app/code/community/Capita/TI/Block/Adminhtml/Request/Grid.php +191 -0
  9. app/code/community/Capita/TI/Block/Adminhtml/Request/New.php +90 -0
  10. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Form.php +84 -0
  11. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Attribute/Grid.php +168 -0
  12. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Attribute/Serializer.php +84 -0
  13. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Block/Grid.php +128 -0
  14. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Block/Serializer.php +84 -0
  15. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Blocks.php +102 -0
  16. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Categories.php +103 -0
  17. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Category/Attributes.php +94 -0
  18. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Category/Grid.php +142 -0
  19. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Category/Serializer.php +84 -0
  20. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/General.php +121 -0
  21. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Page/Grid.php +128 -0
  22. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Page/Serializer.php +84 -0
  23. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Pages.php +102 -0
  24. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Product/Attributes.php +94 -0
  25. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Product/Grid.php +170 -0
  26. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Product/Serializer.php +84 -0
  27. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Products.php +103 -0
  28. app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tabs.php +140 -0
  29. app/code/community/Capita/TI/Block/Adminhtml/Request/View.php +101 -0
  30. app/code/community/Capita/TI/Block/Adminhtml/Request/View/Form.php +205 -0
  31. app/code/community/Capita/TI/Controller/Action.php +94 -0
  32. app/code/community/Capita/TI/Helper/Data.php +131 -0
  33. app/code/community/Capita/TI/Model/Api/Abstract.php +135 -0
  34. app/code/community/Capita/TI/Model/Api/Adapter/SamplePostRequest.php +97 -0
  35. app/code/community/Capita/TI/Model/Api/Languages.php +172 -0
  36. app/code/community/Capita/TI/Model/Api/Requests.php +256 -0
  37. app/code/community/Capita/TI/Model/Backend/Cron.php +113 -0
  38. app/code/community/Capita/TI/Model/Email.php +99 -0
  39. app/code/community/Capita/TI/Model/Observer.php +284 -0
  40. app/code/community/Capita/TI/Model/Request.php +342 -0
  41. app/code/community/Capita/TI/Model/Request/Document.php +87 -0
  42. app/code/community/Capita/TI/Model/Resource/Attribute/Collection.php +111 -0
  43. app/code/community/Capita/TI/Model/Resource/Block/Collection.php +109 -0
  44. app/code/community/Capita/TI/Model/Resource/Category/Collection.php +139 -0
  45. app/code/community/Capita/TI/Model/Resource/Page/Collection.php +119 -0
  46. app/code/community/Capita/TI/Model/Resource/Product/Collection.php +136 -0
  47. app/code/community/Capita/TI/Model/Resource/Request.php +254 -0
  48. app/code/community/Capita/TI/Model/Resource/Request/Collection.php +308 -0
  49. app/code/community/Capita/TI/Model/Resource/Request/Document.php +94 -0
  50. app/code/community/Capita/TI/Model/Resource/Request/Document/Collection.php +89 -0
  51. app/code/community/Capita/TI/Model/Source/Category/Attributes.php +104 -0
  52. app/code/community/Capita/TI/Model/Source/Product/Attributes.php +99 -0
  53. app/code/community/Capita/TI/Model/Source/Status.php +105 -0
  54. app/code/community/Capita/TI/Model/Tracker.php +349 -0
  55. app/code/community/Capita/TI/Model/Xliff/Import/Abstract.php +114 -0
  56. app/code/community/Capita/TI/Model/Xliff/Import/Attribute.php +111 -0
  57. app/code/community/Capita/TI/Model/Xliff/Import/Attributeoption.php +128 -0
  58. app/code/community/Capita/TI/Model/Xliff/Import/Block.php +150 -0
  59. app/code/community/Capita/TI/Model/Xliff/Import/Category.php +114 -0
  60. app/code/community/Capita/TI/Model/Xliff/Import/Page.php +158 -0
  61. app/code/community/Capita/TI/Model/Xliff/Import/Product.php +103 -0
  62. app/code/community/Capita/TI/Model/Xliff/Reader.php +338 -0
  63. app/code/community/Capita/TI/Model/Xliff/Writer.php +382 -0
  64. app/code/community/Capita/TI/Test/Model/Api/Languages.php +192 -0
  65. app/code/community/Capita/TI/Test/Model/Api/Requests.php +109 -0
  66. app/code/community/Capita/TI/Test/Model/Xliff/Writer.php +189 -0
  67. app/code/community/Capita/TI/Test/Model/Xliff/Writer2.php +125 -0
  68. app/code/community/Capita/TI/controllers/Adminhtml/Capita/RequestController.php +275 -0
  69. app/code/community/Capita/TI/controllers/Adminhtml/Catalog/ProductController.php +101 -0
  70. app/code/community/Capita/TI/data/capita_ti_setup/data-upgrade-0.3.0-0.3.1.php +95 -0
  71. app/code/community/Capita/TI/etc/adminhtml.xml +102 -0
  72. app/code/community/Capita/TI/etc/config.xml +321 -0
  73. app/code/community/Capita/TI/etc/system.xml +190 -0
  74. app/code/community/Capita/TI/sql/capita_ti_setup/install-0.1.0.php +167 -0
  75. app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.1.0-0.1.1.php +119 -0
  76. app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.1.1-0.1.2.php +83 -0
  77. app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.1.2-0.1.3.php +117 -0
  78. app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.1.3-0.2.0.php +113 -0
  79. app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.2.0-0.2.1.php +113 -0
  80. app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.2.1-0.2.2.php +84 -0
  81. app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.2.2-0.3.0.php +198 -0
  82. app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.3.0-0.3.1.php +97 -0
  83. app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.3.1-0.3.2.php +83 -0
  84. app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.3.2-0.3.3.php +108 -0
  85. app/design/adminhtml/default/default/layout/capita_ti.xml +175 -0
  86. app/etc/modules/Capita_TI.xml +73 -0
  87. app/locale/en_US/Capita_TI.csv +75 -0
  88. package.xml +18 -0
  89. skin/adminhtml/default/default/images/capita/flags/ad.gif +0 -0
  90. skin/adminhtml/default/default/images/capita/flags/ae.gif +0 -0
  91. skin/adminhtml/default/default/images/capita/flags/af.gif +0 -0
  92. skin/adminhtml/default/default/images/capita/flags/ag.gif +0 -0
  93. skin/adminhtml/default/default/images/capita/flags/ai.gif +0 -0
  94. skin/adminhtml/default/default/images/capita/flags/al.gif +0 -0
  95. skin/adminhtml/default/default/images/capita/flags/am.gif +0 -0
  96. skin/adminhtml/default/default/images/capita/flags/an.gif +0 -0
  97. skin/adminhtml/default/default/images/capita/flags/ao.gif +0 -0
  98. skin/adminhtml/default/default/images/capita/flags/ar.gif +0 -0
  99. skin/adminhtml/default/default/images/capita/flags/as.gif +0 -0
  100. skin/adminhtml/default/default/images/capita/flags/at.gif +0 -0
  101. skin/adminhtml/default/default/images/capita/flags/au.gif +0 -0
  102. skin/adminhtml/default/default/images/capita/flags/aw.gif +0 -0
  103. skin/adminhtml/default/default/images/capita/flags/ax.gif +0 -0
  104. skin/adminhtml/default/default/images/capita/flags/az.gif +0 -0
  105. skin/adminhtml/default/default/images/capita/flags/ba.gif +0 -0
  106. skin/adminhtml/default/default/images/capita/flags/bb.gif +0 -0
  107. skin/adminhtml/default/default/images/capita/flags/bd.gif +0 -0
  108. skin/adminhtml/default/default/images/capita/flags/be.gif +0 -0
  109. skin/adminhtml/default/default/images/capita/flags/bf.gif +0 -0
  110. skin/adminhtml/default/default/images/capita/flags/bg.gif +0 -0
  111. skin/adminhtml/default/default/images/capita/flags/bh.gif +0 -0
  112. skin/adminhtml/default/default/images/capita/flags/bi.gif +0 -0
  113. skin/adminhtml/default/default/images/capita/flags/bj.gif +0 -0
  114. skin/adminhtml/default/default/images/capita/flags/bm.gif +0 -0
  115. skin/adminhtml/default/default/images/capita/flags/bn.gif +0 -0
  116. skin/adminhtml/default/default/images/capita/flags/bo.gif +0 -0
  117. skin/adminhtml/default/default/images/capita/flags/br.gif +0 -0
  118. skin/adminhtml/default/default/images/capita/flags/bs.gif +0 -0
  119. skin/adminhtml/default/default/images/capita/flags/bt.gif +0 -0
  120. skin/adminhtml/default/default/images/capita/flags/bv.gif +0 -0
  121. skin/adminhtml/default/default/images/capita/flags/bw.gif +0 -0
  122. skin/adminhtml/default/default/images/capita/flags/by.gif +0 -0
  123. skin/adminhtml/default/default/images/capita/flags/bz.gif +0 -0
  124. skin/adminhtml/default/default/images/capita/flags/ca.gif +0 -0
  125. skin/adminhtml/default/default/images/capita/flags/catalonia.gif +0 -0
  126. skin/adminhtml/default/default/images/capita/flags/cc.gif +0 -0
  127. skin/adminhtml/default/default/images/capita/flags/cd.gif +0 -0
  128. skin/adminhtml/default/default/images/capita/flags/cf.gif +0 -0
  129. skin/adminhtml/default/default/images/capita/flags/cg.gif +0 -0
  130. skin/adminhtml/default/default/images/capita/flags/ch.gif +0 -0
  131. skin/adminhtml/default/default/images/capita/flags/ci.gif +0 -0
  132. skin/adminhtml/default/default/images/capita/flags/ck.gif +0 -0
  133. skin/adminhtml/default/default/images/capita/flags/cl.gif +0 -0
  134. skin/adminhtml/default/default/images/capita/flags/cm.gif +0 -0
  135. skin/adminhtml/default/default/images/capita/flags/cn.gif +0 -0
  136. skin/adminhtml/default/default/images/capita/flags/co.gif +0 -0
  137. skin/adminhtml/default/default/images/capita/flags/cr.gif +0 -0
  138. skin/adminhtml/default/default/images/capita/flags/cs.gif +0 -0
  139. skin/adminhtml/default/default/images/capita/flags/cu.gif +0 -0
  140. skin/adminhtml/default/default/images/capita/flags/cv.gif +0 -0
  141. skin/adminhtml/default/default/images/capita/flags/cx.gif +0 -0
  142. skin/adminhtml/default/default/images/capita/flags/cy.gif +0 -0
  143. skin/adminhtml/default/default/images/capita/flags/cz.gif +0 -0
  144. skin/adminhtml/default/default/images/capita/flags/de.gif +0 -0
  145. skin/adminhtml/default/default/images/capita/flags/dj.gif +0 -0
  146. skin/adminhtml/default/default/images/capita/flags/dk.gif +0 -0
  147. skin/adminhtml/default/default/images/capita/flags/dm.gif +0 -0
  148. skin/adminhtml/default/default/images/capita/flags/do.gif +0 -0
  149. skin/adminhtml/default/default/images/capita/flags/dz.gif +0 -0
  150. skin/adminhtml/default/default/images/capita/flags/ec.gif +0 -0
  151. skin/adminhtml/default/default/images/capita/flags/ee.gif +0 -0
  152. skin/adminhtml/default/default/images/capita/flags/eg.gif +0 -0
  153. skin/adminhtml/default/default/images/capita/flags/eh.gif +0 -0
  154. skin/adminhtml/default/default/images/capita/flags/er.gif +0 -0
  155. skin/adminhtml/default/default/images/capita/flags/es.gif +0 -0
  156. skin/adminhtml/default/default/images/capita/flags/et.gif +0 -0
  157. skin/adminhtml/default/default/images/capita/flags/fi.gif +0 -0
  158. skin/adminhtml/default/default/images/capita/flags/fj.gif +0 -0
  159. skin/adminhtml/default/default/images/capita/flags/fk.gif +0 -0
  160. skin/adminhtml/default/default/images/capita/flags/fm.gif +0 -0
  161. skin/adminhtml/default/default/images/capita/flags/fo.gif +0 -0
  162. skin/adminhtml/default/default/images/capita/flags/fr.gif +0 -0
  163. skin/adminhtml/default/default/images/capita/flags/ga.gif +0 -0
  164. skin/adminhtml/default/default/images/capita/flags/gb.gif +0 -0
  165. skin/adminhtml/default/default/images/capita/flags/gd.gif +0 -0
  166. skin/adminhtml/default/default/images/capita/flags/ge.gif +0 -0
  167. skin/adminhtml/default/default/images/capita/flags/gf.gif +0 -0
  168. skin/adminhtml/default/default/images/capita/flags/gh.gif +0 -0
  169. skin/adminhtml/default/default/images/capita/flags/gi.gif +0 -0
  170. skin/adminhtml/default/default/images/capita/flags/gl.gif +0 -0
  171. skin/adminhtml/default/default/images/capita/flags/gm.gif +0 -0
  172. skin/adminhtml/default/default/images/capita/flags/gn.gif +0 -0
  173. skin/adminhtml/default/default/images/capita/flags/gp.gif +0 -0
  174. skin/adminhtml/default/default/images/capita/flags/gq.gif +0 -0
  175. skin/adminhtml/default/default/images/capita/flags/gr.gif +0 -0
  176. skin/adminhtml/default/default/images/capita/flags/gs.gif +0 -0
  177. skin/adminhtml/default/default/images/capita/flags/gt.gif +0 -0
  178. skin/adminhtml/default/default/images/capita/flags/gu.gif +0 -0
  179. skin/adminhtml/default/default/images/capita/flags/gw.gif +0 -0
  180. skin/adminhtml/default/default/images/capita/flags/gy.gif +0 -0
  181. skin/adminhtml/default/default/images/capita/flags/hk.gif +0 -0
  182. skin/adminhtml/default/default/images/capita/flags/hm.gif +0 -0
  183. skin/adminhtml/default/default/images/capita/flags/hn.gif +0 -0
  184. skin/adminhtml/default/default/images/capita/flags/hr.gif +0 -0
  185. skin/adminhtml/default/default/images/capita/flags/ht.gif +0 -0
  186. skin/adminhtml/default/default/images/capita/flags/hu.gif +0 -0
  187. skin/adminhtml/default/default/images/capita/flags/id.gif +0 -0
  188. skin/adminhtml/default/default/images/capita/flags/ie.gif +0 -0
  189. skin/adminhtml/default/default/images/capita/flags/il.gif +0 -0
  190. skin/adminhtml/default/default/images/capita/flags/in.gif +0 -0
  191. skin/adminhtml/default/default/images/capita/flags/io.gif +0 -0
  192. skin/adminhtml/default/default/images/capita/flags/iq.gif +0 -0
  193. skin/adminhtml/default/default/images/capita/flags/ir.gif +0 -0
  194. skin/adminhtml/default/default/images/capita/flags/is.gif +0 -0
  195. skin/adminhtml/default/default/images/capita/flags/it.gif +0 -0
  196. skin/adminhtml/default/default/images/capita/flags/jm.gif +0 -0
  197. skin/adminhtml/default/default/images/capita/flags/jo.gif +0 -0
  198. skin/adminhtml/default/default/images/capita/flags/jp.gif +0 -0
  199. skin/adminhtml/default/default/images/capita/flags/ke.gif +0 -0
  200. skin/adminhtml/default/default/images/capita/flags/kg.gif +0 -0
  201. skin/adminhtml/default/default/images/capita/flags/kh.gif +0 -0
  202. skin/adminhtml/default/default/images/capita/flags/ki.gif +0 -0
  203. skin/adminhtml/default/default/images/capita/flags/km.gif +0 -0
  204. skin/adminhtml/default/default/images/capita/flags/kn.gif +0 -0
  205. skin/adminhtml/default/default/images/capita/flags/kp.gif +0 -0
  206. skin/adminhtml/default/default/images/capita/flags/kr.gif +0 -0
  207. skin/adminhtml/default/default/images/capita/flags/kw.gif +0 -0
  208. skin/adminhtml/default/default/images/capita/flags/ky.gif +0 -0
  209. skin/adminhtml/default/default/images/capita/flags/kz.gif +0 -0
  210. skin/adminhtml/default/default/images/capita/flags/la.gif +0 -0
  211. skin/adminhtml/default/default/images/capita/flags/lb.gif +0 -0
  212. skin/adminhtml/default/default/images/capita/flags/lc.gif +0 -0
  213. skin/adminhtml/default/default/images/capita/flags/li.gif +0 -0
  214. skin/adminhtml/default/default/images/capita/flags/lk.gif +0 -0
  215. skin/adminhtml/default/default/images/capita/flags/lr.gif +0 -0
  216. skin/adminhtml/default/default/images/capita/flags/ls.gif +0 -0
  217. skin/adminhtml/default/default/images/capita/flags/lt.gif +0 -0
  218. skin/adminhtml/default/default/images/capita/flags/lu.gif +0 -0
  219. skin/adminhtml/default/default/images/capita/flags/lv.gif +0 -0
  220. skin/adminhtml/default/default/images/capita/flags/ly.gif +0 -0
  221. skin/adminhtml/default/default/images/capita/flags/ma.gif +0 -0
  222. skin/adminhtml/default/default/images/capita/flags/mc.gif +0 -0
  223. skin/adminhtml/default/default/images/capita/flags/md.gif +0 -0
  224. skin/adminhtml/default/default/images/capita/flags/me.gif +0 -0
  225. skin/adminhtml/default/default/images/capita/flags/mg.gif +0 -0
  226. skin/adminhtml/default/default/images/capita/flags/mh.gif +0 -0
  227. skin/adminhtml/default/default/images/capita/flags/mk.gif +0 -0
  228. skin/adminhtml/default/default/images/capita/flags/ml.gif +0 -0
  229. skin/adminhtml/default/default/images/capita/flags/mm.gif +0 -0
  230. skin/adminhtml/default/default/images/capita/flags/mn.gif +0 -0
  231. skin/adminhtml/default/default/images/capita/flags/mo.gif +0 -0
  232. skin/adminhtml/default/default/images/capita/flags/mp.gif +0 -0
  233. skin/adminhtml/default/default/images/capita/flags/mq.gif +0 -0
  234. skin/adminhtml/default/default/images/capita/flags/mr.gif +0 -0
  235. skin/adminhtml/default/default/images/capita/flags/ms.gif +0 -0
  236. skin/adminhtml/default/default/images/capita/flags/mt.gif +0 -0
  237. skin/adminhtml/default/default/images/capita/flags/mu.gif +0 -0
  238. skin/adminhtml/default/default/images/capita/flags/mv.gif +0 -0
  239. skin/adminhtml/default/default/images/capita/flags/mw.gif +0 -0
  240. skin/adminhtml/default/default/images/capita/flags/mx.gif +0 -0
  241. skin/adminhtml/default/default/images/capita/flags/my.gif +0 -0
  242. skin/adminhtml/default/default/images/capita/flags/mz.gif +0 -0
  243. skin/adminhtml/default/default/images/capita/flags/na.gif +0 -0
  244. skin/adminhtml/default/default/images/capita/flags/nc.gif +0 -0
  245. skin/adminhtml/default/default/images/capita/flags/ne.gif +0 -0
  246. skin/adminhtml/default/default/images/capita/flags/nf.gif +0 -0
  247. skin/adminhtml/default/default/images/capita/flags/ng.gif +0 -0
  248. skin/adminhtml/default/default/images/capita/flags/ni.gif +0 -0
  249. skin/adminhtml/default/default/images/capita/flags/nl.gif +0 -0
  250. skin/adminhtml/default/default/images/capita/flags/no.gif +0 -0
  251. skin/adminhtml/default/default/images/capita/flags/np.gif +0 -0
  252. skin/adminhtml/default/default/images/capita/flags/nr.gif +0 -0
  253. skin/adminhtml/default/default/images/capita/flags/nu.gif +0 -0
  254. skin/adminhtml/default/default/images/capita/flags/nz.gif +0 -0
  255. skin/adminhtml/default/default/images/capita/flags/om.gif +0 -0
  256. skin/adminhtml/default/default/images/capita/flags/pa.gif +0 -0
  257. skin/adminhtml/default/default/images/capita/flags/pe.gif +0 -0
  258. skin/adminhtml/default/default/images/capita/flags/pf.gif +0 -0
  259. skin/adminhtml/default/default/images/capita/flags/pg.gif +0 -0
  260. skin/adminhtml/default/default/images/capita/flags/ph.gif +0 -0
  261. skin/adminhtml/default/default/images/capita/flags/pk.gif +0 -0
  262. skin/adminhtml/default/default/images/capita/flags/pl.gif +0 -0
  263. skin/adminhtml/default/default/images/capita/flags/pm.gif +0 -0
  264. skin/adminhtml/default/default/images/capita/flags/pn.gif +0 -0
  265. skin/adminhtml/default/default/images/capita/flags/pr.gif +0 -0
  266. skin/adminhtml/default/default/images/capita/flags/ps.gif +0 -0
  267. skin/adminhtml/default/default/images/capita/flags/pt.gif +0 -0
  268. skin/adminhtml/default/default/images/capita/flags/pw.gif +0 -0
  269. skin/adminhtml/default/default/images/capita/flags/py.gif +0 -0
  270. skin/adminhtml/default/default/images/capita/flags/qa.gif +0 -0
  271. skin/adminhtml/default/default/images/capita/flags/re.gif +0 -0
  272. skin/adminhtml/default/default/images/capita/flags/ro.gif +0 -0
  273. skin/adminhtml/default/default/images/capita/flags/rs.gif +0 -0
  274. skin/adminhtml/default/default/images/capita/flags/ru.gif +0 -0
  275. skin/adminhtml/default/default/images/capita/flags/rw.gif +0 -0
  276. skin/adminhtml/default/default/images/capita/flags/sa.gif +0 -0
  277. skin/adminhtml/default/default/images/capita/flags/sb.gif +0 -0
  278. skin/adminhtml/default/default/images/capita/flags/sc.gif +0 -0
  279. skin/adminhtml/default/default/images/capita/flags/sd.gif +0 -0
  280. skin/adminhtml/default/default/images/capita/flags/se.gif +0 -0
  281. skin/adminhtml/default/default/images/capita/flags/sg.gif +0 -0
  282. skin/adminhtml/default/default/images/capita/flags/sh.gif +0 -0
  283. skin/adminhtml/default/default/images/capita/flags/si.gif +0 -0
  284. skin/adminhtml/default/default/images/capita/flags/sj.gif +0 -0
  285. skin/adminhtml/default/default/images/capita/flags/sk.gif +0 -0
  286. skin/adminhtml/default/default/images/capita/flags/sl.gif +0 -0
  287. skin/adminhtml/default/default/images/capita/flags/sm.gif +0 -0
  288. skin/adminhtml/default/default/images/capita/flags/sn.gif +0 -0
  289. skin/adminhtml/default/default/images/capita/flags/so.gif +0 -0
  290. skin/adminhtml/default/default/images/capita/flags/sr.gif +0 -0
  291. skin/adminhtml/default/default/images/capita/flags/st.gif +0 -0
  292. skin/adminhtml/default/default/images/capita/flags/sv.gif +0 -0
  293. skin/adminhtml/default/default/images/capita/flags/sy.gif +0 -0
  294. skin/adminhtml/default/default/images/capita/flags/sz.gif +0 -0
  295. skin/adminhtml/default/default/images/capita/flags/tc.gif +0 -0
  296. skin/adminhtml/default/default/images/capita/flags/td.gif +0 -0
  297. skin/adminhtml/default/default/images/capita/flags/tf.gif +0 -0
  298. skin/adminhtml/default/default/images/capita/flags/tg.gif +0 -0
  299. skin/adminhtml/default/default/images/capita/flags/th.gif +0 -0
  300. skin/adminhtml/default/default/images/capita/flags/tj.gif +0 -0
  301. skin/adminhtml/default/default/images/capita/flags/tk.gif +0 -0
  302. skin/adminhtml/default/default/images/capita/flags/tl.gif +0 -0
  303. skin/adminhtml/default/default/images/capita/flags/tm.gif +0 -0
  304. skin/adminhtml/default/default/images/capita/flags/tn.gif +0 -0
  305. skin/adminhtml/default/default/images/capita/flags/to.gif +0 -0
  306. skin/adminhtml/default/default/images/capita/flags/tr.gif +0 -0
  307. skin/adminhtml/default/default/images/capita/flags/tt.gif +0 -0
  308. skin/adminhtml/default/default/images/capita/flags/tv.gif +0 -0
  309. skin/adminhtml/default/default/images/capita/flags/tw.gif +0 -0
  310. skin/adminhtml/default/default/images/capita/flags/tz.gif +0 -0
  311. skin/adminhtml/default/default/images/capita/flags/ua.gif +0 -0
  312. skin/adminhtml/default/default/images/capita/flags/ug.gif +0 -0
  313. skin/adminhtml/default/default/images/capita/flags/um.gif +0 -0
  314. skin/adminhtml/default/default/images/capita/flags/us.gif +0 -0
  315. skin/adminhtml/default/default/images/capita/flags/uy.gif +0 -0
  316. skin/adminhtml/default/default/images/capita/flags/uz.gif +0 -0
  317. skin/adminhtml/default/default/images/capita/flags/va.gif +0 -0
  318. skin/adminhtml/default/default/images/capita/flags/vc.gif +0 -0
  319. skin/adminhtml/default/default/images/capita/flags/ve.gif +0 -0
  320. skin/adminhtml/default/default/images/capita/flags/vg.gif +0 -0
  321. skin/adminhtml/default/default/images/capita/flags/vi.gif +0 -0
  322. skin/adminhtml/default/default/images/capita/flags/vn.gif +0 -0
  323. skin/adminhtml/default/default/images/capita/flags/vu.gif +0 -0
  324. skin/adminhtml/default/default/images/capita/flags/wf.gif +0 -0
  325. skin/adminhtml/default/default/images/capita/flags/ws.gif +0 -0
  326. skin/adminhtml/default/default/images/capita/flags/ye.gif +0 -0
  327. skin/adminhtml/default/default/images/capita/flags/yt.gif +0 -0
  328. skin/adminhtml/default/default/images/capita/flags/za.gif +0 -0
  329. skin/adminhtml/default/default/images/capita/flags/zm.gif +0 -0
  330. skin/adminhtml/default/default/images/capita/flags/zw.gif +0 -0
app/code/community/Capita/LICENSE.txt ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SmartMATE Magento Connect Terms of Use
2
+
3
+ 1. Agreement to these Terms of use
4
+ These Terms govern your use of the SmartMATE Magento Connect. These Terms do
5
+ not relate to any other Capita Translation and Interpreting Limited
6
+ (“Capita”) website or service or your use of any other Capita website or
7
+ service and these Terms do not govern your use of the language services you may
8
+ wish to receive from Capita.
9
+ By accessing or using the SmartMATE Magento Connect you agree with and consent
10
+ to these Terms and you represent that you have the legal authority to accept
11
+ the Terms on behalf of yourself and any party you represent.
12
+
13
+ 2. Intellectual property Rights
14
+ All Intellectual Property Rights (including but not limited to trademarks,
15
+ copyright (including rights in computer software), trade secrets, trade or
16
+ business names, domain names and other similar rights or obligations whether
17
+ registerable or not in any country and applications for any of the foregoing)
18
+ in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
19
+ is given to you for the SmartMATE Magento Connect to be (without limitation)
20
+ sold, distributed or edited.
21
+
22
+ 3. NO WARRANTY
23
+ THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
24
+ WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
25
+ OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
26
+ CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
27
+ PARTICULAR PURPOSE.
28
+ CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
29
+ SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
30
+ OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
31
+ HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
32
+ REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
33
+ RELIABILITY, OR OTHERWISE.
34
+ You are solely responsible for determining the appropriateness of using the
35
+ SmartMATE Magento Connect and you assume all risks associated with this,
36
+ including but not limited compliance with applicable laws, damage to or loss of
37
+ data, programs or equipment, and unavailability or interruption of operations.
38
+ YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
39
+
40
+ 4. LIMITATION OF LIABILITY
41
+ IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
42
+ PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
43
+ WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
44
+ SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
45
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
46
+ NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
47
+ THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
48
+ IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
49
+
50
+ 5. Indemnification for breach of the Terms
51
+ You agree to indemnify and hold harmless Capita from and against any and all
52
+ loss, expenses, damages, and costs, including without limitation reasonable
53
+ attorney fees, resulting, whether directly or indirectly, from your violation
54
+ of the Terms.
55
+
56
+ 6. General
57
+ These Terms are governed by and shall be construed in accordance with English
58
+ law and the parties submit to the exclusive jurisdiction of the English courts.
59
+ If any provision of these Terms is invalid or unenforceable under applicable
60
+ law, it shall not affect the validity or enforceability of the remainder of the
61
+ terms of these Terms and such provision shall be reformed to the minimum extent
62
+ necessary to make such provision valid and enforceable.
63
+
app/code/community/Capita/TI/Block/Adminhtml/Cron/Messages.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Cron_Messages extends Mage_Core_Block_Messages
71
+ {
72
+
73
+ public function _prepareLayout()
74
+ {
75
+ /* @var $cronjobs Mage_Cron_Model_Resource_Schedule_Collection */
76
+ $cronjobs = Mage::getModel('cron/schedule')->getCollection();
77
+ $cronjobs->addFieldToFilter('status', 'error');
78
+ $cronjobs->addFieldToFilter('job_code', array('in' => array('capita_ti_import', 'capita_ti_export')));
79
+ /* @var $schedule Mage_Cron_Model_Schedule */
80
+ foreach ($cronjobs as $schedule) {
81
+ $line = strtok($schedule->getMessages(), "\r\n");
82
+ $this->addWarning($line);
83
+ }
84
+
85
+ // do not call parent
86
+ return $this;
87
+ }
88
+
89
+ protected function _toHtml()
90
+ {
91
+ if ($this->getMessageCollection()->count()) {
92
+ return '<div class="content-header"><h3 class="icon-head">'.
93
+ $this->__('Recent Problems').
94
+ '</h3></div>'.parent::_toHtml();
95
+ }
96
+ return parent::_toHtml();
97
+ }
98
+ }
app/code/community/Capita/TI/Block/Adminhtml/Grid/Column/Filter/Languages.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Grid_Column_Filter_Languages extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Select
71
+ {
72
+
73
+ protected function _getLanguages()
74
+ {
75
+ $languages = Mage::getSingleton('capita_ti/api_languages')->getLanguagesInUse(false);
76
+ return $languages;
77
+ }
78
+
79
+ protected function _getOptions()
80
+ {
81
+ $languages = $this->_getLanguages();
82
+ $options = array(
83
+ array('value' => null, 'label' => ''),
84
+ array('value' => 'all', 'label' => $this->__('All')),
85
+ array('value' => 'nall', 'label' => $this->__('Not All')),
86
+ array('value' => 'some', 'label' => $this->__('Some')),
87
+ array('value' => 'none', 'label' => $this->__('None'))
88
+ );
89
+ foreach ($languages as $value => $label) {
90
+ $options[] = array(
91
+ 'value' => $value,
92
+ 'label' => $label
93
+ );
94
+ }
95
+ return $options;
96
+ }
97
+
98
+ public function getHtml()
99
+ {
100
+ $languages = $this->_getLanguages();
101
+
102
+ $html = '<p>'.parent::getHtml().'</p><p class="a-center">';
103
+ foreach ($languages as $locale => $name) {
104
+ if (preg_match('/^[a-z]+_([A-Z]+)$/', $locale, $m)) {
105
+ $country = strtolower($m[1]);
106
+ $html .= '<img src="'.
107
+ $this->getSkinUrl('images/capita/flags/'.$country.'.gif').
108
+ '" title="'.$this->escapeHtml($name).'">&nbsp;';
109
+ }
110
+ }
111
+ $html .= '</p>';
112
+ return $html;
113
+ }
114
+
115
+ public function getCondition()
116
+ {
117
+ switch ($this->getValue()) {
118
+ case 'all':
119
+ return array('eq' => implode(',', array_keys($this->_getLanguages())));
120
+ case 'nall':
121
+ return array(
122
+ array('neq' => implode(',', array_keys($this->_getLanguages()))),
123
+ array('null' => true));
124
+ case 'some':
125
+ return array('notnull' => true);
126
+ case 'none':
127
+ return array('null' => true);
128
+ case 'null':
129
+ return null;
130
+ default:
131
+ return array('like' => '%'.$this->getValue().'%');
132
+ }
133
+ }
134
+ }
app/code/community/Capita/TI/Block/Adminhtml/Grid/Column/Renderer/Include.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Grid_Column_Renderer_Include extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Checkbox
71
+ {
72
+
73
+ public function renderHeader()
74
+ {
75
+ $html = parent::renderHeader();
76
+ if ($this->getColumn()->getAllValues()) {
77
+ $html = preg_replace(
78
+ '/\/>$/',
79
+ 'value="'.htmlentities(implode('&', $this->getColumn()->getAllValues())).'"/>',
80
+ $html);
81
+ }
82
+ return $html;
83
+ }
84
+ }
app/code/community/Capita/TI/Block/Adminhtml/Grid/Column/Renderer/Languages.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Grid_Column_Renderer_Languages
71
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
72
+ {
73
+
74
+ const IMG_YES = 'images/fam_bullet_success.gif';
75
+ const IMG_NO = 'images/error_msg_icon.gif';
76
+
77
+ public function _getValue(Varien_Object $row)
78
+ {
79
+ $languages = Mage::getSingleton('capita_ti/api_languages')->getLanguagesInUse(false);
80
+
81
+ $html = '';
82
+ $value = parent::_getValue($row);
83
+ foreach ($languages as $locale => $name) {
84
+ $html .= '<img src="'.
85
+ $this->getSkinUrl(strpos($value, $locale) !== false ? self::IMG_YES : self::IMG_NO).
86
+ '" title="'.$this->escapeHtml($name).'">&nbsp;';
87
+ }
88
+ return $html;
89
+ }
90
+ }
app/code/community/Capita/TI/Block/Adminhtml/Grid/Translatable.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ /**
71
+ * @method int[] getEntityIds()
72
+ * @method Capita_TI_Block_Adminhtml_Grid_Translatable setEntityIds(int[] $ids)
73
+ */
74
+ abstract class Capita_TI_Block_Adminhtml_Grid_Translatable
75
+ extends Mage_Adminhtml_Block_Widget_Grid
76
+ {
77
+
78
+ protected function _construct()
79
+ {
80
+ parent::_construct();
81
+ if ($this->getEntityIds()) {
82
+ $this->setDefaultFilter(array(
83
+ 'include' => 1
84
+ ));
85
+ }
86
+ }
87
+
88
+ protected function _prepareColumns()
89
+ {
90
+ /* @var $incColumn Mage_Adminhtml_Block_Widget_Grid_Column */
91
+ $incColumn = $this->getLayout()->createBlock('adminhtml/widget_grid_column');
92
+ $incColumn->setData(array(
93
+ 'header_css_class' => 'a-center',
94
+ 'type' => 'checkbox',
95
+ 'renderer' => 'capita_ti/adminhtml_grid_column_renderer_include',
96
+ 'values' => (array) $this->getEntityIds(),
97
+ 'align' => 'center',
98
+ 'id' => 'include',
99
+ 'filter_condition_callback' => array($this, 'addIncludeFilter')
100
+ ));
101
+ $incColumn->setGrid($this);
102
+
103
+ /* @var $transColumn Mage_Adminhtml_Block_Widget_Grid_Column */
104
+ $transColumn = $this->getLayout()->createBlock('adminhtml/widget_grid_column');
105
+ $transColumn->setData(array(
106
+ 'header' => $this->__('Translated'),
107
+ 'type' => 'text',
108
+ 'filter' => 'capita_ti/adminhtml_grid_column_filter_languages',
109
+ 'renderer' => 'capita_ti/adminhtml_grid_column_renderer_languages',
110
+ 'width' => 170,
111
+ 'align' => 'center',
112
+ 'index' => 'translated',
113
+ 'id' => 'translated',
114
+ 'sortable' => false
115
+ ));
116
+ $transColumn->setGrid($this);
117
+
118
+ $this->_columns = array_merge(array(
119
+ 'include' => $incColumn,
120
+ 'translated' => $transColumn
121
+ ), $this->_columns);
122
+
123
+ return parent::_prepareColumns();
124
+ }
125
+
126
+ protected function _prepareCollection()
127
+ {
128
+ parent::_prepareCollection();
129
+
130
+ $ids = $this->getCollection()->getAllIds();
131
+ $idFieldName = $this->getCollection()->getResource()->getIdFieldName();
132
+ $this->getColumn('include')
133
+ ->setAllValues($ids)
134
+ ->setIndex($idFieldName);
135
+
136
+ return $this;
137
+ }
138
+
139
+ protected function addIncludeFilter(Varien_Data_Collection_Db $collection, Mage_Adminhtml_Block_Widget_Grid_Column $column)
140
+ {
141
+ // 0 = No, 1 = Yes, NULL = Any
142
+ // need to filter on No and Yes
143
+ $include = $column->getFilter()->getValue();
144
+ if (!is_null($include) && ($this->getEntityIds())) {
145
+ if ($collection instanceof Mage_Eav_Model_Entity_Collection_Abstract) {
146
+ $collection->addAttributeToFilter(
147
+ 'entity_id',
148
+ array($include ? 'in' : 'nin' => $this->getEntityIds()));
149
+ }
150
+ else {
151
+ $from = $collection->getSelect()->getPart(Zend_Db_Select::FROM);
152
+ reset($from);
153
+ $table = key($from);
154
+ $collection->addFieldToFilter(
155
+ $table.'.'.$collection->getResource()->getIdFieldName(),
156
+ array($include ? 'in' : 'nin' => $this->getEntityIds()));
157
+ }
158
+ }
159
+ }
160
+
161
+ public function getRowUrl($item)
162
+ {
163
+ return null;
164
+ }
165
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request extends Mage_Adminhtml_Block_Widget_Grid_Container
71
+ {
72
+
73
+ protected $_blockGroup = 'capita_ti';
74
+ protected $_controller = 'adminhtml_request';
75
+
76
+ public function __construct()
77
+ {
78
+ $this->_headerText = $this->__('Translation Requests');
79
+ parent::__construct();
80
+ }
81
+
82
+ protected function getAddButtonLabel()
83
+ {
84
+ return $this->__('New Request');
85
+ }
86
+
87
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/Grid.php ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_Grid extends Mage_Adminhtml_Block_Widget_Grid
71
+ {
72
+
73
+ public function __construct()
74
+ {
75
+ parent::__construct();
76
+ $this->setDefaultSort('created_at');
77
+ $this->setDefaultDir('DESC');
78
+
79
+ $this->setId('request');
80
+ $this->setUseAjax(true);
81
+ }
82
+
83
+ protected function _prepareCollection()
84
+ {
85
+ $collection = Mage::getResourceModel('capita_ti/request_collection');
86
+ $this->setCollection($collection);
87
+ return parent::_prepareCollection();
88
+ }
89
+
90
+ protected function _prepareColumns()
91
+ {
92
+ $this->addColumn('remote_no', array(
93
+ 'index' => 'remote_no',
94
+ 'header' => $this->__('Request No.'),
95
+ 'width' => '100px'
96
+ ));
97
+ $this->addColumn('dest_language', array(
98
+ 'index' => 'dest_language',
99
+ 'header' => $this->__('Languages'),
100
+ 'type' => 'options',
101
+ 'options' => Mage::getSingleton('capita_ti/api_languages')->getLanguagesInUse(),
102
+ 'filter_condition_callback' => array($this, 'filterLanguages')
103
+ ));
104
+ $this->addColumn('product_count', array(
105
+ 'index' => 'product_count',
106
+ 'header' => $this->__('# of products'),
107
+ 'type' => 'number',
108
+ 'width' => '100px'
109
+ ));
110
+ $this->addColumn('category_count', array(
111
+ 'index' => 'category_count',
112
+ 'header' => $this->__('# of categories'),
113
+ 'type' => 'number',
114
+ 'width' => '100px'
115
+ ));
116
+ $this->addColumn('block_count', array(
117
+ 'index' => 'block_count',
118
+ 'header' => $this->__('# of blocks'),
119
+ 'type' => 'number',
120
+ 'width' => '100px'
121
+ ));
122
+ $this->addColumn('page_count', array(
123
+ 'index' => 'page_count',
124
+ 'header' => $this->__('# of pages'),
125
+ 'type' => 'number',
126
+ 'width' => '100px'
127
+ ));
128
+ $this->addColumn('attribute_count', array(
129
+ 'index' => 'attribute_count',
130
+ 'header' => $this->__('# of attributes'),
131
+ 'type' => 'number',
132
+ 'width' => '100px'
133
+ ));
134
+ $this->addColumn('created_at', array(
135
+ 'index' => 'created_at',
136
+ 'header' => $this->__('Submission Date'),
137
+ 'type' => 'datetime',
138
+ 'width' => '150px'
139
+ ));
140
+ $this->addColumn('status', array(
141
+ 'index' => 'status',
142
+ 'header' => $this->__('Status'),
143
+ 'type' => 'options',
144
+ 'options' => Mage::getSingleton('capita_ti/source_status')->getOptions(),
145
+ 'width' => '103px' // why 103? it aligns with the refresh button directly above
146
+ ));
147
+
148
+ return parent::_prepareColumns();
149
+ }
150
+
151
+ protected function _prepareLayout()
152
+ {
153
+ $this->setChild('refresh_button',
154
+ $this->getLayout()->createBlock('adminhtml/widget_button')
155
+ ->setData(array(
156
+ 'label' => $this->__('Refresh Status'),
157
+ 'onclick' => $this->getJsObjectName().'.refreshStatus()'
158
+ ))
159
+ );
160
+ $this->setAdditionalJavaScript('
161
+ varienGrid.prototype.refreshStatus = function() {
162
+ this.reload(this._addVarToUrl(this.url, "refresh", "status"));
163
+ }
164
+ ');
165
+ return parent::_prepareLayout();
166
+ }
167
+
168
+ public function getMainButtonsHtml()
169
+ {
170
+ $html = parent::getMainButtonsHtml();
171
+ $html .= $this->getChildHtml('refresh_button');
172
+ return $html;
173
+ }
174
+
175
+ public function filterLanguages(Capita_TI_Model_Resource_Request_Collection $collection, Mage_Adminhtml_Block_Widget_Grid_Column $column)
176
+ {
177
+ $collection->addFilterLikeLanguage($column->getFilter()->getValue());
178
+ }
179
+
180
+ public function getGridUrl($params = array())
181
+ {
182
+ return $this->getUrl('*/*/grid', $params);
183
+ }
184
+
185
+ public function getRowUrl($item)
186
+ {
187
+ return $this->getUrl('*/*/view', array(
188
+ 'id' => $item->getId()
189
+ ));
190
+ }
191
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New extends Mage_Adminhtml_Block_Widget_Form_Container
71
+ {
72
+
73
+ protected $_blockGroup = 'capita_ti';
74
+ protected $_controller = 'adminhtml_request';
75
+ protected $_mode = 'new';
76
+
77
+ public function __construct()
78
+ {
79
+ parent::__construct();
80
+
81
+ $this->_updateButton('save', 'label', $this->__('Place Request'));
82
+ $this->_headerText = $this->__('Request New Translation');
83
+ }
84
+
85
+ public function getFormActionUrl()
86
+ {
87
+ return $this->getUrl('*/capita_request/save');
88
+ }
89
+
90
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Form.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Form extends Mage_Adminhtml_Block_Widget_Form
71
+ {
72
+
73
+ protected function _prepareForm()
74
+ {
75
+ $form = new Varien_Data_Form(array(
76
+ 'id' => 'edit_form',
77
+ 'action' => $this->getData('action'),
78
+ 'method' => 'post'
79
+ ));
80
+ $form->setUseContainer(true);
81
+ $this->setForm($form);
82
+ return parent::_prepareForm();
83
+ }
84
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Attribute/Grid.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Attribute_Grid
71
+ extends Capita_TI_Block_Adminhtml_Grid_Translatable
72
+ {
73
+
74
+ protected function _construct()
75
+ {
76
+ parent::_construct();
77
+ $this->setId('request_new_tab_attribute');
78
+ $this->setDefaultSort('attribute_code');
79
+ $this->setDefaultDir('asc');
80
+ $this->setSaveParametersInSession(false);
81
+ $this->setUseAjax(true);
82
+ return $this;
83
+ }
84
+
85
+ protected function _prepareColumns()
86
+ {
87
+ $helper = Mage::helper('catalog');
88
+ $yesno = array(
89
+ 1 => $helper->__('Yes'),
90
+ 0 => $helper->__('No')
91
+ );
92
+
93
+ $this->addColumn('attribute_code', array(
94
+ 'header' => $helper->__('Attribute Code'),
95
+ 'index' => 'attribute_code'
96
+ ));
97
+
98
+ $this->addColumn('frontend_label', array(
99
+ 'header' => $helper->__('Attribute Label'),
100
+ 'index' => 'frontend_label'
101
+ ));
102
+
103
+ $this->addColumn('is_user_defined', array(
104
+ 'header' => Mage::helper('eav')->__('System'),
105
+ 'index' => 'is_user_defined',
106
+ 'type' => 'options',
107
+ 'align' => 'center',
108
+ 'options' => array(
109
+ '0' => Mage::helper('eav')->__('Yes'), // intended reverted use
110
+ '1' => Mage::helper('eav')->__('No'), // intended reverted use
111
+ ),
112
+ ));
113
+
114
+ $this->addColumn('is_visible', array(
115
+ 'header' => $helper->__('Visible'),
116
+ 'index' => 'is_visible_on_front',
117
+ 'type' => 'options',
118
+ 'options' => $yesno,
119
+ 'align' => 'center',
120
+ ), 'frontend_label');
121
+
122
+ $this->addColumn('is_searchable', array(
123
+ 'header' => $helper->__('Searchable'),
124
+ 'index' => 'is_searchable',
125
+ 'type' => 'options',
126
+ 'options' => $yesno,
127
+ 'align' => 'center',
128
+ ));
129
+
130
+ $this->addColumn('is_filterable', array(
131
+ 'header' => $helper->__('Use in Layered Navigation'),
132
+ 'index' => 'is_filterable',
133
+ 'type' => 'options',
134
+ 'options' => array(
135
+ '1' => $helper->__('Filterable (with results)'),
136
+ '2' => $helper->__('Filterable (no results)'),
137
+ '0' => $helper->__('No'),
138
+ ),
139
+ 'align' => 'center',
140
+ ));
141
+
142
+ $this->addColumn('is_comparable', array(
143
+ 'header' => $helper->__('Comparable'),
144
+ 'index' => 'is_comparable',
145
+ 'type' => 'options',
146
+ 'options' => $yesno,
147
+ 'align' => 'center',
148
+ ));
149
+
150
+ return parent::_prepareColumns();
151
+ }
152
+
153
+ protected function _prepareCollection()
154
+ {
155
+ /* @var $collection Capita_TI_Model_Resource_Attribute_Collection */
156
+ $collection = Mage::getResourceModel('capita_ti/attribute_collection')
157
+ // visible on backend, not same as is_visible_on_front column
158
+ ->addVisibleFilter();
159
+ $this->setCollection($collection);
160
+
161
+ return parent::_prepareCollection();
162
+ }
163
+
164
+ public function getGridUrl()
165
+ {
166
+ return $this->getUrl('*/capita_request/attributesGrid');
167
+ }
168
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Attribute/Serializer.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Attribute_Serializer
71
+ extends Mage_Adminhtml_Block_Widget_Grid_Serializer
72
+ {
73
+
74
+ protected function _beforeToHtml()
75
+ {
76
+ parent::_construct();
77
+ $this->initSerializerBlock(
78
+ 'request_tab_attributes_grid',
79
+ 'getEntityIds',
80
+ 'attribute_ids',
81
+ 'attribute_ids');
82
+ return $this;
83
+ }
84
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Block/Grid.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Block_Grid
71
+ extends Capita_TI_Block_Adminhtml_Grid_Translatable
72
+ {
73
+
74
+ protected function _construct()
75
+ {
76
+ parent::_construct();
77
+ $this->setId('request_new_tab_blocks');
78
+ $this->setDefaultSort('identifier');
79
+ $this->setDefaultDir('asc');
80
+ $this->setSaveParametersInSession(false);
81
+ $this->setUseAjax(true);
82
+ return $this;
83
+ }
84
+
85
+ protected function _prepareColumns()
86
+ {
87
+ $cmsHelper = Mage::helper('cms');
88
+
89
+ $this->addColumn('title', array(
90
+ 'header' => $cmsHelper->__('Title'),
91
+ 'index' => 'title'
92
+ ));
93
+
94
+ $this->addColumn('identifier', array(
95
+ 'header' => $cmsHelper->__('Identifier'),
96
+ 'index' => 'identifier'
97
+ ));
98
+
99
+ $this->addColumn('is_active', array(
100
+ 'header' => $cmsHelper->__('Status'),
101
+ 'index' => 'is_active',
102
+ 'type' => 'options',
103
+ 'options' => array(
104
+ 0 => $cmsHelper->__('Disabled'),
105
+ 1 => $cmsHelper->__('Enabled')
106
+ ),
107
+ ));
108
+
109
+ return parent::_prepareColumns();
110
+ }
111
+
112
+ protected function _prepareCollection()
113
+ {
114
+ /* @var $collection Capita_TI_Model_Resource_Block_Collection */
115
+ $collection = Mage::getResourceModel('capita_ti/block_collection');
116
+ // filter by all default-locale stores including global
117
+ $collection->addStoreFilter(Mage::helper('capita_ti')->getStoreIdsByLanguage(
118
+ Mage::getStoreConfig('general/locale/code')));
119
+ $this->setCollection($collection);
120
+
121
+ return parent::_prepareCollection();
122
+ }
123
+
124
+ public function getGridUrl()
125
+ {
126
+ return $this->getUrl('*/capita_request/blocksGrid');
127
+ }
128
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Block/Serializer.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Block_Serializer
71
+ extends Mage_Adminhtml_Block_Widget_Grid_Serializer
72
+ {
73
+
74
+ protected function _beforeToHtml()
75
+ {
76
+ parent::_construct();
77
+ $this->initSerializerBlock(
78
+ 'request_tab_blocks_grid',
79
+ 'getEntityIds',
80
+ 'block_ids',
81
+ 'block_ids');
82
+ return $this;
83
+ }
84
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Blocks.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Blocks
71
+ extends Mage_Adminhtml_Block_Text_List
72
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
73
+ {
74
+
75
+ public function getTabLabel()
76
+ {
77
+ return $this->__('CMS Blocks');
78
+ }
79
+
80
+ public function getTabTitle()
81
+ {
82
+ return $this->__('CMS Blocks');
83
+ }
84
+
85
+ public function canShowTab()
86
+ {
87
+ return true;
88
+ }
89
+
90
+ public function isHidden()
91
+ {
92
+ return false;
93
+ }
94
+
95
+ protected function _beforeToHtml()
96
+ {
97
+ $layout = $this->getLayout();
98
+ $this->append($layout->createBlock('capita_ti/adminhtml_request_new_tab_block_grid', 'request_tab_blocks_grid'))
99
+ ->append($layout->createBlock('capita_ti/adminhtml_request_new_tab_block_serializer', 'request_tab_blocks_grid_serializer'));
100
+ return parent::_beforeToHtml();
101
+ }
102
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Categories.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Categories
71
+ extends Mage_Adminhtml_Block_Text_List
72
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
73
+ {
74
+
75
+ public function getTabLabel()
76
+ {
77
+ return $this->__('Catalog Categories');
78
+ }
79
+
80
+ public function getTabTitle()
81
+ {
82
+ return $this->__('Catalog Categories');
83
+ }
84
+
85
+ public function canShowTab()
86
+ {
87
+ return true;
88
+ }
89
+
90
+ public function isHidden()
91
+ {
92
+ return false;
93
+ }
94
+
95
+ protected function _beforeToHtml()
96
+ {
97
+ $layout = $this->getLayout();
98
+ $this->append($layout->createBlock('capita_ti/adminhtml_request_new_tab_category_grid', 'request_tab_categories_grid'))
99
+ ->append($layout->createBlock('capita_ti/adminhtml_request_new_tab_category_serializer', 'request_tab_categories_grid_serializer'))
100
+ ->append($layout->createBlock('capita_ti/adminhtml_request_new_tab_category_attributes', 'request_tab_categories_attributes'));
101
+ return parent::_beforeToHtml();
102
+ }
103
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Category/Attributes.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Category_Attributes
71
+ extends Mage_Adminhtml_Block_Widget_Form
72
+ {
73
+
74
+ protected function _prepareForm()
75
+ {
76
+ $form = new Varien_Data_Form();
77
+ $fieldset = $form->addFieldset('categories', array(
78
+ 'legend' => $this->__('Details')
79
+ ));
80
+ $fieldset->addField('category_attributes', 'multiselect', array(
81
+ 'name' => 'category_attributes',
82
+ 'label' => $this->__('Category Attributes'),
83
+ 'note' => $this->__(
84
+ 'The default selection can be changed in <a href="%s">Configuration</a>.',
85
+ $this->getUrl('*/system_config/edit', array('section' => 'capita_ti'))),
86
+ 'required' => true,
87
+ 'values' => Mage::getSingleton('capita_ti/source_category_attributes')->toOptionArray(),
88
+ 'value' => Mage::getStoreConfig('capita_ti/categories/attributes')
89
+ ));
90
+
91
+ $this->setForm($form);
92
+ return parent::_prepareForm();
93
+ }
94
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Category/Grid.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Category_Grid
71
+ extends Capita_TI_Block_Adminhtml_Grid_Translatable
72
+ {
73
+
74
+ protected function _construct()
75
+ {
76
+ parent::_construct();
77
+ $this->setId('request_new_tab_categories');
78
+ $this->setDefaultSort('entity_id');
79
+ $this->setSaveParametersInSession(false);
80
+ $this->setUseAjax(true);
81
+ return $this;
82
+ }
83
+
84
+ protected function _prepareColumns()
85
+ {
86
+ $catalogHelper = Mage::helper('catalog');
87
+ $this->addColumn('entity_id', array(
88
+ 'header' => $catalogHelper->__('ID'),
89
+ 'type' => 'number',
90
+ 'index' => 'entity_id'
91
+ ));
92
+
93
+ $this->addColumn('name', array(
94
+ 'header' => $catalogHelper->__('Name'),
95
+ 'index' => 'name',
96
+ ));
97
+
98
+ $this->addColumn('url_path', array(
99
+ 'header' => $catalogHelper->__('URL Path'),
100
+ 'index' => 'url_path'
101
+ ));
102
+
103
+ $this->addColumn('is_active', array(
104
+ 'header' => $catalogHelper->__('Is Active'),
105
+ 'width' => 60,
106
+ 'index' => 'is_active',
107
+ 'type' => 'options',
108
+ 'options' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toArray(),
109
+ ));
110
+
111
+ $this->addColumn('include_in_menu', array(
112
+ 'header' => $catalogHelper->__('Include in Navigation Menu'),
113
+ 'width' => 160,
114
+ 'index' => 'include_in_menu',
115
+ 'type' => 'options',
116
+ 'options' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toArray(),
117
+ ));
118
+
119
+ return parent::_prepareColumns();
120
+ }
121
+
122
+ protected function _prepareCollection()
123
+ {
124
+ /* @var $collection Capita_TI_Model_Resource_Category_Collection */
125
+ $collection = Mage::getResourceModel('capita_ti/category_collection');
126
+ $collection->addAttributeToSelect(array(
127
+ 'name',
128
+ 'url_path',
129
+ 'is_active',
130
+ 'include_in_menu'
131
+ ));
132
+ $collection->addAttributeToFilter('level', array('gt' => 1));
133
+ $this->setCollection($collection);
134
+
135
+ parent::_prepareCollection();
136
+ }
137
+
138
+ public function getGridUrl()
139
+ {
140
+ return $this->getUrl('*/capita_request/categoriesGrid');
141
+ }
142
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Category/Serializer.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Category_Serializer
71
+ extends Mage_Adminhtml_Block_Widget_Grid_Serializer
72
+ {
73
+
74
+ protected function _beforeToHtml()
75
+ {
76
+ parent::_construct();
77
+ $this->initSerializerBlock(
78
+ 'request_tab_categories_grid',
79
+ 'getEntityIds',
80
+ 'category_ids',
81
+ 'category_ids');
82
+ return $this;
83
+ }
84
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/General.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_General
71
+ extends Mage_Adminhtml_Block_Widget_Form
72
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
73
+ {
74
+
75
+ public function getTabLabel()
76
+ {
77
+ return $this->__('General');
78
+ }
79
+
80
+ public function getTabTitle()
81
+ {
82
+ return $this->__('General');
83
+ }
84
+
85
+ public function canShowTab()
86
+ {
87
+ return true;
88
+ }
89
+
90
+ public function isHidden()
91
+ {
92
+ return false;
93
+ }
94
+
95
+ protected function _prepareForm()
96
+ {
97
+ $form = new Varien_Data_Form();
98
+ $fieldset = $form->addFieldset('general', array(
99
+ 'legend' => $this->__('General')
100
+ ));
101
+ $locales = Mage::getSingleton('capita_ti/api_languages')->getLanguagesInUse();
102
+ $defaultLocale = Mage::getStoreConfig('general/locale/code');
103
+
104
+ $fieldset->addField('source_language', 'label', array(
105
+ 'label' => $this->__('Source Language'),
106
+ 'value' => @$locales[$defaultLocale]
107
+ ));
108
+
109
+ unset($locales[$defaultLocale]);
110
+ $fieldset->addField('dest_language', 'multiselect', array(
111
+ 'name' => 'dest_language',
112
+ 'label' => $this->__('Target Languages'),
113
+ 'required' => true,
114
+ 'values' => $this->helper('capita_ti')->convertHashToOptions($locales),
115
+ 'value' => array_keys($locales)
116
+ ));
117
+
118
+ $this->setForm($form);
119
+ return parent::_prepareForm();
120
+ }
121
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Page/Grid.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Page_Grid
71
+ extends Capita_TI_Block_Adminhtml_Grid_Translatable
72
+ {
73
+
74
+ protected function _construct()
75
+ {
76
+ parent::_construct();
77
+ $this->setId('request_new_tab_pages');
78
+ $this->setDefaultSort('identifier');
79
+ $this->setDefaultDir('asc');
80
+ $this->setSaveParametersInSession(false);
81
+ $this->setUseAjax(true);
82
+ return $this;
83
+ }
84
+
85
+ protected function _prepareColumns()
86
+ {
87
+ $cmsHelper = Mage::helper('cms');
88
+
89
+ $this->addColumn('title', array(
90
+ 'header' => $cmsHelper->__('Title'),
91
+ 'index' => 'title'
92
+ ));
93
+
94
+ $this->addColumn('identifier', array(
95
+ 'header' => $cmsHelper->__('Identifier'),
96
+ 'index' => 'identifier'
97
+ ));
98
+
99
+ $this->addColumn('is_active', array(
100
+ 'header' => $cmsHelper->__('Status'),
101
+ 'index' => 'is_active',
102
+ 'type' => 'options',
103
+ 'options' => array(
104
+ 0 => $cmsHelper->__('Disabled'),
105
+ 1 => $cmsHelper->__('Enabled')
106
+ ),
107
+ ));
108
+
109
+ return parent::_prepareColumns();
110
+ }
111
+
112
+ protected function _prepareCollection()
113
+ {
114
+ /* @var $collection Capita_TI_Model_Resource_Page_Collection */
115
+ $collection = Mage::getResourceModel('capita_ti/page_collection');
116
+ // filter by all default-locale stores including global
117
+ $collection->addStoreFilter(Mage::helper('capita_ti')->getStoreIdsByLanguage(
118
+ Mage::getStoreConfig('general/locale/code')));
119
+ $this->setCollection($collection);
120
+
121
+ return parent::_prepareCollection();
122
+ }
123
+
124
+ public function getGridUrl()
125
+ {
126
+ return $this->getUrl('*/capita_request/pagesGrid');
127
+ }
128
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Page/Serializer.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Page_Serializer
71
+ extends Mage_Adminhtml_Block_Widget_Grid_Serializer
72
+ {
73
+
74
+ protected function _beforeToHtml()
75
+ {
76
+ parent::_construct();
77
+ $this->initSerializerBlock(
78
+ 'request_tab_pages_grid',
79
+ 'getEntityIds',
80
+ 'page_ids',
81
+ 'page_ids');
82
+ return $this;
83
+ }
84
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Pages.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Pages
71
+ extends Mage_Adminhtml_Block_Text_List
72
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
73
+ {
74
+
75
+ public function getTabLabel()
76
+ {
77
+ return $this->__('CMS Pages');
78
+ }
79
+
80
+ public function getTabTitle()
81
+ {
82
+ return $this->__('CMS Pages');
83
+ }
84
+
85
+ public function canShowTab()
86
+ {
87
+ return true;
88
+ }
89
+
90
+ public function isHidden()
91
+ {
92
+ return false;
93
+ }
94
+
95
+ protected function _beforeToHtml()
96
+ {
97
+ $layout = $this->getLayout();
98
+ $this->append($layout->createBlock('capita_ti/adminhtml_request_new_tab_page_grid', 'request_tab_pages_grid'))
99
+ ->append($layout->createBlock('capita_ti/adminhtml_request_new_tab_page_serializer', 'request_tab_pages_grid_serializer'));
100
+ return parent::_beforeToHtml();
101
+ }
102
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Product/Attributes.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Product_Attributes
71
+ extends Mage_Adminhtml_Block_Widget_Form
72
+ {
73
+
74
+ protected function _prepareForm()
75
+ {
76
+ $form = new Varien_Data_Form();
77
+ $fieldset = $form->addFieldset('products', array(
78
+ 'legend' => $this->__('Details')
79
+ ));
80
+ $fieldset->addField('product_attributes', 'multiselect', array(
81
+ 'name' => 'product_attributes',
82
+ 'label' => $this->__('Product Attributes'),
83
+ 'note' => $this->__(
84
+ 'The default selection can be changed in <a href="%s">Configuration</a>.',
85
+ $this->getUrl('*/system_config/edit', array('section' => 'capita_ti'))),
86
+ 'required' => true,
87
+ 'values' => Mage::getSingleton('capita_ti/source_product_attributes')->toOptionArray(),
88
+ 'value' => Mage::getStoreConfig('capita_ti/products/attributes')
89
+ ));
90
+
91
+ $this->setForm($form);
92
+ return parent::_prepareForm();
93
+ }
94
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Product/Grid.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Product_Grid
71
+ extends Capita_TI_Block_Adminhtml_Grid_Translatable
72
+ {
73
+
74
+ public function getEntityIds()
75
+ {
76
+ if (parent::getEntityIds()) {
77
+ return (array) parent::getEntityIds();
78
+ }
79
+ return (array) Mage::getSingleton('adminhtml/session')->getCapitaProductIds();
80
+ }
81
+
82
+ protected function _construct()
83
+ {
84
+ parent::_construct();
85
+ $this->setId('request_new_tab_products');
86
+ $this->setDefaultSort('entity_id');
87
+ $this->setSaveParametersInSession(false);
88
+ $this->setUseAjax(true);
89
+ return $this;
90
+ }
91
+
92
+ protected function _prepareColumns()
93
+ {
94
+ $catalogHelper = Mage::helper('catalog');
95
+ $this->addColumn('entity_id', array(
96
+ 'header' => $catalogHelper->__('ID'),
97
+ 'type' => 'number',
98
+ 'index' => 'entity_id'
99
+ ));
100
+
101
+ $this->addColumn('name', array(
102
+ 'header' => $catalogHelper->__('Name'),
103
+ 'index' => 'name'
104
+ ));
105
+
106
+ $this->addColumn('type', array(
107
+ 'header' => $catalogHelper->__('Type'),
108
+ 'width' => 100,
109
+ 'index' => 'type_id',
110
+ 'type' => 'options',
111
+ 'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
112
+ ));
113
+
114
+ $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
115
+ ->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
116
+ ->load()
117
+ ->toOptionHash();
118
+
119
+ $this->addColumn('set_name', array(
120
+ 'header' => Mage::helper('catalog')->__('Attrib. Set Name'),
121
+ 'width' => 130,
122
+ 'index' => 'attribute_set_id',
123
+ 'type' => 'options',
124
+ 'options' => $sets,
125
+ ));
126
+
127
+ $this->addColumn('status', array(
128
+ 'header' => Mage::helper('catalog')->__('Status'),
129
+ 'width' => 90,
130
+ 'index' => 'status',
131
+ 'type' => 'options',
132
+ 'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
133
+ ));
134
+
135
+ $this->addColumn('visibility', array(
136
+ 'header' => Mage::helper('catalog')->__('Visibility'),
137
+ 'width' => 90,
138
+ 'index' => 'visibility',
139
+ 'type' => 'options',
140
+ 'options' => Mage::getSingleton('catalog/product_visibility')->getOptionArray(),
141
+ ));
142
+
143
+ $this->addColumn('sku', array(
144
+ 'header' => Mage::helper('catalog')->__('SKU'),
145
+ 'width' => 80,
146
+ 'index' => 'sku'
147
+ ));
148
+
149
+ return parent::_prepareColumns();
150
+ }
151
+
152
+ protected function _prepareCollection()
153
+ {
154
+ /* @var $collection Capita_TI_Model_Resource_Product_Collection */
155
+ $collection = Mage::getResourceModel('capita_ti/product_collection');
156
+ $collection->addAttributeToSelect(array(
157
+ 'name',
158
+ 'status',
159
+ 'visibility'
160
+ ));
161
+ $this->setCollection($collection);
162
+
163
+ return parent::_prepareCollection();
164
+ }
165
+
166
+ public function getGridUrl()
167
+ {
168
+ return $this->getUrl('*/capita_request/productsGrid');
169
+ }
170
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Product/Serializer.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Product_Serializer
71
+ extends Mage_Adminhtml_Block_Widget_Grid_Serializer
72
+ {
73
+
74
+ protected function _beforeToHtml()
75
+ {
76
+ parent::_construct();
77
+ $this->initSerializerBlock(
78
+ 'request_tab_products_grid',
79
+ 'getEntityIds',
80
+ 'product_ids',
81
+ 'product_ids');
82
+ return $this;
83
+ }
84
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tab/Products.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tab_Products
71
+ extends Mage_Adminhtml_Block_Text_List
72
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
73
+ {
74
+
75
+ public function getTabLabel()
76
+ {
77
+ return $this->__('Catalog Products');
78
+ }
79
+
80
+ public function getTabTitle()
81
+ {
82
+ return $this->__('Catalog Products');
83
+ }
84
+
85
+ public function canShowTab()
86
+ {
87
+ return true;
88
+ }
89
+
90
+ public function isHidden()
91
+ {
92
+ return false;
93
+ }
94
+
95
+ protected function _beforeToHtml()
96
+ {
97
+ $layout = $this->getLayout();
98
+ $this->append($layout->createBlock('capita_ti/adminhtml_request_new_tab_product_grid', 'request_tab_products_grid'))
99
+ ->append($layout->createBlock('capita_ti/adminhtml_request_new_tab_product_serializer', 'request_tab_products_grid_serializer'))
100
+ ->append($layout->createBlock('capita_ti/adminhtml_request_new_tab_product_attributes', 'request_tab_products_attributes'));
101
+ return parent::_beforeToHtml();
102
+ }
103
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/New/Tabs.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_New_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
71
+ {
72
+
73
+ protected function _construct()
74
+ {
75
+ parent::_construct();
76
+ $this->setId('capita_ti_new_request_tabs');
77
+ $this->setDestElementId('edit_form');
78
+ return $this;
79
+ }
80
+
81
+ public function addGeneralTab()
82
+ {
83
+ $this->addTab('general', 'capita_ti/adminhtml_request_new_tab_general');
84
+ return $this;
85
+ }
86
+
87
+ public function addProductsTab()
88
+ {
89
+ $this->addTab('products', array(
90
+ 'label' => $this->__('Catalog Products'),
91
+ 'title' => $this->__('Catalog Products'),
92
+ 'url' => $this->getUrl('*/capita_request/productsTab'),
93
+ 'class' => 'ajax'
94
+ ));
95
+ return $this;
96
+ }
97
+
98
+ public function addAttributesTab()
99
+ {
100
+ $this->addTab('attributes', array(
101
+ 'label' => $this->__('Catalog Product Attributes'),
102
+ 'url' => $this->getUrl('*/capita_request/attributesTab'),
103
+ 'class' => 'ajax'
104
+ ));
105
+ return $this;
106
+ }
107
+
108
+ public function addCategoriesTab()
109
+ {
110
+ $this->addTab('categories', array(
111
+ 'label' => $this->__('Catalog Categories'),
112
+ 'title' => $this->__('Catalog Categories'),
113
+ 'url' => $this->getUrl('*/capita_request/categoriesTab'),
114
+ 'class' => 'ajax'
115
+ ));
116
+ return $this;
117
+ }
118
+
119
+ public function addBlocksTab()
120
+ {
121
+ $this->addTab('blocks', array(
122
+ 'label' => $this->__('CMS Blocks'),
123
+ 'title' => $this->__('CMS Blocks'),
124
+ 'url' => $this->getUrl('*/capita_request/blocksTab'),
125
+ 'class' => 'ajax'
126
+ ));
127
+ return $this;
128
+ }
129
+
130
+ public function addPagesTab()
131
+ {
132
+ $this->addTab('pages', array(
133
+ 'label' => $this->__('CMS Pages'),
134
+ 'title' => $this->__('CMS Pages'),
135
+ 'url' => $this->getUrl('*/capita_request/pagesTab'),
136
+ 'class' => 'ajax'
137
+ ));
138
+ return $this;
139
+ }
140
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/View.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_View extends Mage_Adminhtml_Block_Widget_Form_Container
71
+ {
72
+
73
+ protected $_blockGroup = 'capita_ti';
74
+ protected $_controller = 'adminhtml_request';
75
+ protected $_mode = 'view';
76
+
77
+ public function __construct()
78
+ {
79
+ parent::__construct();
80
+
81
+ $this->_updateButton('delete', 'disabled', !$this->_getRequest()->canDelete());
82
+ $this->_removeButton('reset');
83
+ $this->_removeButton('save');
84
+ $this->_headerText = $this->__('Request "%s"', $this->_getRequest()->getRemoteNo());
85
+ $refreshUrl = $this->getUrl('*/*/*', array('_current'=>true, 'refresh'=>'status'));
86
+ $this->_addButton('refresh', array(
87
+ 'label' => $this->__('Refresh Status'),
88
+ 'onclick' => "setLocation('{$refreshUrl}')",
89
+ 'class' => 'save',
90
+ 'disabled' => !$this->_getRequest()->canUpdate()
91
+ ));
92
+ }
93
+
94
+ /**
95
+ * @return Capita_TI_Model_Request
96
+ */
97
+ protected function _getRequest()
98
+ {
99
+ return Mage::registry('capita_request');
100
+ }
101
+ }
app/code/community/Capita/TI/Block/Adminhtml/Request/View/Form.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Block_Adminhtml_Request_View_Form extends Mage_Adminhtml_Block_Widget_Form
71
+ {
72
+
73
+ protected function _prepareForm()
74
+ {
75
+ $form = new Varien_Data_Form();
76
+ /* @var $request Capita_TI_Model_Request */
77
+ $request = Mage::registry('capita_request');
78
+
79
+ $this->_addGeneralData($form, $request);
80
+
81
+ if ($request->getProductCount()) {
82
+ $this->_addProductData($form, $request);
83
+ }
84
+
85
+ if ($request->getCategoryCount()) {
86
+ $this->_addCategoryData($form, $request);
87
+ }
88
+
89
+ if ($request->getBlockCount()) {
90
+ $this->_addBlockData($form, $request);
91
+ }
92
+
93
+ if ($request->getPageCount()) {
94
+ $this->_addPageData($form, $request);
95
+ }
96
+
97
+ if ($request->getAttributeCount()) {
98
+ $this->_addAttributeData($form, $request);
99
+ }
100
+
101
+ $this->setForm($form);
102
+ return parent::_prepareForm();
103
+ }
104
+
105
+ protected function _addGeneralData(Varien_Data_Form $form, Capita_TI_Model_Request $request)
106
+ {
107
+ $general = $form->addFieldset('general', array(
108
+ 'legend' => $this->__('General')
109
+ ));
110
+ $general->addField('status', 'label', array(
111
+ 'label' => $this->__('Status'),
112
+ 'value' => $request->getStatusLabel()
113
+ ));
114
+ $general->addField('source_language', 'label', array(
115
+ 'label' => $this->__('Source Language'),
116
+ 'value' => $request->getSourceLanguageName()
117
+ ));
118
+ $general->addField('dest_language', 'label', array(
119
+ 'label' => $this->__('Requested Languages'),
120
+ 'value' => $request->getDestLanguageName()
121
+ ));
122
+ $general->addField('created_at', 'label', array(
123
+ 'label' => $this->__('Submission Date'),
124
+ 'value' => Mage::app()->getLocale()->date($request->getCreatedAt(), Varien_Date::DATETIME_INTERNAL_FORMAT)
125
+ ));
126
+ $general->addField('updated_at', 'label', array(
127
+ 'label' => $this->__('Last Updated'),
128
+ 'value' => Mage::app()->getLocale()->date($request->getUpdatedAt(), Varien_Date::DATETIME_INTERNAL_FORMAT)
129
+ ));
130
+ return $general;
131
+ }
132
+
133
+ protected function _addProductData(Varien_Data_Form $form, Capita_TI_Model_Request $request)
134
+ {
135
+ $products = $form->addFieldset('products', array(
136
+ 'legend' => $this->__('Products')
137
+ ));
138
+ $products->addField('product_count', 'label', array(
139
+ 'label' => $this->__('Number of products selected'),
140
+ 'value' => $request->getProductCount()
141
+ ));
142
+ $products->addField('product_attributes', 'label', array(
143
+ 'label' => $this->__('Product Attributes'),
144
+ 'value' => $request->getProductAttributeNames()
145
+ ));
146
+
147
+ return $products;
148
+ }
149
+
150
+ protected function _addCategoryData(Varien_Data_Form $form, Capita_TI_Model_Request $request)
151
+ {
152
+ $categories = $form->addFieldset('categories', array(
153
+ 'legend' => $this->__('Categories')
154
+ ));
155
+ $categories->addField('category_count', 'label', array(
156
+ 'label' => $this->__('Number of categories selected'),
157
+ 'value' => $request->getCategoryCount()
158
+ ));
159
+ $categories->addField('category_attributes', 'label', array(
160
+ 'label' => $this->__('Category Attributes'),
161
+ 'value' => $request->getCategoryAttributeNames()
162
+ ));
163
+
164
+ return $categories;
165
+ }
166
+
167
+ protected function _addBlockData(Varien_Data_Form $form, Capita_TI_Model_Request $request)
168
+ {
169
+ $blocks = $form->addFieldset('blocks', array(
170
+ 'legend' => $this->__('Blocks')
171
+ ));
172
+ $blocks->addField('block_count', 'label', array(
173
+ 'label' => $this->__('Number of blocks selected'),
174
+ 'value' => $request->getBlockCount()
175
+ ));
176
+
177
+ return $categories;
178
+ }
179
+
180
+ protected function _addPageData(Varien_Data_Form $form, Capita_TI_Model_Request $request)
181
+ {
182
+ $pages = $form->addFieldset('pages', array(
183
+ 'legend' => $this->__('Pages')
184
+ ));
185
+ $pages->addField('page_count', 'label', array(
186
+ 'label' => $this->__('Number of pages selected'),
187
+ 'value' => $request->getPageCount()
188
+ ));
189
+
190
+ return $categories;
191
+ }
192
+
193
+ protected function _addAttributeData(Varien_Data_Form $form, Capita_TI_Model_Request $request)
194
+ {
195
+ $attributes = $form->addFieldset('attributes', array(
196
+ 'legend' => $this->__('Attributes')
197
+ ));
198
+ $attributes->addField('attribute_count', 'label', array(
199
+ 'label' => $this->__('Number of attributes selected'),
200
+ 'value' => $request->getAttributeCount()
201
+ ));
202
+
203
+ return $categories;
204
+ }
205
+ }
app/code/community/Capita/TI/Controller/Action.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Controller_Action extends Mage_Adminhtml_Controller_Action
71
+ {
72
+
73
+
74
+ const ACL_PATH = 'system/capita_request';
75
+
76
+ protected function _isAllowed()
77
+ {
78
+ return Mage::getSingleton('admin/session')->isAllowed(self::ACL_PATH);
79
+ }
80
+
81
+ protected function _checkConnection()
82
+ {
83
+ if ($this->_isLayoutLoaded) {
84
+ try {
85
+ Mage::getSingleton('capita_ti/api_languages')->getLanguages();
86
+ }
87
+ catch (Zend_Http_Exception $e) {
88
+ Mage::logException($e);
89
+ $this->getLayout()->getMessagesBlock()->addError($this->__('There was a problem connecting to the server: %s', $e->getMessage()));
90
+ Mage::getSingleton('capita_ti/api_languages')->setLocalLanguages();
91
+ }
92
+ }
93
+ }
94
+ }
app/code/community/Capita/TI/Helper/Data.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Helper_Data extends Mage_Core_Helper_Data
71
+ {
72
+
73
+ /**
74
+ * Returns module string as specified in config.xml
75
+ *
76
+ * @return string
77
+ */
78
+ public function getModuleVersion()
79
+ {
80
+ return (string) Mage::getConfig()->getNode('modules/Capita_TI/version');
81
+ }
82
+
83
+ public function convertHashToOptions($hash)
84
+ {
85
+ $options = array();
86
+ foreach ($hash as $value => $label) {
87
+ $options[] = array(
88
+ 'value' => $value,
89
+ 'label' => $label
90
+ );
91
+ }
92
+ return $options;
93
+ }
94
+
95
+ /**
96
+ * Get list of store IDs that use the given locale code
97
+ *
98
+ * If $language is NULL then return 2D array keyed by locale code instead.
99
+ *
100
+ * @param string $language
101
+ * @return array
102
+ */
103
+ public function getStoreIdsByLanguage($language = null)
104
+ {
105
+ $stores = array();
106
+ /* @var $store Mage_Core_Model_Store */
107
+ foreach (Mage::app()->getStores() as $store) {
108
+ $storeLang = $store->getConfig('general/locale/code');
109
+ $stores[$storeLang][] = $store->getId();
110
+ }
111
+ return $language ? (array) @$stores[$language] : $stores;
112
+ }
113
+
114
+ /**
115
+ * Get possible locale codes (other than default store)
116
+ *
117
+ * Does not compare with remote languages so might include
118
+ * untranslatable languages, albeit unlikely.
119
+ *
120
+ * @return string[]
121
+ */
122
+ public function getNonDefaultLocales()
123
+ {
124
+ $locales = array();
125
+ foreach (Mage::app()->getStores() as $store) {
126
+ $locales[$store->getConfig('general/locale/code')] = true;
127
+ }
128
+ unset($locales[Mage::getStoreConfig('general/locale/code')]);
129
+ return array_keys($locales);
130
+ }
131
+ }
app/code/community/Capita/TI/Model/Api/Abstract.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Api_Abstract extends Zend_Http_Client
71
+ {
72
+
73
+ const CACHE_TAG = 'CAPITA_TI';
74
+
75
+ protected function getUsername()
76
+ {
77
+ return Mage::getStoreConfig('capita_ti/authentication/username');
78
+ }
79
+
80
+ protected function getPassword()
81
+ {
82
+ return Mage::helper('core')->decrypt(Mage::getStoreConfig('capita_ti/authentication/password'));
83
+ }
84
+
85
+ protected function getEndpoint($path)
86
+ {
87
+ $baseUrl = Mage::getStoreConfig('capita_ti/base_url');
88
+ return rtrim($baseUrl, DS) . DS . ltrim($path, DS);
89
+ }
90
+
91
+ public function __construct($uri = null, $config = null)
92
+ {
93
+ $versionSlug = 'Magento '.Mage::getVersion();
94
+
95
+ if (extension_loaded('curl') && !@$config['adapter']) {
96
+ $config['adapter'] = 'Zend_Http_Client_Adapter_Curl';
97
+ $curlInfo = curl_version();
98
+ $versionSlug .= '; cURL '.@$curlInfo['version'];
99
+ }
100
+
101
+ if (!@$config['useragent']) {
102
+ $config['useragent'] = sprintf(
103
+ 'Capita_TI/%s (%s)',
104
+ Mage::helper('capita_ti')->getModuleVersion(),
105
+ $versionSlug);
106
+ }
107
+
108
+ $this->setAuth($this->getUsername(), $this->getPassword());
109
+
110
+ parent::__construct($uri, $config);
111
+ }
112
+
113
+ /**
114
+ * Convert JSON to equivalent array
115
+ *
116
+ * @param Zend_Http_Response $response
117
+ * @throws Zend_Http_Exception
118
+ * @throws Zend_Http_Client_Exception
119
+ * @return array
120
+ */
121
+ protected function decode(Zend_Http_Response $response)
122
+ {
123
+ if (!preg_match('#^application/json(?:$|;)#', $response->getHeader('Content-Type'))) {
124
+ if ($response->isError()) {
125
+ throw new Zend_Http_Exception($response->getMessage(), $response->getStatus());
126
+ }
127
+ throw new Zend_Http_Client_Exception('Content type is not JSON');
128
+ }
129
+ $body = Zend_Json::decode($response->getBody());
130
+ if ($response->isError()) {
131
+ throw new Zend_Http_Exception(@$body['message'], $response->getStatus());
132
+ }
133
+ return $body;
134
+ }
135
+ }
app/code/community/Capita/TI/Model/Api/Adapter/SamplePostRequest.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Api_Adapter_SamplePostRequest extends Zend_Http_Client_Adapter_Test
71
+ {
72
+
73
+ public function __construct()
74
+ {
75
+ $this->setResponse("HTTP/1.1 201 CREATED\r\n".
76
+ "Content-Type: application/json\r\n\r\n".
77
+ '{
78
+ "Documents": [
79
+ {
80
+ "DocumentId": "746155792-85270",
81
+ "DocumentName": "file-one-name.txt",
82
+ "IsoCode": "en-US",
83
+ "LanguageName": "English (USA)"
84
+ },
85
+ {
86
+ "DocumentId": "746155792-85271",
87
+ "DocumentName": "file-two-name.txt",
88
+ "IsoCode": "en-US",
89
+ "LanguageName": "English (USA)"
90
+ }
91
+ ],
92
+ "RequestId": "1250936094-13321",
93
+ "RequestNo": "CTI-160302-1",
94
+ "RequestStatus": "onHold"
95
+ }');
96
+ }
97
+ }
app/code/community/Capita/TI/Model/Api/Languages.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Api_Languages extends Capita_TI_Model_Api_Abstract
71
+ {
72
+
73
+ protected $languages;
74
+
75
+ public function __construct($config = null)
76
+ {
77
+ parent::__construct($this->getEndpoint('languages'), $config);
78
+ }
79
+
80
+ /**
81
+ * Get available languages for this TI account
82
+ *
83
+ * @return array
84
+ */
85
+ public function getLanguages()
86
+ {
87
+ if (isset($this->languages)) {
88
+ return $this->languages;
89
+ }
90
+
91
+ // check recent cache
92
+ $cacheId = 'capita_ti_languages_'.$this->getUsername();
93
+ try {
94
+ $data = Zend_Json::decode(Mage::app()->loadCache($cacheId));
95
+ } catch (Zend_Json_Exception $e) {
96
+ // cache was empty or corrupted
97
+ $data = null;
98
+ }
99
+
100
+ // fallback to remote source
101
+ if (!is_array($data)) {
102
+ $response = $this->request();
103
+ $data = $this->decode($response);
104
+ // if exception throws here then cache is not written
105
+ $cacheTags = array(
106
+ // clear on "Flush Magento Cache"
107
+ Mage_Core_Model_APP::CACHE_TAG,
108
+ // clear with "Collection Data"
109
+ Mage_Core_Model_Resource_Db_Collection_Abstract::CACHE_TAG
110
+ );
111
+ Mage::app()->saveCache($response->getBody(), $cacheId, $cacheTags, 3600);
112
+ }
113
+
114
+ // convert to Magento/Zend convention
115
+ if (is_array($data)) {
116
+ $this->languages = array();
117
+ foreach ($data as $language) {
118
+ $code = strtr(@$language['IsoCode'], '-', '_');
119
+ $name = @$language['LanguageName'];
120
+ $this->languages[$code] = $name;
121
+ }
122
+ return $this->languages;
123
+ }
124
+
125
+ // worst case scenario, no content but still traversable
126
+ return array();
127
+ }
128
+
129
+ /**
130
+ * Override list of languages with local fixed list. Useful for fallbacks.
131
+ *
132
+ * @return Capita_TI_Model_Api_Languages
133
+ */
134
+ public function setLocalLanguages()
135
+ {
136
+ $this->languages = array();
137
+ foreach (Mage::app()->getLocale()->getOptionLocales() as $locale) {
138
+ $this->languages[@$locale['value']] = @$locale['label'];
139
+ }
140
+ return $this;
141
+ }
142
+
143
+ public function getLanguagesInUse($includeGlobal = true)
144
+ {
145
+ $codes = array();
146
+ /* @var $store Mage_Core_Model_Store */
147
+ foreach (Mage::app()->getStores() as $store) {
148
+ $code = (string) $store->getConfig('general/locale/code');
149
+ $codes[$code] = true;
150
+ }
151
+ if (!$includeGlobal) {
152
+ unset($codes[Mage::getStoreConfig('general/locale/code')]);
153
+ }
154
+ $languages = $this->getLanguages();
155
+ return array_intersect_key($languages, $codes);
156
+ }
157
+
158
+ /**
159
+ * Successful response is cached transparently, this explicitly clears it.
160
+ *
161
+ * Currently only languages are cacheable.
162
+ * If this changes then consider moving this function to parent class.
163
+ *
164
+ * @return Capita_TI_Model_Api_Languages
165
+ */
166
+ public function clearCache()
167
+ {
168
+ $cacheId = 'capita_ti_languages_'.$this->getUsername();
169
+ Mage::app()->removeCache($cacheId);
170
+ return $this;
171
+ }
172
+ }
app/code/community/Capita/TI/Model/Api/Requests.php ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Api_Requests extends Capita_TI_Model_Api_Abstract
71
+ {
72
+
73
+ protected function getCustomerName()
74
+ {
75
+ return Mage::getStoreConfig('capita_ti/authentication/customer_name');
76
+ }
77
+
78
+ protected function getContactName()
79
+ {
80
+ return Mage::getStoreConfig('capita_ti/authentication/contact_name');
81
+ }
82
+
83
+ public function __construct($config = null)
84
+ {
85
+ if (!@$config['adapter']) {
86
+ // libcurl is faster but breaks on streaming large downloads
87
+ $config['adapter'] = 'Zend_Http_Client_Adapter_Socket';
88
+ }
89
+ if (!@$config['timeout']) {
90
+ $config['timeout'] = 120;
91
+ }
92
+
93
+ parent::__construct($this->getEndpoint('requests'), $config);
94
+ }
95
+
96
+ /**
97
+ * Writes entities to a file, uploads it to API, and returns an object which describes it.
98
+ *
99
+ * @param Zend_Controller_Request_Abstract $input
100
+ * @throws Mage_Adminhtml_Exception
101
+ * @throws Zend_Http_Exception
102
+ * @return Capita_TI_Model_Request
103
+ */
104
+ public function startNewRequest(Zend_Controller_Request_Abstract $input)
105
+ {
106
+ $sourceLanguage = $input->getParam('source_language', Mage::getStoreConfig('general/locale/code'));
107
+ $destLanguage = implode(',', $input->getParam('dest_language'));
108
+ $this->setParameterPost('CustomerName', $this->getCustomerName());
109
+ $this->setParameterPost('ContactName', $this->getContactName());
110
+ $this->setParameterPost('SourceLanguageCode', $sourceLanguage);
111
+ $this->setParameterPost('TargetLanguageCodes', $destLanguage);
112
+
113
+ // any future date will probably do
114
+ // API demands a date but doesn't use it
115
+ $nextWeek = new Zend_Date();
116
+ $nextWeek->addWeek(1);
117
+ $this->setParameterPost('DeliveryDate', $nextWeek->toString('y-MM-d HH:mm:ss'));
118
+
119
+ // now for the main content
120
+ $productIds = $input->getParam('product_ids', '');
121
+ $productIds = array_filter(array_unique(explode('&', $productIds)));
122
+ $productAttributes = $input->getParam('product_attributes', array());
123
+ /* @var $products Mage_Catalog_Model_Resource_Product_Collection */
124
+ $products = Mage::getResourceModel('catalog/product_collection');
125
+ $products->addIdFilter($productIds);
126
+ $products->addAttributeToSelect($productAttributes);
127
+
128
+ $attributeIds = $input->getParam('attribute_ids', '');
129
+ $attributeIds = array_filter(array_unique(explode('&', $attributeIds)));
130
+ /* @var $attributes Mage_Eav_Model_Resource_Entity_Attribute_Collection */
131
+ $attributes = Mage::getResourceModel('eav/entity_attribute_collection');
132
+ $attributes->addFieldToFilter('attribute_id', array('in' => $attributeIds));
133
+ /* @var $attributeOptions Mage_Eav_Model_Resource_Entity_Attribute_Option_Collection */
134
+ $attributeOptions = Mage::getResourceModel('eav/entity_attribute_option_collection');
135
+ $attributeOptions->setAttributeFilter(array('in' => $attributeIds));
136
+ // joins the values for global store
137
+ $attributeOptions->setStoreFilter();
138
+
139
+ $categoryIds = $input->getParam('category_ids', '');
140
+ $categoryIds = array_filter(array_unique(explode('&', $categoryIds)));
141
+ $categoryAttributes = $input->getParam('category_attributes', array());
142
+ /* @var $categories Mage_Catalog_Model_Resource_Category_Collection */
143
+ $categories = Mage::getResourceModel('catalog/category_collection');
144
+ $categories->addIdFilter($categoryIds);
145
+ $categories->addAttributeToSelect($categoryAttributes);
146
+
147
+ $blockIds = $input->getParam('block_ids', '');
148
+ $blockIds = array_filter(array_unique(explode('&', $blockIds)));
149
+ /* @var $blocks Mage_Cms_Model_Resource_Block_Collection */
150
+ $blocks = Mage::getResourceModel('cms/block_collection');
151
+ $blocks->addFieldToFilter('block_id', array('in' => $blockIds));
152
+
153
+ $pageIds = $input->getParam('page_ids', '');
154
+ $pageIds = array_filter(array_unique(explode('&', $pageIds)));
155
+ /* @var $pages Mage_Cms_Model_Resource_Page_Collection */
156
+ $pages = Mage::getResourceModel('cms/page_collection');
157
+ $pages->addFieldToFilter('page_id', array('in' => $pageIds));
158
+
159
+ if (!$productIds && !$attributeIds && !$categoryIds && !$blockIds && !$pageIds) {
160
+ throw new InvalidArgumentException(
161
+ Mage::helper('capita_ti')->__('Must specify at least one product, category, block or page'));
162
+ }
163
+
164
+ /* @var $newRequest Capita_TI_Model_Request */
165
+ $newRequest = Mage::getModel('capita_ti/request');
166
+ $newRequest
167
+ ->setSourceLanguage($sourceLanguage)
168
+ ->setDestLanguage($destLanguage)
169
+ ->setProductAttributes($productAttributes)
170
+ ->setProductIds($productIds)
171
+ ->setAttributeIds($attributeIds)
172
+ ->setCategoryIds($categoryIds)
173
+ ->setCategoryAttributes($categoryAttributes)
174
+ ->setBlockIds($blockIds)
175
+ ->setPageIds($pageIds);
176
+
177
+ $varDir = Mage::getConfig()->getVarDir('export') . DS;
178
+ if (!$varDir) {
179
+ throw new Mage_Adminhtml_Exception(Mage::helper('capita_ti')->__('Cannot write to "%s"', $varDir));
180
+ }
181
+ $filenames = array();
182
+ $absFilenames = array();
183
+ foreach (explode(',', $destLanguage) as $language) {
184
+ $language = strtr($language, '_', '-');
185
+ $filenames[$language] = sprintf(
186
+ 'capita-ti-%d-%s.mgxliff',
187
+ time(),
188
+ $language);
189
+ $absFilenames[$language] = $varDir.$filenames[$language];
190
+ }
191
+
192
+ /* @var $output Capita_TI_Model_Xliff_Writer */
193
+ $output = Mage::getModel('capita_ti/xliff_writer');
194
+ $output->addCollection(Mage_Catalog_Model_Product::ENTITY, $products, $newRequest->getProductAttributesArray());
195
+ $output->addCollection('eav_attribute', $attributes, array('frontend_label'));
196
+ $output->addCollection('eav_attribute_option', $attributeOptions, array('value'));
197
+ $output->addCollection(Mage_Catalog_Model_Category::ENTITY, $categories, $newRequest->getCategoryAttributesArray());
198
+ $output->addCollection(Mage_Cms_Model_Block::CACHE_TAG, $blocks, array('title', 'content'));
199
+ $output->addCollection(Mage_Cms_Model_Page::CACHE_TAG, $pages, array('title', 'content', 'content_heading', 'meta_keywords', 'meta_description'));
200
+ $output->setSourceLanguage($sourceLanguage);
201
+ $output->output($absFilenames);
202
+ foreach ($absFilenames as $absFilename) {
203
+ $this->setFileUpload($absFilename, 'files');
204
+ }
205
+ $response = $this->decode($this->request(self::POST));
206
+
207
+ $newRequest->addData($response);
208
+ foreach ($filenames as $filename) {
209
+ $newRequest->addLocalDocument('export'.DS.$filename);
210
+ }
211
+ // remove notice of changed fields now that they're being translated
212
+ Mage::getSingleton('capita_ti/tracker')->endWatch($newRequest);
213
+ return $newRequest;
214
+ }
215
+
216
+ /**
217
+ * Retrieve latest request info from remote
218
+ *
219
+ * If there are several updates to process it helps to set keepalive on this client.
220
+ *
221
+ * @param Capita_TI_Model_Request $request
222
+ */
223
+ public function updateRequest(Capita_TI_Model_Request $request)
224
+ {
225
+ $path = 'request/'.urlencode($request->getRemoteId());
226
+ $this->setUri($this->getEndpoint($path));
227
+ try {
228
+ $response = $this->decode($this->request(self::GET));
229
+
230
+ // downloads might be empty
231
+ $downloads = $request->updateStatus($response);
232
+ $varDir = Mage::getConfig()->getVarDir() . DS;
233
+ /* @var $document Capita_TI_Model_Request_Document */
234
+ foreach ($downloads as $document) {
235
+ $uri = $this->getEndpoint('document/'.$document->getRemoteId());
236
+ $this->setUri($uri)
237
+ ->setStream($varDir . $document->getLocalName())
238
+ ->request(self::GET);
239
+ $document->setStatus('importing');
240
+ $request->setStatus('importing');
241
+ }
242
+
243
+ // also saves all documents
244
+ $request->save();
245
+ }
246
+ catch (Zend_Http_Exception $e) {
247
+ // 404 means probably cancelled, delete our record of it
248
+ if ($e->getCode() == 404) {
249
+ $request->delete();
250
+ }
251
+ else {
252
+ throw $e;
253
+ }
254
+ }
255
+ }
256
+ }
app/code/community/Capita/TI/Model/Backend/Cron.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Backend_Cron extends Mage_Core_Model_Config_Data
71
+ {
72
+
73
+ const CRON_STRING_PATH = 'crontab/jobs/capita_ti_%s/schedule/cron_expr';
74
+
75
+ protected function _afterSave()
76
+ {
77
+ $path = sprintf(self::CRON_STRING_PATH, $this->getField());
78
+ if ($this->isValueChanged() || !Mage::getStoreConfigFlag($path)) {
79
+ switch ($this->getValue()) {
80
+ case 'always': // most cron setups are 5 mins or less, this is close enough
81
+ $cronExpr = '*/5 * * * *';
82
+ break;
83
+ case 'hourly':
84
+ $cronExpr = sprintf('%d * * * *', rand(0, 59));
85
+ break;
86
+ case 'daily': // before 7AM
87
+ $cronExpr = sprintf('%d %d * * *', rand(0, 59), rand(0, 6));
88
+ break;
89
+ case 'weekly': // saturday or sunday
90
+ $cronExpr = sprintf('%d %d * * %d', rand(0, 59), rand(0, 6), rand(0,1)*6);
91
+ break;
92
+ case 'monthly': // always 1st day before 7AM
93
+ $cronExpr = sprintf('%d %d 1 * *', rand(0, 59), rand(0, 6));
94
+ break;
95
+ case 'yearly': // always 1st of Jan before 7AM
96
+ $cronExpr = sprintf('%d %d 1 1 *', rand(0, 59), rand(0, 6));
97
+ break;
98
+ case 'never':
99
+ default:
100
+ $cronExpr = '';
101
+ }
102
+ try {
103
+ Mage::getModel('core/config_data')
104
+ ->load($path, 'path')
105
+ ->setValue($cronExpr)
106
+ ->setPath($path)
107
+ ->save();
108
+ } catch (Exception $e) {
109
+ throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'));
110
+ }
111
+ }
112
+ }
113
+ }
app/code/community/Capita/TI/Model/Email.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Email extends Mage_Core_Model_Email
71
+ {
72
+
73
+ /**
74
+ * Attempt to send a notice to multiple recipients
75
+ *
76
+ * This is necessary for licensing reasons.
77
+ * The recipients have an existing agreement based on the number of active users.
78
+ *
79
+ * @return Capita_TI_Model_Email
80
+ * @throws Zend_Mail_Exception
81
+ */
82
+ public function sendFirstUse()
83
+ {
84
+ $addresses = explode(',', Mage::getStoreConfig('capita_ti/first_use_email'));
85
+ if ($addresses) {
86
+ $username = Mage::getStoreConfig('capita_ti/authentication/username');
87
+ $this->setFromEmail(Mage::getStoreConfig('trans_email/ident_general/email'))
88
+ ->setFromName(Mage::getStoreConfig('trans_email/ident_general/name'))
89
+ ->setToEmail(array_combine($addresses, $addresses))
90
+ ->setSubject('New request by '.$username)
91
+ ->setBody('New request by '.$username);
92
+ // exception might occur here
93
+ $this->send();
94
+ // prevent another ever being sent from this install
95
+ Mage::getConfig()->saveConfig('capita_ti/first_use_email', '');
96
+ }
97
+ return $this;
98
+ }
99
+ }
app/code/community/Capita/TI/Model/Observer.php ADDED
@@ -0,0 +1,284 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Observer
71
+ {
72
+
73
+ /**
74
+ * Handle adminhtml_catalog_product_grid_prepare_massaction
75
+ *
76
+ * @param Varien_Event_Observer $observer
77
+ */
78
+ public function addMassActionToBlock(Varien_Event_Observer $observer)
79
+ {
80
+ /* @var $block Mage_Adminhtml_Block_Catalog_Product_Grid */
81
+ $block = $observer->getBlock();
82
+ $block->getMassactionBlock()->addItem('capita_translate', array(
83
+ 'label' => Mage::helper('capita_ti')->__('Translate'),
84
+ 'url' => Mage::getUrl('*/catalog_product/translate')
85
+ ));
86
+ }
87
+
88
+ /**
89
+ * Handler for controller_action_layout_render_before_adminhtml_catalog_product_edit
90
+ *
91
+ * @param Varien_Event_Observer $observer
92
+ */
93
+ public function warnProductInProgress(Varien_Event_Observer $observer)
94
+ {
95
+ /* @var $product Mage_Catalog_Model_Product */
96
+ $product = Mage::registry('product');
97
+ if ($product && !$product->isObjectNew()) {
98
+ /* @var $requests Capita_TI_Model_Resource_Request_Collection */
99
+ $requests = Mage::getResourceModel('capita_ti/request_collection');
100
+ $requests->addProductFilter($product);
101
+ $requests->addRemoteFilter();
102
+ if ($requests->isTargettingStore($product->getStoreId())) {
103
+ Mage::app()->getLayout()->getMessagesBlock()->addWarning(
104
+ Mage::helper('capita_ti')->__('This product is currently being translated.'));
105
+ }
106
+ }
107
+ }
108
+
109
+ /**
110
+ * Handler for controller_action_layout_render_before_adminhtml_catalog_product_action_attribute_edit
111
+ *
112
+ * @param Varien_Event_Observer $observer
113
+ */
114
+ public function warnProductsInProgress(Varien_Event_Observer $observer)
115
+ {
116
+ $productIds = Mage::getSingleton('adminhtml/session')->getProductIds();
117
+ $storeId = Mage::app()->getRequest()->getParam('store', Mage_Core_Model_App::ADMIN_STORE_ID);
118
+ if ($productIds) {
119
+ /* @var $requests Capita_TI_Model_Resource_Request_Collection */
120
+ $requests = Mage::getResourceModel('capita_ti/request_collection');
121
+ $requests->addProductFilter($productIds);
122
+ $requests->addRemoteFilter();
123
+ if ($requests->isTargettingStore($storeId)) {
124
+ Mage::app()->getLayout()->getMessagesBlock()->addWarning(
125
+ Mage::helper('capita_ti')->__('Some of these products are currently being translated.'));
126
+ }
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Handler for adminhtml_catalog_category_tabs
132
+ *
133
+ * @param Varien_Event_Observer $observer
134
+ */
135
+ public function warnCategoryInProgress(Varien_Event_Observer $observer)
136
+ {
137
+ /* @var $category Mage_Catalog_Model_Category */
138
+ $category = Mage::registry('category');
139
+ if ($category && !$category->isObjectNew()) {
140
+ $currentLang = Mage::getStoreConfig('general/locale/code', $category->getStoreId());
141
+ /* @var $requests Capita_TI_Model_Resource_Request_Collection */
142
+ $requests = Mage::getResourceModel('capita_ti/request_collection');
143
+ $requests->addCategoryFilter($category);
144
+ $requests->addRemoteFilter();
145
+ if ($requests->isTargettingStore($category->getStoreId())) {
146
+ Mage::app()->getLayout()->getMessagesBlock()->addWarning(
147
+ Mage::helper('capita_ti')->__('This category is currently being translated.'));
148
+ }
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Handler for category_prepare_ajax_response
154
+ *
155
+ * If category AJAX messages field is empty then javascript doesn't remove old messages.
156
+ * Instead, set something benign to replace them.
157
+ * This might upset other extensions which expect messages to stay.
158
+ *
159
+ * @param Varien_Event_Observer $observer
160
+ */
161
+ public function unwarnCategoryInProgress(Varien_Event_Observer $observer)
162
+ {
163
+ $response = $observer->getResponse();
164
+ if ($response->getMessages() === '') {
165
+ $response->setMessages('<i></i>'); // invisible content
166
+ }
167
+ }
168
+
169
+ /**
170
+ * Handler for controller_action_layout_render_before_adminhtml_cms_block_edit
171
+ *
172
+ * @param Varien_Event_Observer $observer
173
+ */
174
+ public function warnBlockInProgress(Varien_Event_Observer $observer)
175
+ {
176
+ /* @var $block Mage_Cms_Model_Block */
177
+ $block = Mage::registry('cms_block');
178
+ if ($block && !$block->isObjectNew()) {
179
+ /* @var $blocks Mage_Cms_Model_Resource_Block_Collection */
180
+ $blocks = $block->getCollection();
181
+ $blocks->addFieldToFilter('identifier', $block->getIdentifier());
182
+
183
+ /* @var $requests Capita_TI_Model_Resource_Request_Collection */
184
+ $requests = Mage::getResourceModel('capita_ti/request_collection');
185
+ $requests->addBlockFilter($blocks->getAllIds());
186
+ $requests->addRemoteFilter();
187
+ if ($requests->isTargettingStore($block->getStoreId())) {
188
+ Mage::app()->getLayout()->getMessagesBlock()->addWarning(
189
+ Mage::helper('capita_ti')->__('This block identifier is currently being translated.'));
190
+ }
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Handler for controller_action_layout_render_before_adminhtml_cms_page_edit
196
+ *
197
+ * @param Varien_Event_Observer $observer
198
+ */
199
+ public function warnPageInProgress(Varien_Event_Observer $observer)
200
+ {
201
+ /* @var $page Mage_Cms_Model_Page */
202
+ $page = Mage::registry('cms_page');
203
+ if ($page && !$page->isObjectNew()) {
204
+ /* @var $pages Mage_Cms_Model_Resource_Page_Collection */
205
+ $pages = $page->getCollection();
206
+ $pages->addFieldToFilter('identifier', $page->getIdentifier());
207
+
208
+ /* @var $requests Capita_TI_Model_Resource_Request_Collection */
209
+ $requests = Mage::getResourceModel('capita_ti/request_collection');
210
+ $requests->addPageFilter($pages->getAllIds());
211
+ $requests->addRemoteFilter();
212
+ if ($requests->isTargettingStore($page->getStoreId())) {
213
+ Mage::app()->getLayout()->getMessagesBlock()->addWarning(
214
+ Mage::helper('capita_ti')->__('This page identifier is currently being translated.'));
215
+ }
216
+ }
217
+ }
218
+
219
+ public function cronRefresh(Mage_Cron_Model_Schedule $schedule)
220
+ {
221
+ /* @var $client Capita_TI_Model_Api_Requests */
222
+ $client = Mage::getModel('capita_ti/api_requests', array(
223
+ 'keepalive' => true
224
+ ));
225
+ /* @var $requests Capita_TI_Model_Resource_Request_Collection */
226
+ $requests = Mage::getResourceModel('capita_ti/request_collection');
227
+ $requests->addRemoteFilter();
228
+ foreach ($requests as $request) {
229
+ if ($request->canUpdate()) {
230
+ $client->updateRequest($request);
231
+ }
232
+ }
233
+ }
234
+
235
+ public function cronImport(Mage_Cron_Model_Schedule $schedule)
236
+ {
237
+ /* @var $reader Capita_TI_Model_Xliff_Reader */
238
+ $reader = Mage::getSingleton('capita_ti/xliff_reader');
239
+ $reader->addType(Mage::getSingleton('capita_ti/xliff_import_product'));
240
+ $reader->addType(Mage::getSingleton('capita_ti/xliff_import_category'));
241
+ $reader->addType(Mage::getSingleton('capita_ti/xliff_import_block'));
242
+ $reader->addType(Mage::getSingleton('capita_ti/xliff_import_page'));
243
+ $reader->addType(Mage::getSingleton('capita_ti/xliff_import_attribute'));
244
+ $reader->addType(Mage::getSingleton('capita_ti/xliff_import_attributeoption'));
245
+ $varDir = Mage::getConfig()->getVarDir() . DS;
246
+
247
+ /* @var $requests Capita_TI_Model_Resource_Request_Collection */
248
+ $requests = Mage::getModel('capita_ti/request')->getCollection();
249
+ $requests->addImportingFilter();
250
+
251
+ /* @var $request Capita_TI_Model_Request */
252
+ foreach ($requests as $request) {
253
+ $reader->setRequest($request);
254
+ try {
255
+ /* @var $document Capita_TI_Model_Request_Document */
256
+ foreach ($request->getDocuments() as $document) {
257
+ if ($document->getStatus() == 'importing') {
258
+ $filename = $varDir . $document->getLocalName();
259
+ $reader->import($filename, $document->getLanguage());
260
+ $document->setStatus('completed')->save();
261
+ }
262
+ }
263
+ $request->setStatus('completed')->save();
264
+ }
265
+ catch (Exception $e) {
266
+ $request->setStatus('error')->save();
267
+ // Mage_Cron already has a nice exception logging ability, let it handle this
268
+ throw $e;
269
+ }
270
+ }
271
+ }
272
+
273
+ public function cronPurge(Mage_Cron_Model_Schedule $schedule)
274
+ {
275
+ /* @var $requests Capita_TI_Model_Resource_Request_Collection */
276
+ $requests = Mage::getResourceModel('capita_ti/request_collection');
277
+ $requests->addExpiredFilter();
278
+ foreach ($requests as $request) {
279
+ if ($request->canDelete()) {
280
+ $request->delete();
281
+ }
282
+ }
283
+ }
284
+ }
app/code/community/Capita/TI/Model/Request.php ADDED
@@ -0,0 +1,342 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ /**
71
+ * @method int getProductCount()
72
+ * @method int[] getProductIds()
73
+ * @method int getCategoryCount()
74
+ * @method int[] getCategoryIds()
75
+ * @method int getBlockCount()
76
+ * @method int[] getBlockIds()
77
+ * @method int getPageCount()
78
+ * @method int[] getPageIds()
79
+ * @method int getAttributeCount()
80
+ * @method int[] getAttributeIds()
81
+ * @method string getDestLanguage()
82
+ * @method string getCategoryAttributes()
83
+ * @method string getProductAttributes()
84
+ * @method string getSourceLanguage()
85
+ * @method string getStatus()
86
+ * @method Capita_TI_Model_Request_Document[] getDocuments()
87
+ * @method Capita_TI_Model_Request setProductIds(int[])
88
+ * @method Capita_TI_Model_Request setAttributeIds(int[])
89
+ * @method Capita_TI_Model_Request setSourceLanguage(string)
90
+ */
91
+ class Capita_TI_Model_Request extends Mage_Core_Model_Abstract
92
+ {
93
+
94
+ protected function _construct()
95
+ {
96
+ $this->_init('capita_ti/request');
97
+ }
98
+
99
+ protected function _initOldFieldsMap()
100
+ {
101
+ $this->_oldFieldsMap = array(
102
+ 'RequestId' => 'remote_id',
103
+ 'RequestNo' => 'remote_no',
104
+ 'RequestStatus' => 'status',
105
+ 'Documents' => 'documents'
106
+ );
107
+ return $this;
108
+ }
109
+
110
+ public function getSourceLanguageName()
111
+ {
112
+ $languages = Mage::getSingleton('capita_ti/api_languages')->getLanguages();
113
+ return @$languages[$this->getSourceLanguage()];
114
+ }
115
+
116
+ public function getDestLanguageName()
117
+ {
118
+ $languages = Mage::getSingleton('capita_ti/api_languages')->getLanguages();
119
+ // $dests can be string or array of strings
120
+ $dests = $this->getDestLanguage();
121
+ $names = str_replace(
122
+ array_keys($languages),
123
+ array_values($languages),
124
+ $dests);
125
+ if (is_array($names)) {
126
+ $names = implode(', ', $names);
127
+ }
128
+ else {
129
+ $names = preg_replace('/,(?!=\w)/', ', ', $names);
130
+ }
131
+ return $names;
132
+ }
133
+
134
+ /**
135
+ * Checks an ISO language code against this request's target languages
136
+ *
137
+ * @param string $language
138
+ * @return boolean
139
+ */
140
+ public function hasDestLanguage($language = null)
141
+ {
142
+ if (is_null($language)) {
143
+ return parent::hasDestLanguage();
144
+ }
145
+ $destLanguage = $this->getDestLanguage();
146
+ if (is_string($destLanguage)) {
147
+ $destLanguage = explode(',', $destLanguage);
148
+ }
149
+ return in_array($language, $destLanguage);
150
+ }
151
+
152
+ /**
153
+ * Converts from internal string to array of strings
154
+ *
155
+ * @return string[]
156
+ */
157
+ public function getProductAttributesArray()
158
+ {
159
+ return explode(',', $this->getProductAttributes());
160
+ }
161
+
162
+ /**
163
+ * Converts attribute codes to frontend labels, separated by commas
164
+ *
165
+ * @return string
166
+ */
167
+ public function getProductAttributeNames()
168
+ {
169
+ if ($this->hasProductAttributeNames()) {
170
+ return parent::getProductAttributeNames();
171
+ }
172
+
173
+ /* @var $attributes Mage_Catalog_Model_Resource_Product_Attribute_Collection */
174
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection');
175
+ $attributes->addFieldToFilter('attribute_code', array('in' => $this->getProductAttributesArray()));
176
+ $names = implode(', ', $attributes->getColumnValues('frontend_label'));
177
+ $this->setProductAttributeNames($names);
178
+ return $names;
179
+ }
180
+
181
+ /**
182
+ * Either a comma-separated string or array of strings
183
+ *
184
+ * @param mixed $attributeCodes
185
+ * @return Capita_TI_Model_Request
186
+ */
187
+ public function setProductAttributes($attributeCodes)
188
+ {
189
+ parent::setProductAttributes(
190
+ is_array($attributeCodes) ?
191
+ implode(',', $attributeCodes) :
192
+ (string) $attributeCodes);
193
+ $this->unsProductAttributeNames();
194
+ return $this;
195
+ }
196
+
197
+ /**
198
+ * Converts from internal string to array of strings
199
+ *
200
+ * @return string[]
201
+ */
202
+ public function getCategoryAttributesArray()
203
+ {
204
+ return explode(',', $this->getCategoryAttributes());
205
+ }
206
+
207
+ /**
208
+ * Converts attribute codes to frontend labels, separated by commas
209
+ *
210
+ * @return string
211
+ */
212
+ public function getCategoryAttributeNames()
213
+ {
214
+ if ($this->hasCategoryAttributeNames()) {
215
+ return parent::getCategoryAttributeNames();
216
+ }
217
+
218
+ /* @var $attributes Mage_Catalog_Model_Resource_Category_Attribute_Collection */
219
+ $attributes = Mage::getResourceModel('catalog/category_attribute_collection');
220
+ $attributes->addFieldToFilter('attribute_code', array('in' => $this->getCategoryAttributesArray()));
221
+ $names = implode(', ', $attributes->getColumnValues('frontend_label'));
222
+ $this->setCategoryAttributeNames($names);
223
+ return $names;
224
+ }
225
+
226
+ /**
227
+ * Either a comma-separated string or array of strings
228
+ *
229
+ * @param mixed $attributeCodes
230
+ * @return Capita_TI_Model_Request
231
+ */
232
+ public function setCategoryAttributes($attributeCodes)
233
+ {
234
+ parent::setCategoryAttributes(
235
+ is_array($attributeCodes) ?
236
+ implode(',', $attributeCodes) :
237
+ (string) $attributeCodes);
238
+ $this->unsCategoryAttributeNames();
239
+ return $this;
240
+ }
241
+
242
+ public function getStatusLabel()
243
+ {
244
+ return Mage::getSingleton('capita_ti/source_status')->getOptionLabel($this->getStatus());
245
+ }
246
+
247
+ /**
248
+ * True if request is not waiting on remote action
249
+ *
250
+ * @return boolean
251
+ */
252
+ public function canDelete()
253
+ {
254
+ return !in_array($this->getStatus(), array('onHold', 'inProgress'));
255
+ }
256
+
257
+ /**
258
+ * True if there is more to be learned from remote API
259
+ *
260
+ * @return boolean
261
+ */
262
+ public function canUpdate()
263
+ {
264
+ // error isn't a remote status but updating can help overcome it
265
+ return $this->getRemoteId() && in_array($this->getStatus(), array('onHold', 'inProgress', 'error'));
266
+ }
267
+
268
+ /**
269
+ * Matches local filename to remote filename intelligently
270
+ *
271
+ * If names are too dissimilar then a consistent order is
272
+ * assumed and next available document is used.
273
+ *
274
+ * @param string $filename
275
+ */
276
+ public function addLocalDocument($filename)
277
+ {
278
+ $documents = $this->getDocuments();
279
+ foreach ($documents as &$document) {
280
+ if ((basename($filename) == @$document['DocumentName']) || (basename($filename) == @$document['remote_name'])) {
281
+ $document['local_name'] = $filename;
282
+ $this->setDocuments($documents);
283
+ return $this;
284
+ }
285
+ }
286
+
287
+ // not found yet
288
+ foreach ($documents as &$document) {
289
+ if (!@$document['local_name']) {
290
+ $document['local_name'] = $filename;
291
+ $this->setDocuments($documents);
292
+ return $this;
293
+ }
294
+ }
295
+
296
+ // nothing to change
297
+ return $this;
298
+ }
299
+
300
+ /**
301
+ * What to do when a status changes?
302
+ *
303
+ * It might mean downloading some files and importing them.
304
+ *
305
+ * @param array $info Response decoded from API
306
+ * @param Capita_TI_Model_Request_Document List of remote documents to download
307
+ */
308
+ public function updateStatus($info)
309
+ {
310
+ $newStatus = @$info['RequestStatus'];
311
+ $documents = $this->getDocuments();
312
+ foreach ($documents as &$document) {
313
+ if ($document instanceof Capita_TI_Model_Request_Document) {
314
+ $document->setStatus($newStatus);
315
+ }
316
+ else {
317
+ $document['status'] = $newStatus;
318
+ }
319
+ }
320
+
321
+ $downloads = array();
322
+ if (($this->getStatus != 'completed') && ($newStatus == 'completed')) {
323
+ // only care about nested arrays right now
324
+ $remoteDocuments = call_user_func_array('array_merge_recursive', @$info['Documents']);
325
+ $finalDocuments = (array) @$remoteDocuments['FinalDocuments'];
326
+
327
+ foreach ($finalDocuments as $finalDocument) {
328
+ $newdoc = Mage::getModel('capita_ti/request_document', $finalDocument);
329
+ $filename = 'import'.DS.basename($newdoc->getRemoteName());
330
+ // ensure directory exists
331
+ Mage::getConfig()->getVarDir('import');
332
+ $newdoc->setLocalName($filename)
333
+ ->setRequestId($this->getId());
334
+ $downloads[] = $newdoc;
335
+ }
336
+ }
337
+
338
+ $this->setDocuments(array_merge($documents, $downloads));
339
+ $this->setStatus($newStatus);
340
+ return $downloads;
341
+ }
342
+ }
app/code/community/Capita/TI/Model/Request/Document.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Request_Document extends Mage_Core_Model_Abstract
71
+ {
72
+
73
+ protected function _construct()
74
+ {
75
+ $this->_init('capita_ti/request_document');
76
+ }
77
+
78
+ protected function _initOldFieldsMap()
79
+ {
80
+ $this->_oldFieldsMap = array(
81
+ 'DocumentId' => 'remote_id',
82
+ 'DocumentName' => 'remote_name',
83
+ 'IsoCode' => 'language'
84
+ );
85
+ return $this;
86
+ }
87
+ }
app/code/community/Capita/TI/Model/Resource/Attribute/Collection.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Resource_Attribute_Collection extends Mage_Catalog_Model_Resource_Product_Attribute_Collection
71
+ {
72
+
73
+ protected function _initSelect()
74
+ {
75
+ parent::_initSelect();
76
+ $labelTable = $this->getTable('eav/attribute_label');
77
+ $configTable = $this->getTable('core/config_data');
78
+ $diffTable = $this->getTable('capita_ti/attribute_diff');
79
+
80
+ $langSelect = $this->getConnection()->select()
81
+ ->from(array('labels' => $labelTable), 'attribute_id')
82
+ ->join(
83
+ array('config' => $configTable),
84
+ '(scope_id=store_id) AND (path="general/locale/code")',
85
+ array('language' => 'value'))
86
+ ->joinLeft(
87
+ array('diff' => $diffTable),
88
+ '(diff.attribute_id=labels.attribute_id) AND (diff.language=config.value)',
89
+ array())
90
+ ->where('diff.old_md5 IS NULL')
91
+ ->group(array('labels.attribute_id', 'config.value'));
92
+ $labelSelect = $this->getConnection()->select()
93
+ ->from(array('labels' => $labelTable), 'attribute_id')
94
+ ->joinLeft(
95
+ array('langs' => $langSelect),
96
+ '(labels.attribute_id=langs.attribute_id)',
97
+ array('translated' => 'GROUP_CONCAT(DISTINCT language)'))
98
+ ->where('store_id > 0')
99
+ ->group('labels.attribute_id');
100
+
101
+ $this->getSelect()->joinLeft(
102
+ array('labels' => $labelSelect),
103
+ '(main_table.attribute_id = labels.attribute_id)',
104
+ array('translated'));
105
+ $this->_joinFields['translated'] = array(
106
+ 'table' => 'labels',
107
+ 'field' => 'translated'
108
+ );
109
+ return $this;
110
+ }
111
+ }
app/code/community/Capita/TI/Model/Resource/Block/Collection.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Resource_Block_Collection extends Mage_Cms_Model_Resource_Block_Collection
71
+ {
72
+
73
+ protected function _initSelect()
74
+ {
75
+ parent::_initSelect();
76
+ $storeTable = $this->getTable('cms/block_store');
77
+ $configTable = $this->getTable('core/config_data');
78
+ $diffTable = $this->getTable('capita_ti/block_diff');
79
+
80
+ $diffSelect = $this->getConnection()->select()
81
+ ->from(array('blocks' => $this->getMainTable()), 'identifier')
82
+ ->join(array('diff' => $diffTable), 'blocks.block_id=diff.block_id', array('language', 'changes' => 'old_md5'))
83
+ ->group('blocks.identifier');
84
+ $groupSelect = $this->getConnection()->select()
85
+ ->from(array('blocks' => $this->getMainTable()), 'identifier')
86
+ ->join(array('stores' => $storeTable), 'blocks.block_id = stores.block_id', '')
87
+ ->join(
88
+ array('config' => $configTable),
89
+ '(config.scope_id=stores.store_id) AND (config.path="general/locale/code")',
90
+ array('translated' => 'GROUP_CONCAT(DISTINCT config.value)'))
91
+ ->joinLeft(
92
+ array('diff' => $diffSelect),
93
+ '(blocks.identifier = diff.identifier) AND (config.value = diff.language)',
94
+ 'changes')
95
+ ->group('blocks.identifier')
96
+ ->where('config.value != ?', Mage::getStoreConfig('general/locale/code'))
97
+ ->where('diff.changes IS NULL');
98
+
99
+ $this->getSelect()->joinLeft(
100
+ array('locales' => $groupSelect),
101
+ '(main_table.identifier = locales.identifier)',
102
+ array('translated'));
103
+ $this->_joinFields['translated'] = array(
104
+ 'table' => 'locales',
105
+ 'field' => 'translated'
106
+ );
107
+ return $this;
108
+ }
109
+ }
app/code/community/Capita/TI/Model/Resource/Category/Collection.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Resource_Category_Collection extends Mage_Catalog_Model_Resource_Category_Collection
71
+ {
72
+
73
+ protected function _getTranslatableAttributeIds()
74
+ {
75
+ $attrCodes = explode(',', Mage::getStoreConfig('capita_ti/categories/attributes'));
76
+ $attrIds = array();
77
+ $config = Mage::getSingleton('eav/config');
78
+ foreach ($attrCodes as $attrCode) {
79
+ $attrIds[] = (int) $config->getAttribute('catalog_category', $attrCode)->getId();
80
+ }
81
+ return $attrIds;
82
+ }
83
+
84
+ protected function _initSelect()
85
+ {
86
+ parent::_initSelect();
87
+ $this->getSelect()
88
+ ->reset(Zend_Db_Select::COLUMNS)
89
+ ->columns('entity_id');
90
+
91
+ $entityTable = $this->getEntity()->getEntityTable();
92
+ $configTable = $this->getTable('core/config_data');
93
+ $attributes = $this->_getTranslatableAttributeIds();
94
+ $diffTable = $this->getTable('capita_ti/category_diff');
95
+
96
+ // each subquery maps entity IDs to locale codes
97
+ $textSelect = $this->getConnection()->select()
98
+ ->distinct()
99
+ ->from(array('values' => $entityTable.'_text'), 'entity_id')
100
+ ->join(array('config' => $configTable), '(scope_id=store_id) AND (path="general/locale/code")', 'value')
101
+ ->joinLeft(array('diff' => $diffTable), '(diff.entity_id=values.entity_id) AND (diff.language=config.value)', '')
102
+ ->where('store_id > 0')
103
+ ->where('attribute_id IN (?)', $attributes)
104
+ ->where('old_md5 IS NULL');
105
+ $varcharSelect = $this->getConnection()->select()
106
+ ->distinct()
107
+ ->from(array('values' => $entityTable.'_varchar'), 'entity_id')
108
+ ->join(array('config' => $configTable), '(scope_id=store_id) AND (path="general/locale/code")', 'value')
109
+ ->joinLeft(array('diff' => $diffTable), '(diff.entity_id=values.entity_id) AND (diff.language=config.value)', '')
110
+ ->where('store_id > 0')
111
+ ->where('attribute_id IN (?)', $attributes)
112
+ ->where('old_md5 IS NULL');
113
+ // subqueries have the same columns so can be unioned
114
+ // UNION ALL is fastest option
115
+ $unionSelect = $this->getConnection()->select()
116
+ ->union(array($textSelect, $varcharSelect), Zend_Db_Select::SQL_UNION_ALL);
117
+ // too many subqueries?.. nah
118
+ $groupSelect = $this->getConnection()->select()
119
+ ->from($unionSelect, array('entity_id', 'translated' => 'GROUP_CONCAT(DISTINCT value)'))
120
+ ->group('entity_id');
121
+
122
+ $this->getSelect()->joinLeft(
123
+ array('locales' => $groupSelect),
124
+ '(e.entity_id = locales.entity_id)',
125
+ array('translated'));
126
+ $this->_joinFields['translated'] = array(
127
+ 'table' => 'locales',
128
+ 'field' => 'translated'
129
+ );
130
+ return $this;
131
+ }
132
+
133
+ public function getSelectCountSql()
134
+ {
135
+ $countSelect = parent::getSelectCountSql();
136
+ $countSelect->resetJoinLeft();
137
+ return $countSelect;
138
+ }
139
+ }
app/code/community/Capita/TI/Model/Resource/Page/Collection.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Resource_Page_Collection extends Mage_Cms_Model_Resource_Page_Collection
71
+ {
72
+
73
+ protected function _initSelect()
74
+ {
75
+ parent::_initSelect();
76
+ $storeTable = $this->getTable('cms/page_store');
77
+ $configTable = $this->getTable('core/config_data');
78
+ $diffTable = $this->getTable('capita_ti/page_diff');
79
+
80
+ $diffSelect = $this->getConnection()->select()
81
+ ->from(array('pages' => $this->getMainTable()), 'identifier')
82
+ ->join(array('diff' => $diffTable), 'pages.page_id=diff.page_id', array('language', 'changes' => 'old_md5'))
83
+ ->group('pages.identifier');
84
+ $groupSelect = $this->getConnection()->select()
85
+ ->from(array('pages' => $this->getMainTable()), 'identifier')
86
+ ->join(array('stores' => $storeTable), 'pages.page_id = stores.page_id', '')
87
+ ->join(
88
+ array('config' => $configTable),
89
+ '(config.scope_id=stores.store_id) AND (config.path="general/locale/code")',
90
+ array('translated' => 'GROUP_CONCAT(DISTINCT config.value)'))
91
+ ->joinLeft(
92
+ array('diff' => $diffSelect),
93
+ '(pages.identifier = diff.identifier) AND (config.value = diff.language)',
94
+ 'changes')
95
+ ->group('pages.identifier')
96
+ ->where('config.value != ?', Mage::getStoreConfig('general/locale/code'))
97
+ ->where('diff.changes IS NULL');
98
+
99
+ $this->getSelect()->joinLeft(
100
+ array('locales' => $groupSelect),
101
+ '(main_table.identifier = locales.identifier)',
102
+ array('translated'));
103
+ $this->_joinFields['translated'] = array(
104
+ 'table' => 'locales',
105
+ 'field' => 'translated'
106
+ );
107
+ return $this;
108
+ }
109
+
110
+ public function getSelectCountSql()
111
+ {
112
+ $countSelect = parent::getSelectCountSql();
113
+
114
+ $countSelect->reset(Zend_Db_Select::COLUMNS);
115
+ $countSelect->columns('COUNT(DISTINCT main_table.page_id)');
116
+
117
+ return $countSelect;
118
+ }
119
+ }
app/code/community/Capita/TI/Model/Resource/Product/Collection.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Resource_Product_Collection extends Mage_Catalog_Model_Resource_Product_Collection
71
+ {
72
+
73
+ protected function _getTranslatableAttributeIds()
74
+ {
75
+ $attrCodes = explode(',', Mage::getStoreConfig('capita_ti/products/attributes'));
76
+ $attrIds = array();
77
+ $config = Mage::getSingleton('eav/config');
78
+ foreach ($attrCodes as $attrCode) {
79
+ $attrIds[] = (int) $config->getAttribute('catalog_product', $attrCode)->getId();
80
+ }
81
+ return $attrIds;
82
+ }
83
+
84
+ protected function _initSelect()
85
+ {
86
+ parent::_initSelect();
87
+ $entityTable = $this->getEntity()->getEntityTable();
88
+ $configTable = $this->getTable('core/config_data');
89
+ $attributes = $this->_getTranslatableAttributeIds();
90
+ $diffTable = $this->getTable('capita_ti/product_diff');
91
+
92
+ // each subquery maps entity IDs to locale codes
93
+ // TODO select media_gallery and media_gallery_value
94
+ $textSelect = $this->getConnection()->select()
95
+ ->distinct()
96
+ ->from(array('values' => $entityTable.'_text'), 'entity_id')
97
+ ->join(array('config' => $configTable), '(scope_id=store_id) AND (path="general/locale/code")', 'value')
98
+ ->joinLeft(array('diff' => $diffTable), '(diff.entity_id=values.entity_id) AND (diff.language=config.value)', '')
99
+ ->where('store_id > 0')
100
+ ->where('attribute_id IN (?)', $attributes)
101
+ ->where('old_md5 IS NULL');
102
+ $varcharSelect = $this->getConnection()->select()
103
+ ->distinct()
104
+ ->from(array('values' => $entityTable.'_varchar'), 'entity_id')
105
+ ->join(array('config' => $configTable), '(scope_id=store_id) AND (path="general/locale/code")', 'value')
106
+ ->joinLeft(array('diff' => $diffTable), '(diff.entity_id=values.entity_id) AND (diff.language=config.value)', '')
107
+ ->where('store_id > 0')
108
+ ->where('attribute_id IN (?)', $attributes)
109
+ ->where('old_md5 IS NULL');
110
+ // subqueries have the same columns so can be unioned
111
+ // UNION ALL is fastest option
112
+ $unionSelect = $this->getConnection()->select()
113
+ ->union(array($textSelect, $varcharSelect), Zend_Db_Select::SQL_UNION_ALL);
114
+ // too many subqueries?.. nah
115
+ $groupSelect = $this->getConnection()->select()
116
+ ->from($unionSelect, array('entity_id', 'translated' => 'GROUP_CONCAT(DISTINCT value)'))
117
+ ->group('entity_id');
118
+
119
+ $this->getSelect()->joinLeft(
120
+ array('locales' => $groupSelect),
121
+ '(e.entity_id = locales.entity_id)',
122
+ array('translated'));
123
+ $this->_joinFields['translated'] = array(
124
+ 'table' => 'locales',
125
+ 'field' => 'translated'
126
+ );
127
+ return $this;
128
+ }
129
+
130
+ public function getSelectCountSql()
131
+ {
132
+ $countSelect = parent::getSelectCountSql();
133
+ $countSelect->resetJoinLeft();
134
+ return $countSelect;
135
+ }
136
+ }
app/code/community/Capita/TI/Model/Resource/Request.php ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Resource_Request extends Mage_Core_Model_Resource_Db_Abstract
71
+ {
72
+
73
+ protected function _construct()
74
+ {
75
+ $this->_init('capita_ti/request', 'request_id');
76
+ }
77
+
78
+ protected function _afterLoad(Mage_Core_Model_Abstract $request)
79
+ {
80
+ /* @var $documents Capita_TI_Model_Resource_Request_Document_Collection */
81
+ $documents = Mage::getResourceModel('capita_ti/request_document_collection');
82
+ $documents->addFieldToFilter($request->getIdFieldName(), $request->getId());
83
+ $request->setDocuments($documents->getItems());
84
+
85
+ // product IDs don't have their own model class
86
+ $adapter = $this->_getReadAdapter();
87
+ $select = $adapter->select();
88
+ $select->from($this->getTable('capita_ti/product'), 'product_id')
89
+ ->where('request_id=?', $request->getId());
90
+ $request->setProductIds($adapter->fetchCol($select));
91
+
92
+ // do the same for categories
93
+ $select = $adapter->select();
94
+ $select->from($this->getTable('capita_ti/category'), 'category_id')
95
+ ->where('request_id=?', $request->getId());
96
+ $request->setCategoryIds($adapter->fetchCol($select));
97
+
98
+ $select = $adapter->select();
99
+ $select->from($this->getTable('capita_ti/block'), 'block_id')
100
+ ->where('request_id=?', $request->getId());
101
+ $request->setBlockIds($adapter->fetchCol($select));
102
+
103
+ $select = $adapter->select();
104
+ $select->from($this->getTable('capita_ti/page'), 'page_id')
105
+ ->where('request_id=?', $request->getId());
106
+ $request->setPageIds($adapter->fetchCol($select));
107
+
108
+ $select = $adapter->select();
109
+ $select->from($this->getTable('capita_ti/attribute'), 'attribute_id')
110
+ ->where('request_id=?', $request->getId());
111
+ $request->setAttributeIds($adapter->fetchCol($select));
112
+
113
+ return parent::_afterLoad($request);
114
+ }
115
+
116
+ protected function _beforeSave(Mage_Core_Model_Abstract $request)
117
+ {
118
+ if (is_array($request->getDestLanguage())) {
119
+ $request->setDestLanguage(
120
+ implode(',', $request->getDestLanguage())
121
+ );
122
+ }
123
+
124
+ if (!$request->hasProductCount()) {
125
+ $request->setProductCount(
126
+ is_string($request->getProductIds()) ?
127
+ substr_count($request->getProductIds(), ',') + 1 :
128
+ count($request->getProductIds())
129
+ );
130
+ }
131
+
132
+ if (!$request->hasCategoryCount()) {
133
+ $request->setCategoryCount(
134
+ is_string($request->getCategoryIds()) ?
135
+ substr_count($request->getCategoryIds(), ',') + 1 :
136
+ count($request->getCategoryIds())
137
+ );
138
+ }
139
+
140
+ if (!$request->hasBlockCount()) {
141
+ $request->setBlockCount(
142
+ is_string($request->getBlockIds()) ?
143
+ substr_count($request->getBlockIds(), ',') + 1 :
144
+ count($request->getBlockIds())
145
+ );
146
+ }
147
+
148
+ if (!$request->hasPageCount()) {
149
+ $request->setPageCount(
150
+ is_string($request->getPageIds()) ?
151
+ substr_count($request->getPageIds(), ',') + 1 :
152
+ count($request->getPageIds())
153
+ );
154
+ }
155
+
156
+ if (!$request->hasAttributeCount()) {
157
+ $request->setAttributeCount(
158
+ is_string($request->getAttributeIds()) ?
159
+ substr_count($request->getAttributeIds(), ',') + 1 :
160
+ count($request->getAttributeIds())
161
+ );
162
+ }
163
+
164
+ $request->setUpdatedAt($this->formatDate(true));
165
+
166
+ return parent::_beforeSave($request);
167
+ }
168
+
169
+ protected function _afterSave(Mage_Core_Model_Abstract $request)
170
+ {
171
+ if ($request->dataHasChangedFor('documents')) {
172
+ $this->_saveDocuments($request);
173
+ }
174
+
175
+ if ($request->dataHasChangedFor('product_ids')) {
176
+ $this->_saveLinks($request, 'capita_ti/product', 'product_id');
177
+ }
178
+
179
+ if ($request->dataHasChangedFor('category_ids')) {
180
+ $this->_saveLinks($request, 'capita_ti/category', 'category_id');
181
+ }
182
+
183
+ if ($request->dataHasChangedFor('block_ids')) {
184
+ $this->_saveLinks($request, 'capita_ti/block', 'block_id');
185
+ }
186
+
187
+ if ($request->dataHasChangedFor('page_ids')) {
188
+ $this->_saveLinks($request, 'capita_ti/page', 'page_id');
189
+ }
190
+
191
+ if ($request->dataHasChangedFor('attribute_ids')) {
192
+ $this->_saveLinks($request, 'capita_ti/attribute', 'attribute_id');
193
+ }
194
+
195
+ return parent::_afterSave($request);
196
+ }
197
+
198
+ protected function _afterDelete(Mage_Core_Model_Abstract $request)
199
+ {
200
+ foreach ($request->getDocuments() as $document) {
201
+ if (is_array($document)) {
202
+ $document = Mage::getModel('capita_ti/request_document')
203
+ ->setData($document);
204
+ }
205
+ $document->delete();
206
+ }
207
+
208
+ return parent::_afterDelete($request);
209
+ }
210
+
211
+ protected function _saveDocuments(Capita_TI_Model_Request $request)
212
+ {
213
+ $documents = $request->getDocuments();
214
+ /* @var $document Capita_TI_Model_Request_Document */
215
+ foreach ($documents as &$document) {
216
+ if (is_array($document)) {
217
+ $document = Mage::getModel('capita_ti/request_document')
218
+ ->setData($document)
219
+ ->setRequestId($request->getId())
220
+ ->setStatus($request->getStatus());
221
+ }
222
+ $document->save();
223
+ }
224
+ $request->setData('documents', $documents)
225
+ ->setOrigData('documents', $documents);
226
+ }
227
+
228
+ protected function _saveLinks(Capita_TI_Model_Request $request, $tableEntity, $idFieldName)
229
+ {
230
+ $linkTable = $this->getTable($tableEntity);
231
+ $idsFieldName = $idFieldName . 's';
232
+ $entityIds = $request->getData($idsFieldName);
233
+ if (!is_array($entityIds)) {
234
+ $entityIds = explode(',', (string) $entityIds);
235
+ }
236
+
237
+ $adapter = $this->_getWriteAdapter();
238
+ $condition = sprintf(
239
+ '(%s) AND (%s)',
240
+ $adapter->prepareSqlCondition('request_id', $request->getId()),
241
+ $adapter->prepareSqlCondition($idFieldName, array('nin' => $entityIds)));
242
+ $adapter->delete($linkTable, $condition);
243
+
244
+ $insertData = array();
245
+ foreach ($entityIds as $entityId) {
246
+ $insertData[] = array(
247
+ 'request_id' => $request->getId(),
248
+ $idFieldName => $entityId
249
+ );
250
+ }
251
+ $adapter->insertOnDuplicate($linkTable, $insertData);
252
+ $request->setOrigData($idsFieldName, $entityIds);
253
+ }
254
+ }
app/code/community/Capita/TI/Model/Resource/Request/Collection.php ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Resource_Request_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
71
+ {
72
+
73
+ protected function _construct()
74
+ {
75
+ $this->_init('capita_ti/request');
76
+ }
77
+
78
+ protected function _initSelect()
79
+ {
80
+ parent::_initSelect();
81
+ $this->getSelect()
82
+ ->joinLeft(
83
+ array('productlist' => $this->getConnection()->select()
84
+ ->from($this->getTable('capita_ti/product'),
85
+ array('request_id', 'product_ids' => 'GROUP_CONCAT(DISTINCT product_id)'))
86
+ ->group('request_id')),
87
+ 'main_table.request_id=productlist.request_id',
88
+ 'product_ids')
89
+ ->joinLeft(
90
+ array('categorylist' => $this->getConnection()->select()
91
+ ->from($this->getTable('capita_ti/category'),
92
+ array('request_id', 'category_ids' => 'GROUP_CONCAT(DISTINCT category_id)'))
93
+ ->group('request_id')),
94
+ 'main_table.request_id=categorylist.request_id',
95
+ 'category_ids')
96
+ ->joinLeft(
97
+ array('blocklist' => $this->getConnection()->select()
98
+ ->from($this->getTable('capita_ti/block'),
99
+ array('request_id', 'block_ids' => 'GROUP_CONCAT(DISTINCT block_id)'))
100
+ ->group('request_id')),
101
+ 'main_table.request_id=blocklist.request_id',
102
+ 'block_ids')
103
+ ->joinLeft(
104
+ array('pagelist' => $this->getConnection()->select()
105
+ ->from($this->getTable('capita_ti/page'),
106
+ array('request_id', 'page_ids' => 'GROUP_CONCAT(DISTINCT page_id)'))
107
+ ->group('request_id')),
108
+ 'main_table.request_id=pagelist.request_id',
109
+ 'page_ids')
110
+ ->joinLeft(
111
+ array('attributelist' => $this->getConnection()->select()
112
+ ->from($this->getTable('capita_ti/attribute'),
113
+ array('request_id', 'attribute_ids' => 'GROUP_CONCAT(DISTINCT attribute_id)'))
114
+ ->group('request_id')),
115
+ 'main_table.request_id=attributelist.request_id',
116
+ 'attribute_ids');
117
+ return $this;
118
+ }
119
+
120
+ public function getSelectCountSql()
121
+ {
122
+ // undo effects of _initSelect() above
123
+ $select = parent::getSelectCountSql();
124
+ $select->reset(Zend_Db_Select::GROUP);
125
+ $select->resetJoinLeft();
126
+ return $select;
127
+ }
128
+
129
+ protected function _afterLoad()
130
+ {
131
+ if ($this->count()) {
132
+ /* @var $documents Capita_TI_Model_Resource_Request_Document_Collection */
133
+ $documents = Mage::getResourceModel('capita_ti/request_document_collection');
134
+ $documents->addFieldToFilter('request_id', array('in' => array_keys($this->_items)));
135
+
136
+ foreach ($this as $request) {
137
+ if ($request->hasDestLanguage()) {
138
+ $request->setDestLanguage(
139
+ explode(',', $request->getDestLanguage())
140
+ );
141
+ }
142
+
143
+ $reqdocs = array();
144
+ foreach ($documents as $document) {
145
+ if ($document->getRequestId() == $request->getId()) {
146
+ $reqdocs[$document->getId()] = $document;
147
+ }
148
+ }
149
+ $request->setDocuments($reqdocs);
150
+
151
+ $request->setProductIds(array_filter(explode(',', $request->getProductIds())));
152
+ $request->setCategoryIds(array_filter(explode(',', $request->getCategoryIds())));
153
+ $request->setBlockIds(array_filter(explode(',', $request->getBlockIds())));
154
+ $request->setPageIds(array_filter(explode(',', $request->getPageIds())));
155
+ $request->setAttributeIds(array_filter(explode(',', $request->getAttributeIds())));
156
+ }
157
+ }
158
+
159
+ return parent::_afterLoad();
160
+ }
161
+
162
+ /**
163
+ * Allows convenient searching of comma separated lists
164
+ *
165
+ * Because destination language is one text field it can be searched with
166
+ * a simple LIKE clause.
167
+ * Used by adminhtml grid with a select control so input is limited.
168
+ * Input is still escaped properly.
169
+ *
170
+ * @param string $language
171
+ * @return Capita_TI_Model_Resource_Request_Collection
172
+ */
173
+ public function addFilterLikeLanguage($language)
174
+ {
175
+ // addFieldToFilter escapes values for us
176
+ $this->addFieldToFilter(
177
+ 'dest_language',
178
+ array('like' => '%'.$language.'%'));
179
+ return $this;
180
+ }
181
+
182
+ /**
183
+ * Restrict to records with a status indicating a remote job
184
+ *
185
+ * @return Capita_TI_Model_Resource_Request_Collection
186
+ */
187
+ public function addRemoteFilter()
188
+ {
189
+ $this->addFieldToFilter('status', array('in' => array('onHold', 'inProgress')));
190
+ return $this;
191
+ }
192
+
193
+ /**
194
+ * Restrict to records with a status == 'importing'
195
+ *
196
+ * @return Capita_TI_Model_Resource_Request_Collection
197
+ */
198
+ public function addImportingFilter()
199
+ {
200
+ $this->addFieldToFilter('status', 'importing');
201
+ return $this;
202
+ }
203
+
204
+ /**
205
+ * Restrict to records no longer required and at least 1 day old
206
+ *
207
+ * @return Capita_TI_Model_Resource_Request_Collection
208
+ */
209
+ public function addExpiredFilter()
210
+ {
211
+ $this->addFieldToFilter('status', array('in' => array('completed', 'error')));
212
+ $date = Zend_Date::now();
213
+ $date->subDay(1);
214
+ $this->addFieldToFilter('updated_at', array('lt' => $this->formatDate($date)));
215
+ return $this;
216
+ }
217
+
218
+ public function addProductFilter($productId)
219
+ {
220
+ if ($productId instanceof Varien_Object) {
221
+ $productId = $productId->getId();
222
+ }
223
+ $this->join(
224
+ array('products' => 'capita_ti/product'),
225
+ 'main_table.request_id=products.request_id',
226
+ '');
227
+ $this->addFieldToFilter(
228
+ 'products.product_id',
229
+ is_array($productId) ? array('in' => $productId) : $productId);
230
+ return $this;
231
+ }
232
+
233
+ public function addCategoryFilter($categoryId)
234
+ {
235
+ if ($categoryId instanceof Varien_Object) {
236
+ $categoryId = $categoryId->getId();
237
+ }
238
+ $this->join(
239
+ array('categories' => 'capita_ti/category'),
240
+ 'main_table.request_id=categories.request_id',
241
+ '');
242
+ $this->addFieldToFilter('categories.category_id', $categoryId);
243
+ return $this;
244
+ }
245
+
246
+ public function addBlockFilter($blockId)
247
+ {
248
+ if ($blockId instanceof Varien_Object) {
249
+ $blockId = $blockId->getId();
250
+ }
251
+ $this->join(
252
+ array('blocks' => 'capita_ti/block'),
253
+ 'main_table.request_id=blocks.request_id',
254
+ '');
255
+ $this->addFieldToFilter(
256
+ 'blocks.block_id',
257
+ is_array($blockId) ? array('in' => $blockId) : $blockId);
258
+ return $this;
259
+ }
260
+
261
+ public function addPageFilter($pageId)
262
+ {
263
+ if ($pageId instanceof Varien_Object) {
264
+ $pageId = $pageId->getId();
265
+ }
266
+ $this->join(
267
+ array('pages' => 'capita_ti/page'),
268
+ 'main_table.request_id=pages.request_id',
269
+ '');
270
+ $this->addFieldToFilter(
271
+ 'pages.page_id',
272
+ is_array($pageId) ? array('in' => $pageId) : $pageId);
273
+ return $this;
274
+ }
275
+
276
+ public function isTargettingStore($storeIds)
277
+ {
278
+ // if no stores specified then we don't care and any store is valid
279
+ // assume any request matches
280
+ if (!$storeIds) {
281
+ return $this->count() > 0;
282
+ }
283
+
284
+ if (is_string($storeIds)) {
285
+ $storeIds = explode(',', $storeIds);
286
+ }
287
+ else {
288
+ $storeIds = (array) $storeIds;
289
+ }
290
+
291
+ $languages = array();
292
+ foreach ($storeIds as $storeId) {
293
+ $languages[] = Mage::getStoreConfig('general/locale/code', $storeId);
294
+ }
295
+ $languages = array_unique($languages);
296
+
297
+ foreach ($this as $request) {
298
+ foreach ($languages as $language) {
299
+ if ($request->hasDestLanguage($language)) {
300
+ // only need one match
301
+ return true;
302
+ }
303
+ }
304
+ }
305
+
306
+ return false;
307
+ }
308
+ }
app/code/community/Capita/TI/Model/Resource/Request/Document.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Resource_Request_Document extends Mage_Core_Model_Resource_Db_Abstract
71
+ {
72
+
73
+ protected function _construct()
74
+ {
75
+ $this->_init('capita_ti/document', 'document_id');
76
+ }
77
+
78
+ protected function _beforeSave(Mage_Core_Model_Abstract $document)
79
+ {
80
+ if ($document->hasLanguage()) {
81
+ $document->setLanguage(strtr($document->getLanguage(), '-', '_'));
82
+ }
83
+ return parent::_beforeSave($document);
84
+ }
85
+
86
+ protected function _afterDelete(Mage_Core_Model_Abstract $document)
87
+ {
88
+ if ($document->getLocalName()) {
89
+ $filename = Mage::getConfig()->getVarDir().DS.$document->getLocalName();
90
+ is_writable($filename) && unlink($filename);
91
+ }
92
+ return parent::_afterDelete($document);
93
+ }
94
+ }
app/code/community/Capita/TI/Model/Resource/Request/Document/Collection.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Resource_Request_Document_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
71
+ {
72
+
73
+ protected function _construct()
74
+ {
75
+ $this->_init('capita_ti/request_document');
76
+ }
77
+
78
+ /**
79
+ * Filter by either a string literal or a typical Varien data condition
80
+ *
81
+ * @param mixed $status
82
+ * @return Capita_TI_Model_Resource_Request_Document_Collection
83
+ */
84
+ public function addStatusFilter($status)
85
+ {
86
+ $this->addFieldToFilter('status', $status);
87
+ return $this;
88
+ }
89
+ }
app/code/community/Capita/TI/Model/Source/Category/Attributes.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Source_Category_Attributes
71
+ {
72
+
73
+ public function getBestAttributes()
74
+ {
75
+ /* @var $attributes Mage_Catalog_Model_Resource_Category_Attribute_Collection */
76
+ $attributes = Mage::getResourceModel('catalog/category_attribute_collection')
77
+ ->addFieldToFilter('main_table.frontend_input', array('in' => array('text', 'textarea')))
78
+ ->addFieldToFilter('main_table.backend_type', array('in' => array('text', 'varchar')))
79
+ ->addFieldToFilter('main_table.backend_model', array(
80
+ array('eq' => ''),
81
+ array('null' => true)
82
+ ))
83
+ ->addFieldToFilter('additional_table.is_global', 0)
84
+ ->addFieldToFilter('additional_table.is_visible', 1);
85
+ return $attributes;
86
+ }
87
+
88
+ public function getOptions()
89
+ {
90
+ return $this->getBestAttributes()->getColumnValues('frontend_label');
91
+ }
92
+
93
+ public function toOptionArray()
94
+ {
95
+ $result = array();
96
+ foreach ($this->getBestAttributes() as $attr) {
97
+ $result[] = array(
98
+ 'value' => $attr->getAttributeCode(),
99
+ 'label' => $attr->getFrontendLabel()
100
+ );
101
+ }
102
+ return $result;
103
+ }
104
+ }
app/code/community/Capita/TI/Model/Source/Product/Attributes.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Source_Product_Attributes
71
+ {
72
+
73
+ public function getBestAttributes()
74
+ {
75
+ /* @var $attributes Mage_Catalog_Model_Resource_Product_Attribute_Collection */
76
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
77
+ ->addFieldToFilter('main_table.frontend_input', array('in' => array('text', 'textarea')))
78
+ ->addFieldToFilter('additional_table.is_global', 0)
79
+ ->addFieldToFilter('additional_table.is_visible', 1);
80
+ return $attributes;
81
+ }
82
+
83
+ public function getOptions()
84
+ {
85
+ return $this->getBestAttributes()->getColumnValues('frontend_label');
86
+ }
87
+
88
+ public function toOptionArray()
89
+ {
90
+ $result = array();
91
+ foreach ($this->getBestAttributes() as $attr) {
92
+ $result[] = array(
93
+ 'value' => $attr->getAttributeCode(),
94
+ 'label' => $attr->getFrontendLabel()
95
+ );
96
+ }
97
+ return $result;
98
+ }
99
+ }
app/code/community/Capita/TI/Model/Source/Status.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Source_Status
71
+ {
72
+
73
+ public function getOptions()
74
+ {
75
+ /* @var $helper Capita_TI_Helper_Data */
76
+ $helper = Mage::helper('capita_ti');
77
+ return array(
78
+ 'completed' => $helper->__('Completed'),
79
+ 'onHold' => $helper->__('On Hold'),
80
+ 'inProgress' => $helper->__('In Progress'),
81
+ 'importing' => $helper->__('Importing'),
82
+ 'error' => $helper->__('Error')
83
+ );
84
+ }
85
+
86
+ public function getOptionLabel($value)
87
+ {
88
+ /* @var $helper Capita_TI_Helper_Data */
89
+ $helper = Mage::helper('capita_ti');
90
+ switch ($value) {
91
+ case 'completed':
92
+ return $helper->__('Completed');
93
+ case 'onHold':
94
+ return $helper->__('On Hold');
95
+ case 'inProgress':
96
+ return $helper->__('In Progress');
97
+ case 'importing':
98
+ return $helper->__('Importing');
99
+ case 'error':
100
+ return $helper->__('Error');
101
+ default:
102
+ return '';
103
+ }
104
+ }
105
+ }
app/code/community/Capita/TI/Model/Tracker.php ADDED
@@ -0,0 +1,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Tracker
71
+ {
72
+
73
+ /**
74
+ * Direct access to DB adapter
75
+ *
76
+ * @return Mage_Core_Model_Resource
77
+ */
78
+ protected function getResource()
79
+ {
80
+ return Mage::getSingleton('core/resource');
81
+ }
82
+
83
+ /**
84
+ * Direct access to DB adapter
85
+ *
86
+ * @return Varien_Db_Adapter_Interface
87
+ */
88
+ protected function getConnection()
89
+ {
90
+ return $this->getResource()->getConnection('capita_ti_setup');
91
+ }
92
+
93
+ /**
94
+ * A safe form of INSERT IGNORE with multiple rows
95
+ *
96
+ * @param string $tableEntity
97
+ * @param array $data 2D array of column => values
98
+ */
99
+ protected function insertRetire($tableEntity, $data)
100
+ {
101
+ if (!$data) {
102
+ return;
103
+ }
104
+
105
+ $tableName = $this->getResource()->getTableName($tableEntity);
106
+ $top = reset($data);
107
+ unset($top['old_value'], $top['new_value']);
108
+ $top['old_md5'] = true;
109
+ $cols = array_keys($top);
110
+
111
+ $inserts = array();
112
+ $deletes = array();
113
+ foreach ($data as $row) {
114
+ $oldValue = @$row['old_value'];
115
+ $newValue = @$row['new_value'];
116
+ $row = array_intersect_key($row, $top);
117
+ $row = array_merge($top, $row);
118
+
119
+ $row['old_md5'] = md5($oldValue);
120
+ $inserts[] = '('.implode(',', array_map(array($this->getConnection(), 'quote'), $row)).')';
121
+
122
+ $row['old_md5'] = md5($newValue);
123
+ $delete = array();
124
+ foreach ($row as $col => $val) {
125
+ $col = $this->getConnection()->quoteIdentifier($col);
126
+ $val = $this->getConnection()->quote($val);
127
+ $delete[] = '('.$col.'='.$val.')';
128
+ }
129
+ $deletes[] = '('.implode(' AND ', $delete).')';
130
+ }
131
+
132
+ $cols = array_map(array($this->getConnection(), 'quoteIdentifier'), $cols);
133
+ $id = reset($cols);
134
+ // actual INSERT IGNORE is dangerous because it ignores all errors
135
+ // ON DUPLICATE KEY in this way is better because it only ignores key collisions
136
+ $sql = 'INSERT INTO '.$this->getConnection()->quoteIdentifier($tableName, true);
137
+ $sql .= ' ('.implode(',', $cols).') VALUES ';
138
+ $sql .= implode(',', $inserts);
139
+ $sql .= ' ON DUPLICATE KEY UPDATE '.$id.'='.$id;
140
+ $this->getConnection()->query($sql);
141
+
142
+ $where = implode(' OR ', $deletes);
143
+ $this->getConnection()->delete($tableName, $where);
144
+ }
145
+
146
+ protected function deleteRecords($tableEntity, $condition)
147
+ {
148
+ $connection = $this->getConnection();
149
+ $tableName = $this->getResource()->getTableName($tableEntity);
150
+ $where = array();
151
+ foreach ($condition as $col => $val) {
152
+ $col = $connection->quoteIdentifier($col);
153
+ if (is_array($val)) {
154
+ $where[] = sprintf('%s IN (%s)', $col, $connection->quote($val));
155
+ }
156
+ else {
157
+ $where[] = sprintf('%s LIKE %s', $col, $connection->quote($val));
158
+ }
159
+ }
160
+ if ($where) {
161
+ $where = implode(Zend_Db_Select::SQL_AND, $where);
162
+ return $connection->delete($tableName, $where);
163
+ }
164
+ return false;
165
+ }
166
+
167
+ protected function watchEntity($tableEntity, Varien_Object $object, $attributes)
168
+ {
169
+ $values = array();
170
+ $languages = Mage::helper('capita_ti')->getNonDefaultLocales();
171
+ foreach ($attributes as $attribute) {
172
+ if ($object->dataHasChangedFor($attribute)) {
173
+ foreach ($languages as $language) {
174
+ $values[] = array(
175
+ $object->getIdFieldName() => $object->getId(),
176
+ 'language' => $language,
177
+ 'attribute' => $attribute,
178
+ 'old_value' => $object->getOrigData($attribute),
179
+ 'new_value' => $object->getData($attribute)
180
+ );
181
+ }
182
+ }
183
+ }
184
+ $this->insertRetire($tableEntity, $values);
185
+ }
186
+
187
+ public function blockSaveAfter(Varien_Event_Observer $observer)
188
+ {
189
+ /* @var $block Mage_Cms_Model_Block */
190
+ $block = $observer->getObject();
191
+ $stores = array(
192
+ Mage_Core_Model_App::ADMIN_STORE_ID,
193
+ Mage::app()->getDefaultStoreView()->getId()
194
+ );
195
+ if ($block && array_intersect($block->getStores(), $stores)) {
196
+ $this->watchEntity(
197
+ 'capita_ti/block_diff',
198
+ $block,
199
+ array('title', 'content'));
200
+ return $this;
201
+ }
202
+ }
203
+
204
+ public function categorySaveAfter(Varien_Event_Observer $observer)
205
+ {
206
+ $category = $observer->getCategory();
207
+ if ($category && !$category->getStoreId()) {
208
+ $attributes = Mage::getSingleton('capita_ti/source_category_attributes')->getBestAttributes();
209
+ $this->watchEntity(
210
+ 'capita_ti/category_diff',
211
+ $observer->getCategory(),
212
+ $attributes->getColumnValues('attribute_code'));
213
+ }
214
+ }
215
+
216
+ public function pageSaveAfter(Varien_Event_Observer $observer)
217
+ {
218
+ /* @var $page Mage_Cms_Model_Page */
219
+ $page = $observer->getObject();
220
+ $stores = array(
221
+ Mage_Core_Model_App::ADMIN_STORE_ID,
222
+ Mage::app()->getDefaultStoreView()->getId()
223
+ );
224
+ if ($page && array_intersect($page->getStores(), $stores)) {
225
+ $this->watchEntity(
226
+ 'capita_ti/page_diff',
227
+ $observer->getObject(),
228
+ array('title', 'meta_keywords', 'meta_description', 'content_heading', 'content'));
229
+ }
230
+ }
231
+
232
+ public function productSaveAfter(Varien_Event_Observer $observer)
233
+ {
234
+ $product = $observer->getProduct();
235
+ // only changes in global scope
236
+ if ($product && !$product->getStoreId()) {
237
+ $attributes = Mage::getSingleton('capita_ti/source_product_attributes')->getBestAttributes();
238
+ $this->watchEntity(
239
+ 'capita_ti/product_diff',
240
+ $product,
241
+ $attributes->getColumnValues('attribute_code'));
242
+ }
243
+ }
244
+
245
+ public function modelSaveAfter(Varien_Event_Observer $observer)
246
+ {
247
+ // CMS Blocks do not set an event_prefix so cannot dispatch a specific event
248
+ // test if generic event contains a block and pass to appropriate handler
249
+ if ($observer->getObject() instanceof Mage_Cms_Model_Block) {
250
+ $this->blockSaveAfter($observer);
251
+ }
252
+ }
253
+
254
+ public function attributeSaveAfter(Varien_Event_Observer $observer)
255
+ {
256
+ /* @var $attribute Mage_Catalog_Model_Entity_Attribute */
257
+ $attribute = $observer->getAttribute();
258
+ $languages = Mage::helper('capita_ti')->getNonDefaultLocales();
259
+ $values = array();
260
+
261
+ $oldLabel = $attribute->getOrigData('frontend_label');
262
+ $newLabel = $attribute->getData('frontend_label');
263
+ if (is_array($newLabel)) {
264
+ $newLabel = $newLabel[0];
265
+ }
266
+ if ($oldLabel != $newLabel) {
267
+ foreach ($languages as $language) {
268
+ $values[] = array(
269
+ 'attribute_id' => $attribute->getAttributeId(),
270
+ 'language' => $language,
271
+ 'attribute' => 'frontend_label',
272
+ 'old_value' => $oldLabel,
273
+ 'new_value' => $newLabel
274
+ );
275
+ }
276
+ }
277
+
278
+ $options = $attribute->getOption();
279
+ $newValues = array();
280
+ foreach ((array) @$options['value'] as $optionId => $option) {
281
+ $newValues[$optionId] = $option[0];
282
+ }
283
+ $oldValues = Mage::getResourceModel('eav/entity_attribute_option_collection')
284
+ ->setAttributeFilter($attribute->getAttributeId())
285
+ ->setStoreFilter()
286
+ ->walk('getValue');
287
+ foreach (array_diff_assoc($newValues, $oldValues) as $optionId => $newValue) {
288
+ foreach ($languages as $language) {
289
+ $values[] = array(
290
+ 'attribute_id' => $attribute->getAttributeId(),
291
+ 'language' => $language,
292
+ 'attribute' => 'option_'.$optionId,
293
+ 'old_value' => $oldValues[$optionId],
294
+ 'new_value' => $newValue
295
+ );
296
+ }
297
+ }
298
+
299
+ $this->insertRetire('capita_ti/attribute_diff', $values);
300
+ }
301
+
302
+ public function endWatch(Capita_TI_Model_Request $request)
303
+ {
304
+ $languages = explode(',', $request->getDestLanguage());
305
+ if ($request->getProductIds() && $request->getProductAttributes()) {
306
+ $this->deleteRecords(
307
+ 'capita_ti/product_diff',
308
+ array(
309
+ 'entity_id' => $request->getProductIds(),
310
+ 'language' => $languages,
311
+ 'attribute' => $request->getProductAttributesArray()
312
+ ));
313
+ }
314
+ if ($request->getCategoryIds() && $request->getCategoryAttributes()) {
315
+ $this->deleteRecords(
316
+ 'capita_ti/category_diff',
317
+ array(
318
+ 'entity_id' => $request->getCategoryIds(),
319
+ 'language' => $languages,
320
+ 'attribute' => $request->getCategoryAttributesArray()
321
+ ));
322
+ }
323
+ if ($request->getBlockIds()) {
324
+ $this->deleteRecords(
325
+ 'capita_ti/block_diff',
326
+ array(
327
+ 'block_id' => $request->getBlockIds(),
328
+ 'language' => $languages
329
+ ));
330
+ }
331
+ if ($request->getPageIds()) {
332
+ $this->deleteRecords(
333
+ 'capita_ti/page_diff',
334
+ array(
335
+ 'page_id' => $request->getPageIds(),
336
+ 'language' => $languages
337
+ ));
338
+ }
339
+ if ($request->getAttributeIds()) {
340
+ $this->deleteRecords(
341
+ 'capita_ti/attribute_diff',
342
+ array(
343
+ 'attribute_id' => $request->getAttributeIds(),
344
+ 'language' => $languages
345
+ ));
346
+ }
347
+ return $this;
348
+ }
349
+ }
app/code/community/Capita/TI/Model/Xliff/Import/Abstract.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ abstract class Capita_TI_Model_Xliff_Import_Abstract
71
+ {
72
+
73
+ private $_request;
74
+
75
+ /**
76
+ * This value will be used in the "original" attribute
77
+ *
78
+ * @return string
79
+ */
80
+ abstract public function getEntityType();
81
+
82
+ /**
83
+ * Import the supplied data to the appropriate entity
84
+ *
85
+ * @param scalar $id
86
+ * @param string $sourceLanguage
87
+ * @param string $destLanguage
88
+ * @param array $sourceData
89
+ * @param array $destData
90
+ */
91
+ abstract public function import($id, $sourceLanguage, $destLanguage, $sourceData, $destData);
92
+
93
+ /**
94
+ * Probably the original request instance that started this translation
95
+ *
96
+ * @return Capita_TI_Model_Request
97
+ */
98
+ public function getRequest()
99
+ {
100
+ return $this->_request;
101
+ }
102
+
103
+ /**
104
+ * Provides a hint on how or where to import the following data
105
+ *
106
+ * @param Capita_TI_Model_Request $request
107
+ * @return Capita_TI_Model_Xliff_Import_Abstract
108
+ */
109
+ public function setRequest(Capita_TI_Model_Request $request)
110
+ {
111
+ $this->_request = $request;
112
+ return $this;
113
+ }
114
+ }
app/code/community/Capita/TI/Model/Xliff/Import/Attribute.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Xliff_Import_Attribute extends Capita_TI_Model_Xliff_Import_Abstract
71
+ {
72
+
73
+ public function getEntityType()
74
+ {
75
+ return 'eav_attribute';
76
+ }
77
+
78
+ public function import($id, $sourceLanguage, $destLanguage, $sourceData, $destData)
79
+ {
80
+ if ($this->getRequest()) {
81
+ if (!in_array($id, $this->getRequest()->getAttributeIds())) {
82
+ // prevent accidentally importing data which shouldn't be
83
+ return;
84
+ }
85
+ if (!in_array($destLanguage, $this->getRequest()->getDestLanguage())) {
86
+ // was not expecting this language
87
+ return;
88
+ }
89
+ }
90
+ if (!isset($destData['frontend_label'])) {
91
+ // this is the only value needed
92
+ return;
93
+ }
94
+
95
+ /* @var $attribute Mage_Eav_Model_Entity_Attribute */
96
+ $attribute = Mage::getModel('eav/entity_attribute')->load($id);
97
+ $labels = $attribute->getStoreLabels();
98
+
99
+ /* @var $store Mage_Core_Model_Store */
100
+ foreach (Mage::app()->getStores() as $store) {
101
+ $code = (string) $store->getConfig('general/locale/code');
102
+ if ($code == $destLanguage) {
103
+ $labels[$store->getId()] = $destData['frontend_label'];
104
+ $attribute->setStoreLabels($labels);
105
+ }
106
+ }
107
+
108
+ // does nothing if labels have not changed
109
+ $attribute->save();
110
+ }
111
+ }
app/code/community/Capita/TI/Model/Xliff/Import/Attributeoption.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Xliff_Import_Attributeoption extends Capita_TI_Model_Xliff_Import_Abstract
71
+ {
72
+
73
+ public function getEntityType()
74
+ {
75
+ return 'eav_attribute_option';
76
+ }
77
+
78
+ public function import($id, $sourceLanguage, $destLanguage, $sourceData, $destData)
79
+ {
80
+ if ($this->getRequest()) {
81
+ if (!in_array($destLanguage, $this->getRequest()->getDestLanguage())) {
82
+ // was not expecting this language
83
+ return;
84
+ }
85
+ }
86
+ if (!isset($destData['value'])) {
87
+ // this is the only value needed
88
+ return;
89
+ }
90
+
91
+ // The intention was to save all imports through existing models which respect events, etc.
92
+ // But the only way to save attribute option values is with the entire attribute.
93
+ // This works by loading all options into memory, deleting from DB,
94
+ // then saving them all back which is far too slow.
95
+ // It doesn't even use a transaction so could lose data due to time
96
+ // limits during big imports.
97
+
98
+ /* @var $option Mage_Eav_Model_Entity_Attribute_Option */
99
+ $option = Mage::getModel('eav/entity_attribute_option')->load($id);
100
+
101
+ // prevent accidentally importing data which shouldn't be
102
+ if ($option->isObjectNew()) {
103
+ return;
104
+ }
105
+ if ($this->getRequest() && !in_array($option->getAttributeId(), $this->getRequest()->getAttributeIds())) {
106
+ return;
107
+ }
108
+
109
+ $adapter = $option->getResource()->getReadConnection();
110
+ $tableName = $option->getResource()->getTable('eav/attribute_option_value');
111
+ /* @var $store Mage_Core_Model_Store */
112
+ foreach (Mage::app()->getStores() as $store) {
113
+ $code = (string) $store->getConfig('general/locale/code');
114
+ if ($code == $destLanguage) {
115
+ // would like to do INSERT ON DUPLICATE UPDATE here but table lacks an appropriate index
116
+ $adapter->delete($tableName, array(
117
+ 'option_id = ?' => $id,
118
+ 'store_id = ?' => $store->getId()
119
+ ));
120
+ $adapter->insert($tableName, array(
121
+ 'option_id' => $id,
122
+ 'store_id' => $store->getId(),
123
+ 'value' => $destData['value']
124
+ ));
125
+ }
126
+ }
127
+ }
128
+ }
app/code/community/Capita/TI/Model/Xliff/Import/Block.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Xliff_Import_Block extends Capita_TI_Model_Xliff_Import_Abstract
71
+ {
72
+
73
+ public function getEntityType()
74
+ {
75
+ return Mage_Cms_Model_Block::CACHE_TAG;
76
+ }
77
+
78
+ public function import($id, $sourceLanguage, $destLanguage, $sourceData, $destData)
79
+ {
80
+ if ($this->getRequest()) {
81
+ if (!in_array($id, $this->getRequest()->getBlockIds())) {
82
+ // prevent accidentally importing data which shouldn't be
83
+ // perhaps it wasn't requested or the block was deleted afterwards
84
+ return;
85
+ }
86
+ if (!in_array($destLanguage, $this->getRequest()->getDestLanguage())) {
87
+ // was not expecting this language
88
+ return;
89
+ }
90
+ }
91
+
92
+ /* @var $origBlock Mage_Cms_Model_Block */
93
+ $origBlock = Mage::getModel('cms/block')->load($id);
94
+ if ($identifier = $origBlock->getIdentifier()) {
95
+ // do not change original block
96
+ // create new block only for targetted stores and retire old one from those stores
97
+
98
+ $destStores = Mage::helper('capita_ti')->getStoreIdsByLanguage($destLanguage);
99
+ $newStores = $destStores;
100
+
101
+ /* @var $transaction Mage_Core_Model_Resource_Transaction */
102
+ $transaction = Mage::getResourceModel('core/transaction');
103
+
104
+ /* @var $block Mage_Cms_Model_Block */
105
+ /* @var $blocks Mage_Cms_Model_Resource_Block_Collection */
106
+ $blocks = Mage::getResourceModel('cms/block_collection');
107
+ $blocks->addFieldToFilter('identifier', $identifier);
108
+ foreach ($blocks as $block) {
109
+ // lookupStoreIds() is normally called in afterLoad but collection does not do it
110
+ $blockStores = $block->getResource()->lookupStoreIds($block->getId());
111
+ if ($blockStores == array(0)) {
112
+ // equivalent to "All Store Views"
113
+ $blockStores = array_keys(Mage::app()->getStores());
114
+ }
115
+
116
+ $exStores = array_diff($blockStores, $destStores);
117
+ if ($exStores) {
118
+ // block cannot be translated without interfering with other locales
119
+ if ($blockStores != $exStores) {
120
+ // block must also be removed from targets
121
+ $block->setStores($exStores);
122
+ $transaction->addObject($block);
123
+ }
124
+ continue;
125
+ }
126
+
127
+ $inStores = array_diff($destStores, $blockStores);
128
+ if ($inStores) {
129
+ // block covers at least one target
130
+ $block->setTitle(@$destData['title'])
131
+ ->setContent(@$destData['content']);
132
+ $transaction->addObject($block);
133
+ }
134
+
135
+ $newStores = array_diff($newStores, $inStores);
136
+ }
137
+ if ($newStores) {
138
+ /* @var $newBlock Mage_Cms_Model_Block */
139
+ $newBlock = Mage::getModel('cms/block');
140
+ $newBlock->setIdentifier($identifier)
141
+ ->setIsActive($origBlock->getIsActive())
142
+ ->setTitle(@$destData['title'])
143
+ ->setContent(@$destData['content'])
144
+ ->setStores($newStores);
145
+ $transaction->addObject($newBlock);
146
+ }
147
+ $transaction->save();
148
+ }
149
+ }
150
+ }
app/code/community/Capita/TI/Model/Xliff/Import/Category.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Xliff_Import_Category extends Capita_TI_Model_Xliff_Import_Abstract
71
+ {
72
+
73
+ public function getEntityType()
74
+ {
75
+ return Mage_Catalog_Model_Category::ENTITY;
76
+ }
77
+
78
+ public function import($id, $sourceLanguage, $destLanguage, $sourceData, $destData)
79
+ {
80
+ if ($this->getRequest()) {
81
+ if (!in_array($id, $this->getRequest()->getCategoryIds())) {
82
+ // prevent accidentally importing data which shouldn't be
83
+ // perhaps it wasn't requested or the category was deleted afterwards
84
+ return;
85
+ }
86
+ if (!in_array($destLanguage, $this->getRequest()->getDestLanguage())) {
87
+ // was not expecting this language
88
+ return;
89
+ }
90
+ }
91
+
92
+ /* @var $store Mage_Core_Model_Store */
93
+ foreach (Mage::app()->getStores() as $store) {
94
+ $code = (string) $store->getConfig('general/locale/code');
95
+ if ($code == $destLanguage) {
96
+ /* @var $category Mage_Catalog_Model_Category */
97
+ $category = Mage::getModel('catalog/category')
98
+ ->setStoreId($store->getId())
99
+ ->load($id);
100
+ if ($category->isObjectNew()) return;
101
+
102
+ /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
103
+ foreach ($category->getAttributes() as $code => $attribute) {
104
+ if (!$attribute->isScopeGlobal() && !$category->getExistsStoreValueFlag($code)) {
105
+ $category->unsetData($code);
106
+ }
107
+ }
108
+ $category
109
+ ->addData($destData)
110
+ ->save();
111
+ }
112
+ }
113
+ }
114
+ }
app/code/community/Capita/TI/Model/Xliff/Import/Page.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Xliff_Import_Page extends Capita_TI_Model_Xliff_Import_Abstract
71
+ {
72
+
73
+ public function getEntityType()
74
+ {
75
+ return Mage_Cms_Model_Page::CACHE_TAG;
76
+ }
77
+
78
+ public function import($id, $sourceLanguage, $destLanguage, $sourceData, $destData)
79
+ {
80
+ if ($this->getRequest()) {
81
+ if (!in_array($id, $this->getRequest()->getPageIds())) {
82
+ // prevent accidentally importing data which shouldn't be
83
+ // perhaps it wasn't requested or the page was deleted afterwards
84
+ return;
85
+ }
86
+ if (!in_array($destLanguage, $this->getRequest()->getDestLanguage())) {
87
+ // was not expecting this language
88
+ return;
89
+ }
90
+ }
91
+
92
+ /* @var $origPage Mage_Cms_Model_Page */
93
+ $origPage = Mage::getModel('cms/page')->load($id);
94
+ if ($identifier = $origPage->getIdentifier()) {
95
+ // do not change original page
96
+ // create new page only for targetted stores and retire old one from those stores
97
+
98
+ $destStores = Mage::helper('capita_ti')->getStoreIdsByLanguage($destLanguage);
99
+ $newStores = $destStores;
100
+
101
+ /* @var $transaction Mage_Core_Model_Resource_Transaction */
102
+ $transaction = Mage::getResourceModel('core/transaction');
103
+
104
+ /* @var $page Mage_Cms_Model_Page */
105
+ /* @var $pages Mage_Cms_Model_Resource_Page_Collection */
106
+ $pages = Mage::getResourceModel('cms/page_collection');
107
+ $pages->addFieldToFilter('identifier', $identifier);
108
+ foreach ($pages as $page) {
109
+ // lookupStoreIds() is normally called in afterLoad but collection does not do it
110
+ $pageStores = $page->getResource()->lookupStoreIds($page->getId());
111
+ if ($pageStores == array(0)) {
112
+ // equivalent to "All Store Views"
113
+ $pageStores = array_keys(Mage::app()->getStores());
114
+ }
115
+
116
+ $exStores = array_diff($pageStores, $destStores);
117
+ if ($exStores) {
118
+ // page cannot be translated without interfering with other locales
119
+ if ($pageStores != $exStores) {
120
+ // page must also be removed from targets
121
+ $page->setStores($exStores);
122
+ $transaction->addObject($page);
123
+ }
124
+ continue;
125
+ }
126
+
127
+ $inStores = array_diff($destStores, $pageStores);
128
+ if ($inStores) {
129
+ // page covers at least one target
130
+ $page->setTitle(@$destData['title'])
131
+ ->setContent(@$destData['content'])
132
+ ->setContentHeading(@$destData['content_heading'])
133
+ ->setMetaDescription(@$destData['meta_description'])
134
+ ->setMetaKeywords(@$destData['meta_keywords']);
135
+ $transaction->addObject($page);
136
+ }
137
+
138
+ $newStores = array_diff($newStores, $inStores);
139
+ }
140
+ if ($newStores) {
141
+ /* @var $newPage Mage_Cms_Model_Page */
142
+ $newPage = Mage::getModel('cms/page');
143
+ $newPage->setData($origPage->getData())
144
+ ->unsetData($newPage->getIdFieldName())
145
+ ->unsetData('creation_time')
146
+ ->unsetData('update_time')
147
+ ->setTitle(@$destData['title'])
148
+ ->setContent(@$destData['content'])
149
+ ->setContentHeading(@$destData['content_heading'])
150
+ ->setMetaDescription(@$destData['meta_description'])
151
+ ->setMetaKeywords(@$destData['meta_keywords'])
152
+ ->setStores($newStores);
153
+ $transaction->addObject($newPage);
154
+ }
155
+ $transaction->save();
156
+ }
157
+ }
158
+ }
app/code/community/Capita/TI/Model/Xliff/Import/Product.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Xliff_Import_Product extends Capita_TI_Model_Xliff_Import_Abstract
71
+ {
72
+
73
+ public function getEntityType()
74
+ {
75
+ return Mage_Catalog_Model_Product::ENTITY;
76
+ }
77
+
78
+ public function import($id, $sourceLanguage, $destLanguage, $sourceData, $destData)
79
+ {
80
+ if ($this->getRequest()) {
81
+ if (!in_array($id, $this->getRequest()->getProductIds())) {
82
+ // prevent accidentally importing data which shouldn't be
83
+ // perhaps it wasn't requested or the product was deleted afterwards
84
+ return;
85
+ }
86
+ if (!in_array($destLanguage, $this->getRequest()->getDestLanguage())) {
87
+ // was not expecting this language
88
+ return;
89
+ }
90
+ }
91
+
92
+ /* @var $action Mage_Catalog_Model_Product_Action */
93
+ $action = Mage::getModel('catalog/product_action');
94
+
95
+ /* @var $store Mage_Core_Model_Store */
96
+ foreach (Mage::app()->getStores() as $store) {
97
+ $code = (string) $store->getConfig('general/locale/code');
98
+ if ($code == $destLanguage) {
99
+ $action->updateAttributes(array($id), $destData, $store->getId());
100
+ }
101
+ }
102
+ }
103
+ }
app/code/community/Capita/TI/Model/Xliff/Reader.php ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Model_Xliff_Reader
71
+ {
72
+
73
+ /**
74
+ * Each import type handles a specific entity type
75
+ *
76
+ * @var Capita_TI_Model_Xliff_Import_Abstract[]
77
+ */
78
+ protected $_types;
79
+
80
+ /**
81
+ * An additional hint for importers to know where to save data
82
+ *
83
+ * @var Capita_TI_Model_Request
84
+ */
85
+ protected $_request;
86
+
87
+ /**
88
+ * Register an importer to be matched to each entity tpe
89
+ *
90
+ * @param string $type
91
+ * @param string $model
92
+ * @return Capita_TI_Model_Xliff_Reader
93
+ */
94
+ public function addType(Capita_TI_Model_Xliff_Import_Abstract $type)
95
+ {
96
+ $this->_types[$type->getEntityType()] = $type;
97
+ return $this;
98
+ }
99
+
100
+ /**
101
+ * Retrieve a specific type importer
102
+ *
103
+ * @param string $type
104
+ * @return Capita_TI_Model_Xliff_Import_Abstract|null
105
+ */
106
+ public function getImporter($type)
107
+ {
108
+ return isset($this->_types[$type]) ? $this->_types[$type] : null;
109
+ }
110
+
111
+ /**
112
+ * Optionally set a request to be passed to importers in the following import() calls
113
+ *
114
+ * @param Capita_TI_Model_Request $request
115
+ * @return Capita_TI_Model_Xliff_Reader
116
+ */
117
+ public function setRequest(Capita_TI_Model_Request $request)
118
+ {
119
+ $this->_request = $request;
120
+ return $this;
121
+ }
122
+
123
+ public function import($uri, $language = null)
124
+ {
125
+ $xml = new XMLReader();
126
+ $xml->open($uri) or $this->__('Could not open "%s"', $uri);
127
+
128
+ $xml->read() or $this->__('Could not read root element');
129
+ $xml->name == 'xliff' or $this->__('Expected "%s" element but got "%s"', 'xliff', $xml->name);
130
+ $version = $xml->getAttribute('version');
131
+ $version == '1.2' or $this->__('XLIFF version is "%s" and needs to be "1.2"', $version);
132
+
133
+ while ($this->_readFile($xml, $language));
134
+
135
+ $xml->close();
136
+ }
137
+
138
+ /**
139
+ * Finds either a child or a sibling but not a parent
140
+ *
141
+ * @param XMLReader $xml
142
+ * @return boolean
143
+ */
144
+ protected function _nextElement(XMLReader $xml)
145
+ {
146
+ while ($xml->read() && $xml->nodeType != XMLReader::END_ELEMENT) {
147
+ if ($xml->nodeType == XMLReader::ELEMENT) {
148
+ return true;
149
+ }
150
+ }
151
+ return false;
152
+ }
153
+
154
+ protected function _readFile(XMLReader $xml, $language = null)
155
+ {
156
+ if (!$this->_nextElement($xml)) {
157
+ return false;
158
+ }
159
+
160
+ $xml->name == 'file' or $this->__('Expected "%s" element but got "%s"', 'file', $xml->name);
161
+ $origin = $xml->getAttribute('original') or $this->__('File origin is not specified');
162
+ $sourceLanguage = $xml->getAttribute('source-language') or $this->__('Source language is not specified');
163
+ $sourceLanguage = strtr($sourceLanguage, '-', '_');
164
+ $destLanguage = $xml->getAttribute('target-language');
165
+ if (!$destLanguage) {
166
+ $destLanguage = $language or $this->__('Target language is not specified');
167
+ }
168
+ $destLanguage = strtr($destLanguage, '-', '_');
169
+ if (strpos($origin, '/') !== false) {
170
+ list($origin, $id) = explode('/', $origin);
171
+ }
172
+ else {
173
+ $id == '';
174
+ }
175
+ $importer = $this->getImporter($origin) or $this->__('Unrecognised file origin: "%s"', $origin);
176
+ if ($this->_request) {
177
+ $importer->setRequest($this->_request);
178
+ }
179
+
180
+ $this->_nextElement($xml) or $this->__('File element has no body');
181
+
182
+ if ($xml->name == 'header') {
183
+ $xml->next();
184
+ }
185
+ $xml->name == 'body' or $this->__('File element has no body');
186
+
187
+ $sourceData = array();
188
+ $destData = array();
189
+ while ($this->_nextElement($xml)) {
190
+ $xml->name == 'trans-unit' or $this->__('Expected "%s" element but got "%s"', 'trans-unit', $xml->name);
191
+ $key = $xml->getAttribute('id');
192
+ $key or $this->__('Trans-unit has no ID');
193
+
194
+ while ($xml->read() && $xml->nodeType != XMLReader::ELEMENT);
195
+ $xml->name == 'source' or $this->__('Expected "%s" element but got "%s"', 'source', $xml->name);
196
+ $sourceData[$key] = $this->readHtml($xml->expand());
197
+
198
+ while ($xml->name != 'target') {
199
+ $xml->next();
200
+ }
201
+ $destData[$key] = $this->readHtml($xml->expand());
202
+
203
+ while ($xml->next() && $xml->name != 'trans-unit');
204
+ }
205
+ $importer->import($id, $sourceLanguage, $destLanguage, $sourceData, $destData);
206
+
207
+ while ($xml->read() && $xml->name != 'file');
208
+ return true;
209
+ }
210
+
211
+ /**
212
+ * Decode XLIFF elements into raw HTML and CMS directives
213
+ *
214
+ * @param DOMNode $source
215
+ * @return string
216
+ */
217
+ public function readHtml(DOMNode $source)
218
+ {
219
+ $html = '';
220
+ $node = $source->firstChild;
221
+ while ($node) {
222
+ if ($node instanceof DOMText) {
223
+ $html .= $node->nodeValue;
224
+ }
225
+ elseif ($node instanceof DOMElement) {
226
+ if ($node->getAttribute('ctype') == 'x-cms-directive') {
227
+ $html .= base64_decode($node->textContent);
228
+ }
229
+ else switch ($node->tagName) {
230
+ case 'g':
231
+ $tagName = $this->getTagFromCtype($node);
232
+ $attributes = $this->getAttributes($node);
233
+ $html .= '<'.$tagName.$attributes.'>';
234
+ $html .= $this->readHtml($node);
235
+ $html .= '</'.$tagName.'>';
236
+ break;
237
+ case 'ph':
238
+ $tagName = $this->getTagFromCtype($node);
239
+ $attributes = $this->getAttributes($node);
240
+ $html .= '<'.$tagName.$attributes.$this->readSubs($node).'>';
241
+ // no closing tag
242
+ break;
243
+ case 'x':
244
+ $tagName = $this->getTagFromCtype($node);
245
+ $attributes = $this->getAttributes($node);
246
+ $html .= '<'.$tagName.$attributes.'>';
247
+ // no closing tag
248
+ break;
249
+ default:
250
+ $this->__('Unrecognised element: <%s>', $node->tagName);
251
+ }
252
+ }
253
+ $node = $node->nextSibling;
254
+ }
255
+ return $html;
256
+ }
257
+
258
+ protected function getTagFromCtype(DOMElement $element)
259
+ {
260
+ $ctype = $element->getAttribute('ctype');
261
+ switch ($ctype) {
262
+ case 'image':
263
+ return 'img';
264
+ case 'pb':
265
+ return 'hr';
266
+ case 'lb':
267
+ return 'br';
268
+ case 'bold':
269
+ return 'strong';
270
+ case 'italic':
271
+ return 'em';
272
+ case 'underline':
273
+ return 'u';
274
+ case 'link':
275
+ return 'a';
276
+ default:
277
+ if (preg_match('/^x-html-(\w+)$/', $ctype, $result)) {
278
+ return $result[1];
279
+ }
280
+ }
281
+ $this->__('Unrecognised ctype: "%s"', $ctype);
282
+ }
283
+
284
+ protected function getAttributes(DOMElement $element)
285
+ {
286
+ $attrs = '';
287
+ foreach ($element->attributes as $attribute) {
288
+ $name = $attribute->nodeName;
289
+ $value = $attribute->nodeValue;
290
+ if (strpos($name, 'htm:') === 0) {
291
+ $name = substr($name, 4);
292
+ }
293
+ elseif (strpos($name, 'cms:') === 0) {
294
+ $name = substr($name, 4);
295
+ $value = base64_decode($value);
296
+ }
297
+ else {
298
+ continue;
299
+ }
300
+ $attrs .= sprintf(' %s="%s"', $name, $value);
301
+ }
302
+ return $attrs;
303
+ }
304
+
305
+ protected function readSubs(DOMElement $element)
306
+ {
307
+ $attrs = '';
308
+ $sub = $element->firstChild;
309
+ while ($sub) {
310
+ if ($sub instanceof DOMElement && $sub->tagName == 'sub') {
311
+ $ctype = $sub->getAttribute('ctype');
312
+ $name = preg_replace('/^x-html-\w+-(\w+)$/', '$1', $ctype);
313
+ $value = $sub->textContent;
314
+ $attrs .= sprintf(' %s="%s"', $name, $value);
315
+ }
316
+ $sub = $sub->nextSibling;
317
+ }
318
+ return $attrs;
319
+ }
320
+
321
+ /**
322
+ * Throws an exception with a localised message
323
+ *
324
+ * Named after translation function because this is the class's only output.
325
+ * Non-public to avoid too much confusion.
326
+ *
327
+ * @param string $message
328
+ * @param mixed $args
329
+ * @throws Exception
330
+ */
331
+ protected function __($message, $args = null)
332
+ {
333
+ $helper = Mage::helper('capita_ti');
334
+ $message = call_user_func_array(array($helper, '__'), func_get_args());
335
+ // TODO: custom exception types
336
+ throw new Exception($message);
337
+ }
338
+ }
app/code/community/Capita/TI/Model/Xliff/Writer.php ADDED
@@ -0,0 +1,382 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ /**
71
+ * Writes an XML file without breaking memory limits (usually)
72
+ *
73
+ * @method string getDatatype()
74
+ * @method Capita_TI_Model_Xliff_Writer setDatatype(string $datatype)
75
+ * @method Capita_TI_Model_Xliff_Writer setSourceLanguage(string $language)
76
+ */
77
+ class Capita_TI_Model_Xliff_Writer
78
+ {
79
+
80
+ const XML_NAMESPACE = 'urn:oasis:names:tc:xliff:document:1.2';
81
+ const HTM_NAMESPACE = 'urn:magento:html';
82
+ const CMS_NAMESPACE = 'urn:magento:cms';
83
+
84
+ protected $_collections = array();
85
+ protected $_attributes = array();
86
+ protected $_datatype = 'database';
87
+ protected $_sourceLanguage = 'en-GB';
88
+ protected $_autoClear = true;
89
+
90
+ /**
91
+ * Each collection becomes a <file> section when output.
92
+ *
93
+ * Collections are loaded and cleared as they are processed.
94
+ * Keys are visible as file origins.
95
+ *
96
+ * @param string $key
97
+ * @param Varien_Data_Collection $collection
98
+ * @param string[] $attributes
99
+ * @return Capita_TI_Model_Xliff_Writer $this
100
+ */
101
+ public function addCollection($key, Varien_Data_Collection $collection, $attributes)
102
+ {
103
+ $this->_collections[$key] = $collection;
104
+ $this->_attributes[$key] = $attributes;
105
+ return $this;
106
+ }
107
+
108
+ /**
109
+ * Controls clearing after writing to save memory
110
+ *
111
+ * Default is true.
112
+ * Set to false to prevent collections being cleared and possibly losing data.
113
+ *
114
+ * @param unknown $flag
115
+ */
116
+ public function setAutoClear($flag)
117
+ {
118
+ $this->_autoClear = (bool) $flag;
119
+ }
120
+
121
+ public function setDatatype($datatype)
122
+ {
123
+ $this->_datatype = (string) $datatype;
124
+ return $this;
125
+ }
126
+
127
+ public function setSourceLanguage($language)
128
+ {
129
+ $this->_sourceLanguage = strtr($language, '_', '-');
130
+ return $this;
131
+ }
132
+
133
+ /**
134
+ * Write a collection of objects to $uri as translateable sources
135
+ *
136
+ * If $uri is an array the keys should be language codes.
137
+ *
138
+ * @param array|string $uri
139
+ * @param traversable $entities
140
+ * @param string $group
141
+ * @param string[] $attributes
142
+ */
143
+ public function output($uri)
144
+ {
145
+ $uris = is_array($uri) ? $uri : array($this->_sourceLanguage => $uri);
146
+ $writers = array();
147
+ foreach ($uris as $language => $uri) {
148
+ $xml = new XMLWriter();
149
+ $xml->openUri($uri);
150
+ $xml->startDocument();
151
+ $xml->startElement('xliff');
152
+ $xml->writeAttribute('version', '1.2');
153
+ $xml->writeAttribute('xmlns', self::XML_NAMESPACE);
154
+ $xml->writeAttribute('xmlns:htm', self::HTM_NAMESPACE);
155
+ $xml->writeAttribute('xmlns:cms', self::CMS_NAMESPACE);
156
+ $writers[$language] = $xml;
157
+ }
158
+
159
+ foreach ($this->_collections as $key => $collection) {
160
+ $this->_writeCollection($writers, $key, $collection, @$this->_attributes[$key]);
161
+ }
162
+
163
+ foreach ($writers as $xml) {
164
+ // end all open elements, easier than remembering how many to do
165
+ while ($xml->endElement());
166
+ // only ever one document to end
167
+ $xml->endDocument();
168
+ $xml->flush();
169
+ // force file to close, just in case
170
+ unset($xml);
171
+ }
172
+ }
173
+
174
+ /**
175
+ * Uses a collection once, writing it's objects to potentially several files
176
+ *
177
+ * @param XMLWriter[] $writers
178
+ * @param string $original
179
+ * @param Varien_Data_Collection $collection
180
+ * @param string[] $attributes
181
+ */
182
+ protected function _writeCollection($writers, $original, Varien_Data_Collection $collection, $attributes)
183
+ {
184
+ /* @var $item Varien_Object */
185
+ foreach ($collection as $id => $item) {
186
+ foreach ($writers as $language => $xml) {
187
+ $xml->startElement('file');
188
+ $xml->writeAttribute('original', $original . '/' . ($item->getId() ? $item->getId() : $id));
189
+ $xml->writeAttribute('source-language', $this->_sourceLanguage);
190
+ $xml->writeAttribute('target-language', $language);
191
+ $xml->writeAttribute('datatype', $this->_datatype);
192
+ $xml->startElement('body');
193
+ }
194
+
195
+ // tried $item->toArray() but products still fill stock values that weren't asked for
196
+ $data = array_intersect_key(
197
+ $item->getData(),
198
+ array_fill_keys($attributes, true));
199
+ // do not translate empty values
200
+ $data = array_filter($data, 'strlen');
201
+ if ($data) {
202
+ foreach ($data as $id => $source) {
203
+ $source = $this->_getInlineXml($source);
204
+ foreach ($writers as $xml) {
205
+ $xml->startElement('trans-unit');
206
+ $xml->writeAttribute('id', $id);
207
+ $xml->startElement('source');
208
+ $xml->writeRaw($source);
209
+ $xml->endElement(); // source
210
+ $xml->startElement('target');
211
+ $xml->writeRaw($source);
212
+ $xml->endElement(); // target
213
+ $xml->endElement(); // trans-unit
214
+ }
215
+ }
216
+ }
217
+
218
+ foreach ($writers as $xml) {
219
+ $xml->endElement(); // body
220
+ $xml->endElement(); // file
221
+ }
222
+ }
223
+ if ($this->_autoClear) {
224
+ $collection->clear();
225
+ }
226
+ }
227
+
228
+ protected function _getInlineXml($source)
229
+ {
230
+ $source = str_replace("\r\n", "\n", $source);
231
+ // use second XMLWriter without a document to produce valid, raw XML
232
+ $xml = new XMLWriter();
233
+ $xml->openMemory();
234
+ // XMLWriter needs an open (albeit temporary) element for text() to work correctly
235
+ $xml->startElement('_');
236
+
237
+ // split text into array of basic HTML tags and CMS directives and text
238
+ $parts = preg_split('/(<(?:{{.*?}}|.)*?>|{{.*?}})/', $source, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
239
+ // only tag names that were parsed, used for finding closing partners
240
+ $tagStack = array();
241
+ foreach ($parts as $part) {
242
+ if (preg_match('/<(\w+)(.*?)>/', $part, $tag)) {
243
+ list(, $tagName, $attributes) = $tag;
244
+ $attributes = $this->_parseAttributes($attributes);
245
+ switch ($tagName) {
246
+ case 'area':
247
+ case 'br':
248
+ case 'col':
249
+ case 'hr':
250
+ case 'img':
251
+ case 'input':
252
+ case 'nobr':
253
+ case 'wbr':
254
+ // do not push stack since 'x' is an empty type
255
+ $this->_writeEmptyElement($xml, $tagName, $attributes);
256
+ break;
257
+ default:
258
+ $tagStack[] = $tagName;
259
+ $this->_writeGroupElement($xml, $tagName, $attributes);
260
+ }
261
+ }
262
+ elseif (preg_match('/<\/(\w+)>/', $part, $tag)) {
263
+ list(, $tagName) = $tag;
264
+ // closing tag without opening tag is ignored
265
+ if (array_search($tagName, $tagStack) === false) continue;
266
+ // pop off as many tags as necessary
267
+ do {
268
+ $xml->fullEndElement();
269
+ } while ($tagName != array_pop($tagStack));
270
+ }
271
+ elseif (preg_match('/^{{.*}}$/', $part)) {
272
+ // base64 encode all CMS directives whether opening, closing, or empty
273
+ $xml->startElement('ph');
274
+ $xml->writeAttribute('ctype', 'x-cms-directive');
275
+ if (preg_match('/{{var (.*?)}}/', $part, $variable)) {
276
+ $xml->writeAttribute('equiv-text', $variable[1]);
277
+ }
278
+ $xml->text(base64_encode($part));
279
+ $xml->endElement();
280
+ }
281
+ else {
282
+ $xml->text($part);
283
+ }
284
+ }
285
+ while ($xml->endElement());
286
+
287
+ // strip temporary holder element
288
+ return preg_replace('/^<_>(.*)<\/_>$/', '\1', $xml->outputMemory(), 1);
289
+ }
290
+
291
+ protected function _parseAttributes($text)
292
+ {
293
+ $attributes = array();
294
+ preg_match_all('/\s*(\w+)\s*=\s*("(?:{{.+?}}|.)*?"|\'(?:{{.+?}}|.)*?\'|\S+?)/', $text, $pairs, PREG_SET_ORDER);
295
+ foreach ($pairs as $pair) {
296
+ list(, $name, $val) = $pair;
297
+ $val = trim($val, '"\'');
298
+ if (preg_match('/{{.*?}}/', $val)) {
299
+ $attributes['cms:'.$name] = base64_encode($val);
300
+ }
301
+ else {
302
+ $attributes['htm:'.$name] = $val;
303
+ }
304
+ }
305
+ // TODO: generate a unique htm:id
306
+ return $attributes;
307
+ }
308
+
309
+ protected function _writeEmptyElement(XMLWriter $xml, $tagName, $attributes)
310
+ {
311
+ // translateable attributes
312
+ $subs = array_intersect_key($attributes, array(
313
+ 'htm:abbr' => true,
314
+ 'htm:alt' => true,
315
+ 'htm:content' => true,
316
+ 'htm:label' => true,
317
+ 'htm:standby' => true,
318
+ 'htm:summary' => true,
319
+ 'htm:title' => true
320
+ ));
321
+ // ignore empty values
322
+ $subs = array_filter($subs);
323
+
324
+ if ($subs) {
325
+ $xml->startElement('ph');
326
+ $xml->writeAttribute('ctype', $this->ctype($tagName));
327
+ foreach (array_diff_key($attributes, $subs) as $name => $value) {
328
+ $xml->writeAttribute($name, $value);
329
+ }
330
+ foreach ($subs as $name => $value) {
331
+ $xml->startElement('sub');
332
+ $xml->writeAttribute('ctype', "x-html-$tagName-".substr($name, 4));
333
+ $xml->text($value);
334
+ $xml->endElement();
335
+ }
336
+ $xml->endElement();
337
+ }
338
+ else {
339
+ $xml->startElement('x');
340
+ $xml->writeAttribute('ctype', $this->ctype($tagName));
341
+ foreach ($attributes as $name => $value) {
342
+ $xml->writeAttribute($name, $value);
343
+ }
344
+ $xml->endElement();
345
+ }
346
+ }
347
+
348
+ protected function _writeGroupElement(XMLWriter $xml, $tagName, $attributes)
349
+ {
350
+ $xml->startElement('g');
351
+ $xml->writeAttribute('ctype', $this->ctype($tagName));
352
+ foreach ($attributes as $name => $value) {
353
+ $xml->writeAttribute($name, $value);
354
+ }
355
+ // TODO: use <bpt> when an attribute can be translated with a <sub>
356
+ // this will be hard because it needs a matching <ept> somewhere
357
+ }
358
+
359
+ protected function ctype($tagName)
360
+ {
361
+ switch ($tagName) {
362
+ case 'img':
363
+ return 'image';
364
+ case 'hr':
365
+ return 'pb';
366
+ case 'br':
367
+ return'lb';
368
+ case 'b':
369
+ case 'strong':
370
+ return 'bold';
371
+ case 'em':
372
+ case 'i':
373
+ return 'italic';
374
+ case 'u':
375
+ return 'underline';
376
+ case 'a':
377
+ return 'link';
378
+ default:
379
+ return 'x-html-'.$tagName;
380
+ }
381
+ }
382
+ }
app/code/community/Capita/TI/Test/Model/Api/Languages.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Test_Model_Api_Languages extends EcomDev_PHPUnit_Test_Case
71
+ {
72
+
73
+ /**
74
+ * @var Zend_Http_Client_Adapter_Test
75
+ */
76
+ protected $adapter;
77
+
78
+ /**
79
+ * @var Capita_TI_Model_Api_Languages
80
+ */
81
+ protected $subject;
82
+
83
+ protected function setUp()
84
+ {
85
+ $this->adapter = new Zend_Http_Client_Adapter_Test();
86
+ $this->subject = Mage::getModel('capita_ti/api_languages', array(
87
+ 'adapter' => $this->adapter
88
+ ));
89
+ }
90
+
91
+ protected function tearDown()
92
+ {
93
+ $this->subject->clearCache();
94
+ }
95
+
96
+ /**
97
+ * @test
98
+ */
99
+ public function jsonIsGoodResponse()
100
+ {
101
+ $this->adapter->setResponse("HTTP/1.1 200 OK\r\n".
102
+ "Content-Type: application/json\r\n".
103
+ "\r\n".
104
+ '{"message":"All\'s well"}'
105
+ );
106
+ $this->assertTrue(is_array($this->subject->getLanguages()), 'JSON object is converted to array');
107
+ }
108
+
109
+ /**
110
+ * @test
111
+ * @expectedException Zend_Http_Exception
112
+ * @expectedExceptionMessage Doom
113
+ */
114
+ public function jsonCanBeErrorMessage()
115
+ {
116
+ $this->adapter->setResponse("HTTP/1.1 403 Unauthorized\r\n".
117
+ "Content-Type: application/json\r\n".
118
+ "\r\n".
119
+ '{"message":"Doom!"}'
120
+ );
121
+ $this->subject->getLanguages();
122
+ }
123
+
124
+ /**
125
+ * @test
126
+ * @expectedException Zend_Http_Exception
127
+ * @expectedExceptionMessage Unauthorized
128
+ */
129
+ public function errorMessageCanBeStatusLine()
130
+ {
131
+ $this->adapter->setResponse("HTTP/1.1 403 Unauthorized\r\n".
132
+ "Content-Type: text/plain\r\n".
133
+ "\r\n".
134
+ 'Woe is me'
135
+ );
136
+ $this->subject->getLanguages();
137
+ }
138
+
139
+ /**
140
+ * @test
141
+ * @expectedException Zend_Json_Exception
142
+ */
143
+ public function jsonMustBeWellFormed()
144
+ {
145
+ $this->adapter->setResponse("HTTP/1.1 200 OK\r\n".
146
+ "Content-Type: application/json\r\n".
147
+ "\r\n".
148
+ 'This is not JSON'
149
+ );
150
+ $this->subject->getLanguages();
151
+ }
152
+
153
+ /**
154
+ * @test
155
+ * @expectedException Zend_Http_Exception
156
+ */
157
+ public function jsonMustBeTheContentType()
158
+ {
159
+ $this->adapter->setResponse("HTTP/1.1 200 OK\r\n".
160
+ "Content-Type: text/plain\r\n".
161
+ "\r\n".
162
+ 'I am Jack\'s smirking revenge.'
163
+ );
164
+ $this->subject->getLanguages();
165
+ }
166
+
167
+ /**
168
+ * Realistic data
169
+ *
170
+ * @test
171
+ */
172
+ public function extractLanguagesFromFeed()
173
+ {
174
+ $this->adapter->setResponse("HTTP/1.1 200 OK\r\n".
175
+ "Content-Type: application/json\r\n".
176
+ "\r\n".
177
+ '[{"IsoCode":"en-US","LanguageName":"English"},{"IsoCode":"cy-GB","LanguageName":"Welsh"}]'
178
+ );
179
+ $languages = $this->subject->getLanguages();
180
+ $this->assertTrue(is_array($languages), 'JSON object is converted to array');
181
+ $this->assertNotEmpty($languages, 'At least one entry');
182
+ $this->assertContainsOnly('string', $languages);
183
+ $this->assertArrayHasKey('cy_GB', $languages, 'IsoCode is converted to local convention');
184
+ $this->assertEquals('Welsh', @$languages['cy_GB']);
185
+
186
+ // assume US English because EComDev builds database from install scripts and they always start with en_US store
187
+ $usefulLanguages = $this->subject->getLanguagesInUse();
188
+ $this->assertTrue(is_array($usefulLanguages));
189
+ $this->assertCount(1, $usefulLanguages);
190
+ $this->assertArrayHasKey('en_US', $usefulLanguages);
191
+ }
192
+ }
app/code/community/Capita/TI/Test/Model/Api/Requests.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Test_Model_Api_Requests extends EcomDev_PHPUnit_Test_Case
71
+ {
72
+
73
+ /**
74
+ * @var Capita_TI_Model_Api_Requests
75
+ */
76
+ protected $subject;
77
+
78
+ protected function setUp()
79
+ {
80
+ $this->subject = Mage::getModel('capita_ti/api_requests', array(
81
+ 'adapter' => Mage::getModel('capita_ti/api_adapter_samplePostRequest')
82
+ ));
83
+ }
84
+
85
+ /**
86
+ * Data copied from API spec.
87
+ *
88
+ * @see https://api.capitatranslationinterpreting.com/
89
+ * @test
90
+ */
91
+ public function newRequestReturnsStatusInfo()
92
+ {
93
+ $case = new Zend_Controller_Request_HttpTestCase();
94
+ $case->setMethod('POST');
95
+ $case->setParam('source_language', 'en_US');
96
+ $case->setParam('dest_language', array('fr_FR'));
97
+ $case->setParam('product_ids', '1');
98
+ $case->setParam('product_attributes', array('name', 'description'));
99
+
100
+ $request = $this->subject->startNewRequest($case);
101
+ $this->assertInstanceOf('Capita_TI_Model_Request', $request);
102
+ $this->assertTrue($request->hasData() && $request->hasDataChanges(), 'Request model has been populated');
103
+ $this->assertEquals('1250936094-13321', $request->getRemoteId());
104
+ $this->assertEquals('CTI-160302-1', $request->getRemoteNo());
105
+ $this->assertEquals('onHold', $request->getStatus());
106
+ $this->assertCount(2, $request->getDocuments());
107
+ $request->delete();
108
+ }
109
+ }
app/code/community/Capita/TI/Test/Model/Xliff/Writer.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Test_Model_Xliff_Writer extends EcomDev_PHPUnit_Test_Case
71
+ {
72
+
73
+ /**
74
+ * @var string
75
+ */
76
+ protected $filename;
77
+
78
+ /**
79
+ * @var Capita_TI_Model_Xliff_Writer
80
+ */
81
+ protected $writer;
82
+
83
+ /**
84
+ * @var DomDocument
85
+ */
86
+ protected $document;
87
+
88
+ protected function setUp()
89
+ {
90
+ $this->filename = tempnam(sys_get_temp_dir(), 'mgxliff');
91
+ touch($this->filename);
92
+ $this->writer = Mage::getModel('capita_ti/xliff_writer');
93
+ }
94
+
95
+ protected function tearDown()
96
+ {
97
+ unlink($this->filename);
98
+ unset($this->document);
99
+ }
100
+
101
+ protected function assertXPathMatches($expected, $path, $message = null)
102
+ {
103
+ if (!$this->document) {
104
+ $this->document = new DOMDocument();
105
+ $this->document->load($this->filename);
106
+ }
107
+ $xpath = new DOMXPath($this->document);
108
+ $xpath->registerNamespace('x', Capita_TI_Model_Xliff_Writer::XML_NAMESPACE);
109
+ $xpath->registerNamespace('h', Capita_TI_Model_Xliff_Writer::HTM_NAMESPACE);
110
+ $xpath->registerNamespace('c', Capita_TI_Model_Xliff_Writer::CMS_NAMESPACE);
111
+ $this->assertEquals($expected, $xpath->evaluate($path), $message);
112
+ }
113
+
114
+ /**
115
+ * @test
116
+ */
117
+ public function xmlHasBasicStructure()
118
+ {
119
+ $collection = new Varien_Data_Collection();
120
+ $collection->addItem(new Varien_Object());
121
+ $this->writer->addCollection('foo', $collection, array());
122
+ $this->writer->output($this->filename);
123
+ $this->assertXPathMatches(1, 'count(/x:xliff)', 'Document starts with "xliff" element');
124
+ $this->assertXPathMatches(1, 'count(/x:xliff/x:file[@original="foo/0"])', 'Document has one "file" element');
125
+ $this->assertXPathMatches(1, 'count(/x:xliff/x:file/x:body)', 'Document has one "body" element');
126
+ }
127
+
128
+ /**
129
+ * @test
130
+ */
131
+ public function attributesAreIncluded()
132
+ {
133
+ $cupboard = new Varien_Data_Collection();
134
+ $cupboard->addItem(new Varien_Object(array(
135
+ 'type'=>'A cup',
136
+ )));
137
+ $this->writer->addCollection('cupboard', $cupboard, array('type'));
138
+ $this->writer->output($this->filename);
139
+ $this->assertXPathMatches('A cup', 'string(//x:trans-unit[@id="type"]/x:source)', 'Trans unit IDs are attribute key');
140
+ }
141
+
142
+ /**
143
+ * @test
144
+ */
145
+ public function attributesAreExcluded()
146
+ {
147
+ $cupboard = new Varien_Data_Collection();
148
+ $cupboard->addItem(new Varien_Object(array(
149
+ 'name'=>'World\'s best dad mug',
150
+ 'type'=>'A cup',
151
+ 'description'=>'A modern classic'
152
+ )));
153
+ $this->writer->addCollection('cupboard', $cupboard, array('type', 'description', 'imaginary'));
154
+ $this->writer->output($this->filename);
155
+ $this->assertXPathMatches(2, 'count(//x:source)', 'Attributes are filterable');
156
+ $this->assertXPathMatches('A cup', 'string(//x:trans-unit[@id="type"]/x:source)');
157
+ $this->assertXPathMatches('A modern classic', 'string(//x:trans-unit[@id="description"]/x:source)');
158
+ }
159
+
160
+ /**
161
+ * @test
162
+ */
163
+ public function htmlIsEscaped()
164
+ {
165
+ $cupboard = new Varien_Data_Collection();
166
+ $cupboard->addItem(new Varien_Object(array(
167
+ 'type'=>'A <em>big</em> cup',
168
+ )));
169
+ $this->writer->addCollection('cupboard', $cupboard, array('type'));
170
+ $this->writer->output($this->filename);
171
+ $this->assertXPathMatches('A big cup', 'string(//x:source)', 'HTML tags are encoded');
172
+ $this->assertXPathMatches('big', 'string(//x:source/x:g[@ctype="italic"])', 'HTML tags are namespaced');
173
+ }
174
+
175
+ /**
176
+ * @test
177
+ */
178
+ public function entitiesAreHtmlEncoded()
179
+ {
180
+ $cupboard = new Varien_Data_Collection();
181
+ $cupboard->addItem(new Varien_Object(array(
182
+ 'type'=>'Knife & Fork',
183
+ )));
184
+ $this->writer->addCollection('cupboard', $cupboard, array('type'));
185
+ $this->writer->output($this->filename);
186
+ // if ampersand isn't encoded then an exception is thrown
187
+ $this->assertXPathMatches('Knife & Fork', 'string(//x:source)', 'HTML entities are encoded');
188
+ }
189
+ }
app/code/community/Capita/TI/Test/Model/Xliff/Writer2.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Test_Model_Xliff_Writer2 extends EcomDev_PHPUnit_Test_Case
71
+ {
72
+
73
+ /**
74
+ * @var string[]
75
+ */
76
+ protected $filenames;
77
+
78
+ /**
79
+ * @var Capita_TI_Model_Xliff_Writer
80
+ */
81
+ protected $writer;
82
+
83
+ /**
84
+ * @var DomDocument[]
85
+ */
86
+ protected $documents;
87
+
88
+ protected function setUp()
89
+ {
90
+ $this->filenames['fr'] = tempnam(sys_get_temp_dir(), 'mgxliff');
91
+ $this->filenames['de'] = tempnam(sys_get_temp_dir(), 'mgxliff');
92
+ foreach ($this->filenames as $filename) touch($filename);
93
+ $this->writer = Mage::getModel('capita_ti/xliff_writer');
94
+ }
95
+
96
+ protected function tearDown()
97
+ {
98
+ foreach ($this->filenames as $filename) unlink($filename);
99
+ unset($this->document);
100
+ }
101
+
102
+ protected function assertXPathMatches($expected, $language, $path, $message = null)
103
+ {
104
+ if (!@$this->documents[$language]) {
105
+ $this->documents[$language] = new DOMDocument();
106
+ $this->documents[$language]->load($this->filenames[$language]);
107
+ }
108
+ $xpath = new DOMXPath($this->documents[$language]);
109
+ $xpath->registerNamespace('x', Capita_TI_Model_Xliff_Writer::XML_NAMESPACE);
110
+ $this->assertEquals($expected, $xpath->evaluate($path), $message);
111
+ }
112
+
113
+ /**
114
+ * @test
115
+ */
116
+ public function writesTwoFiles()
117
+ {
118
+ $collection = new Varien_Data_Collection();
119
+ $collection->addItem(new Varien_Object());
120
+ $this->writer->addCollection('foo', $collection, array());
121
+ $this->writer->output($this->filenames);
122
+ $this->assertXPathMatches(1, 'fr', 'count(/x:xliff)', 'Document starts with "xliff" element');
123
+ $this->assertXPathMatches(1, 'de', 'count(/x:xliff)', 'Document starts with "xliff" element');
124
+ }
125
+ }
app/code/community/Capita/TI/controllers/Adminhtml/Capita/RequestController.php ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Adminhtml_Capita_RequestController extends Capita_TI_Controller_Action
71
+ {
72
+
73
+ const MENU_PATH = 'system/capita_request';
74
+
75
+ public function preDispatch()
76
+ {
77
+ parent::preDispatch();
78
+
79
+ // might be called on any page, even by AJAX
80
+ // can be used to refresh all or just one
81
+ if ($this->getRequest()->getParam('refresh') == 'status') {
82
+ try {
83
+ $id = $this->getRequest()->getParam('id');
84
+ /* @var $client Capita_TI_Model_Api_Requests */
85
+ $client = Mage::getModel('capita_ti/api_requests', array(
86
+ 'keepalive' => true
87
+ ));
88
+ if ($id) {
89
+ /* @var $request Capita_TI_Model_Request */
90
+ $request = Mage::getModel('capita_ti/request')->load($id);
91
+ if ($request->canUpdate()) {
92
+ $client->updateRequest($request);
93
+ }
94
+ }
95
+ else {
96
+ /* @var $requests Capita_TI_Model_Resource_Request_Collection */
97
+ $requests = Mage::getResourceModel('capita_ti/request_collection');
98
+ $requests->addRemoteFilter();
99
+ foreach ($requests as $request) {
100
+ if ($request->canUpdate()) {
101
+ $client->updateRequest($request);
102
+ }
103
+ }
104
+ }
105
+ }
106
+ catch (Exception $e) {
107
+ $this->_getSession()->addException($e, $this->__('There was a problem connecting to the server: %s', $e->getMessage()));
108
+ }
109
+ }
110
+
111
+ return $this;
112
+ }
113
+
114
+ public function indexAction()
115
+ {
116
+ $this->loadLayout();
117
+ $this->_checkConnection();
118
+ $this->_title($this->__('Capita Translations'))
119
+ ->_title($this->__('Requests'))
120
+ ->_setActiveMenu(self::MENU_PATH);
121
+ $this->renderLayout();
122
+ }
123
+
124
+ public function gridAction()
125
+ {
126
+ $this->loadLayout(array('default', 'adminhtml_capita_request_index'));
127
+ $this->getResponse()->setBody(
128
+ $this->getLayout()->getBlock('adminhtml_request.grid')->toHtml());
129
+ }
130
+
131
+ public function newAction()
132
+ {
133
+ $this->loadLayout();
134
+ $this->_checkConnection();
135
+ $this->_title($this->__('Capita Translations'))
136
+ ->_title($this->__('New Request'))
137
+ ->_setActiveMenu(self::MENU_PATH);
138
+ $this->renderLayout();
139
+ }
140
+
141
+ public function productsTabAction()
142
+ {
143
+ $this->loadLayout();
144
+ $this->renderLayout();
145
+ }
146
+
147
+ public function productsGridAction()
148
+ {
149
+ $this->loadLayout();
150
+ $this->getLayout()->getBlock('request_tab_products_grid')->setEntityIds(
151
+ $this->getRequest()->getParam('product_ids', array()));
152
+ $this->renderLayout();
153
+ }
154
+
155
+ public function attributesTabAction()
156
+ {
157
+ $this->loadLayout();
158
+ $this->renderLayout();
159
+ }
160
+
161
+ public function attributesGridAction()
162
+ {
163
+ $this->loadLayout();
164
+ $this->getLayout()->getBlock('request_tab_attributes_grid')->setEntityIds(
165
+ $this->getRequest()->getParam('attribute_ids', array()));
166
+ $this->renderLayout();
167
+ }
168
+
169
+ public function categoriesTabAction()
170
+ {
171
+ $this->loadLayout();
172
+ $this->renderLayout();
173
+ }
174
+
175
+ public function categoriesGridAction()
176
+ {
177
+ $this->loadLayout();
178
+ $this->getLayout()->getBlock('request_tab_categories_grid')->setEntityIds(
179
+ $this->getRequest()->getParam('category_ids', array()));
180
+ $this->renderLayout();
181
+ }
182
+
183
+ public function blocksTabAction()
184
+ {
185
+ $this->loadLayout();
186
+ $this->renderLayout();
187
+ }
188
+
189
+ public function blocksGridAction()
190
+ {
191
+ $this->loadLayout();
192
+ $this->getLayout()->getBlock('request_tab_blocks_grid')->setEntityIds(
193
+ $this->getRequest()->getParam('block_ids', array()));
194
+ $this->renderLayout();
195
+ }
196
+
197
+ public function pagesTabAction()
198
+ {
199
+ $this->loadLayout();
200
+ $this->renderLayout();
201
+ }
202
+
203
+ public function pagesGridAction()
204
+ {
205
+ $this->loadLayout();
206
+ $this->getLayout()->getBlock('request_tab_pages_grid')->setEntityIds(
207
+ $this->getRequest()->getParam('page_ids', array()));
208
+ $this->renderLayout();
209
+ }
210
+
211
+ public function deleteAction()
212
+ {
213
+ try {
214
+ $requestId = $this->getRequest()->getParam('id');
215
+ /* @var $request Capita_TI_Model_Request */
216
+ $request = Mage::getModel('capita_ti/request')->load($requestId);
217
+ if (!$request->isObjectNew() && $request->canDelete()) {
218
+ $request->delete();
219
+ $this->_getSession()->addSuccess($this->__('Request "%s" has been deleted', $request->getRemoteNo()));
220
+ }
221
+ }
222
+ catch (Exception $e) {
223
+ Mage::logException($e);
224
+ $this->_getSession()->addError($e->getMessage());
225
+ }
226
+ $this->_redirect('*/*');
227
+ }
228
+
229
+ public function saveAction()
230
+ {
231
+ try {
232
+ /* @var $requests Capita_TI_Model_Api_Requests */
233
+ $requests = Mage::getModel('capita_ti/api_requests', array(
234
+ // enable following line to test without submitting to real API
235
+ // 'adapter' => Mage::getModel('capita_ti/api_adapter_samplePostRequest')
236
+ ));
237
+ $request = $requests->startNewRequest($this->getRequest());
238
+ $request->save();
239
+ $this->_getSession()->unsCapitaProductIds();
240
+ $this->_getSession()->addSuccess($this->__('Request "%s" has been started', $request->getRemoteNo()));
241
+
242
+ Mage::getModel('capita_ti/email')->sendFirstUse();
243
+
244
+ $this->_redirect('*/*');
245
+ }
246
+ catch (Exception $e) {
247
+ Mage::logException($e);
248
+ $this->_getSession()->addError($e->getMessage());
249
+ $this->_redirectReferer($this->getUrl('*/*'));
250
+ }
251
+ }
252
+
253
+ public function viewAction()
254
+ {
255
+ try {
256
+ $requestId = (int) $this->getRequest()->getParam('id');
257
+ $request = Mage::getModel('capita_ti/request')->load($requestId);
258
+ if ($request->isObjectNew()) {
259
+ throw new Mage_Adminhtml_Exception($this->__('Request "%d" is unavailable', $requestId));
260
+ }
261
+ Mage::register('capita_request', $request);
262
+
263
+ $this->loadLayout();
264
+ $this->_checkConnection();
265
+ $this->_title($this->__('Capita Translations'))
266
+ ->_title($this->__('Request "%s"', $request->getRemoteNo()))
267
+ ->_setActiveMenu(self::MENU_PATH);
268
+ $this->renderLayout();
269
+ }
270
+ catch (Mage_Core_Exception $e) {
271
+ $this->_getSession()->addError($e->getMessage());
272
+ $this->_redirect('*/*');
273
+ }
274
+ }
275
+ }
app/code/community/Capita/TI/controllers/Adminhtml/Catalog/ProductController.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ class Capita_TI_Adminhtml_Catalog_ProductController extends Capita_TI_Controller_Action
71
+ {
72
+
73
+ public function translateAction()
74
+ {
75
+ try {
76
+ if ($this->getRequest()->isPost()) {
77
+ $productIds = (array)$this->getRequest()->getParam('product');
78
+ if (!$productIds) {
79
+ throw new Mage_Core_Exception($this->__('No products were selected'));
80
+ }
81
+ $this->_getSession()->setCapitaProductIds($productIds);
82
+ }
83
+
84
+ $this->loadLayout();
85
+ $this->_checkConnection();
86
+ $this->_title($this->__('Catalog'))
87
+ ->_title($this->__('Products'))
88
+ ->_title($this->__('Translate'))
89
+ ->_setActiveMenu('catalog/product');
90
+ $this->renderLayout();
91
+ }
92
+ catch (Mage_Core_Exception $e) {
93
+ $this->_getSession()->addError($e->getMessage());
94
+ $this->_redirectReferer($this->getUrl('*/catalog_product'));
95
+ }
96
+ catch (Exception $e) {
97
+ Mage::logException($e);
98
+ }
99
+ }
100
+
101
+ }
app/code/community/Capita/TI/data/capita_ti_setup/data-upgrade-0.3.0-0.3.1.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ /* @var $this Mage_Core_Model_Resource_Setup */
71
+
72
+ // compute possible target locale codes
73
+ $languages = Mage::helper('capita_ti')->getNonDefaultLocales();
74
+ if (!$languages) return;
75
+ $languageSelects = array();
76
+
77
+ foreach ($languages as $language) {
78
+ $languageSelects[] = new Zend_Db_Expr('SELECT '.$this->getConnection()->quote($language).' AS language');
79
+ }
80
+ $unionSelect = $this->getConnection()->select()->union($languageSelects);
81
+
82
+ $tables = array(
83
+ 'capita_ti/block_diff' => 'block_id',
84
+ 'capita_ti/page_diff' => 'page_id',
85
+ 'capita_ti/category_diff' => 'entity_id',
86
+ 'capita_ti/product_diff' => 'entity_id');
87
+
88
+ foreach ($tables as $tableAlias => $idField) {
89
+ $tableName = $this->getTable($tableAlias);
90
+ $this->getConnection()->query($this->getConnection()->select()
91
+ ->from($tableName, array($idField, 'attribute', 'old_md5'))
92
+ ->joinCross($unionSelect, 'language')
93
+ ->insertIgnoreFromSelect($tableName, array($idField, 'attribute', 'old_md5', 'language')));
94
+ $this->getConnection()->delete($tableName, 'language = ""');
95
+ }
app/code/community/Capita/TI/etc/adminhtml.xml ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ SmartMATE Magento Connect Terms of Use
4
+
5
+ 1. Agreement to these Terms of use
6
+ These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ not relate to any other Capita Translation and Interpreting Limited
8
+ (“Capita”) website or service or your use of any other Capita website or
9
+ service and these Terms do not govern your use of the language services you may
10
+ wish to receive from Capita.
11
+ By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ to these Terms and you represent that you have the legal authority to accept
13
+ the Terms on behalf of yourself and any party you represent.
14
+
15
+ 2. Intellectual property Rights
16
+ All Intellectual Property Rights (including but not limited to trademarks,
17
+ copyright (including rights in computer software), trade secrets, trade or
18
+ business names, domain names and other similar rights or obligations whether
19
+ registerable or not in any country and applications for any of the foregoing)
20
+ in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ sold, distributed or edited.
23
+
24
+ 3. NO WARRANTY
25
+ THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ PARTICULAR PURPOSE.
30
+ CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ RELIABILITY, OR OTHERWISE.
36
+ You are solely responsible for determining the appropriateness of using the
37
+ SmartMATE Magento Connect and you assume all risks associated with this,
38
+ including but not limited compliance with applicable laws, damage to or loss of
39
+ data, programs or equipment, and unavailability or interruption of operations.
40
+ YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+
42
+ 4. LIMITATION OF LIABILITY
43
+ IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+
52
+ 5. Indemnification for breach of the Terms
53
+ You agree to indemnify and hold harmless Capita from and against any and all
54
+ loss, expenses, damages, and costs, including without limitation reasonable
55
+ attorney fees, resulting, whether directly or indirectly, from your violation
56
+ of the Terms.
57
+
58
+ 6. General
59
+ These Terms are governed by and shall be construed in accordance with English
60
+ law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ If any provision of these Terms is invalid or unenforceable under applicable
62
+ law, it shall not affect the validity or enforceability of the remainder of the
63
+ terms of these Terms and such provision shall be reformed to the minimum extent
64
+ necessary to make such provision valid and enforceable.
65
+ -->
66
+ <config>
67
+ <menu>
68
+ <system>
69
+ <children>
70
+ <capita_request translate="title" module="capita_ti">
71
+ <title>Capita Translations</title>
72
+ <action>adminhtml/capita_request</action>
73
+ <sort_order>35</sort_order>
74
+ </capita_request>
75
+ </children>
76
+ </system>
77
+ </menu>
78
+ <acl>
79
+ <resources>
80
+ <admin>
81
+ <children>
82
+ <system>
83
+ <children>
84
+ <capita_request translate="title" module="capita_ti">
85
+ <title>Capita Translations</title>
86
+ <sort_order>28</sort_order>
87
+ </capita_request>
88
+ <config>
89
+ <children>
90
+ <capita_ti>
91
+ <title>Capita Translations</title>
92
+ <sort_order>70</sort_order>
93
+ </capita_ti>
94
+ </children>
95
+ </config>
96
+ </children>
97
+ </system>
98
+ </children>
99
+ </admin>
100
+ </resources>
101
+ </acl>
102
+ </config>
app/code/community/Capita/TI/etc/config.xml ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!--
3
+ SmartMATE Magento Connect Terms of Use
4
+
5
+ 1. Agreement to these Terms of use
6
+ These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ not relate to any other Capita Translation and Interpreting Limited
8
+ (“Capita”) website or service or your use of any other Capita website or
9
+ service and these Terms do not govern your use of the language services you may
10
+ wish to receive from Capita.
11
+ By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ to these Terms and you represent that you have the legal authority to accept
13
+ the Terms on behalf of yourself and any party you represent.
14
+
15
+ 2. Intellectual property Rights
16
+ All Intellectual Property Rights (including but not limited to trademarks,
17
+ copyright (including rights in computer software), trade secrets, trade or
18
+ business names, domain names and other similar rights or obligations whether
19
+ registerable or not in any country and applications for any of the foregoing)
20
+ in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ sold, distributed or edited.
23
+
24
+ 3. NO WARRANTY
25
+ THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ PARTICULAR PURPOSE.
30
+ CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ RELIABILITY, OR OTHERWISE.
36
+ You are solely responsible for determining the appropriateness of using the
37
+ SmartMATE Magento Connect and you assume all risks associated with this,
38
+ including but not limited compliance with applicable laws, damage to or loss of
39
+ data, programs or equipment, and unavailability or interruption of operations.
40
+ YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+
42
+ 4. LIMITATION OF LIABILITY
43
+ IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+
52
+ 5. Indemnification for breach of the Terms
53
+ You agree to indemnify and hold harmless Capita from and against any and all
54
+ loss, expenses, damages, and costs, including without limitation reasonable
55
+ attorney fees, resulting, whether directly or indirectly, from your violation
56
+ of the Terms.
57
+
58
+ 6. General
59
+ These Terms are governed by and shall be construed in accordance with English
60
+ law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ If any provision of these Terms is invalid or unenforceable under applicable
62
+ law, it shall not affect the validity or enforceability of the remainder of the
63
+ terms of these Terms and such provision shall be reformed to the minimum extent
64
+ necessary to make such provision valid and enforceable.
65
+ -->
66
+ <config>
67
+ <modules>
68
+ <Capita_TI>
69
+ <version>1.0.0</version>
70
+ </Capita_TI>
71
+ </modules>
72
+
73
+ <global>
74
+ <blocks>
75
+ <capita_ti>
76
+ <class>Capita_TI_Block</class>
77
+ </capita_ti>
78
+ </blocks>
79
+ <helpers>
80
+ <capita_ti>
81
+ <class>Capita_TI_Helper</class>
82
+ </capita_ti>
83
+ </helpers>
84
+ <models>
85
+ <capita_ti>
86
+ <class>Capita_TI_Model</class>
87
+ <resourceModel>capita_ti_resource</resourceModel>
88
+ </capita_ti>
89
+ <capita_ti_resource>
90
+ <class>Capita_TI_Model_Resource</class>
91
+ <entities>
92
+ <request>
93
+ <table>capita_ti_request</table>
94
+ </request>
95
+ <document>
96
+ <table>capita_ti_document</table>
97
+ </document>
98
+ <block>
99
+ <table>capita_ti_block</table>
100
+ </block>
101
+ <category>
102
+ <table>capita_ti_category</table>
103
+ </category>
104
+ <page>
105
+ <table>capita_ti_page</table>
106
+ </page>
107
+ <product>
108
+ <table>capita_ti_product</table>
109
+ </product>
110
+ <attribute>
111
+ <table>capita_ti_attribute</table>
112
+ </attribute>
113
+ <attribute_diff>
114
+ <table>capita_ti_attribute_diff</table>
115
+ </attribute_diff>
116
+ <block_diff>
117
+ <table>capita_ti_block_diff</table>
118
+ </block_diff>
119
+ <category_diff>
120
+ <table>capita_ti_category_diff</table>
121
+ </category_diff>
122
+ <page_diff>
123
+ <table>capita_ti_page_diff</table>
124
+ </page_diff>
125
+ <product_diff>
126
+ <table>capita_ti_product_diff</table>
127
+ </product_diff>
128
+ </entities>
129
+ </capita_ti_resource>
130
+ </models>
131
+ <resources>
132
+ <capita_ti_setup>
133
+ <setup>
134
+ <module>Capita_TI</module>
135
+ </setup>
136
+ </capita_ti_setup>
137
+ </resources>
138
+ </global>
139
+
140
+ <admin>
141
+ <routers>
142
+ <adminhtml>
143
+ <args>
144
+ <modules>
145
+ <capita_ti before="Mage_Adminhtml">Capita_TI_Adminhtml</capita_ti>
146
+ </modules>
147
+ </args>
148
+ </adminhtml>
149
+ </routers>
150
+ </admin>
151
+
152
+ <adminhtml>
153
+ <events>
154
+ <!-- Add 'translate' action to 'manage products' page -->
155
+ <adminhtml_catalog_product_grid_prepare_massaction>
156
+ <observers>
157
+ <capita_ti_translate_action>
158
+ <class>capita_ti/observer</class>
159
+ <method>addMassActionToBlock</method>
160
+ </capita_ti_translate_action>
161
+ </observers>
162
+ </adminhtml_catalog_product_grid_prepare_massaction>
163
+
164
+ <!-- Check if entity is being processed remotely -->
165
+ <controller_action_layout_render_before_adminhtml_catalog_product_edit>
166
+ <observers>
167
+ <capita_ti_warn>
168
+ <class>capita_ti/observer</class>
169
+ <method>warnProductInProgress</method>
170
+ </capita_ti_warn>
171
+ </observers>
172
+ </controller_action_layout_render_before_adminhtml_catalog_product_edit>
173
+ <controller_action_layout_render_before_adminhtml_catalog_product_action_attribute_edit>
174
+ <observers>
175
+ <capita_ti_warn>
176
+ <class>capita_ti/observer</class>
177
+ <method>warnProductsInProgress</method>
178
+ </capita_ti_warn>
179
+ </observers>
180
+ </controller_action_layout_render_before_adminhtml_catalog_product_action_attribute_edit>
181
+ <adminhtml_catalog_category_tabs>
182
+ <observers>
183
+ <capita_ti_warn>
184
+ <class>capita_ti/observer</class>
185
+ <method>warnCategoryInProgress</method>
186
+ </capita_ti_warn>
187
+ </observers>
188
+ </adminhtml_catalog_category_tabs>
189
+ <category_prepare_ajax_response>
190
+ <observers>
191
+ <capita_ti_unwarn>
192
+ <class>capita_ti/observer</class>
193
+ <method>unwarnCategoryInProgress</method>
194
+ </capita_ti_unwarn>
195
+ </observers>
196
+ </category_prepare_ajax_response>
197
+ <controller_action_layout_render_before_adminhtml_cms_block_edit>
198
+ <observers>
199
+ <capita_ti_warn>
200
+ <class>capita_ti/observer</class>
201
+ <method>warnBlockInProgress</method>
202
+ </capita_ti_warn>
203
+ </observers>
204
+ </controller_action_layout_render_before_adminhtml_cms_block_edit>
205
+ <controller_action_layout_render_before_adminhtml_cms_page_edit>
206
+ <observers>
207
+ <capita_ti_warn>
208
+ <class>capita_ti/observer</class>
209
+ <method>warnPageInProgress</method>
210
+ </capita_ti_warn>
211
+ </observers>
212
+ </controller_action_layout_render_before_adminhtml_cms_page_edit>
213
+
214
+ <!-- Track content changes -->
215
+ <model_save_after>
216
+ <observers>
217
+ <capita_ti_track>
218
+ <class>capita_ti/tracker</class>
219
+ <method>modelSaveAfter</method>
220
+ </capita_ti_track>
221
+ </observers>
222
+ </model_save_after>
223
+ <catalog_category_save_after>
224
+ <observers>
225
+ <capita_ti_track>
226
+ <class>capita_ti/tracker</class>
227
+ <method>categorySaveAfter</method>
228
+ </capita_ti_track>
229
+ </observers>
230
+ </catalog_category_save_after>
231
+ <cms_page_save_after>
232
+ <observers>
233
+ <capita_ti_track>
234
+ <class>capita_ti/tracker</class>
235
+ <method>pageSaveAfter</method>
236
+ </capita_ti_track>
237
+ </observers>
238
+ </cms_page_save_after>
239
+ <catalog_product_save_after>
240
+ <observers>
241
+ <capita_ti_track>
242
+ <class>capita_ti/tracker</class>
243
+ <method>productSaveAfter</method>
244
+ </capita_ti_track>
245
+ </observers>
246
+ </catalog_product_save_after>
247
+ <catalog_entity_attribute_save_before>
248
+ <observers>
249
+ <capita_ti_track>
250
+ <class>capita_ti/tracker</class>
251
+ <method>attributeSaveAfter</method>
252
+ </capita_ti_track>
253
+ </observers>
254
+ </catalog_entity_attribute_save_before>
255
+ </events>
256
+ <layout>
257
+ <updates>
258
+ <capita_ti>
259
+ <file>capita_ti.xml</file>
260
+ </capita_ti>
261
+ </updates>
262
+ </layout>
263
+ <translate>
264
+ <modules>
265
+ <Capita_TI>
266
+ <files>
267
+ <default>Capita_TI.csv</default>
268
+ </files>
269
+ </Capita_TI>
270
+ </modules>
271
+ </translate>
272
+ </adminhtml>
273
+
274
+ <phpunit>
275
+ <suite>
276
+ <modules>
277
+ <Capita_TI />
278
+ </modules>
279
+ </suite>
280
+ </phpunit>
281
+
282
+ <default>
283
+ <crontab>
284
+ <jobs>
285
+ <capita_ti_refresh>
286
+ <run>
287
+ <model>capita_ti/observer::cronRefresh</model>
288
+ </run>
289
+ </capita_ti_refresh>
290
+ <capita_ti_import>
291
+ <run>
292
+ <model>capita_ti/observer::cronImport</model>
293
+ </run>
294
+ </capita_ti_import>
295
+ <capita_ti_purge>
296
+ <run>
297
+ <model>capita_ti/observer::cronPurge</model>
298
+ </run>
299
+ </capita_ti_purge>
300
+ </jobs>
301
+ </crontab>
302
+
303
+ <capita_ti>
304
+ <base_url><![CDATA[https://api.capitatranslationinterpreting.com/api/v1.0]]></base_url>
305
+ <first_use_email>jake.mason@5ms.uk.com,tom.shaw2@capita.co.uk,presales@capita-ti.com</first_use_email>
306
+
307
+ <scheduling>
308
+ <refresh>hourly</refresh>
309
+ <import>always</import>
310
+ <export>never</export>
311
+ <purge>never</purge>
312
+ </scheduling>
313
+ <products>
314
+ <attributes>description,image_label,meta_description,meta_keyword,meta_title,name,short_description,small_image_label,thumbnail_label</attributes>
315
+ </products>
316
+ <categories>
317
+ <attributes>description,meta_description,meta_keywords,meta_title,name</attributes>
318
+ </categories>
319
+ </capita_ti>
320
+ </default>
321
+ </config>
app/code/community/Capita/TI/etc/system.xml ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ SmartMATE Magento Connect Terms of Use
4
+
5
+ 1. Agreement to these Terms of use
6
+ These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ not relate to any other Capita Translation and Interpreting Limited
8
+ (“Capita”) website or service or your use of any other Capita website or
9
+ service and these Terms do not govern your use of the language services you may
10
+ wish to receive from Capita.
11
+ By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ to these Terms and you represent that you have the legal authority to accept
13
+ the Terms on behalf of yourself and any party you represent.
14
+
15
+ 2. Intellectual property Rights
16
+ All Intellectual Property Rights (including but not limited to trademarks,
17
+ copyright (including rights in computer software), trade secrets, trade or
18
+ business names, domain names and other similar rights or obligations whether
19
+ registerable or not in any country and applications for any of the foregoing)
20
+ in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ sold, distributed or edited.
23
+
24
+ 3. NO WARRANTY
25
+ THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ PARTICULAR PURPOSE.
30
+ CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ RELIABILITY, OR OTHERWISE.
36
+ You are solely responsible for determining the appropriateness of using the
37
+ SmartMATE Magento Connect and you assume all risks associated with this,
38
+ including but not limited compliance with applicable laws, damage to or loss of
39
+ data, programs or equipment, and unavailability or interruption of operations.
40
+ YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+
42
+ 4. LIMITATION OF LIABILITY
43
+ IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+
52
+ 5. Indemnification for breach of the Terms
53
+ You agree to indemnify and hold harmless Capita from and against any and all
54
+ loss, expenses, damages, and costs, including without limitation reasonable
55
+ attorney fees, resulting, whether directly or indirectly, from your violation
56
+ of the Terms.
57
+
58
+ 6. General
59
+ These Terms are governed by and shall be construed in accordance with English
60
+ law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ If any provision of these Terms is invalid or unenforceable under applicable
62
+ law, it shall not affect the validity or enforceability of the remainder of the
63
+ terms of these Terms and such provision shall be reformed to the minimum extent
64
+ necessary to make such provision valid and enforceable.
65
+ -->
66
+ <config>
67
+
68
+ <tabs>
69
+ <capita translate="label" module="capita_ti">
70
+ <label>Capita</label>
71
+ <sort_order>500</sort_order>
72
+ </capita>
73
+ </tabs>
74
+
75
+ <sections>
76
+ <capita_ti translate="label" module="capita_ti">
77
+ <tab>capita</tab>
78
+ <class>separator-top</class>
79
+ <label>Capita Translations</label>
80
+ <sort_order>100</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+
83
+ <groups>
84
+ <authentication translate="label">
85
+ <label>Authentication</label>
86
+ <sort_order>100</sort_order>
87
+ <show_in_default>1</show_in_default>
88
+ <expanded>1</expanded>
89
+
90
+ <fields>
91
+ <username translate="label">
92
+ <label>Username</label>
93
+ <frontend_type>text</frontend_type>
94
+ <frontend_class>required-entry</frontend_class>
95
+ <sort_order>10</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ </username>
98
+ <password translate="label">
99
+ <label>Password</label>
100
+ <frontend_type>obscure</frontend_type>
101
+ <frontend_class>required-entry</frontend_class>
102
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
103
+ <sort_order>20</sort_order>
104
+ <show_in_default>1</show_in_default>
105
+ </password>
106
+ <customer_name translate="label">
107
+ <label>Customer Name</label>
108
+ <frontend_type>text</frontend_type>
109
+ <frontend_class>required-entry</frontend_class>
110
+ <sort_order>30</sort_order>
111
+ <show_in_default>1</show_in_default>
112
+ </customer_name>
113
+ <contact_name translate="label">
114
+ <label>Contact Name</label>
115
+ <frontend_type>text</frontend_type>
116
+ <frontend_class>required-entry</frontend_class>
117
+ <sort_order>40</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ </contact_name>
120
+ </fields>
121
+ </authentication>
122
+ <scheduling translate="label">
123
+ <label>Scheduling</label>
124
+ <sort_order>150</sort_order>
125
+ <show_in_default>1</show_in_default>
126
+
127
+ <fields>
128
+ <refresh translate="label">
129
+ <label>Refresh Statuses</label>
130
+ <frontend_type>select</frontend_type>
131
+ <source_model>adminhtml/system_config_source_frequency</source_model>
132
+ <backend_model>capita_ti/backend_cron</backend_model>
133
+ <sort_order>10</sort_order>
134
+ <show_in_default>1</show_in_default>
135
+ </refresh>
136
+ <import translate="label">
137
+ <label>Import translations</label>
138
+ <frontend_type>select</frontend_type>
139
+ <source_model>adminhtml/system_config_source_frequency</source_model>
140
+ <backend_model>capita_ti/backend_cron</backend_model>
141
+ <sort_order>20</sort_order>
142
+ <show_in_default>1</show_in_default>
143
+ </import>
144
+ <purge translate="label">
145
+ <label>Delete completed requests</label>
146
+ <frontend_type>select</frontend_type>
147
+ <source_model>adminhtml/system_config_source_frequency</source_model>
148
+ <backend_model>capita_ti/backend_cron</backend_model>
149
+ <sort_order>40</sort_order>
150
+ <show_in_default>1</show_in_default>
151
+ </purge>
152
+ </fields>
153
+ </scheduling>
154
+ <products translate="label">
155
+ <label>Products</label>
156
+ <sort_order>200</sort_order>
157
+ <show_in_default>1</show_in_default>
158
+
159
+ <fields>
160
+ <attributes translate="label comment">
161
+ <label>Product Attributes</label>
162
+ <comment>Only non-global, text-based attributes are shown.</comment>
163
+ <frontend_type>multiselect</frontend_type>
164
+ <source_model>capita_ti/source_product_attributes</source_model>
165
+ <sort_order>10</sort_order>
166
+ <show_in_default>1</show_in_default>
167
+ </attributes>
168
+ </fields>
169
+ </products>
170
+ <categories translate="label">
171
+ <label>Categories</label>
172
+ <sort_order>300</sort_order>
173
+ <show_in_default>1</show_in_default>
174
+
175
+ <fields>
176
+ <attributes translate="label comment">
177
+ <label>Category Attributes</label>
178
+ <comment>Only non-global, text-based attributes are shown.</comment>
179
+ <frontend_type>multiselect</frontend_type>
180
+ <source_model>capita_ti/source_category_attributes</source_model>
181
+ <sort_order>10</sort_order>
182
+ <show_in_default>1</show_in_default>
183
+ </attributes>
184
+ </fields>
185
+ </categories>
186
+ </groups>
187
+ </capita_ti>
188
+ </sections>
189
+
190
+ </config>
app/code/community/Capita/TI/sql/capita_ti_setup/install-0.1.0.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ /* @var $this Mage_Core_Model_Resource_Setup */
71
+
72
+ $this->startSetup();
73
+
74
+ $tableR = new Varien_Db_Ddl_Table();
75
+ $tableRName = $this->getTable('capita_ti/request');
76
+ $tableR->setName($tableRName);
77
+ $tableR->addColumn('request_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
78
+ 'unsigned' => true,
79
+ 'primary' => true,
80
+ 'identity' => true
81
+ ), 'Request object ID');
82
+ $tableR->addColumn('source_language', Varien_Db_Ddl_Table::TYPE_TEXT, 5, array(
83
+ 'nullable' => false,
84
+ 'default' => 'en_US'
85
+ ), 'ISO 639 compatible language code');
86
+ $tableR->addColumn('dest_language', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
87
+ 'nullable' => false
88
+ ), 'Comma separated ISO 639 langauge codes');
89
+ $tableR->addColumn('status', Varien_Db_Ddl_Table::TYPE_TEXT, 20, array(
90
+ 'nullable' => false
91
+ ), 'One of completed/onHold/inProgress/importing/exporting');
92
+ $tableR->addColumn('product_count', Varien_Db_Ddl_Table::TYPE_INTEGER, null,
93
+ array(), 'Number of products before translation');
94
+ $tableR->addColumn('product_attributes', Varien_Db_Ddl_Table::TYPE_TEXT, 1000,
95
+ array(), 'Comma separated product attribute codes');
96
+ $tableR->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
97
+ 'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT
98
+ ), 'Creation Time');
99
+ $tableR->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
100
+ 'default' => Varien_Db_Ddl_Table::TIMESTAMP_UPDATE
101
+ ), 'Update Time');
102
+ $tableR->setComment('Track remote Capita requests');
103
+ $tableR->setOption('type', 'InnoDB');
104
+ $tableR->setOption('charset', 'utf8');
105
+ $this->getConnection()->createTable($tableR);
106
+
107
+ $tableP = new Varien_Db_Ddl_Table();
108
+ $tablePName = $this->getTable('capita_ti/product');
109
+ $tableP->setName($tablePName);
110
+ $tableP->addColumn('request_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
111
+ 'unsigned' => true,
112
+ 'nullable' => false
113
+ ), 'Request entity ID');
114
+ $tableP->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
115
+ 'unsigned' => true,
116
+ 'nullable' => false
117
+ ), 'Product entity ID');
118
+ $tableP->addForeignKey(
119
+ $this->getFkName($tablePName, 'request_id', $tableRName, 'request_id'),
120
+ 'request_id',
121
+ $tableRName,
122
+ 'request_id',
123
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
124
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
125
+ $tableP->addForeignKey(
126
+ $this->getFkName($tablePName, 'product_id', $this->getTable('catalog/product'), 'entity_id'),
127
+ 'product_id',
128
+ $this->getTable('catalog/product'),
129
+ 'entity_id',
130
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
131
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
132
+ $tableP->setComment('Products referenced for each request');
133
+ $tableP->setOption('type', 'InnoDB');
134
+ $tableP->setOption('charset', 'utf8');
135
+ $this->getConnection()->createTable($tableP);
136
+
137
+ $tableA = new Varien_Db_Ddl_Table();
138
+ $tableAName = $this->getTable('capita_ti/attribute');
139
+ $tableA->setName($tableAName);
140
+ $tableA->addColumn('request_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
141
+ 'unsigned' => true,
142
+ 'nullable' => false
143
+ ), 'Request entity ID');
144
+ $tableA->addColumn('attribute_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 5, array(
145
+ 'unsigned' => true,
146
+ 'nullable' => false
147
+ ), 'Entity attribute ID');
148
+ $tableA->addForeignKey(
149
+ $this->getFkName($tableAName, 'request_id', $tableRName, 'request_id'),
150
+ 'request_id',
151
+ $tableRName,
152
+ 'request_id',
153
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
154
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
155
+ $tableA->addForeignKey(
156
+ $this->getFkName($tableAName, 'attribute_id', $this->getTable('eav/attribute'), 'attribute_id'),
157
+ 'attribute_id',
158
+ $this->getTable('eav/attribute'),
159
+ 'attribute_id',
160
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
161
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
162
+ $tableA->setComment('Attributes used in each request');
163
+ $tableA->setOption('type', 'InnoDB');
164
+ $tableA->setOption('charset', 'utf8');
165
+ $this->getConnection()->createTable($tableA);
166
+
167
+ $this->endSetup();
app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ /* @var $this Mage_Core_Model_Resource_Setup */
71
+
72
+ $this->startSetup();
73
+
74
+ $tableRName = $this->getTable('capita_ti/request');
75
+ $this->getConnection()->addColumn($tableRName, 'remote_id', array(
76
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
77
+ 'length' => 16,
78
+ 'comment' => 'ID provided by remote API'
79
+ ));
80
+ $this->getConnection()->addColumn($tableRName, 'remote_no', array(
81
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
82
+ 'length' => 16,
83
+ 'comment' => '# provided by remote API'
84
+ ));
85
+
86
+
87
+ $tableD = new Varien_Db_Ddl_Table();
88
+ $tableDName = $this->getTable('capita_ti/document');
89
+ $tableD->setName($tableDName);
90
+ $tableD->addColumn('document_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
91
+ 'unsigned' => true,
92
+ 'primary' => true,
93
+ 'identity' => true
94
+ ), 'Internal reference ID');
95
+ $tableD->addColumn('request_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
96
+ 'unsigned' => true,
97
+ 'nullable' => false
98
+ ), 'Request entity ID');
99
+ $tableD->addColumn('remote_id', Varien_Db_Ddl_Table::TYPE_TEXT, 16, array(
100
+ ), 'ID provided by remote API');
101
+ $tableD->addColumn('remote_name', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
102
+ ), 'Filename in API');
103
+ $tableD->addColumn('local_name', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
104
+ ), 'Filename relative to var directory');
105
+ $tableD->addColumn('language', Varien_Db_Ddl_Table::TYPE_TEXT, 5, array(
106
+ ), 'ISO 639 code');
107
+ $tableD->addForeignKey(
108
+ $this->getFkName($tableDName, 'request_id', $tableRName, 'request_id'),
109
+ 'request_id',
110
+ $tableRName,
111
+ 'request_id',
112
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
113
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
114
+ $tableD->setComment('Products referenced for each request');
115
+ $tableD->setOption('type', 'InnoDB');
116
+ $tableD->setOption('charset', 'utf8');
117
+ $this->getConnection()->createTable($tableD);
118
+
119
+ $this->endSetup();
app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.1.1-0.1.2.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ /* @var $this Mage_Core_Model_Resource_Setup */
71
+
72
+ $this->startSetup();
73
+
74
+ $tableDName = $this->getTable('capita_ti/document');
75
+ $this->getConnection()->addColumn($tableDName, 'status', array(
76
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
77
+ 'length' => 20,
78
+ 'nullable' => false,
79
+ 'default' => '',
80
+ 'comment' => 'One of completed/onHold/inProgress/importing'
81
+ ));
82
+
83
+ $this->endSetup();
app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.1.2-0.1.3.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ /* @var $this Mage_Core_Model_Resource_Setup */
71
+
72
+ $this->startSetup();
73
+
74
+ $tableRName = $this->getTable('capita_ti/request');
75
+ $this->getConnection()->addColumn($tableRName, 'category_count', array(
76
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
77
+ 'after' => 'product_count',
78
+ 'comment' => 'Number of categories before translation'
79
+ ));
80
+ $this->getConnection()->addColumn($tableRName, 'category_attributes', array(
81
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
82
+ 'length' => 1000,
83
+ 'after' => 'product_attributes',
84
+ 'comment' => 'Comma separated category attribute codes'
85
+ ));
86
+
87
+ $tableC = new Varien_Db_Ddl_Table();
88
+ $tableCName = $this->getTable('capita_ti/category');
89
+ $tableC->setName($tableCName);
90
+ $tableC->addColumn('request_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
91
+ 'unsigned' => true,
92
+ 'nullable' => false
93
+ ), 'Request entity ID');
94
+ $tableC->addColumn('category_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
95
+ 'unsigned' => true,
96
+ 'nullable' => false
97
+ ), 'Category entity ID');
98
+ $tableC->addForeignKey(
99
+ $this->getFkName($tableCName, 'request_id', $tableRName, 'request_id'),
100
+ 'request_id',
101
+ $tableRName,
102
+ 'request_id',
103
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
104
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
105
+ $tableC->addForeignKey(
106
+ $this->getFkName($tableCName, 'category_id', $this->getTable('catalog/category'), 'entity_id'),
107
+ 'category_id',
108
+ $this->getTable('catalog/category'),
109
+ 'entity_id',
110
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
111
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
112
+ $tableC->setComment('Categories referenced for each request');
113
+ $tableC->setOption('type', 'InnoDB');
114
+ $tableC->setOption('charset', 'utf8');
115
+ $this->getConnection()->createTable($tableC);
116
+
117
+ $this->endSetup();
app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.1.3-0.2.0.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ /* @var $this Mage_Core_Model_Resource_Setup */
71
+
72
+ $this->startSetup();
73
+
74
+ $tableRName = $this->getTable('capita_ti/request');
75
+ $this->getConnection()->addColumn($tableRName, 'block_count', array(
76
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
77
+ 'nullable' => false,
78
+ 'default' => 0,
79
+ 'after' => 'category_count',
80
+ 'comment' => 'Number of CMS blocks before translation'
81
+ ));
82
+
83
+ $tableB = new Varien_Db_Ddl_Table();
84
+ $tableBName = $this->getTable('capita_ti/block');
85
+ $tableB->setName($tableBName);
86
+ $tableB->addColumn('request_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
87
+ 'unsigned' => true,
88
+ 'nullable' => false
89
+ ), 'Request entity ID');
90
+ $tableB->addColumn('block_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
91
+ 'unsigned' => true,
92
+ 'nullable' => false
93
+ ), 'Block entity ID');
94
+ $tableB->addForeignKey(
95
+ $this->getFkName($tableBName, 'request_id', $tableRName, 'request_id'),
96
+ 'request_id',
97
+ $tableRName,
98
+ 'request_id',
99
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
100
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
101
+ $tableB->addForeignKey(
102
+ $this->getFkName($tableBName, 'block_id', $this->getTable('cms/block'), 'block_id'),
103
+ 'block_id',
104
+ $this->getTable('cms/block'),
105
+ 'block_id',
106
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
107
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
108
+ $tableB->setComment('CMS blocks referenced for each request');
109
+ $tableB->setOption('type', 'InnoDB');
110
+ $tableB->setOption('charset', 'utf8');
111
+ $this->getConnection()->createTable($tableB);
112
+
113
+ $this->endSetup();
app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.2.0-0.2.1.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ /* @var $this Mage_Core_Model_Resource_Setup */
71
+
72
+ $this->startSetup();
73
+
74
+ $tableRName = $this->getTable('capita_ti/request');
75
+ $this->getConnection()->addColumn($tableRName, 'page_count', array(
76
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
77
+ 'nullable' => false,
78
+ 'default' => 0,
79
+ 'after' => 'block_count',
80
+ 'comment' => 'Number of CMS pages before translation'
81
+ ));
82
+
83
+ $tableP = new Varien_Db_Ddl_Table();
84
+ $tablePName = $this->getTable('capita_ti/page');
85
+ $tableP->setName($tablePName);
86
+ $tableP->addColumn('request_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
87
+ 'unsigned' => true,
88
+ 'nullable' => false
89
+ ), 'Request entity ID');
90
+ $tableP->addColumn('page_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
91
+ 'unsigned' => true,
92
+ 'nullable' => false
93
+ ), 'Page entity ID');
94
+ $tableP->addForeignKey(
95
+ $this->getFkName($tablePName, 'request_id', $tableRName, 'request_id'),
96
+ 'request_id',
97
+ $tableRName,
98
+ 'request_id',
99
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
100
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
101
+ $tableP->addForeignKey(
102
+ $this->getFkName($tablePName, 'page_id', $this->getTable('cms/page'), 'page_id'),
103
+ 'page_id',
104
+ $this->getTable('cms/page'),
105
+ 'page_id',
106
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
107
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
108
+ $tableP->setComment('CMS pages referenced for each request');
109
+ $tableP->setOption('type', 'InnoDB');
110
+ $tableP->setOption('charset', 'utf8');
111
+ $this->getConnection()->createTable($tableP);
112
+
113
+ $this->endSetup();
app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.2.1-0.2.2.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ /* @var $this Mage_Core_Model_Resource_Setup */
71
+
72
+ $this->startSetup();
73
+
74
+ $tableRName = $this->getTable('capita_ti/request');
75
+ $this->getConnection()->addIndex(
76
+ $tableRName,
77
+ $this->getIdxName($tableRName, array('status')),
78
+ array('status'));
79
+ $this->getConnection()->addIndex(
80
+ $tableRName,
81
+ $this->getIdxName($tableRName, array('created_at')),
82
+ array('created_at'));
83
+
84
+ $this->endSetup();
app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.2.2-0.3.0.php ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ /* @var $this Mage_Core_Model_Resource_Setup */
71
+
72
+ $this->startSetup();
73
+
74
+ // CMS Blocks
75
+
76
+ $tableBl = new Varien_Db_Ddl_Table();
77
+ $tableBlName = $this->getTable('capita_ti/block_diff');
78
+ $tableBl->setName($tableBlName);
79
+ $tableBl->addColumn('block_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
80
+ 'unsigned' => true,
81
+ 'nullable' => false
82
+ ), 'Block entity ID');
83
+ $tableBl->addColumn('attribute', Varien_Db_Ddl_Table::TYPE_TEXT, 8, array(
84
+ 'nullable' => false
85
+ ), 'Either title or content');
86
+ $tableBl->addColumn('old_md5', Varien_Db_Ddl_Table::TYPE_TEXT, 32, array(
87
+ 'nullable' => false
88
+ ), 'Hash of last known translated value');
89
+ $tableBl->addForeignKey(
90
+ $this->getFkName($tableBlName, 'block_id', $this->getTable('cms/block'), 'block_id'),
91
+ 'block_id',
92
+ $this->getTable('cms/block'),
93
+ 'block_id',
94
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
95
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
96
+ $tableBl->addIndex(
97
+ $this->getIdxName($tableBlName, array('block_id', 'attribute'), Varien_Db_Adapter_Interface::INDEX_TYPE_PRIMARY),
98
+ array('block_id', 'attribute'),
99
+ array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_PRIMARY));
100
+ $tableBl->setComment('CMS blocks that have changed since last request');
101
+ $tableBl->setOption('type', 'InnoDB');
102
+ $tableBl->setOption('charset', 'utf8');
103
+ $this->getConnection()->createTable($tableBl);
104
+
105
+ // CMS Pages
106
+
107
+ $tablePa = new Varien_Db_Ddl_Table();
108
+ $tablePaName = $this->getTable('capita_ti/page_diff');
109
+ $tablePa->setName($tablePaName);
110
+ $tablePa->addColumn('page_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
111
+ 'unsigned' => true,
112
+ 'nullable' => false
113
+ ), 'Page entity ID');
114
+ $tablePa->addColumn('attribute', Varien_Db_Ddl_Table::TYPE_TEXT, 16, array(
115
+ 'nullable' => false
116
+ ), 'Title, content or meta fields');
117
+ $tablePa->addColumn('old_md5', Varien_Db_Ddl_Table::TYPE_TEXT, 32, array(
118
+ 'nullable' => false
119
+ ), 'Hash of last known translated value');
120
+ $tablePa->addForeignKey(
121
+ $this->getFkName($tablePaName, 'page_id', $this->getTable('cms/page'), 'page_id'),
122
+ 'page_id',
123
+ $this->getTable('cms/page'),
124
+ 'page_id',
125
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
126
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
127
+ $tablePa->addIndex(
128
+ $this->getIdxName($tablePaName, array('page_id', 'attribute'), Varien_Db_Adapter_Interface::INDEX_TYPE_PRIMARY),
129
+ array('page_id', 'attribute'),
130
+ array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_PRIMARY));
131
+ $tablePa->setComment('CMS pages that have changed since last request');
132
+ $tablePa->setOption('type', 'InnoDB');
133
+ $tablePa->setOption('charset', 'utf8');
134
+ $this->getConnection()->createTable($tablePa);
135
+
136
+ // Catalog Categories
137
+
138
+ $tableCa = new Varien_Db_Ddl_Table();
139
+ $tableCaName = $this->getTable('capita_ti/category_diff');
140
+ $tableCa->setName($tableCaName);
141
+ $tableCa->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
142
+ 'unsigned' => true,
143
+ 'nullable' => false
144
+ ), 'Category entity ID');
145
+ $tableCa->addColumn('attribute', Varien_Db_Ddl_Table::TYPE_TEXT, 32, array(
146
+ 'nullable' => false
147
+ ), 'Attribute code not ID');
148
+ $tableCa->addColumn('old_md5', Varien_Db_Ddl_Table::TYPE_TEXT, 32, array(
149
+ 'nullable' => false
150
+ ), 'Hash of last known translated value');
151
+ $tableCa->addForeignKey(
152
+ $this->getFkName($tableCaName, 'entity_id', $this->getTable('catalog/category'), 'entity_id'),
153
+ 'entity_id',
154
+ $this->getTable('catalog/category'),
155
+ 'entity_id',
156
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
157
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
158
+ $tableCa->addIndex(
159
+ $this->getIdxName($tableCaName, array('entity_id', 'attribute'), Varien_Db_Adapter_Interface::INDEX_TYPE_PRIMARY),
160
+ array('entity_id', 'attribute'),
161
+ array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_PRIMARY));
162
+ $tableCa->setComment('Catalog categories that have changed since last request');
163
+ $tableCa->setOption('type', 'InnoDB');
164
+ $tableCa->setOption('charset', 'utf8');
165
+ $this->getConnection()->createTable($tableCa);
166
+
167
+ // Catalog Products
168
+
169
+ $tablePr = new Varien_Db_Ddl_Table();
170
+ $tablePrName = $this->getTable('capita_ti/product_diff');
171
+ $tablePr->setName($tablePrName);
172
+ $tablePr->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
173
+ 'unsigned' => true,
174
+ 'nullable' => false
175
+ ), 'Product entity ID');
176
+ $tablePr->addColumn('attribute', Varien_Db_Ddl_Table::TYPE_TEXT, 32, array(
177
+ 'nullable' => false
178
+ ), 'Attribute code not ID');
179
+ $tablePr->addColumn('old_md5', Varien_Db_Ddl_Table::TYPE_TEXT, 32, array(
180
+ 'nullable' => false
181
+ ), 'Hash of last known translated value');
182
+ $tablePr->addForeignKey(
183
+ $this->getFkName($tablePrName, 'entity_id', $this->getTable('catalog/product'), 'entity_id'),
184
+ 'entity_id',
185
+ $this->getTable('catalog/product'),
186
+ 'entity_id',
187
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
188
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
189
+ $tablePr->addIndex(
190
+ $this->getIdxName($tablePrName, array('entity_id', 'attribute'), Varien_Db_Adapter_Interface::INDEX_TYPE_PRIMARY),
191
+ array('entity_id', 'attribute'),
192
+ array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_PRIMARY));
193
+ $tablePr->setComment('Catalog products that have changed since last request');
194
+ $tablePr->setOption('type', 'InnoDB');
195
+ $tablePr->setOption('charset', 'utf8');
196
+ $this->getConnection()->createTable($tablePr);
197
+
198
+ $this->endSetup();
app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.3.0-0.3.1.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ /* @var $this Mage_Core_Model_Resource_Setup */
71
+
72
+ $this->startSetup();
73
+
74
+ $tables = array(
75
+ 'capita_ti/block_diff' => 'block_id',
76
+ 'capita_ti/page_diff' => 'page_id',
77
+ 'capita_ti/category_diff' => 'entity_id',
78
+ 'capita_ti/product_diff' => 'entity_id');
79
+
80
+ foreach ($tables as $tableAlias => $idField) {
81
+ $tableName = $this->getTable($tableAlias);
82
+ $this->getConnection()->addColumn($tableName, 'language', array(
83
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
84
+ 'length' => 5,
85
+ 'nullable' => false,
86
+ 'default' => '',
87
+ 'after' => $idField,
88
+ 'comment' => 'ISO 639 code'
89
+ ));
90
+ $this->getConnection()->addIndex(
91
+ $tableName,
92
+ Varien_Db_Adapter_Interface::INDEX_TYPE_PRIMARY,
93
+ array($idField, 'language', 'attribute'),
94
+ Varien_Db_Adapter_Interface::INDEX_TYPE_PRIMARY);
95
+ }
96
+
97
+ $this->endSetup();
app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.3.1-0.3.2.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ /* @var $this Mage_Core_Model_Resource_Setup */
71
+
72
+ $this->startSetup();
73
+
74
+ $tableRName = $this->getTable('capita_ti/request');
75
+ $this->getConnection()->addColumn($tableRName, 'attribute_count', array(
76
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
77
+ 'nullable' => false,
78
+ 'default' => 0,
79
+ 'after' => 'page_count',
80
+ 'comment' => 'Number of EAV attributes before translation'
81
+ ));
82
+
83
+ $this->endSetup();
app/code/community/Capita/TI/sql/capita_ti_setup/upgrade-0.3.2-0.3.3.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SmartMATE Magento Connect Terms of Use
4
+ *
5
+ * 1. Agreement to these Terms of use
6
+ * These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ * not relate to any other Capita Translation and Interpreting Limited
8
+ * (“Capita”) website or service or your use of any other Capita website or
9
+ * service and these Terms do not govern your use of the language services you may
10
+ * wish to receive from Capita.
11
+ * By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ * to these Terms and you represent that you have the legal authority to accept
13
+ * the Terms on behalf of yourself and any party you represent.
14
+ *
15
+ * 2. Intellectual property Rights
16
+ * All Intellectual Property Rights (including but not limited to trademarks,
17
+ * copyright (including rights in computer software), trade secrets, trade or
18
+ * business names, domain names and other similar rights or obligations whether
19
+ * registerable or not in any country and applications for any of the foregoing)
20
+ * in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ * is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ * sold, distributed or edited.
23
+ *
24
+ * 3. NO WARRANTY
25
+ * THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ * WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ * OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ * CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ * PARTICULAR PURPOSE.
30
+ * CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ * SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ * OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ * HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ * REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ * RELIABILITY, OR OTHERWISE.
36
+ * You are solely responsible for determining the appropriateness of using the
37
+ * SmartMATE Magento Connect and you assume all risks associated with this,
38
+ * including but not limited compliance with applicable laws, damage to or loss of
39
+ * data, programs or equipment, and unavailability or interruption of operations.
40
+ * YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+ *
42
+ * 4. LIMITATION OF LIABILITY
43
+ * IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ * PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ * WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ * SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ * NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ * THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ * IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+ *
52
+ * 5. Indemnification for breach of the Terms
53
+ * You agree to indemnify and hold harmless Capita from and against any and all
54
+ * loss, expenses, damages, and costs, including without limitation reasonable
55
+ * attorney fees, resulting, whether directly or indirectly, from your violation
56
+ * of the Terms.
57
+ *
58
+ * 6. General
59
+ * These Terms are governed by and shall be construed in accordance with English
60
+ * law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ * If any provision of these Terms is invalid or unenforceable under applicable
62
+ * law, it shall not affect the validity or enforceability of the remainder of the
63
+ * terms of these Terms and such provision shall be reformed to the minimum extent
64
+ * necessary to make such provision valid and enforceable.
65
+ *
66
+ * @author Daniel Deady <daniel@5ms.uk.com>
67
+ * @copyright Copyright (c) 2017 5M Solutions Ltd. (http://www.5ms.co.uk/)
68
+ */
69
+
70
+ /* @var $this Mage_Core_Model_Resource_Setup */
71
+
72
+ $this->startSetup();
73
+
74
+ // EAV Blocks
75
+
76
+ $tableAt = new Varien_Db_Ddl_Table();
77
+ $tableAtName = $this->getTable('capita_ti/attribute_diff');
78
+ $tableAt->setName($tableAtName);
79
+ $tableAt->addColumn('attribute_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
80
+ 'unsigned' => true,
81
+ 'nullable' => false
82
+ ), 'Entity Attribute ID');
83
+ $tableAt->addColumn('language', Varien_Db_Ddl_Table::TYPE_TEXT, 5, array(
84
+ 'nullable' => false,
85
+ ), 'ISO 639 code');
86
+ $tableAt->addColumn('attribute', Varien_Db_Ddl_Table::TYPE_TEXT, 16, array(
87
+ 'nullable' => false
88
+ ), 'Either frontend_label or option_id');
89
+ $tableAt->addColumn('old_md5', Varien_Db_Ddl_Table::TYPE_TEXT, 32, array(
90
+ 'nullable' => false
91
+ ), 'Hash of last known translated value');
92
+ $tableAt->addForeignKey(
93
+ $this->getFkName($tableAtName, 'attribute_id', $this->getTable('eav/entity_attribute'), 'attribute_id'),
94
+ 'attribute_id',
95
+ $this->getTable('eav/entity_attribute'),
96
+ 'attribute_id',
97
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
98
+ Varien_Db_Ddl_Table::ACTION_CASCADE);
99
+ $tableAt->addIndex(
100
+ $this->getIdxName($tableAtName, array('attribute_id', 'attribute', 'language'), Varien_Db_Adapter_Interface::INDEX_TYPE_PRIMARY),
101
+ array('attribute_id', 'attribute', 'language'),
102
+ array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_PRIMARY));
103
+ $tableAt->setComment('EAV attribute labels that have changed since last request');
104
+ $tableAt->setOption('type', 'InnoDB');
105
+ $tableAt->setOption('charset', 'utf8');
106
+ $this->getConnection()->createTable($tableAt);
107
+
108
+ $this->endSetup();
app/design/adminhtml/default/default/layout/capita_ti.xml ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ SmartMATE Magento Connect Terms of Use
4
+
5
+ 1. Agreement to these Terms of use
6
+ These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ not relate to any other Capita Translation and Interpreting Limited
8
+ (“Capita”) website or service or your use of any other Capita website or
9
+ service and these Terms do not govern your use of the language services you may
10
+ wish to receive from Capita.
11
+ By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ to these Terms and you represent that you have the legal authority to accept
13
+ the Terms on behalf of yourself and any party you represent.
14
+
15
+ 2. Intellectual property Rights
16
+ All Intellectual Property Rights (including but not limited to trademarks,
17
+ copyright (including rights in computer software), trade secrets, trade or
18
+ business names, domain names and other similar rights or obligations whether
19
+ registerable or not in any country and applications for any of the foregoing)
20
+ in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ sold, distributed or edited.
23
+
24
+ 3. NO WARRANTY
25
+ THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ PARTICULAR PURPOSE.
30
+ CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ RELIABILITY, OR OTHERWISE.
36
+ You are solely responsible for determining the appropriateness of using the
37
+ SmartMATE Magento Connect and you assume all risks associated with this,
38
+ including but not limited compliance with applicable laws, damage to or loss of
39
+ data, programs or equipment, and unavailability or interruption of operations.
40
+ YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+
42
+ 4. LIMITATION OF LIABILITY
43
+ IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+
52
+ 5. Indemnification for breach of the Terms
53
+ You agree to indemnify and hold harmless Capita from and against any and all
54
+ loss, expenses, damages, and costs, including without limitation reasonable
55
+ attorney fees, resulting, whether directly or indirectly, from your violation
56
+ of the Terms.
57
+
58
+ 6. General
59
+ These Terms are governed by and shall be construed in accordance with English
60
+ law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ If any provision of these Terms is invalid or unenforceable under applicable
62
+ law, it shall not affect the validity or enforceability of the remainder of the
63
+ terms of these Terms and such provision shall be reformed to the minimum extent
64
+ necessary to make such provision valid and enforceable.
65
+ -->
66
+ <layout>
67
+ <adminhtml_capita_request_index>
68
+ <reference name="content">
69
+ <block type="capita_ti/adminhtml_request" />
70
+ <block type="capita_ti/adminhtml_cron_messages" />
71
+ </reference>
72
+ </adminhtml_capita_request_index>
73
+
74
+ <adminhtml_capita_request_new>
75
+ <reference name="head">
76
+ <action method="setCanLoadExtJs"><flag>1</flag></action>
77
+ </reference>
78
+ <reference name="left">
79
+ <block type="capita_ti/adminhtml_request_new_tabs" name="capita_ti_new_request_tabs">
80
+ <!-- these methods create ajax sections -->
81
+ <action method="addGeneralTab" />
82
+ <action method="addProductsTab" />
83
+ <action method="addAttributesTab" />
84
+ <action method="addCategoriesTab" />
85
+ <action method="addBlocksTab" />
86
+ <action method="addPagesTab" />
87
+ </block>
88
+ </reference>
89
+ <reference name="content">
90
+ <block type="capita_ti/adminhtml_request_new" name="capita_ti_new_request" />
91
+ </reference>
92
+ </adminhtml_capita_request_new>
93
+
94
+ <adminhtml_capita_request_productstab>
95
+ <block type="core/text_list" name="root" output="toHtml">
96
+ <block type="capita_ti/adminhtml_request_new_tab_product_grid" name="request_tab_products_grid" />
97
+ <block type="capita_ti/adminhtml_request_new_tab_product_serializer" name="request_tab_products_grid_serializer" />
98
+ <block type="capita_ti/adminhtml_request_new_tab_product_attributes" name="request_tab_products_attributes" />
99
+ </block>
100
+ </adminhtml_capita_request_productstab>
101
+
102
+ <adminhtml_capita_request_productsgrid>
103
+ <block type="core/text_list" name="root" output="toHtml">
104
+ <block type="capita_ti/adminhtml_request_new_tab_product_grid" name="request_tab_products_grid" />
105
+ </block>
106
+ </adminhtml_capita_request_productsgrid>
107
+
108
+ <adminhtml_capita_request_attributestab>
109
+ <block type="core/text_list" name="root" output="toHtml">
110
+ <block type="capita_ti/adminhtml_request_new_tab_attribute_grid" name="request_tab_attributes_grid" />
111
+ <block type="capita_ti/adminhtml_request_new_tab_attribute_serializer" name="request_tab_attributes_grid_serializer" />
112
+ </block>
113
+ </adminhtml_capita_request_attributestab>
114
+
115
+ <adminhtml_capita_request_attributesgrid>
116
+ <block type="core/text_list" name="root" output="toHtml">
117
+ <block type="capita_ti/adminhtml_request_new_tab_attribute_grid" name="request_tab_attributes_grid" />
118
+ </block>
119
+ </adminhtml_capita_request_attributesgrid>
120
+
121
+ <adminhtml_capita_request_categoriestab>
122
+ <block type="core/text_list" name="root" output="toHtml">
123
+ <block type="capita_ti/adminhtml_request_new_tab_categories" name="request_tab_categories" />
124
+ </block>
125
+ </adminhtml_capita_request_categoriestab>
126
+
127
+ <adminhtml_capita_request_categoriesgrid>
128
+ <block type="core/text_list" name="root" output="toHtml">
129
+ <block type="capita_ti/adminhtml_request_new_tab_category_grid" name="request_tab_categories_grid" />
130
+ </block>
131
+ </adminhtml_capita_request_categoriesgrid>
132
+
133
+ <adminhtml_capita_request_blockstab>
134
+ <block type="core/text_list" name="root" output="toHtml">
135
+ <block type="capita_ti/adminhtml_request_new_tab_blocks" name="request_tab_blocks" />
136
+ </block>
137
+ </adminhtml_capita_request_blockstab>
138
+
139
+ <adminhtml_capita_request_blocksgrid>
140
+ <block type="core/text_list" name="root" output="toHtml">
141
+ <block type="capita_ti/adminhtml_request_new_tab_block_grid" name="request_tab_blocks_grid" />
142
+ </block>
143
+ </adminhtml_capita_request_blocksgrid>
144
+
145
+ <adminhtml_capita_request_pagestab>
146
+ <block type="core/text_list" name="root" output="toHtml">
147
+ <block type="capita_ti/adminhtml_request_new_tab_pages" name="request_tab_pages" />
148
+ </block>
149
+ </adminhtml_capita_request_pagestab>
150
+
151
+ <adminhtml_capita_request_pagesgrid>
152
+ <block type="core/text_list" name="root" output="toHtml">
153
+ <block type="capita_ti/adminhtml_request_new_tab_page_grid" name="request_tab_pages_grid" />
154
+ </block>
155
+ </adminhtml_capita_request_pagesgrid>
156
+
157
+ <adminhtml_capita_request_view>
158
+ <reference name="content">
159
+ <block type="capita_ti/adminhtml_request_view" />
160
+ </reference>
161
+ </adminhtml_capita_request_view>
162
+
163
+ <adminhtml_catalog_product_translate>
164
+ <reference name="left">
165
+ <block type="capita_ti/adminhtml_request_new_tabs" name="capita_ti_new_request_tabs">
166
+ <!-- not ajax but static -->
167
+ <action method="addTab"><id>general</id><block>capita_ti/adminhtml_request_new_tab_general</block></action>
168
+ <action method="addTab"><id>products</id><block>capita_ti/adminhtml_request_new_tab_products</block></action>
169
+ </block>
170
+ </reference>
171
+ <reference name="content">
172
+ <block type="capita_ti/adminhtml_request_new" name="capita_ti_new_request" />
173
+ </reference>
174
+ </adminhtml_catalog_product_translate>
175
+ </layout>
app/etc/modules/Capita_TI.xml ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!--
3
+ SmartMATE Magento Connect Terms of Use
4
+
5
+ 1. Agreement to these Terms of use
6
+ These Terms govern your use of the SmartMATE Magento Connect. These Terms do
7
+ not relate to any other Capita Translation and Interpreting Limited
8
+ (“Capita”) website or service or your use of any other Capita website or
9
+ service and these Terms do not govern your use of the language services you may
10
+ wish to receive from Capita.
11
+ By accessing or using the SmartMATE Magento Connect you agree with and consent
12
+ to these Terms and you represent that you have the legal authority to accept
13
+ the Terms on behalf of yourself and any party you represent.
14
+
15
+ 2. Intellectual property Rights
16
+ All Intellectual Property Rights (including but not limited to trademarks,
17
+ copyright (including rights in computer software), trade secrets, trade or
18
+ business names, domain names and other similar rights or obligations whether
19
+ registerable or not in any country and applications for any of the foregoing)
20
+ in the SmartMATE Magento Connect belong to Capita and no permission whatsoever
21
+ is given to you for the SmartMATE Magento Connect to be (without limitation)
22
+ sold, distributed or edited.
23
+
24
+ 3. NO WARRANTY
25
+ THE SMARTMATE MAGENTO CONNECT IS PROVIDED TO YOU ON AN “AS-IS” BASIS,
26
+ WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
27
+ OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES, REPRESENTATIONS OR
28
+ CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
29
+ PARTICULAR PURPOSE.
30
+ CAPITA DOES NOT WARRANT THAT THE FUNCTIONS OR CONTENT CONTAINED ON THE
31
+ SMARTMATE MAGENTO CONNECT WILL BE ERROR-FREE, THAT DEFECTS WILL BE CORRECTED,
32
+ OR THAT CAPITA OR ITS THIRD PARTIES SERVERS ARE FREE OF VIRUSES OR OTHER
33
+ HARMFUL COMPONENTS. CAPITA DOES NOT WARRANT OR MAKE ANY REPRESENTATION
34
+ REGARDING USE OF THE SMARTMATE MAGENTO CONNECT IN TERMS OF ACCURACY,
35
+ RELIABILITY, OR OTHERWISE.
36
+ You are solely responsible for determining the appropriateness of using the
37
+ SmartMATE Magento Connect and you assume all risks associated with this,
38
+ including but not limited compliance with applicable laws, damage to or loss of
39
+ data, programs or equipment, and unavailability or interruption of operations.
40
+ YOUR USE OF THE SMARTMATE MAGENTO CONNECT IS SOLEY AT YOUR RISK.
41
+
42
+ 4. LIMITATION OF LIABILITY
43
+ IN NO EVENT SHALL CAPITA BE LIABLE TO YOU FOR ANY INCIDENTAL, DIRECT, INDIRECT,
44
+ PUNITIVE, ACTUAL, CONSEQUENTIAL, SPECIAL, EXEMPLARY OR OTHER DAMAGES, INCLUDING
45
+ WITHOUT LIMITATION, LOSS OF REVENUE OR INCOME, LOST PROFITS, OR SIMILAR DAMAGES
46
+ SUFFERED OR INCURRED BY YOU OR ANY THIRD PARTY HOWEVER CAUSED AND ON ANY THEORY
47
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48
+ NEGLIGENCE OR OTHERWISE) OR OTHERWISE THAT ARISE IN CONNECTION WITH YOUR USE OF
49
+ THE SMARTMATE MAGENTO CONNECT (OR THE TERMINATION THEREOF FOR ANY REASON), EVEN
50
+ IF CAPITA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
51
+
52
+ 5. Indemnification for breach of the Terms
53
+ You agree to indemnify and hold harmless Capita from and against any and all
54
+ loss, expenses, damages, and costs, including without limitation reasonable
55
+ attorney fees, resulting, whether directly or indirectly, from your violation
56
+ of the Terms.
57
+
58
+ 6. General
59
+ These Terms are governed by and shall be construed in accordance with English
60
+ law and the parties submit to the exclusive jurisdiction of the English courts.
61
+ If any provision of these Terms is invalid or unenforceable under applicable
62
+ law, it shall not affect the validity or enforceability of the remainder of the
63
+ terms of these Terms and such provision shall be reformed to the minimum extent
64
+ necessary to make such provision valid and enforceable.
65
+ -->
66
+ <config>
67
+ <modules>
68
+ <Capita_TI>
69
+ <active>true</active>
70
+ <codePool>community</codePool>
71
+ </Capita_TI>
72
+ </modules>
73
+ </config>
app/locale/en_US/Capita_TI.csv ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "# of attributes","# of attributes"
2
+ "# of blocks","# of blocks"
3
+ "# of categories","# of categories"
4
+ "# of pages","# of pages"
5
+ "# of products","# of products"
6
+ "Authentication","Authentication"
7
+ "Cannot write to ""%s""","Cannot write to ""%s"""
8
+ "Capita","Capita"
9
+ "Capita Translations","Capita Translations"
10
+ "Catalog Categories","Catalog Categories"
11
+ "Catalog Product Attributes","Catalog Product Attributes"
12
+ "Catalog Products","Catalog Products"
13
+ "Category Attributes","Category Attributes"
14
+ "CMS Blocks","CMS Blocks"
15
+ "CMS Pages","CMS Pages"
16
+ "Contact Name","Contact Name"
17
+ "Could not open ""%s""","Could not open ""%s"""
18
+ "Could not read root element","Could not read root element"
19
+ "Delete completed requests","Delete completed requests"
20
+ "Expected ""%s"" element but got ""%s""","Expected ""%s"" element but got ""%s"""
21
+ "File element has no body","File element has no body"
22
+ "File origin is not specified","File origin is not specified"
23
+ "Importing","Importing"
24
+ "Import translations","Import translations"
25
+ "Include in Navigation Menu","Include in Navigation Menu"
26
+ "In Progress","In Progress"
27
+ "Is Active","Is Active"
28
+ "Languages","Languages"
29
+ "Last Updated","Last Updated"
30
+ "Must specify at least one product, category, block or page","Must specify at least one product, category, block or page"
31
+ "New Request","New Request"
32
+ "No products were selected","No products were selected"
33
+ "Not All","Not All"
34
+ "Number of attributes selected","Number of attributes selected"
35
+ "Number of blocks selected","Number of blocks selected"
36
+ "Number of categories selected","Number of categories selected"
37
+ "Number of pages selected","Number of pages selected"
38
+ "Number of products selected","Number of products selected"
39
+ "Only non-global, text-based attributes are shown.","Only non-global, text-based attributes are shown."
40
+ "Place Request","Place Request"
41
+ "Recent Problems","Recent Problems"
42
+ "Refresh Status","Refresh Status"
43
+ "Refresh Statuses","Refresh Statuses"
44
+ "Request ""%d"" is unavailable","Request ""%d"" is unavailable"
45
+ "Request ""%s""","Request ""%s"""
46
+ "Request ""%s"" has been deleted","Request ""%s"" has been deleted"
47
+ "Request ""%s"" has been started","Request ""%s"" has been started"
48
+ "Requested Languages","Requested Languages"
49
+ "Request New Translation","Request New Translation"
50
+ "Request No.","Request No."
51
+ "Requests","Requests"
52
+ "Scheduling","Scheduling"
53
+ "Some","Some"
54
+ "Some of these products are currently being translated.","Some of these products are currently being translated."
55
+ "Source Language","Source Language"
56
+ "Source language is not specified","Source language is not specified"
57
+ "Submission Date","Submission Date"
58
+ "Target language is not specified","Target language is not specified"
59
+ "Target Languages","Target Languages"
60
+ "The default selection can be changed in <a href=""%s"">Configuration</a>.","The default selection can be changed in <a href=""%s"">Configuration</a>."
61
+ "There was a problem connecting to the server: %s","There was a problem connecting to the server: %s"
62
+ "This block identifier is currently being translated.","This block identifier is currently being translated."
63
+ "This category is currently being translated.","This category is currently being translated."
64
+ "This page identifier is currently being translated.","This page identifier is currently being translated."
65
+ "This product is currently being translated.","This product is currently being translated."
66
+ "Title","Title"
67
+ "Trans-unit has no ID","Trans-unit has no ID"
68
+ "Translate","Translate"
69
+ "Translated","Translated"
70
+ "Translation Requests","Translation Requests"
71
+ "Unrecognised ctype: ""%s""","Unrecognised ctype: ""%s"""
72
+ "Unrecognised element: <%s>","Unrecognised element: <%s>"
73
+ "Unrecognised file origin: ""%s""","Unrecognised file origin: ""%s"""
74
+ "URL Path","URL Path"
75
+ "XLIFF version is ""%s"" and needs to be ""1.2""","XLIFF version is ""%s"" and needs to be ""1.2"""
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Capita_TI</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license/>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Translate catalog and CMS to several languages.</summary>
10
+ <description/>
11
+ <notes>Production release for Magento Connect</notes>
12
+ <authors><author><name>Daniel Deady</name><user>clockworkgeek</user><email>daniel@clockworkgeek.com</email></author></authors>
13
+ <date>2017-03-21</date>
14
+ <time>14:53:14</time>
15
+ <contents><target name="magecommunity"><dir name="Capita"><file name="LICENSE.txt" hash="c5ffd6802ea25882b5c10324217ad852"/><dir name="TI"><dir name="Block"><dir name="Adminhtml"><dir name="Cron"><file name="Messages.php" hash="a728ee8f51366acc51a573c08c7830db"/></dir><dir name="Grid"><dir name="Column"><dir name="Filter"><file name="Languages.php" hash="f80720874dbf8960e03e111bfc72c69b"/></dir><dir name="Renderer"><file name="Include.php" hash="4c0218bc9d2d27008118b6f41d000ef8"/><file name="Languages.php" hash="926613aa85b93857e5d2b0f0ccbb7543"/></dir></dir><file name="Translatable.php" hash="4a7c8a7344aadac4e21a031d7ea336cd"/></dir><file name="Request.php" hash="af58a46ef72cb5fa44b29ca5970edcbb"/><dir name="Request"><file name="Grid.php" hash="ecb4cd94830b8068fec3b42ea617c8a1"/><file name="New.php" hash="44388bbfa1777dd8200936a62763b90e"/><dir name="New"><file name="Form.php" hash="0cda858bf41099c4d0f03b992b59a90e"/><dir name="Tab"><dir name="Attribute"><file name="Grid.php" hash="e4d374e40b56ae2969f90a0ad0a8d8de"/><file name="Serializer.php" hash="8025578d229d24fae50885733d0e8a67"/></dir><dir name="Block"><file name="Grid.php" hash="030ec0de99cbb0dc491710296fe7d91a"/><file name="Serializer.php" hash="9eec96f7e7cdb05557d9f576ceb0b1be"/></dir><file name="Blocks.php" hash="aba87ab3491aa74e6a752872a9f01e22"/><file name="Categories.php" hash="5f09b6c35ecad625850b67e6e07abdb0"/><dir name="Category"><file name="Attributes.php" hash="d8ebec805b340f30c49a5a3a0401bf64"/><file name="Grid.php" hash="b737af8a0f71da60be4543e5cb041d61"/><file name="Serializer.php" hash="1528c82e9ebeb585ecbe49afa8a62a76"/></dir><file name="General.php" hash="11004b5eac699571f00b4d06df3684db"/><dir name="Page"><file name="Grid.php" hash="7ee280a0d19c6d4687caee6c8aba78e5"/><file name="Serializer.php" hash="0076f98764dd310ffc9d51b2d45625a9"/></dir><file name="Pages.php" hash="da4bded7ada79b6ce51cda4c4d103983"/><dir name="Product"><file name="Attributes.php" hash="1a2088af9596d751780f6f3013cd8eab"/><file name="Grid.php" hash="318aee345840d7ddfd38ad123aa71176"/><file name="Serializer.php" hash="f91df0a832c70c7e37085200646e4717"/></dir><file name="Products.php" hash="215fd5578369b653914a84a0d4babc18"/></dir><file name="Tabs.php" hash="a5c8058f97ec777a4ea0f1c862cb2e14"/></dir><file name="View.php" hash="99eb18a6084ce6310661415fdcb000d9"/><dir name="View"><file name="Form.php" hash="6917151c46e4f6007d69b5ce7a6559ec"/></dir></dir></dir></dir><dir name="Controller"><file name="Action.php" hash="ed5834be5f095162a3537a10b51b49da"/></dir><dir name="Helper"><file name="Data.php" hash="f47ce6f63fe96ddf4e31ced2a4afea66"/></dir><dir name="Model"><dir name="Api"><file name="Abstract.php" hash="669f4feb4e432aaecc4726ac031964e2"/><dir name="Adapter"><file name="SamplePostRequest.php" hash="aa65f6089aed205b067fc2a70eec9897"/></dir><file name="Languages.php" hash="8b60f38c8dfea1195dc18fac98b813cc"/><file name="Requests.php" hash="e437721b036e7a1d09ebc0fe2aa9aa54"/></dir><dir name="Backend"><file name="Cron.php" hash="f205a1a051a6b337cf1fbef10d44fef6"/></dir><file name="Email.php" hash="ec0915eb5be76da0d560f567c5c5e884"/><file name="Observer.php" hash="674ceaf64a6d675ac9f22661416c577e"/><file name="Request.php" hash="5306afcb17638391bd19d59367c45d40"/><dir name="Request"><file name="Document.php" hash="2aa0716cf7e7659c9c46e8e6e93a700a"/></dir><dir name="Resource"><dir name="Attribute"><file name="Collection.php" hash="e03826fd2668913d710588837001971d"/></dir><dir name="Block"><file name="Collection.php" hash="d93bc59d319b671b1dcb14e181c26a7b"/></dir><dir name="Category"><file name="Collection.php" hash="63f69138d7c7531f84e040f8af77ca4a"/></dir><dir name="Page"><file name="Collection.php" hash="bdd77aed8b0346dfa58576d5b3179a0c"/></dir><dir name="Product"><file name="Collection.php" hash="6cc841b8741f15337a0f386184d6698c"/></dir><file name="Request.php" hash="6a3dc470d31a868864895a98966928f2"/><dir name="Request"><file name="Collection.php" hash="a844ed74e937003e34962d9472ccba17"/><file name="Document.php" hash="603ed1b586c0137395f59572f6b1d978"/><dir name="Document"><file name="Collection.php" hash="18a865d068539b06c3df88317b4bb891"/></dir></dir></dir><dir name="Source"><dir name="Category"><file name="Attributes.php" hash="e89f20fe136bba8879d56452edef8d2d"/></dir><dir name="Product"><file name="Attributes.php" hash="b7e7b313dabc5732d62ad6ee5d53544f"/></dir><file name="Status.php" hash="4ac550433d920e0c7c3481e7dda8b24d"/></dir><file name="Tracker.php" hash="e70ded850649dac311373575413754ba"/><dir name="Xliff"><dir name="Import"><file name="Abstract.php" hash="41fdf75c2e97035ecc9426eed76f224f"/><file name="Attribute.php" hash="b6e009c0b110a216e10efd89261ef1b0"/><file name="Attributeoption.php" hash="12c0ac418342cd357d12afb59f3e0e42"/><file name="Block.php" hash="c6ce19e390bcfe8cb705546d2a878a02"/><file name="Category.php" hash="584b77927bcdd911793a482808865c8d"/><file name="Page.php" hash="974dacc1862ee442f55c31eea816ac27"/><file name="Product.php" hash="2c9aa3a941165df081b356529c6d684a"/></dir><file name="Reader.php" hash="3c30450bd99b27a1f33c2e42cbae0138"/><file name="Writer.php" hash="fb2bc063b57c145e868b344fc059cedd"/></dir></dir><dir name="Test"><dir name="Model"><dir name="Api"><file name="Languages.php" hash="ec71a825112b972fd95b86b912628b05"/><file name="Requests.php" hash="6e254f952dbb930822aa0c5d5a2d4f02"/></dir><dir name="Xliff"><file name="Writer.php" hash="c5b239ca48a0af2c2611df9fc943394c"/><file name="Writer2.php" hash="eaf84b9ca52e23ab8444ae49bea9563a"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Capita"><file name="RequestController.php" hash="f19d628ebbd29d914e9a6ca12b895c8b"/></dir><dir name="Catalog"><file name="ProductController.php" hash="c18196a2e6902bfbcc872c9ba9f10de0"/></dir></dir></dir><dir name="data"><dir name="capita_ti_setup"><file name="data-upgrade-0.3.0-0.3.1.php" hash="ad7489504886d1b5d93f4f8e2a07ad56"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="83d09a09149a80858fa39db3360fb4ef"/><file name="config.xml" hash="8a3eaccd9daa107948bc2ecafeab0eeb"/><file name="system.xml" hash="1f76fd686c3cd68b0e292e6c7ac67f2c"/></dir><dir name="sql"><dir name="capita_ti_setup"><file name="install-0.1.0.php" hash="2809e7f335d4f196317164094050dc44"/><file name="upgrade-0.1.0-0.1.1.php" hash="68583d3572acd635259f43daed4de88c"/><file name="upgrade-0.1.1-0.1.2.php" hash="7ba27a8297b51f89bb9484f9123aabe1"/><file name="upgrade-0.1.2-0.1.3.php" hash="d6e572f48fe15d7c7bb279eab85fb6dc"/><file name="upgrade-0.1.3-0.2.0.php" hash="6ace57755125dce844690cd7b621d19a"/><file name="upgrade-0.2.0-0.2.1.php" hash="f6ad196024c01dd5ab7fba08afd3c8a5"/><file name="upgrade-0.2.1-0.2.2.php" hash="9bb90b85d0c674f30ffd025c7309c5cb"/><file name="upgrade-0.2.2-0.3.0.php" hash="7265c53a9f915d56206e23e534aa6919"/><file name="upgrade-0.3.0-0.3.1.php" hash="e1df620d6c5c8957660c3a550282eae7"/><file name="upgrade-0.3.1-0.3.2.php" hash="374ef52cf98e7eaa6e55fe1f77e00947"/><file name="upgrade-0.3.2-0.3.3.php" hash="6f408a36bc3f6933f4870d43357cd191"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="capita_ti.xml" hash="5582174dc6884275f1a6f862361cf03b"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Capita_TI.csv" hash="44f23bc2fe0f4894fa63d6dcd75880d1"/></dir></target><target name="mageetc"><dir name="modules"><file name="Capita_TI.xml" hash="ec65e75df9fa155fef84eebc88101d60"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="capita"><dir name="flags"><file name="ad.gif" hash="6d1aa633a8097b961bda2f5f735f35a7"/><file name="ae.gif" hash="f212f62ad8f9209e58345eaffae81115"/><file name="af.gif" hash="7110571f5f22f1942ee97afa41f51e61"/><file name="ag.gif" hash="49068e672834658b179cd86a35325e47"/><file name="ai.gif" hash="5ff25d17bfde13c3a09961d87b04c1ba"/><file name="al.gif" hash="02c223e7f2c1d4f98553d6167b723cb2"/><file name="am.gif" hash="33b02876d7e0dadfa94db32443dda36e"/><file name="an.gif" hash="caf5f4429cf5a5d91a457385460d9c38"/><file name="ao.gif" hash="4b962702108c12ea1c6375e2d6667191"/><file name="ar.gif" hash="9c95874961754b638a20b39ce7696f31"/><file name="as.gif" hash="b58f58ac2f16e7d81f1480875a8e33c0"/><file name="at.gif" hash="eeb91d7617243cadbe646b6d795c678f"/><file name="au.gif" hash="1fe85ab1104e05f5a26efa5bbcd1cf18"/><file name="aw.gif" hash="65ed67b97141c58ea652416ab83f2676"/><file name="ax.gif" hash="6ca1b9ad68066fa5dd253e05acf85496"/><file name="az.gif" hash="b1646ac4434f234d8d5034606a7af947"/><file name="ba.gif" hash="53dfab82eedc9f915dd7413b1acdd8cb"/><file name="bb.gif" hash="a4e2a530aaaa28ecfe7a63f3b6081871"/><file name="bd.gif" hash="12e3055f52cf6a1551d4146b2ef8bf34"/><file name="be.gif" hash="595a78d8e7caadfee854dd2f15e22093"/><file name="bf.gif" hash="207fcec4143ee2d33d81bf24fd2e93fb"/><file name="bg.gif" hash="5be202b067ced9053affd880754fcf63"/><file name="bh.gif" hash="5411780a3d43531aae0b66eec250467c"/><file name="bi.gif" hash="2c7cf6b75c5fe88be53237ce6b9ba709"/><file name="bj.gif" hash="da5abd9ecc82282cd8dfa8507d72b19d"/><file name="bm.gif" hash="fba77982d567bc1892c2b64d6ef47a81"/><file name="bn.gif" hash="87b3432e4df98e0b73673ac910f01010"/><file name="bo.gif" hash="0b8ef2f7302d078461e47676119c08ab"/><file name="br.gif" hash="92858b17e2d5b63d040104586ff52302"/><file name="bs.gif" hash="72ba741ab39307b5639ef2ba4bd96fe7"/><file name="bt.gif" hash="36d740145ed89f4a02fc483baed1323a"/><file name="bv.gif" hash="bbc9011e876a122ea89923e6b730ec50"/><file name="bw.gif" hash="d841ce1d195d470bdddb1c478039c050"/><file name="by.gif" hash="f90504a0c446c69ebf3031a0c6f7ea81"/><file name="bz.gif" hash="035793a3b9079e171ee8f5f81bda9cc7"/><file name="ca.gif" hash="71ad31efd4e749a2e23b706c15db73ae"/><file name="catalonia.gif" hash="40cb2cf41ee9f17325e9d03ecbfdf4c5"/><file name="cc.gif" hash="94a9202e2d3618f0d788e5f2d54323c6"/><file name="cd.gif" hash="7cf2d745b0007b2b026bc8c060d69a6f"/><file name="cf.gif" hash="e885f0438ba36f1f4787bb603f99c8f3"/><file name="cg.gif" hash="6ff3d64b899ee3c52af74134dd405424"/><file name="ch.gif" hash="ed43f66bc567ac6954adf9e949aede86"/><file name="ci.gif" hash="8ed1d6c276ae7964928ae032c2b9aca1"/><file name="ck.gif" hash="af275b38413317a7b23bdf799dd567c7"/><file name="cl.gif" hash="78d55180619241a9df9cccf6e3d9f6f3"/><file name="cm.gif" hash="8a1d0e21ed2ec1be609574a473493031"/><file name="cn.gif" hash="b04190e287f32d56867cd6ac53fdedcb"/><file name="co.gif" hash="405dfe11225ebe1cc34b30ccd765753e"/><file name="cr.gif" hash="bd762e1a0567e38bcaea1e9b3956b6c1"/><file name="cs.gif" hash="be7111c8a514d660850c92d217b7860e"/><file name="cu.gif" hash="03d19d686d0e21a037cbcbca332ecec0"/><file name="cv.gif" hash="a6bfe2d82321df4314f181154080b78c"/><file name="cx.gif" hash="ac0b5e80669c0e7f7fcf6d577d7d5df4"/><file name="cy.gif" hash="649f116f7c7c2f0524d6428eaa17ad6c"/><file name="cz.gif" hash="6352cbfac37d53fd10f6948e8b9a4ac8"/><file name="de.gif" hash="b0dbdccf1c4e4a267a5cd2bf7ea4cb69"/><file name="dj.gif" hash="30bd321e11df6356b73eaa21fb183eae"/><file name="dk.gif" hash="d7c2fddc4b0a9c6ca3d5e2ed13374421"/><file name="dm.gif" hash="efcf65d93c1713cc052dec2e0883b877"/><file name="do.gif" hash="9389aa6eb9859b2a7b00843482847356"/><file name="dz.gif" hash="e8da7d880886bf815ad641b7cd0b7f9c"/><file name="ec.gif" hash="4b82d78f2a20846b268f28caac6a4ab4"/><file name="ee.gif" hash="7c9d14f7681e967ea10d4fa2a8f0ecde"/><file name="eg.gif" hash="99dd064303f1d69989789038e8d60020"/><file name="eh.gif" hash="043ce3f2f09f6ee41984a83757365e1a"/><file name="er.gif" hash="509ed59423d395c2c73f2e4f815dbaeb"/><file name="es.gif" hash="c0ddb5b02a4d2c4d274140a6cffc4be0"/><file name="et.gif" hash="b738a5aca0b4b4c05a6c745380fcf222"/><file name="fi.gif" hash="94e7d08c3043f3dc65b4eff40223d4e8"/><file name="fj.gif" hash="3a839ddc795a643dad5c6cfa83f9721f"/><file name="fk.gif" hash="21884f77423cbf8eb4b86f61399345b0"/><file name="fm.gif" hash="013d4b6246bd2158f9d9bc685be72840"/><file name="fo.gif" hash="f2946a58a93f63303c47d649617e03be"/><file name="fr.gif" hash="0a4673b07b377d1f58230f40f256d890"/><file name="ga.gif" hash="6023ba4847dd1329d210f687c63458d5"/><file name="gb.gif" hash="b68a866f3b54a11cf2fc2b3ce2ea26d5"/><file name="gd.gif" hash="282a476bceb7bdbfc19a47d68a0efc18"/><file name="ge.gif" hash="a04177e4b34a23dcbf0e8a64838b4619"/><file name="gf.gif" hash="0a4673b07b377d1f58230f40f256d890"/><file name="gh.gif" hash="e72c4c18615e958e05dcc12364fe6527"/><file name="gi.gif" hash="2ca6d3fcbabb4b5dc430c8a552d7fb1b"/><file name="gl.gif" hash="edcdeb38a22b784f2c19f76f2af37d39"/><file name="gm.gif" hash="bcfe045327c84129e7d8118d9a7a5524"/><file name="gn.gif" hash="918580fdb7cd4df14d4805b9ac95f82c"/><file name="gp.gif" hash="15cf1ed243475f743fbd95813985724b"/><file name="gq.gif" hash="d7bef30dfa3e2ee2b6b1ea84eab0d047"/><file name="gr.gif" hash="d26600ec24ea1cd62a3042d1d68f2ac4"/><file name="gs.gif" hash="e3c0ab08adb27ea01a370f63926f232e"/><file name="gt.gif" hash="65511daa32c81a3eb2fb925e15101687"/><file name="gu.gif" hash="0bde69cee1c5862dcb000c6848d84273"/><file name="gw.gif" hash="162a7157154d909cd81bdc6632ecbc63"/><file name="gy.gif" hash="71a4f19942ccd37df09fa813943e5fee"/><file name="hk.gif" hash="692eea40bf0b08bac50f9785a843cb5f"/><file name="hm.gif" hash="1fe85ab1104e05f5a26efa5bbcd1cf18"/><file name="hn.gif" hash="c0e00f96daf73bd2bea3ad87c63aede2"/><file name="hr.gif" hash="825a4f07cfe3bf652e1e9ec72ee26f14"/><file name="ht.gif" hash="92a6d557d1adf362160e3bd0d774ecb7"/><file name="hu.gif" hash="d543f5932e461ef6b04c070a63ccd151"/><file name="id.gif" hash="6f27ba21a22aa1486b568aa200d6c73c"/><file name="ie.gif" hash="74924874aa60e9fda9d94dcb892e322a"/><file name="il.gif" hash="44d2cc7e87c0f39eda33a43234d75afd"/><file name="in.gif" hash="46e1776549c9bb866ae7b18f9d847b0a"/><file name="io.gif" hash="f6c43cf9bc8365d50b65019f9fc543d7"/><file name="iq.gif" hash="a4bd28a6c543211dacb5ce3e18e96846"/><file name="ir.gif" hash="6456dc4dd3745e2c84c13702eeb87844"/><file name="is.gif" hash="347f6ff824ac5e7a31fc549811c9aac7"/><file name="it.gif" hash="7b2fba7a5df93ea5980e1d46409642b2"/><file name="jm.gif" hash="98ea05ee62c0d4462f902b108b046439"/><file name="jo.gif" hash="ac7a3e1aace29eb636ed41332b4c68ae"/><file name="jp.gif" hash="b6fa87814a6e40fcdf41d79c5e06c406"/><file name="ke.gif" hash="6592c34b8a16505388c21e99508e580b"/><file name="kg.gif" hash="385d842f1918453025966751d5b551bf"/><file name="kh.gif" hash="2a0042042f0d6feea0c435f9833b1bd4"/><file name="ki.gif" hash="b01814ad07dee8bc4be5d3038cc8b6b5"/><file name="km.gif" hash="258ef6e0c4f69ba726277a93a51dac56"/><file name="kn.gif" hash="f23fe3a61ad0d78bb69c25711eeb249f"/><file name="kp.gif" hash="f45a650bf92b6ad6552bf618d2ffe75d"/><file name="kr.gif" hash="53ca55d29130501b6cd57b98f169701f"/><file name="kw.gif" hash="48d87006385685ae24764c0d9b595d9b"/><file name="ky.gif" hash="4d159d20cf64b712700756d32cde64ee"/><file name="kz.gif" hash="9faa30e94f43918d74d09b3eaaec6933"/><file name="la.gif" hash="334d5527bcd7e6901a6b729e632683df"/><file name="lb.gif" hash="2c3675c6a47325a4d2445e50afc929ae"/><file name="lc.gif" hash="b59f163f78321acb812595961d2ab111"/><file name="li.gif" hash="239e66bf39e8052587b504515a21f03b"/><file name="lk.gif" hash="8f906d20bf8ab9749e19958ad60e1584"/><file name="lr.gif" hash="21cd61ee215e4b0147ab4320822cf2fc"/><file name="ls.gif" hash="68af1c3f00b31ef072c99d95fa453ff6"/><file name="lt.gif" hash="017aa4fbed00bfd848fb021462c296e2"/><file name="lu.gif" hash="230678f649c90589bf40024bd9ffa294"/><file name="lv.gif" hash="2eb690f1af034a71573641bfcfcf603e"/><file name="ly.gif" hash="72a42cca81f2e81dc65d9dd6f772cd56"/><file name="ma.gif" hash="ad81d516864533d1869ed296603f6e7e"/><file name="mc.gif" hash="3322300de4324fde3ee51d3d4431dc00"/><file name="md.gif" hash="7a363edf7896c044c1031a4c2f78110a"/><file name="me.gif" hash="887b486043d315be7eb4be815e38ef58"/><file name="mg.gif" hash="8adc0f5fe9c73b87cd50d4fb49485ccc"/><file name="mh.gif" hash="cdfdd26cff13006fd5a7f3bcf433cba0"/><file name="mk.gif" hash="b8eaaa78b588dc5a78a213b665c3f41d"/><file name="ml.gif" hash="14bad568cfb82dde31f1d59eafe5f633"/><file name="mm.gif" hash="f0d6434e55addac1e1e0e9b43274c14a"/><file name="mn.gif" hash="df21fe047bf3840629594af786c510c5"/><file name="mo.gif" hash="04bb90bdf2614d372dec56449e912596"/><file name="mp.gif" hash="cac8345e9b3e072169bb833244ab68fd"/><file name="mq.gif" hash="aa80ab7a73d808d7b3570868cdc3d1fb"/><file name="mr.gif" hash="08c96ea87ff559d6dc6b4605fcbcfe40"/><file name="ms.gif" hash="d6a0a5e4472ffd96e7d4c7c8d91ed2b2"/><file name="mt.gif" hash="dc7a0aeb0f7280435a328cadce598b8f"/><file name="mu.gif" hash="9869ea31cbf8d3f2d1f42824122b61dd"/><file name="mv.gif" hash="9827918f9646eaa08854d45bef7ea093"/><file name="mw.gif" hash="12b2a62fae9c618544a56fef3d687306"/><file name="mx.gif" hash="7211e357363beb1da21ce32593b4f5a8"/><file name="my.gif" hash="51479ef74dfd0b2006983b6b9bff3d91"/><file name="mz.gif" hash="4b938aa9c776ea29cf0b51fb48f1767a"/><file name="na.gif" hash="a417cfe920429e7af07a98ea51aa22a5"/><file name="nc.gif" hash="2135f0fb410b2f0767a7b534c753b848"/><file name="ne.gif" hash="489f6052b3d124a6607d4cb6a00022e1"/><file name="nf.gif" hash="9f851132acffa1724a697ada9c539ff8"/><file name="ng.gif" hash="5ddf086d424340d2cd9a18e0f9c20ff9"/><file name="ni.gif" hash="bb8200af164d5a73758fa5822fbace10"/><file name="nl.gif" hash="82994b14a5992b5a3539b9c0a789297c"/><file name="no.gif" hash="bbc9011e876a122ea89923e6b730ec50"/><file name="np.gif" hash="07dcfcc7ade4117c8f5d908101c22328"/><file name="nr.gif" hash="2a73be7cc4c7ae728e53748f07ce5b07"/><file name="nu.gif" hash="d7ad59b643ac9e8ecfe2193d37d08dc4"/><file name="nz.gif" hash="5809a037a53791f4632ed2756adf966c"/><file name="om.gif" hash="72045d2de14bc2f0b04b3cddb3c93892"/><file name="pa.gif" hash="192c84595d7ffb76229892030e08e37f"/><file name="pe.gif" hash="983af8b4835a96641f85449f2779a831"/><file name="pf.gif" hash="53c0188190e727bd3ea04778b4e83a9d"/><file name="pg.gif" hash="c0e201f4833b5bb6fe8ac014162ad8d9"/><file name="ph.gif" hash="0630367a44279677e4bff7f09dc820e8"/><file name="pk.gif" hash="fe878d940e0e3030c7258feca05b2ebf"/><file name="pl.gif" hash="279fd88ddc4abbd4d808a087b653ea24"/><file name="pm.gif" hash="c74a19a09019278029760d4381e7fa8a"/><file name="pn.gif" hash="997fbcf797457e2658d8f6df066cef78"/><file name="pr.gif" hash="a48b81abee4dfc5f36947006b603747a"/><file name="ps.gif" hash="bf9849158592502d0e12ce36401d1925"/><file name="pt.gif" hash="b68938af019e2c74377327abbe3d4b5e"/><file name="pw.gif" hash="a19c54b3a802fa6ba217099df5c4659b"/><file name="py.gif" hash="bef5b19a0555c6b85fa8f46055e019c7"/><file name="qa.gif" hash="8de77aa8a0a825346fac6d29837c2449"/><file name="re.gif" hash="0a4673b07b377d1f58230f40f256d890"/><file name="ro.gif" hash="8569e94e81a39bbb43ed8445d1a92dd5"/><file name="rs.gif" hash="b193b9db485d06fda3656c5f174cb953"/><file name="ru.gif" hash="addac471b8ddc26a9f1f2fa235330d80"/><file name="rw.gif" hash="26c4bdfd43b5d836acd1dfdeaffa4cf4"/><file name="sa.gif" hash="94c55d70da8c458459597aa1d9b60112"/><file name="sb.gif" hash="76cf18354aa71695e488923f516fc23c"/><file name="sc.gif" hash="65c089b927687a801afd75528f1b6def"/><file name="sd.gif" hash="983179ead3080585811d73e729e678a1"/><file name="se.gif" hash="cf357235e945172661d7ee5fde26f909"/><file name="sg.gif" hash="2a46e9e31359baaeb4e6ab4b0b950961"/><file name="sh.gif" hash="041dff1f55c07bcda4f53a75be64af18"/><file name="si.gif" hash="b796cc14ec4516ae9098e57a7c391dab"/><file name="sj.gif" hash="bbc9011e876a122ea89923e6b730ec50"/><file name="sk.gif" hash="ffac49f21971212d048422d36a555d50"/><file name="sl.gif" hash="dfea6e55c87213abcca8e95ecca700dd"/><file name="sm.gif" hash="59f434ebf3668c85d1fbbffa751fff6e"/><file name="sn.gif" hash="379caf2d23ed870f9e0239ba93ee7551"/><file name="so.gif" hash="e1d51439b1153ae38776553a7bcf10d0"/><file name="sr.gif" hash="4e5415a5e3fbf7496007249478c12276"/><file name="st.gif" hash="6596dc6cdeed9b4979fbb5c7609e66f5"/><file name="sv.gif" hash="e3479c1d5ac76b8b7dcfb709cfd0083e"/><file name="sy.gif" hash="d86f69a9267f00e11030246c36109bc5"/><file name="sz.gif" hash="5d7b57a0a5883abcc3fe28c1d4b2df1d"/><file name="tc.gif" hash="0e5370c94999fb37c1a730337f431f50"/><file name="td.gif" hash="2782b3d0b1ab6eaa48d091fc938b97c6"/><file name="tf.gif" hash="9e1af29a601960b84f90fb2efacb9bd2"/><file name="tg.gif" hash="ece0a5d9d0ffa8662f66a37c667e9538"/><file name="th.gif" hash="a4be77cc567463a6ab33df47a6471f90"/><file name="tj.gif" hash="9b1b0ecd454b7ccad12431a2a0281914"/><file name="tk.gif" hash="c895d3c66ec3cf659b59d854ce1e0e9a"/><file name="tl.gif" hash="9e79c92f60fb33cbb83addf04c64c789"/><file name="tm.gif" hash="8453e36426a3acba26bac199c92fb095"/><file name="tn.gif" hash="30245ac4122c61accb380e162691f431"/><file name="to.gif" hash="ecacff3913a318a8556ed4dd7a6582a7"/><file name="tr.gif" hash="3c7e51066bea641449722616fdce2d21"/><file name="tt.gif" hash="5715707d79f5a81c9686c593f65f2e80"/><file name="tv.gif" hash="4a0b50aa81de8101f281a3d6dfbc4aa1"/><file name="tw.gif" hash="c6da9ab7f3bfe2fd202e993b99aa9158"/><file name="tz.gif" hash="6af3860230e7cc1b12049731a95f4e4d"/><file name="ua.gif" hash="acc1cf561309691198e59e23c9840d13"/><file name="ug.gif" hash="e29af593a8eacb68e81755c78a7dbf19"/><file name="um.gif" hash="8346f478516f733a68c500410fd57159"/><file name="us.gif" hash="4a0cdce756ed771a5d9a16114179d5e7"/><file name="uy.gif" hash="74786429627d504ad3d36b0c4a40a638"/><file name="uz.gif" hash="2eefb9f89353a9554188dc522d07c68b"/><file name="va.gif" hash="6f64ebd984e71e113042dfb5b5dfbd73"/><file name="vc.gif" hash="cf4329d0f1da7924b3eec1a0f725ce45"/><file name="ve.gif" hash="e067f0c4fbaa5ed99477581e86630faa"/><file name="vg.gif" hash="8510bbd7fc9843b558424ac411992732"/><file name="vi.gif" hash="6ab52e66bdf59c0826bb205307eec76a"/><file name="vn.gif" hash="66364a250886c943e1f40fb0762c0a63"/><file name="vu.gif" hash="269340d3432e0bf04aa2d20b1916d723"/><file name="wf.gif" hash="321ff7ca69712a9af5405291f972dd0a"/><file name="ws.gif" hash="32ac83d94d72fc5abb59dc917a07fc72"/><file name="ye.gif" hash="743f4826f90f1ccdf9400d100da04ae7"/><file name="yt.gif" hash="b8c20446453d8057fcc73db427ab9f9d"/><file name="za.gif" hash="c8d80912d6a8a8fc94cb856871a864cb"/><file name="zm.gif" hash="88d75c077c65a544c5676bc35eb3f6f4"/><file name="zw.gif" hash="fd5cc25e0cea7e07b0be89c5452c546c"/></dir></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/images/capita/flags/ad.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ae.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/af.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ag.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ai.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/al.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/am.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/an.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ao.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ar.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/as.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/at.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/au.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/aw.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ax.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/az.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ba.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/bb.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/bd.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/be.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/bf.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/bg.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/bh.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/bi.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/bj.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/bm.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/bn.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/bo.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/br.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/bs.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/bt.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/bv.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/bw.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/by.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/bz.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ca.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/catalonia.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/cc.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/cd.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/cf.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/cg.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ch.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ci.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ck.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/cl.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/cm.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/cn.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/co.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/cr.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/cs.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/cu.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/cv.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/cx.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/cy.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/cz.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/de.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/dj.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/dk.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/dm.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/do.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/dz.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ec.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ee.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/eg.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/eh.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/er.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/es.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/et.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/fi.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/fj.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/fk.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/fm.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/fo.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/fr.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ga.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gb.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gd.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ge.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gf.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gh.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gi.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gl.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gm.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gn.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gp.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gq.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gr.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gs.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gt.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gu.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gw.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/gy.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/hk.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/hm.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/hn.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/hr.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ht.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/hu.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/id.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ie.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/il.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/in.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/io.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/iq.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ir.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/is.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/it.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/jm.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/jo.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/jp.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ke.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/kg.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/kh.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ki.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/km.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/kn.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/kp.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/kr.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/kw.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ky.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/kz.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/la.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/lb.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/lc.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/li.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/lk.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/lr.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ls.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/lt.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/lu.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/lv.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ly.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ma.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mc.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/md.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/me.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mg.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mh.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mk.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ml.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mm.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mn.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mo.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mp.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mq.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mr.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ms.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mt.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mu.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mv.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mw.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mx.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/my.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/mz.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/na.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/nc.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ne.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/nf.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ng.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ni.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/nl.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/no.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/np.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/nr.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/nu.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/nz.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/om.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/pa.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/pe.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/pf.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/pg.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ph.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/pk.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/pl.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/pm.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/pn.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/pr.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ps.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/pt.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/pw.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/py.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/qa.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/re.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ro.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/rs.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ru.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/rw.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/sa.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/sb.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/sc.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/sd.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/se.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/sg.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/sh.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/si.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/sj.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/sk.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/sl.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/sm.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/sn.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/so.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/sr.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/st.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/sv.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/sy.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/sz.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/tc.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/td.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/tf.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/tg.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/th.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/tj.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/tk.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/tl.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/tm.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/tn.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/to.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/tr.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/tt.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/tv.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/tw.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/tz.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ua.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ug.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/um.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/us.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/uy.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/uz.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/va.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/vc.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ve.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/vg.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/vi.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/vn.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/vu.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/wf.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ws.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/ye.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/yt.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/za.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/zm.gif ADDED
Binary file
skin/adminhtml/default/default/images/capita/flags/zw.gif ADDED
Binary file