Magento_Mobile - Version 1.4.2.0.22.1

Version Notes

1.4.2.0.22.1 version of package
internal svn revision #121425

Download this release

Release Info

Developer Magento Core Team
Extension Magento_Mobile
Version 1.4.2.0.22.1
Comparing to
See all releases


Version 1.4.2.0.22.1

Files changed (204) hide show
  1. app/code/core/Mage/XmlConnect/Block/Adminhtml/History.php +48 -0
  2. app/code/core/Mage/XmlConnect/Block/Adminhtml/History/Grid.php +116 -0
  3. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile.php +53 -0
  4. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit.php +136 -0
  5. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Form.php +55 -0
  6. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Submission.php +49 -0
  7. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Cache.php +106 -0
  8. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Content.php +146 -0
  9. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design.php +98 -0
  10. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion.php +57 -0
  11. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion/Images.php +157 -0
  12. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion/Tabs.php +79 -0
  13. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion/Themes.php +77 -0
  14. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Preview.php +75 -0
  15. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Themes.php +199 -0
  16. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Flurryanalytics.php +161 -0
  17. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/General.php +168 -0
  18. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Notification.php +216 -0
  19. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Payment.php +288 -0
  20. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Settings.php +120 -0
  21. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Social.php +330 -0
  22. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Submission/History.php +163 -0
  23. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tabs.php +67 -0
  24. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Addrow.php +101 -0
  25. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Color.php +47 -0
  26. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Country.php +172 -0
  27. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Datetime.php +205 -0
  28. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Font.php +105 -0
  29. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Image.php +99 -0
  30. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Page.php +107 -0
  31. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Tabs.php +65 -0
  32. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Theme.php +52 -0
  33. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Grid.php +123 -0
  34. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Grid/Renderer/Bool.php +61 -0
  35. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Grid/Renderer/Type.php +53 -0
  36. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Preview/Content.php +55 -0
  37. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Preview/Tabitems.php +63 -0
  38. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission.php +121 -0
  39. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Form.php +54 -0
  40. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Renderer/Country/Androidmarket.php +47 -0
  41. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Renderer/Country/Istore.php +47 -0
  42. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tab/Container.php +99 -0
  43. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tab/Container/Submission.php +389 -0
  44. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tabs.php +49 -0
  45. app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Widget/Form.php +112 -0
  46. app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue.php +48 -0
  47. app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Edit.php +88 -0
  48. app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Edit/Form.php +166 -0
  49. app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid.php +184 -0
  50. app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Action.php +74 -0
  51. app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Application.php +51 -0
  52. app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Id.php +47 -0
  53. app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Msgtitle.php +51 -0
  54. app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Pushtitle.php +47 -0
  55. app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Status.php +69 -0
  56. app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Template.php +51 -0
  57. app/code/core/Mage/XmlConnect/Block/Adminhtml/Template.php +65 -0
  58. app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit.php +87 -0
  59. app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit/Form.php +160 -0
  60. app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid.php +159 -0
  61. app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid/Renderer/Application.php +51 -0
  62. app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Preview.php +69 -0
  63. app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Preview/Form.php +69 -0
  64. app/code/core/Mage/XmlConnect/Block/Cart.php +245 -0
  65. app/code/core/Mage/XmlConnect/Block/Cart/Crosssell.php +100 -0
  66. app/code/core/Mage/XmlConnect/Block/Cart/Info.php +75 -0
  67. app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer.php +261 -0
  68. app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer/Configurable.php +86 -0
  69. app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer/Grouped.php +51 -0
  70. app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Details.php +91 -0
  71. app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Review.php +128 -0
  72. app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Shippingmethods.php +118 -0
  73. app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mep/Totals.php +86 -0
  74. app/code/core/Mage/XmlConnect/Block/Cart/Totals.php +165 -0
  75. app/code/core/Mage/XmlConnect/Block/Catalog.php +75 -0
  76. app/code/core/Mage/XmlConnect/Block/Catalog/Category.php +122 -0
  77. app/code/core/Mage/XmlConnect/Block/Catalog/Category/Info.php +76 -0
  78. app/code/core/Mage/XmlConnect/Block/Catalog/Filters.php +68 -0
  79. app/code/core/Mage/XmlConnect/Block/Catalog/Product.php +165 -0
  80. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Attributes.php +64 -0
  81. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Gallery.php +89 -0
  82. app/code/core/Mage/XmlConnect/Block/Catalog/Product/List.php +202 -0
  83. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options.php +227 -0
  84. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Bundle.php +123 -0
  85. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Configurable.php +236 -0
  86. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Giftcard.php +316 -0
  87. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Grouped.php +102 -0
  88. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Simple.php +49 -0
  89. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Virtual.php +49 -0
  90. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price.php +98 -0
  91. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Bundle.php +425 -0
  92. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Default.php +828 -0
  93. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Giftcard.php +96 -0
  94. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Related.php +132 -0
  95. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Review.php +90 -0
  96. app/code/core/Mage/XmlConnect/Block/Catalog/Product/Review/List.php +115 -0
  97. app/code/core/Mage/XmlConnect/Block/Catalog/Search.php +144 -0
  98. app/code/core/Mage/XmlConnect/Block/Catalog/Search/Suggest.php +69 -0
  99. app/code/core/Mage/XmlConnect/Block/Checkout/Address/Billing.php +62 -0
  100. app/code/core/Mage/XmlConnect/Block/Checkout/Address/Form.php +234 -0
  101. app/code/core/Mage/XmlConnect/Block/Checkout/Address/Shipping.php +62 -0
  102. app/code/core/Mage/XmlConnect/Block/Checkout/Agreements.php +63 -0
  103. app/code/core/Mage/XmlConnect/Block/Checkout/Order/Review.php +74 -0
  104. app/code/core/Mage/XmlConnect/Block/Checkout/Order/Review/Info.php +191 -0
  105. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Authorizenet.php +128 -0
  106. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Ccsave.php +142 -0
  107. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Checkmo.php +73 -0
  108. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Authorizenet.php +37 -0
  109. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Ccsave.php +62 -0
  110. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Checkmo.php +71 -0
  111. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Free.php +50 -0
  112. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Paypal/Abstract.php +63 -0
  113. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Paypal/Express.php +37 -0
  114. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Paypal/Mecl.php +37 -0
  115. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Pbridge/Authorizenet.php +37 -0
  116. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Pbridge/Paypal/Direct.php +37 -0
  117. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Pbridge/Paypaluk/Direct.php +37 -0
  118. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Pbridge/Verisign.php +63 -0
  119. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Purchaseorder.php +59 -0
  120. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/List.php +366 -0
  121. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Paypal/Direct.php +62 -0
  122. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Paypal/Payflow.php +160 -0
  123. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Pbridge/Abstract.php +90 -0
  124. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Pbridge/Authorizenet.php +43 -0
  125. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Pbridge/Paypal.php +43 -0
  126. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Pbridge/Paypaluk.php +43 -0
  127. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Pbridge/Verisign.php +43 -0
  128. app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Purchaseorder.php +91 -0
  129. app/code/core/Mage/XmlConnect/Block/Checkout/Pbridge/Result.php +50 -0
  130. app/code/core/Mage/XmlConnect/Block/Checkout/Shipping/Method/Available.php +81 -0
  131. app/code/core/Mage/XmlConnect/Block/Checkout/Shipping/Method/Avaliable.php +39 -0
  132. app/code/core/Mage/XmlConnect/Block/Cms/Page.php +45 -0
  133. app/code/core/Mage/XmlConnect/Block/Configuration.php +125 -0
  134. app/code/core/Mage/XmlConnect/Block/Customer/Address/Form.php +466 -0
  135. app/code/core/Mage/XmlConnect/Block/Customer/Address/List.php +128 -0
  136. app/code/core/Mage/XmlConnect/Block/Customer/Form.php +96 -0
  137. app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Boolean.php +59 -0
  138. app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Date.php +110 -0
  139. app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/File.php +119 -0
  140. app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Image.php +88 -0
  141. app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Multiline.php +99 -0
  142. app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Multiselect.php +66 -0
  143. app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Select.php +66 -0
  144. app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Text.php +99 -0
  145. app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Textarea.php +43 -0
  146. app/code/core/Mage/XmlConnect/Block/Customer/GiftcardCheck.php +79 -0
  147. app/code/core/Mage/XmlConnect/Block/Customer/Order/Details.php +199 -0
  148. app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Bundle.php +226 -0
  149. app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Default.php +133 -0
  150. app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Downloadable.php +148 -0
  151. app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Giftcard.php +79 -0
  152. app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Grouped.php +62 -0
  153. app/code/core/Mage/XmlConnect/Block/Customer/Order/Items.php +94 -0
  154. app/code/core/Mage/XmlConnect/Block/Customer/Order/List.php +76 -0
  155. app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals.php +147 -0
  156. app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Customerbalance.php +66 -0
  157. app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Customerbalance/Refunded.php +66 -0
  158. app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Giftcards.php +78 -0
  159. app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Tax.php +93 -0
  160. app/code/core/Mage/XmlConnect/Block/Customer/Storecredit.php +121 -0
  161. app/code/core/Mage/XmlConnect/Block/Home.php +88 -0
  162. app/code/core/Mage/XmlConnect/Block/Review/Form.php +113 -0
  163. app/code/core/Mage/XmlConnect/Block/Wishlist.php +115 -0
  164. app/code/core/Mage/XmlConnect/Controller/Action.php +157 -0
  165. app/code/core/Mage/XmlConnect/Helper/Android.php +725 -0
  166. app/code/core/Mage/XmlConnect/Helper/Catalog/Category/Image.php +103 -0
  167. app/code/core/Mage/XmlConnect/Helper/Customer/Form/Renderer.php +59 -0
  168. app/code/core/Mage/XmlConnect/Helper/Customer/Order.php +304 -0
  169. app/code/core/Mage/XmlConnect/Helper/Data.php +865 -0
  170. app/code/core/Mage/XmlConnect/Helper/Image.php +788 -0
  171. app/code/core/Mage/XmlConnect/Helper/Ipad.php +750 -0
  172. app/code/core/Mage/XmlConnect/Helper/Iphone.php +797 -0
  173. app/code/core/Mage/XmlConnect/Helper/Payment.php +42 -0
  174. app/code/core/Mage/XmlConnect/Helper/Theme.php +395 -0
  175. app/code/core/Mage/XmlConnect/Model/Adminhtml/System/Config/Backend/Baseurl.php +50 -0
  176. app/code/core/Mage/XmlConnect/Model/Adminhtml/System/Config/Backend/Currency/Default.php +50 -0
  177. app/code/core/Mage/XmlConnect/Model/Application.php +1219 -0
  178. app/code/core/Mage/XmlConnect/Model/Catalog/Category/Image.php +206 -0
  179. app/code/core/Mage/XmlConnect/Model/Catalog/Category/Media/Config.php +75 -0
  180. app/code/core/Mage/XmlConnect/Model/ConfigData.php +221 -0
  181. app/code/core/Mage/XmlConnect/Model/Corefix/Checkout/Session.php +137 -0
  182. app/code/core/Mage/XmlConnect/Model/Corefix/Checkout/Type/Onepage.php +465 -0
  183. app/code/core/Mage/XmlConnect/Model/Corefix/Sales/Quote.php +427 -0
  184. app/code/core/Mage/XmlConnect/Model/History.php +73 -0
  185. app/code/core/Mage/XmlConnect/Model/Input/Filter/MaliciousCode.php +100 -0
  186. app/code/core/Mage/XmlConnect/Model/Mysql4/Application.php +128 -0
  187. app/code/core/Mage/XmlConnect/Model/Mysql4/Application/Collection.php +37 -0
  188. app/code/core/Mage/XmlConnect/Model/Mysql4/Cms/Page/Collection.php +63 -0
  189. app/code/core/Mage/XmlConnect/Model/Mysql4/ConfigData.php +107 -0
  190. app/code/core/Mage/XmlConnect/Model/Mysql4/ConfigData/Collection.php +177 -0
  191. app/code/core/Mage/XmlConnect/Model/Mysql4/Filter/Collection.php +101 -0
  192. app/code/core/Mage/XmlConnect/Model/Mysql4/History.php +84 -0
  193. app/code/core/Mage/XmlConnect/Model/Mysql4/History/Collection.php +69 -0
  194. app/code/core/Mage/XmlConnect/Model/Mysql4/Queue.php +37 -0
  195. app/code/core/Mage/XmlConnect/Model/Mysql4/Queue/Collection.php +103 -0
  196. app/code/core/Mage/XmlConnect/Model/Mysql4/Setup.php +29 -0
  197. app/code/core/Mage/XmlConnect/Model/Mysql4/Template.php +37 -0
  198. app/code/core/Mage/XmlConnect/Model/Mysql4/Template/Collection.php +72 -0
  199. app/code/core/Mage/XmlConnect/Model/Observer.php +121 -0
  200. app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Config.php +55 -0
  201. app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Mecl.php +82 -0
  202. app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Mep.php +114 -0
  203. app/code/core/Mage/XmlConnect/Model/Paypal/Mecl/Checkout.php +43 -0
  204. app/code/core/Mage/XmlConnect/Model/Paypal/Mep/Checkout.php +83 -0
