Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update as of 9/27/2012

* Refactoring Magento 2 to use jQuery instead of Prototype:
  * Implemented simple lazy-loading functionality
  * Converted decorator mechanism to jQuery
  * Moved Installation process to jQuery
  * Moved Home, Category and Simple Product View pages to jQuery
  * Moved all frontend libraries from `pub/js` directory to `pub/lib`
* Improved Javascript unit tests to be consistent with other test frameworks in Magento
* Added Javascript code analysis tests to the static tests suite
* Added jQuery file uploader for admin backend, cleaned out old deprecated uploaders
* Implemented fixture of 100k orders for the performance tests
* Fixes
  * Admin menu elements order differs for a cached page and non-cached one
  * Typos in System > Configuration > General Tab
  * Wrong elements positions on "View Order" page
  * Impossible to configure checkout on store scope
  * Warning message in `system.log` when using GD2 image adapter
  * "Preview" link is absent for managing CMS Pages in single store mode
  * "Promotions" tab is missing on Configuration page
  * Wrong format of performance tests config
  • Loading branch information...
commit 215c077c2187ccc70703823978182f861cedd58a 1 parent da072ba
mage2-team mage2-team authored
Showing with 4,709 additions and 22,392 deletions.
  1. +1 −0  .gitignore
  2. +22 −0 CHANGELOG.markdown
  3. +3 −3 app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php
  4. +0 −151 app/code/core/Mage/Adminhtml/Block/Media/Editor.php
  5. +9 −54 app/code/core/Mage/Adminhtml/Block/Media/Uploader.php
  6. +0 −52 app/code/core/Mage/Adminhtml/controllers/Media/EditorController.php
  7. +0 −56 app/code/core/Mage/Adminhtml/controllers/Media/UploaderController.php
  8. +27 −0 app/code/core/Mage/Adminhtml/view/adminhtml/catalog.xml
  9. +12 −24 app/code/core/Mage/Adminhtml/view/adminhtml/catalog/product.js
  10. +1 −1  app/code/core/Mage/Adminhtml/view/adminhtml/catalog/product/helper/gallery.phtml
  11. +22 −0 app/code/core/Mage/Adminhtml/view/adminhtml/cms.xml
  12. +75 −24 app/code/core/Mage/Adminhtml/view/adminhtml/cms/browser/content/uploader.phtml
  13. +0 −1  app/code/core/Mage/Adminhtml/view/adminhtml/main.xml
  14. +0 −46 app/code/core/Mage/Adminhtml/view/adminhtml/media/editor.phtml
  15. +69 −27 app/code/core/Mage/Adminhtml/view/adminhtml/media/uploader.phtml
  16. +11 −0 app/code/core/Mage/Adminhtml/view/adminhtml/newsletter.xml
  17. +15 −1 app/code/core/Mage/Backend/Model/Menu/Item.php
  18. +1 −1  app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Date.php
  19. +50 −0 app/code/core/Mage/Catalog/view/frontend/js/grid.js
  20. +39 −0 app/code/core/Mage/Catalog/view/frontend/js/mage-attributes-processing.js
  21. +96 −50 app/code/core/Mage/Catalog/view/frontend/product/list.phtml
  22. +44 −26 app/code/core/Mage/Catalog/view/frontend/product/list/toolbar.phtml
  23. +182 −0 app/code/core/Mage/CatalogSearch/view/frontend/form-mini.js
  24. +10 −2 app/code/core/Mage/CatalogSearch/view/frontend/form.mini.phtml
  25. +3 −3 app/code/core/Mage/Checkout/etc/system.xml
  26. +42 −24 app/code/core/Mage/Checkout/view/frontend/cart/sidebar.phtml
  27. +1 −1  app/code/core/Mage/Checkout/view/frontend/cart/sidebar/default.phtml
  28. +67 −0 app/code/core/Mage/Checkout/view/frontend/js/checkout-topcart.js
  29. +36 −0 app/code/core/Mage/Checkout/view/frontend/js/product-view.js
  30. +49 −0 app/code/core/Mage/Checkout/view/frontend/js/sidebar.js
  31. +137 −0 app/code/core/Mage/Core/Block/Html/Date/Jquery/Calendar.php
  32. +1 −1  app/code/core/Mage/Core/Model/Config/Options.php
  33. +1 −1  app/code/core/Mage/Core/Model/Store.php
  34. +1 −1  app/code/core/Mage/Core/etc/system.xml
  35. +0 −2  app/code/core/Mage/DesignEditor/view/frontend/layout.xml
  36. +4 −4 app/code/core/Mage/Directory/etc/system.xml
  37. +27 −4 app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php
  38. +17 −35 app/code/core/Mage/Downloadable/view/adminhtml/product/edit/downloadable.phtml
  39. +74 −11 app/code/core/Mage/Downloadable/view/adminhtml/product/edit/downloadable/links.phtml
  40. +73 −17 app/code/core/Mage/Downloadable/view/adminhtml/product/edit/downloadable/samples.phtml
  41. +12 −21 app/code/core/Mage/Install/view/install/begin.phtml
  42. +127 −92 app/code/core/Mage/Install/view/install/config.phtml
  43. +85 −57 app/code/core/Mage/Install/view/install/create_admin.phtml
  44. +36 −0 app/code/core/Mage/Install/view/install/css/mage-js-ee-style.css
  45. +38 −0 app/code/core/Mage/Install/view/install/css/mage-js-style.css
  46. +43 −0 app/code/core/Mage/Install/view/install/css/validate.css
  47. +4 −4 app/code/core/Mage/Install/view/install/db/mysql4.phtml
  48. BIN  app/code/core/Mage/Install/view/install/images/validation_advice_bg.gif
  49. +39 −0 app/code/core/Mage/Install/view/install/js/begin.js
  50. +33 −0 app/code/core/Mage/Install/view/install/js/config.js
  51. +30 −0 app/code/core/Mage/Install/view/install/js/create-admin.js
  52. +38 −0 app/code/core/Mage/Install/view/install/js/locale.js
  53. +6 −10 app/code/core/Mage/Install/view/install/locale.phtml
  54. +61 −63 app/code/core/Mage/Install/view/install/page.phtml
  55. +11 −13 app/code/core/Mage/Install/view/install/state.phtml
  56. +99 −0 app/code/core/Mage/Newsletter/view/frontend/newsletter.js
  57. +21 −5 app/code/core/Mage/Newsletter/view/frontend/subscribe.phtml
  58. +0 −1  app/code/core/Mage/Oauth/view/adminhtml/layout.xml
  59. +35 −13 app/code/core/Mage/Page/Block/Html/Head.php
  60. +40 −0 app/code/core/Mage/Page/view/frontend/css/validate.css
  61. +4 −1 app/code/core/Mage/Page/view/frontend/html/footer.phtml
  62. +13 −13 app/code/core/Mage/Page/view/frontend/html/head.phtml
  63. +11 −1 app/code/core/Mage/Page/view/frontend/html/topmenu.phtml
  64. BIN  app/code/core/Mage/Page/view/frontend/images/validation_advice_bg.gif
  65. +41 −0 app/code/core/Mage/Page/view/frontend/js/cookie.js
  66. +12 −4 app/code/core/Mage/Page/view/frontend/js/cookie.phtml
  67. +68 −0 app/code/core/Mage/Page/view/frontend/js/menu.js
  68. +3 −7 app/code/core/Mage/Page/view/frontend/layout.xml
  69. +23 −22 app/code/core/Mage/Poll/view/frontend/active.phtml
  70. +42 −0 app/code/core/Mage/Poll/view/frontend/poll.js
  71. +0 −1  app/code/core/Mage/Poll/view/frontend/result.phtml
  72. +18 −4 app/code/core/Mage/Reports/view/frontend/product_viewed.phtml
  73. +11 −0 app/code/core/Mage/Sales/Model/Order.php
  74. +9 −9 app/code/core/Mage/Sales/view/frontend/layout.xml
  75. +1 −1  app/code/core/Mage/SalesRule/etc/adminhtml/acl.xml
  76. +1 −0  app/code/core/Mage/SalesRule/etc/system.xml
  77. +1 −1  app/code/core/Mage/Weee/view/frontend/layout.xml
  78. +4 −0 app/design/adminhtml/default/default/skin/default/boxes.css
  79. +0 −4 app/design/frontend/default/iphone/Mage_Page/layout.xml
  80. +8 −8 app/design/frontend/default/iphone/Mage_Sales/layout.xml
  81. +96 −45 app/design/frontend/default/modern/Mage_Catalog/product/list.phtml
  82. +13 −6 app/design/frontend/default/modern/Mage_CatalogSearch/form.mini.phtml
  83. +22 −6 app/design/frontend/default/modern/Mage_Newsletter/subscribe.phtml
  84. +6 −2 app/design/frontend/default/modern/Mage_Page/html/footer.phtml
  85. +0 −4 app/design/frontend/default/modern/Mage_Page/layout.xml
  86. +8 −8 app/design/frontend/default/modern/Mage_Sales/layout.xml
  87. +38 −0 app/design/frontend/default/modern/skin/default/Mage_Page/css/validate.css
  88. +2 −2 dev/tests/integration/testsuite/Mage/Cms/Model/Wysiwyg/ConfigTest.php
  89. +1 −1  dev/tests/integration/testsuite/Mage/Core/Helper/JsTest.php
  90. +2 −2 dev/tests/integration/testsuite/Mage/Core/Model/Design/PackagePublicationTest.php
  91. +5 −5 dev/tests/integration/testsuite/Mage/Core/Model/Design/PackageTest.php
  92. +5 −5 dev/tests/integration/testsuite/Mage/Core/Model/StoreTest.php
  93. +1 −1  dev/tests/integration/testsuite/Mage/Core/Model/Variable/ConfigTest.php
  94. +3 −3 dev/tests/integration/testsuite/Mage/Page/Block/Html/HeadTest.php
  95. +1 −1  dev/tests/integration/testsuite/Mage/Widget/Model/Widget/ConfigTest.php
  96. +3 −0  dev/tests/integration/testsuite/Varien/Image/Adapter/InterfaceTest.php
  97. +3 −0  dev/tests/js/.gitignore
  98. +0 −29 dev/tests/js/jsTestDriver.conf
  99. +50 −0 dev/tests/js/jsTestDriver.php.dist
  100. +43 −0 dev/tests/js/jsTestDriverOrder.php
  101. +242 −0 dev/tests/js/run_js_tests.php
  102. +59 −0 dev/tests/js/testsuite/mage/calendar/calendar-test.js
  103. +77 −0 dev/tests/js/testsuite/mage/decorate-test.js
  104. +54 −0 dev/tests/js/testsuite/mage/design_editor/checkbox-test.js
  105. +0 −54 dev/tests/js/testsuite/mage/design_editor/checkboxTest.js
  106. +83 −0 dev/tests/js/testsuite/mage/design_editor/container-test.js
  107. +0 −83 dev/tests/js/testsuite/mage/design_editor/containerTest.js
  108. 0  dev/tests/js/testsuite/mage/design_editor/{historyTest.js → history-test.js}
  109. 0  dev/tests/js/testsuite/mage/design_editor/{historyToolbarTest.js → history-toolbar-test.js}
  110. +141 −0 dev/tests/js/testsuite/mage/design_editor/menu-test.js
  111. +0 −141 dev/tests/js/testsuite/mage/design_editor/menuTest.js
  112. 0  dev/tests/js/testsuite/mage/design_editor/{pageTest.js → page-test.js}
  113. +71 −0 dev/tests/js/testsuite/mage/design_editor/panel-test.js
  114. +0 −71 dev/tests/js/testsuite/mage/design_editor/panelTest.js
  115. +161 −0 dev/tests/js/testsuite/mage/design_editor/tree-test.js
  116. +0 −159 dev/tests/js/testsuite/mage/design_editor/treeTest.js
  117. +57 −0 dev/tests/js/testsuite/mage/localization/localize-test.js
  118. +0 −73 dev/tests/js/testsuite/mage/localization/localizeTest.js
  119. +63 −0 dev/tests/js/testsuite/mage/mage-test.js
  120. +0 −51 dev/tests/js/testsuite/mage/mageTest.js
  121. 0  dev/tests/js/testsuite/mage/translate/{translateTest.js → translate-test.js}
  122. +301 −0 dev/tests/js/testsuite/mage/validation/validate-test.js
  123. +0 −280 dev/tests/js/testsuite/mage/validation/validateTest.js
  124. +14 −2 dev/tests/performance/config.php.dist
  125. +37 −0 dev/tests/performance/testsuite/backend.jmx
  126. +93 −0 dev/tests/performance/testsuite/fixtures/sales_100k_orders.php
  127. +7 −0 dev/tests/static/phpunit.xml.dist
  128. +205 −0 dev/tests/static/testsuite/Js/LiveCodeTest.php
  129. +11 −0 dev/tests/static/testsuite/Js/_files/blacklist/core.txt
  130. +8 −0 dev/tests/static/testsuite/Js/_files/whitelist/core.txt
  131. +1 −0  dev/tests/static/testsuite/Php/_files/whitelist/core.txt
  132. +59 −0 dev/tests/unit/testsuite/Magento/Date/Jquery/CalendarTest.php
  133. +36 −0 dev/tests/unit/testsuite/Varien/Data/CollectionTest.php
  134. +125 −0 dev/tests/unit/testsuite/Varien/Image/Adapter/AbstractTest.php
  135. +129 −0 lib/Magento/Date/Jquery/Calendar.php
  136. +11 −0 lib/Varien/Data/Collection.php
  137. +0 −13 lib/Varien/Data/Form/Element/Gallery.php
  138. +10 −0 lib/Varien/File/Uploader.php
  139. +91 −40 lib/Varien/Image/Adapter/Abstract.php
  140. +11 −9 lib/Varien/Image/Adapter/Gd2.php
  141. +0 −533 pub/js/extjs/resources/css/ytheme-galdaka.css
  142. +0 −37 pub/js/mage/adminhtml/fix-extjs-defer.js
  143. +0 −258 pub/js/mage/adminhtml/uploader.js
  144. +0 −66 pub/js/mage/translate.js
  145. +0 −524 pub/js/tiny_mce/classes/ControlManager.js
  146. +0 −577 pub/js/tiny_mce/classes/EditorCommands.js
  147. +0 −503 pub/js/tiny_mce/classes/EditorManager.js
  148. +0 −635 pub/js/tiny_mce/classes/ForceBlocks.js
  149. +0 −66 pub/js/tiny_mce/classes/LegacyInput.js
  150. +0 −456 pub/js/tiny_mce/classes/Popup.js
  151. +0 −200 pub/js/tiny_mce/classes/UndoManager.js
  152. +0 −231 pub/js/tiny_mce/classes/WindowManager.js
  153. +0 −337 pub/js/tiny_mce/classes/adapter/jquery/adapter.js
  154. +0 −336 pub/js/tiny_mce/classes/adapter/jquery/jquery.tinymce.js
  155. +0 −1,876 pub/js/tiny_mce/classes/dom/DOMUtils.js
  156. +0 −195 pub/js/tiny_mce/classes/dom/Element.js
  157. +0 −381 pub/js/tiny_mce/classes/dom/EventUtils.js
  158. +0 −687 pub/js/tiny_mce/classes/dom/Range.js
  159. +0 −251 pub/js/tiny_mce/classes/dom/RangeUtils.js
  160. +0 −285 pub/js/tiny_mce/classes/dom/ScriptLoader.js
  161. +0 −379 pub/js/tiny_mce/classes/dom/Serializer.js
  162. +0 −64 pub/js/tiny_mce/classes/dom/TreeWalker.js
  163. +0 −445 pub/js/tiny_mce/classes/dom/TridentSelection.js
  164. +0 −73 pub/js/tiny_mce/classes/ui/Button.js
  165. +0 −285 pub/js/tiny_mce/classes/ui/ColorSplitButton.js
  166. +0 −66 pub/js/tiny_mce/classes/ui/Container.js
  167. +0 −198 pub/js/tiny_mce/classes/ui/Control.js
  168. +0 −476 pub/js/tiny_mce/classes/ui/DropMenu.js
  169. +0 −428 pub/js/tiny_mce/classes/ui/ListBox.js
  170. +0 −186 pub/js/tiny_mce/classes/ui/Menu.js
  171. +0 −176 pub/js/tiny_mce/classes/ui/MenuButton.js
  172. +0 −74 pub/js/tiny_mce/classes/ui/MenuItem.js
  173. +0 −217 pub/js/tiny_mce/classes/ui/NativeListBox.js
  174. +0 −42 pub/js/tiny_mce/classes/ui/Separator.js
  175. +0 −154 pub/js/tiny_mce/classes/ui/SplitButton.js
  176. +0 −89 pub/js/tiny_mce/classes/ui/Toolbar.js
  177. +0 −138 pub/js/tiny_mce/classes/util/Cookie.js
  178. +0 −112 pub/js/tiny_mce/classes/util/Dispatcher.js
  179. +0 −103 pub/js/tiny_mce/classes/util/JSON.js
  180. +0 −28 pub/js/tiny_mce/classes/util/JSONP.js
  181. +0 −112 pub/js/tiny_mce/classes/util/JSONRequest.js
  182. +0 −312 pub/js/tiny_mce/classes/util/URI.js
  183. +0 −88 pub/js/tiny_mce/classes/util/XHR.js
  184. +0 −129 pub/js/tiny_mce/classes/xml/Parser.js
  185. +0 −504 pub/js/tiny_mce/license.txt
  186. +0 −5 pub/js/tiny_mce/plugins/advhr/css/advhr.css
  187. +0 −57 pub/js/tiny_mce/plugins/advhr/editor_plugin_src.js
  188. +0 −43 pub/js/tiny_mce/plugins/advhr/js/rule.js
  189. +0 −58 pub/js/tiny_mce/plugins/advhr/rule.htm
  190. +0 −13 pub/js/tiny_mce/plugins/advimage/css/advimage.css
  191. +0 −50 pub/js/tiny_mce/plugins/advimage/editor_plugin_src.js
  192. +0 −235 pub/js/tiny_mce/plugins/advimage/image.htm
  193. +0 −462 pub/js/tiny_mce/plugins/advimage/js/image.js
  194. +0 −8 pub/js/tiny_mce/plugins/advlink/css/advlink.css
  195. +0 −61 pub/js/tiny_mce/plugins/advlink/editor_plugin_src.js
  196. +0 −532 pub/js/tiny_mce/plugins/advlink/js/advlink.js
  197. +0 −338 pub/js/tiny_mce/plugins/advlink/link.htm
  198. +0 −176 pub/js/tiny_mce/plugins/advlist/editor_plugin_src.js
  199. +0 −431 pub/js/tiny_mce/plugins/autosave/editor_plugin_src.js
  200. +0 −4 pub/js/tiny_mce/plugins/autosave/langs/en.js
  201. +0 −120 pub/js/tiny_mce/plugins/bbcode/editor_plugin_src.js
  202. +0 −160 pub/js/tiny_mce/plugins/contextmenu/editor_plugin_src.js
  203. +0 −82 pub/js/tiny_mce/plugins/directionality/editor_plugin_src.js
  204. +0 −43 pub/js/tiny_mce/plugins/emotions/editor_plugin_src.js
  205. +0 −42 pub/js/tiny_mce/plugins/emotions/emotions.htm
  206. +0 −43 pub/js/tiny_mce/plugins/emotions/js/emotions.js
  207. +0 −22 pub/js/tiny_mce/plugins/example/dialog.htm
  208. +0 −84 pub/js/tiny_mce/plugins/example/editor_plugin_src.js
  209. +0 −19 pub/js/tiny_mce/plugins/example/js/dialog.js
  210. +0 −3  pub/js/tiny_mce/plugins/example/langs/en.js
  211. +0 −3  pub/js/tiny_mce/plugins/example/langs/en_dlg.js
  212. +0 −143 pub/js/tiny_mce/plugins/fullpage/css/fullpage.css
  213. +0 −405 pub/js/tiny_mce/plugins/fullpage/editor_plugin_src.js
  214. +0 −259 pub/js/tiny_mce/plugins/fullpage/fullpage.htm
  215. +0 −232 pub/js/tiny_mce/plugins/fullpage/js/fullpage.js
  216. +0 −159 pub/js/tiny_mce/plugins/fullscreen/editor_plugin_src.js
  217. +0 −110 pub/js/tiny_mce/plugins/fullscreen/fullscreen.htm
  218. +0 −54 pub/js/tiny_mce/plugins/iespell/editor_plugin_src.js
  219. +0 −699 pub/js/tiny_mce/plugins/inlinepopups/editor_plugin_src.js
  220. +0 −387 pub/js/tiny_mce/plugins/inlinepopups/template.htm
  221. +0 −83 pub/js/tiny_mce/plugins/insertdatetime/editor_plugin_src.js
  222. +0 −262 pub/js/tiny_mce/plugins/layer/editor_plugin_src.js
  223. +0 −139 pub/js/tiny_mce/plugins/legacyoutput/editor_plugin_src.js
  224. +0 −17 pub/js/tiny_mce/plugins/media/css/media.css
  225. +0 −890 pub/js/tiny_mce/plugins/media/editor_plugin_src.js
  226. +0 −73 pub/js/tiny_mce/plugins/media/js/embed.js