app/code/core/Mage/XmlConnect/Block/Adminhtml/History.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect application submission history grid
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_History extends Mage_Adminhtml_Block_Widget_Grid_Container
35
+ {
36
+ /**
37
+ * Class constructor
38
+ */
39
+ public function __construct()
40
+ {
41
+ $this->_blockGroup = 'xmlconnect';
42
+ $this->_controller = 'adminhtml_history';
43
+ $this->_headerText = $this->__('App Submission History');
44
+
45
+ parent::__construct();
46
+ $this->removeButton('add');
47
+ }
48
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/History/Grid.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect application history grid
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_History_Grid extends Mage_Adminhtml_Block_Widget_Grid
35
+ {
36
+ /**
37
+ * Constructor
38
+ *
39
+ * Setting grid_id, sort order and sort direction
40
+ */
41
+ public function __construct()
42
+ {
43
+ parent::__construct();
44
+ $this->setId('app_history_grid');
45
+ $this->setDefaultSort('created_at');
46
+ $this->setDefaultDir('ASC');
47
+ }
48
+
49
+ /**
50
+ * Setting collection to show
51
+ *
52
+ * @return Mage_Adminhtml_Block_Widget_Grid
53
+ */
54
+ protected function _prepareCollection()
55
+ {
56
+ $collection = Mage::getModel('xmlconnect/history')->getCollection();
57
+ $this->setCollection($collection);
58
+ return parent::_prepareCollection();
59
+ }
60
+
61
+ /**
62
+ * Configuration of grid
63
+ *
64
+ * @return Mage_Adminhtml_Block_Widget_Grid
65
+ */
66
+ protected function _prepareColumns()
67
+ {
68
+ $this->addColumn('title', array(
69
+ 'header' => $this->__('App Title'),
70
+ 'align' => 'left',
71
+ 'index' => 'title',
72
+ 'type' => 'text',
73
+ 'escape' => true
74
+ ));
75
+
76
+ $this->addColumn('name', array(
77
+ 'header' => $this->__('App Name'),
78
+ 'align' => 'left',
79
+ 'index' => 'name',
80
+ 'escape' => true
81
+ ));
82
+
83
+ $this->addColumn('code', array(
84
+ 'header' => $this->__('App Code'),
85
+ 'align' => 'left',
86
+ 'index' => 'code',
87
+ 'escape' => true
88
+ ));
89
+
90
+ $this->addColumn('created_at', array(
91
+ 'header' => $this->__('Date Submitted'),
92
+ 'align' => 'left',
93
+ 'index' => 'created_at',
94
+ 'type' => 'datetime'
95
+ ));
96
+
97
+ $this->addColumn('activation_key', array(
98
+ 'header' => $this->__('Activation Key'),
99
+ 'align' => 'left',
100
+ 'index' => 'activation_key',
101
+ 'escape' => true
102
+ ));
103
+ return parent::_prepareColumns();
104
+ }
105
+
106
+ /**
107
+ * Remove row click url
108
+ *
109
+ * @param Mage_Catalog_Model_Product|Varien_Object $row
110
+ * @return string
111
+ */
112
+ public function getRowUrl($row)
113
+ {
114
+ return '';
115
+ }
116
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect application grid
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile extends Mage_Adminhtml_Block_Widget_Grid_Container
35
+ {
36
+ /**
37
+ * Class constructor
38
+ */
39
+ public function __construct()
40
+ {
41
+ $this->_controller = 'adminhtml_mobile';
42
+ $this->_blockGroup = 'xmlconnect';
43
+ $xmlconnectVersion = Mage::getConfig()->getNode(
44
+ Mage_XmlConnect_Model_Application::XML_PATH_MODULE_VERSION
45
+ );
46
+ $this->_headerText = $this->__('Manage Apps')
47
+ . ' '
48
+ . $this->__('ver. %s', $xmlconnectVersion);
49
+ $this->_addButtonLabel = $this->__('Add App');
50
+
51
+ parent::__construct();
52
+ }
53
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Application edit block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit
35
+ extends Mage_Adminhtml_Block_Widget_Form_Container
36
+ {
37
+ /**
38
+ * Setting app action buttons for application
39
+ */
40
+ public function __construct()
41
+ {
42
+ $this->_objectId = 'application_id';
43
+ $this->_controller = 'adminhtml_mobile';
44
+ $this->_blockGroup = 'xmlconnect';
45
+ parent::__construct();
46
+ if ((bool)!Mage::getSingleton('adminhtml/session')->getNewApplication()) {
47
+ $app = Mage::helper('xmlconnect')->getApplication();
48
+ $this->_updateButton('save', 'label', $this->__('Save'));
49
+ $this->_updateButton('save', 'onclick', 'if (editForm.submit()) {disableElements(\'save\')}');
50
+
51
+ $this->_addButton('save_and_continue', array(
52
+ 'label' => $this->__('Save and Continue Edit'),
53
+ 'onclick' => 'saveAndContinueEdit()',
54
+ 'class' => 'save',
55
+ ), -5);
56
+
57
+ if ($app->getId()) {
58
+ $this->_addButton('submit_application_button', array(
59
+ 'label' => $this->__('Save and Submit App'),
60
+ 'onclick' => 'saveAndSubmitApp()',
61
+ 'class' => 'save'
62
+ ), -10);
63
+ }
64
+
65
+ $this->_formScripts[] = 'function saveAndContinueEdit() {'
66
+ .'if (editForm.submit($(\'edit_form\').action + \'back/edit/\')) {disableElements(\'save\')};}';
67
+ if ($app->getId()) {
68
+ $this->_formScripts[] = 'function saveAndSubmitApp() {'
69
+ .'if (editForm.submit($(\'edit_form\').action + \'submitapp/' . $app->getId() . '\')) {'
70
+ .'disableElements(\'save\')};}';
71
+ }
72
+ } else {
73
+ $this->removeButton('save');
74
+ $this->removeButton('delete');
75
+ }
76
+
77
+ if (isset($app) && $app->getIsSubmitted()) {
78
+ $this->removeButton('delete');
79
+ }
80
+ $this->removeButton('reset');
81
+ }
82
+
83
+ /**
84
+ * Adding JS scripts and styles to block
85
+ *
86
+ * @throws Mage_Core_Exception
87
+ * @return Mage_Adminhtml_Block_Widget_Form_Container
88
+ */
89
+ protected function _prepareLayout()
90
+ {
91
+ $this->getLayout()->getBlock('head')->addJs('jscolor/jscolor.js');
92
+ $this->getLayout()->getBlock('head')->addJs('scriptaculous/scriptaculous.js');
93
+
94
+ if ((bool)!Mage::getSingleton('adminhtml/session')->getNewApplication()) {
95
+ $deviceType = Mage::helper('xmlconnect')->getDeviceType();
96
+ switch ($deviceType) {
97
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE:
98
+ $this->getLayout()->getBlock('head')->addItem('skin_css', 'xmlconnect/mobile-home.css');
99
+ $this->getLayout()->getBlock('head')->addItem('skin_css', 'xmlconnect/mobile-catalog.css');
100
+ break;
101
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD:
102
+ $this->getLayout()->getBlock('head')->addItem('skin_css', 'xmlconnect/mobile-ipad-home.css');
103
+ $this->getLayout()->getBlock('head')->addItem('skin_css', 'xmlconnect/mobile-ipad-catalog.css');
104
+ break;
105
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID:
106
+ $this->getLayout()->getBlock('head')->addItem('skin_css', 'xmlconnect/mobile-android.css');
107
+ break;
108
+ default:
109
+ Mage::throwException(
110
+ $this->__('Device doesn\'t recognized: "%s". Unable to load preview model.', $deviceType)
111
+ );
112
+ break;
113
+ }
114
+ }
115
+
116
+ return parent::_prepareLayout();
117
+ }
118
+
119
+ /**
120
+ * Get form header title
121
+ *
122
+ * @return string
123
+ */
124
+ public function getHeaderText()
125
+ {
126
+ if ((bool)!Mage::getSingleton('adminhtml/session')->getNewApplication()) {
127
+ $app = Mage::helper('xmlconnect')->getApplication();
128
+ }
129
+
130
+ if (isset($app) && $app->getId()) {
131
+ return $this->__('Edit App "%s"', $this->htmlEscape($app->getName()));
132
+ } else {
133
+ return $this->__('New App');
134
+ }
135
+ }
136
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Form.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Application Form block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
35
+ {
36
+ /**
37
+ * Prepare form before rendering HTML
38
+ * Setting Form Fieldsets and fields
39
+ *
40
+ * @return Mage_Adminhtml_Block_Widget_Form
41
+ */
42
+ protected function _prepareForm()
43
+ {
44
+ $form = new Varien_Data_Form(array('id' => 'edit_form',
45
+ 'action' => Mage::getSingleton('adminhtml/session')->getNewApplication()
46
+ ? $this->getUrl('*/mobile/edit', array('_current' => true))
47
+ : $this->getUrl('*/mobile/save'),
48
+ 'method' => 'post',
49
+ 'enctype' => 'multipart/form-data'
50
+ ));
51
+ $form->setUseContainer(true);
52
+ $this->setForm($form);
53
+ return parent::_prepareForm();
54
+ }
55
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Submission.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Application Submission block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Submission
35
+ extends Mage_Adminhtml_Block_Widget_Tabs
36
+ {
37
+ /**
38
+ * Constructor
39
+ *
40
+ * Setting grid_id, DOM destination element id
41
+ *
42
+ */
43
+ public function __construct()
44
+ {
45
+ parent::__construct();
46
+ $this->setId('mobile_app_submit');
47
+ $this->setDestElementId('content');
48
+ }
49
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Cache.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Tab for Cache Management
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Cache
35
+ extends Mage_Adminhtml_Block_Widget_Form
36
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
+ {
38
+ /**
39
+ * Prepare form before rendering HTML
40
+ * Setting Form Fieldsets and fields
41
+ *
42
+ * @return Mage_Adminhtml_Block_Widget_Form
43
+ */
44
+ protected function _prepareForm()
45
+ {
46
+ $form = new Varien_Data_Form();
47
+ $this->setForm($form);
48
+
49
+ $data = Mage::helper('xmlconnect')->getApplication()->getFormData();
50
+
51
+ $fieldset = $form->addFieldset('cache_management', array('legend' => $this->__('Cache Management')));
52
+ if (isset($data['conf[native][cacheLifetime]'])) {
53
+ $lifetime = $data['conf[native][cacheLifetime]'];
54
+ } else {
55
+ $lifetime = Mage::helper('xmlconnect')->getDefaultCacheLifetime();
56
+ }
57
+ $fieldset->addField('conf/native/cacheLifetime', 'text', array(
58
+ 'label' => $this->__('Cache Lifetime (seconds)'),
59
+ 'name' => 'conf[native][cacheLifetime]',
60
+ 'value' => $lifetime,
61
+ 'note' => $this->__('If you want to disable the cache on the application side, leave the field empty. Warning! When disabling cache, the application will take time to load each page.'),
62
+ ));
63
+
64
+ return parent::_prepareForm();
65
+ }
66
+
67
+ /**
68
+ * Tab label getter
69
+ *
70
+ * @return string
71
+ */
72
+ public function getTabLabel()
73
+ {
74
+ return $this->__('Cache Management');
75
+ }
76
+
77
+ /**
78
+ * Tab title getter
79
+ *
80
+ * @return string
81
+ */
82
+ public function getTabTitle()
83
+ {
84
+ return $this->__('Cache Management');
85
+ }
86
+
87
+ /**
88
+ * Check if tab can be shown
89
+ *
90
+ * @return bool
91
+ */
92
+ public function canShowTab()
93
+ {
94
+ return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication();
95
+ }
96
+
97
+ /**
98
+ * Check if tab hidden
99
+ *
100
+ * @return bool
101
+ */
102
+ public function isHidden()
103
+ {
104
+ return false;
105
+ }
106
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Content.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Tab for Content Management
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Content
35
+ extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
36
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
+ {
38
+ protected $_pages;
39
+
40
+ /**
41
+ * Class constructor
42
+ * Setting view option
43
+ */
44
+ public function __construct()
45
+ {
46
+ parent::__construct();
47
+ $this->setShowGlobalIcon(true);
48
+ }
49
+
50
+ /**
51
+ * Add page input to fieldset
52
+ *
53
+ * @param Varien_Data_Form_Element_Fieldset $fieldset
54
+ * @param string $fieldPrefix
55
+ */
56
+ protected function _addPage($fieldset, $fieldPrefix)
57
+ {
58
+ $element = $fieldset->addField($fieldPrefix, 'page', array(
59
+ 'name' => $fieldPrefix,
60
+ ));
61
+ $element->initFields(array(
62
+ 'name' => $fieldPrefix,
63
+ 'values' => $this->_pages,
64
+ ));
65
+ }
66
+
67
+ /**
68
+ * Prepare form before rendering HTML
69
+ * Setting Form Fieldsets and fields
70
+ *
71
+ * @return Mage_Adminhtml_Block_Widget_Form
72
+ */
73
+ protected function _prepareForm()
74
+ {
75
+ $model = Mage::helper('xmlconnect')->getApplication();
76
+ $conf = $model->getConf();
77
+ $form = new Varien_Data_Form();
78
+ $this->setForm($form);
79
+
80
+ $pages = Mage::getResourceModel('xmlconnect/cms_page_collection')->toOptionIdArray();
81
+ $dummy = array(array( 'value' => '', 'label' => '' ));
82
+ $this->_pages = array_merge($dummy, $pages);
83
+
84
+ $fieldset = $form->addFieldset('cms_pages', array('legend' => $this->__('Pages')));
85
+ $this->_addElementTypes($fieldset);
86
+
87
+ $fieldset->addField('page_row_add', 'addrow', array(
88
+ 'onclick' => 'insertNewTableRow(this)',
89
+ 'options' => $this->_pages,
90
+ 'class' => ' scalable save ',
91
+ 'label' => $this->__('Label'),
92
+ 'before_element_html' => $this->__('Get Content from CMS Page').'</td><td class="label">',
93
+ ));
94
+
95
+ if (!empty($conf['native']['pages'])) {
96
+ foreach ($conf['native']['pages'] as $key=>$dummy) {
97
+ $this->_addPage($fieldset, 'conf[native][pages]['.$key.']');
98
+ }
99
+ }
100
+
101
+ $data = $model->getFormData();
102
+ $data['page_row_add'] = $this->__('Add Page');
103
+ $form->setValues($data);
104
+ return parent::_prepareForm();
105
+ }
106
+
107
+ /**
108
+ * Prepare label for tab
109
+ *
110
+ * @return string
111
+ */
112
+ public function getTabLabel()
113
+ {
114
+ return $this->__('Content');
115
+ }
116
+
117
+ /**
118
+ * Prepare title for tab
119
+ *
120
+ * @return string
121
+ */
122
+ public function getTabTitle()
123
+ {
124
+ return $this->__('Content');
125
+ }
126
+
127
+ /**
128
+ * Returns status flag about this tab can be shown or not
129
+ *
130
+ * @return true
131
+ */
132
+ public function canShowTab()
133
+ {
134
+ return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication();
135
+ }
136
+
137
+ /**
138
+ * Returns status flag about this tab hidden or not
139
+ *
140
+ * @return false
141
+ */
142
+ public function isHidden()
143
+ {
144
+ return false;
145
+ }
146
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Tab for Design Management
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design
35
+ extends Mage_Adminhtml_Block_Template
36
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
+ {
38
+ /**
39
+ * Set design tab template
40
+ * Set to show global icon
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+ $this->setShowGlobalIcon(true);
46
+ $this->setTemplate('xmlconnect/edit/tab/design.phtml');
47
+ }
48
+
49
+ /**
50
+ * Tab label getter
51
+ *
52
+ * @return string
53
+ */
54
+ public function getTabLabel()
55
+ {
56
+ return $this->__('Design');
57
+ }
58
+
59
+ /**
60
+ * Tab title getter
61
+ *
62
+ * @return string
63
+ */
64
+ public function getTabTitle()
65
+ {
66
+ return $this->__('Design');
67
+ }
68
+
69
+ /**
70
+ * Check if tab can be shown
71
+ *
72
+ * @return bool
73
+ */
74
+ public function canShowTab()
75
+ {
76
+ return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication();
77
+ }
78
+
79
+ /**
80
+ * Check if tab hidden
81
+ *
82
+ * @return bool
83
+ */
84
+ public function isHidden()
85
+ {
86
+ return false;
87
+ }
88
+
89
+ /**
90
+ * Check if we have to show Preview Block
91
+ *
92
+ * @return bool
93
+ */
94
+ public function canShowPreview()
95
+ {
96
+ return true;
97
+ }
98
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Tab design accordion xml renderer
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Xmlconnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion
35
+ extends Mage_Adminhtml_Block_Widget_Accordion
36
+ {
37
+ /**
38
+ * Add accordion item by specified block
39
+ *
40
+ * @param string $itemId
41
+ * @param mixed $block
42
+ */
43
+ public function addAccordionItem($itemId, $block)
44
+ {
45
+ if (strpos($block, '/') !== false) {
46
+ $block = $this->getLayout()->createBlock($block);
47
+ } else {
48
+ $block = $this->getLayout()->getBlock($block);
49
+ }
50
+
51
+ $this->addItem($itemId, array(
52
+ 'title' => $block->getTitle(),
53
+ 'content' => $block->toHtml(),
54
+ 'open' => $block->getIsOpen(),
55
+ ));
56
+ }
57
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion/Images.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Tab design Accordion Images xml renderer
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Xmlconnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Images
35
+ extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
36
+ {
37
+ /**
38
+ * Getter for accordion item title
39
+ *
40
+ * @return string
41
+ */
42
+ public function getTitle()
43
+ {
44
+ return $this->__('Images');
45
+ }
46
+
47
+ /**
48
+ * Getter for accordion item is open flag
49
+ *
50
+ * @return bool
51
+ */
52
+ public function getIsOpen()
53
+ {
54
+ return true;
55
+ }
56
+
57
+ /**
58
+ * Prepare form
59
+ *
60
+ * @throws Mage_Core_Exception
61
+ * @return Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
62
+ */
63
+ protected function _prepareForm()
64
+ {
65
+ $form = new Varien_Data_Form();
66
+
67
+ $fieldset = $form->addFieldset('field_logo', array());
68
+ $this->_addElementTypes($fieldset);
69
+ $this->addImage($fieldset,
70
+ 'conf[native][navigationBar][icon]',
71
+ $this->__('Logo in Header'),
72
+ $this->__('Recommended size 35px x 35px.'),
73
+ $this->_getDesignPreviewImageUrl('conf/native/navigationBar/icon'),
74
+ true
75
+ );
76
+
77
+ $deviceType = Mage::helper('xmlconnect')->getDeviceType();
78
+ switch ($deviceType) {
79
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE:
80
+ $this->addImage($fieldset,
81
+ 'conf[native][body][bannerImage]',
82
+ $this->__('Banner on Home Screen'),
83
+ $this->__('Recommended size 320px x 230px. Note: Image size affects the performance of your app. Keep your image size below 50 KB for optimal performance.'),
84
+ $this->_getDesignPreviewImageUrl('conf/native/body/bannerImage'),
85
+ true
86
+ );
87
+ $this->addImage($fieldset,
88
+ 'conf[native][body][backgroundImage]',
89
+ $this->__('App Background'),
90
+ $this->__('Recommended size 320px x 367px. Note: Image size affects the performance of your app. Keep your image size below 75 KB for optimal performance.'),
91
+ $this->_getDesignPreviewImageUrl('conf/native/body/backgroundImage'),
92
+ true
93
+ );
94
+ break;
95
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD:
96
+ $this->addImage($fieldset,
97
+ 'conf[native][body][bannerIpadLandscapeImage]',
98
+ $this->__('Banner on Home Screen <br />(landscape mode)'),
99
+ $this->__('Recommended size 1024px x 344px. Note: Image size affects the performance of your app.'),
100
+ $this->_getDesignPreviewImageUrl('conf/native/body/bannerIpadLandscapeImage'),
101
+ true
102
+ );
103
+ $this->addImage($fieldset,
104
+ 'conf[native][body][bannerIpadImage]',
105
+ $this->__('Banner on Home Screen <br />(portrait mode)'),
106
+ $this->__('Recommended size 768px x 294px. Note: Image size affects the performance of your app.'),
107
+ $this->_getDesignPreviewImageUrl('conf/native/body/bannerIpadImage'),
108
+ true
109
+ );
110
+ $this->addImage($fieldset,
111
+ 'conf[native][body][backgroundIpadLandscapeImage]',
112
+ $this->__('App Background <br />(landscape mode)'),
113
+ $this->__('Recommended size 1024px x 704px. Note: Image size affects the performance of your app.'),
114
+ $this->_getDesignPreviewImageUrl('conf/native/body/backgroundIpadLandscapeImage'),
115
+ true
116
+ );
117
+ $this->addImage($fieldset,
118
+ 'conf[native][body][backgroundIpadPortraitImage]',
119
+ $this->__('App Background <br />(portrait mode)'),
120
+ $this->__('Recommended size 768px x 960px. Note: Image size affects the performance of your app.'),
121
+ $this->_getDesignPreviewImageUrl('conf/native/body/backgroundIpadPortraitImage'),
122
+ true
123
+ );
124
+ break;
125
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID:
126
+ $this->addImage($fieldset,
127
+ 'conf[native][body][bannerAndroidImage]',
128
+ $this->__('Banner on Home Screen'),
129
+ $this->__('Recommended size 320px x 258px. Note: Image size affects the performance of your app. Keep your image size below 50 KB for optimal performance.'),
130
+ $this->_getDesignPreviewImageUrl('conf/native/body/bannerAndroidImage'),
131
+ true
132
+ );
133
+ break;
134
+ default:
135
+ Mage::throwException(
136
+ $this->__('Device doesn\'t recognized: "%s". Unable to load a helper.', $deviceType)
137
+ );
138
+ break;
139
+ }
140
+
141
+ $form->setValues(Mage::helper('xmlconnect')->getApplication()->getFormData());
142
+ $this->setForm($form);
143
+ return parent::_prepareForm();
144
+ }
145
+
146
+ /**
147
+ * Retrieve url for images in the skin folder
148
+ *
149
+ * @param string $name - path to file name relative to the skin dir
150
+ * @return string
151
+ */
152
+ protected function _getDesignPreviewImageUrl($name)
153
+ {
154
+ $name = Mage::helper('xmlconnect/image')->getInterfaceImagesPaths($name);
155
+ return Mage::helper('xmlconnect/image')->getDefaultDesignUrl($name);
156
+ }
157
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion/Tabs.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Device tabs accordion block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Tabs
35
+ extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
36
+ {
37
+ /**
38
+ * Getter for accordion item title
39
+ *
40
+ * @return string
41
+ */
42
+ public function getTitle()
43
+ {
44
+ if (Mage::helper('xmlconnect')->getDeviceType() == Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD) {
45
+ $title = $this->__('Extensions');
46
+ } else {
47
+ $title = $this->__('Tabs');
48
+ }
49
+ return $title;
50
+ }
51
+
52
+ /**
53
+ * Getter for accordion item is open flag
54
+ *
55
+ * @return bool
56
+ */
57
+ public function getIsOpen()
58
+ {
59
+ return true;
60
+ }
61
+
62
+ /**
63
+ * Prepare form
64
+ *
65
+ * @return Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
66
+ */
67
+ protected function _prepareForm()
68
+ {
69
+ $form = new Varien_Data_Form();
70
+
71
+ $fieldset = $form->addFieldset('field_tabs', array());
72
+ $this->_addElementTypes($fieldset);
73
+ $fieldset->addField('conf[extra][tabs]', 'tabs', array('name' => 'conf[extra][tabs]'));
74
+
75
+ $form->setValues(Mage::helper('xmlconnect')->getApplication()->getFormData());
76
+ $this->setForm($form);
77
+ return parent::_prepareForm();
78
+ }
79
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Accordion/Themes.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Device design themes accordion block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Accordion_Themes
35
+ extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
36
+ {
37
+ /**
38
+ * Getter for accordion item title
39
+ *
40
+ * @return string
41
+ */
42
+ public function getTitle()
43
+ {
44
+ return $this->__('Color Themes');
45
+ }
46
+
47
+ /**
48
+ * Getter for accordion item is open flag
49
+ *
50
+ * @return bool
51
+ */
52
+ public function getIsOpen()
53
+ {
54
+ return true;
55
+ }
56
+
57
+ /**
58
+ * Add theme field
59
+ *
60
+ * @return Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
61
+ */
62
+ protected function _prepareForm()
63
+ {
64
+ $form = new Varien_Data_Form();
65
+
66
+ $fieldset = $form->addFieldset('field_colors', array());
67
+ $this->_addElementTypes($fieldset);
68
+ $fieldset->addField('theme', 'theme', array(
69
+ 'name' => 'theme',
70
+ 'themes' => Mage::helper('xmlconnect/theme')->getAllThemes(),
71
+ ));
72
+ $form->setValues(Mage::helper('xmlconnect')->getApplication()->getFormData());
73
+ $this->setForm($form);
74
+
75
+ return parent::_prepareForm();
76
+ }
77
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Preview.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Tab design preview xml renderer
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Xmlconnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Preview
35
+ extends Mage_Adminhtml_Block_Template
36
+ {
37
+ /**
38
+ * Set preview template
39
+ */
40
+ public function __construct()
41
+ {
42
+ parent::__construct();
43
+
44
+ $device = Mage::helper('xmlconnect')->getDeviceType();
45
+ if (array_key_exists($device, Mage::helper('xmlconnect')->getSupportedDevices())) {
46
+ $template = 'xmlconnect/edit/tab/design/preview_' . strtolower($device) . '.phtml';
47
+ } else {
48
+ Mage::throwException(
49
+ $this->__('Device doesn\'t recognized. Unable to load a template.')
50
+ );
51
+ }
52
+
53
+ $this->setTemplate($template);
54
+ }
55
+
56
+ /**
57
+ * Retieve preview action url
58
+ *
59
+ * @param string $page
60
+ * @return string
61
+ */
62
+ public function getPreviewActionUrl($page = 'home')
63
+ {
64
+ $params = array();
65
+ $model = Mage::helper('xmlconnect')->getApplication();
66
+ if ($model !== null) {
67
+ if ($model->getId() !== null) {
68
+ $params = array('application_id' => $model->getId());
69
+ } else {
70
+ $params = array('devtype' => $model->getType());
71
+ }
72
+ }
73
+ return $this->getUrl('*/*/preview' . $page, $params);
74
+ }
75
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Themes.php ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Device design themes block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Themes extends Mage_Adminhtml_Block_Template
35
+ {
36
+ /**
37
+ * Set themes template and color fieldsets
38
+ */
39
+ public function __construct()
40
+ {
41
+ parent::__construct();
42
+
43
+ $model = Mage::helper('xmlconnect')->getApplication();
44
+ $this->setTemplate('xmlconnect/form/element/themes.phtml');
45
+
46
+ $data = $model->getFormData();
47
+ $this->setColorFieldset(array(
48
+ array('id' => 'field_colors', 'label' => $this->__('Colors'), 'fields' => array(
49
+ $this->_addColorBox(
50
+ 'conf[native][navigationBar][tintColor]',
51
+ $this->__('Header Background Color'),
52
+ $data
53
+ ),
54
+ $this->_addColorBox(
55
+ 'conf[native][body][primaryColor]',
56
+ $this->__('Primary Color'),
57
+ $data
58
+ ),
59
+ $this->_addColorBox(
60
+ 'conf[native][body][secondaryColor]',
61
+ $this->__('Secondary Color'),
62
+ $data
63
+ ),
64
+ $this->_addColorBox(
65
+ 'conf[native][categoryItem][backgroundColor]',
66
+ $this->__('Category Item Background Color'),
67
+ $data
68
+ ),
69
+ $this->_addColorBox(
70
+ 'conf[native][categoryItem][tintColor]',
71
+ $this->__('Category Button Color'),
72
+ $data
73
+ ),
74
+ )),
75
+ array('id' => 'field_fonts', 'label' => $this->__('Fonts'), 'fields' => array(
76
+ $this->_addColorBox(
77
+ 'conf[extra][fontColors][header]',
78
+ $this->__('Header Font Color'),
79
+ $data
80
+ ),
81
+ $this->_addColorBox(
82
+ 'conf[extra][fontColors][primary]',
83
+ $this->__('Primary Font Color'),
84
+ $data
85
+ ),
86
+ $this->_addColorBox(
87
+ 'conf[extra][fontColors][secondary]',
88
+ $this->__('Secondary Font Color'),
89
+ $data
90
+ ),
91
+ $this->_addColorBox(
92
+ 'conf[extra][fontColors][price]',
93
+ $this->__('Price Font Color'),
94
+ $data
95
+ ),
96
+ )),
97
+ array('id' => 'field_advanced', 'label' => $this->__('Advanced Settings'), 'fields' => array(
98
+ $this->_addColorBox(
99
+ 'conf[native][body][backgroundColor]',
100
+ $this->__('Background Color'),
101
+ $data
102
+ ),
103
+ $this->_addColorBox(
104
+ 'conf[native][body][scrollBackgroundColor]',
105
+ $this->__('Scroll Background Color'),
106
+ $data
107
+ ),
108
+ $this->_addColorBox(
109
+ 'conf[native][itemActions][relatedProductBackgroundColor]',
110
+ $this->__('Related Product Background Color'),
111
+ $data
112
+ ),
113
+ )),
114
+ ));
115
+ }
116
+
117
+ /**
118
+ * Themes array getter
119
+ *
120
+ * @return array
121
+ */
122
+ public function getAllThemes()
123
+ {
124
+ $result = array();
125
+
126
+ foreach ($this->getThemes() as $theme) {
127
+ $result[$theme->getName()] = $theme->getFormData();
128
+ }
129
+ return $result;
130
+ }
131
+
132
+ /**
133
+ * Create color field params
134
+ *
135
+ * @param id $id
136
+ * @param string $label
137
+ * @param array $data
138
+ * @return array
139
+ */
140
+ protected function _addColorBox($id, $label, $data)
141
+ {
142
+ return array(
143
+ 'id' => $id,
144
+ 'name' => $id,
145
+ 'label' => $label,
146
+ 'value' => isset($data[$id]) ? $data[$id] : ''
147
+ );
148
+ }
149
+
150
+ /**
151
+ * Getter, check if it's needed to load default theme config
152
+ *
153
+ * @return bool
154
+ */
155
+ public function getDefaultThemeLoaded()
156
+ {
157
+ return Mage::helper('xmlconnect')->getApplication()->getDefaultThemeLoaded();
158
+ }
159
+
160
+ /**
161
+ * Check if adding new Application
162
+ *
163
+ * @return bool
164
+ */
165
+ public function isNewApplication()
166
+ {
167
+ return Mage::helper('xmlconnect')->getApplication()->getId() ? false : true;
168
+ }
169
+
170
+ /**
171
+ * Save theme action url getter
172
+ *
173
+ * @return string
174
+ */
175
+ public function getSaveThemeActionUrl()
176
+ {
177
+ return $this->getUrl('*/*/saveTheme');
178
+ }
179
+
180
+ /**
181
+ * Get delete theme action url
182
+ *
183
+ * @return string
184
+ */
185
+ public function getDeleteThemeActionUrl()
186
+ {
187
+ return $this->getUrl('*/*/deleteTheme');
188
+ }
189
+
190
+ /**
191
+ * Reset theme action url getter
192
+ *
193
+ * @return string
194
+ */
195
+ public function getResetThemeActionUrl()
196
+ {
197
+ return $this->getUrl('*/*/resetTheme');
198
+ }
199
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Flurryanalytics.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Tab for Flurry Analytics Management
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Flurryanalytics
35
+ extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
36
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
+ {
38
+ protected $_pages;
39
+
40
+ /**
41
+ * Constructor
42
+ * Setting view options
43
+ */
44
+ public function __construct()
45
+ {
46
+ parent::__construct();
47
+ $this->setShowGlobalIcon(true);
48
+ }
49
+
50
+ /**
51
+ * Prepare form before rendering HTML
52
+ * Setting Form Fieldsets and fields
53
+ *
54
+ * @return Mage_Adminhtml_Block_Widget_Form
55
+ */
56
+ protected function _prepareForm()
57
+ {
58
+ $form = new Varien_Data_Form();
59
+
60
+ $this->setForm($form);
61
+
62
+ $data = Mage::helper('xmlconnect')->getApplication()->getFormData();
63
+ $yesNoValues = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
64
+
65
+ $fieldset = $form->addFieldset('flurryAnalytics', array('legend' => $this->__('Flurry Analytics')));
66
+
67
+ if (isset($data['conf[native][merchantFlurryTracking][isActive]'])) {
68
+ $isActiveValue = $data['conf[native][merchantFlurryTracking][isActive]'];
69
+ } else {
70
+ $isActiveValue = '0';
71
+ }
72
+
73
+ $enabled = $fieldset->addField('conf/native/merchantFlurryTracking/isActive', 'select', array(
74
+ 'label' => $this->__('Enable Flurry Analytics'),
75
+ 'name' => 'conf[native][merchantFlurryTracking][isActive]',
76
+ 'values' => $yesNoValues,
77
+ 'note' => $this->__('Enable Flurry Analytics for the merchant.'),
78
+ 'value' => $isActiveValue
79
+ ));
80
+
81
+ $flurryAnalyticsUrl = $this->escapeHtml(
82
+ Mage::getStoreConfig('xmlconnect/flurry_analytics/statistics_url')
83
+ );
84
+
85
+ $fieldset->addField('flurry_analytics_link', 'link', array(
86
+ 'title' => $this->__('Flurry Analytics Site'),
87
+ 'label' => $this->__('Flurry Analytics Site'),
88
+ 'value' => $flurryAnalyticsUrl,
89
+ 'href' => $flurryAnalyticsUrl,
90
+ 'target' => '__blank',
91
+ 'note' => $this->__('You can watch statistics here.'),
92
+ ));
93
+
94
+ if (isset($data['conf[native][merchantFlurryTracking][accountId]'])) {
95
+ $accountIdValue = $data['conf[native][merchantFlurryTracking][accountId]'];
96
+ } else {
97
+ $accountIdValue = '';
98
+ }
99
+
100
+ $flurryApiCode = $fieldset->addField('conf/native/merchantFlurryTracking/accountId', 'text', array(
101
+ 'label' => $this->__('Flurry API Code'),
102
+ 'name' => 'conf[native][merchantFlurryTracking][accountId]',
103
+ 'enabled' => true,
104
+ 'required' => true,
105
+ 'value' => $accountIdValue
106
+ ));
107
+
108
+ // field dependencies
109
+ $this->setChild('form_after', $this->getLayout()
110
+ ->createBlock('adminhtml/widget_form_element_dependence')
111
+ ->addFieldMap($flurryApiCode->getHtmlId(), $flurryApiCode->getName())
112
+ ->addFieldMap($enabled->getHtmlId(), $enabled->getName())
113
+ ->addFieldDependence(
114
+ $flurryApiCode->getName(),
115
+ $enabled->getName(),
116
+ 1
117
+ ));
118
+ return parent::_prepareForm();
119
+ }
120
+
121
+ /**
122
+ * Tab label getter
123
+ *
124
+ * @return string
125
+ */
126
+ public function getTabLabel()
127
+ {
128
+ return $this->__('Analytics');
129
+ }
130
+
131
+ /**
132
+ * Tab title getter
133
+ *
134
+ * @return string
135
+ */
136
+ public function getTabTitle()
137
+ {
138
+ return $this->__('Flurry Analytics');
139
+ }
140
+
141
+ /**
142
+ * Check if tab can be shown
143
+ *
144
+ * @return bool
145
+ */
146
+ public function canShowTab()
147
+ {
148
+ return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication()
149
+ && Mage::helper('xmlconnect')->getDeviceType() == Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE;
150
+ }
151
+
152
+ /**
153
+ * Check if tab hidden
154
+ *
155
+ * @return bool
156
+ */
157
+ public function isHidden()
158
+ {
159
+ return false;
160
+ }
161
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/General.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Tab for General Info Management
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_General
35
+ extends Mage_Adminhtml_Block_Widget_Form
36
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
+ {
38
+ /**
39
+ * Prepare form before rendering HTML
40
+ * Setting Form Fieldsets and fields
41
+ *
42
+ * @return Mage_Adminhtml_Block_Widget_Form
43
+ */
44
+ protected function _prepareForm()
45
+ {
46
+ $model = Mage::helper('xmlconnect')->getApplication();
47
+
48
+ $form = new Varien_Data_Form();
49
+ $form->setHtmlIdPrefix('app_');
50
+ $fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('App Information')));
51
+
52
+ if ($model->getId()) {
53
+ $fieldset->addField('application_id', 'hidden', array(
54
+ 'name' => 'application_id',
55
+ 'value' => $model->getId()
56
+ ));
57
+ }
58
+
59
+ $fieldset->addField('name', 'text', array(
60
+ 'name' => 'name',
61
+ 'label' => $this->__('App Name'),
62
+ 'title' => $this->__('App Name'),
63
+ 'maxlength' => '250',
64
+ 'value' => $model->getName(),
65
+ 'required' => true,
66
+ ));
67
+
68
+ if ($model->getId()) {
69
+ $fieldset->addField('code', 'label', array(
70
+ 'label' => $this->__('App Code'),
71
+ 'title' => $this->__('App Code'),
72
+ 'value' => $model->getCode(),
73
+ ));
74
+ }
75
+
76
+ /**
77
+ * Check is single store mode
78
+ */
79
+ if (!Mage::app()->isSingleStoreMode()) {
80
+ $storeElement = $fieldset->addField('store_id', 'select', array(
81
+ 'name' => 'store_id',
82
+ 'label' => $this->__('Store View'),
83
+ 'title' => $this->__('Store View'),
84
+ 'required' => true,
85
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, false),
86
+ ));
87
+ } else {
88
+ $storeElement = $fieldset->addField('store_id', 'hidden', array(
89
+ 'name' => 'store_id',
90
+ 'value' => Mage::app()->getStore(true)->getId()
91
+ ));
92
+ $model->setStoreId(Mage::app()->getStore(true)->getId());
93
+ }
94
+
95
+ if ($model->getId()) {
96
+ $storeElement->setValue($model->getStoreId());
97
+ $storeElement->setDisabled(true);
98
+ } else if ($model->getStoreId()) {
99
+ $storeElement->setValue($model->getStoreId());
100
+ }
101
+
102
+ $fieldset->addField('showdev', 'select', array(
103
+ 'name' => 'showdev',
104
+ 'label' => $this->__('Device Type'),
105
+ 'title' => $this->__('Device Type'),
106
+ 'values' => array($model->getType() => $model->getDevtype()),
107
+ 'disabled' => true,
108
+ ));
109
+
110
+ $fieldset->addField('devtype', 'hidden', array(
111
+ 'name' => 'devtype',
112
+ 'value' => $model->getType(),
113
+ ));
114
+
115
+ $yesNoValues = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
116
+
117
+ $fieldset->addField('browsing_mode', 'select', array(
118
+ 'label' => $this->__('Catalog Only App?'),
119
+ 'name' => 'browsing_mode',
120
+ 'note' => $this->__('A Catalog Only App will not support functions such as add to cart, add to wishlist, or login.'),
121
+ 'value' => $model->getBrowsingMode(),
122
+ 'values' => $yesNoValues
123
+ ));
124
+
125
+ $this->setForm($form);
126
+ return parent::_prepareForm();
127
+ }
128
+
129
+ /**
130
+ * Tab label getter
131
+ *
132
+ * @return string
133
+ */
134
+ public function getTabLabel()
135
+ {
136
+ return $this->__('General');
137
+ }
138
+
139
+ /**
140
+ * Tab title getter
141
+ *
142
+ * @return string
143
+ */
144
+ public function getTabTitle()
145
+ {
146
+ return $this->__('General');
147
+ }
148
+
149
+ /**
150
+ * Check if tab can be shown
151
+ *
152
+ * @return bool
153
+ */
154
+ public function canShowTab()
155
+ {
156
+ return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication();
157
+ }
158
+
159
+ /**
160
+ * Check if tab hidden
161
+ *
162
+ * @return bool
163
+ */
164
+ public function isHidden()
165
+ {
166
+ return false;
167
+ }
168
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Notification.php ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Tab for Notifications Management
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Notification
35
+ extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
36
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
+ {
38
+ /**
39
+ * Constructor
40
+ * Setting view options
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+ $this->setShowGlobalIcon(true);
46
+ }
47
+
48
+ /**
49
+ * Prepare form before rendering HTML
50
+ * Setting Form Fieldsets and fields
51
+ *
52
+ * @return Mage_Adminhtml_Block_Widget_Form
53
+ */
54
+ protected function _prepareForm()
55
+ {
56
+ $form = new Varien_Data_Form();
57
+
58
+ $this->setForm($form);
59
+
60
+ $data = Mage::helper('xmlconnect')->getApplication()->getFormData();
61
+
62
+ $yesNoValues = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
63
+
64
+ $fieldset = $form->addFieldset('notifications', array(
65
+ 'legend' => $this->__('Urban Airship Push Notification'),
66
+ ));
67
+
68
+ if (isset($data['conf[native][notifications][isActive]'])) {
69
+ $notificationStatus = $data['conf[native][notifications][isActive]'];
70
+ } else {
71
+ $notificationStatus = '0';
72
+ }
73
+
74
+ $notificationEnabled = $fieldset->addField('conf/native/notifisations/isActive', 'select', array(
75
+ 'label' => $this->__('Enable AirMail Message Push notification'),
76
+ 'name' => 'conf[native][notifications][isActive]',
77
+ 'values' => $yesNoValues,
78
+ 'value' => $notificationStatus,
79
+ ));
80
+
81
+ if (isset($data['conf[native][notifications][applicationKey]'])) {
82
+ $keyValue = $data['conf[native][notifications][applicationKey]'];
83
+ } else {
84
+ $keyValue = '';
85
+ }
86
+
87
+ $applicationKey = $fieldset->addField('conf/native/notifications/applicationKey', 'text', array(
88
+ 'label' => $this->__('Application Key'),
89
+ 'name' => 'conf[native][notifications][applicationKey]',
90
+ 'value' => $keyValue,
91
+ 'required' => true
92
+ ));
93
+
94
+ if (isset($data['conf[native][notifications][applicationSecret]'])) {
95
+ $secretValue = $data['conf[native][notifications][applicationSecret]'];
96
+ } else {
97
+ $secretValue = '';
98
+ }
99
+
100
+ $applicationSecret = $fieldset->addField('conf/native/notifications/applicationSecret', 'text', array(
101
+ 'label' => $this->__('Application Secret'),
102
+ 'name' => 'conf[native][notifications][applicationSecret]',
103
+ 'value' => $secretValue,
104
+ 'required' => true
105
+ ));
106
+
107
+ if (isset($data['conf[native][notifications][applicationMasterSecret]'])) {
108
+ $mSecretValue = $data['conf[native][notifications][applicationMasterSecret]'];
109
+ } else {
110
+ $mSecretValue = '';
111
+ }
112
+
113
+ $mSecretConfPath = 'conf/native/notifications/applicationMasterSecret';
114
+ $applicationMasterSecret = $fieldset->addField($mSecretConfPath, 'text', array(
115
+ 'label' => $this->__('Application Master Secret'),
116
+ 'name' => 'conf[native][notifications][applicationMasterSecret]',
117
+ 'value' => $mSecretValue,
118
+ 'required' => true
119
+ ));
120
+
121
+ if (isset($data['conf[native][notifications][mailboxTitle]'])) {
122
+ $titleValue = $data['conf[native][notifications][mailboxTitle]'];
123
+ } else {
124
+ $titleValue = '';
125
+ }
126
+
127
+ $mailboxTitle = $fieldset->addField('conf/native/notifications/mailboxTitle', 'text', array(
128
+ 'label' => $this->__('Mailbox title'),
129
+ 'name' => 'conf[native][notifications][mailboxTitle]',
130
+ 'value' => $titleValue,
131
+ 'required' => true,
132
+ 'note' => $this->__('The Mailbox title will be shown in the More Info tab. To understand more about the title, please <a target="_blank" href="http://www.magentocommerce.com/img/product/mobile/helpers/mail_box_title.png">click here</a>')
133
+ ));
134
+
135
+ // field dependencies
136
+ $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
137
+ ->addFieldMap($applicationKey->getHtmlId(), $applicationKey->getName())
138
+ ->addFieldMap($applicationSecret->getHtmlId(), $applicationSecret->getName())
139
+ ->addFieldMap($applicationMasterSecret->getHtmlId(), $applicationMasterSecret->getName())
140
+ ->addFieldMap($mailboxTitle->getHtmlId(), $mailboxTitle->getName())
141
+ ->addFieldMap($notificationEnabled->getHtmlId(), $notificationEnabled->getName())
142
+ ->addFieldDependence(
143
+ $applicationKey->getName(),
144
+ $notificationEnabled->getName(),
145
+ 1)
146
+ ->addFieldDependence(
147
+ $applicationSecret->getName(),
148
+ $notificationEnabled->getName(),
149
+ 1)
150
+ ->addFieldDependence(
151
+ $applicationMasterSecret->getName(),
152
+ $notificationEnabled->getName(),
153
+ 1)
154
+ ->addFieldDependence(
155
+ $mailboxTitle->getName(),
156
+ $notificationEnabled->getName(),
157
+ 1)
158
+ );
159
+ return parent::_prepareForm();
160
+ }
161
+
162
+ /**
163
+ * Tab label getter
164
+ *
165
+ * @return string
166
+ */
167
+ public function getTabLabel()
168
+ {
169
+ return $this->__('Push Notification');
170
+ }
171
+
172
+ /**
173
+ * Tab title getter
174
+ *
175
+ * @return string
176
+ */
177
+ public function getTabTitle()
178
+ {
179
+ return $this->__('Push Notification');
180
+ }
181
+
182
+ /**
183
+ * Check if tab can be shown
184
+ *
185
+ * @return bool
186
+ */
187
+ public function canShowTab()
188
+ {
189
+ return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication()
190
+ && Mage::helper('xmlconnect')->isNotificationsAllowed();
191
+ }
192
+
193
+ /**
194
+ * Check if tab hidden
195
+ *
196
+ * @return bool
197
+ */
198
+ public function isHidden()
199
+ {
200
+ if (!$this->getData('conf/special/notifications_submitted')) {
201
+ return false;
202
+ } else {
203
+ return true;
204
+ }
205
+ }
206
+
207
+ /**
208
+ * Append helper above form
209
+ *
210
+ * @return string
211
+ */
212
+ protected function _toHtml()
213
+ {
214
+ return $this->getChildHtml('app_notification_helper') . parent::_toHtml();
215
+ }
216
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Payment.php ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Tab for Payments Management
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Payment
35
+ extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
36
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
+ {
38
+ protected $_pages;
39
+
40
+ /**
41
+ * Constructor
42
+ * Setting view options
43
+ */
44
+ public function __construct()
45
+ {
46
+ parent::__construct();
47
+ $this->setShowGlobalIcon(true);
48
+ }
49
+
50
+ /**
51
+ * Prepare form before rendering HTML
52
+ * Setting Form Fieldsets and fields
53
+ *
54
+ * @return Mage_Adminhtml_Block_Widget_Form
55
+ */
56
+ protected function _prepareForm()
57
+ {
58
+ $form = new Varien_Data_Form();
59
+
60
+ $this->setForm($form);
61
+
62
+ $data = Mage::helper('xmlconnect')->getApplication()->getFormData();
63
+ $yesNoValues = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
64
+
65
+ $fieldset = $form->addFieldset('onepage_checkout', array('legend' => $this->__('Standard Checkout')));
66
+
67
+ if (isset($data['conf[native][defaultCheckout][isActive]'])) {
68
+ $checkoutStatus = $data['conf[native][defaultCheckout][isActive]'];
69
+ } else {
70
+ $checkoutStatus = '1';
71
+ }
72
+
73
+ $fieldset->addField('conf/native/defaultCheckout/isActive', 'select', array(
74
+ 'label' => $this->__('Enable Standard Checkout'),
75
+ 'name' => 'conf[native][defaultCheckout][isActive]',
76
+ 'values' => $yesNoValues,
77
+ 'note' => $this->__('Standard Checkout uses the checkout methods provided by Magento. Only inline payment methods are supported. (e.g PayPal Direct, Authorize.Net, etc.)'),
78
+ 'value' => $checkoutStatus
79
+ ));
80
+
81
+ $deviceType = Mage::helper('xmlconnect')->getDeviceType();
82
+ switch ($deviceType) {
83
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE:
84
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD:
85
+ /**
86
+ * PayPal MEP management
87
+ */
88
+ $fieldsetPaypal = $form->addFieldset('paypal_mep_checkout', array(
89
+ 'legend' => $this->__('PayPal Mobile Embedded Payment (MEP)')
90
+ ));
91
+
92
+ $paypalMepIsAvailable = Mage::getModel('xmlconnect/payment_method_paypal_mep')
93
+ ->isAvailable(null);
94
+
95
+ $paypalActive = 0;
96
+ if (isset($data['conf[native][paypal][isActive]'])) {
97
+ $paypalActive = (int)($data['conf[native][paypal][isActive]'] && $paypalMepIsAvailable);
98
+ }
99
+
100
+ $paypalConfigurationUrl = $this->escapeHtml(
101
+ $this->getUrl('adminhtml/system_config/edit', array('section' => 'paypal'))
102
+ );
103
+
104
+ $activateMepMethodNote = $this->__('To activate PayPal MEP payment method activate Express checkout first. ');
105
+
106
+ $businessAccountNote = $this->__('MEP is PayPal\'s native checkout experience for the iPhone. You can choose to use MEP alongside standard checkout, or use it as your only checkout method for Magento mobile. PayPal MEP requires a <a href="%s">PayPal business account</a>', $paypalConfigurationUrl);
107
+
108
+ $paypalActiveField = $fieldsetPaypal->addField('conf/native/paypal/isActive', 'select', array(
109
+ 'label' => $this->__('Activate PayPal Checkout'),
110
+ 'name' => 'conf[native][paypal][isActive]',
111
+ 'note' => (!$paypalMepIsAvailable ? $activateMepMethodNote : $businessAccountNote),
112
+ 'values' => $yesNoValues,
113
+ 'value' => $paypalActive,
114
+ 'disabled' => !$paypalMepIsAvailable
115
+ ));
116
+
117
+ if (isset($data['conf[special][merchantLabel]'])) {
118
+ $merchantLabelValue = $data['conf[special][merchantLabel]'];
119
+ } else {
120
+ $merchantLabelValue = '';
121
+ }
122
+ $merchantlabelField = $fieldsetPaypal->addField('conf/special/merchantLabel', 'text', array(
123
+ 'name' => 'conf[special][merchantLabel]',
124
+ 'label' => $this->__('Merchant Label'),
125
+ 'title' => $this->__('Merchant Label'),
126
+ 'required' => true,
127
+ 'value' => $merchantLabelValue
128
+ ));
129
+
130
+ if (isset($data['config_data[payment][paypalmep/allowspecific]'])) {
131
+ $paypalMepAllow = (int) $data['config_data[payment][paypalmep/allowspecific]'];
132
+ } else {
133
+ $paypalMepAllow = 0;
134
+ }
135
+ $paypalMepAllowSpecific = $fieldsetPaypal->addField(
136
+ 'config_data/paypalmep/allowspecific',
137
+ 'select',
138
+ array(
139
+ 'name' => 'config_data[payment:paypalmep/allowspecific]',
140
+ 'label' => $this->__('Payment Applicable From'),
141
+ 'values' => array(
142
+ array('value' => 0, 'label' => $this->__('All Allowed Countries')),
143
+ array('value' => 1, 'label' => $this->__('Specific Countries'))
144
+ ),
145
+ 'value' => $paypalMepAllow
146
+ ));
147
+
148
+ $countries = Mage::getModel('adminhtml/system_config_source_country')->toOptionArray(true);
149
+
150
+ if (empty($data['config_data[payment][paypalmep/allowspecific]'])) {
151
+ $countrySelected = array();
152
+ } else {
153
+ $countrySelected = explode(',', $data['config_data[payment][paypalmep/applicable]']);
154
+ }
155
+
156
+ $paypalMepApplicable = $fieldsetPaypal->addField(
157
+ 'config_data/paypalmep/applicable',
158
+ 'multiselect',
159
+ array(
160
+ 'name' => 'config_data[payment:paypalmep/applicable]',
161
+ 'label' => $this->__('Countries Payment Applicable From'),
162
+ 'values' => $countries,
163
+ 'value' => $countrySelected
164
+ ));
165
+
166
+ // field dependencies
167
+ $this->setChild('form_after', $this->getLayout()
168
+ ->createBlock('adminhtml/widget_form_element_dependence')
169
+ ->addFieldMap($paypalMepAllowSpecific->getHtmlId(), $paypalMepAllowSpecific->getName())
170
+ ->addFieldMap($paypalMepApplicable->getHtmlId(), $paypalMepApplicable->getName())
171
+ ->addFieldMap($merchantlabelField->getHtmlId(), $merchantlabelField->getName())
172
+ ->addFieldMap($paypalActiveField->getHtmlId(), $paypalActiveField->getName())
173
+ ->addFieldDependence(
174
+ $paypalMepApplicable->getName(),
175
+ $paypalMepAllowSpecific->getName(),
176
+ 1
177
+ )
178
+ ->addFieldDependence(
179
+ $paypalMepAllowSpecific->getName(),
180
+ $paypalActiveField->getName(),
181
+ 1
182
+ )
183
+ ->addFieldDependence(
184
+ $paypalMepApplicable->getName(),
185
+ $paypalActiveField->getName(),
186
+ 1
187
+ )
188
+ ->addFieldDependence(
189
+ $merchantlabelField->getName(),
190
+ $paypalActiveField->getName(),
191
+ 1
192
+ )
193
+ );
194
+ break;
195
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID:
196
+ /**
197
+ * PayPal MECL management
198
+ */
199
+ if (Mage::app()->isSingleStoreMode() || Mage::helper('xmlconnect')->getApplication()->getId()) {
200
+ $paypalMeclIsAvailable = Mage::getModel('xmlconnect/payment_method_paypal_mecl')
201
+ ->isAvailable();
202
+ $activateMeclMethodNote = $this->__('You need to enable PayPal Express Checkout first from the Payment configuration before enabling PayPal MECL.');
203
+ } else {
204
+ $paypalMeclIsAvailable = false;
205
+ $activateMeclMethodNote = $this->__('Please create and save an application first.');
206
+ }
207
+
208
+ $fieldsetMecl = $form->addFieldset('paypal_mecl_checkout', array(
209
+ 'legend' => $this->__('PayPal Mobile Express Checkout Library (MECL)')
210
+ ));
211
+
212
+ $meclAccountNote = $this->__('PayPal MECL is the mobile version of PayPal\'s Express Checkout service. You can choose to use MECL alongside standard checkout, or use it as your only checkout method for Magento Mobile.');
213
+
214
+ $paypalMeclActive = 0;
215
+ if (isset($data['config_data[payment][paypalmecl_is_active]'])) {
216
+ $paypalMeclActive = (int) $data['config_data[payment][paypalmecl_is_active]'];
217
+ }
218
+
219
+ $fieldsetMecl->addField('config_data/paypalmecl_is_active', 'select', array(
220
+ 'label' => $this->__('Activate PayPal MECL'),
221
+ 'name' => 'config_data[payment:paypalmecl_is_active]',
222
+ 'note' => (!$paypalMeclIsAvailable ? $activateMeclMethodNote : $meclAccountNote),
223
+ 'values' => $yesNoValues,
224
+ 'value' => $paypalMeclActive,
225
+ 'disabled' => !$paypalMeclIsAvailable
226
+ ));
227
+
228
+ /**
229
+ * PayPal MEP management
230
+ */
231
+ $fieldsetPaypal = $form->addFieldset('paypal_mep_checkout', array(
232
+ 'legend' => $this->__('PayPal Mobile Embedded Payment (MEP)')
233
+ ));
234
+ $fieldsetPaypal->addField('paypal_note', 'note', array(
235
+ 'label' => $this->__('Notice'),
236
+ 'text' => $this->__('Currently, PayPal MEP is not available for the Android application')
237
+ ));
238
+ break;
239
+ default:
240
+ Mage::throwException(
241
+ $this->__('Device doesn\'t recognized: "%s". Unable to load preview model.', $deviceType)
242
+ );
243
+ break;
244
+ }
245
+
246
+ return parent::_prepareForm();
247
+ }
248
+
249
+ /**
250
+ * Tab label getter
251
+ *
252
+ * @return string
253
+ */
254
+ public function getTabLabel()
255
+ {
256
+ return $this->__('Payment Methods');
257
+ }
258
+
259
+ /**
260
+ * Tab title getter
261
+ *
262
+ * @return string
263
+ */
264
+ public function getTabTitle()
265
+ {
266
+ return $this->__('Payment Methods');
267
+ }
268
+
269
+ /**
270
+ * Check if tab can be shown
271
+ *
272
+ * @return bool
273
+ */
274
+ public function canShowTab()
275
+ {
276
+ return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication();
277
+ }
278
+
279
+ /**
280
+ * Check if tab hidden
281
+ *
282
+ * @return bool
283
+ */
284
+ public function isHidden()
285
+ {
286
+ return false;
287
+ }
288
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Settings.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Tab for Settings Management
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Settings
35
+ extends Mage_Adminhtml_Block_Widget_Form
36
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
+ {
38
+ protected function _prepareLayout()
39
+ {
40
+ $this->setChild('continue_button',
41
+ $this->getLayout()->createBlock('adminhtml/widget_button')
42
+ ->setData(array(
43
+ 'label' => Mage::helper('catalog')->__('Continue'),
44
+ 'onclick' => "if (editForm.submit()) { return false }",
45
+ 'class' => 'save'
46
+ )
47
+ )
48
+ );
49
+ return parent::_prepareLayout();
50
+ }
51
+
52
+ /**
53
+ * Prepare form before rendering HTML
54
+ * Setting Form Fieldsets and fields
55
+ *
56
+ * @return Mage_Adminhtml_Block_Widget_Form
57
+ */
58
+ protected function _prepareForm()
59
+ {
60
+
61
+ $form = new Varien_Data_Form();
62
+ $form->setHtmlIdPrefix('app_');
63
+ $fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Device Information')));
64
+
65
+ $fieldset->addField('type', 'select', array(
66
+ 'name' => 'type',
67
+ 'label' => $this->__('Device Type'),
68
+ 'title' => $this->__('Device Type'),
69
+ 'values' => Mage::helper('xmlconnect')->getDeviceTypeOptions(),
70
+ 'required' => true
71
+ ));
72
+
73
+ $fieldset->addField('continue_button', 'note', array(
74
+ 'text' => $this->getChildHtml('continue_button'),
75
+ ));
76
+
77
+ $this->setForm($form);
78
+ return parent::_prepareForm();
79
+ }
80
+
81
+ /**
82
+ * Tab label getter
83
+ *
84
+ * @return string
85
+ */
86
+ public function getTabLabel()
87
+ {
88
+ return $this->__('Settings');
89
+ }
90
+
91
+ /**
92
+ * Tab title getter
93
+ *
94
+ * @return string
95
+ */
96
+ public function getTabTitle()
97
+ {
98
+ return $this->__('Settings');
99
+ }
100
+
101
+ /**
102
+ * Check if tab can be shown
103
+ *
104
+ * @return bool
105
+ */
106
+ public function canShowTab()
107
+ {
108
+ return (bool) Mage::getSingleton('adminhtml/session')->getNewApplication();
109
+ }
110
+
111
+ /**
112
+ * Check if tab hidden
113
+ *
114
+ * @return bool
115
+ */
116
+ public function isHidden()
117
+ {
118
+ return false;
119
+ }
120
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Social.php ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Tab for Social Networking settings
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Social
35
+ extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
36
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
+ {
38
+ /**
39
+ * Prepare form before rendering HTML
40
+ * Setting Form Fieldsets and fields
41
+ *
42
+ * @return Mage_Adminhtml_Block_Widget_Form
43
+ */
44
+ protected function _prepareForm()
45
+ {
46
+ $form = new Varien_Data_Form();
47
+
48
+ $this->setForm($form);
49
+
50
+ $data = Mage::helper('xmlconnect')->getApplication()->getFormData();
51
+
52
+ $yesNoValues = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
53
+
54
+ /**
55
+ * Default values for social networks is DISABLED
56
+ */
57
+ $twitterStatus = $facebookStatus = $linkedinStatus = 0;
58
+ $noteText = $this->__('Please <a href="%s" target="_blank">click here</a> to see how to setup and retrieve API credentials.');
59
+
60
+ /**
61
+ * Twitter fieldset options
62
+ */
63
+ $fieldsetTwitter = $form->addFieldset('twitter', array(
64
+ 'legend' => $this->__('Twitter API')
65
+ ));
66
+
67
+ if (isset($data['conf[native][socialNetworking][twitter][isActive]'])) {
68
+ $twitterStatus = (int)$data['conf[native][socialNetworking][twitter][isActive]'];
69
+ }
70
+
71
+ $twitterActiveField = $fieldsetTwitter->addField(
72
+ 'conf/native/socialNetworking/twitter/isActive',
73
+ 'select',
74
+ array(
75
+ 'label' => $this->__('Enable Twitter'),
76
+ 'name' => 'conf[native][socialNetworking][twitter][isActive]',
77
+ 'values' => $yesNoValues,
78
+ 'value' => $twitterStatus,
79
+ )
80
+ );
81
+
82
+ if (isset($data['conf[native][socialNetworking][twitter][apiKey]'])) {
83
+ $twitterApiKey = $data['conf[native][socialNetworking][twitter][apiKey]'];
84
+ } else {
85
+ $twitterApiKey = '';
86
+ }
87
+
88
+ $twitterApiKeyField = $fieldsetTwitter->addField(
89
+ 'conf/native/socialNetworking/twitter/apiKey',
90
+ 'text',
91
+ array(
92
+ 'label' => $this->__('Twitter API Key'),
93
+ 'name' => 'conf[native][socialNetworking][twitter][apiKey]',
94
+ 'required' => true,
95
+ 'value' => $twitterApiKey
96
+ )
97
+ );
98
+
99
+ if (isset($data['conf[native][socialNetworking][twitter][secretKey]'])) {
100
+ $twitterSecretKey = $data['conf[native][socialNetworking][twitter][secretKey]'];
101
+ } else {
102
+ $twitterSecretKey = '';
103
+ }
104
+
105
+ $twitterSecretKeyField = $fieldsetTwitter->addField(
106
+ 'conf/native/socialNetworking/twitter/secretKey',
107
+ 'text',
108
+ array(
109
+ 'label' => $this->__('Twitter Secret Key'),
110
+ 'name' => 'conf[native][socialNetworking][twitter][secretKey]',
111
+ 'required' => true,
112
+ 'value' => $twitterSecretKey
113
+ )
114
+ );
115
+
116
+ $fieldsetTwitter->addField(
117
+ 'twitterNote',
118
+ 'note',
119
+ array(
120
+ 'text' => sprintf(
121
+ $noteText,
122
+ Mage::getStoreConfig(Mage_XmlConnect_Model_Application::XML_PATH_HOWTO_TWITTER_URL)
123
+ ),
124
+ )
125
+ );
126
+
127
+ /**
128
+ * Facebook fieldset options
129
+ */
130
+ $fieldsetFacebook = $form->addFieldset('facebook', array(
131
+ 'legend' => $this->__('Facebook API'),
132
+ ));
133
+
134
+ if (isset($data['conf[native][socialNetworking][facebook][isActive]'])) {
135
+ $facebookStatus = (int)$data['conf[native][socialNetworking][facebook][isActive]'];
136
+ }
137
+
138
+ $facebookActiveField = $fieldsetFacebook->addField(
139
+ 'conf/native/socialNetworking/facebook/isActive',
140
+ 'select',
141
+ array(
142
+ 'label' => $this->__('Enable Facebook'),
143
+ 'name' => 'conf[native][socialNetworking][facebook][isActive]',
144
+ 'values' => $yesNoValues,
145
+ 'value' => $facebookStatus,
146
+ )
147
+ );
148
+
149
+ if (isset($data['conf[native][socialNetworking][facebook][appID]'])) {
150
+ $facebookAppID = $data['conf[native][socialNetworking][facebook][appID]'];
151
+ } else {
152
+ $facebookAppID = '';
153
+ }
154
+
155
+ $facebookAppIDField = $fieldsetFacebook->addField(
156
+ 'conf/native/socialNetworking/facebook/appID',
157
+ 'text',
158
+ array(
159
+ 'label' => $this->__('Facebook Application ID'),
160
+ 'name' => 'conf[native][socialNetworking][facebook][appID]',
161
+ 'required' => true,
162
+ 'value' => $facebookAppID
163
+ )
164
+ );
165
+
166
+ $fieldsetFacebook->addField(
167
+ 'facebookNote',
168
+ 'note',
169
+ array(
170
+ 'text' => sprintf(
171
+ $noteText,
172
+ Mage::getStoreConfig(Mage_XmlConnect_Model_Application::XML_PATH_HOWTO_FACEBOOK_URL)
173
+ ),
174
+ )
175
+ );
176
+
177
+ /**
178
+ * LinkedIn fieldset options
179
+ */
180
+ $fieldsetLinkedin = $form->addFieldset('linkedin', array(
181
+ 'legend' => $this->__('LinkedIn API'),
182
+ ));
183
+
184
+ if (isset($data['conf[native][socialNetworking][linkedin][isActive]'])) {
185
+ $linkedinStatus = (int)$data['conf[native][socialNetworking][linkedin][isActive]'];
186
+ }
187
+
188
+ $linkedinActiveField = $fieldsetLinkedin->addField(
189
+ 'conf/native/socialNetworking/linkedin/isActive',
190
+ 'select',
191
+ array(
192
+ 'label' => $this->__('Enable LinkedIn'),
193
+ 'name' => 'conf[native][socialNetworking][linkedin][isActive]',
194
+ 'values' => $yesNoValues,
195
+ 'value' => $linkedinStatus,
196
+ )
197
+ );
198
+
199
+ if (isset($data['conf[native][socialNetworking][linkedin][apiKey]'])) {
200
+ $linkedinApiKey = $data['conf[native][socialNetworking][linkedin][apiKey]'];
201
+ } else {
202
+ $linkedinApiKey = '';
203
+ }
204
+
205
+ $linkedinApiKeyField = $fieldsetLinkedin->addField(
206
+ 'conf/native/socialNetworking/linkedin/apiKey',
207
+ 'text',
208
+ array(
209
+ 'label' => $this->__('LinkedIn API Key'),
210
+ 'name' => 'conf[native][socialNetworking][linkedin][apiKey]',
211
+ 'required' => true,
212
+ 'value' => $linkedinApiKey
213
+ )
214
+ );
215
+
216
+ if (isset($data['conf[native][socialNetworking][linkedin][secretKey]'])) {
217
+ $linkedinSecretKey = $data['conf[native][socialNetworking][linkedin][secretKey]'];
218
+ } else {
219
+ $linkedinSecretKey = '';
220
+ }
221
+
222
+ $linkedinSecretKeyField = $fieldsetLinkedin->addField(
223
+ 'conf/native/socialNetworking/linkedin/secretKey',
224
+ 'text',
225
+ array(
226
+ 'label' => $this->__('LinkedIn Secret Key'),
227
+ 'name' => 'conf[native][socialNetworking][linkedin][secretKey]',
228
+ 'required' => true,
229
+ 'value' => $linkedinSecretKey
230
+ )
231
+ );
232
+
233
+ $fieldsetLinkedin->addField(
234
+ 'linkedinNote',
235
+ 'note',
236
+ array(
237
+ 'text' => sprintf(
238
+ $noteText,
239
+ Mage::getStoreConfig(Mage_XmlConnect_Model_Application::XML_PATH_HOWTO_LINKEDIN_URL)
240
+ ),
241
+ )
242
+ );
243
+
244
+ /**
245
+ * Set field dependencies
246
+ */
247
+ $this->setChild('form_after', $this->getLayout()
248
+ ->createBlock('adminhtml/widget_form_element_dependence')
249
+ /**
250
+ * Facebook field dependencies
251
+ */
252
+ ->addFieldMap($facebookActiveField->getHtmlId(), $facebookActiveField->getName())
253
+ ->addFieldMap($facebookAppIDField->getHtmlId(), $facebookAppIDField->getName())
254
+ ->addFieldDependence(
255
+ $facebookAppIDField->getName(),
256
+ $facebookActiveField->getName(),
257
+ 1)
258
+ /**
259
+ * Twitter field dependencies
260
+ */
261
+ ->addFieldMap($twitterApiKeyField->getHtmlId(), $twitterApiKeyField->getName())
262
+ ->addFieldMap($twitterActiveField->getHtmlId(), $twitterActiveField->getName())
263
+ ->addFieldMap($twitterSecretKeyField->getHtmlId(), $twitterSecretKeyField->getName())
264
+ ->addFieldDependence(
265
+ $twitterApiKeyField->getName(),
266
+ $twitterActiveField->getName(),
267
+ 1)
268
+ ->addFieldDependence(
269
+ $twitterSecretKeyField->getName(),
270
+ $twitterActiveField->getName(),
271
+ 1)
272
+ /**
273
+ * LinkedIn field dependencies
274
+ */
275
+ ->addFieldMap($linkedinApiKeyField->getHtmlId(), $linkedinApiKeyField->getName())
276
+ ->addFieldMap($linkedinActiveField->getHtmlId(), $linkedinActiveField->getName())
277
+ ->addFieldMap($linkedinSecretKeyField->getHtmlId(), $linkedinSecretKeyField->getName())
278
+ ->addFieldDependence(
279
+ $linkedinApiKeyField->getName(),
280
+ $linkedinActiveField->getName(),
281
+ 1)
282
+ ->addFieldDependence(
283
+ $linkedinSecretKeyField->getName(),
284
+ $linkedinActiveField->getName(),
285
+ 1)
286
+ );
287
+
288
+ return parent::_prepareForm();
289
+ }
290
+
291
+ /**
292
+ * Tab label getter
293
+ *
294
+ * @return string
295
+ */
296
+ public function getTabLabel()
297
+ {
298
+ return $this->__('Social Networking');
299
+ }
300
+
301
+ /**
302
+ * Tab title getter
303
+ *
304
+ * @return string
305
+ */
306
+ public function getTabTitle()
307
+ {
308
+ return $this->__('Social Networking');
309
+ }
310
+
311
+ /**
312
+ * Check if tab can be shown
313
+ *
314
+ * @return bool
315
+ */
316
+ public function canShowTab()
317
+ {
318
+ return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication();
319
+ }
320
+
321
+ /**
322
+ * Check if tab hidden
323
+ *
324
+ * @return bool
325
+ */
326
+ public function isHidden()
327
+ {
328
+ return false;
329
+ }
330
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Submission/History.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect application history grid
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Submission_History
35
+ extends Mage_Adminhtml_Block_Widget_Grid
36
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
+ {
38
+ /**
39
+ * Set order by column and order direction
40
+ * Set grid ID
41
+ * Set use AJAX for grid
42
+ *
43
+ */
44
+ public function __construct()
45
+ {
46
+ parent::__construct();
47
+ $this->setId('history_grid');
48
+ $this->setDefaultSort('created_at');
49
+ $this->setDefaultDir('ASC');
50
+ $this->setUseAjax(true);
51
+ $this->setSaveParametersInSession(true);
52
+ $this->setVarNameFilter('history_filter');
53
+ }
54
+
55
+ /**
56
+ * Tab label getter
57
+ *
58
+ * @return string
59
+ */
60
+ public function getTabLabel()
61
+ {
62
+ return $this->__('Submission History');
63
+ }
64
+
65
+ /**
66
+ * Tab title getter
67
+ *
68
+ * @return string
69
+ */
70
+ public function getTabTitle()
71
+ {
72
+ return $this->__('Submission History');
73
+ }
74
+
75
+ /**
76
+ * Check if tab can be shown
77
+ *
78
+ * @return bool
79
+ */
80
+ public function canShowTab()
81
+ {
82
+ return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication();
83
+ }
84
+
85
+ /**
86
+ * Check if tab hidden
87
+ *
88
+ * @return bool
89
+ */
90
+ public function isHidden()
91
+ {
92
+ return false;
93
+ }
94
+
95
+ /**
96
+ * Initialize history collection
97
+ * Set application filter
98
+ *
99
+ * @return Mage_Adminhtml_Block_Widget_Grid
100
+ */
101
+ protected function _prepareCollection()
102
+ {
103
+ $collection = Mage::getResourceModel('xmlconnect/history_collection')
104
+ ->addApplicationFilter($this->_getApplication()->getId());
105
+ $this->setCollection($collection);
106
+ return parent::_prepareCollection();
107
+ }
108
+
109
+ /**
110
+ * Configuration of grid
111
+ *
112
+ * @return Mage_Adminhtml_Block_Widget_Grid
113
+ */
114
+ protected function _prepareColumns()
115
+ {
116
+ $this->addColumn('activation_key', array(
117
+ 'header' => $this->__('Activation Key'),
118
+ 'align' => 'left',
119
+ 'index' => 'activation_key',
120
+ 'type' => 'text',
121
+ 'escape' => true
122
+ ));
123
+
124
+ $this->addColumn('created_at', array(
125
+ 'header' => $this->__('Date Submitted'),
126
+ 'align' => 'left',
127
+ 'index' => 'created_at',
128
+ 'type' => 'datetime'
129
+ ));
130
+
131
+ return parent::_prepareColumns();
132
+ }
133
+
134
+ /**
135
+ * Ajax grid URL getter
136
+ * @return string
137
+ */
138
+ public function getGridUrl()
139
+ {
140
+ return $this->getUrl('*/*/submissionHistoryGrid', array('_current'=>true));
141
+ }
142
+
143
+ /**
144
+ * Get current application model
145
+ *
146
+ * @return Mage_XmlConnect_Model_Application
147
+ */
148
+ protected function _getApplication()
149
+ {
150
+ return Mage::helper('xmlconnect')->getApplication();
151
+ }
152
+
153
+ /**
154
+ * Remove row click url
155
+ *
156
+ * @param Mage_Catalog_Model_Product|Varien_Object $row
157
+ * @return string
158
+ */
159
+ public function getRowUrl($row)
160
+ {
161
+ return '';
162
+ }
163
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tabs.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Application Tabs block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tabs
35
+ extends Mage_Adminhtml_Block_Widget_Tabs
36
+ {
37
+ /**
38
+ * Constructor
39
+ * Setting grid_id, DOM destination element id, Title
40
+ */
41
+ public function __construct()
42
+ {
43
+ parent::__construct();
44
+ $this->setId('mobile_app_tabs');
45
+ $this->setDestElementId('edit_form');
46
+ $this->setTitle($this->__('Manage Mobile App'));
47
+ }
48
+
49
+ /**
50
+ * Preparing global layout
51
+ *
52
+ * @return Mage_Core_Block_Abstract
53
+ */
54
+ protected function _prepareLayout()
55
+ {
56
+ if (Mage::getSingleton('adminhtml/session')->getNewApplication()) {
57
+ $this->addTab('set', array(
58
+ 'label' => $this->__('Settings'),
59
+ 'content' => $this->getLayout()
60
+ ->createBlock('xmlconnect/adminhtml_mobile_edit_tab_settings')
61
+ ->toHtml(),
62
+ 'active' => true
63
+ ));
64
+ }
65
+ return parent::_prepareLayout();
66
+ }
67
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Addrow.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Xmlconnect Add row form element
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Addrow
35
+ extends Varien_Data_Form_Element_Button
36
+ {
37
+ /**
38
+ * Render Element Html
39
+ *
40
+ * @return string
41
+ */
42
+ public function getElementHtml()
43
+ {
44
+ $html = $this->getBeforeElementHtml()
45
+ . '<button id="'.$this->getHtmlId()
46
+ . '" name="'
47
+ . $this->getName()
48
+ . '" value="'.$this->getEscapedValue()
49
+ . '" '
50
+ . $this->serialize($this->getHtmlAttributes())
51
+ . ' ><span>'
52
+ . $this->getEscapedValue()
53
+ . '</span></button>'
54
+ . $this->getAfterElementHtml();
55
+ return $html;
56
+ }
57
+
58
+ /**
59
+ * Getter for "before_element_html"
60
+ *
61
+ * @return string
62
+ */
63
+ public function getBeforeElementHtml()
64
+ {
65
+ return $this->getData('before_element_html');
66
+ }
67
+
68
+ /**
69
+ * Return label html code
70
+ *
71
+ * @param string $idSuffix
72
+ * @return string
73
+ */
74
+ public function getLabelHtml($idSuffix = '')
75
+ {
76
+ if ($this->getLabel() !== null) {
77
+ $html = '<label for="' . $this->getHtmlId() . $idSuffix . '">'
78
+ . $this->getLabel()
79
+ . ($this->getRequired() ? ' <span class="required">*</span>' : '')
80
+ . '</label>';
81
+ } else {
82
+ $html = '';
83
+ }
84
+ return $html;
85
+ }
86
+
87
+ /**
88
+ * Overriding toHtml parent method
89
+ * Adding addrow Block to element renderer
90
+ *
91
+ * @return string
92
+ */
93
+ public function toHtml()
94
+ {
95
+ $blockClassName = Mage::getConfig()->getBlockClassName('adminhtml/template');
96
+ $jsBlock = new $blockClassName;
97
+ $jsBlock->setTemplate('xmlconnect/form/element/addrow.phtml');
98
+ $jsBlock->setOptions($this->getOptions());
99
+ return parent::toHtml() . $jsBlock->toHtml();
100
+ }
101
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Color.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Xmlconnect color form element
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Color
35
+ extends Varien_Data_Form_Element_Text
36
+ {
37
+ /**
38
+ * Return html code for current block
39
+ *
40
+ * @return mixed|string
41
+ */
42
+ public function getHtml()
43
+ {
44
+ $this->addClass('color {required:false,hash:true}');
45
+ return parent::getHtml();
46
+ }
47
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Country.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect Country selector form element
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Country
35
+ extends Varien_Data_Form_Element_Checkboxes
36
+ {
37
+ /**
38
+ * Flag of using the border in the table's TD
39
+ *
40
+ * @var bool
41
+ */
42
+ protected $_useBorderClass = false;
43
+
44
+ /**
45
+ * Init Element
46
+ *
47
+ * @param array $attributes
48
+ */
49
+ public function __construct($attributes=array())
50
+ {
51
+ parent::__construct($attributes);
52
+ $this->setType('checkbox');
53
+ $this->setExtType('country');
54
+ }
55
+
56
+ /**
57
+ * Retrieve HTML
58
+ *
59
+ * @return string
60
+ */
61
+ public function getElementHtml()
62
+ {
63
+ $values = $this->_prepareValues();
64
+
65
+ if (empty($values)) {
66
+ return '';
67
+ }
68
+
69
+ $columns = (int)$this->getData('columns');
70
+ $columns = $columns ? $columns : 1;
71
+ $rows = ceil(count($values) / $columns);
72
+ $row = $column = 0;
73
+
74
+ $options = array();
75
+
76
+ foreach ($values as $value) {
77
+ if (empty($value['value'])) {
78
+ continue;
79
+ }
80
+ $options[$row++][$column] = $value;
81
+ if ($row == $rows) {
82
+ $row = 0;
83
+ $column++;
84
+ }
85
+ }
86
+
87
+ while ($row < $rows) {
88
+ $options[$row++][$column] = '';
89
+ }
90
+
91
+ $id = $this->getData('id');
92
+ $id = empty($id) ? '' : ' id="' . $id . '-table"';
93
+ $class = $this->getData('class');
94
+ $html = PHP_EOL . "<table class=\"countries {$class}\"{$id}>" . PHP_EOL;
95
+
96
+ $zebrine = '';
97
+ $stripy = false;
98
+ if (strpos($class, 'stripy')) {
99
+ $stripy = true;
100
+ }
101
+
102
+ $columns--;
103
+ foreach ($options as $row) {
104
+ $html .= "<tr{$zebrine}>" . PHP_EOL;
105
+
106
+ if ($stripy) {
107
+ $zebrine = empty($zebrine) ? ' class="odd"' : '';
108
+ $this->_useBorderClass = true;
109
+ foreach ($row as $idx => $option) {
110
+ /**
111
+ * for istore (as shown by $stripy) use border settings in TD
112
+ */
113
+ if ($idx == $columns) {
114
+ /**
115
+ * for last table's column TD should not have a border
116
+ */
117
+ $this->_useBorderClass = false;
118
+ }
119
+ $html .= $this->_optionToHtml($option);
120
+ }
121
+ } else {
122
+ foreach ($row as $option) {
123
+ $html .= $this->_optionToHtml($option);
124
+ }
125
+ }
126
+
127
+ $html .= PHP_EOL . '</tr>' . PHP_EOL;
128
+ }
129
+
130
+ $html .= '</table>'
131
+ . PHP_EOL
132
+ . $this->getAfterElementHtml();
133
+
134
+ return $html;
135
+ }
136
+
137
+ /**
138
+ * Get HTML code for the one option
139
+ *
140
+ * @param array $option
141
+ * @return string
142
+ */
143
+ protected function _optionToHtml($option)
144
+ {
145
+ if (empty($option)) {
146
+ $html = '<td>&nbsp;</td><td>&nbsp;</td>';
147
+ } else {
148
+ $id = $this->getHtmlId() . '_' . $this->_escape($option['value']);
149
+ $isNameLeft = $this->getData('place_name_left');
150
+
151
+ $border = $this->_useBorderClass ? ' class="border"' : '';
152
+ $html = '<td' . $border . '><input id="' . $id . '"';
153
+ foreach ($this->getHtmlAttributes() as $attribute) {
154
+ $value = $this->getDataUsingMethod($attribute, $option['value']);
155
+ if ($value) {
156
+ $html .= ' ' . $attribute . '="' . $value . '"';
157
+ }
158
+ }
159
+ $html .= ' value="' . $option['value'] . '" /></td>';
160
+
161
+ $label = '<td><label for="' . $id . '" style="white-space: nowrap;">' . $option['label'] . '</label></td>';
162
+
163
+ if ($isNameLeft) {
164
+ $html = $label . $html;
165
+ } else {
166
+ $html = $html . $label;
167
+ }
168
+ }
169
+
170
+ return $html;
171
+ }
172
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Datetime.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect data selector form element
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Datetime
35
+ extends Varien_Data_Form_Element_Abstract
36
+ {
37
+ /**
38
+ * Date
39
+ *
40
+ * @var Zend_Date
41
+ */
42
+ protected $_value;
43
+
44
+ public function __construct($attributes=array())
45
+ {
46
+ parent::__construct($attributes);
47
+ $this->setType('text');
48
+ $this->setExtType('textfield');
49
+ if (isset($attributes['value'])) {
50
+ $this->setValue($attributes['value']);
51
+ }
52
+ }
53
+
54
+ /**
55
+ * If script executes on x64 system, converts large
56
+ * numeric values to timestamp limit
57
+ *
58
+ * @param int $value
59
+ * @return int
60
+ */
61
+ protected function _toTimestamp($value)
62
+ {
63
+ $value = (int)$value;
64
+ if ($value > 3155760000) {
65
+ $value = 0;
66
+ }
67
+ return $value;
68
+ }
69
+
70
+ /**
71
+ * Set date value
72
+ * If Zend_Date instance is provided instead of value, other params will be ignored.
73
+ * Format and locale must be compatible with Zend_Date
74
+ *
75
+ * @param mixed $value
76
+ * @param string $format
77
+ * @param string $locale
78
+ * @return Varien_Data_Form_Element_Date
79
+ */
80
+ public function setValue($value, $format = null, $locale = null)
81
+ {
82
+ if (empty($value)) {
83
+ $this->_value = '';
84
+ return $this;
85
+ }
86
+ if ($value instanceof Zend_Date) {
87
+ $this->_value = $value;
88
+ return $this;
89
+ }
90
+ if (preg_match('/^[0-9]+$/', $value)) {
91
+ $this->_value = new Zend_Date($this->_toTimestamp($value));
92
+ //$this->_value = new Zend_Date((int)value);
93
+ return $this;
94
+ }
95
+ // last check, if input format was set
96
+ if (null === $format) {
97
+ $format = Varien_Date::DATETIME_INTERNAL_FORMAT;
98
+ if ($this->getInputFormat()) {
99
+ $format = $this->getInputFormat();
100
+ }
101
+ }
102
+ // last check, if locale was set
103
+ if (null === $locale) {
104
+ if (!$locale = $this->getLocale()) {
105
+ $locale = null;
106
+ }
107
+ }
108
+ try {
109
+ $this->_value = new Zend_Date($value, $format, $locale);
110
+ } catch (Exception $e) {
111
+ $this->_value = '';
112
+ }
113
+ return $this;
114
+ }
115
+
116
+ /**
117
+ * Get date value as string.
118
+ * Format can be specified, or it will be taken from $this->getFormat()
119
+ *
120
+ * @param string $format (compatible with Zend_Date)
121
+ * @return string
122
+ */
123
+ public function getValue($format = null)
124
+ {
125
+ if (empty($this->_value)) {
126
+ return '';
127
+ }
128
+ if (null === $format) {
129
+ $format = $this->getFormat() . " " . $this->getFormatT();
130
+ }
131
+ return $this->_value->toString($format);
132
+ }
133
+
134
+ /**
135
+ * Get value instance, if any
136
+ *
137
+ * @return Zend_Date
138
+ */
139
+ public function getValueInstance()
140
+ {
141
+ if (empty($this->_value)) {
142
+ return null;
143
+ }
144
+ return $this->_value;
145
+ }
146
+
147
+ /**
148
+ * Output the input field and assign calendar instance to it.
149
+ * In order to output the date:
150
+ * - the value must be instantiated (Zend_Date)
151
+ * - output format must be set (compatible with Zend_Date)
152
+ *
153
+ * @return string
154
+ */
155
+ public function getElementHtml()
156
+ {
157
+ $this->addClass('input-text');
158
+
159
+ $html = sprintf(
160
+ '<input name="%s" id="%s" value="%s" %s style="width:110px !important;" />'
161
+ .' <img src="%s" alt="" class="v-middle" id="%s_trig" title="%s" style="%s" />',
162
+ $this->getName(),
163
+ $this->getHtmlId(),
164
+ $this->_escape($this->getValue()),
165
+ $this->serialize($this->getHtmlAttributes()),
166
+ $this->getImage(),
167
+ $this->getHtmlId(),
168
+ 'Select Date',
169
+ ($this->getDisabled() ? 'display:none;' : '')
170
+ );
171
+ $outputFormat = $this->getFormat();
172
+ $outputTimeFormat = $this->getFormatT();
173
+ if (empty($outputFormat)) {
174
+ Mage::throwException(
175
+ $this->__('Output format is not specified. Please, specify "format" key in constructor, or set it using setFormat().')
176
+ );
177
+ }
178
+ $displayFormat = Varien_Date::convertZendToStrFtime($outputFormat, true, false);
179
+ $displayTimeFormat = Varien_Date::convertZendToStrFtime($outputTimeFormat, false, true);
180
+
181
+ $html .= sprintf('
182
+ <script type="text/javascript">
183
+ //<![CDATA[
184
+ Calendar.setup({
185
+ inputField: "%s",
186
+ ifFormat: "%s",
187
+ showsTime: %s,
188
+ button: "%s_trig",
189
+ align: "Bl",
190
+ singleClick : false,
191
+ timeFormat: 12
192
+ });
193
+ //]]>
194
+ </script>',
195
+ $this->getHtmlId(),
196
+ $displayFormat . " " . $displayTimeFormat,
197
+ $this->getTime() ? 'true' : 'false',
198
+ $this->getHtmlId()
199
+ );
200
+
201
+ $html .= $this->getAfterElementHtml();
202
+
203
+ return $html;
204
+ }
205
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Font.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect font form element
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Font
35
+ extends Varien_Data_Form_Element_Abstract
36
+ {
37
+ /**
38
+ * Init font element
39
+ *
40
+ * @param array $attributes
41
+ */
42
+ public function __construct($attributes=array())
43
+ {
44
+ parent::__construct($attributes);
45
+ $this->setType('font');
46
+ }
47
+
48
+ /**
49
+ * Setting stored data to Font element
50
+ *
51
+ * @param array $conf
52
+ */
53
+ public function initFields($conf)
54
+ {
55
+ $name = $conf['name'];
56
+
57
+ $this->addElement(new Varien_Data_Form_Element_Select(array(
58
+ 'name' => $name . '[name]',
59
+ 'values' => $conf['fontNames'],
60
+ 'style' => 'width: 206px; margin: 0',
61
+ )));
62
+
63
+ $this->addElement(new Varien_Data_Form_Element_Select(array(
64
+ 'name' => $name . '[size]',
65
+ 'values' => $conf['fontSizes'],
66
+ 'style' => 'width: 70px; margin: 0',
67
+ )));
68
+
69
+ $this->addElement(new Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Color(array(
70
+ 'name' => $name . '[color]',
71
+ 'style' => 'width: 60px; margin: 0'
72
+ )));
73
+ }
74
+
75
+ /**
76
+ * Add form element
77
+ *
78
+ * @param Varien_Data_Form_Element_Abstract $element
79
+ * @param bool|string $after also can be '^'
80
+ * @return Varien_Data_Form
81
+ */
82
+ public function addElement(Varien_Data_Form_Element_Abstract $element, $after = false)
83
+ {
84
+ $element->setId($element->getData('name'));
85
+ $element->setNoSpan(true);
86
+ parent::addElement($element, $after);
87
+ }
88
+
89
+ /**
90
+ * Get Rendered Element Html
91
+ *
92
+ * @return string
93
+ */
94
+ public function getElementHtml()
95
+ {
96
+ $elementsArray = array();
97
+ foreach ($this->getElements() as $element) {
98
+ $elementsArray[] .= $element->toHtml();
99
+ }
100
+ return $elementsArray[0]
101
+ . $elementsArray[1]
102
+ . '</td><td class="label" style="width: 2em !important">'
103
+ . $elementsArray[2];
104
+ }
105
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Image.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect image form element
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Image
35
+ extends Varien_Data_Form_Element_Image
36
+ {
37
+ /**
38
+ * Function fetches image Url actual or default
39
+ *
40
+ * @return string
41
+ */
42
+ protected function _getUrl()
43
+ {
44
+ if ($this->getValue()) {
45
+ if (strpos($this->getValue(), '://') === false) {
46
+ $url = Mage::helper('xmlconnect/image')->getFileDefaultSizeSuffixAsUrl($this->getValue());
47
+ $url = Mage::helper('xmlconnect/image')->getMediaUrl($url);
48
+ } else {
49
+ $url = $this->getValue();
50
+ }
51
+ } else {
52
+ $url = $this->getDefaultValue();
53
+ }
54
+ return $url;
55
+ }
56
+
57
+ /**
58
+ * Get "clear" filename from element
59
+ *
60
+ * @return string
61
+ */
62
+ public function getUploadName()
63
+ {
64
+ /**
65
+ * Ugly hack to avoid $_FILES[..]['name'][..][..]
66
+ */
67
+ $name = $this->getName();
68
+ $name = strtr($name, array('[' => '/', ']' => ''));
69
+ return $name;
70
+ }
71
+
72
+ /**
73
+ * Compose output html for element
74
+ *
75
+ * @return string
76
+ */
77
+ public function getElementHtml()
78
+ {
79
+ $html = '<div style="white-space: nowrap">';
80
+
81
+ $url = $this->_getUrl();
82
+ $html .= '<a href="' . $url . '" onclick="imagePreview(\'' . $this->getHtmlId() . '_image\'); return false;">';
83
+ $html .= '<img src="' . $url . '" id="' . $this->getHtmlId() . '_image"';
84
+ $html .= ' alt="" height="22" width="22" class="small-image-preview v-middle" /></a> ';
85
+
86
+ $html .= '<input id="' . $this->getHtmlId() . '_hidden" name="' . $this->getName();
87
+ $html .= '" value="' . $this->getEscapedValue() . '" type="hidden" />';
88
+
89
+ $this->setClass('input-file');
90
+ $html .= '<input id="' . $this->getHtmlId() . '" name="' . $this->getUploadName();
91
+ $attr = $this->serialize($this->getHtmlAttributes());
92
+ $html .= '" value="' . $this->getEscapedValue() . '" ' . $attr . '/>' . PHP_EOL;
93
+ $html .= $this->getAfterElementHtml();
94
+
95
+ $html .= '</div>';
96
+
97
+ return $html;
98
+ }
99
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Page.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect page form element
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Page
35
+ extends Varien_Data_Form_Element_Abstract
36
+ {
37
+ /**
38
+ * Init page element
39
+ *
40
+ * @param array $attributes
41
+ */
42
+ public function __construct($attributes=array())
43
+ {
44
+ parent::__construct($attributes);
45
+ $this->setType('page');
46
+ }
47
+
48
+ /**
49
+ * Setting stored data to page element
50
+ *
51
+ * @param array $conf
52
+ */
53
+ public function initFields($conf)
54
+ {
55
+ $this->addElement(new Varien_Data_Form_Element_Text(array(
56
+ 'name' => $conf['name'] . '[label]',
57
+ 'class' => 'label onclick_text',
58
+ )));
59
+
60
+ $this->addElement(new Varien_Data_Form_Element_Select(array(
61
+ 'name' => $conf['name'] . '[id]',
62
+ 'values' => $conf['values'],
63
+ )));
64
+ }
65
+
66
+ /**
67
+ * Add form element
68
+ *
69
+ * @param Varien_Data_Form_Element_Abstract $element
70
+ * @param boolean|string $after also can be '^'
71
+ * @return Varien_Data_Form
72
+ */
73
+ public function addElement(Varien_Data_Form_Element_Abstract $element, $after = false)
74
+ {
75
+ $element->setId($element->getData('name'));
76
+ parent::addElement($element, $after);
77
+ }
78
+
79
+ /**
80
+ * Getter for Label field
81
+ * fetching first element as label
82
+ *
83
+ * @param string $idSuffix
84
+ * @return string
85
+ */
86
+ public function getLabelHtml($idSuffix = '')
87
+ {
88
+ list($label, $element) = $this->getElements();
89
+ return $label->toHtml();
90
+ }
91
+
92
+ /**
93
+ * Getter for second part of rendered field ("selectbox" and "delete button")
94
+ * fetching second element as <element code>
95
+ *
96
+ * @return string
97
+ */
98
+ public function getElementHtml()
99
+ {
100
+ list($label, $element) = $this->getElements();
101
+ return $element->toHtml()
102
+ . '</td><td class="label" style="width: 5em">'
103
+ . '<button class=" scalable save onclick_button" value="&minus;"><span>'
104
+ . Mage::helper('xmlconnect')->__('Delete')
105
+ . '</span></button>';
106
+ }
107
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Tabs.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect tabs form element
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Tabs
35
+ extends Varien_Data_Form_Element_Text
36
+ {
37
+ /**
38
+ * Generate application tabs html
39
+ *
40
+ * @return string
41
+ */
42
+ public function getHtml()
43
+ {
44
+ if ((bool)Mage::getSingleton('adminhtml/session')->getNewApplication()) {
45
+ return '';
46
+ }
47
+
48
+ $blockClassName = Mage::getConfig()->getBlockClassName('adminhtml/template');
49
+ $block = new $blockClassName;
50
+ $device = Mage::helper('xmlconnect')->getDeviceType();
51
+ if (array_key_exists($device, Mage::helper('xmlconnect')->getSupportedDevices())) {
52
+ $template = 'xmlconnect/form/element/app_tabs_' . strtolower($device) . '.phtml';
53
+ } else {
54
+ Mage::throwException(
55
+ $this->__('Device doesn\'t recognized. Unable to load a template.')
56
+ );
57
+ }
58
+
59
+ $block->setTemplate($template);
60
+ $tabs = Mage::getModel('xmlconnect/tabs', $this->getValue());
61
+ $block->setTabs($tabs);
62
+ $block->setName($this->getName());
63
+ return $block->toHtml();
64
+ }
65
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Theme.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect theme form element
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Theme
35
+ extends Varien_Data_Form_Element_Text
36
+ {
37
+ /**
38
+ * Generate themes (colors) html
39
+ *
40
+ * @return string
41
+ */
42
+ public function getHtml()
43
+ {
44
+ $blockClassName = Mage::getConfig()
45
+ ->getBlockClassName('xmlconnect/adminhtml_mobile_edit_tab_design_themes');
46
+ $block = new $blockClassName;
47
+ $block->setThemes($this->getThemes());
48
+ $block->setName($this->getName());
49
+ $block->setValue($this->getValue());
50
+ return $block->toHtml();
51
+ }
52
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Grid.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Application grid block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_Xmlconnect_Block_Adminhtml_Mobile_Grid extends Mage_Adminhtml_Block_Widget_Grid
35
+ {
36
+ /**
37
+ * Class constructor
38
+ */
39
+ public function __construct()
40
+ {
41
+ parent::__construct();
42
+ $this->setId('mobile_apps_grid');
43
+ $this->setDefaultSort('application_id');
44
+ $this->setDefaultDir('ASC');
45
+ }
46
+
47
+ /**
48
+ * Initialize grid data collection
49
+ *
50
+ * @return Mage_Adminhtml_Block_Widget_Grid
51
+ */
52
+ protected function _prepareCollection()
53
+ {
54
+ $collection = Mage::getModel('xmlconnect/application')->getCollection();
55
+ $this->setCollection($collection);
56
+ return parent::_prepareCollection();
57
+ }
58
+
59
+ /**
60
+ * Declare grid columns
61
+ *
62
+ * @return Mage_Adminhtml_Block_Widget_Grid
63
+ */
64
+ protected function _prepareColumns()
65
+ {
66
+ $this->addColumn('name', array(
67
+ 'header' => $this->__('App Name'),
68
+ 'align' => 'left',
69
+ 'index' => 'name',
70
+ ));
71
+
72
+ $this->addColumn('code', array(
73
+ 'header' => $this->__('App Code'),
74
+ 'align' => 'left',
75
+ 'index' => 'code',
76
+ 'width' => '200',
77
+ ));
78
+
79
+ if (!Mage::app()->isSingleStoreMode()) {
80
+ $this->addColumn('store_id', array(
81
+ 'header' => $this->__('Store View'),
82
+ 'index' => 'store_id',
83
+ 'type' => 'store',
84
+ 'store_view' => true,
85
+ 'sortable' => false,
86
+ 'width' => '250',
87
+ ));
88
+ }
89
+
90
+ $this->addColumn('type', array(
91
+ 'header' => $this->__('Device'),
92
+ 'type' => 'text',
93
+ 'index' => 'type',
94
+ 'align' => 'center',
95
+ 'filter' => 'adminhtml/widget_grid_column_filter_select',
96
+ 'options' => Mage::helper('xmlconnect')->getSupportedDevices(),
97
+ 'renderer' => 'xmlconnect/adminhtml_mobile_grid_renderer_type',
98
+ ));
99
+
100
+ $this->addColumn('status', array(
101
+ 'header' => $this->__('Status'),
102
+ 'index' => 'status',
103
+ 'renderer' => 'xmlconnect/adminhtml_mobile_grid_renderer_bool',
104
+ 'align' => 'center',
105
+ 'filter' => 'adminhtml/widget_grid_column_filter_select',
106
+ 'options' => Mage::helper('xmlconnect')->getStatusOptions(),
107
+
108
+ ));
109
+
110
+ return parent::_prepareColumns();
111
+ }
112
+
113
+ /**
114
+ * Row click url
115
+ *
116
+ * @param Mage_Catalog_Model_Product|Varien_Object $row
117
+ * @return string
118
+ */
119
+ public function getRowUrl($row)
120
+ {
121
+ return $this->getUrl('*/*/edit', array('application_id' => $row->getId()));
122
+ }
123
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Grid/Renderer/Bool.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect status field grid renderer
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Grid_Renderer_Bool
35
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
36
+ {
37
+ /**
38
+ * Render application status image
39
+ *
40
+ * @param Varien_Object $row
41
+ * @return string
42
+ */
43
+ public function render(Varien_Object $row)
44
+ {
45
+ $result = '';
46
+ $status = (int) $row->getData($this->getColumn()->getIndex());
47
+ $options = Mage::helper('xmlconnect')->getStatusOptions();
48
+ if ($status == Mage_XmlConnect_Model_Application::APP_STATUS_SUCCESS) {
49
+ $result = '<img src="'
50
+ . Mage::helper('xmlconnect/image')->getSkinImagesUrl('gel_green.png')
51
+ . '" >&nbsp;'
52
+ . (isset($options[$status]) ? $options[$status] : '');
53
+ } else if ($status == Mage_XmlConnect_Model_Application::APP_STATUS_INACTIVE) {
54
+ $result = '<img src="'
55
+ . Mage::helper('xmlconnect/image')->getSkinImagesUrl('gel_red.png')
56
+ . '" >&nbsp;'
57
+ . (isset($options[$status]) ? $options[$status] : '');
58
+ }
59
+ return $result;
60
+ }
61
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Grid/Renderer/Type.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml catalog super product link grid checkbox renderer
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Grid_Renderer_Type
35
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
36
+ {
37
+ /**
38
+ * Renders grid column
39
+ *
40
+ * @param Varien_Object $row
41
+ * @return string
42
+ */
43
+ public function render(Varien_Object $row)
44
+ {
45
+ $type = $row->getData($this->getColumn()->getIndex());
46
+ $devices = Mage::helper('xmlconnect')->getSupportedDevices();
47
+ if (isset($devices[$type])) {
48
+ return $devices[$type];
49
+ } else {
50
+ return $type;
51
+ }
52
+ }
53
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Preview/Content.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect preview content block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Preview_Content
35
+ extends Mage_Adminhtml_Block_Template
36
+ {
37
+ /**
38
+ * Set path to template used for generating block's output.
39
+ *
40
+ * @param string $templateType
41
+ * @return Mage_XmlConnect_Block_Adminhtml_Mobile_Preview_Content
42
+ */
43
+ public function setTemplate($templateType)
44
+ {
45
+ $deviceType = Mage::helper('xmlconnect')->getDeviceType();
46
+ parent::setTemplate(
47
+ 'xmlconnect/edit/tab/design/preview/'
48
+ . $templateType
49
+ . '_'
50
+ . $deviceType
51
+ . '.phtml'
52
+ );
53
+ return $this;
54
+ }
55
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Preview/Tabitems.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect Tab items block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Preview_Tabitems
35
+ extends Mage_Adminhtml_Block_Template
36
+ {
37
+ /**
38
+ * Set preview tab items template
39
+ */
40
+ public function __construct()
41
+ {
42
+ parent::__construct();
43
+
44
+ $deviceType = Mage::helper('xmlconnect')->getDeviceType();
45
+ $this->setTemplate(
46
+ 'xmlconnect/edit/tab/design/preview/tab_items_'
47
+ . $deviceType
48
+ . '.phtml'
49
+ );
50
+ }
51
+
52
+ /**
53
+ * Set active tab
54
+ *
55
+ * @param string $tab
56
+ * @return Mage_XmlConnect_Block_Adminhtml_Mobile_Preview_Tabitems
57
+ */
58
+ public function setActiveTab($tab)
59
+ {
60
+ Mage::helper('xmlconnect')->getPreviewModel()->setActiveTab($tab);
61
+ return $this;
62
+ }
63
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Application submission block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission
35
+ extends Mage_Adminhtml_Block_Widget_Form_Container
36
+ {
37
+ /**
38
+ * Setting buttons for submit application page
39
+ */
40
+ public function __construct()
41
+ {
42
+ $this->_objectId = 'application_id';
43
+ $this->_controller = 'adminhtml_mobile';
44
+ $this->_blockGroup = 'xmlconnect';
45
+ $this->_mode = 'submission';
46
+ parent::__construct();
47
+
48
+ $this->removeButton('delete');
49
+ $this->removeButton('save');
50
+ $this->removeButton('reset');
51
+
52
+ $app = Mage::helper('xmlconnect')->getApplication();
53
+ if ($app && $app->getIsResubmitAction()) {
54
+ $label = $this->__('Resubmit App');
55
+ } else {
56
+ $label = $this->__('Submit App');
57
+ }
58
+
59
+ $this->_addButton('submission_post', array(
60
+ 'class' => 'save',
61
+ 'label' => $label,
62
+ 'onclick' => "submitApplication()",
63
+ ));
64
+
65
+ $this->_updateButton('back', 'label', $this->__('Back to App Edit'));
66
+ $this->_updateButton(
67
+ 'back',
68
+ 'onclick',
69
+ 'setLocation(\'' . $this->getUrl('*/*/edit', array('application_id' => $app->getId())) . '\')'
70
+ );
71
+ }
72
+
73
+ /**
74
+ * Adding styles to block
75
+ *
76
+ * @throws Mage_Core_Exception
77
+ * @return Mage_Adminhtml_Block_Widget_Form_Container
78
+ */
79
+ protected function _prepareLayout()
80
+ {
81
+ $this->getLayout()->getBlock('head')->addJs('jscolor/jscolor.js');
82
+ $this->getLayout()->getBlock('head')->addJs('scriptaculous/scriptaculous.js');
83
+
84
+
85
+ $deviceType = Mage::helper('xmlconnect')->getDeviceType();
86
+ switch ($deviceType) {
87
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE:
88
+ $this->getLayout()->getBlock('head')->addItem('skin_css', 'xmlconnect/mobile-home.css');
89
+ $this->getLayout()->getBlock('head')->addItem('skin_css', 'xmlconnect/mobile-catalog.css');
90
+ break;
91
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD:
92
+ $this->getLayout()->getBlock('head')->addItem('skin_css', 'xmlconnect/mobile-ipad-home.css');
93
+ $this->getLayout()->getBlock('head')->addItem('skin_css', 'xmlconnect/mobile-ipad-catalog.css');
94
+ break;
95
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID:
96
+ $this->getLayout()->getBlock('head')->addItem('skin_css', 'xmlconnect/mobile-android.css');
97
+ break;
98
+ default:
99
+ Mage::throwException(
100
+ $this->__('Device doesn\'t recognized: "%s". Unable to load preview model.', $deviceType)
101
+ );
102
+ break;
103
+ }
104
+
105
+ return parent::_prepareLayout();
106
+ }
107
+
108
+ /**
109
+ * Get form header title
110
+ *
111
+ * @return string
112
+ */
113
+ public function getHeaderText()
114
+ {
115
+ $app = Mage::helper('xmlconnect')->getApplication();
116
+ if ($app && $app->getId()) {
117
+ return $this->__('Submit App "%s"', $this->htmlEscape($app->getName()));
118
+ }
119
+ return '';
120
+ }
121
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Form.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Device submission form block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Form
35
+ extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+ /**
38
+ * Prepare form before rendering HTML
39
+ *
40
+ * @return Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Form
41
+ */
42
+ protected function _prepareForm()
43
+ {
44
+ $form = new Varien_Data_Form(array(
45
+ 'id' => 'edit_form',
46
+ 'action' => $this->getUrl('*/mobile/submission'),
47
+ 'method' => 'post',
48
+ 'enctype' => 'multipart/form-data'
49
+ ));
50
+ $form->setUseContainer(true);
51
+ $this->setForm($form);
52
+ return parent::_prepareForm();
53
+ }
54
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Renderer/Country/Androidmarket.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Country field renderer for Android Market
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Renderer_Country_Androidmarket
35
+ extends Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset_Element
36
+ implements Varien_Data_Form_Element_Renderer_Interface
37
+ {
38
+ /**
39
+ * Override setting the template
40
+ *
41
+ * @return void
42
+ */
43
+ protected function _construct()
44
+ {
45
+ $this->setTemplate('xmlconnect/form/element/country/androidmarket.phtml');
46
+ }
47
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Renderer/Country/Istore.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Country field renderer for iStore
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Renderer_Country_Istore
35
+ extends Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset_Element
36
+ implements Varien_Data_Form_Element_Renderer_Interface
37
+ {
38
+ /**
39
+ * Override setting the template
40
+ *
41
+ * @return void
42
+ */
43
+ protected function _construct()
44
+ {
45
+ $this->setTemplate('xmlconnect/form/element/country/istore.phtml');
46
+ }
47
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tab/Container.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Device container block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Tab_Container
35
+ extends Mage_Adminhtml_Block_Template
36
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
+ {
38
+ /**
39
+ * Constructor
40
+ * Setting view parameters, template
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+ $this->setShowGlobalIcon(true);
46
+ $this->setTemplate('xmlconnect/submission/container.phtml');
47
+ }
48
+
49
+ /**
50
+ * Prepare label for tab
51
+ *
52
+ * @return string
53
+ */
54
+ public function getTabLabel()
55
+ {
56
+ return $this->__('Submission');
57
+ }
58
+
59
+ /**
60
+ * Prepare title for tab
61
+ *
62
+ * @return string
63
+ */
64
+ public function getTabTitle()
65
+ {
66
+ return $this->__('Submission');
67
+ }
68
+
69
+ /**
70
+ * Returns status flag about this tab can be shown or not
71
+ *
72
+ * @return true
73
+ */
74
+ public function canShowTab()
75
+ {
76
+ return true;
77
+ }
78
+
79
+ /**
80
+ * Returns status flag about this tab hidden or not
81
+ *
82
+ * @return true
83
+ */
84
+ public function isHidden()
85
+ {
86
+ return false;
87
+ }
88
+
89
+ /**
90
+ * Retrive submission action url
91
+ *
92
+ * @return string
93
+ */
94
+ public function getActionUrl()
95
+ {
96
+ $param = array('key' => Mage::helper('xmlconnect')->getApplication()->getId());
97
+ return $this->getUrl('*/*/submissionPost', $param);
98
+ }
99
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tab/Container/Submission.php ADDED
@@ -0,0 +1,389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Device submission container block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Tab_Container_Submission
35
+ extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
36
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
37
+ {
38
+
39
+ /**
40
+ * Constructor
41
+ * Setting view parameters
42
+ */
43
+ public function __construct()
44
+ {
45
+ parent::__construct();
46
+ $this->setShowGlobalIcon(true);
47
+ }
48
+
49
+ /**
50
+ * Adding preview for images if application was submitted(so we have saved images)
51
+ *
52
+ * @return Mage_Core_Block_Abstract
53
+ */
54
+ protected function _prepareLayout()
55
+ {
56
+ $block = $this->getLayout()->createBlock('adminhtml/template')
57
+ ->setTemplate('xmlconnect/submission/app_icons_preview.phtml')
58
+ ->setImages(Mage::helper('xmlconnect')->getApplication()->getImages());
59
+ $this->setChild('images', $block);
60
+ parent::_prepareLayout();
61
+ }
62
+
63
+ /**
64
+ * Add image uploader to fieldset
65
+ *
66
+ * @param Varien_Data_Form_Element_Fieldset $fieldset
67
+ * @param string $fieldName
68
+ * @param string $title
69
+ * @param string $note
70
+ * @param string $default
71
+ * @param boolean $required
72
+ */
73
+ public function addImage($fieldset, $fieldName, $title, $note = '', $default = '', $required = false)
74
+ {
75
+ $fieldset->addField($fieldName, 'image', array(
76
+ 'name' => $fieldName,
77
+ 'label' => $title,
78
+ 'note' => !empty($note) ? $note : null,
79
+ 'default_value' => $default,
80
+ 'required' => $required,
81
+ ));
82
+ }
83
+
84
+ /**
85
+ * Prepare form before rendering HTML
86
+ *
87
+ * @return Mage_Adminhtml_Block_Widget_Form
88
+ */
89
+ protected function _prepareForm()
90
+ {
91
+ $deviceType = Mage::helper('xmlconnect')->getDeviceType();
92
+ $form = new Varien_Data_Form();
93
+ $this->setForm($form);
94
+ /** @var $app Mage_XmlConnect_Model_Application */
95
+ $app = Mage::helper('xmlconnect')->getApplication();
96
+ $form->setAction($this->getUrl('*/mobile/submission'));
97
+ $isResubmit = $app->getIsResubmitAction();
98
+ $formData = $app->getFormData();
99
+
100
+ $url = Mage::getStoreConfig('xmlconnect/mobile_application/activation_key_url');
101
+ $afterElementHtml = $this->__('In order to submit your app, you need to first purchase a <a href="%s" target="_blank">%s</a> from MagentoCommerce', $url, $this->__('Activation Key'));
102
+ $fieldset = $form->addFieldset('submit_keys', array('legend' => $this->__('Key')));
103
+ $field = $fieldset->addField('conf[submit_text][key]', 'text', array(
104
+ 'name' => 'conf[submit_text][key]',
105
+ 'label' => $this->__('Activation Key'),
106
+ 'value' => isset($formData['conf[submit_text][key]']) ? $formData['conf[submit_text][key]'] : null,
107
+ 'after_element_html' => $afterElementHtml,
108
+ ));
109
+ if (!$isResubmit) {
110
+ $field->setRequired(true);
111
+ } else {
112
+ $field->setDisabled('disabled');
113
+ $fieldset->addField('conf[submit_text][key]_hidden', 'hidden', array(
114
+ 'name' => 'conf[submit_text][key]',
115
+ 'value' => isset($formData['conf[submit_text][key]']) ? $formData['conf[submit_text][key]'] : null,
116
+ ));
117
+ }
118
+
119
+ if ($isResubmit) {
120
+ $url = Mage::getStoreConfig('xmlconnect/mobile_application/resubmission_key_url');
121
+ $rsText = $this->__('Resubmission Key');
122
+ $afterElementHtml = $this->__('In order to resubmit your app, you need to first purchase a <a href="%s" target="_blank">%s</a> from MagentoCommerce', $url, $rsText);
123
+
124
+ if (isset($formData['conf[submit_text][resubmission_activation_key]'])) {
125
+ $rsKeyVal = $formData['conf[submit_text][resubmission_activation_key]'];
126
+ } else {
127
+ $rsKeyVal = null;
128
+ }
129
+
130
+ $fieldset->addField('conf[submit_text][resubmission_activation_key]', 'text', array(
131
+ 'name' => 'conf[submit_text][resubmission_activation_key]',
132
+ 'label' => $this->__('Resubmission Key'),
133
+ 'value' => $rsKeyVal,
134
+ 'required' => true,
135
+ 'after_element_html' => $afterElementHtml,
136
+ ));
137
+ }
138
+
139
+ $fieldset = $form->addFieldset('submit_general', array('legend' => $this->__('Submission Fields')));
140
+
141
+ $fieldset->addField('submission_action', 'hidden', array(
142
+ 'name' => 'submission_action',
143
+ 'value' => '1',
144
+ ));
145
+
146
+ switch ($deviceType) {
147
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE:
148
+ $titleLength = Mage_XmlConnect_Helper_Iphone::SUBMISSION_TITLE_LENGTH;
149
+ $descriptionLength = Mage_XmlConnect_Helper_Iphone::SUBMISSION_DESCRIPTION_LENGTH;
150
+ $descriptionNote = $this->__('Description that appears in the iTunes App Store. %s chars maximum. ', $descriptionLength);
151
+ break;
152
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD:
153
+ $titleLength = Mage_XmlConnect_Helper_Ipad::SUBMISSION_TITLE_LENGTH;
154
+ $descriptionLength = Mage_XmlConnect_Helper_Ipad::SUBMISSION_DESCRIPTION_LENGTH;
155
+ $descriptionNote = $this->__('Description that appears in the iTunes App Store. %s chars maximum. ', $descriptionLength);
156
+ break;
157
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID:
158
+ $titleLength = Mage_XmlConnect_Helper_Android::SUBMISSION_TITLE_LENGTH;
159
+ $descriptionLength = Mage_XmlConnect_Helper_Android::SUBMISSION_DESCRIPTION_LENGTH;
160
+ $descriptionNote = $this->__('Description that appears in Android Market. %s chars maximum. ', $descriptionLength);
161
+ break;
162
+ }
163
+
164
+ $titleNote = $this->__('Name that appears beneath your app when users install it to their device. We recommend choosing a name that is 10-12 characters and that your customers will recognize. %s chars max.', $titleLength);
165
+
166
+ $fieldset->addField('conf/submit_text/title', 'text', array(
167
+ 'name' => 'conf[submit_text][title]',
168
+ 'label' => $this->__('Title'),
169
+ 'maxlength' => $titleLength,
170
+ 'value' => isset($formData['conf[submit_text][title]']) ? $formData['conf[submit_text][title]'] : null,
171
+ 'note' => $titleNote,
172
+ 'required' => true,
173
+ ));
174
+
175
+ if (isset($formData['conf[submit_text][description]'])) {
176
+ $descrVal = $formData['conf[submit_text][description]'];
177
+ } else {
178
+ $descrVal = null;
179
+ }
180
+
181
+ $field = $fieldset->addField('conf/submit_text/description', 'textarea', array(
182
+ 'name' => 'conf[submit_text][description]',
183
+ 'label' => $this->__('Description'),
184
+ 'maxlength' => $descriptionLength,
185
+ 'value' => $descrVal,
186
+ 'note' => $descriptionNote,
187
+ 'required' => true,
188
+ ));
189
+ $field->setRows(15);
190
+
191
+ $fieldset->addField('conf/submit_text/contact_email', 'text', array(
192
+ 'name' => 'conf[submit_text][email]',
193
+ 'label' => $this->__('Contact Email'),
194
+ 'class' => 'email',
195
+ 'maxlength' => '40',
196
+ 'value' => isset($formData['conf[submit_text][email]']) ? $formData['conf[submit_text][email]'] : null,
197
+ 'note' => $this->__('Administrative contact for this app and for app submission issues.'),
198
+ 'required' => true,
199
+ ));
200
+
201
+ $fieldset->addField('conf/submit_text/price_free_label', 'label', array(
202
+ 'name' => 'conf[submit_text][price_free_label]',
203
+ 'label' => $this->__('Price'),
204
+ 'value' => $this->__('Free'),
205
+ 'maxlength' => '40',
206
+ 'checked' => 'checked',
207
+ 'note' => $this->__('Only free apps are allowed in this version.'),
208
+ ));
209
+
210
+ $fieldset->addField('conf/submit_text/price_free', 'hidden', array(
211
+ 'name' => 'conf[submit_text][price_free]',
212
+ 'value' => '1',
213
+ ));
214
+
215
+ if (isset($formData['conf[submit_text][country]'])) {
216
+ $selected = explode(',', $formData['conf[submit_text][country]']);
217
+ } else {
218
+ $selected = null;
219
+ }
220
+
221
+ $deviceHelper = Mage::helper('xmlconnect')->getDeviceHelper();
222
+ $fieldset->addType('country', 'Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Country');
223
+ $fieldset->addField('conf/submit_text/country', 'country', array(
224
+ 'id' => 'submission-countries',
225
+ 'name' => 'conf[submit_text][country][]',
226
+ 'label' => $deviceHelper->getCountryLabel(),
227
+ 'values' => Mage::helper('xmlconnect')->getCountryOptionsArray(),
228
+ 'value' => $selected,
229
+ 'note' => $this->__('Make this app available in the following territories'),
230
+ 'columns' => $deviceHelper->getCountryColumns(),
231
+ 'place_name_left' => $deviceHelper->isCountryNamePlaceLeft(),
232
+ 'class' => $deviceHelper->getCountryClass(),
233
+ 'required' => true,
234
+ ))
235
+ ->setRenderer($deviceHelper->getCountryRenderer());
236
+
237
+ if (isset($formData['conf[submit_text][copyright]'])) {
238
+ $copyVal = $formData['conf[submit_text][copyright]'];
239
+ } else {
240
+ $copyVal = null;
241
+ }
242
+
243
+ $fieldset->addField('conf/submit_text/copyright', 'text', array(
244
+ 'name' => 'conf[submit_text][copyright]',
245
+ 'label' => $this->__('Copyright'),
246
+ 'maxlength' => '200',
247
+ 'value' => $copyVal,
248
+ 'note' => $this->__('Appears in the info section of your app (example: Copyright 2010 – Your Company, Inc.)'),
249
+ 'required' => true,
250
+ ));
251
+
252
+ if ($deviceType !== Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID) {
253
+ if (isset($formData['conf[submit_text][keywords]'])) {
254
+ $keyWordsVal = $formData['conf[submit_text][keywords]'];
255
+ } else {
256
+ $keyWordsVal = null;
257
+ }
258
+
259
+ $fieldset->addField('conf/submit_text/keywords', 'text', array(
260
+ 'name' => 'conf[submit_text][keywords]',
261
+ 'label' => $this->__('Keywords'),
262
+ 'maxlength' => '100',
263
+ 'value' => $keyWordsVal,
264
+ 'note' => $this->__('One or more keywords that describe your app. Keywords are matched to users\' searches in the App Store and help return accurate search results. Separate multiple keywords with commas. 100 chars is maximum.'),
265
+ ));
266
+ }
267
+
268
+ $fieldset = $form->addFieldset('submit_icons', array('legend' => $this->__('Icons')));
269
+
270
+ switch ($deviceType) {
271
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE:
272
+ $this->addImage($fieldset, 'conf/submit/icon', $this->__('Large iTunes Icon'),
273
+ $this->__('Large icon that appears in the iTunes App Store. You do not need to apply a gradient or soft edges (this is done automatically by Apple). Required size: 512px x 512px.'), '', true);
274
+
275
+ $this->addImage($fieldset, 'conf/submit/loader_image', $this->__('Loader Splash Screen'),
276
+ $this->__('Image that appears on first screen while your app is loading. Required size: 320px x 460px.'), '', true);
277
+
278
+ $this->addImage($fieldset, 'conf/submit/loader_image_i4', $this->__('Loader Splash Screen <br />(iPhone 4 retina)'),
279
+ $this->__('Image that appears on first screen while your app is loading. Required size: 640px x 920px.'), '', false);
280
+
281
+ $this->addImage($fieldset, 'conf/submit/logo', $this->__('Custom App Icon'),
282
+ $this->__('Icon that will appear on the user’s phone after they download your app. You do not need to apply a gradient or soft edges (this is done automatically by Apple). Recommended size: 57px x 57px at 72 dpi.'), '', true);
283
+
284
+ $this->addImage($fieldset, 'conf/submit/logo_i4', $this->__('Custom App Icon <br />(iPhone 4 retina)'),
285
+ $this->__('Icon that will appear on the user\'s phone after they download your app. You do not need to apply a gradient or soft edges (this is done automatically by Apple). Recommended size: 114px x 114px.'), '', false);
286
+
287
+ $this->addImage($fieldset, 'conf/submit/big_logo', $this->__('Copyright Page Logo'),
288
+ $this->__('Store logo that is displayed on copyright page of app. Preferred size: 100px x 100px.'), '', true);
289
+
290
+ $this->addImage($fieldset, 'conf/submit/big_logo_i4', $this->__('Copyright Page Logo <br />(iPhone 4 retina)'),
291
+ $this->__('Store logo that is displayed on copyright page of app. Preferred size: 200px x 200px.'), '', false);
292
+ break;
293
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD:
294
+ $this->addImage($fieldset, 'conf/submit/icon', $this->__('Large iTunes Icon'),
295
+ $this->__('Large icon that appears in the iTunes App Store. You do not need to apply a gradient or soft edges (this is done automatically by Apple). Required size: 512px x 512px.'), '', true);
296
+
297
+ $this->addImage($fieldset, 'conf/submit/ipad_loader_portrait_image', $this->__('Loader Splash Screen <br />(portrait mode)'),
298
+ $this->__('Image that appears on first screen while your app is loading. Required size: 768px x 1024px.'), '', true);
299
+
300
+ $this->addImage($fieldset, 'conf/submit/ipad_loader_landscape_image', $this->__('Loader Splash Screen <br />(landscape mode)'),
301
+ $this->__('Image that appears on first screen while your app is loading. Required size: 1024px x 768px.'), '', true);
302
+
303
+ $this->addImage($fieldset, 'conf/submit/ipad_logo', $this->__('Custom App Icon'),
304
+ $this->__('Icon that will appear on the user\'s device after they download your app. You do not need to apply a gradient or soft edges (this is done automatically by Apple). Recommended size: 72px x 72px.'), '', true);
305
+
306
+ $this->addImage($fieldset, 'conf/submit/big_logo', $this->__('Copyright Page Logo'),
307
+ $this->__('Store logo that is displayed on copyright page of app. Preferred size: 100px x 100px.'), '', true);
308
+ break;
309
+ case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID:
310
+ $this->addImage($fieldset, 'conf/submit/icon', $this->__('High Resolution Application Icon'),
311
+ $this->__('The icon that appears in the Android Market. Recommended size: 512px x 512px. Maximum size: 1024 KB.'), '', true);
312
+
313
+ $this->addImage($fieldset, 'conf/submit/android_loader_image', $this->__('Loader Splash Screen'),
314
+ $this->__('Image that appears on first screen while your app is loading. Required size: 320px x 455px.'), '', true);
315
+
316
+ $this->addImage($fieldset, 'conf/submit/android_logo', $this->__('Custom App Icon'),
317
+ $this->__('Icon that will appear on the user\'s device after they download your app. Recommended size: 48px x 48px.'), '', true);
318
+
319
+ $this->addImage($fieldset, 'conf/submit/big_logo', $this->__('Copyright Page Logo'),
320
+ $this->__('Store logo that is displayed on copyright page of app. Preferred size: 100px x 100px.'), '', true);
321
+ break;
322
+ }
323
+
324
+ return parent::_prepareForm();
325
+ }
326
+
327
+ /**
328
+ * Prepare label for tab
329
+ *
330
+ * @return string
331
+ */
332
+ public function getTabLabel()
333
+ {
334
+ return $this->__('Submission');
335
+ }
336
+
337
+ /**
338
+ * Prepare title for tab
339
+ *
340
+ * @return string
341
+ */
342
+ public function getTabTitle()
343
+ {
344
+ return $this->__('Submission');
345
+ }
346
+
347
+ /**
348
+ * Returns status flag about this tab can be shown or not
349
+ *
350
+ * @return true
351
+ */
352
+ public function canShowTab()
353
+ {
354
+ return true;
355
+ }
356
+
357
+ /**
358
+ * Returns status flag about this tab hidden or not
359
+ *
360
+ * @return false
361
+ */
362
+ public function isHidden()
363
+ {
364
+ return false;
365
+ }
366
+
367
+ /**
368
+ * Configure image element type
369
+ *
370
+ * @return array
371
+ */
372
+ protected function _getAdditionalElementTypes()
373
+ {
374
+ return array(
375
+ 'image' => Mage::getConfig()->getBlockClassName('xmlconnect/adminhtml_mobile_helper_image'),
376
+ );
377
+ }
378
+
379
+ /**
380
+ * Prepare html output
381
+ * Adding preview for images if application was submitted(so we have saved images)
382
+ *
383
+ * @return string
384
+ */
385
+ protected function _toHtml()
386
+ {
387
+ return parent::_toHtml() . $this->getChildHtml('images');
388
+ }
389
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tabs.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Device submission tabs block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Tabs
35
+ extends Mage_Adminhtml_Block_Widget_Tabs
36
+ {
37
+ /**
38
+ * Constructor
39
+ * Setting view parameters, destination element DomId and title
40
+ */
41
+ public function __construct()
42
+ {
43
+ parent::__construct();
44
+
45
+ $this->setId('mobile_app_tabs');
46
+ $this->setDestElementId('edit_form');
47
+ $this->setTitle($this->__('Manage Mobile App'));
48
+ }
49
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Widget/Form.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Xmlconnect widget form block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form extends Mage_Adminhtml_Block_Widget_Form
35
+ {
36
+ /**
37
+ * Add color chooser to fieldset
38
+ *
39
+ * @param Varien_Data_Form_Element_Fieldset $fieldset
40
+ * @param string $fieldName
41
+ * @param string $title
42
+ */
43
+ protected function addColor($fieldset, $fieldName, $title)
44
+ {
45
+ $fieldset->addField($fieldName, 'color', array(
46
+ 'name' => $fieldName,
47
+ 'label' => $title,
48
+ ));
49
+ }
50
+
51
+ /**
52
+ * Add image uploader to fieldset
53
+ *
54
+ * @param Varien_Data_Form_Element_Fieldset $fieldset
55
+ * @param string $fieldName
56
+ * @param string $title
57
+ * @param string|null $note
58
+ * @param string $default
59
+ * @param boolean $required
60
+ */
61
+ public function addImage($fieldset, $fieldName, $title, $note = null, $default = '', $required = false)
62
+ {
63
+ $fieldset->addField($fieldName, 'image', array(
64
+ 'name' => $fieldName,
65
+ 'label' => $title,
66
+ 'note' => $note,
67
+ 'default_value' => $default,
68
+ 'required' => $required,
69
+ ));
70
+ }
71
+
72
+ /**
73
+ * Add font selector to fieldset
74
+ *
75
+ * @param Varien_Data_Form_Element_Fieldset $fieldset
76
+ * @param string $fieldPrefix
77
+ * @param string $title
78
+ */
79
+ public function addFont($fieldset, $fieldPrefix, $title)
80
+ {
81
+ $element = $fieldset->addField($fieldPrefix, 'font', array(
82
+ 'name' => $fieldPrefix,
83
+ 'label' => $title,
84
+ ));
85
+
86
+ $element->initFields(array(
87
+ 'name' => $fieldPrefix,
88
+ 'fontNames' => Mage::helper('xmlconnect')->getDeviceHelper()->getFontList(),
89
+ 'fontSizes' => Mage::helper('xmlconnect')->getDeviceHelper()->getFontSizes(),
90
+ ));
91
+ }
92
+
93
+ /**
94
+ * Configure image element type
95
+ *
96
+ * @return array
97
+ */
98
+ protected function _getAdditionalElementTypes()
99
+ {
100
+ $config = Mage::getConfig();
101
+ return array(
102
+ 'image' => $config->getBlockClassName('xmlconnect/adminhtml_mobile_form_element_image'),
103
+ 'font' => $config->getBlockClassName('xmlconnect/adminhtml_mobile_form_element_font'),
104
+ 'color' => $config->getBlockClassName('xmlconnect/adminhtml_mobile_form_element_color'),
105
+ 'tabs' => $config->getBlockClassName('xmlconnect/adminhtml_mobile_form_element_tabs'),
106
+ 'theme' => $config->getBlockClassName('xmlconnect/adminhtml_mobile_form_element_theme'),
107
+ 'page' => $config->getBlockClassName('xmlconnect/adminhtml_mobile_form_element_page'),
108
+ 'addrow'=> $config->getBlockClassName('xmlconnect/adminhtml_mobile_form_element_addrow'),
109
+ 'datetime' => $config->getBlockClassName('xmlconnect/adminhtml_mobile_form_element_datetime'),
110
+ );
111
+ }
112
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect AirMail message queue grid
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Queue extends Mage_Adminhtml_Block_Widget_Grid_Container
35
+ {
36
+ /**
37
+ * Class constructor
38
+ */
39
+ public function __construct()
40
+ {
41
+ $this->_blockGroup = 'xmlconnect';
42
+ $this->_controller = 'adminhtml_queue';
43
+ $this->_headerText = $this->__('AirMail Messages Queue');
44
+
45
+ parent::__construct();
46
+ $this->removeButton('add');
47
+ }
48
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Edit.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Xmlconnect queue edit block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Queue_Edit
35
+ extends Mage_Adminhtml_Block_Widget_Form_Container
36
+ {
37
+ /**
38
+ * Constructor
39
+ */
40
+ public function __construct()
41
+ {
42
+ $this->_objectId = 'id';
43
+ $this->_controller = 'adminhtml_queue';
44
+ $this->_blockGroup = 'xmlconnect';
45
+ parent::__construct();
46
+
47
+ $message = Mage::registry('current_message');
48
+ if ($message && $message->getStatus() != Mage_XmlConnect_Model_Queue::STATUS_IN_QUEUE) {
49
+ $this->_removeButton('reset');
50
+ $this->_removeButton('save');
51
+ } else {
52
+ $this->_updateButton('save', 'label', $this->__('Queue Message'));
53
+ $this->_updateButton('save', 'onclick', 'if (editForm.submit()) {disableElements(\'save\')}');
54
+ }
55
+ $this->_removeButton('delete');
56
+
57
+ $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getBackUrl() . '\')');
58
+ }
59
+
60
+ /**
61
+ * Get URL for back (reset) button
62
+ *
63
+ * @return string
64
+ */
65
+ public function getBackUrl()
66
+ {
67
+ $template = Mage::registry('current_template');
68
+ $message = Mage::registry('current_message');
69
+ return $message && !$message->getId() && $template && $template->getId()
70
+ ? $this->getUrl('*/*/template')
71
+ : $this->getUrl('*/*/queue');
72
+ }
73
+
74
+ /**
75
+ * Get header text
76
+ *
77
+ * @return string
78
+ */
79
+ public function getHeaderText()
80
+ {
81
+ $message = Mage::registry('current_message');
82
+ if ($message && $message->getId()) {
83
+ return $this->__('Edit AirMail Message Queue #%s', $this->htmlEscape($message->getId()));
84
+ } else {
85
+ return $this->__('New AirMail Message Queue');
86
+ }
87
+ }
88
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Edit/Form.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Xmlconnect queue edit form block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Queue_Edit_Form
35
+ extends Mage_XmlConnect_Block_Adminhtml_Template_Edit_Form
36
+ {
37
+ /**
38
+ * Prepare form before rendering HTML
39
+ * Setting Form Fieldsets and fields
40
+ *
41
+ * @return Mage_Adminhtml_Block_Widget_Form
42
+ */
43
+ protected function _prepareForm()
44
+ {
45
+ $model = Mage::registry('current_message');
46
+
47
+ if ($model->getStatus() == Mage_XmlConnect_Model_Queue::STATUS_IN_QUEUE) {
48
+ $this->_fieldsEnabled = true;
49
+ } else {
50
+ $this->_fieldsEnabled = false;
51
+ }
52
+
53
+ parent::_prepareForm();
54
+
55
+ if (null !== Mage::registry('current_template')) {
56
+ $templateModel = Mage::registry('current_template');
57
+ } else {
58
+ $templateModel = Mage::getModel('xmlconnect/template')->load($model->getTemplateId());
59
+ }
60
+
61
+ $fieldset = $this->getForm()->addFieldset(
62
+ "message_settings",
63
+ array('legend' => $this->__('Message Settings')),
64
+ '^'
65
+ );
66
+
67
+ if ($model->getId()) {
68
+ $fieldset->addField('message_id', 'hidden', array(
69
+ 'name' => 'message_id'
70
+ ));
71
+ }
72
+
73
+ // set exec_time for showing accordingly to locale datetime settings
74
+ $model->setExecTime(Mage::getSingleton('core/date')->date(null, $model->getExecTime()));
75
+
76
+ /** @var $sovereignField Varien_Data_Form_Element_Abstract */
77
+ $sovereignField = $fieldset->addField('type', 'select', array(
78
+ 'name' => 'type',
79
+ 'values' => Mage::helper('xmlconnect')->getMessageTypeOptions(),
80
+ 'label' => $this->__('Message Type'),
81
+ 'title' => $this->__('Message Type'),
82
+ 'disabled' => !$this->_fieldsEnabled,
83
+ 'required' => true,
84
+ ));
85
+
86
+ $fieldset->addField('exec_time', 'date', array(
87
+ 'name' => 'exec_time',
88
+ 'format' => Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
89
+ 'label' => $this->__('Start Date'),
90
+ 'time' => true,
91
+ 'title' => $this->__('Start Date'),
92
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
93
+ 'note' => $this->__('If leave this field empty, the message will be sent immediately'),
94
+ 'disabled' => !$this->_fieldsEnabled,
95
+ 'required' => false,
96
+ ));
97
+
98
+ $this->_addElementTypes($fieldset);
99
+
100
+ // field dependencies
101
+ if (isset($this->_dependentFields['message_title']) || isset($this->_dependentFields['content'])) {
102
+ $dependenceBlock = $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence');
103
+
104
+ $dependenceBlock->addFieldMap(
105
+ $this->_dependentFields['message_title']->getHtmlId(),
106
+ $this->_dependentFields['message_title']->getName()
107
+ )
108
+ ->addFieldMap(
109
+ $this->_dependentFields['content']->getHtmlId(),
110
+ $this->_dependentFields['content']->getName()
111
+ )
112
+ ->addFieldMap(
113
+ $sovereignField->getHtmlId(),
114
+ $sovereignField->getName()
115
+ );
116
+
117
+ if (!empty($this->_dependentFields['message_title'])) {
118
+ $dependenceBlock->addFieldDependence(
119
+ $this->_dependentFields['message_title']->getName(),
120
+ $sovereignField->getName(),
121
+ Mage_XmlConnect_Model_Queue::MESSAGE_TYPE_AIRMAIL
122
+ );
123
+
124
+ if (!$this->_fieldsEnabled) {
125
+ $this->_dependentFields['message_title']->setReadonly(true, true);
126
+ }
127
+ }
128
+
129
+ if (!empty($this->_dependentFields['content'])) {
130
+ $dependenceBlock->addFieldDependence(
131
+ $this->_dependentFields['content']->getName(),
132
+ $sovereignField->getName(),
133
+ Mage_XmlConnect_Model_Queue::MESSAGE_TYPE_AIRMAIL
134
+ );
135
+
136
+ if (!$this->_fieldsEnabled) {
137
+ $this->_dependentFields['content']->setReadonly(true, true);
138
+ }
139
+ }
140
+ $this->setChild('form_after', $dependenceBlock);
141
+ }
142
+
143
+ if (!$model->getName()) {
144
+ $model->setName($templateModel->getName());
145
+ }
146
+ if (!$model->getPushTitle()) {
147
+ $model->setPushTitle($templateModel->getPushTitle());
148
+ }
149
+ if (!$model->getMessageTitle()) {
150
+ $model->setMessageTitle($templateModel->getMessageTitle());
151
+ }
152
+ if (!$model->getContent()) {
153
+ $model->setContent($templateModel->getContent());
154
+ }
155
+ if (!$model->getTemplateId()) {
156
+ $model->setTemplateId($templateModel->getId());
157
+ }
158
+ $model->setMessageId($model->getId());
159
+ $model->setData('app_code', $templateModel->getData('app_code'));
160
+
161
+ $this->getForm()->setAction($this->getUrl('*/*/saveMessage'));
162
+ $this->getForm()->setValues($model->getData());
163
+
164
+ $this->setForm($this->getForm());
165
+ }
166
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid.php ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect AirMail message queue grid
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid extends Mage_Adminhtml_Block_Widget_Grid
35
+ {
36
+
37
+ /**
38
+ * Setting grid_id, sort order and sort direction
39
+ */
40
+ public function __construct()
41
+ {
42
+ parent::__construct();
43
+ $this->setId('app_queue_grid');
44
+ $this->setDefaultSort('exec_time');
45
+ $this->setDefaultDir('DESC');
46
+ $this->setSaveParametersInSession(true);
47
+ }
48
+
49
+ /**
50
+ * Setting collection to show
51
+ *
52
+ * @return Mage_Adminhtml_Block_Widget_Grid
53
+ */
54
+ protected function _prepareCollection()
55
+ {
56
+ $collection = Mage::getModel('xmlconnect/queue')->getCollection();
57
+
58
+ $collection->addFieldToFilter(
59
+ 'main_table.status',
60
+ array('neq' => Mage_XmlConnect_Model_Queue::STATUS_DELETED)
61
+ );
62
+ $this->setCollection($collection);
63
+ return parent::_prepareCollection();
64
+ }
65
+
66
+ /**
67
+ * Configuration of grid
68
+ *
69
+ * @return Mage_Adminhtml_Block_Widget_Grid
70
+ */
71
+ protected function _prepareColumns()
72
+ {
73
+ $this->addColumn('id', array(
74
+ 'header' => $this->__('ID'),
75
+ 'align' => 'center',
76
+ 'index' => 'main_table.id',
77
+ 'width' => '40px',
78
+ 'renderer' => 'xmlconnect/adminhtml_queue_grid_renderer_id'
79
+ ));
80
+
81
+ $this->addColumn('exec_time', array(
82
+ 'header' => $this->__('Queue Date'),
83
+ 'index' => 'exec_time',
84
+ 'type' => 'datetime',
85
+ 'gmtoffset' => false,
86
+ 'default' => ' ---- '
87
+ ));
88
+
89
+ $this->addColumn('app_code', array(
90
+ 'header' => $this->__('Application Name'),
91
+ 'align' => 'left',
92
+ 'index' => 'main_table.app_code',
93
+ 'type' => 'options',
94
+ 'options' => Mage::helper('xmlconnect')->getApplications(),
95
+ 'renderer' => 'xmlconnect/adminhtml_queue_grid_renderer_application'
96
+ ));
97
+
98
+ $this->addColumn('name', array(
99
+ 'header' => $this->__('Template Name'),
100
+ 'align' => 'left',
101
+ 'index' => 't.name',
102
+ 'type' => 'text',
103
+ 'default' => '--- Parent template has been deleted ---',
104
+ 'renderer' => 'xmlconnect/adminhtml_queue_grid_renderer_template'
105
+ ));
106
+
107
+ $this->addColumn('push_title', array(
108
+ 'header' => $this->__('Push Title'),
109
+ 'align' => 'left',
110
+ 'index' => 'main_table.push_title',
111
+ 'type' => 'text',
112
+ 'renderer' => 'xmlconnect/adminhtml_queue_grid_renderer_pushtitle'
113
+ ));
114
+
115
+ $this->addColumn('message_title', array(
116
+ 'header' => $this->__('Message Title'),
117
+ 'align' => 'left',
118
+ 'index' => 'main_table.message_title',
119
+ 'type' => 'text',
120
+ 'renderer' => 'xmlconnect/adminhtml_queue_grid_renderer_msgtitle'
121
+ ));
122
+
123
+ $this->addColumn('status', array(
124
+ 'header' => $this->__('Status'),
125
+ 'align' => 'left',
126
+ 'index' => 'main_table.status',
127
+ 'type' => 'options',
128
+ 'width' => '50px',
129
+ 'options' => array(
130
+ Mage_XmlConnect_Model_Queue::STATUS_CANCELED => $this->__('Canceled'),
131
+ Mage_XmlConnect_Model_Queue::STATUS_IN_QUEUE => $this->__('In Queue'),
132
+ Mage_XmlConnect_Model_Queue::STATUS_COMPLETED => $this->__('Completed'),
133
+ ),
134
+ 'renderer' => 'xmlconnect/adminhtml_queue_grid_renderer_status',
135
+ ));
136
+
137
+ $this->addColumn('action', array(
138
+ 'header' => $this->__('Action'),
139
+ 'type' => 'action',
140
+ 'getter' => 'getId',
141
+ 'renderer' => 'xmlconnect/adminhtml_queue_grid_renderer_action',
142
+
143
+ 'filter' => false,
144
+ 'sortable' => false,
145
+ ));
146
+
147
+ return parent::_prepareColumns();
148
+ }
149
+
150
+ /**
151
+ * Prepare mass actions
152
+ *
153
+ * @return Mage_XmlConnect_Block_Adminhtml_Queue_Grid
154
+ */
155
+ protected function _prepareMassaction()
156
+ {
157
+ $this->setMassactionIdField('id');
158
+ $this->getMassactionBlock()->setFormFieldName('queue');
159
+
160
+ $this->getMassactionBlock()->addItem('delete', array(
161
+ 'label' => $this->__('Delete'),
162
+ 'url' => $this->getUrl('*/*/massDeleteQueue'),
163
+ 'confirm' => $this->__('Are you sure you what to delete selected records?')
164
+ ));
165
+
166
+ $this->getMassactionBlock()->addItem('cancel', array(
167
+ 'label' => $this->__('Cancel'),
168
+ 'url' => $this->getUrl('*/*/massCancelQueue'),
169
+ 'confirm' => $this->__('Are you sure you what to cancel selected records?')
170
+ ));
171
+ return $this;
172
+ }
173
+
174
+ /**
175
+ * Configure row click url
176
+ *
177
+ * @param Mage_Catalog_Model_Queue|Varien_Object $row
178
+ * @return string
179
+ */
180
+ public function getRowUrl($row)
181
+ {
182
+ return $this->getUrl('*/*/editQueue', array('id' => $row->getId()));
183
+ }
184
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Action.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml airmail queue grid block action item renderer
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid_Renderer_Action
35
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
36
+ {
37
+ /**
38
+ * Render grid row
39
+ *
40
+ * @param Varien_Object $row
41
+ * @return string
42
+ */
43
+ public function render(Varien_Object $row)
44
+ {
45
+ $actions = array(
46
+ array(
47
+ 'caption' => $this->__('Preview'),
48
+ 'url' => $this->getUrl('*/*/previewQueue', array('id' => $row->getId())),
49
+ 'popup' => true,
50
+ ),
51
+ );
52
+
53
+ if ($row->getStatus() == Mage_XmlConnect_Model_Queue::STATUS_IN_QUEUE) {
54
+ $actions[] = array(
55
+ 'caption' => $this->__('Edit'),
56
+ 'url' => $this->getUrl('*/*/editQueue', array('id' => $row->getId())),
57
+ );
58
+ $actions[] = array(
59
+ 'caption' => $this->__('Cancel'),
60
+ 'url' => $this->getUrl('*/*/cancelQueue', array('id' => $row->getId())),
61
+ 'confirm' => $this->__('Are you sure you whant to cancel a message?')
62
+ );
63
+ }
64
+
65
+ $actions[] = array(
66
+ 'caption' => $this->__('Delete'),
67
+ 'url' => $this->getUrl('*/*/deleteQueue', array('id' => $row->getId())),
68
+ 'confirm' => $this->__('Are you sure you whant to delete a message?')
69
+ );
70
+
71
+ $this->getColumn()->setActions($actions);
72
+ return parent::render($row);
73
+ }
74
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Application.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml airmail queue grid block action item renderer
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid_Renderer_Application
35
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
36
+ {
37
+ /**
38
+ * Render grid row
39
+ *
40
+ * @param Varien_Object $row
41
+ * @return string
42
+ */
43
+ public function render(Varien_Object $row)
44
+ {
45
+ $str = $this->htmlEscape($row->getAppName());
46
+ if ($str == '') {
47
+ $str = ' --- ';
48
+ }
49
+ return $str;
50
+ }
51
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Id.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml airmail queue grid block action item renderer
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid_Renderer_Id
35
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
36
+ {
37
+ /**
38
+ * Render grid row
39
+ *
40
+ * @param Varien_Object $row
41
+ * @return string
42
+ */
43
+ public function render(Varien_Object $row)
44
+ {
45
+ return $row->getId();
46
+ }
47
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Msgtitle.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml airmail queue grid block action item renderer
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid_Renderer_Msgtitle
35
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
36
+ {
37
+ /**
38
+ * Render grid row
39
+ *
40
+ * @param Varien_Object $row
41
+ * @return string
42
+ */
43
+ public function render(Varien_Object $row)
44
+ {
45
+ $msgTitle = $row->getMessageTitle();
46
+ if (strlen($msgTitle) > 50) {
47
+ $msgTitle = substr($msgTitle, 0, 50) . '...';
48
+ }
49
+ return $this->htmlEscape($msgTitle);
50
+ }
51
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Pushtitle.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml airmail queue grid block action item renderer
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid_Renderer_Pushtitle
35
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
36
+ {
37
+ /**
38
+ * Render grid row
39
+ *
40
+ * @param Varien_Object $row
41
+ * @return string
42
+ */
43
+ public function render(Varien_Object $row)
44
+ {
45
+ return $this->htmlEscape($row->getPushTitle());
46
+ }
47
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Status.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml airmail queue grid block action item renderer
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid_Renderer_Status
35
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
36
+ {
37
+ /**
38
+ * Render grid row
39
+ *
40
+ * @param Varien_Object $row
41
+ * @return string
42
+ */
43
+ public function render(Varien_Object $row)
44
+ {
45
+ $str = '';
46
+ if (is_numeric($row->getStatus())) {
47
+ switch ($row->getStatus()) {
48
+ case Mage_XmlConnect_Model_Queue::STATUS_IN_QUEUE:
49
+ $str = $this->__('In Queue');
50
+ break;
51
+ case Mage_XmlConnect_Model_Queue::STATUS_CANCELED:
52
+ $str = $this->__('Cancelled');
53
+ break;
54
+ case Mage_XmlConnect_Model_Queue::STATUS_COMPLETED:
55
+ $str = $this->__('Completed');
56
+ break;
57
+ case Mage_XmlConnect_Model_Queue::STATUS_DELETED:
58
+ $str = $this->__('Deleted');
59
+ break;
60
+ }
61
+ }
62
+
63
+ if ($str === '') {
64
+ $str = $this->__('Undefined');
65
+ }
66
+
67
+ return $this->htmlEscape($str);
68
+ }
69
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Template.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml airmail queue grid block action item renderer
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid_Renderer_Template
35
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
36
+ {
37
+ /**
38
+ * Render grid row
39
+ *
40
+ * @param Varien_Object $row
41
+ * @return string
42
+ */
43
+ public function render(Varien_Object $row)
44
+ {
45
+ $str = $this->htmlEscape($row->getTplName());
46
+ if ($str == '') {
47
+ $str .= '---';
48
+ }
49
+ return $str;
50
+ }
51
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect AirMail message template grid
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Template extends Mage_Adminhtml_Block_Widget_Grid_Container
35
+ {
36
+ /**
37
+ * Class constructor
38
+ */
39
+ public function __construct()
40
+ {
41
+ $this->_blockGroup = 'xmlconnect';
42
+ $this->_controller = 'adminhtml_template';
43
+ $this->_headerText = $this->__('AirMail templates');
44
+
45
+ parent::__construct();
46
+ $this->removeButton('add');
47
+ }
48
+
49
+ /**
50
+ * Prepare layout
51
+ * Add new button
52
+ *
53
+ * @return Mage_Adminhtml_Block_Widget_Grid_Container
54
+ */
55
+ protected function _prepareLayout()
56
+ {
57
+ $this->_addButton('add_new', array(
58
+ 'label' => $this->__('Add New Template'),
59
+ 'onclick' => "setLocation('{$this->getUrl('*/*/newTemplate')}')",
60
+ 'class' => 'add'
61
+ ));
62
+
63
+ return parent::_prepareLayout();
64
+ }
65
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Xmlconnect template edit block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Template_Edit
35
+ extends Mage_Adminhtml_Block_Widget_Form_Container
36
+ {
37
+ /**
38
+ * Constructor
39
+ */
40
+ public function __construct()
41
+ {
42
+ $this->_objectId = 'id';
43
+ $this->_controller = 'adminhtml_template';
44
+ $this->_blockGroup = 'xmlconnect';
45
+ parent::__construct();
46
+
47
+ $this->_updateButton(
48
+ 'delete',
49
+ 'onclick',
50
+ 'deleteConfirm(\''
51
+ . $this->__('Warning: All related AirMail messages will be deleted!')
52
+ . PHP_EOL
53
+ . $this->__('Are you sure you want to do this?')
54
+ .'\', \''
55
+ . $this->getDeleteUrl()
56
+ . '\')'
57
+ );
58
+ $this->_updateButton('save', 'label', $this->__('Save'));
59
+ $this->_updateButton('save', 'onclick', 'if (editForm.submit()) {disableElements(\'save\')}');
60
+ $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getUrl('*/*/template') . '\')');
61
+ }
62
+
63
+ /**
64
+ * Return delete url for customer group
65
+ *
66
+ * @return string
67
+ */
68
+ public function getDeleteUrl()
69
+ {
70
+ return $this->getUrl('*/*/deletetemplate', array($this->_objectId => $this->getRequest()->getParam($this->_objectId)));
71
+ }
72
+
73
+ /**
74
+ * Get text for header
75
+ *
76
+ * @return string
77
+ */
78
+ public function getHeaderText()
79
+ {
80
+ $template = Mage::registry('current_template');
81
+ if ($template && $template->getId()) {
82
+ return $this->__('Edit Template "%s"', $this->htmlEscape($template->getName()));
83
+ } else {
84
+ return $this->__('New Template');
85
+ }
86
+ }
87
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit/Form.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Xmlconnect template edit form block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Template_Edit_Form
35
+ extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
36
+ {
37
+ /**
38
+ * Enabled fields flag
39
+ *
40
+ * @var bool
41
+ */
42
+ protected $_fieldsEnabled = true;
43
+
44
+ /**
45
+ * Field dependencies
46
+ *
47
+ * @var array
48
+ */
49
+ protected $_dependentFields = array();
50
+
51
+ /**
52
+ * Load Wysiwyg on demand and Prepare layout
53
+ */
54
+ protected function _prepareLayout()
55
+ {
56
+ parent::_prepareLayout();
57
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
58
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Prepare form
64
+ *
65
+ * @return Mage_Adminhtml_Block_Widget_Form
66
+ */
67
+ protected function _prepareForm()
68
+ {
69
+ $model = Mage::registry('current_template');
70
+
71
+ if (!$model) {
72
+ $model = new Varien_Object();
73
+ }
74
+
75
+ $action = $this->getUrl('*/*/saveTemplate');
76
+
77
+ $form = new Varien_Data_Form(array(
78
+ 'id' => 'edit_form',
79
+ 'action' => $action,
80
+ 'method' => 'post',
81
+ 'enctype' => 'multipart/form-data'
82
+ ));
83
+ $form->setHtmlIdPrefix('template_');
84
+
85
+ $fieldset = $form->addFieldset('edit_template', array('legend' => $this->__('Template')));
86
+ $this->_addElementTypes($fieldset);
87
+
88
+ if ($model->getId()) {
89
+ $fieldset->addField('id', 'hidden', array(
90
+ 'name' => 'id',
91
+ ));
92
+ $fieldset->addField('template_id', 'hidden', array(
93
+ 'name' => 'template_id',
94
+ ));
95
+ }
96
+
97
+ $fieldset->addField('app_code', 'select', array(
98
+ 'name' => 'app_code',
99
+ 'label' => $this->__('Application'),
100
+ 'title' => $this->__('Application'),
101
+ 'disabled' => $model->getId() || !$this->_fieldsEnabled ? true : false,
102
+ 'values' => Mage::helper('xmlconnect')->getApplicationOptions(),
103
+ 'note' => $this->__('Creating a Template is allowed only for applications which have device type iPhone.'),
104
+ 'required' => true,
105
+ ));
106
+
107
+ $fieldset->addField('name', 'text', array(
108
+ 'name' => 'name',
109
+ 'label' => $this->__('Template Name'),
110
+ 'title' => $this->__('Template Name'),
111
+ 'required' => true,
112
+ 'disabled' => $model->getId() || !$this->_fieldsEnabled ? true : false,
113
+ 'note' => $this->__('Maximum length is 255'),
114
+ 'maxlength' => 255
115
+ ));
116
+
117
+ $fieldset->addField('push_title', 'text', array(
118
+ 'name' => 'push_title',
119
+ 'label' => $this->__('Push Title'),
120
+ 'title' => $this->__('Push Title'),
121
+ 'required' => true,
122
+ 'disabled' => !$this->_fieldsEnabled ? true : false,
123
+ 'note' => $this->__('Maximum length is 140'),
124
+ 'maxlength' => 140
125
+ ));
126
+
127
+ $this->_dependentFields['message_title'] = $fieldset->addField('message_title', 'text', array(
128
+ 'name' => 'message_title',
129
+ 'label' => $this->__('Message Title'),
130
+ 'title' => $this->__('Message Title'),
131
+ 'required' => true,
132
+ 'disabled' => !$this->_fieldsEnabled ? true : false,
133
+ 'note' => $this->__('Maximum length is 255'),
134
+ 'maxlength' => 255
135
+ ));
136
+
137
+ $widgetFilters = array('is_email_compatible' => 1);
138
+ $wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array(
139
+ // 'add_widgets' => true,
140
+ // 'add_variables' => true,
141
+ 'widget_filters' => $widgetFilters
142
+ ));
143
+
144
+ $this->_dependentFields['content'] = $fieldset->addField('content', 'editor', array(
145
+ 'label' => $this->__('Template Content'),
146
+ 'title' => $this->__('Template Content'),
147
+ 'name' => 'content',
148
+ 'style' => 'height:30em;',
149
+ 'state' => 'html',
150
+ 'required' => true,
151
+ 'disabled' => !$this->_fieldsEnabled ? true : false,
152
+ 'config' => $wysiwygConfig
153
+ ));
154
+
155
+ $form->setValues($model->getData());
156
+ $form->setUseContainer(true);
157
+ $this->setForm($form);
158
+ return parent::_prepareForm();
159
+ }
160
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid.php ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect AirMail message queue grid
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Template_Grid extends Mage_Adminhtml_Block_Widget_Grid
35
+ {
36
+ /**
37
+ * Setting grid_id, sort order and sort direction
38
+ */
39
+ public function __construct()
40
+ {
41
+ parent::__construct();
42
+ $this->setId('app_template_grid');
43
+ $this->setDefaultSort('created_at');
44
+ $this->setDefaultDir('ASC');
45
+ $this->setSaveParametersInSession(true);
46
+ }
47
+
48
+ /**
49
+ * Setting collection to show
50
+ *
51
+ * @return Mage_Adminhtml_Block_Widget_Grid
52
+ */
53
+ protected function _prepareCollection()
54
+ {
55
+ $collection = Mage::getModel('xmlconnect/template')->getCollection();
56
+ $this->setCollection($collection);
57
+ return parent::_prepareCollection();
58
+ }
59
+
60
+ /**
61
+ * Configuration of grid
62
+ *
63
+ * @return Mage_Adminhtml_Block_Widget_Grid
64
+ */
65
+ protected function _prepareColumns()
66
+ {
67
+ $this->addColumn('id', array(
68
+ 'header' => $this->__('ID'),
69
+ 'align' => 'center',
70
+ 'index' => 'id',
71
+ 'width' => '40px'
72
+ ));
73
+
74
+ $this->addColumn('name', array(
75
+ 'header' => $this->__('Template Name'),
76
+ 'align' => 'left',
77
+ 'index' => 'name',
78
+ 'escape' => true
79
+ ));
80
+
81
+ $this->addColumn('created_at', array(
82
+ 'header' => $this->__('Date Created'),
83
+ 'align' => 'left',
84
+ 'index' => 'created_at',
85
+ 'type' => 'datetime'
86
+ ));
87
+
88
+ $this->addColumn('modified_at', array(
89
+ 'header' => $this->__('Date Updated'),
90
+ 'align' => 'left',
91
+ 'index' => 'modified_at',
92
+ 'type' => 'datetime'
93
+ ));
94
+
95
+ $this->addColumn('app_code', array(
96
+ 'header' => $this->__('Application'),
97
+ 'index' => 'app_code',
98
+ 'type' => 'options',
99
+ 'align' => 'left',
100
+ 'options' => Mage::helper('xmlconnect')->getApplications(),
101
+ 'renderer' => 'xmlconnect/adminhtml_template_grid_renderer_application',
102
+ 'escape' => true
103
+ ));
104
+
105
+ $this->addColumn('push_title', array(
106
+ 'header' => $this->__('Push Title'),
107
+ 'type' => 'text',
108
+ 'align' => 'left',
109
+ 'index' => 'push_title',
110
+ 'escape' => true
111
+ ));
112
+
113
+ $this->addColumn('message_title', array(
114
+ 'header' => $this->__('Message Title'),
115
+ 'type' => 'text',
116
+ 'align' => 'left',
117
+ 'index' => 'message_title',
118
+ 'escape' => true
119
+ ));
120
+
121
+ $this->addColumn('action', array(
122
+ 'header' => $this->__('Action'),
123
+ 'type' => 'action',
124
+ 'getter' => 'getId',
125
+ 'actions' => array(
126
+ array(
127
+ 'caption' => $this->__('Preview'),
128
+ 'url' => array(
129
+ 'base' => '*/*/previewTemplate'
130
+ ),
131
+ 'popup' => true,
132
+ 'field' => 'id'
133
+ ),
134
+ array(
135
+ 'caption' => $this->__('Queue Message'),
136
+ 'url' => array(
137
+ 'base' => '*/*/queueMessage',
138
+ ),
139
+ 'field' => 'template_id'
140
+ ),
141
+ ),
142
+ 'filter' => false,
143
+ 'sortable' => false,
144
+ ));
145
+
146
+ return parent::_prepareColumns();
147
+ }
148
+
149
+ /**
150
+ * Configure row click url
151
+ *
152
+ * @param Mage_Catalog_Model_Template|Varien_Object $row
153
+ * @return string
154
+ */
155
+ public function getRowUrl($row)
156
+ {
157
+ return $this->getUrl('*/*/editTemplate', array('id' => $row->getId()));
158
+ }
159
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid/Renderer/Application.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml airmail queue grid block action item renderer
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Template_Grid_Renderer_Application
35
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
36
+ {
37
+ /**
38
+ * Render grid row
39
+ *
40
+ * @param Varien_Object $row
41
+ * @return string
42
+ */
43
+ public function render(Varien_Object $row)
44
+ {
45
+ $str = $this->htmlEscape($row->getAppName());
46
+ if ($str == '') {
47
+ $str = ' --- ';
48
+ }
49
+ return $str;
50
+ }
51
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Preview.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * XmlConnect Adminhtml AirMail template preview block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Template_Preview extends Mage_Adminhtml_Block_Widget
35
+ {
36
+ /**
37
+ * Retrieve processed template
38
+ *
39
+ * @return string
40
+ */
41
+ protected function _toHtml()
42
+ {
43
+ if ((int)$this->getRequest()->getParam('queue_preview')) {
44
+ $id = $this->getRequest()->getParam('queue_preview');
45
+ /** @var $template Mage_XmlConnect_Model_Queue */
46
+ $template = Mage::getModel('xmlconnect/queue');
47
+ } else {
48
+ $id = (int)$this->getRequest()->getParam('id');
49
+ /** @var $template Mage_XmlConnect_Model_Template */
50
+ $template = Mage::getModel('xmlconnect/template');
51
+ }
52
+
53
+ if ($id) {
54
+ $template->load($id);
55
+ }
56
+
57
+ $storeId = (int)$this->getRequest()->getParam('store_id');
58
+
59
+ if (!$storeId) {
60
+ $storeId = Mage::app()->getDefaultStoreView()->getId();
61
+ }
62
+
63
+ $template->emulateDesign($storeId);
64
+ $templateProcessed = $template->getProcessedTemplate(array(), true);
65
+ $template->revertDesign();
66
+
67
+ return $templateProcessed;
68
+ }
69
+ }
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Preview/Form.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Admin form widget
29
+ *
30
+ * @category Mage
31
+ * @package Mage_XmlConnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Adminhtml_Template_Preview_Form
35
+ extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+ /**
38
+ * Preparing from for revision page
39
+ *
40
+ * @return Mage_XmlConnect_Block_Adminhtml_Template_Preview_Form
41
+ */
42
+ protected function _prepareForm()
43
+ {
44
+ $form = new Varien_Data_Form(array(
45
+ 'id' => 'preview_form',
46
+ 'action' => $this->getUrl('*/*/drop', array('_current' => true)),
47
+ 'method' => 'post'
48
+ ));
49
+
50
+ if ($data = $this->getTemplateFormData()) {
51
+ $mapper = array('preview_store_id' => 'store_id');
52
+
53
+ foreach ($data as $key => $value) {
54
+ if (array_key_exists($key, $mapper)) {
55
+ $name = $mapper[$key];
56
+ } else {
57
+ $name = $key;
58
+ }
59
+ $form->addField($key, 'hidden', array('name' => $name));
60
+ }
61
+ $form->setValues($data);
62
+ }
63
+
64
+ $form->setUseContainer(true);
65
+ $this->setForm($form);
66
+ return parent::_prepareForm();
67
+ }
68
+ }
69
+
app/code/core/Mage/XmlConnect/Block/Cart.php ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_XmlConnect
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Shopping cart xml renderer
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Xmlconnect
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
35
+ {
36
+ /**
37
+ * Render shopping cart xml
38
+ *
39
+ * @return string
40
+ */
41
+ protected function _toHtml()
42
+ {
43
+ $cartMessages = $this->getMessages();
44
+ $quote = $this->getQuote();
45
+ /** @var $xmlObject Mage_XmlConnect_Model_Simplexml_Element */
46
+ $xmlObject = Mage::getModel('xmlconnect/simplexml_element', '<cart></cart>');
47
+ $xmlObject->addAttribute('is_virtual', (int)$this->helper('checkout/cart')->getIsVirtualQuote());
48
+ $xmlObject->addAttribute('summary_qty', (int)$this->helper('checkout/cart')->getSummaryCount());
49
+ if (strlen($quote->getCouponCode())) {
50
+ $xmlObject->addAttribute('has_coupon_code', 1);
51
+ }
52
+ $products = $xmlObject->addChild('products');
53
+ /* @var $item Mage_Sales_Model_Quote_Item */
54
+ foreach ($this->getItems() as $item) {
55
+ $type = $item->getProductType();
56
+ $renderer = $this->getItemRenderer($type)->setItem($item);
57
+ /**
58
+ * General information
59
+ */
60
+ $itemXml = $products->addChild('item');
61
+ $itemXml->addChild('entity_id', $item->getProduct()->getId());
62
+ $itemXml->addChild('entity_type', $type);
63
+ $itemXml->addChild('item_id', $item->getId());
64
+ $itemXml->addChild('name', $xmlObject->escapeXml($renderer->getProductName()));
65
+ $itemXml->addChild('code', 'cart[' . $item->getId() . '][qty]');
66
+ $itemXml->addChild('qty', $renderer->getQty());
67
+ $icon = $renderer->getProductThumbnail()->resize(
68
+ Mage::helper('xmlconnect/image')->getImageSizeForContent('product_small')
69
+ );
70
+ $iconXml = $itemXml->addChild('icon', $icon);
71
+ $file = Mage::helper('xmlconnect')->urlToPath($icon);
72
+ $iconXml->addAttribute('modification_time', filemtime($file));
73
+ /**
74
+ * Price
75
+ */
76
+ $exclPrice = $inclPrice = 0;
77
+ if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
78
+ if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
79
+ && $item->getWeeeTaxAppliedAmount()
80
+ ) {
81
+ $exclPrice = $item->getCalculationPrice() + $item->getWeeeTaxAppliedAmount()
82
+ + $item->getWeeeTaxDisposition();
83
+ } else {
84
+ $exclPrice = $item->getCalculationPrice();
85
+ }
86
+ }
87
+ if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
88
+ $_incl = $this->helper('checkout')->getPriceInclTax($item);
89
+ if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
90
+ && $item->getWeeeTaxAppliedAmount()
91
+ ) {
92
+ $inclPrice = $_incl + $item->getWeeeTaxAppliedAmount();
93
+ } else {
94
+ $inclPrice = $_incl - $item->getWeeeTaxDisposition();
95
+ }
96
+ }
97
+ $exclPrice = Mage::helper('xmlconnect')->formatPriceForXml($exclPrice);
98
+ $paypalPrice = Mage::helper('xmlconnect')->formatPriceForXml($item->getCalculationPrice());
99
+ $formattedExclPrice = $quote->getStore()->formatPrice($exclPrice, false);
100
+ $inclPrice = Mage::helper('xmlconnect')->formatPriceForXml($inclPrice);
101
+ $formattedInclPrice = $quote->getStore()->formatPrice($inclPrice, false);
102
+
103
+ $priceXmlObj = $itemXml->addChild('price');
104
+ $formattedPriceXmlObj = $itemXml->addChild('formated_price');
105
+
106
+ if ($this->helper('tax')->displayCartBothPrices()) {
107
+ $priceXmlObj->addAttribute('excluding_tax', $exclPrice);
108
+ $priceXmlObj->addAttribute('including_tax', $inclPrice);
109
+
110
+ $formattedPriceXmlObj->addAttribute('excluding_tax', $formattedExclPrice);
111
+ $formattedPriceXmlObj->addAttribute('including_tax', $formattedInclPrice);