Sorry, we could not display the entire diff because it was too big.
1  .gitignore
View
@@ -34,3 +34,4 @@ atlassian*
dev/api-tests/config.php
dev/api-tests/integration/tmp/*
dev/api-tests/integration/framework/local-mysql.xml
+
22 CHANGELOG.markdown
View
@@ -1,3 +1,25 @@
+Update as of 9/27/2012
+======================
+* Refactoring Magento 2 to use jQuery instead of Prototype:
+ * Implemented simple lazy-loading functionality
+ * Converted decorator mechanism to jQuery
+ * Moved Installation process to jQuery
+ * Moved Home, Category and Simple Product View pages to jQuery
+ * Moved all frontend libraries from `pub/js` directory to `pub/lib`
+* Improved Javascript unit tests to be consistent with other test frameworks in Magento
+* Added Javascript code analysis tests to the static tests suite
+* Added jQuery file uploader for admin backend, cleaned out old deprecated uploaders
+* Implemented fixture of 100k orders for the performance tests
+* Fixes
+ * Admin menu elements order differs for a cached page and non-cached one
+ * Typos in System > Configuration > General Tab
+ * Wrong elements positions on "View Order" page
+ * Impossible to configure checkout on store scope
+ * Warning message in `system.log` when using GD2 image adapter
+ * "Preview" link is absent for managing CMS Pages in single store mode
+ * "Promotions" tab is missing on Configuration page
+ * Wrong format of performance tests config
+
Update as of 9/13/2012
======================
* Implemented the option to enable the single store mode in the system configuration, which simplifies the back-end GUI:
6 app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php
View
@@ -38,7 +38,6 @@ class Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery extends Varien_Da
public function getElementHtml()
{
$html = $this->getContentHtml();
- //$html.= $this->getAfterElementHtml();
return $html;
}
@@ -54,8 +53,9 @@ public function getContentHtml()
$content = Mage::getSingleton('Mage_Core_Model_Layout')
->createBlock('Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content');
- $content->setId($this->getHtmlId() . '_content')
- ->setElement($this);
+ $content->setId($this->getHtmlId() . '_content')->setElement($this);
+ $galleryJs = $content->getJsObjectName();
+ $content->getUploader()->getConfig()->setMegiaGallery($galleryJs);
return $content->toHtml();
}
151 app/code/core/Mage/Adminhtml/Block/Media/Editor.php
View
@@ -1,151 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Adminhtml media library image editor
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Adminhtml_Block_Media_Editor extends Mage_Adminhtml_Block_Widget
-{
-
- protected $_config;
-
- public function __construct()
- {
- parent::__construct();
- $this->setTemplate('media/editor.phtml');
- $this->getConfig()->setParams();
- }
-
- protected function _prepareLayout()
- {
- $this->setChild(
- 'rotatecw_button',
- $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
- ->addData(array(
- 'id' => $this->_getButtonId('rotatecw'),
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Rotate CW'),
- 'onclick' => $this->getJsObjectName() . '.rotateCw()'
- ))
- );
-
- $this->setChild(
- 'rotateccw_button',
- $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
- ->addData(array(
- 'id' => $this->_getButtonId('rotateccw'),
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Rotate CCW'),
- 'onclick' => $this->getJsObjectName() . '.rotateCCw()'
- ))
- );
-
- $this->setChild(
- 'resize_button',
- $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
- ->addData(array(
- 'id' => $this->_getButtonId('upload'),
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Resize'),
- 'onclick' => $this->getJsObjectName() . '.resize()'
- ))
- );
-
- $this->setChild(
- 'image_button',
- $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
- ->addData(array(
- 'id' => $this->_getButtonId('image'),
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Get Image Base64'),
- 'onclick' => $this->getJsObjectName() . '.getImage()'
- ))
- );
-
- return parent::_prepareLayout();
- }
-
- protected function _getButtonId($buttonName)
- {
- return $this->getHtmlId() . '-' . $buttonName;
- }
-
- public function getRotatecwButtonHtml()
- {
- return $this->getChildHtml('rotatecw_button');
- }
-
- public function getImageButtonHtml()
- {
- return $this->getChildHtml('image_button');
- }
-
- public function getRotateccwButtonHtml()
- {
- return $this->getChildHtml('rotateccw_button');
- }
-
- public function getResizeButtonHtml()
- {
- return $this->getChildHtml('resize_button');
- }
-
- /**
- * Retrive uploader js object name
- *
- * @return string
- */
- public function getJsObjectName()
- {
- return $this->getHtmlId() . 'JsObject';
- }
-
- /**
- * Retrive config json
- *
- * @return string
- */
- public function getConfigJson()
- {
- return Mage::helper('Mage_Core_Helper_Data')->jsonEncode($this->getConfig()->getData());
- }
-
- /**
- * Retrive config object
- *
- * @return Varien_Config
- */
- public function getConfig()
- {
- if(is_null($this->_config)) {
- $this->_config = new Varien_Object();
- }
-
- return $this->_config;
- }
-
-}
63 app/code/core/Mage/Adminhtml/Block/Media/Uploader.php
View
@@ -60,65 +60,20 @@ public function __construct()
));
}
+ /**
+ * Prepares layout and set element renderer
+ *
+ * @return Mage_Adminhtml_Block_Media_Uploader
+ */
protected function _prepareLayout()
{
- $this->setChild(
- 'browse_button',
- $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
- ->addData(array(
- 'id' => $this->_getButtonId('browse'),
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Browse Files...'),
- 'type' => 'button',
- 'onclick' => $this->getJsObjectName() . '.browse()'
- ))
- );
-
- $this->setChild(
- 'upload_button',
- $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
- ->addData(array(
- 'id' => $this->_getButtonId('upload'),
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Upload Files'),
- 'type' => 'button',
- 'onclick' => $this->getJsObjectName() . '.upload()'
- ))
- );
-
- $this->setChild(
- 'delete_button',
- $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')
- ->addData(array(
- 'id' => '{{id}}-delete',
- 'class' => 'delete',
- 'type' => 'button',
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Remove'),
- 'onclick' => $this->getJsObjectName() . '.removeFile(\'{{fileId}}\')'
- ))
- );
-
+ $head = $this->getLayout()->getBlock('head');
+ if ($head) {
+ $head->addCss('Mage_Adminhtml::jquery/fileUploader/css/jquery.fileupload-ui.css');
+ }
return parent::_prepareLayout();
}
- protected function _getButtonId($buttonName)
- {
- return $this->getHtmlId() . '-' . $buttonName;
- }
-
- public function getBrowseButtonHtml()
- {
- return $this->getChildHtml('browse_button');
- }
-
- public function getUploadButtonHtml()
- {
- return $this->getChildHtml('upload_button');
- }
-
- public function getDeleteButtonHtml()
- {
- return $this->getChildHtml('delete_button');
- }
-
/**
* Retrive uploader js object name
*
52 app/code/core/Mage/Adminhtml/controllers/Media/EditorController.php
View
@@ -1,52 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Media library editor controller
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Adminhtml_Media_EditorController extends Mage_Adminhtml_Controller_Action
-{
- public function indexAction()
- {
- $this->loadLayout();
- $this->_addContent(
- $this->getLayout()->createBlock('Mage_Adminhtml_Block_Media_Editor')
- );
- $this->renderLayout();
- }
-
- protected function _isAllowed()
- {
- return Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed(
- Mage_Backend_Model_Acl_Config::ACL_RESOURCE_ALL
- );
- }
-}
56 app/code/core/Mage/Adminhtml/controllers/Media/UploaderController.php
View
@@ -1,56 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Media library upload controller
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Adminhtml_Media_UploaderController extends Mage_Adminhtml_Controller_Action
-{
-
- public function uploadAction()
- {
- $this->getResponse()->setBody(Mage::helper('Mage_Core_Helper_Data')->jsonEncode($_REQUEST));
- }
-
- public function indexAction()
- {
- $this->loadLayout();
- $this->_addContent(
- $this->getLayout()->createBlock('Mage_Adminhtml_Block_Media_Uploader')
- );
- $this->renderLayout();
- }
-
- protected function _isAllowed()
- {
- return Mage::getSingleton('Mage_Core_Model_Authorization')
- ->isAllowed(Mage_Backend_Model_Acl_Config::ACL_RESOURCE_ALL);
- }
-}
27 app/code/core/Mage/Adminhtml/view/adminhtml/catalog.xml
View
@@ -50,6 +50,14 @@
<action method="addJs"><file>mage/jquery-no-conflict.js</file></action>
<action method="addJs"><file>jquery/jquery-ui-1.8.18.custom.min.js</file></action>
<action method="addCss"><file>Mage_Adminhtml::css/ui-lightness/jquery-ui-1.8.21.custom.css</file></action>
+
+ <action method="addCss"><file>Mage_Adminhtml::jquery/fileUploader/css/jquery.fileupload-ui.css</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/vendor/jquery.ui.widget.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.iframe-transport.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/load-image.min.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/canvas-to-blob.min.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload-fp.js</file></action>
</reference>
<reference name="content">
<block type="Mage_Adminhtml_Block_Catalog_Product_Edit" name="product_edit"></block>
@@ -72,6 +80,14 @@
<action method="addJs"><file>mage/jquery-no-conflict.js</file></action>
<action method="addJs"><file>jquery/jquery-ui-1.8.18.custom.min.js</file></action>
<action method="addCss"><file>Mage_Adminhtml::css/ui-lightness/jquery-ui-1.8.21.custom.css</file></action>
+
+ <action method="addCss"><file>Mage_Adminhtml::jquery/fileUploader/css/jquery.fileupload-ui.css</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/vendor/jquery.ui.widget.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.iframe-transport.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/load-image.min.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/canvas-to-blob.min.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload-fp.js</file></action>
</reference>
<reference name="content">
<block type="Mage_Adminhtml_Block_Catalog_Product_Edit" name="product_edit"></block>
@@ -288,6 +304,17 @@ Layout handle for configurable products
<adminhtml_catalog_category_edit>
<update handle="editor"/>
+ <reference name="head">
+ <action method="addCss"><file>Mage_Adminhtml::jquery/fileUploader/css/jquery.fileupload-ui.css</file></action>
+
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/vendor/jquery.ui.widget.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.iframe-transport.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload.js</file></action>
+
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/load-image.min.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/canvas-to-blob.min.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload-fp.js</file></action>
+ </reference>
<reference name="left">
<block name="category.tree" type="Mage_Adminhtml_Block_Catalog_Category_Tree" template="catalog/category/tree.phtml" />
</reference>
36 app/code/core/Mage/Adminhtml/view/adminhtml/catalog/product.js
View
@@ -91,30 +91,18 @@ Product.Gallery.prototype = {
this.getElement('add_images_button').hide();
this.getElement('uploader').show();
},
- handleUploadComplete : function(files) {
- files.each( function(item) {
- if (!item.response.isJSON()) {
- try {
- console.log(item.response);
- } catch (e2) {
- alert(item.response);
- }
- return;
- }
- var response = item.response.evalJSON();
- if (response.error) {
- return;
- }
- var newImage = {};
- newImage.url = response.url;
- newImage.file = response.file;
- newImage.label = '';
- newImage.position = this.getNextPosition();
- newImage.disabled = 0;
- newImage.removed = 0;
- this.images.push(newImage);
- this.uploader.removeFile(item.id);
- }.bind(this));
+ handleUploadComplete : function(file) {
+ if (file.error) {
+ return;
+ }
+ var newImage = {};
+ newImage.url = file.url;
+ newImage.file = file.file;
+ newImage.label = '';
+ newImage.position = this.getNextPosition();
+ newImage.disabled = 0;
+ newImage.removed = 0;
+ this.images.push(newImage);
this.container.setHasChanges();
this.updateImages();
},
2  app/code/core/Mage/Adminhtml/view/adminhtml/catalog/product/helper/gallery.phtml
View
@@ -120,6 +120,6 @@ $_block = $this;
<input type="hidden" id="<?php echo $_block->getHtmlId() ?>_save_image" name="<?php echo $_block->getElement()->getName() ?>[values]" value="<?php echo $_block->escapeHtml($_block->getImagesValuesJson()) ?>" />
<script type="text/javascript">
//<![CDATA[
-var <?php echo $_block->getJsObjectName(); ?> = new Product.Gallery('<?php echo $_block->getHtmlId() ?>', <?php if ($_block->getElement()->getReadonly()):?>null<?php else:?><?php echo $_block->getUploader()->getJsObjectName() ?><?php endif;?>, <?php echo $_block->getImageTypesJson() ?>);
+var <?php echo $_block->getJsObjectName(); ?> = new Product.Gallery('<?php echo $_block->getHtmlId() ?>', null, <?php echo $_block->getImageTypesJson() ?>);
//]]>
</script>
22 app/code/core/Mage/Adminhtml/view/adminhtml/cms.xml
View
@@ -38,6 +38,17 @@
</adminhtml_cms_page_new>
<adminhtml_cms_page_edit>
+ <reference name="head">
+ <action method="addCss"><file>Mage_Adminhtml::jquery/fileUploader/css/jquery.fileupload-ui.css</file></action>
+
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/vendor/jquery.ui.widget.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.iframe-transport.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload.js</file></action>
+
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/load-image.min.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/canvas-to-blob.min.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload-fp.js</file></action>
+ </reference>
<update handle="editor"/>
<reference name="content">
<block type="Mage_Adminhtml_Block_Cms_Page_Edit" name="cms_page_edit"></block>
@@ -68,6 +79,17 @@
<adminhtml_cms_block_edit>
<update handle="editor"/>
+ <reference name="head">
+ <action method="addCss"><file>Mage_Adminhtml::jquery/fileUploader/css/jquery.fileupload-ui.css</file></action>
+
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/vendor/jquery.ui.widget.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.iframe-transport.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload.js</file></action>
+
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/load-image.min.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/canvas-to-blob.min.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload-fp.js</file></action>
+ </reference>
<reference name="content">
<block type="Mage_Adminhtml_Block_Cms_Block_Edit" name="cms_block_edit"></block>
</reference>
99 app/code/core/Mage/Adminhtml/view/adminhtml/cms/browser/content/uploader.phtml
View
@@ -31,41 +31,92 @@
* @see Mage_Adminhtml_Block_Cms_Wysiwyg_Images_Content_Uploader
*/
?>
+
<div id="<?php echo $this->getHtmlId() ?>" class="uploader">
- <div class="buttons">
- <div id="<?php echo $this->getHtmlId() ?>-install-flash" style="display:none">
- <?php echo Mage::helper('Mage_Media_Helper_Data')->__('This content requires last version of Adobe Flash Player. <a href="%s">Get Flash</a>', 'http://www.adobe.com/go/getflash/') ?>
- </div>
- </div>
+ <span class="fileinput-button form-buttons">
+ <span><?php echo Mage::helper('Mage_Adminhtml_Helper_Data')->__('Browse Files...') ?></span>
+ <input id="fileupload" type="file" name="<?php echo $this->getConfig()->getFileField() ?>" data-url="<?php echo $this->getConfig()->getUrl() ?>" multiple>
+ </span>
<div class="clear"></div>
<div class="no-display" id="<?php echo $this->getHtmlId() ?>-template">
<div id="{{id}}" class="file-row">
- <span class="file-info">{{name}} ({{size}})</span>
- <span class="delete-button"><?php echo $this->getDeleteButtonHtml() ?></span>
- <span class="progress-text"></span>
- <div class="clear"></div>
+ <span class="file-info">{{name}} ({{size}})</span>
+ <div class="progressbar-container">
+ <div class="progressbar upload-progress" style="width: 0%;"></div>
+ </div>
+ <div class="clear"></div>
</div>
</div>
- <div class="no-display" id="<?php echo $this->getHtmlId() ?>-template-progress">
- {{percent}}% {{uploaded}} / {{total}}
- </div>
</div>
<script type="text/javascript">
//<![CDATA[
-maxUploadFileSizeInBytes = <?php echo $this->getDataMaxSizeInBytes() ?>;
-maxUploadFileSize = '<?php echo $this->getDataMaxSize() ?>';
+(function($) {
+ $(function () {
+ $('#fileupload').fileupload({
+ dataType: 'json',
+ formData: {
+ isAjax: 'true',
+ form_key: FORM_KEY
+ },
+ sequentialUploads: true,
+ acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
+ maxFileSize: <?php echo $this->getDataMaxSizeInBytes() ?>,
+ add: function(e, data) {
+ $.each(data.files, function (index, file) {
+ data.fileId = Math.random().toString(36).substr(2,9);
+ var progressTmpl = $('#<?php echo $this->getHtmlId(); ?>-template').children(':first').clone();
+ progressTmpl.attr('id', data.fileId);
+ var fileInfoHtml = progressTmpl.html().replace('{{size}}', byteConvert(file.size))
+ .replace('{{name}}', file.name);
+ progressTmpl.html(fileInfoHtml) ;
+
+ progressTmpl.appendTo('#<?php echo $this->getHtmlId() ?>');
+
+ });
+ $(this).fileupload('process', data).done(function () {
+ data.submit();
+ });
+ },
+ done: function(e, data) {
+ var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
+ $(progressSelector).css('width','100%');
+ if (data.result && !data.result.hasOwnProperty('errorcode')) {
+ $(progressSelector).removeClass('upload-progress').addClass('upload-success');
+ MediabrowserInstance.handleUploadComplete();
+ } else {
+ $(progressSelector).removeClass('upload-progress').addClass('upload-failure');
+ }
+ },
+ progress: function(e, data) {
+ var progress = parseInt(data.loaded / data.total * 100, 10);
+ var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
+ $(progressSelector).css('width', progress + '%');
+ },
+ fail: function(e, data) {
+ var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
+ $(progressSelector).removeClass('upload-progress').addClass('upload-failure');
+ }
+ });
-<?php echo $this->getJsObjectName() ?> = new Flex.Uploader('<?php echo $this->getHtmlId() ?>', '<?php echo $this->getSkinUrl('media/uploader.swf') ?>', <?php echo $this->getConfigJson() ?>);
-<?php echo $this->getJsObjectName() ?>.onFilesComplete = function(completedFiles){
- completedFiles.each(function(file){
- <?php echo $this->getJsObjectName() ?>.removeFile(file.id);
+ $('#fileupload').fileupload('option', {
+ process: [
+ {
+ action: 'load',
+ fileTypes: /^image\/(gif|jpeg|png)$/,
+ maxFileSize: <?php echo $this->getDataMaxSizeInBytes() ?> * 10
+ },
+ {
+ action: 'resize',
+ maxWidth: <?php echo Varien_File_Uploader::MAX_IMAGE_WIDTH ?>,
+ maxHeight: <?php echo Varien_File_Uploader::MAX_IMAGE_HEIGHT ?>
+ },
+ {
+ action: 'save'
+ }
+ ]
+ });
});
- MediabrowserInstance.handleUploadComplete();
-}
-// hide flash buttons
-if ($('<?php echo $this->getHtmlId() ?>-flash') != undefined) {
- $('<?php echo $this->getHtmlId() ?>-flash').setStyle({float:'left'});
-}
+})(jQuery);
//]]>
</script>
1  app/code/core/Mage/Adminhtml/view/adminhtml/main.xml
View
@@ -79,7 +79,6 @@ Supported layout update handles (special):
<action method="addJs"><file>mage/adminhtml/form.js</file></action>
<action method="addJs"><file>mage/adminhtml/accordion.js</file></action>
<action method="addJs"><file>mage/adminhtml/tools.js</file></action>
- <action method="addJs"><file>mage/adminhtml/uploader.js</file></action>
<action method="addJs"><file>Mage_Adminhtml::catalog/product.js</file></action>
<action method="addJs"><file>lib/ds-sleight.js</file><params>defer</params><if>lt IE 7</if></action>
46 app/code/core/Mage/Adminhtml/view/adminhtml/media/editor.phtml
View
@@ -1,46 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category design
- * @package default_default
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- */
-?>
-<?php echo $this->helper('Mage_Adminhtml_Helper_Media_Js')->includeScript('lib/flex.js') ?>
-<?php echo $this->helper('Mage_Adminhtml_Helper_Media_Js')->includeScript('lib/FABridge.js') ?>
-<?php echo $this->helper('Mage_Adminhtml_Helper_Media_Js')->includeScript('mage/adminhtml/image.js') ?>
-<div id="<?php echo $this->getHtmlId() ?>" class="editor" style="width:100%; height:100%;">
- <div class="buttons" style="margin-bottom: 20px;">
- <?php echo $this->getRotatecwButtonHtml() ?>
- <?php echo $this->getRotateccwButtonHtml() ?>
- <input type="text" id="<?php echo $this->_getButtonId('width') ?>" size="7"/>
- x
- <input type="text" id="<?php echo $this->_getButtonId('height') ?>" size="7"/> px
- <?php echo $this->getResizeButtonHtml() ?>
- <?php echo $this->getImageButtonHtml() ?>
- </div>
-
-
-</div>
-<textarea id="<?php echo $this->_getButtonId('b64') ?>" rows="10" cols="50"></textarea>
-<script type="text/javascript">
-<?php echo $this->getJsObjectName() ?> = new Flex.ImageEditor('<?php echo $this->getHtmlId() ?>', '<?php echo $this->getSkinUrl('media/editor.swf') ?>', <?php echo $this->getConfigJson() ?>);
-</script>
96 app/code/core/Mage/Adminhtml/view/adminhtml/media/uploader.phtml
View
@@ -30,44 +30,86 @@
*/
?>
-<?php echo $this->helper('Mage_Adminhtml_Helper_Media_Js')->includeScript('lib/flex.js') ?>
-<?php echo $this->helper('Mage_Adminhtml_Helper_Media_Js')->includeScript('mage/adminhtml/flexuploader.js') ?>
-<?php echo $this->helper('Mage_Adminhtml_Helper_Media_Js')->includeScript('lib/FABridge.js') ?>
-
<div id="<?php echo $this->getHtmlId() ?>" class="uploader">
- <div class="buttons">
- <?php /* buttons included in flex object */ ?>
- <?php /*echo $this->getBrowseButtonHtml()*/ ?>
- <?php /*echo $this->getUploadButtonHtml()*/ ?>
- <div id="<?php echo $this->getHtmlId() ?>-install-flash" style="display:none">
- <?php echo Mage::helper('Mage_Media_Helper_Data')->__('This content requires last version of Adobe Flash Player. <a href="%s">Get Flash</a>', 'http://www.adobe.com/go/getflash/') ?>
- </div>
- </div>
+ <span class="fileinput-button form-buttons">
+ <span><?php echo Mage::helper('Mage_Adminhtml_Helper_Data')->__('Browse Files...') ?></span>
+ <input id="fileupload" type="file" name="<?php echo $this->getConfig()->getFileField() ?>" data-url="<?php echo $this->getConfig()->getUrl() ?>" multiple>
+ </span>
<div class="clear"></div>
<div class="no-display" id="<?php echo $this->getHtmlId() ?>-template">
<div id="{{id}}" class="file-row">
- <span class="file-info">{{name}} ({{size}})</span>
- <span class="delete-button"><?php echo $this->getDeleteButtonHtml() ?></span>
- <span class="progress-text"></span>
- <div class="clear"></div>
+ <span class="file-info">{{name}} ({{size}})</span>
+ <div class="progressbar-container">
+ <div class="progressbar upload-progress" style="width: 0%;"></div>
+ </div>
+ <div class="clear"></div>
</div>
</div>
- <div class="no-display" id="<?php echo $this->getHtmlId() ?>-template-progress">
- {{percent}}% {{uploaded}} / {{total}}
- </div>
</div>
<script type="text/javascript">
//<![CDATA[
+(function($) {
+ $(function () {
+ $('#fileupload').fileupload({
+ dataType: 'json',
+ sequentialUploads: true,
+ acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
+ maxFileSize: <?php echo $this->getDataMaxSizeInBytes() ?>,
+ add: function(e, data) {
+ $.each(data.files, function (index, file) {
+ data.fileId = Math.random().toString(36).substr(2,9);
+ var progressTmpl = $('#<?php echo $this->getHtmlId(); ?>-template').children(':first').clone();
+ progressTmpl.attr('id', data.fileId);
+ var fileInfoHtml = progressTmpl.html().replace('{{size}}', byteConvert(file.size))
+ .replace('{{name}}', file.name);
+ progressTmpl.html(fileInfoHtml) ;
-var maxUploadFileSizeInBytes = <?php echo $this->getDataMaxSizeInBytes() ?>;
-var maxUploadFileSize = '<?php echo $this->getDataMaxSize() ?>';
-
-<?php echo $this->getJsObjectName() ?> = new Flex.Uploader('<?php echo $this->getHtmlId() ?>', '<?php echo $this->getUploaderUrl('media/uploader.swf') ?>', <?php echo $this->getConfigJson() ?>);
-
-if (varienGlobalEvents) {
- varienGlobalEvents.attachEventHandler('tabChangeBefore', <?php echo $this->getJsObjectName() ?>.onContainerHideBefore);
-}
+ progressTmpl.appendTo('#<?php echo $this->getHtmlId() ?>');
+ });
+ $(this).fileupload('process', data).done(function () {
+ data.submit();
+ });
+ },
+ done: function(e, data) {
+ var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
+ $(progressSelector).css('width','100%');
+ if (data.result && !data.result.hasOwnProperty('errorcode')) {
+ $(progressSelector).removeClass('upload-progress').addClass('upload-success');
+ <?php echo $this->getConfig()->getMegiaGallery() ?>.handleUploadComplete(data.result);
+ } else {
+ $(progressSelector).removeClass('upload-progress').addClass('upload-failure');
+ }
+ },
+ progress: function(e, data) {
+ var progress = parseInt(data.loaded / data.total * 100, 10);
+ var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
+ $(progressSelector).css('width', progress + '%');
+ },
+ fail: function(e, data) {
+ var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
+ $(progressSelector).removeClass('upload-progress').addClass('upload-failure');
+ }
+ });
+ $('#fileupload').fileupload('option', {
+ process: [
+ {
+ action: 'load',
+ fileTypes: /^image\/(gif|jpeg|png)$/,
+ maxFileSize: <?php echo $this->getDataMaxSizeInBytes() ?> * 10
+ },
+ {
+ action: 'resize',
+ maxWidth: <?php echo Varien_File_Uploader::MAX_IMAGE_WIDTH ?>,
+ maxHeight: <?php echo Varien_File_Uploader::MAX_IMAGE_HEIGHT ?>
+ },
+ {
+ action: 'save'
+ }
+ ]
+ });
+ });
+})(jQuery);
//]]>
</script>
11 app/code/core/Mage/Adminhtml/view/adminhtml/newsletter.xml
View
@@ -29,6 +29,17 @@
<layout>
<adminhtml_newsletter_template_edit>
<update handle="editor"/>
+ <reference name="head">
+ <action method="addCss"><file>Mage_Adminhtml::jquery/fileUploader/css/jquery.fileupload-ui.css</file></action>
+
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/vendor/jquery.ui.widget.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.iframe-transport.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload.js</file></action>
+
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/load-image.min.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/canvas-to-blob.min.js</file></action>
+ <action method="addJs"><file>Mage_Adminhtml::jquery/fileUploader/jquery.fileupload-fp.js</file></action>
+ </reference>
<reference name="content">
<block type="Mage_Adminhtml_Block_Newsletter_Template_Edit" name="template_edit" template="newsletter/template/edit.phtml" />
</reference>
16 app/code/core/Mage/Backend/Model/Menu/Item.php
View
@@ -153,6 +153,13 @@ class Mage_Backend_Model_Menu_Item
protected $_validator;
/**
+ * Serialized submenu string
+ *
+ * @var string
+ */
+ protected $_serializedSubmenu;
+
+ /**
* @param array $data
* @throws InvalidArgumentException
* @throws BadMethodCallException
@@ -445,6 +452,9 @@ public function isAllowed()
public function __sleep()
{
$this->_moduleHelperName = get_class($this->_moduleHelper);
+ if ($this->_submenu) {
+ $this->_serializedSubmenu = $this->_submenu->serialize();
+ }
return array(
'_parentId',
'_moduleHelperName',
@@ -457,7 +467,7 @@ public function __sleep()
'_dependsOnModule',
'_tooltip',
'_title',
- '_submenu',
+ '_serializedSubmenu'
);
}
@@ -470,5 +480,9 @@ public function __wakeup()
$this->_storeConfig = Mage::getSingleton('Mage_Core_Model_Store_Config');
$this->_menuFactory = Mage::getSingleton('Mage_Backend_Model_Menu_Factory');
$this->_urlModel = Mage::getSingleton('Mage_Backend_Model_Url');
+ if ($this->_serializedSubmenu) {
+ $this->_submenu = $this->_menuFactory->getMenuInstance();
+ $this->_submenu->unserialize($this->_serializedSubmenu);
+ }
}
}
2  app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Date.php
View
@@ -91,7 +91,7 @@ public function getCalendarDateHtml()
$yearEnd = Mage::getSingleton('Mage_Catalog_Model_Product_Option_Type_Date')->getYearEnd();
$calendar = $this->getLayout()
- ->createBlock('Mage_Core_Block_Html_Date')
+ ->createBlock('Mage_Core_Block_Html_Date_Jquery_Calendar')
->setId('options_'.$this->getOption()->getId().'_date')
->setName('options['.$this->getOption()->getId().'][date]')
->setClass('product-custom-option datetime-picker input-text' . $require)
50 app/code/core/Mage/Catalog/view/frontend/js/grid.js
View
@@ -0,0 +1,50 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category frontend grid
+ * @package mage
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
+ */
+/*jshint browser:true jquery:true*/
+(function ($) {
+ // Default fields to initialize for grid
+ var gridInit = {
+ listId: null,
+ decoratorParams: null,
+ genericSelector: null
+ };
+
+ $(document).ready(function () {
+ // Trigger initalize event
+ $.mage.event.trigger("mage.grid.initialize", gridInit);
+
+ if (gridInit.listId) {
+ $.mage.decorator.list(gridInit.listId);
+ }
+ if (gridInit.genericSelector) {
+ if (gridInit.decoratorParams) {
+ $.mage.decorator.general($(gridInit.genericSelector), gridInit.decoratorParams);
+ }
+ else {
+ $.mage.decorator.general($(gridInit.genericSelector));
+ }
+ }
+ });
+})(jQuery);
39 app/code/core/Mage/Catalog/view/frontend/js/mage-attributes-processing.js
View
@@ -0,0 +1,39 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category frontend poll
+ * @package mage
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
+ */
+/*jshint evil:true browser:true jquery:true*/
+(function ($) {
+ $(document).ready(function () {
+ $('[data-mage-redirect]').each(function () {
+ var data = eval("(" + $(this).attr('data-mage-redirect') + ")");
+ $(this).on(data.event, function () {
+ if (data.url) {
+ $(location).attr('href', data.url);
+ } else {
+ $(location).attr('href', $(this).val());
+ }
+ });
+ });
+ });
+}(jQuery));
146 app/code/core/Mage/Catalog/view/frontend/product/list.phtml
View
@@ -32,100 +32,146 @@
*/
?>
<?php
- $_productCollection=$this->getLoadedProductCollection();
- $_helper = $this->helper('Mage_Catalog_Helper_Output');
+$_productCollection = $this->getLoadedProductCollection();
+$_helper = $this->helper('Mage_Catalog_Helper_Output');
?>
-<?php if(!$_productCollection->count()): ?>
+<?php if (!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<div class="category-products">
<?php echo $this->getToolbarHtml() ?>
<?php // List mode ?>
- <?php if($this->getMode()!='grid'): ?>
+ <?php if ($this->getMode() != 'grid'): ?>
<?php $_iterator = 0; ?>
<ol class="products-list" id="products-list">
- <?php foreach ($_productCollection as $_product): ?>
- <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
+ <?php foreach ($_productCollection as $_product): ?>
+ <li class="item<?php if (++$_iterator == sizeof($_productCollection)): ?> last<?php endif; ?>">
<?php // Product Image
- $_label = $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true);
- $_size = $this->getSmallImageSize();
+ $_label = $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true);
+ $_size = $this->getSmallImageSize();
?>
- <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_label ?>" class="product-image"><img src="<?php echo $this->getSmallImageUrl($_product); ?>" width="<?php echo $_size?>" height="<?php echo $_size?>" alt="<?php echo $_label ?>" /></a>
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_label ?>" class="product-image"><img
+ src="<?php echo $this->getSmallImageUrl($_product); ?>" width="<?php echo $_size?>"
+ height="<?php echo $_size?>" alt="<?php echo $_label ?>"/></a>
<?php // Product description ?>
<div class="product-shop">
<div class="f-fix">
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
- <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
- <?php if($_product->getRatingSummary()): ?>
+ <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>"
+ title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name'); ?></a>
+ </h2>
+ <?php if ($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product) ?>
<?php endif; ?>
<?php echo $this->getPriceHtml($_product, true) ?>
- <?php if($_product->isSaleable()): ?>
- <p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
+
+ <?php if ($_product->isSaleable()): ?>
+ <p>
+ <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart"
+ data-mage-redirect="{event: 'click', url: '<?php echo $this->getAddToCartUrl($_product) ?>'}">
+ <span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
+ </p>
<?php else: ?>
- <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<div class="desc std">
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
- <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>"
+ class="link-learn"><?php echo $this->__('Learn More') ?></a>
</div>
<ul class="add-to-links">
<?php if ($this->helper('Mage_Wishlist_Helper_Data')->isAllow()) : ?>
- <li><a href="<?php echo $this->helper('Mage_Wishlist_Helper_Data')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
+ <li><a href="<?php echo $this->helper('Mage_Wishlist_Helper_Data')->getAddUrl($_product) ?>"
+ class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
<?php endif; ?>
- <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
- <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
+ <?php if ($_compareUrl = $this->getAddToCompareUrl($_product)): ?>
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>"
+ class="link-compare"><?php echo $this->__('Add to Compare') ?></a>
+ </li>
<?php endif; ?>
</ul>
</div>
</div>
</li>
- <?php endforeach; ?>
+ <?php endforeach; ?>
</ol>
- <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
-
+ <script type="text/javascript">
+ //<![CDATA[
+ (function($) {
+ $.mage.event.observe('mage.grid.initialize', function (event, initData) {
+ initData.listId = '#products-list';
+ });
+ $.mage.load.js("<?php echo $this->getSkinUrl('mage/decorate.js') ?>");
+ $.mage.load.js("<?php echo $this->getSkinUrl('Mage_Catalog::js/grid.js') ?>");
+ $.mage.load.js("<?php echo $this->getSkinUrl('Mage_Catalog::js/mage-attributes-processing.js') ?>");
+ })(jQuery);
+ //]]>
+ </script>
<?php else: ?>
<?php // Grid Mode ?>
<?php $_collectionSize = $_productCollection->count() ?>
<?php $_columnCount = $this->getColumnCount(); ?>
- <?php $i=0; foreach ($_productCollection as $_product): ?>
- <?php if ($i++%$_columnCount==0): ?>
+ <?php $i = 0;
+ foreach ($_productCollection as $_product): ?>
+ <?php if ($i++ % $_columnCount == 0): ?>
<ul class="products-grid">
<?php endif ?>
- <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
- <?php // Product Image
- $_label = $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true);
- $_size = $this->getSmallImageSize();
- ?>
- <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_label ?>" class="product-image"><img src="<?php echo $this->getSmallImageUrl($_product); ?>" width="<?php echo $_size?>" height="<?php echo $_size?>" alt="<?php echo $_label ?>" /></a>
- <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
- <?php if($_product->getRatingSummary()): ?>
- <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
+ <li class="item<?php if (($i - 1) % $_columnCount == 0): ?> first<?php elseif ($i % $_columnCount == 0): ?> last<?php endif; ?>">
+ <?php // Product Image
+ $_label = $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true);
+ $_size = $this->getSmallImageSize();
+ ?>
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_label ?>" class="product-image"><img
+ src="<?php echo $this->getSmallImageUrl($_product); ?>" width="<?php echo $_size?>"
+ height="<?php echo $_size?>" alt="<?php echo $_label ?>"/></a>
+
+ <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>"
+ title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a>
+ </h2>
+ <?php if ($_product->getRatingSummary()): ?>
+ <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
+ <?php endif; ?>
+ <?php echo $this->getPriceHtml($_product, true) ?>
+ <div class="actions">
+ <?php if ($_product->isSaleable()): ?>
+ <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart"
+ data-mage-redirect="{event: 'click', url: '<?php echo $this->getAddToCartUrl($_product) ?>'}">
+ <span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
+ <?php else: ?>
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
- <?php echo $this->getPriceHtml($_product, true) ?>
- <div class="actions">
- <?php if($_product->isSaleable()): ?>
- <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
- <?php else: ?>
- <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
+ <ul class="add-to-links">
+ <?php if ($this->helper('Mage_Wishlist_Helper_Data')->isAllow()) : ?>
+ <li><a href="<?php echo $this->helper('Mage_Wishlist_Helper_Data')->getAddUrl($_product) ?>"
+ class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
<?php endif; ?>
- <ul class="add-to-links">
- <?php if ($this->helper('Mage_Wishlist_Helper_Data')->isAllow()) : ?>
- <li><a href="<?php echo $this->helper('Mage_Wishlist_Helper_Data')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
- <?php endif; ?>
- <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
- <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
- <?php endif; ?>
- </ul>
- </div>
- </li>
- <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
+ <?php if ($_compareUrl = $this->getAddToCompareUrl($_product)): ?>
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>"
+ class="link-compare"><?php echo $this->__('Add to Compare') ?></a>
+ </li>
+ <?php endif; ?>
+ </ul>
+ </div>
+ </li>
+ <?php if ($i % $_columnCount == 0 || $i == $_collectionSize): ?>
</ul>
<?php endif ?>
<?php endforeach ?>
- <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
+ <script type="text/javascript">
+ //<![CDATA[
+ (function($) {
+ $.mage.event.observe('mage.grid.initialize', function (event, initData) {
+ initData.genericSelector = 'ul.products-grid';
+ initData.decoratorParam = ['odd', 'even', 'first', 'last'];
+ });
+ $.mage.load.js("<?php echo $this->getSkinUrl('mage/decorate.js') ?>");
+ $.mage.load.js("<?php echo $this->getSkinUrl('Mage_Catalog::js/grid.js') ?>");
+ $.mage.load.js("<?php echo $this->getSkinUrl('Mage_Catalog::js/mage-attributes-processing.js') ?>");
+ })(jQuery);
+ //]]>
+ </script>
<?php endif; ?>
<div class="toolbar-bottom">
70 app/code/core/Mage/Catalog/view/frontend/product/list/toolbar.phtml
View
@@ -31,25 +31,26 @@
* @see Mage_Catalog_Block_Product_List_Toolbar
*/
?>
-<?php if($this->getCollection()->getSize()): ?>
+<?php if ($this->getCollection()->getSize()): ?>
<div class="toolbar">
<div class="pager">
<p class="amount">
- <?php if($this->getLastPageNum()>1): ?>
- <?php echo $this->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
+ <?php if ($this->getLastPageNum() > 1): ?>
+ <?php echo $this->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
<?php else: ?>
- <strong><?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?></strong>
+ <strong><?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?></strong>
<?php endif; ?>
</p>
<div class="limiter">
<label><?php echo $this->__('Show') ?></label>
- <select onchange="setLocation(this.value)">
- <?php foreach ($this->getAvailableLimit() as $_key=>$_limit): ?>
- <option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>>
+ <select data-mage-redirect="{'event':'change'}">
+ <?php foreach ($this->getAvailableLimit() as $_key => $_limit): ?>
+ <option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if ($this->isLimitCurrent($_key)): ?>
+ selected="selected"<?php endif ?>>
<?php echo $_limit ?>
</option>
- <?php endforeach; ?>
+ <?php endforeach; ?>
</select> <?php echo $this->__('per page') ?>
</div>
@@ -57,40 +58,57 @@
</div>
- <?php if( $this->isExpanded() ): ?>
+ <?php if ($this->isExpanded()): ?>
<div class="sorter">
- <?php if( $this->isEnabledViewSwitcher() ): ?>
+ <?php if ($this->isEnabledViewSwitcher()): ?>
<p class="view-mode">
<?php $_modes = $this->getModes(); ?>
- <?php if($_modes && count($_modes)>1): ?>
+ <?php if ($_modes && count($_modes) > 1): ?>
<label><?php echo $this->__('View as') ?>:</label>
- <?php foreach ($this->getModes() as $_code=>$_label): ?>
- <?php if($this->isModeActive($_code)): ?>
- <strong title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></strong>&nbsp;
- <?php else: ?>
- <a href="<?php echo $this->getModeUrl($_code) ?>" title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></a>&nbsp;
- <?php endif; ?>
- <?php endforeach; ?>
+ <?php foreach ($this->getModes() as $_code => $_label): ?>
+ <?php if ($this->isModeActive($_code)): ?>
+ <strong title="<?php echo $_label ?>"
+ class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></strong>&nbsp;
+ <?php else: ?>
+ <a href="<?php echo $this->getModeUrl($_code) ?>" title="<?php echo $_label ?>"
+ class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></a>&nbsp;
+ <?php endif; ?>
+ <?php endforeach; ?>
<?php endif; ?>
</p>
<?php endif; ?>
-
+
<div class="sort-by">
<label><?php echo $this->__('Sort By') ?></label>
- <select onchange="setLocation(this.value)">
- <?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
- <option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
+ <select data-mage-redirect="{'event':'change'}">
+ <?php foreach ($this->getAvailableOrders() as $_key => $_order): ?>
+ <option
+ value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if ($this->isOrderCurrent($_key)): ?>
+ selected="selected"<?php endif; ?>>
<?php echo $this->__($_order) ?>
</option>
- <?php endforeach; ?>
+ <?php endforeach; ?>
</select>
- <?php if($this->getCurrentDirection() == 'desc'): ?>
- <a href="<?php echo $this->getOrderUrl(null, 'asc') ?>" title="<?php echo $this->__('Set Ascending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_desc_arrow.gif') ?>" alt="<?php echo $this->__('Set Ascending Direction') ?>" class="v-middle" /></a>
+ <?php if ($this->getCurrentDirection() == 'desc'): ?>
+ <a href="<?php echo $this->getOrderUrl(null, 'asc') ?>"
+ title="<?php echo $this->__('Set Ascending Direction') ?>"><img
+ src="<?php echo $this->getSkinUrl('images/i_desc_arrow.gif') ?>"
+ alt="<?php echo $this->__('Set Ascending Direction') ?>" class="v-middle"/></a>
<?php else: ?>
- <a href="<?php echo $this->getOrderUrl(null, 'desc') ?>" title="<?php echo $this->__('Set Descending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_asc_arrow.gif') ?>" alt="<?php echo $this->__('Set Descending Direction') ?>" class="v-middle" /></a>
+ <a href="<?php echo $this->getOrderUrl(null, 'desc') ?>"
+ title="<?php echo $this->__('Set Descending Direction') ?>"><img
+ src="<?php echo $this->getSkinUrl('images/i_asc_arrow.gif') ?>"
+ alt="<?php echo $this->__('Set Descending Direction') ?>" class="v-middle"/></a>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
+ <script type="text/javascript">
+ //<![CDATA[
+ (function($) {
+ $.mage.load.js("<?php echo $this->getSkinUrl('Mage_Catalog::js/mage-attributes-processing.js') ?>");
+ })(jQuery);
+ //]]>
+ </script>
</div>
<?php endif ?>
182 app/code/core/Mage/CatalogSearch/view/frontend/form-mini.js
View
@@ -0,0 +1,182 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category catalogsearch search
+ * @package mage
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
+ */
+/*jshint browser:true jquery:true*/
+(function ($) {
+ $(document).ready(function () {
+
+ var searchInit = {
+ // Default values
+ minSearchLength: 2,
+ responseFieldElements: 'ul li',
+ selectClass: 'selected',
+ // Filled in initialization event
+ placeholder: null,
+ destinationSelector: null,
+ fieldSelector: null,
+ formSelector: null
+ };
+ // Trigger initialize event
+ $.mage.event.trigger('mage.catalogsearch.initialize', searchInit);
+
+ var responseList = {
+ indexList: null,
+ selected: null
+ };
+
+ function getFirstVisibleElement() {
+ if (responseList.indexList) {
+ var firstElement = responseList.indexList.first();
+ return firstElement.is(':visible') ? firstElement : firstElement.next();
+ }
+ return false;
+ }
+
+ function getLastElement() {
+ if (responseList.indexList) {
+ return responseList.indexList.last();
+ }
+ return false;
+ }
+
+ function resetResponseList(all) {
+ // To reset the selected attribute on every ajax response,result hide and mouse out from list
+ responseList.selected = null;
+ if (all === true) {
+ // To reset the list on search result hide
+ responseList.indexList = null;
+ }
+ }
+
+ $(searchInit.fieldSelector).on('blur', function () {
+ if ($(this).val() === '') {
+ $(this).val(searchInit.placeholder);
+ }
+ // use setTimeout to make sure submit event happens before blur event
+ setTimeout(function () {
+ $(searchInit.destinationSelector).hide();
+ }, 250);
+ });
+
+ $(searchInit.fieldSelector).trigger('blur');
+
+ $(searchInit.fieldSelector).on('focus', function () {
+ if ($(this).val() === searchInit.placeholder) {
+ $(this).val('');
+ }
+ });
+
+ $(searchInit.fieldSelector).on('keydown', function (e) {
+
+ var keyCode = e.keyCode || e.which;
+
+ switch (keyCode) {
+
+ case $.mage.constant.KEY_ESC:
+ resetResponseList(true);
+ $(searchInit.destinationSelector).hide();
+ break;
+ case $.mage.constant.KEY_TAB:
+ $(searchInit.formSelector).trigger('submit');
+ break;
+ case $.mage.constant.KEY_DOWN:
+ if (responseList.indexList) {
+ if (!responseList.selected) {
+ getFirstVisibleElement().addClass(searchInit.selectClass);
+ responseList.selected = getFirstVisibleElement();
+ }
+ else if (!getLastElement().hasClass(searchInit.selectClass)) {
+ responseList.selected = responseList.selected.removeClass(searchInit.selectClass).next().addClass(searchInit.selectClass);
+ } else {
+ responseList.selected.removeClass(searchInit.selectClass);
+ getFirstVisibleElement().addClass(searchInit.selectClass);
+ responseList.selected = getFirstVisibleElement();
+ }
+ }
+ break;
+ case $.mage.constant.KEY_UP:
+ if (responseList.indexList !== null) {
+ if (!getFirstVisibleElement().hasClass(searchInit.selectClass)) {
+ responseList.selected = responseList.selected.removeClass(searchInit.selectClass).prev().addClass(searchInit.selectClass);
+
+ } else {
+ responseList.selected.removeClass(searchInit.selectClass);
+ getLastElement().addClass(searchInit.selectClass);
+ responseList.selected = getLastElement();
+ }
+ }
+ break;
+ default:
+ return true;
+ }
+ });
+
+ $(searchInit.formSelector).on('submit', function (e) {
+ if ($(searchInit.fieldSelector).val() === searchInit.placeholder || $(searchInit.fieldSelector).val() === '') {
+ e.preventDefault();
+ }
+ if (responseList.selected) {
+ $(searchInit.fieldSelector).val(responseList.selected.attr('title'));
+ }
+ });
+
+ $(searchInit.fieldSelector).on('input propertychange', function () {
+
+ var searchField = $(this);
+ var clonePostion = {
+ position: 'absolute',
+ left: searchField.offset().left,
+ top: searchField.offset().top + searchField.outerHeight(),
+ width: searchField.outerWidth()
+ };
+
+ if ($(this).val().length >= parseInt(searchInit.minSearchLength, 10)) {
+ $.get(searchInit.url, {q: $(this).val()}, function (data) {
+ responseList.indexList = $(searchInit.destinationSelector).html(data)
+ .css(clonePostion)
+ .show()
+ .find(searchInit.responseFieldElements);
+ resetResponseList(false);
+ responseList.indexList.on('click',function () {
+ responseList.selected = $(this);
+ $(searchInit.formSelector).trigger('submit');
+ }).on('hover',function () {
+ responseList.indexList.removeClass(searchInit.selectClass);
+ $(this).addClass(searchInit.selectClass);
+ responseList.selected = $(this);
+ }).on('mouseout', function () {
+ if (!getLastElement() && getLastElement().hasClass(searchInit.selectClass)) {
+ $(this).removeClass(searchInit.selectClass);
+ resetResponseList(false);
+ }
+ });
+ });
+ } else {
+ resetResponseList(true);
+ $(searchInit.destinationSelector).hide();
+ }
+ });
+ });
+})(jQuery);
+
12 app/code/core/Mage/CatalogSearch/view/frontend/form.mini.phtml
View
@@ -32,8 +32,16 @@
<div id="search_autocomplete" class="search-autocomplete"></div>
<script type="text/javascript">
//<![CDATA[
- var searchForm = new Varien.searchForm('search_mini_form', 'search', '<?php echo $this->__('Search entire store here...') ?>');
- searchForm.initAutocomplete('<?php echo $this->helper('Mage_CatalogSearch_Helper_Data')->getSuggestUrl() ?>', 'search_autocomplete');
+ (function($) {
+ $.mage.event.observe('mage.catalogsearch.initialize', function (e, o) {
+ o.formSelector = '#search_mini_form',
+ o.fieldSelector = '#search',
+ o.placeholder = '<?php echo $this->__('Search entire store here...') ?>',
+ o.url = '<?php echo $this->helper('Mage_CatalogSearch_Helper_Data')->getSuggestUrl() ?>',
+ o.destinationSelector = '#search_autocomplete'
+ });
+ $.mage.load.jsSync("<?php echo $this->getSkinUrl('Mage_CatalogSearch::form-mini.js') ?>");
+ })(jQuery);
//]]>
</script>
</div>
6 app/code/core/Mage/Checkout/etc/system.xml
View
@@ -34,7 +34,7 @@
<sort_order>305</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
- <show_in_store>0</show_in_store>
+ <show_in_store>1</show_in_store>
<resource>Mage_Checkout::checkout</resource>
<groups>
<options translate="label">
@@ -43,7 +43,7 @@
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
- <show_in_store>0</show_in_store>
+ <show_in_store>1</show_in_store>
<fields>
<onepage_checkout_enabled translate="label">
<label>Enable Onepage Checkout</label>
@@ -72,7 +72,7 @@
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
- </customer_must_be_logged>
+ </customer_must_be_logged>
<enable_agreements translate="label">
<label>Enable Terms and Conditions</label>
<frontend_type>select</frontend_type>
66 app/code/core/Mage/Checkout/view/frontend/cart/sidebar.phtml
View
@@ -31,50 +31,68 @@
*/
?>
-<?php if ($this->getIsNeedToDisplaySideBar()):?>
+<?php if ($this->getIsNeedToDisplaySideBar()): ?>
<div class="block block-cart">
<?php $_cartQty = $this->getSummaryCount() ?>
<div class="block-title">
<strong><span><?php echo $this->__('My Cart') ?></span></strong>
</div>
<div class="block-content">
- <?php if ($_cartQty>0): ?>
+ <?php if ($_cartQty > 0): ?>
<div class="summary">
- <?php if ($_cartQty==1): ?>
- <p class="amount"><?php echo $this->__('There is <a href="%s">1 item</a> in your cart.', $this->getUrl('checkout/cart')) ?></p>
+ <?php if ($_cartQty == 1): ?>
+ <p class="amount"><?php echo $this->__('There is <a href="%s">1 item</a> in your cart.', $this->getUrl('checkout/cart')) ?></p>
<?php else: ?>
- <p class="amount"><?php echo $this->__('There are <a href="%s">%s items</a> in your cart.', $this->getUrl('checkout/cart'), $_cartQty) ?></p>
+ <p class="amount"><?php echo $this->__('There are <a href="%s">%s items</a> in your cart.', $this->getUrl('checkout/cart'), $_cartQty) ?></p>