Diglin_Username - Version 2.0.1

Version Notes

- 2.0.1:
- Add composer, modman, MageTrashApp support to help installing and uninstalling this module
- Move template to design base package
- Fix several bugs like saving username from frontend, checkout process as guest, etc
- Follow best practices for module setup
- Version 1.5.0: update for Magento 1.7
- Version 1.4.0: fix a problem to enable and disable a customer account from Customer Management in backend
- Version 1.3.0: new features. Configurable options: display username in Manage Customer Grid, allow customer to edit or not username in frontend My Account, define maximum and minimum length of username for the forms, define what kind of validation desired (letters, digits, both or both " _-)
- Version 1.2.1: fix customer account layout
- Version 1.2.0: fix problem with case sensitive OS, limit the number of characters possible (now it's between 6 and 30 letters), allow only some characters, try to provide compatibility update for users who had the old Jfusion_Username module, generate a username for old customers who don't have it, based on email address and a random id, improve the german translation, tested on 1.6.2 and 1.5.1
- Version 1.1.0: change the module name from Jfusion_Customer to Diglin_Username, fix bugs with checkout frontend and backend and with old customers
- Version 1.0.2 - fix a bug with the installation
- Version 1.0.1 - fix bug in sql query during installation on prefixed tables, add german translation, do package for Magento version prior to 1.5 and version 1.5.x
- Version 1.0.0 - stable version

Download this release

Release Info

Developer diglin
Extension Diglin_Username
Version 2.0.1
Comparing to
See all releases


Code changes from version 1.5.0 to 2.0.1

Files changed (65) hide show
  1. app/code/community/Diglin/Username/Block/Overwrite/Adminhtml/Config/Source/Hint.php +2 -2
  2. app/code/community/Diglin/Username/Block/Overwrite/Adminhtml/Grid.php +1 -1
  3. app/code/community/Diglin/Username/Helper/Data.php +11 -2
  4. app/code/community/Diglin/Username/Model/Config/Share.php +39 -0
  5. app/code/community/Diglin/Username/Model/Config/Source/Inputvalidation.php +1 -1
  6. app/code/community/Diglin/Username/Model/Customer.php +3 -2
  7. app/code/community/Diglin/Username/Model/Entity/Customer.php +43 -15
  8. app/code/community/Diglin/Username/Model/Entity/Setup.php +48 -14
  9. app/code/community/Diglin/Username/Model/Form.php +22 -16
  10. app/code/community/Diglin/Username/Model/Import/Entity/Customer.php +122 -0
  11. app/code/community/Diglin/Username/Model/Observer.php +44 -15
  12. app/code/community/Diglin/Username/controllers/AccountController.php +60 -0
  13. app/code/community/Diglin/Username/data/username_setup/data-install-2.0.0.php +46 -0
  14. app/code/community/Diglin/Username/etc/config.xml +24 -4
  15. app/code/community/Diglin/Username/etc/system.xml +19 -1
  16. app/code/community/Diglin/Username/etc/uninstall.txt +8 -0
  17. app/code/community/Diglin/Username/sql/username_setup/install-2.0.0.php +63 -0
  18. app/code/community/Diglin/Username/sql/username_setup/mysql4-install-1.0.0.php +1 -1
  19. app/code/community/Diglin/Username/sql/username_setup/mysql4-upgrade-1.0.0-1.1.0.php +1 -1
  20. app/code/community/Diglin/Username/sql/username_setup/mysql4-upgrade-1.1.0-1.2.0.php +1 -1
  21. app/code/community/Diglin/Username/sql/username_setup/mysql4-upgrade-1.3.0-1.4.0.php +2 -2
  22. app/code/community/Diglin/Username/sql/username_setup/mysql4-upgrade-1.4.0-2.0.0.php +28 -0
  23. app/code/community/Diglin/Username/sql/username_setup/uninstall.php +16 -0
  24. app/code/community/Hackathon/MageTrashApp/Adminhtml/Block/System/Config/Form/Fieldset/Modules/MageTrashApp.php +91 -0
  25. app/code/community/Hackathon/MageTrashApp/Block/Adminhtml/System/Config/Form/Fieldset/Modules/MageTrashApp.php +91 -0
  26. app/code/community/Hackathon/MageTrashApp/Block/Adminhtml/System/Config/Form/Fieldset/Modules/Rewind.php +120 -0
  27. app/code/community/Hackathon/MageTrashApp/Helper/Data.php +180 -0
  28. app/code/community/Hackathon/MageTrashApp/Model/Adminhtml/Config/Data.php +173 -0
  29. app/code/community/Hackathon/MageTrashApp/Model/CoreResource.php +47 -0
  30. app/code/community/Hackathon/MageTrashApp/Model/Observer.php +67 -0
  31. app/code/community/Hackathon/MageTrashApp/Model/PearWrapper.php +245 -0
  32. app/code/community/Hackathon/MageTrashApp/Model/Resource/Resource.php +28 -0
  33. app/code/community/Hackathon/MageTrashApp/Model/Resource/Setup.php +37 -0
  34. app/code/community/Hackathon/MageTrashApp/Model/Uninstall.php +196 -0
  35. app/code/community/Hackathon/MageTrashApp/Test/Config/Config.php +8 -0
  36. app/code/community/Hackathon/MageTrashApp/Test/Helper/DataTest.php +45 -0
  37. app/code/community/Hackathon/MageTrashApp/Test/Model/Observer.php +12 -0
  38. app/code/community/Hackathon/MageTrashApp/controllers/Adminhtml/indexController.php +26 -0
  39. app/code/community/Hackathon/MageTrashApp/etc/adminhtml.xml +22 -0
  40. app/code/community/Hackathon/MageTrashApp/etc/config.xml +85 -0
  41. app/code/community/Hackathon/MageTrashApp/etc/doc.uninstall.txt +20 -0
  42. app/code/community/Hackathon/MageTrashApp/etc/system.xml +35 -0
  43. app/design/frontend/base/default/layout/username.xml +76 -0
  44. app/design/frontend/base/default/template/username/checkout/onepage/13/billing.phtml +216 -0
  45. app/design/frontend/{default/default/template/username/checkout/onepage → base/default/template/username/checkout/onepage/17}/billing.phtml +3 -197
  46. app/design/frontend/base/default/template/username/checkout/onepage/billing.phtml +33 -0
  47. app/design/frontend/{default → base}/default/template/username/checkout/onepage/login.phtml +9 -0
  48. app/design/frontend/base/default/template/username/customer/account/dashboard/info.phtml +50 -0
  49. app/design/frontend/base/default/template/username/customer/form/13/register.phtml +190 -0
  50. app/design/frontend/{default/default/template/username/customer/form → base/default/template/username/customer/form/17}/register.phtml +6 -169
  51. app/design/frontend/{default → base}/default/template/username/customer/form/edit.phtml +4 -4
  52. app/design/frontend/base/default/template/username/customer/form/forgotpassword.phtml +57 -0
  53. app/design/frontend/{default → base}/default/template/username/customer/form/login.phtml +4 -4
  54. app/design/frontend/base/default/template/username/customer/form/register.phtml +34 -0
  55. app/design/frontend/base/default/template/username/persistent/checkout/onepage/billing.phtml +235 -0
  56. app/design/frontend/base/default/template/username/persistent/checkout/onepage/login.phtml +163 -0
  57. app/design/frontend/base/default/template/username/persistent/customer/form/login.phtml +95 -0
  58. app/design/frontend/base/default/template/username/persistent/customer/form/register.phtml +201 -0
  59. app/design/frontend/default/default/layout/username.xml +0 -62
  60. app/design/frontend/default/default/template/username/checkout/.DS_Store +0 -0
  61. app/design/frontend/default/default/template/username/customer/account/dashboard/info.phtml +0 -65
  62. app/etc/modules/Diglin_Username.xml +11 -12
  63. app/etc/modules/Hackathon_MageTrashApp.xml +9 -0
  64. app/locale/de_DE/Diglin_Username.csv +4 -4
  65. package.xml +27 -16
app/code/community/Diglin/Username/Block/Overwrite/Adminhtml/Config/Source/Hint.php CHANGED
@@ -12,7 +12,7 @@
12
  *
13
  * @category Diglin
14
  * @package Diglin_Username
15
- * @copyright Copyright (c) 2011-2012 Diglin (http://www.diglin.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
  class Diglin_Username_Block_Overwrite_Adminhtml_Config_Source_Hint
@@ -30,6 +30,6 @@ class Diglin_Username_Block_Overwrite_Adminhtml_Config_Source_Hint
30
  {
31
  $version = Mage::getConfig()->getModuleConfig('Diglin_Username')->version;
32
  return '<p><a href="javascript:window.open(\'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y66QHLU5VX5BC\')"><img src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" alt="Donate via Paypal" /> </a>Please, Invite me for a drink for the hard work done. Thank you in advance for your donation</p>
33
- <p><strong>Diglin_Chat Version: '.$version.'</strong></p>';
34
  }
35
  }
12
  *
13
  * @category Diglin
14
  * @package Diglin_Username
15
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
  class Diglin_Username_Block_Overwrite_Adminhtml_Config_Source_Hint
30
  {
31
  $version = Mage::getConfig()->getModuleConfig('Diglin_Username')->version;
32
  return '<p><a href="javascript:window.open(\'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y66QHLU5VX5BC\')"><img src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" alt="Donate via Paypal" /> </a>Please, Invite me for a drink for the hard work done. Thank you in advance for your donation</p>
33
+ <p><strong>Diglin_Username Version: '.$version.'</strong></p>';
34
  }
35
  }
app/code/community/Diglin/Username/Block/Overwrite/Adminhtml/Grid.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
- * @copyright Copyright (c) 2011-2012 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
  class Diglin_Username_Block_Overwrite_Adminhtml_Grid extends Mage_Adminhtml_Block_Customer_Grid
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
  class Diglin_Username_Block_Overwrite_Adminhtml_Grid extends Mage_Adminhtml_Block_Customer_Grid
app/code/community/Diglin/Username/Helper/Data.php CHANGED
@@ -4,7 +4,16 @@
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
- * @copyright Copyright (c) 2011-2012 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
- class Diglin_Username_Helper_Data extends Mage_Core_Helper_Abstract {}
 
 
 
 
 
 
 
 
 
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
+ class Diglin_Username_Helper_Data extends Mage_Core_Helper_Abstract
11
+ {
12
+ public function isPersistentMustBeEnabled ()
13
+ {
14
+ return Mage::getStoreConfigFlag('username/general/enabled')
15
+ && Mage::helper('core')->isModuleEnabled('persistent')
16
+ && Mage::helper('core')->isModuleOutputEnabled('persistent')
17
+ && Mage::helper('persistent')->isEnabled();
18
+ }
19
+ }
app/code/community/Diglin/Username/Model/Config/Share.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * @category Diglin
6
+ * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ /**
12
+ * Customer sharing config model
13
+ *
14
+ * @category Diglin
15
+ * @package Diglin_Username
16
+ */
17
+ class Diglin_Username_Model_Config_Share extends Mage_Customer_Model_Config_Share
18
+ {
19
+ /**
20
+ * Check for username dublicates before saving customers sharing options
21
+ *
22
+ * @return Mage_Customer_Model_Config_Share
23
+ * @throws Mage_Core_Exception
24
+ */
25
+ public function _beforeSave()
26
+ {
27
+ parent::_beforeSave();
28
+
29
+ $value = $this->getValue();
30
+ if ($value == self::SHARE_GLOBAL) {
31
+ if (Mage::getResourceSingleton('customer/customer')->findUsernameDuplicates()) {
32
+ Mage::throwException(
33
+ Mage::helper('customer')->__('Cannot share customer accounts globally because some customer accounts with the same username exist on multiple websites and cannot be merged.')
34
+ );
35
+ }
36
+ }
37
+ return $this;
38
+ }
39
+ }
app/code/community/Diglin/Username/Model/Config/Source/Inputvalidation.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
- * @copyright Copyright (c) 2011-2012 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
  class Diglin_Username_Model_Config_Source_InputValidation
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
  class Diglin_Username_Model_Config_Source_InputValidation
app/code/community/Diglin/Username/Model/Customer.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
- * @copyright Copyright (c) 2011-2012 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
  class Diglin_Username_Model_Customer extends Mage_Customer_Model_Customer{
@@ -21,9 +21,10 @@ class Diglin_Username_Model_Customer extends Mage_Customer_Model_Customer{
21
  {
22
  if(Zend_Validate::is($login, 'EmailAddress')){
23
  $this->loadByEmail($login);
24
- }else{
25
  $this->loadByUsername($login);
26
  }
 
27
  if ($this->getConfirmation() && $this->isConfirmationRequired()) {
28
  throw Mage::exception('Mage_Core', Mage::helper('customer')->__('This account is not confirmed.'),
29
  self::EXCEPTION_EMAIL_NOT_CONFIRMED
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
  class Diglin_Username_Model_Customer extends Mage_Customer_Model_Customer{
21
  {
22
  if(Zend_Validate::is($login, 'EmailAddress')){
23
  $this->loadByEmail($login);
24
+ }else if (Mage::getStoreConfigFlag('username/general/enabled')) {
25
  $this->loadByUsername($login);
26
  }
27
+
28
  if ($this->getConfirmation() && $this->isConfirmationRequired()) {
29
  throw Mage::exception('Mage_Core', Mage::helper('customer')->__('This account is not confirmed.'),
30
  self::EXCEPTION_EMAIL_NOT_CONFIRMED
app/code/community/Diglin/Username/Model/Entity/Customer.php CHANGED
@@ -4,25 +4,27 @@
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
- * @copyright Copyright (c) 2011-2012 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
- class Diglin_Username_Model_Entity_Customer extends Mage_Customer_Model_Entity_Customer{
11
 
12
  protected function _beforeSave(Varien_Object $customer)
13
  {
14
  parent::_beforeSave($customer);
15
 
16
- if ($customer->getSharingConfig()->isWebsiteScope()) {
17
- $websiteId = (int) $customer->getWebsiteId();
18
- }else{
19
- $websiteId = null;
20
- }
21
-
22
- $model = Mage::getModel('customer/customer');
23
- $result = $model->customerUsernameExists($customer->getUsername(), $websiteId);
24
- if ($result && $result->getId() != $customer->getId()) {
25
- throw Mage::exception('Mage_Core', Mage::helper('customer')->__("Username already exists"));
 
 
26
  }
27
 
28
  return $this;
@@ -45,13 +47,16 @@ class Diglin_Username_Model_Entity_Customer extends Mage_Customer_Model_Entity_C
45
  */
46
  public function loadByUsername(Mage_Customer_Model_Customer $customer, $username)
47
  {
48
- $filter = new Zend_Filter_StringToLower(array('encoding' => 'UTF-8'));
49
- $username = $filter->filter($username);
 
 
50
  $select = $this->_getReadAdapter()->select()
51
  ->from($this->getEntityTable(), array($this->getEntityIdField()))
52
  ->joinNatural(array('cev' => $this->getTable('customer_entity_varchar')))
53
- ->joinNatural(array('ea' => $this->getTable('eav_attribute')))
54
  ->where('ea.attribute_code=\'username\' AND cev.value=?',$username);
 
55
  if ($customer->getSharingConfig()->isWebsiteScope()) {
56
  if (!$customer->hasData('website_id')) {
57
  Mage::throwException(Mage::helper('customer')->__('Customer website ID must be specified when using the website scope.'));
@@ -67,4 +72,27 @@ class Diglin_Username_Model_Entity_Customer extends Mage_Customer_Model_Entity_C
67
  }
68
  return $this;
69
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  }
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
+ class Diglin_Username_Model_Entity_Customer extends Mage_Customer_Model_Resource_Customer {
11
 
12
  protected function _beforeSave(Varien_Object $customer)
13
  {
14
  parent::_beforeSave($customer);
15
 
16
+ if (Mage::getStoreConfigFlag('username/general/enabled')) {
17
+ if ($customer->getSharingConfig()->isWebsiteScope()) {
18
+ $websiteId = (int) $customer->getWebsiteId();
19
+ }else{
20
+ $websiteId = null;
21
+ }
22
+
23
+ $model = Mage::getModel('customer/customer');
24
+ $result = $model->customerUsernameExists($customer->getUsername(), $websiteId);
25
+ if ($result && $result->getId() != $customer->getId()) {
26
+ throw Mage::exception('Mage_Core', Mage::helper('customer')->__("Username already exists"));
27
+ }
28
  }
29
 
30
  return $this;
47
  */
48
  public function loadByUsername(Mage_Customer_Model_Customer $customer, $username)
49
  {
50
+ if (!Mage::getStoreConfigFlag('username/general/case_sensitive')) {
51
+ $filter = new Zend_Filter_StringToLower(array('encoding' => 'UTF-8'));
52
+ $username = $filter->filter($username);
53
+ }
54
  $select = $this->_getReadAdapter()->select()
55
  ->from($this->getEntityTable(), array($this->getEntityIdField()))
56
  ->joinNatural(array('cev' => $this->getTable('customer_entity_varchar')))
57
+ ->joinNatural(array('ea' => $this->getTable('eav/attribute')))
58
  ->where('ea.attribute_code=\'username\' AND cev.value=?',$username);
59
+
60
  if ($customer->getSharingConfig()->isWebsiteScope()) {
61
  if (!$customer->hasData('website_id')) {
62
  Mage::throwException(Mage::helper('customer')->__('Customer website ID must be specified when using the website scope.'));
72
  }
73
  return $this;
74
  }
75
+
76
+ /**
77
+ * Check whether there are username duplicates of customers in global scope
78
+ *
79
+ * @return bool
80
+ */
81
+ public function findUsernameDuplicates()
82
+ {
83
+ $adapter = $this->_getReadAdapter();
84
+ $select = $adapter->select()
85
+ ->from(array('cev' => $this->getTable('customer_entity_varchar')), array('cnt' => 'COUNT(*)'))
86
+ ->joinLeft(array('ea' => $this->getTable('eav/attribute')), 'ea.attribute_id = cev.attribute_id')
87
+ ->where('ea.attribute_code=\'username\'')
88
+ ->group('cev.value')
89
+ ->order('cnt DESC')
90
+ ->limit(1);
91
+
92
+ $lookup = $adapter->fetchRow($select);
93
+ if (empty($lookup)) {
94
+ return false;
95
+ }
96
+ return $lookup['cnt'] > 1;
97
+ }
98
  }
app/code/community/Diglin/Username/Model/Entity/Setup.php CHANGED
@@ -4,30 +4,64 @@
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
- * @copyright Copyright (c) 2011-2012 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
- class Diglin_Username_Model_Entity_Setup extends Mage_Customer_Model_Entity_Setup{
 
11
 
12
  public function getDefaultEntities()
13
  {
14
- $entities = parent::getDefaultEntities();
15
-
16
- $entities['customer']['attributes'] = array(
 
 
 
 
 
 
 
 
 
 
17
  'username' => array(
18
  'type' => 'varchar',
19
  'input' => 'text',
20
  'label' => 'Username',
21
- 'sort_order' => 44,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  )
23
  );
24
-
25
- $entities['customer']['attributes'][] = array('is_active' => array(
26
- 'label' => 'Active',
27
- 'visible' => true,
28
- 'sort_order' => 40,
29
- ));
30
-
31
- return $entities;
32
  }
33
  }
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
+ class Diglin_Username_Model_Entity_Setup extends Mage_Customer_Model_Resource_Setup
11
+ {
12
 
13
  public function getDefaultEntities()
14
  {
15
+ return $this->getAdditionalAttributes(parent::getDefaultEntities());
16
+ }
17
+
18
+ /**
19
+ *
20
+ * To be used directly by install script or by setup class
21
+ *
22
+ * @param null $entities
23
+ * @return array
24
+ */
25
+ public function getAdditionalAttributes ($entities = null)
26
+ {
27
+ $newEntity = array(
28
  'username' => array(
29
  'type' => 'varchar',
30
  'input' => 'text',
31
  'label' => 'Username',
32
+ 'visible' => true,
33
+ 'required' => false,
34
+ 'sort_order' => 44,
35
+ 'position' => 44,
36
+ 'adminhtml_customer' => 1,
37
+ 'adminhtml_checkout' => 1,
38
+ 'validate_rules' => serialize(array(
39
+ 'max_text_length' => 30,
40
+ 'min_text_length' => 6
41
+ )),
42
+ ),
43
+ 'is_active' => array(
44
+ 'group' => 'Account information',
45
+ 'label' => 'Active',
46
+ 'type' => 'static',
47
+ 'input' => 'select',
48
+ 'user_defined' => true,
49
+ 'source' => 'eav/entity_attribute_source_boolean',
50
+ 'required' => false,
51
+ 'default' => true,
52
+ 'visible' => true,
53
+ 'visible_on_front' => false,
54
+ 'sort_order' => 40,
55
+ 'position' => 40,
56
+ 'adminhtml_only' => 1
57
  )
58
  );
59
+
60
+ // In this case we just need the array of the data and set manually the attribute
61
+ if (is_null($entities)) {
62
+ return $newEntity;
63
+ }
64
+
65
+ return $entities['customer']['attributes'] = array_merge($entities['customer']['attributes'], $newEntity);
 
66
  }
67
  }
app/code/community/Diglin/Username/Model/Form.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
- * @copyright Copyright (c) 2011-2012 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
  class Diglin_Username_Model_Form extends Mage_Customer_Model_Form
@@ -16,13 +16,13 @@ class Diglin_Username_Model_Form extends Mage_Customer_Model_Form
16
  public function extractData (Zend_Controller_Request_Http $request, $scope = null, $scopeOnly = true)
17
  {
18
  $data = parent::extractData($request, $scope, $scopeOnly);
19
- if(isset($data['username'])) {
20
  $filter = new Zend_Filter_StringToLower(array('encoding' => 'UTF-8'));
21
  $data['username'] = $filter->filter($data['username']);
22
  }
23
  return $data;
24
  }
25
-
26
  /**
27
  * (non-PHPdoc)
28
  * @see Mage_Customer_Model_Form::validateData()
@@ -30,17 +30,20 @@ class Diglin_Username_Model_Form extends Mage_Customer_Model_Form
30
  public function validateData (array $data)
31
  {
32
  $errors = parent::validateData($data);
 
33
  if (isset($data['username'])) {
34
  $model = Mage::getModel('customer/customer');
 
35
  $customerId = Mage::app()->getFrontController()
36
  ->getRequest()
37
  ->getParam('customer_id');
 
38
  if (! $customerId) {
39
  $customerId = Mage::app()->getFrontController()
40
  ->getRequest()
41
  ->getParam('id');
42
  }
43
-
44
  if (isset($data['website_id']) && $data['website_id'] !== false) {
45
  $websiteId = $data['website_id'];
46
  } elseif ($customerId) {
@@ -52,24 +55,27 @@ class Diglin_Username_Model_Form extends Mage_Customer_Model_Form
52
  } else {
53
  $websiteId = Mage::app()->getWebsite()->getId();
54
  }
55
-
 
 
 
 
 
 
 
 
 
 
 
56
  $validate = new Zend_Validate_Regex('/^[\w-]*$/');
57
  if(Mage::getStoreConfig('username/general/input_validation') == 'default' && ! $validate->isValid($data['username']) ){
58
  $message = Mage::helper('username')->__('Username is invalid! Only letters, digits and \'_-\' values are accepted.');
59
- if ($errors === true) {
60
- $errors = array();
61
- }
62
  $errors = array_merge($errors, array($message));
63
  }
64
-
65
  $result = $model->customerUsernameExists($data['username'], $websiteId);
66
- if ($result && $result->getId() != Mage::app()->getFrontController()
67
- ->getRequest()
68
- ->getParam('id') && $result->getId() != Mage::getSingleton('customer/session')->getCustomerId('id')) {
69
- $message = Mage::helper('username')->__("Username already exists");
70
- if ($errors === true) {
71
- $errors = array();
72
- }
73
  $errors = array_merge($errors, array($message));
74
  }
75
  }
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
  class Diglin_Username_Model_Form extends Mage_Customer_Model_Form
16
  public function extractData (Zend_Controller_Request_Http $request, $scope = null, $scopeOnly = true)
17
  {
18
  $data = parent::extractData($request, $scope, $scopeOnly);
19
+ if(isset($data['username']) && !Mage::getStoreConfigFlag('username/general/case_sensitive')) {
20
  $filter = new Zend_Filter_StringToLower(array('encoding' => 'UTF-8'));
21
  $data['username'] = $filter->filter($data['username']);
22
  }
23
  return $data;
24
  }
25
+
26
  /**
27
  * (non-PHPdoc)
28
  * @see Mage_Customer_Model_Form::validateData()
30
  public function validateData (array $data)
31
  {
32
  $errors = parent::validateData($data);
33
+
34
  if (isset($data['username'])) {
35
  $model = Mage::getModel('customer/customer');
36
+
37
  $customerId = Mage::app()->getFrontController()
38
  ->getRequest()
39
  ->getParam('customer_id');
40
+
41
  if (! $customerId) {
42
  $customerId = Mage::app()->getFrontController()
43
  ->getRequest()
44
  ->getParam('id');
45
  }
46
+
47
  if (isset($data['website_id']) && $data['website_id'] !== false) {
48
  $websiteId = $data['website_id'];
49
  } elseif ($customerId) {
55
  } else {
56
  $websiteId = Mage::app()->getWebsite()->getId();
57
  }
58
+
59
+ if (!is_array($errors)) {
60
+ $errors = array();
61
+ }
62
+
63
+ $isCheckoutAsGuest = Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod();
64
+ if ($isCheckoutAsGuest != Mage_Checkout_Model_Type_Onepage::METHOD_GUEST && empty($data['username'])) {
65
+ $message = Mage::helper('username')->__('Username is a required field.');
66
+ $errors = array_merge($errors, array($message));
67
+ }
68
+
69
+ // Other rules are validated by the parent class because they are basic rules provided by Magento Core
70
  $validate = new Zend_Validate_Regex('/^[\w-]*$/');
71
  if(Mage::getStoreConfig('username/general/input_validation') == 'default' && ! $validate->isValid($data['username']) ){
72
  $message = Mage::helper('username')->__('Username is invalid! Only letters, digits and \'_-\' values are accepted.');
 
 
 
73
  $errors = array_merge($errors, array($message));
74
  }
75
+
76
  $result = $model->customerUsernameExists($data['username'], $websiteId);
77
+ if ($result && $result->getId() != $customerId) {
78
+ $message = Mage::helper('username')->__('Username already exists');
 
 
 
 
 
79
  $errors = array_merge($errors, array($message));
80
  }
81
  }
app/code/community/Diglin/Username/Model/Import/Entity/Customer.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * @category Diglin
6
+ * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Diglin_Username_Model_Import_Entity_Customer extends Mage_ImportExport_Model_Import_Entity_Customer
11
+ {
12
+ /**
13
+ * Gather and save information about customer entities.
14
+ *
15
+ * Diglin: make is_active for new customer importeable
16
+ * clst: make is_active updateable for existing customers
17
+ *
18
+ * @return Mage_ImportExport_Model_Import_Entity_Customer
19
+ */
20
+ protected function _saveCustomers()
21
+ {
22
+ /** @var $resource Mage_Customer_Model_Customer */
23
+ $resource = Mage::getModel('customer/customer');
24
+ $strftimeFormat = Varien_Date::convertZendToStrftime(Varien_Date::DATETIME_INTERNAL_FORMAT, true, true);
25
+ $table = $resource->getResource()->getEntityTable();
26
+ $nextEntityId = Mage::getResourceHelper('importexport')->getNextAutoincrement($table);
27
+ $passId = $resource->getAttribute('password_hash')->getId();
28
+ $passTable = $resource->getAttribute('password_hash')->getBackend()->getTable();
29
+
30
+ while ($bunch = $this->_dataSourceModel->getNextBunch()) {
31
+ $entityRowsIn = array();
32
+ $entityRowsUp = array();
33
+ $attributes = array();
34
+
35
+ foreach ($bunch as $rowNum => $rowData) {
36
+ if (!$this->validateRow($rowData, $rowNum)) {
37
+ continue;
38
+ }
39
+ if (self::SCOPE_DEFAULT == $this->getRowScope($rowData)) {
40
+ // entity table data
41
+ $entityRow = array(
42
+ 'group_id' => empty($rowData['group_id']) ? self::DEFAULT_GROUP_ID : $rowData['group_id'],
43
+ 'store_id' => empty($rowData[self::COL_STORE])
44
+ ? 0 : $this->_storeCodeToId[$rowData[self::COL_STORE]],
45
+ 'created_at' => empty($rowData['created_at'])
46
+ ? now() : gmstrftime($strftimeFormat, strtotime($rowData['created_at'])),
47
+ 'updated_at' => now(),
48
+ 'is_active' => empty($rowData['is_active']) ? 1 : $this->_attributes['is_active']['options'][$rowData['is_active']]
49
+ );
50
+ if (isset($this->_oldCustomers[$rowData[self::COL_EMAIL]][$rowData[self::COL_WEBSITE]])) { // edit
51
+ $entityId = $this->_oldCustomers[$rowData[self::COL_EMAIL]][$rowData[self::COL_WEBSITE]];
52
+ $entityRow['entity_id'] = $entityId;
53
+ $entityRowsUp[] = $entityRow;
54
+ } else { // create
55
+ $entityId = $nextEntityId++;
56
+ $entityRow['entity_id'] = $entityId;
57
+ $entityRow['entity_type_id'] = $this->_entityTypeId;
58
+ $entityRow['attribute_set_id'] = 0;
59
+ $entityRow['website_id'] = $this->_websiteCodeToId[$rowData[self::COL_WEBSITE]];
60
+ $entityRow['email'] = $rowData[self::COL_EMAIL];
61
+ $entityRowsIn[] = $entityRow;
62
+
63
+ $this->_newCustomers[$rowData[self::COL_EMAIL]][$rowData[self::COL_WEBSITE]] = $entityId;
64
+ }
65
+ // attribute values
66
+ foreach (array_intersect_key($rowData, $this->_attributes) as $attrCode => $value) {
67
+ if (!$this->_attributes[$attrCode]['is_static'] && strlen($value)) {
68
+ /** @var $attribute Mage_Customer_Model_Attribute */
69
+ $attribute = $resource->getAttribute($attrCode);
70
+ $backModel = $attribute->getBackendModel();
71
+ $attrParams = $this->_attributes[$attrCode];
72
+
73
+ if ('select' == $attrParams['type']) {
74
+ $value = $attrParams['options'][strtolower($value)];
75
+ } elseif ('datetime' == $attrParams['type']) {
76
+ $value = gmstrftime($strftimeFormat, strtotime($value));
77
+ } elseif ($backModel) {
78
+ $attribute->getBackend()->beforeSave($resource->setData($attrCode, $value));
79
+ $value = $resource->getData($attrCode);
80
+ }
81
+ $attributes[$attribute->getBackend()->getTable()][$entityId][$attrParams['id']] = $value;
82
+
83
+ // restore 'backend_model' to avoid default setting
84
+ $attribute->setBackendModel($backModel);
85
+ }
86
+ }
87
+ // password change/set
88
+ if (isset($rowData['password']) && strlen($rowData['password'])) {
89
+ $attributes[$passTable][$entityId][$passId] = $resource->hashPassword($rowData['password']);
90
+ }
91
+ }
92
+ }
93
+ $this->_saveCustomerEntity($entityRowsIn, $entityRowsUp)->_saveCustomerAttributes($attributes);
94
+ }
95
+ return $this;
96
+ }
97
+
98
+ /**
99
+ * Update and insert data in entity table.
100
+ *
101
+ * clst: make is_active updateable for existing customers
102
+ *
103
+ * @param array $entityRowsIn Row for insert
104
+ * @param array $entityRowsUp Row for update
105
+ * @return Mage_ImportExport_Model_Import_Entity_Customer
106
+ */
107
+ protected function _saveCustomerEntity(array $entityRowsIn, array $entityRowsUp)
108
+ {
109
+ if ($entityRowsIn) {
110
+ $this->_connection->insertMultiple($this->_entityTable, $entityRowsIn);
111
+ }
112
+ if ($entityRowsUp) {
113
+ $this->_connection->insertOnDuplicate(
114
+ $this->_entityTable,
115
+ $entityRowsUp,
116
+ array('group_id', 'store_id', 'updated_at', 'created_at', 'is_active')
117
+ );
118
+ }
119
+ return $this;
120
+ }
121
+
122
+ }
app/code/community/Diglin/Username/Model/Observer.php CHANGED
@@ -4,11 +4,19 @@
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
- * @copyright Copyright (c) 2011-2012 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
- class Diglin_Username_Model_Observer extends Mage_Customer_Model_Observer {
11
-
 
 
 
 
 
 
 
 
12
  public function isActive($observer)
13
  {
14
  $customer = $observer->getEvent()->getModel();
@@ -17,17 +25,30 @@ class Diglin_Username_Model_Observer extends Mage_Customer_Model_Observer {
17
  throw new Mage_Core_Exception(Mage::helper('customer')->__('This account is disabled.'), 0);
18
  }
19
  }
20
-
 
 
 
 
 
 
 
21
  public function addAttributeToCollection ($observer)
22
  {
 
23
  $collection = $observer->getEvent()->getCollection();
24
- $collection->addAttributeToSelect('username');
 
 
 
25
  }
26
 
27
  /**
28
  * Change the attribute of username after the configuration
29
  * has been changed
30
- *
 
 
31
  * @param Varien_Event_Observer $observer
32
  */
33
  public function changeEavAttribute ($observer)
@@ -46,17 +67,25 @@ class Diglin_Username_Model_Observer extends Mage_Customer_Model_Observer {
46
 
47
  /* @var $attributeUsernameModel Mage_Customer_Model_Attribute */
48
  $attributeUsernameModel = Mage::getModel('customer/attribute')->loadByCode('customer', 'username');
49
- $rules = $attributeUsernameModel->getValidateRules();
50
- $rules['max_text_length'] = $maxLength;
51
- $rules['min_text_length'] = $minLength;
52
-
53
- if($inputValidation != 'default') {
54
- $rules['input_validation'] = $inputValidation;
55
- }else {
56
- $rules['input_validation'] = '';
 
 
 
 
 
57
  }
 
 
58
 
59
  $attributeUsernameModel->setValidateRules($rules);
60
- $attributeUsernameModel->save();
 
61
  }
62
  }
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
+ class Diglin_Username_Model_Observer extends Mage_Customer_Model_Observer
11
+ {
12
+ /**
13
+ * Test if the customer account is enabled or not
14
+ *
15
+ * Event: customer_customer_authenticated
16
+ *
17
+ * @param Varien_Event_Observer $observer
18
+ * @throws Mage_Core_Exception
19
+ */
20
  public function isActive($observer)
21
  {
22
  $customer = $observer->getEvent()->getModel();
25
  throw new Mage_Core_Exception(Mage::helper('customer')->__('This account is disabled.'), 0);
26
  }
27
  }
28
+
29
+ /**
30
+ * Add on the fly the username attribute to the customer collection
31
+ *
32
+ * Event: eav_collection_abstract_load_before
33
+ *
34
+ * @param Varien_Event_Observer $observer
35
+ */
36
  public function addAttributeToCollection ($observer)
37
  {
38
+ /* @var $collection Mage_Eav_Model_Entity_Collection_Abstract */
39
  $collection = $observer->getEvent()->getCollection();
40
+ if ($collection->getEntity()->getType() == 'customer') {
41
+ $collection->addAttributeToSelect('username');
42
+ }
43
+
44
  }
45
 
46
  /**
47
  * Change the attribute of username after the configuration
48
  * has been changed
49
+ *
50
+ * Event: admin_system_config_changed_section_username
51
+ *
52
  * @param Varien_Event_Observer $observer
53
  */
54
  public function changeEavAttribute ($observer)
67
 
68
  /* @var $attributeUsernameModel Mage_Customer_Model_Attribute */
69
  $attributeUsernameModel = Mage::getModel('customer/attribute')->loadByCode('customer', 'username');
70
+ if($attributeUsernameModel->getId()) {
71
+ $rules = $attributeUsernameModel->getValidateRules();
72
+ $rules['max_text_length'] = $maxLength;
73
+ $rules['min_text_length'] = $minLength;
74
+
75
+ if($inputValidation != 'default') {
76
+ $rules['input_validation'] = $inputValidation;
77
+ }else {
78
+ $rules['input_validation'] = '';
79
+ }
80
+
81
+ $attributeUsernameModel->setValidateRules($rules);
82
+ $attributeUsernameModel->save();
83
  }
84
+ <<<<<<< HEAD
85
+ =======
86
 
87
  $attributeUsernameModel->setValidateRules($rules);
88
+ $attributeUsernameModel->save();
89
+ >>>>>>> 110cb6a43b166e9d2882c96ffe68c0b82da10964
90
  }
91
  }
app/code/community/Diglin/Username/controllers/AccountController.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * @category Diglin
6
+ * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ require_once 'Mage/Customer/controllers/AccountController.php';
12
+
13
+ class Diglin_Username_AccountController extends Mage_Customer_AccountController
14
+ {
15
+ /**
16
+ * Rewrite to allow support of Username
17
+ *
18
+ */
19
+ public function forgotPasswordPostAction ()
20
+ {
21
+ $email = (string) $this->getRequest()->getPost('email');
22
+ if ($email) {
23
+
24
+ /** @var $customer Diglin_Username_Model_Customer */
25
+ $customer = Mage::getModel('customer/customer')
26
+ ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
27
+ ->loadByUsername($email);
28
+
29
+ if (!$customer->getId() && !Zend_Validate::is($email, 'EmailAddress')) {
30
+ $this->_getSession()->setForgottenEmail($email);
31
+ $this->_getSession()->addError($this->__('Invalid email address.'));
32
+ $this->_redirect('*/*/forgotpassword');
33
+ return;
34
+ } else if (!$customer->getId()) {
35
+ // Load by Email if username not found and email seems to be valid
36
+ $customer->loadByEmail($email);
37
+ }
38
+
39
+ if ($customer->getId()) {
40
+ try {
41
+ $newResetPasswordLinkToken = Mage::helper('customer')->generateResetPasswordLinkToken();
42
+ $customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
43
+ $customer->sendPasswordResetConfirmationEmail();
44
+ } catch (Exception $exception) {
45
+ $this->_getSession()->addError($exception->getMessage());
46
+ $this->_redirect('*/*/forgotpassword');
47
+ return;
48
+ }
49
+ }
50
+ $this->_getSession()
51
+ ->addSuccess(Mage::helper('customer')->__('If there is an account associated with %s you will receive an email with a link to reset your password.', Mage::helper('customer')->htmlEscape($email)));
52
+ $this->_redirect('*/*/');
53
+ return;
54
+ } else {
55
+ $this->_getSession()->addError($this->__('Please enter your email or username.'));
56
+ $this->_redirect('*/*/forgotpassword');
57
+ return;
58
+ }
59
+ }
60
+ }
app/code/community/Diglin/Username/data/username_setup/data-install-2.0.0.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * @category Diglin
6
+ * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ /* @var $installer Diglin_Username_Model_Entity_Setup */
12
+ $installer = $this;
13
+
14
+ /* @var $eavConfig Mage_Eav_Model_Config */
15
+ $usernameAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'username');
16
+
17
+ $installer->startSetup();
18
+
19
+ $select = $installer->getConnection()->select()
20
+ ->from($this->getTable('customer_entity_varchar'), 'entity_id')
21
+ ->where('attribute_id = ?', $usernameAttribute->getId());
22
+
23
+ $ids = $installer->getConnection()->fetchCol($select);
24
+
25
+ $select = $installer->getConnection()->select()
26
+ ->from(array('c' => $this->getTable('customer_entity')), 'email');
27
+
28
+ if (!empty($ids)) {
29
+ $select->joinLeft(array('cev' => $this->getTable('customer_entity_varchar')), 'c.entity_id = cev.entity_id')
30
+ ->where('cev.entity_id NOT IN ('. implode(',', $ids) . ')');
31
+ }
32
+
33
+ // Create username for old customers to prevent problem when creating an order as a guest
34
+ $customers = $installer->getConnection()->fetchAll($select);
35
+ foreach ($customers as $customer){
36
+ $customer['attribute_id'] = $usernameAttribute->getId();
37
+ $email = $customer['email'];
38
+ $pos = strpos($email, '@');
39
+ $customer['value'] = substr($email, 0, $pos) . substr(uniqid(), 0, 5);
40
+ unset($customer['email']);
41
+ unset($customer['value_id']);
42
+
43
+ $installer->getConnection()->insert($this->getTable('customer_entity_varchar'), $customer);
44
+ }
45
+
46
+ $installer->endSetup();
app/code/community/Diglin/Username/etc/config.xml CHANGED
@@ -2,17 +2,19 @@
2
  <config>
3
  <modules>
4
  <Diglin_Username>
5
- <version>1.5.0</version>
6
  </Diglin_Username>
7
  </modules>
8
  <default>
9
  <username>
10
  <general>
 
11
  <frontend>0</frontend>
12
  <grid>1</grid>
13
  <max_length>30</max_length>
14
  <min_length>6</min_length>
15
  <input_validation>default</input_validation>
 
16
  </general>
17
  </username>
18
  </default>
@@ -63,8 +65,8 @@
63
  <rewrite>
64
  <customer>Diglin_Username_Model_Customer</customer>
65
  <form>Diglin_Username_Model_Form</form>
66
- <!-- <observer>Diglin_Username_Model_Observer</observer>-->
67
  <setup>Diglin_Username_Model_Setup</setup>
 
68
  </rewrite>
69
  </customer>
70
  <customer_entity>
@@ -77,6 +79,11 @@
77
  <customer>Diglin_Username_Model_Entity_Customer</customer>
78
  </rewrite>
79
  </customer_resource>
 
 
 
 
 
80
  </models>
81
 
82
  <resources>
@@ -105,6 +112,16 @@
105
  </global>
106
 
107
  <frontend>
 
 
 
 
 
 
 
 
 
 
108
  <translate>
109
  <modules>
110
  <Diglin_Username>
@@ -126,15 +143,14 @@
126
  <adminhtml>
127
  <events>
128
  <admin_system_config_changed_section_username>
129
- <!-- <core_config_data_save_before>-->
130
  <observers>
131
  <change_eav_username>
132
  <class>username/observer</class>
133
  <method>changeEavAttribute</method>
134
  </change_eav_username>
135
  </observers>
136
- <!-- </core_config_data_save_before>-->
137
  </admin_system_config_changed_section_username>
 
138
  <eav_collection_abstract_load_before>
139
  <observers>
140
  <customer_load_collection>
@@ -145,4 +161,8 @@
145
  </eav_collection_abstract_load_before>
146
  </events>
147
  </adminhtml>
 
 
 
 
148
  </config>
2
  <config>
3
  <modules>
4
  <Diglin_Username>
5
+ <version>2.0.1</version>
6
  </Diglin_Username>
7
  </modules>
8
  <default>
9
  <username>
10
  <general>
11
+ <enabled>1</enabled>
12
  <frontend>0</frontend>
13
  <grid>1</grid>
14
  <max_length>30</max_length>
15
  <min_length>6</min_length>
16
  <input_validation>default</input_validation>
17
+ <case_sensitive>1</case_sensitive>
18
  </general>
19
  </username>
20
  </default>
65
  <rewrite>
66
  <customer>Diglin_Username_Model_Customer</customer>
67
  <form>Diglin_Username_Model_Form</form>
 
68
  <setup>Diglin_Username_Model_Setup</setup>
69
+ <config_share>Diglin_Username_Model_Config_Share</config_share>
70
  </rewrite>
71
  </customer>
72
  <customer_entity>
79
  <customer>Diglin_Username_Model_Entity_Customer</customer>
80
  </rewrite>
81
  </customer_resource>
82
+ <importexport>
83
+ <rewrite>
84
+ <import_entity_customer>Diglin_Username_Model_Import_Entity_Customer</import_entity_customer>
85
+ </rewrite>
86
+ </importexport>
87
  </models>
88
 
89
  <resources>
112
  </global>
113
 
114
  <frontend>
115
+ <routers>
116
+ <customer>
117
+ <args>
118
+ <modules>
119
+ <username before="Mage_Customer">Diglin_Username</username>
120
+ </modules>
121
+ </args>
122
+ </customer>
123
+ </routers>
124
+
125
  <translate>
126
  <modules>
127
  <Diglin_Username>
143
  <adminhtml>
144
  <events>
145
  <admin_system_config_changed_section_username>
 
146
  <observers>
147
  <change_eav_username>
148
  <class>username/observer</class>
149
  <method>changeEavAttribute</method>
150
  </change_eav_username>
151
  </observers>
 
152
  </admin_system_config_changed_section_username>
153
+
154
  <eav_collection_abstract_load_before>
155
  <observers>
156
  <customer_load_collection>
161
  </eav_collection_abstract_load_before>
162
  </events>
163
  </adminhtml>
164
+
165
+ <uninstall>
166
+ <filename>uninstall.txt</filename>
167
+ </uninstall>
168
  </config>
app/code/community/Diglin/Username/etc/system.xml CHANGED
@@ -33,6 +33,16 @@
33
  <show_in_store>1</show_in_store>
34
  <comment><![CDATA[]]></comment>
35
  <fields>
 
 
 
 
 
 
 
 
 
 
36
  <frontend>
37
  <label>Allow frontend edit</label>
38
  <frontend_type>select</frontend_type>
@@ -44,7 +54,7 @@
44
  <comment><![CDATA[Allow the customer to edit his username in "My Account"]]></comment>
45
  </frontend>
46
  <grid>
47
- <label>Display username in Manage Customers Grid</label>
48
  <frontend_type>select</frontend_type>
49
  <source_model>adminhtml/system_config_source_yesno</source_model>
50
  <sort_order>20</sort_order>
@@ -73,6 +83,14 @@
73
  <show_in_default>1</show_in_default>
74
  <comment><![CDATA[What kind of username do you want to accept? You can set the value 'Default' which accept letters, digits and the special characters '_-' ]]></comment>
75
  </input_validation>
 
 
 
 
 
 
 
 
76
  </fields>
77
  </general>
78
  </groups>
33
  <show_in_store>1</show_in_store>
34
  <comment><![CDATA[]]></comment>
35
  <fields>
36
+ <enabled>
37
+ <label>Enable Username Support</label>
38
+ <frontend_type>select</frontend_type>
39
+ <source_model>adminhtml/system_config_source_yesno</source_model>
40
+ <sort_order>1</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ <comment><![CDATA[Enable username support in your store]]></comment>
45
+ </enabled>
46
  <frontend>
47
  <label>Allow frontend edit</label>
48
  <frontend_type>select</frontend_type>
54
  <comment><![CDATA[Allow the customer to edit his username in "My Account"]]></comment>
55
  </frontend>
56
  <grid>
57
+ <label><![CDATA[Display username in "Manage Customers" Grid]]></label>
58
  <frontend_type>select</frontend_type>
59
  <source_model>adminhtml/system_config_source_yesno</source_model>
60
  <sort_order>20</sort_order>
83
  <show_in_default>1</show_in_default>
84
  <comment><![CDATA[What kind of username do you want to accept? You can set the value 'Default' which accept letters, digits and the special characters '_-' ]]></comment>
85
  </input_validation>
86
+ <case_sensitive>
87
+ <label>Case Sensitive Username</label>
88
+ <frontend_type>select</frontend_type>
89
+ <source_model>adminhtml/system_config_source_yesno</source_model>
90
+ <sort_order>60</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <comment><![CDATA[Do you want to make the username case sensitive? If not case sensitive, the username will be saved in lowercase. The idea to save in lowercase is to not irritate the user in case he provides a wrong username case.]]></comment>
93
+ </case_sensitive>
94
  </fields>
95
  </general>
96
  </groups>
app/code/community/Diglin/Username/etc/uninstall.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ app/code/community/Diglin/Username app/code/community/Diglin/Username
2
+ app/design/frontend/base/default/layout/username.xml app/design/frontend/base/default/layout/username.xml
3
+ app/design/frontend/base/default/template/username app/design/frontend/base/default/template/username
4
+ app/etc/modules/Diglin_Username.xml app/etc/modules/Diglin_Username.xml
5
+ app/locale/de_DE/Diglin_Username.csv app/locale/de_DE/Diglin_Username.csv
6
+ app/locale/en_GB/Diglin_Username.csv app/locale/en_GB/Diglin_Username.csv
7
+ app/locale/en_US/Diglin_Username.csv app/locale/en_US/Diglin_Username.csv
8
+ app/locale/fr_FR/Diglin_Username.csv app/locale/fr_FR/Diglin_Username.csv
app/code/community/Diglin/Username/sql/username_setup/install-2.0.0.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * @category Diglin
6
+ * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ /* @var $installer Diglin_Username_Model_Entity_Setup */
12
+ $installer = $this;
13
+
14
+ /* @var $eavConfig Mage_Eav_Model_Config */
15
+ $eavConfig = Mage::getSingleton('eav/config');
16
+
17
+ $store = Mage::app()->getStore(Mage_Core_Model_App::ADMIN_STORE_ID);
18
+
19
+ $attributes = $installer->getAdditionalAttributes();
20
+
21
+ foreach ($attributes as $attributeCode => $data) {
22
+ $installer->addAttribute('customer', $attributeCode, $data);
23
+
24
+ $attribute = $eavConfig->getAttribute('customer', $attributeCode);
25
+ $attribute->setWebsite( (($store->getWebsite()) ? $store->getWebsite() : 0));
26
+
27
+ if (false === ($attribute->getIsSystem() == 1 && $attribute->getIsVisible() == 0)) {
28
+ $usedInForms = array(
29
+ 'customer_account_create',
30
+ 'customer_account_edit',
31
+ 'checkout_register',
32
+ );
33
+ if (!empty($data['adminhtml_only'])) {
34
+ $usedInForms = array('adminhtml_customer');
35
+ } else {
36
+ $usedInForms[] = 'adminhtml_customer';
37
+ }
38
+ if (!empty($data['adminhtml_checkout'])) {
39
+ $usedInForms[] = 'adminhtml_checkout';
40
+ }
41
+
42
+ $attribute->setData('used_in_forms', $usedInForms);
43
+ }
44
+ $attribute->save();
45
+ }
46
+
47
+ $installer->startSetup();
48
+
49
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote'), 'customer_username', array(
50
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
51
+ 'length' => '255',
52
+ 'nullable' => true,
53
+ 'comment' => 'Customer Username'
54
+ ));
55
+
56
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'), 'customer_username', array(
57
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
58
+ 'length' => '255',
59
+ 'nullable' => true,
60
+ 'comment' => 'Customer Username'
61
+ ));
62
+
63
+ $installer->endSetup();
app/code/community/Diglin/Username/sql/username_setup/mysql4-install-1.0.0.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
- * @copyright Copyright (c) 2011-2012 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
  $installer = $this;
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
  $installer = $this;
app/code/community/Diglin/Username/sql/username_setup/mysql4-upgrade-1.0.0-1.1.0.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
- * @copyright Copyright (c) 2011-2012 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
 
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
 
app/code/community/Diglin/Username/sql/username_setup/mysql4-upgrade-1.1.0-1.2.0.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
- * @copyright Copyright (c) 2011-2012 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
  $installer = $this;
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
  $installer = $this;
app/code/community/Diglin/Username/sql/username_setup/mysql4-upgrade-1.3.0-1.4.0.php CHANGED
@@ -4,11 +4,11 @@
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
- * @copyright Copyright (c) 2011-2012 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
 
11
- /* @var $installer Rissip_Customer_Model_Entity_Setup */
12
  $installer = $this;
13
 
14
  $installer->startSetup();
4
  *
5
  * @category Diglin
6
  * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
  */
10
 
11
+ /* @var $installer Diglin_Username_Model_Entity_Setup */
12
  $installer = $this;
13
 
14
  $installer->startSetup();
app/code/community/Diglin/Username/sql/username_setup/mysql4-upgrade-1.4.0-2.0.0.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * @category Diglin
6
+ * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ /* @var $installer Diglin_Username_Model_Entity_Setup */
12
+ $installer = $this;
13
+
14
+ $installer->updateAttribute('customer', 'username', 'is_required', 0);
15
+
16
+ $installer->startSetup();
17
+
18
+ $select = $installer->getConnection()->select()
19
+ ->from($installer->getTable('core_config_data'), 'config_id')
20
+ ->where ('path = ?', 'username/general/force_tolower');
21
+
22
+ $ids = $installer->getConnection()->fetchCol($select);
23
+
24
+ foreach ($ids as $id) {
25
+ $installer->getConnection()->update($installer->getTable('core_config_data'), array('path' => 'username/general/case_sensitive'), array('config_id = ?' => $id));
26
+ }
27
+
28
+ $installer->endSetup();
app/code/community/Diglin/Username/sql/username_setup/uninstall.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * @category Diglin
6
+ * @package Diglin_Username
7
+ * @copyright Copyright (c) 2011-2013 Diglin (http://www.diglin.com)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ /* @var $installer Diglin_Username_Model_Entity_Setup */
12
+ $installer = $this;
13
+
14
+ $installer->deleteTableRow($installer->getTable('eav_attribute'), 'attribute_code', 'username');
15
+ $installer->getConnection()->dropColumn($installer->getTable('sales/quote'), 'customer_username');
16
+ $installer->getConnection()->dropColumn($installer->getTable('sales/order'), 'customer_username');
app/code/community/Hackathon/MageTrashApp/Adminhtml/Block/System/Config/Form/Fieldset/Modules/MageTrashApp.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ class Hackathon_MageTrashApp_Adminhtml_Block_System_Config_Form_Fieldset_Modules_MageTrashApp
6
+ extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
7
+ {
8
+ protected $_dummyElement;
9
+ protected $_fieldRenderer;
10
+ protected $_values;
11
+
12
+
13
+ public function render(Varien_Data_Form_Element_Abstract $element)
14
+ {
15
+ $html = $this->_getHeaderHtml($element);
16
+
17
+ $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
18
+
19
+ $dispatchResult = new Varien_Object($modules);
20
+ Mage::dispatchEvent(
21
+ 'magetrashapp_system_config_magetrashapp_manage_extns_render_before',
22
+ array('modules' => $dispatchResult)
23
+ );
24
+ $modules = $dispatchResult->toArray();
25
+
26
+ sort($modules);
27
+
28
+ foreach ($modules as $moduleName) {
29
+ $moduleStatus = Mage::getConfig()->getModuleConfig($moduleName)->is('active', 'true');
30
+
31
+ if ($moduleName==='Mage_Adminhtml' ||$moduleName==='Hackathon_MageTrashApp'
32
+ || stripos($moduleName,'Mage_') !== false) {
33
+ continue;
34
+ }
35
+ $html.= $this->_getFieldHtml($element, $moduleName,$moduleStatus);
36
+ }
37
+ $html .= $this->_getFooterHtml($element);
38
+
39
+ return $html;
40
+ }
41
+
42
+ protected function _getDummyElement()
43
+ {
44
+ if (empty($this->_dummyElement)) {
45
+ $this->_dummyElement = new Varien_Object(array('show_in_default'=>1, 'show_in_website'=>1));
46
+ }
47
+ return $this->_dummyElement;
48
+ }
49
+
50
+ protected function _getFieldRenderer()
51
+ {
52
+ if (empty($this->_fieldRenderer)) {
53
+ $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
54
+ }
55
+ return $this->_fieldRenderer;
56
+ }
57
+
58
+
59
+
60
+ protected function _getValues()
61
+ {
62
+ if (empty($this->_values)) {
63
+ $this->_values = array(
64
+ array('label'=>Mage::helper('adminhtml')->__('Disabled'), 'value'=>0),
65
+ array('label'=>Mage::helper('adminhtml')->__('Enabled'), 'value'=>1),
66
+ array('label'=>Mage::helper('adminhtml')->__('Uninstall'), 'value'=>2),
67
+ );
68
+ }
69
+ return $this->_values;
70
+ }
71
+
72
+
73
+ protected function _getFieldHtml($fieldset, $moduleName,$moduleStatus)
74
+ {
75
+
76
+ $e = $this->_getDummyElement();
77
+
78
+ $field = $fieldset->addField($moduleName, 'select',
79
+ array(
80
+ 'name' => 'groups[manage_extns][fields]['.$moduleName.'][value]',
81
+ 'label' => $moduleName,
82
+ 'value' => (int)$moduleStatus,
83
+ 'values' => $this->_getValues(),
84
+ 'inherit' => true,
85
+ 'can_use_default_value' => $this->getForm()->canUseDefaultValue($e),
86
+ 'can_use_website_value' => $this->getForm()->canUseWebsiteValue($e),
87
+ ))->setRenderer($this->_getFieldRenderer());
88
+
89
+ return $field->toHtml();
90
+ }
91
+ }
app/code/community/Hackathon/MageTrashApp/Block/Adminhtml/System/Config/Form/Fieldset/Modules/MageTrashApp.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ class Hackathon_MageTrashApp_Block_Adminhtml_System_Config_Form_Fieldset_Modules_MageTrashApp
6
+ extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
7
+ {
8
+ protected $_dummyElement;
9
+ protected $_fieldRenderer;
10
+ protected $_values;
11
+
12
+
13
+ public function render(Varien_Data_Form_Element_Abstract $element)
14
+ {
15
+ $html = $this->_getHeaderHtml($element);
16
+
17
+ $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
18
+
19
+ $dispatchResult = new Varien_Object($modules);
20
+ Mage::dispatchEvent(
21
+ 'magetrashapp_system_config_magetrashapp_manage_extns_render_before',
22
+ array('modules' => $dispatchResult)
23
+ );
24
+ $modules = $dispatchResult->toArray();
25
+
26
+ sort($modules);
27
+
28
+ foreach ($modules as $moduleName) {
29
+ $moduleStatus = Mage::getConfig()->getModuleConfig($moduleName)->is('active', 'true');
30
+
31
+ if ($moduleName==='Mage_Adminhtml' ||$moduleName==='Hackathon_MageTrashApp'
32
+ || stripos($moduleName,'Mage_') !== false) {
33
+ continue;
34
+ }
35
+ $html.= $this->_getFieldHtml($element, $moduleName,$moduleStatus);
36
+ }
37
+ $html .= $this->_getFooterHtml($element);
38
+
39
+ return $html;
40
+ }
41
+
42
+ protected function _getDummyElement()
43
+ {
44
+ if (empty($this->_dummyElement)) {
45
+ $this->_dummyElement = new Varien_Object(array('show_in_default'=>1, 'show_in_website'=>1));
46
+ }
47
+ return $this->_dummyElement;
48
+ }
49
+
50
+ protected function _getFieldRenderer()
51
+ {
52
+ if (empty($this->_fieldRenderer)) {
53
+ $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
54
+ }
55
+ return $this->_fieldRenderer;
56
+ }
57
+
58
+
59
+
60
+ protected function _getValues()
61
+ {
62
+ if (empty($this->_values)) {
63
+ $this->_values = array(
64
+ array('label'=>Mage::helper('adminhtml')->__('Disabled'), 'value'=>0),
65
+ array('label'=>Mage::helper('adminhtml')->__('Enabled'), 'value'=>1),
66
+ array('label'=>Mage::helper('adminhtml')->__('Uninstall'), 'value'=>2),
67
+ );
68
+ }
69
+ return $this->_values;
70
+ }
71
+
72
+
73
+ protected function _getFieldHtml($fieldset, $moduleName,$moduleStatus)
74
+ {
75
+
76
+ $e = $this->_getDummyElement();
77
+
78
+ $field = $fieldset->addField($moduleName, 'select',
79
+ array(
80
+ 'name' => 'groups[manage_extns][fields]['.$moduleName.'][value]',
81
+ 'label' => $moduleName,
82
+ 'value' => (int)$moduleStatus,
83
+ 'values' => $this->_getValues(),
84
+ 'inherit' => true,
85
+ 'can_use_default_value' => $this->getForm()->canUseDefaultValue($e),
86
+ 'can_use_website_value' => $this->getForm()->canUseWebsiteValue($e),
87
+ ))->setRenderer($this->_getFieldRenderer());
88
+
89
+ return $field->toHtml();
90
+ }
91
+ }
app/code/community/Hackathon/MageTrashApp/Block/Adminhtml/System/Config/Form/Fieldset/Modules/Rewind.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ class Hackathon_MageTrashApp_Block_Adminhtml_System_Config_Form_Fieldset_Modules_Rewind
6
+ extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
7
+ {
8
+ protected $_dummyElement;
9
+ protected $_fieldRenderer;
10
+
11
+
12
+ public function render(Varien_Data_Form_Element_Abstract $element)
13
+ {
14
+ $html = $this->_getHeaderHtml($element);
15
+
16
+ $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
17
+
18
+ $dispatchResult = new Varien_Object($modules);
19
+ Mage::dispatchEvent(
20
+ 'magetrashapp_system_config_magetrashapp_manage_extns_render_before',
21
+ array('modules' => $dispatchResult)
22
+ );
23
+ $modules = $dispatchResult->toArray();
24
+
25
+ sort($modules);
26
+
27
+ foreach ($modules as $moduleName) {
28
+ if ($moduleName==='Mage_Adminhtml' || $moduleName==='Hackathon_MageTrashApp'
29
+ || stripos($moduleName,'Mage_') !== false) {
30
+ continue;
31
+ }
32
+
33
+ $resName = Mage::helper('magetrashapp')->getResourceName($moduleName);
34
+ $number = Mage::getResourceSingleton('core/resource')->getDbVersion($resName);
35
+ if (!$resName || $resName == $number) {
36
+ continue;
37
+ }
38
+
39
+ $html.= $this->_getFieldHtml($element, $moduleName);
40
+ }
41
+ $html .= $this->_getFooterHtml($element);
42
+ return $html;
43
+ }
44
+
45
+ protected function _getDummyElement()
46
+ {
47
+ if (empty($this->_dummyElement)) {
48
+ $this->_dummyElement = new Varien_Object(array('show_in_default'=>1, 'show_in_website'=>1));
49
+ }
50
+ return $this->_dummyElement;
51
+ }
52
+
53
+ protected function _getFieldRenderer()
54
+ {
55
+ if (empty($this->_fieldRenderer)) {
56
+ $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
57
+ }
58
+ return $this->_fieldRenderer;
59
+ }
60
+
61
+ /**
62
+ * @param $moduleName
63
+ * @return array
64
+ */
65
+ protected function _getValues($moduleName)
66
+ {
67
+ $nameSpaceModule = str_replace('_', '/', $moduleName);
68
+ $resName = Mage::helper('magetrashapp')->getResourceName($moduleName);
69
+ $community = Mage::getBaseDir('code') . DS . 'community' . DS;
70
+
71
+ $sqlScriptPath = $community . $nameSpaceModule . DS . 'sql' . DS . $resName . DS. '*.*';
72
+
73
+ $valuesArray = array(
74
+ array('label'=>Mage::helper('adminhtml')->__('Do nothing'), 'value'=>2),
75
+ array('label'=>Mage::helper('adminhtml')->__('Delete core_resource'), 'value'=>0)
76
+ );
77
+
78
+ // Loop through all sql files and create a value for each
79
+ foreach(glob($sqlScriptPath) as $filename){
80
+ $filename = explode("-",basename($filename));
81
+
82
+ foreach ($filename as $part) {
83
+ if (strpos($part, ".php")) {
84
+ $part = str_replace('.php', '', $part);
85
+ $number = $part;
86
+ }
87
+ }
88
+
89
+ $sqlVersionsArray[] = array('label'=>Mage::helper('adminhtml')->__(
90
+ 'Rewind core_resource: ' . $number), 'value'=>'1_' . $number
91
+ );
92
+ }
93
+
94
+ if (!empty($sqlVersionsArray)) {
95
+ $valuesArray = array_merge($valuesArray, array_reverse($sqlVersionsArray));
96
+ }
97
+
98
+ return $valuesArray;
99
+ }
100
+
101
+
102
+ protected function _getFieldHtml($fieldset, $moduleName)
103
+ {
104
+
105
+ $e = $this->_getDummyElement();
106
+
107
+ $field = $fieldset->addField($moduleName . '_Rewind', 'select',
108
+ array(
109
+ 'name' => 'groups[rewind_extns][fields]['.$moduleName.'][value]',
110
+ 'label' => $moduleName,
111
+ 'value' => 2,
112
+ 'values' => $this->_getValues($moduleName),
113
+ 'inherit' => true,
114
+ 'can_use_default_value' => $this->getForm()->canUseDefaultValue($e),
115
+ 'can_use_website_value' => $this->getForm()->canUseWebsiteValue($e),
116
+ ))->setRenderer($this->_getFieldRenderer());
117
+
118
+ return $field->toHtml();
119
+ }
120
+ }
app/code/community/Hackathon/MageTrashApp/Helper/Data.php ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Hackathon_MageTrashApp_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ const DISABLE = 0;
5
+ const ENABLE = 1;
6
+ const UNINSTALL = 2;
7
+
8
+ const DELETE = 0;
9
+ const REWIND = 1;
10
+
11
+ public function uninstallModule($moduleName)
12
+ {
13
+ // deactivate the module
14
+ $this->activateModule($moduleName,false);
15
+
16
+ // Check the dependencies first and allow the rest of the process otherwise block it
17
+ $dependencies = $this->checkDependencies($moduleName);
18
+ if (count($dependencies) > 0) {
19
+ Mage::throwException(
20
+ $this->__('The module %s has dependencies with the module(s) %s. Please fix that before to remove this module.', $moduleName, implode(',', $dependencies))
21
+ );
22
+ return;
23
+ }
24
+
25
+ /* @var $uninstallModel Hackathon_MageTrashApp_Model_Uninstall */
26
+ $uninstallModel = Mage::getModel('magetrashapp/uninstall');
27
+
28
+ // We need to trigger SQL uninstall scripts
29
+ Mage::dispatchEvent('magetrashapp_before_sql_uninstall');
30
+ $uninstallModel->uninstallSqlCommand($moduleName);
31
+ Mage::dispatchEvent('magetrashapp_after_sql_uninstall');
32
+
33
+ // We need to remove all package files based on uninstall.txt file or modman file
34
+ Mage::dispatchEvent('magetrashapp_before_package_uninstall');
35
+ $uninstallModel->processUninstallPackage($moduleName);
36
+ Mage::dispatchEvent('magetrashapp_after_package_uninstall');
37
+ Mage::getSingleton('adminhtml/session')->addSuccess($moduleName.' has been uninstalled.');
38
+
39
+ // Do the cleanup of the config here because we need the old config until this point
40
+ Mage::app()->getStore()->resetConfig();
41
+ }
42
+
43
+ /**
44
+ *
45
+ * @param string $moduleName
46
+ * @return boolean | array
47
+ */
48
+ protected function checkDependencies ($moduleName)
49
+ {
50
+ $moduleDepends = array();
51
+ foreach (Mage::getConfig()->getNode('modules')->children() as $parentName => $module) {
52
+ if ($parentName == $moduleName) {
53
+ continue;
54
+ }
55
+
56
+ if ($module->depends) {
57
+ foreach ($module->depends->children() as $name => $depend) {
58
+ if ($name === $moduleName && (bool) Mage::getConfig()->getModuleConfig($moduleName)->is('active', 'true')) {
59
+ $moduleDepends[] = $parentName;
60
+ }
61
+ }
62
+ }
63
+ }
64
+
65
+ return $moduleDepends;
66
+ }
67
+
68
+ /**
69
+ * Activate/Deactivate a Magento module
70
+ *
71
+ * @param string $name
72
+ * @return string
73
+ */
74
+ public function activateModule($name,$activateFlag = true)
75
+ {
76
+ $isDeactivationPossible = true;
77
+ if (count($this->checkDependencies($name)) > 0) {
78
+ $isDeactivationPossible = false;
79
+ }
80
+
81
+
82
+ if ($isDeactivationPossible) {
83
+ $status = '';
84
+ $xmlPath = Mage::getBaseDir() . DS . 'app' . DS . 'etc' . DS . 'modules' . DS . $name .'.xml';
85
+ if (file_exists($xmlPath)) {
86
+ $xmlObj = new Varien_Simplexml_Config($xmlPath);
87
+
88
+ $xmlObj->setNode(
89
+ 'modules/'.$name.'/active',
90
+ $activateFlag ? 'true' : 'false'
91
+ );
92
+
93
+ if (is_writable($xmlPath)) {
94
+ $xmlData = $xmlObj->getNode()->asNiceXml();
95
+ @file_put_contents($xmlPath, $xmlData);
96
+ if ($activateFlag) {
97
+ $status = $this->__('The module "%s" has been successfully activated.', $name);
98
+ } else {
99
+ $status = $this->__('The module "%s" has been successfully deactivated.', $name);
100
+ }
101
+ } else {
102
+ $status = $this->__('File %s is not writable.', $xmlPath);
103
+ }
104
+ } else {
105
+ $status = $this->__(
106
+ 'Module %s is probably not installed. File %s does not exist.',
107
+ $name,
108
+ $xmlPath
109
+ );
110
+ }
111
+ } else {
112
+ $status = $this->__('Module can\'t be deactivated because it is a dependency of another module which is still active.');
113
+ }
114
+
115
+ return $status;
116
+ }
117
+
118
+ public function rrmdir($dir)
119
+ {
120
+ if (is_dir($dir)) {
121
+ $objects = scandir($dir);
122
+ foreach ($objects as $object) {
123
+ if ($object != "." && $object != "..") {
124
+ if (filetype($dir."/".$object) == "dir") $this->rrmdir($dir."/".$object); else unlink($dir."/".$object);
125
+ }
126
+ }
127
+ reset($objects);
128
+ rmdir($dir);
129
+ }
130
+ }
131
+
132
+ /**
133
+ * Delete Core Resource for specified module
134
+ *
135
+ * @param $moduleName
136
+ */
137
+ public function deleteCoreResource($moduleName)
138
+ {
139
+ $resName = $this->getResourceName($moduleName);
140
+ $number = Mage::getResourceSingleton('core/resource')->getDbVersion($resName);
141
+
142
+ Mage::getModel('magetrashapp/coreresource')->deleteCoreResource($moduleName, $resName, $number);
143
+ }
144
+
145
+ /**
146
+ * Rewind Core Resource for specified module
147
+ *
148
+ * @param $moduleName
149
+ * @param $number
150
+ */
151
+ public function rewindCoreResource ($moduleName, $number)
152
+ {
153
+ $resName = Mage::helper('magetrashapp')->getResourceName($moduleName);
154
+
155
+ Mage::getModel('magetrashapp/coreresource')->rewindCoreResource($moduleName, $resName, $number);
156
+ }
157
+
158
+ /**
159
+ * Get resource name from config.xml node
160
+ *
161
+ * @param $moduleName
162
+ * @return mixed
163
+ */
164
+ public function getResourceName($moduleName) {
165
+ $config = Mage::app()->getConfig();
166
+ $xmlPath = $config->getModuleDir('etc', $moduleName) . DS . 'config.xml';
167
+
168
+ if (file_exists($xmlPath)) {
169
+ $xmlObj = new Varien_Simplexml_Config($xmlPath);
170
+
171
+ $resourceNode = $xmlObj->getNode('global/resources');
172
+ if ($resourceNode) {
173
+ $resourceNode = $resourceNode->asArray();
174
+ reset($resourceNode);
175
+ $resName = key($resourceNode);
176
+ return $resName;
177
+ }
178
+ }
179
+ }
180
+ }
app/code/community/Hackathon/MageTrashApp/Model/Adminhtml/Config/Data.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: damian
5
+ * Date: 12.01.13
6
+ * Time: 15:31
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+ class Hackathon_MageTrashApp_Model_Adminhtml_Config_Data extends Mage_Adminhtml_Model_Config_Data {
10
+
11
+ // need to edit save
12
+
13
+ public function save()
14
+ {
15
+ $this->_validate();
16
+ $this->_getScope();
17
+
18
+ Mage::dispatchEvent('model_config_data_save_before', array('object' => $this));
19
+
20
+ $section = $this->getSection();
21
+ $website = $this->getWebsite();
22
+ $store = $this->getStore();
23
+ $groups = $this->getGroups();
24
+ $scope = $this->getScope();
25
+ $scopeId = $this->getScopeId();
26
+
27
+ if (empty($groups)) {
28
+ return $this;
29
+ }
30
+
31
+ $sections = Mage::getModel('adminhtml/config')->getSections();
32
+ /* @var $sections Mage_Core_Model_Config_Element */
33
+
34
+ $oldConfig = $this->_getConfig(true);
35
+
36
+ $deleteTransaction = Mage::getModel('core/resource_transaction');
37
+ /* @var $deleteTransaction Mage_Core_Model_Resource_Transaction */
38
+ $saveTransaction = Mage::getModel('core/resource_transaction');
39
+ /* @var $saveTransaction Mage_Core_Model_Resource_Transaction */
40
+
41
+ // Extends for old config data
42
+ $oldConfigAdditionalGroups = array();
43
+
44
+ foreach ($groups as $group => $groupData) {
45
+ /**
46
+ * Map field names if they were cloned
47
+ */
48
+ $groupConfig = $sections->descend($section.'/groups/'.$group);
49
+
50
+ if ($clonedFields = !empty($groupConfig->clone_fields)) {
51
+ if ($groupConfig->clone_model) {
52
+ $cloneModel = Mage::getModel((string)$groupConfig->clone_model);
53
+ } else {
54
+ Mage::throwException('Config form fieldset clone model required to be able to clone fields');
55
+ }
56
+ $mappedFields = array();
57
+ $fieldsConfig = $sections->descend($section.'/groups/'.$group.'/fields');
58
+
59
+ if ($fieldsConfig->hasChildren()) {
60
+ foreach ($fieldsConfig->children() as $field => $node) {
61
+ foreach ($cloneModel->getPrefixes() as $prefix) {
62
+ $mappedFields[$prefix['field'].(string)$field] = (string)$field;
63
+ }
64
+ }
65
+ }
66
+ }
67
+ // set value for group field entry by fieldname
68
+ // use extra memory
69
+ $fieldsetData = array();
70
+ foreach ($groupData['fields'] as $field => $fieldData) {
71
+ $fieldsetData[$field] = (is_array($fieldData) && isset($fieldData['value']))
72
+ ? $fieldData['value'] : null;
73
+ }
74
+
75
+ foreach ($groupData['fields'] as $field => $fieldData) {
76
+ $fieldConfig = $sections->descend($section . '/groups/' . $group . '/fields/' . $field);
77
+ if (!$fieldConfig && $clonedFields && isset($mappedFields[$field])) {
78
+ $fieldConfig = $sections->descend($section . '/groups/' . $group . '/fields/'
79
+ . $mappedFields[$field]);
80
+ }
81
+ if (!$fieldConfig) {
82
+ $node = $sections->xpath($section .'//' . $group . '[@type="group"]/fields/' . $field);
83
+ if ($node) {
84
+ $fieldConfig = $node[0];
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Get field backend model
90
+ */
91
+ // HACKATHON START
92
+ if ($fieldConfig) {
93
+ $backendClass = $fieldConfig->backend_model;
94
+ if (!$backendClass) {
95
+ $backendClass = 'core/config_data';
96
+ }
97
+ } else {
98
+ $backendClass = 'core/config_data';
99
+ }
100
+ // HACKATHON END
101
+
102
+
103
+ /** @var $dataObject Mage_Core_Model_Config_Data */
104
+ $dataObject = Mage::getModel($backendClass);
105
+ if (!$dataObject instanceof Mage_Core_Model_Config_Data) {
106
+ Mage::throwException('Invalid config field backend model: '.$backendClass);
107
+ }
108
+
109
+ $dataObject
110
+ ->setField($field)
111
+ ->setGroups($groups)
112
+ ->setGroupId($group)
113
+ ->setStoreCode($store)
114
+ ->setWebsiteCode($website)
115
+ ->setScope($scope)
116
+ ->setScopeId($scopeId)
117
+ ->setFieldConfig($fieldConfig)
118
+ ->setFieldsetData($fieldsetData)
119
+ ;
120
+
121
+ if (!isset($fieldData['value'])) {
122
+ $fieldData['value'] = null;
123
+ }
124
+
125
+ $path = $section . '/' . $group . '/' . $field;
126
+
127
+ /**
128
+ * Look for custom defined field path
129
+ */
130
+ if (is_object($fieldConfig)) {
131
+ $configPath = (string)$fieldConfig->config_path;
132
+ if (!empty($configPath) && strrpos($configPath, '/') > 0) {
133
+ // Extend old data with specified section group
134
+ $groupPath = substr($configPath, 0, strrpos($configPath, '/'));
135
+ if (!isset($oldConfigAdditionalGroups[$groupPath])) {
136
+ $oldConfig = $this->extendConfig($groupPath, true, $oldConfig);
137
+ $oldConfigAdditionalGroups[$groupPath] = true;
138
+ }
139
+ $path = $configPath;
140
+ }
141
+ }
142
+
143
+ $inherit = !empty($fieldData['inherit']);
144
+
145
+ $dataObject->setPath($path)
146
+ ->setValue($fieldData['value']);
147
+
148
+ if (isset($oldConfig[$path])) {
149
+ $dataObject->setConfigId($oldConfig[$path]['config_id']);
150
+
151
+ /**
152
+ * Delete config data if inherit
153
+ */
154
+ if (!$inherit) {
155
+ $saveTransaction->addObject($dataObject);
156
+ }
157
+ else {
158
+ $deleteTransaction->addObject($dataObject);
159
+ }
160
+ }
161
+ elseif (!$inherit) {
162
+ $dataObject->unsConfigId();
163
+ $saveTransaction->addObject($dataObject);
164
+ }
165
+ }
166
+ }
167
+
168
+ $deleteTransaction->delete();
169
+ $saveTransaction->save();
170
+
171
+ return $this;
172
+ }
173
+ }
app/code/community/Hackathon/MageTrashApp/Model/CoreResource.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Hackathon_MageTrashApp_Model_CoreResource extends Mage_Core_Model_Abstract{
4
+
5
+ /**
6
+ * Delete Core Resource for specified module
7
+ *
8
+ * @param $moduleName
9
+ * @param $resName
10
+ * @param $number
11
+ */
12
+ public function deleteCoreResource($moduleName, $resName, $number)
13
+ {
14
+ if (!$number) {
15
+ Mage::getSingleton('adminhtml/session')->AddNotice('No CoreResource version found for:'. $moduleName);
16
+ } else {
17
+ Mage::register('isSecureArea', true);
18
+ $resource = Mage::getResourceSingleton('magetrashapp/resource');
19
+ $resource->deleteDbVersion($resName, $number);
20
+ Mage::unregister('isSecureArea');
21
+
22
+ if ($resource->getDbVersion($resName) == $resName) {
23
+ Mage::getSingleton('adminhtml/session')->AddNotice('CoreResource Deleted for:'. $moduleName);
24
+ }
25
+ }
26
+ }
27
+
28
+ /**
29
+ * Reset Core Resource to specified version
30
+ *
31
+ * @param $moduleName
32
+ * @param $resName
33
+ * @param $number
34
+ */
35
+ public function rewindCoreResource ($moduleName, $resName, $number)
36
+ {
37
+ Mage::register('isSecureArea', true);
38
+ $resource = Mage::getResourceSingleton('core/resource');
39
+ $resource->setDbVersion($resName, $number);
40
+ Mage::unregister('isSecureArea');
41
+
42
+ if ($resource->getDbVersion($resName) == $number) {
43
+ Mage::getSingleton('adminhtml/session')->AddNotice($moduleName .
44
+ ' CoreResource version rewound to: ' .$number);
45
+ }
46
+ }
47
+ }
app/code/community/Hackathon/MageTrashApp/Model/Observer.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Hackathon_MageTrashApp_Model_Observer extends Mage_Core_Model_Abstract {
3
+
4
+ private $disableModules = array();
5
+
6
+ public function saveConfig($observer) {
7
+
8
+ $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
9
+
10
+ $dispatchResult = new Varien_Object($modules);
11
+
12
+ $modules = $dispatchResult->toArray();
13
+
14
+ foreach ($modules as $moduleName) {
15
+ if ($moduleName==='Mage_Adminhtml' ||$moduleName==='Hackathon_MageTrashApp'
16
+ || stripos($moduleName,'Mage_') !== false) {
17
+ continue;
18
+ }
19
+
20
+ $configFlag = Mage::getStoreConfig('magetrashapp/manage_extns/' . $moduleName);
21
+
22
+
23
+ switch ($configFlag) {
24
+ case Hackathon_MageTrashApp_Helper_Data::ENABLE:
25
+ Mage::helper('magetrashapp')->activateModule($moduleName);
26
+ break;
27
+ case Hackathon_MageTrashApp_Helper_Data::DISABLE:
28
+ $this->disableModules[] = $moduleName;
29
+ Mage::helper('magetrashapp')->activateModule($moduleName, false);
30
+
31
+ break;
32
+ case Hackathon_MageTrashApp_Helper_Data::UNINSTALL:
33
+ Mage::helper('magetrashapp')->uninstallModule($moduleName);
34
+ break;
35
+ default:
36
+ break;
37
+
38
+ }
39
+
40
+ $configFlag = Mage::getStoreConfig('magetrashapp/rewind_extns/' . $moduleName);
41
+
42
+ if ($configFlag != 0) {
43
+ $version = substr($configFlag, 2);
44
+ $configFlag = $configFlag[0];
45
+ } elseif (is_null($configFlag)) {
46
+ continue;
47
+ }
48
+
49
+ switch ($configFlag) {
50
+ case Hackathon_MageTrashApp_Helper_Data::DELETE:
51
+ Mage::helper('magetrashapp')->deleteCoreResource($moduleName);
52
+ break;
53
+ case Hackathon_MageTrashApp_Helper_Data::REWIND:
54
+ Mage::helper('magetrashapp')->rewindCoreResource($moduleName, $version);
55
+ break;
56
+ default:
57
+ break;
58
+
59
+ }
60
+
61
+ }
62
+
63
+
64
+ }
65
+
66
+
67
+ }
app/code/community/Hackathon/MageTrashApp/Model/PearWrapper.php ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Hackathon_MageTrashApp_Model_PearWrapper extends Mage_Core_Model_Abstract
5
+ {
6
+ const DEFAULT_SCONFIG_FILENAME = 'cache.cfg';
7
+
8
+ /**
9
+ * Object of config
10
+ *
11
+ * @var Mage_Connect_Config
12
+ */
13
+ protected $_config;
14
+
15
+ /**
16
+ * Object of single config
17
+ *
18
+ * @var Mage_Connect_Singleconfig
19
+ */
20
+ protected $_sconfig;
21
+
22
+ /**
23
+ * Object of frontend
24
+ *
25
+ * @var Mage_Connect_Frontend
26
+ */
27
+ protected $_frontend;
28
+
29
+ /**
30
+ * Internal cache for command objects
31
+ *
32
+ * @var array
33
+ */
34
+ protected $_cmdCache = array();
35
+
36
+ /**
37
+ * Console Started flag
38
+ *
39
+ * @var boolean
40
+ */
41
+ protected $_consoleStarted = false;
42
+
43
+ /**
44
+ * Instance of class
45
+ *
46
+ * @var Maged_Connect
47
+ */
48
+ static protected $_instance;
49
+
50
+ /**
51
+ * Constructor loads Config, Cache Config and initializes Frontend
52
+ */
53
+ public function __construct()
54
+ {
55
+ $this->getConfig();
56
+ $this->getSingleConfig();
57
+ //$this->getFrontend();
58
+ }
59
+
60
+ /**
61
+ * Destructor, sends Console footer if Console started
62
+ */
63
+ public function __destruct()
64
+ {
65
+ if ($this->_consoleStarted) {
66
+ $this->_consoleFooter();
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Initialize instance
72
+ *
73
+ * @return Maged_Connect
74
+ */
75
+ public static function getInstance()
76
+ {
77
+ if (!self::$_instance) {
78
+ self::$_instance = new self;
79
+ }
80
+ return self::$_instance;
81
+ }
82
+
83
+ /**
84
+ * Retrieve object of config and set it to Mage_Connect_Command
85
+ *
86
+ * @return Mage_Connect_Config
87
+ */
88
+ public function getConfig()
89
+ {
90
+ if (!$this->_config) {
91
+ $this->_config = new Mage_Connect_Config();
92
+ $ftp=$this->_config->__get('remote_config');
93
+ if(!empty($ftp)){
94
+ $packager = new Mage_Connect_Packager();
95
+ list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
96
+ $this->_config=$config;
97
+ $this->_sconfig=$cache;
98
+ }
99
+ $this->_config->magento_root = dirname(dirname(__FILE__)).DS.'..';
100
+ //Mage_Connect_Command::setConfigObject($this->_config);
101
+ }
102
+ return $this->_config;
103
+ }
104
+
105
+ /**
106
+ * Retrieve object of single config and set it to Mage_Connect_Command
107
+ *
108
+ * @param bool $reload
109
+ * @return Mage_Connect_Singleconfig
110
+ */
111
+ public function getSingleConfig($reload = false)
112
+ {
113
+ if(!$this->_sconfig || $reload) {
114
+ $this->_sconfig = new Mage_Connect_Singleconfig(
115
+
116
+ Mage::getModuleDir('etc','Hackathon_MageTrashApp').DIRECTORY_SEPARATOR
117
+ . self::DEFAULT_SCONFIG_FILENAME
118
+ );
119
+ }
120
+ Mage_Connect_Command::setSconfig($this->_sconfig);
121
+ return $this->_sconfig;
122
+
123
+ }
124
+
125
+ /**
126
+ * Retrieve object of frontend and set it to Mage_Connect_Command
127
+ *
128
+ * @return Maged_Connect_Frontend
129
+ */
130
+ public function getFrontend()
131
+ {
132
+ if (!$this->_frontend) {
133
+ $this->_frontend = new Maged_Connect_Frontend();
134
+ Mage_Connect_Command::setFrontendObject($this->_frontend);
135
+ }
136
+ return $this->_frontend;
137
+ }
138
+
139
+ /**
140
+ * Retrieve lof from frontend
141
+ *
142
+ * @return array
143
+ */
144
+ public function getLog()
145
+ {
146
+ return $this->getFrontend()->getLog();
147
+ }
148
+
149
+ /**
150
+ * Retrieve output from frontend
151
+ *
152
+ * @return array
153
+ */
154
+ public function getOutput()
155
+ {
156
+ return $this->getFrontend()->getOutput();
157
+ }
158
+
159
+ /**
160
+ * Clean registry
161
+ *
162
+ * @return Maged_Connect
163
+ */
164
+ public function cleanSconfig()
165
+ {
166
+ $this->getSingleConfig()->clear();
167
+ return $this;
168
+ }
169
+
170
+ /**
171
+ * Delete directory recursively
172
+ *
173
+ * @param string $path
174
+ * @return Maged_Connect
175
+ */
176
+ public function delTree($path) {
177
+ if (@is_dir($path)) {
178
+ $entries = @scandir($path);
179
+ foreach ($entries as $entry) {
180
+ if ($entry != '.' && $entry != '..') {
181
+ $this->delTree($path.DS.$entry);
182
+ }
183
+ }
184
+ @rmdir($path);
185
+ } else {
186
+ @unlink($path);
187
+ }
188
+ return $this;
189
+ }
190
+
191
+ /**
192
+ * Run commands from Mage_Connect_Command
193
+ *
194
+ * @param string $command
195
+ * @param array $options
196
+ * @param array $params
197
+ * @return boolean|Mage_Connect_Error
198
+ */
199
+ public function run($command, $options=array(), $params=array())
200
+ {
201
+ @set_time_limit(0);
202
+ @ini_set('memory_limit', '256M');
203
+
204
+ if (empty($this->_cmdCache[$command])) {
205
+ Mage_Connect_Command::getCommands();
206
+ /**
207
+ * @var $cmd Mage_Connect_Command
208
+ */
209
+ $cmd = Mage_Connect_Command::getInstance($command);
210
+ if ($cmd instanceof Mage_Connect_Error) {
211
+ return $cmd;
212
+ }
213
+ $this->_cmdCache[$command] = $cmd;
214
+ } else {
215
+ /**
216
+ * @var $cmd Mage_Connect_Command
217
+ */
218
+ $cmd = $this->_cmdCache[$command];
219
+ }
220
+ $ftp=$this->getConfig()->remote_config;
221
+ if(strlen($ftp)>0){
222
+ $options=array_merge($options, array('ftp'=>$ftp));
223
+ }
224
+ $cmd->run($command, $options, $params);
225
+ if ($cmd->ui()->hasErrors()) {
226
+ return false;
227
+ } else {
228
+ return true;
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Set remote Config by URI
234
+ *
235
+ * @param $uri
236
+ * @return Maged_Connect
237
+ */
238
+ public function setRemoteConfig($uri)
239
+ {
240
+ $this->getConfig()->remote_config=$uri;
241
+ return $this;
242
+ }
243
+
244
+
245
+ }
app/code/community/Hackathon/MageTrashApp/Model/Resource/Resource.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Hackathon_MageTrashApp_Model_Resource_Resource extends Mage_Core_Model_Resource_Resource
4
+ {
5
+ /**
6
+ * Delete core_resource entry
7
+ *
8
+ * @param $resName
9
+ * @param $version
10
+ * @return int
11
+ */
12
+ public function deleteDbVersion($resName, $version)
13
+ {
14
+ $dbModuleInfo = array(
15
+ 'code' => $resName,
16
+ 'version' => $version,
17
+ );
18
+
19
+ if ($this->getDbVersion($resName)) {
20
+ self::$_versions[$resName] = $resName;
21
+ return $this->_getWriteAdapter()->delete($this->getMainTable(),
22
+ array('code = ?' => $resName));
23
+ } else {
24
+ self::$_versions[$resName] = $version;
25
+ return $this->_getWriteAdapter()->insert($this->getMainTable(), $dbModuleInfo);
26
+ }
27
+ }
28
+ }
app/code/community/Hackathon/MageTrashApp/Model/Resource/Setup.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Hackathon_MageTrashApp_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
4
+ {
5
+
6
+ public function runUninstallSql($fileName,$resourceName) {
7
+
8
+ Mage::getSingleton('adminhtml/session')->addNotice('Invoking uninstall file for resource'.$resourceName);
9
+
10
+ $connection = Mage::getSingleton('core/resource')->getConnection($resourceName);
11
+
12
+ $connection->disallowDdlCache();
13
+
14
+ try {
15
+ // run sql uninstall php
16
+ $result = include $fileName;
17
+ // remove core_resource
18
+ if ($result) {
19
+ Mage::getSingleton('adminhtml/session')->
20
+ addNotice('Removing core resource '.$resourceName);
21
+ $this->deleteTableRow('core/resource', 'code', $resourceName);
22
+ }
23
+
24
+ } catch (Exception $e) {
25
+ $result = false;
26
+ Mage::log($e);
27
+ Mage::getSingleton('adminhtml/session')->
28
+ addWarning('Running uninstall failed for resource '.$resourceName);
29
+ }
30
+
31
+ $connection->allowDdlCache();
32
+
33
+ return $result;
34
+
35
+ }
36
+
37
+ }
app/code/community/Hackathon/MageTrashApp/Model/Uninstall.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Hackathon_MageTrashApp_Model_Uninstall extends Mage_Core_Model_Abstract
4
+ {
5
+ /**
6
+ * Run the uninstall sql script to remove everything from module in database
7
+ * This uninstall script must be provided by the extension provider
8
+ *
9
+ * @param $moduleName
10
+ */
11
+ public function uninstallSqlCommand ($moduleName)
12
+ {
13
+ Mage::getSingleton('adminhtml/session')->AddNotice('Running SQL Unininstall for Module:'.$moduleName);
14
+
15
+ $result = false;
16
+
17
+ $resources = Mage::getConfig()->getNode('global/resources')->children();
18
+ foreach ($resources as $resName => $resource) {
19
+ if (!$resource->setup) {
20
+ continue;
21
+ }
22
+
23
+ if (isset($resource->setup->module)) {
24
+ $testModName = (string)$resource->setup->module;
25
+ if ($testModName==$moduleName) {
26
+ $resourceName = $resName;
27
+ }
28
+ }
29
+ }
30
+
31
+ if (empty($resourceName)) {
32
+ return $result;
33
+ }
34
+
35
+ $fileName = $this->_getUninstallSQLFile($moduleName,$resourceName);
36
+
37
+ if (!is_null($fileName) ) {
38
+
39
+ $resource = new Hackathon_MageTrashApp_Model_Resource_Setup($resourceName);
40
+ $result = $resource->runUninstallSql($fileName,$resourceName);
41
+
42
+ } else {
43
+ Mage::getSingleton('adminhtml/session')->addNotice('Unable to find uninstall script for:'. $moduleName);
44
+ }
45
+
46
+ return $result;
47
+
48
+ }
49
+
50
+ /**
51
+ * Gets the Uninstall file contents if present
52
+ *
53
+ * Lifted and modified from Mage_Core_Resource_Setup::_getAvailableDbFiles()
54
+ *
55
+ * @return bool
56
+ */
57
+ protected function _getUninstallSQLFile($moduleName,$resourceName) {
58
+
59
+
60
+ $filesDir = Mage::getModuleDir('sql', $moduleName) . DS . $resourceName;
61
+ if (!is_dir($filesDir) || !is_readable($filesDir)) {
62
+ return null;
63
+ }
64
+
65
+ $uninstallFile = null;
66
+ $regExpDb = sprintf('#^.*%s\.(php|sql)$#i', 'uninstall');
67
+ $handlerDir = dir($filesDir);
68
+ while (false !== ($file = $handlerDir->read())) {
69
+ $matches = array();
70
+ if (preg_match($regExpDb, $file, $matches)) {
71
+ $uninstallFile = $filesDir . DS . $file;
72
+ break;
73
+ }
74
+ }
75
+ $handlerDir->close();
76
+
77
+ return $uninstallFile;
78
+ }
79
+
80
+
81
+ /**
82
+ * Options for uninstall are:
83
+ * 1. Pear
84
+ * 2. Using uninstall.sql and file as specified in config.xml
85
+ * Format of the file must be modman???
86
+ * @param $moduleName
87
+ */
88
+ public function processUninstallPackage($moduleName)
89
+ {
90
+ // if (!$this->processPearUninstall($moduleName)) {
91
+ $this->processFileBasedUninstall($moduleName);
92
+ // }
93
+ }
94
+
95
+ /**
96
+ * Attempts to uninstall Pear
97
+ *
98
+ * @param $moduleName
99
+ */
100
+ protected function processPearUninstall($moduleName) {
101
+ Mage::log("facebook foo");
102
+ $command = 'uninstall';
103
+ $params[] = 'community';
104
+ $params[] = $moduleName;
105
+ Mage_Connect_Command_Install::registerCommands(); // needed for init
106
+ $pear = new Mage_Connect_Command_Install();
107
+
108
+ // we need a config obj
109
+
110
+ /* @var $config Hackathon_MageTrashApp_Model_PearWrapper */
111
+ $config = Mage::getModel('magetrashapp/pearWrapper');
112
+ $bla = $config->getConfig();
113
+
114
+ /*$config = new Mage_Connect_Config();
115
+ $ftp=$config->__get('remote_config');
116
+ if(!empty($ftp)){
117
+ $packager = new Mage_Connect_Packager();
118
+ list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
119
+ $config;
120
+ }
121
+ $config->magento_root = dirname(dirname(__FILE__)).DS.'..';DS.'..';
122
+ */
123
+
124
+ $pear->setConfigObject($bla);
125
+
126
+ $result = $pear->doUninstall($command,array(),$params);
127
+
128
+ $bla = 'dfdf';
129
+
130
+ }
131
+
132
+ /**
133
+ * Attempts to uninstall Pear
134
+ *
135
+ * @param $moduleName
136
+ */
137
+ protected function processFileBasedUninstall($moduleName)
138
+ {
139
+ $magentoRoot = dirname(Mage::getRoot());
140
+
141
+ $config = Mage::app()->getConfig();
142
+ $configModule = $config->getModuleConfig($moduleName);
143
+
144
+ /* @var $configFile Mage_Core_Model_Config_Base */
145
+ $configFile = Mage::getModel('core/config_base');
146
+
147
+ /* @var $helper Hackathon_MageTrashApp_Helper_Data */
148
+ $helper = Mage::helper('magetrashapp');
149
+
150
+ // if ($configModule->is('active', true)) {
151
+ // Mage::throwException( $helper->__('The module %s must be disabled before to uninstall.', $moduleName));
152
+ // return;
153
+ // }
154
+
155
+ $etc = $config->getModuleDir('etc', $moduleName) . DS . 'config.xml';
156
+ $configFile->loadFile($etc);
157
+
158
+ $element = $configFile->getNode('uninstall');
159
+
160
+ if (!empty($element) && !$element->filename) {
161
+ $filename = $element->filename;
162
+ } else {
163
+ $filename = 'uninstall.txt';
164
+ }
165
+
166
+ $uninstallFile = $config->getModuleDir('etc', $moduleName) . DS . $filename;
167
+
168
+ if (file_exists($uninstallFile)) {
169
+ $handle = fopen($uninstallFile, 'r');
170
+ while ($line = fgets($handle)) {
171
+ $line = preg_replace('/\s+/', '%%%', $line);
172
+ $lines = explode('%%%', $line);
173
+
174
+ if (count($lines) > 2) { // modman file format, we take the second argument because it should be the path of the target installation
175
+ $pathsToDelete[] = $magentoRoot . DS . trim($lines[1], '/');
176
+ } else {
177
+ $pathsToDelete[] = $magentoRoot . DS . trim($lines[0], '/');
178
+ }
179
+ }
180
+ if (!feof($handle)) {
181
+ $helper->__('A problem occured while trying to get access to the uninstall file.');
182
+ }
183
+ fclose($handle);
184
+
185
+ foreach ($pathsToDelete as $dest) {
186
+ if(file_exists($dest) && (is_file($dest) || is_link($dest))) {
187
+ unlink($dest);
188
+ } else if (file_exists($dest)) {
189
+ $helper->rrmdir($dest);
190
+ }
191
+ }
192
+ return true;
193
+ }
194
+ return false;
195
+ }
196
+ }
app/code/community/Hackathon/MageTrashApp/Test/Config/Config.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Hackathon_MageTrashApp_Test_Config_Config extends EcomDev_PHPUnit_Test_Case_Config {
3
+
4
+ public function testObserverAliasExist(){
5
+ $this->assertModelAlias('magetrashapp/observer','Hackathon_MageTrashApp_Model_Observer');
6
+ }
7
+
8
+ }
app/code/community/Hackathon/MageTrashApp/Test/Helper/DataTest.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'app/Mage.php';
3
+ require_once 'app/code/community/Hackathon/MageTrashApp/Helper/Data.php';
4
+ require_once 'PHPUnit/Framework/TestCase.php';
5
+
6
+ /**
7
+ * Hackthon_MageTrashApp_Helper_Data test case.
8
+ */
9
+ class DataTest extends PHPUnit_Framework_TestCase {
10
+
11
+ /**
12
+ *
13
+ * @var Hackthon_MageTrashApp_Helper_Data
14
+ */
15
+ private $Hackthon_MageTrashApp_Helper_Data;
16
+
17
+ /**
18
+ * Prepares the environment before running a test.
19
+ */
20
+ protected function setUp() {
21
+ parent::setUp ();
22
+
23
+ // TODO Auto-generated DataTest::setUp()
24
+
25
+ $this->Hackthon_MageTrashApp_Helper_Data = new Hackthon_MageTrashApp_Helper_Data(/* parameters */);
26
+ }
27
+
28
+ /**
29
+ * Cleans up the environment after running a test.
30
+ */
31
+ protected function tearDown() {
32
+ // TODO Auto-generated DataTest::tearDown()
33
+ $this->Hackthon_MageTrashApp_Helper_Data = null;
34
+
35
+ parent::tearDown ();
36
+ }
37
+
38
+ /**
39
+ * Constructs the test case.
40
+ */
41
+ public function __construct() {
42
+ // TODO Auto-generated constructor
43
+ }
44
+ }
45
+
app/code/community/Hackathon/MageTrashApp/Test/Model/Observer.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Hackathon_MageTrashApp_Test_Model_Observer extends EcomDev_PHPUnit_Test_Case_Config {
3
+ /**
4
+ * @var Hackathon_MageTrashApp_Model_Observer
5
+ */
6
+ protected $model = null;
7
+
8
+ protected function setUp(){
9
+ $this->model = Mage::getModel('magetrashapp/observer');
10
+ }
11
+
12
+ }
app/code/community/Hackathon/MageTrashApp/controllers/Adminhtml/indexController.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Hackathon_MageTrashApp_Adminhtml_indexController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function uninstallAction ()
6
+ {
7
+ $moduleName = $this->getRequest()->getParam('module_name');
8
+
9
+ try {
10
+ Mage::helper()->uninstallModule($moduleName);
11
+ } catch (Exception $e) {
12
+
13
+ }
14
+ }
15
+
16
+
17
+ public function activateModule ()
18
+ {
19
+
20
+ }
21
+
22
+ public function deactivateModule ()
23
+ {
24
+
25
+ }
26
+ }
app/code/community/Hackathon/MageTrashApp/etc/adminhtml.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <magetrashapp translate="title" module="trashapp">
12
+ <title>Mage Trash App</title>
13
+ </magetrashapp>
14
+ </children>
15
+ </config>
16
+ </children>
17
+ </system>
18
+ </children>
19
+ </admin>
20
+ </resources>
21
+ </acl>
22
+ </config>
app/code/community/Hackathon/MageTrashApp/etc/config.xml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <phpunit>
4
+ <suite>
5
+ <modules>
6
+ <Hackathon_MageTrashApp />
7
+ </modules>
8
+ </suite>
9
+ </phpunit>
10
+
11
+ <modules>
12
+ <Hackathon_MageTrashApp>
13
+ <version>1.0.0</version>
14
+ </Hackathon_MageTrashApp>
15
+ </modules>
16
+
17
+ <global>
18
+ <blocks>
19
+ <magetrashapp>
20
+ <class>Hackathon_MageTrashApp_Block</class>
21
+ </magetrashapp>
22
+ <magetrashapp_adminhtml>
23
+ <class>Hackathon_MageTrashApp_Block_Adminhtml</class>
24
+ </magetrashapp_adminhtml>
25
+ </blocks>
26
+ <helpers>
27
+ <magetrashapp>
28
+ <class>Hackathon_MageTrashApp_Helper</class>
29
+ </magetrashapp>
30
+ </helpers>
31
+
32
+ <models>
33
+ <magetrashapp>
34
+ <class>Hackathon_MageTrashApp_Model</class>
35
+ <resourceModel>magetrashapp_resource</resourceModel>
36
+ </magetrashapp>
37
+ <magetrashapp_resource>
38
+ <class>Hackathon_MageTrashApp_Model_Resource</class>
39
+ </magetrashapp_resource>
40
+ <adminhtml>
41
+ <rewrite>
42
+ <config_data>Hackathon_MageTrashApp_Model_Adminhtml_Config_Data</config_data>
43
+ </rewrite>
44
+ </adminhtml>
45
+ </models>
46
+ <resources>
47
+ <magetrashapp_resource>
48
+ <setup>
49
+ <module>Hackathon_MageTrashApp</module>
50
+ </setup>
51
+ <connection>
52
+ <use>core_setup</use>
53
+ </connection>
54
+ </magetrashapp_resource>
55
+ </resources>
56
+ <events>
57
+ <admin_system_config_changed_section_magetrashapp>
58
+ <observers>
59
+ <hackathon_magetrashapp>
60
+ <class>Hackathon_MageTrashApp_Model_Observer</class>
61
+ <method>saveConfig</method>
62
+ </hackathon_magetrashapp>
63
+ </observers>
64
+ </admin_system_config_changed_section_magetrashapp>
65
+ </events>
66
+
67
+ </global>
68
+
69
+ <admin>
70
+ <routers>
71
+ <subscription>
72
+ <use>admin</use>
73
+ <args>
74
+ <module>Hackathon_MageTrashApp</module>
75
+ <frontName>magetrashapp</frontName>
76
+ </args>
77
+ </subscription>
78
+ </routers>
79
+ </admin>
80
+
81
+ <uninstall>
82
+ <filename>uninstall.txt</filename>
83
+ <!-- <path>.modman/Hackathon_MageTrashApp</path> -->
84
+ </uninstall>
85
+ </config>
app/code/community/Hackathon/MageTrashApp/etc/doc.uninstall.txt ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Place a file uninstall.txt into the folder etc/ of your module to allow to be triggered by this module when you deinstall it.
2
+ If you wish to change the name of this uninstall.txt file to something different, just set into the config.xml file of your module, the following:
3
+ <config>
4
+ ...
5
+ <uninstall>
6
+ <filename>myuninstallfile.txt</filename>
7
+ </uninstall>
8
+ </config>
9
+
10
+ The format of the content should start from the Magento Root path. For example: you want to deinstall the module Namepspace_Mymodule placed into the community code pool
11
+ Just do:
12
+ app/code/community/Namespace/Mymodule
13
+ app/etc/modules/Namespace_Mymodule.xml
14
+ js/mynamespace/
15
+ skin/frontend/base/default/images/mynapespace
16
+
17
+ If you have modman, you could copy the file of modman into the etc folder. In this case, the second part of each line will be taken to uninstall your module.
18
+ For example:
19
+ src/app/code/community/Namespace/Mymodule app/code/community/Namespace/Mymodule
20
+ src/app/etc/modules/Namespace_Mymodule.xml app/etc/modules/Namespace_Mymodule.xml
app/code/community/Hackathon/MageTrashApp/etc/system.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <sections>
5
+ <magetrashapp translate="label">
6
+ <label>Mage Trash App</label>
7
+ <tab>advanced</tab>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>999</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <groups>
14
+ <manage_extns>
15
+ <label>Extensions Installed</label>
16
+ <frontend_type>text</frontend_type>
17
+ <frontend_model>magetrashapp_adminhtml/system_config_form_fieldset_modules_mageTrashApp</frontend_model>
18
+ <sort_order>20</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ </manage_extns>
23
+ <rewind_extns>
24
+ <label>Rewind Extension</label>
25
+ <frontend_type>text</frontend_type>
26
+ <frontend_model>magetrashapp_adminhtml/system_config_form_fieldset_modules_rewind</frontend_model>
27
+ <sort_order>30</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ </rewind_extns>
32
+ </groups>
33
+ </magetrashapp>
34
+ </sections>
35
+ </config>
app/design/frontend/base/default/layout/username.xml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Diglin
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Diglin
23
+ * @package Diglin_Username
24
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+ <layout version="2.0.0">
29
+
30
+ <customer_account_index>
31
+ <reference name="customer_account_dashboard">
32
+ <block type="core/template" name="username_information" as="info1">
33
+ <action method="setTemplate" ifconfig="username/general/enabled">
34
+ <template>username/customer/account/dashboard/info.phtml</template>
35
+ </action>
36
+ </block>
37
+ </reference>
38
+ </customer_account_index>
39
+
40
+ <customer_account_login>
41
+ <reference name="customer_form_login">
42
+ <action method="setTemplate" ifconfig="username/general/enabled"><template>username/customer/form/login.phtml</template></action>
43
+ <action method="setTemplate" helper="username/data/isPersistentMustBeEnabled"><template>username/persistent/customer/form/login.phtml</template></action>
44
+ </reference>
45
+ </customer_account_login>
46
+
47
+ <customer_account_edit>
48
+ <reference name="customer_edit">
49
+ <action method="setTemplate" ifconfig="username/general/enabled"><template>username/customer/form/edit.phtml</template></action>
50
+ </reference>
51
+ </customer_account_edit>
52
+
53
+ <customer_account_create>
54
+ <reference name="customer_form_register">
55
+ <action method="setTemplate" ifconfig="username/general/enabled"><template>username/customer/form/register.phtml</template></action>
56
+ <action method="setTemplate" helper="username/data/isPersistentMustBeEnabled"><template>username/persistent/customer/form/register.phtml</template></action>
57
+ </reference>
58
+ </customer_account_create>
59
+
60
+ <customer_account_forgotpassword>
61
+ <reference name="forgotPassword">
62
+ <action method="setTemplate" ifconfig="username/general/enabled"><template>username/customer/form/forgotpassword.phtml</template></action>
63
+ </reference>
64
+ </customer_account_forgotpassword>
65
+
66
+ <checkout_onepage_index>
67
+ <reference name="checkout.onepage.billing">
68
+ <action method="setTemplate" ifconfig="username/general/enabled"><template>username/checkout/onepage/billing.phtml</template></action>
69
+ <action method="setTemplate" helper="username/data/isPersistentMustBeEnabled"><template>username/persistent/checkout/onepage/billing.phtml</template></action>
70
+ </reference>
71
+ <reference name="checkout.onepage.login">
72
+ <action method="setTemplate" ifconfig="username/general/enabled"><template>username/checkout/onepage/login.phtml</template></action>
73
+ <action method="setTemplate" helper="username/data/isPersistentMustBeEnabled"><template>username/persistent/checkout/onepage/login.phtml</template></action>
74
+ </reference>
75
+ </checkout_onepage_index>
76
+ </layout>
app/design/frontend/base/default/template/username/checkout/onepage/13/billing.phtml ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@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 Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <form id="co-billing-form" action="">
28
+ <fieldset>
29
+ <ul class="form-list">
30
+ <?php if ($this->customerHasAddresses()): ?>
31
+ <li class="wide">
32
+ <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
33
+ <div class="input-box">
34
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
35
+ </div>
36
+ </li>
37
+ <?php endif; ?>
38
+ <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
39
+ <fieldset>
40
+ <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
41
+ <ul>
42
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
43
+ <li class="fields">
44
+ <div class="field">
45
+ <label for="billing:company"><?php echo $this->__('Company') ?></label>
46
+ <div class="input-box">
47
+ <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
48
+ </div>
49
+ </div>
50
+ <?php if(!$this->isCustomerLoggedIn()): ?>
51
+ <div class="field">
52
+ <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
53
+ <div class="input-box">
54
+ <input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
55
+ </div>
56
+ </div>
57
+ <?php endif ?>
58
+ </li>
59
+ <?php if(!$this->isCustomerLoggedIn()): ?>
60
+ <li class="fields">
61
+ <div class="field">
62
+ <label for="billing:username" class="required"><em>*</em><?php echo $this->__('Username') ?></label>
63
+ <div class="input-box">
64
+ <input type="text" name="billing[username]" id="billing:username" value="<?php echo $this->escapeHtml($this->getAddress()->getUsername()) ?>" title="<?php echo $this->__('Username') ?>" class="input-text required-entry" />
65
+ </div>
66
+ </div>
67
+ <?php endif ?>
68
+ </li>
69
+ <li class="wide">
70
+ <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
71
+ <div class="input-box">
72
+ <input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text required-entry" />
73
+ </div>
74
+ </li>
75
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
76
+ <li class="wide">
77
+ <div class="input-box">
78
+ <input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text" />
79
+ </div>
80
+ </li>
81
+ <?php endfor ?>
82
+ <li class="fields">
83
+ <div class="field">
84
+ <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
85
+ <div class="input-box">
86
+ <input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text required-entry" id="billing:city" />
87
+ </div>
88
+ </div>
89
+ <div class="field">
90
+ <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
91
+ <div class="input-box">
92
+ <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
93
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
94
+ </select>
95
+ <script type="text/javascript">
96
+ //<![CDATA[
97
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
98
+ //]]>
99
+ </script>
100
+ <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
101
+ </div>
102
+ </div>
103
+ </li>
104
+ <li class="fields">
105
+ <div class="field">
106
+ <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
107
+ <div class="input-box">
108
+ <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international required-entry" />
109
+ </div>
110
+ </div>
111
+ <div class="field">
112
+ <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
113
+ <div class="input-box">
114
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
115
+ </div>
116
+ </div>
117
+ </li>
118
+ <li class="fields">
119
+ <div class="field">
120
+ <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
121
+ <div class="input-box">
122
+ <input type="text" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" id="billing:telephone" />
123
+ </div>
124
+ </div>
125
+ <div class="field">
126
+ <label for="billing:fax"><?php echo $this->__('Fax') ?></label>
127
+ <div class="input-box">
128
+ <input type="text" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text" id="billing:fax" />
129
+ </div>
130
+ </div>
131
+ </li>
132
+ <?php if(!$this->isCustomerLoggedIn()): ?>
133
+
134
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
135
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
136
+ <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
137
+ <li class="fields">
138
+ <?php if ($_dob->isEnabled()): ?>
139
+ <div class="field">
140
+ <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
141
+ </div>
142
+ <?php endif; ?>
143
+ <?php if ($_gender->isEnabled()): ?>
144
+ <div class="field">
145
+ <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
146
+ </div>
147
+ <?php endif ?>
148
+ </li>
149
+ <?php endif ?>
150
+
151
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
152
+ <?php if ($_taxvat->isEnabled()): ?>
153
+ <li>
154
+ <?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
155
+ </li>
156
+ <?php endif ?>
157
+
158
+ <li class="fields" id="register-customer-password">
159
+ <div class="field">
160
+ <label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
161
+ <div class="input-box">
162
+ <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
163
+ </div>
164
+ </div>
165
+ <div class="field">
166
+ <label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
167
+ <div class="input-box">
168
+ <input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
169
+ </div>
170
+ </div>
171
+ </li>
172
+ <?php endif; ?>
173
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
174
+ <li class="control">
175
+ <input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
176
+ </li>
177
+ <?php else:?>
178
+ <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
179
+ <?php endif; ?>
180
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
181
+ </ul>
182
+ </fieldset>
183
+ </li>
184
+ <?php /* Extensions placeholder */ ?>
185
+ <?php echo $this->getChildHtml('checkout.onepage.billing.extra')?>
186
+ <?php if ($this->canShip()): ?>
187
+ <li class="control">
188
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to this address') ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
189
+ <li class="control">
190
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to different address') ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
191
+ </li>
192
+ <?php endif; ?>
193
+ </ul>
194
+ <?php if (!$this->canShip()): ?>
195
+ <input type="hidden" name="billing[use_for_shipping]" value="1" />
196
+ <?php endif; ?>
197
+ <div class="buttons-set" id="billing-buttons-container">
198
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
199
+ <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
200
+ <span class="please-wait" id="billing-please-wait" style="display:none;">
201
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
202
+ </span>
203
+ </div>
204
+ </fieldset>
205
+ </form>
206
+ <script type="text/javascript">
207
+ //<![CDATA[
208
+ var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
209
+ var billingForm = new VarienForm('co-billing-form');
210
+
211
+ //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
212
+ $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
213
+
214
+ var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions, undefined, 'billing:postcode');
215
+ //]]>
216
+ </script>
app/design/frontend/{default/default/template/username/checkout/onepage → base/default/template/username/checkout/onepage/17}/billing.phtml RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Magento
4
  *
5
  * NOTICE OF LICENSE
6
  *
@@ -23,201 +23,8 @@
23
  * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
-
27
- if(version_compare(Mage::getVersion(), '1.7.0') < 0 ) { // Magento version < 1.7.0
28
  ?>
29
  <form id="co-billing-form" action="">
30
- <fieldset>
31
- <ul class="form-list">
32
- <?php if ($this->customerHasAddresses()): ?>
33
- <li class="wide">
34
- <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
35
- <div class="input-box">
36
- <?php echo $this->getAddressesHtmlSelect('billing') ?>
37
- </div>
38
- </li>
39
- <?php endif; ?>
40
- <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
41
- <fieldset>
42
- <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
43
- <ul>
44
- <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
45
- <li class="fields">
46
- <div class="field">
47
- <label for="billing:company"><?php echo $this->__('Company') ?></label>
48
- <div class="input-box">
49
- <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
50
- </div>
51
- </div>
52
- <?php if(!$this->isCustomerLoggedIn()): ?>
53
- <div class="field">
54
- <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
55
- <div class="input-box">
56
- <input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
57
- </div>
58
- </div>
59
- <?php endif ?>
60
- </li>
61
- <?php if(!$this->isCustomerLoggedIn()): ?>
62
- <li class="fields">
63
- <div class="field">
64
- <label for="billing:username" class="required"><em>*</em><?php echo $this->__('Username') ?></label>
65
- <div class="input-box">
66
- <input type="text" name="billing[username]" id="billing:username" value="<?php echo $this->escapeHtml($this->getAddress()->getUsername()) ?>" title="<?php echo $this->__('Username') ?>" class="input-text required-entry" />
67
- </div>
68
- </div>
69
- <?php endif ?>
70
- </li>
71
- <li class="wide">
72
- <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
73
- <div class="input-box">
74
- <input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text required-entry" />
75
- </div>
76
- </li>
77
- <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
78
- <li class="wide">
79
- <div class="input-box">
80
- <input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text" />
81
- </div>
82
- </li>
83
- <?php endfor ?>
84
- <li class="fields">
85
- <div class="field">
86
- <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
87
- <div class="input-box">
88
- <input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text required-entry" id="billing:city" />
89
- </div>
90
- </div>
91
- <div class="field">
92
- <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
93
- <div class="input-box">
94
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
95
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
96
- </select>
97
- <script type="text/javascript">
98
- //<![CDATA[
99
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
100
- //]]>
101
- </script>
102
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
103
- </div>
104
- </div>
105
- </li>
106
- <li class="fields">
107
- <div class="field">
108
- <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
109
- <div class="input-box">
110
- <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international required-entry" />
111
- </div>
112
- </div>
113
- <div class="field">
114
- <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
115
- <div class="input-box">
116
- <?php echo $this->getCountryHtmlSelect('billing') ?>
117
- </div>
118
- </div>
119
- </li>
120
- <li class="fields">
121
- <div class="field">
122
- <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
123
- <div class="input-box">
124
- <input type="text" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" id="billing:telephone" />
125
- </div>
126
- </div>
127
- <div class="field">
128
- <label for="billing:fax"><?php echo $this->__('Fax') ?></label>
129
- <div class="input-box">
130
- <input type="text" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text" id="billing:fax" />
131
- </div>
132
- </div>
133
- </li>
134
- <?php if(!$this->isCustomerLoggedIn()): ?>
135
-
136
- <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
137
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
138
- <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
139
- <li class="fields">
140
- <?php if ($_dob->isEnabled()): ?>
141
- <div class="field">
142
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
143
- </div>
144
- <?php endif; ?>
145
- <?php if ($_gender->isEnabled()): ?>
146
- <div class="field">
147
- <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
148
- </div>
149
- <?php endif ?>
150
- </li>
151
- <?php endif ?>
152
-
153
- <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
154
- <?php if ($_taxvat->isEnabled()): ?>
155
- <li>
156
- <?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
157
- </li>
158
- <?php endif ?>
159
-
160
- <li class="fields" id="register-customer-password">
161
- <div class="field">
162
- <label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
163
- <div class="input-box">
164
- <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
165
- </div>
166
- </div>
167
- <div class="field">
168
- <label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
169
- <div class="input-box">
170
- <input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
171
- </div>
172
- </div>
173
- </li>
174
- <?php endif; ?>
175
- <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
176
- <li class="control">
177
- <input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
178
- </li>
179
- <?php else:?>
180
- <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
181
- <?php endif; ?>
182
- <?php echo $this->getChildHtml('form.additional.info'); ?>
183
- </ul>
184
- </fieldset>
185
- </li>
186
- <?php /* Extensions placeholder */ ?>
187
- <?php echo $this->getChildHtml('checkout.onepage.billing.extra')?>
188
- <?php if ($this->canShip()): ?>
189
- <li class="control">
190
- <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to this address') ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
191
- <li class="control">
192
- <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to different address') ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
193
- </li>
194
- <?php endif; ?>
195
- </ul>
196
- <?php if (!$this->canShip()): ?>
197
- <input type="hidden" name="billing[use_for_shipping]" value="1" />
198
- <?php endif; ?>
199
- <div class="buttons-set" id="billing-buttons-container">
200
- <p class="required"><?php echo $this->__('* Required Fields') ?></p>
201
- <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
202
- <span class="please-wait" id="billing-please-wait" style="display:none;">
203
- <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
204
- </span>
205
- </div>
206
- </fieldset>
207
- </form>
208
- <script type="text/javascript">
209
- //<![CDATA[
210
- var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
211
- var billingForm = new VarienForm('co-billing-form');
212
-
213
- //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
214
- $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
215
-
216
- var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions, undefined, 'billing:postcode');
217
- //]]>
218
- </script>
219
- <?php } else { // Version Magento >= 1.7.0 ?>
220
- <form id="co-billing-form" action="">
221
  <fieldset>
222
  <ul class="form-list">
223
  <?php if ($this->customerHasAddresses()): ?>
@@ -250,7 +57,7 @@ if(version_compare(Mage::getVersion(), '1.7.0') < 0 ) { // Magento version < 1.7
250
  <?php endif; ?>
251
  </li>
252
  <?php if(!$this->isCustomerLoggedIn()): ?>
253
- <li class="fields">
254
  <div class="field">
255
  <label for="billing:username" class="required"><em>*</em><?php echo $this->__('Username') ?></label>
256
  <div class="input-box">
@@ -415,5 +222,4 @@ if(version_compare(Mage::getVersion(), '1.7.0') < 0 ) { // Magento version < 1.7
415
 
416
  var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
417
  //]]>
418
- </script>
419
- <?php } ?>
1
  <?php
2
  /**
3
+ * Diglin
4
  *
5
  * NOTICE OF LICENSE
6
  *
23
  * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
 
 
26
  ?>
27
  <form id="co-billing-form" action="">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  <fieldset>
29
  <ul class="form-list">
30
  <?php if ($this->customerHasAddresses()): ?>
57
  <?php endif; ?>
58
  </li>
59
  <?php if(!$this->isCustomerLoggedIn()): ?>
60
+ <li class="fields" id="register-username">
61
  <div class="field">
62
  <label for="billing:username" class="required"><em>*</em><?php echo $this->__('Username') ?></label>
63
  <div class="input-box">
222
 
223
  var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
224
  //]]>
225
+ </script>
 
app/design/frontend/base/default/template/username/checkout/onepage/billing.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@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 Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+ if(version_compare(Mage::getVersion(), '1.7.0') < 0 ) { // Magento version < 1.7.0
28
+ $version = '13';
29
+ } else { // Version Magento >= 1.7.0
30
+ $version = '17';
31
+ }
32
+
33
+ include_once dirname(__FILE__) . '/' . $version . '/billing.phtml';
app/design/frontend/{default → base}/default/template/username/checkout/onepage/login.phtml RENAMED
@@ -119,5 +119,14 @@
119
  loginForm.submit();
120
  }
121
  }
 
 
 
 
 
 
 
 
 
122
  //]]>
123
  </script>
119
  loginForm.submit();
120
  }
121
  }
122
+
123
+ // Diglin - Special Username
124
+ document.observe("login:setMethod", function (event){
125
+ if(event.memo.method == 'guest') {
126
+ Element.hide('register-username');
127
+ } else {
128
+ Element.show('register-username');
129
+ }
130
+ });
131
  //]]>
132
  </script>
app/design/frontend/base/default/template/username/customer/account/dashboard/info.phtml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@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 Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
28
+ ?>
29
+ <?php if ($customer->getUsername()):?>
30
+ <div class="box-account box-info">
31
+ <div class="box-head">
32
+ <h2><?php echo $this->__('Additional Information') ?></h2>
33
+ </div>
34
+ <div class="col2-set">
35
+ <div class="col-1">
36
+ <div class="box">
37
+ <div class="box-title">
38
+ <h3><?php echo $this->__('Extra User Information') ?></h3>
39
+ <a href="<?php echo $this->getUrl('customer/account/edit') ?>"><?php echo $this->__('Edit') ?></a>
40
+ </div>
41
+ <div class="box-content">
42
+ <p>
43
+ <?php echo $this->__('Username: ') . $this->htmlEscape($customer->getUsername()) ?>
44
+ </p>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ <?php endif; ?>
app/design/frontend/base/default/template/username/customer/form/13/register.phtml ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@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 Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Create account form template
29
+ *
30
+ * @see Mage_Customer_Block_Form_Register
31
+ */
32
+ ?>
33
+ <div class="account-create">
34
+ <div class="page-title">
35
+ <h1><?php echo $this->__('Create an Account') ?></h1>
36
+ </div>
37
+ <?php echo $this->getChildHtml('form_fields_before')?>
38
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
39
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
40
+ <div class="fieldset">
41
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
42
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
43
+ <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
44
+ <ul class="form-list">
45
+ <li class="fields">
46
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->toHtml() ?>
47
+ </li>
48
+ <li>
49
+ <div class="field">
50
+ <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
51
+ <div class="input-box">
52
+ <input type="text" name="email" id="email" value="<?php echo $this->htmlEscape($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text required-entry validate-email" />
53
+ </div>
54
+ </div>
55
+ <div class="field">
56
+ <label for="username" class="required"><em>*</em><?php echo Mage::helper('customer')->__('Username') ?></label>
57
+ <div class="input-box">
58
+ <input type="text" name="username" id="username" value="<?php echo $this->htmlEscape($this->getFormData()->getUsername()) ?>" title="<?php echo Mage::helper('customer')->__('Username') ?>" class="input-text required-entry" />
59
+ </div>
60
+ </div>
61
+ </li>
62
+ <?php if ($this->isNewsletterEnabled()): ?>
63
+ <li class="control">
64
+ <div class="input-box">
65
+ <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
66
+ </div>
67
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
68
+ </li>
69
+ <?php endif ?>
70
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
71
+ <?php if ($_dob->isEnabled()): ?>
72
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
73
+ <?php endif ?>
74
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
75
+ <?php if ($_taxvat->isEnabled()): ?>
76
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
77
+ <?php endif ?>
78
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
79
+ <?php if ($_gender->isEnabled()): ?>
80
+ <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
81
+ <?php endif ?>
82
+ </ul>
83
+ </div>
84
+ <?php if($this->getShowAddressFields()): ?>
85
+ <div class="fieldset">
86
+ <input type="hidden" name="create_address" value="1" />
87
+ <h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
88
+ <ul class="form-list">
89
+ <li class="fields">
90
+ <div class="field">
91
+ <label for="company"><?php echo $this->__('Company') ?></label>
92
+ <div class="input-box">
93
+ <input type="text" name="company" id="company" value="<?php echo $this->htmlEscape($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
94
+ </div>
95
+ </div>
96
+ <div class="field">
97
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
98
+ <div class="input-box">
99
+ <input type="text" name="telephone" id="telephone" value="<?php echo $this->htmlEscape($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" />
100
+ </div>
101
+ </div>
102
+ </li>
103
+ <li class="wide">
104
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
105
+ <div class="input-box">
106
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text required-entry" />
107
+ </div>
108
+ </li>
109
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
110
+ <li class="wide">
111
+ <div class="input-box">
112
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i?>" class="input-text" />
113
+ </div>
114
+ </li>
115
+ <?php endfor ?>
116
+ <li class="fields">
117
+ <div class="field">
118
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
119
+ <div class="input-box">
120
+ <input type="text" name="city" value="<?php echo $this->htmlEscape($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text required-entry" id="city" />
121
+ </div>
122
+ </div>
123
+ <div class="field">
124
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
125
+ <div class="input-box">
126
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
127
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
128
+ </select>
129
+ <script type="text/javascript">
130
+ //<![CDATA[
131
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
132
+ //]]>
133
+ </script>
134
+ <input type="text" id="region" name="region" value="<?php echo $this->htmlEscape($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
135
+ </div>
136
+ </div>
137
+ </li>
138
+ <li class="fields">
139
+ <div class="field">
140
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
141
+ <div class="input-box">
142
+ <input type="text" name="postcode" value="<?php echo $this->htmlEscape($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international required-entry" />
143
+ </div>
144
+ </div>
145
+ <div class="field">
146
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
147
+ <div class="input-box">
148
+ <?php echo $this->getCountryHtmlSelect() ?>
149
+ </div>
150
+ </div>
151
+ </li>
152
+ </ul>
153
+ <input type="hidden" name="default_billing" value="1" />
154
+ <input type="hidden" name="default_shipping" value="1" />
155
+ </div>
156
+ <?php endif; ?>
157
+ <div class="fieldset">
158
+ <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
159
+ <ul class="form-list">
160
+ <li class="fields">
161
+ <div class="field">
162
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
163
+ <div class="input-box">
164
+ <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
165
+ </div>
166
+ </div>
167
+ <div class="field">
168
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
169
+ <div class="input-box">
170
+ <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
171
+ </div>
172
+ </div>
173
+ </li>
174
+ </ul>
175
+ </div>
176
+ <div class="buttons-set">
177
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
178
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
179
+ <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
180
+ </div>
181
+ </form>
182
+ <script type="text/javascript">
183
+ //<![CDATA[
184
+ var dataForm = new VarienForm('form-validate', true);
185
+ <?php if($this->getShowAddressFields()): ?>
186
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
187
+ <?php endif; ?>
188
+ //]]>
189
+ </script>
190
+ </div>
app/design/frontend/{default/default/template/username/customer/form → base/default/template/username/customer/form/17}/register.phtml RENAMED
@@ -4,10 +4,10 @@
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.
@@ -21,176 +21,15 @@
21
  * @category Diglin
22
  * @package Diglin_Username
23
  * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
  */
26
 
27
- if (version_compare(Mage::getVersion(), '1.7.0') < 0) { // Magento version < 1.7.0
28
-
29
- /**
30
  * Create account form template
31
  *
32
  * @see Mage_Customer_Block_Form_Register
33
  */
34
  ?>
35
- <div class="account-create">
36
- <div class="page-title">
37
- <h1><?php echo $this->__('Create an Account') ?></h1>
38
- </div>
39
- <?php echo $this->getChildHtml('form_fields_before')?>
40
- <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
41
- <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
42
- <div class="fieldset">
43
- <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
44
- <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
45
- <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
46
- <ul class="form-list">
47
- <li class="fields">
48
- <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->toHtml() ?>
49
- </li>
50
- <li>
51
- <div class="field">
52
- <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
53
- <div class="input-box">
54
- <input type="text" name="email" id="email" value="<?php echo $this->htmlEscape($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text required-entry validate-email" />
55
- </div>
56
- </div>
57
- <div class="field">
58
- <label for="username" class="required"><em>*</em><?php echo Mage::helper('customer')->__('Username') ?></label>
59
- <div class="input-box">
60
- <input type="text" name="username" id="username" value="<?php echo $this->htmlEscape($this->getFormData()->getUsername()) ?>" title="<?php echo Mage::helper('customer')->__('Username') ?>" class="input-text required-entry" />
61
- </div>
62
- </div>
63
- </li>
64
- <?php if ($this->isNewsletterEnabled()): ?>
65
- <li class="control">
66
- <div class="input-box">
67
- <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
68
- </div>
69
- <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
70
- </li>
71
- <?php endif ?>
72
- <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
73
- <?php if ($_dob->isEnabled()): ?>
74
- <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
75
- <?php endif ?>
76
- <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
77
- <?php if ($_taxvat->isEnabled()): ?>
78
- <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
79
- <?php endif ?>
80
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
81
- <?php if ($_gender->isEnabled()): ?>
82
- <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
83
- <?php endif ?>
84
- </ul>
85
- </div>
86
- <?php if($this->getShowAddressFields()): ?>
87
- <div class="fieldset">
88
- <input type="hidden" name="create_address" value="1" />
89
- <h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
90
- <ul class="form-list">
91
- <li class="fields">
92
- <div class="field">
93
- <label for="company"><?php echo $this->__('Company') ?></label>
94
- <div class="input-box">
95
- <input type="text" name="company" id="company" value="<?php echo $this->htmlEscape($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
96
- </div>
97
- </div>
98
- <div class="field">
99
- <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
100
- <div class="input-box">
101
- <input type="text" name="telephone" id="telephone" value="<?php echo $this->htmlEscape($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" />
102
- </div>
103
- </div>
104
- </li>
105
- <li class="wide">
106
- <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
107
- <div class="input-box">
108
- <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text required-entry" />
109
- </div>
110
- </li>
111
- <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
112
- <li class="wide">
113
- <div class="input-box">
114
- <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i?>" class="input-text" />
115
- </div>
116
- </li>
117
- <?php endfor ?>
118
- <li class="fields">
119
- <div class="field">
120
- <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
121
- <div class="input-box">
122
- <input type="text" name="city" value="<?php echo $this->htmlEscape($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text required-entry" id="city" />
123
- </div>
124
- </div>
125
- <div class="field">
126
- <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
127
- <div class="input-box">
128
- <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
129
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
130
- </select>
131
- <script type="text/javascript">
132
- //<![CDATA[
133
- $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
134
- //]]>
135
- </script>
136
- <input type="text" id="region" name="region" value="<?php echo $this->htmlEscape($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
137
- </div>
138
- </div>
139
- </li>
140
- <li class="fields">
141
- <div class="field">
142
- <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
143
- <div class="input-box">
144
- <input type="text" name="postcode" value="<?php echo $this->htmlEscape($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international required-entry" />
145
- </div>
146
- </div>
147
- <div class="field">
148
- <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
149
- <div class="input-box">
150
- <?php echo $this->getCountryHtmlSelect() ?>
151
- </div>
152
- </div>
153
- </li>
154
- </ul>
155
- <input type="hidden" name="default_billing" value="1" />
156
- <input type="hidden" name="default_shipping" value="1" />
157
- </div>
158
- <?php endif; ?>
159
- <div class="fieldset">
160
- <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
161
- <ul class="form-list">
162
- <li class="fields">
163
- <div class="field">
164
- <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
165
- <div class="input-box">
166
- <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
167
- </div>
168
- </div>
169
- <div class="field">
170
- <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
171
- <div class="input-box">
172
- <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
173
- </div>
174
- </div>
175
- </li>
176
- </ul>
177
- </div>
178
- <div class="buttons-set">
179
- <p class="required"><?php echo $this->__('* Required Fields') ?></p>
180
- <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
181
- <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
182
- </div>
183
- </form>
184
- <script type="text/javascript">
185
- //<![CDATA[
186
- var dataForm = new VarienForm('form-validate', true);
187
- <?php if($this->getShowAddressFields()): ?>
188
- new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
189
- <?php endif; ?>
190
- //]]>
191
- </script>
192
- </div>
193
- <?php } else { // Magento version 1.7.0 ?>
194
  <div class="account-create">
195
  <div class="page-title">
196
  <h1><?php echo $this->__('Create an Account') ?></h1>
@@ -356,6 +195,4 @@ if (version_compare(Mage::getVersion(), '1.7.0') < 0) { // Magento version < 1.7
356
  <?php endif; ?>
357
  //]]>
358
  </script>
359
- </div>
360
-
361
- <?php } ?>
4
  *
5
  * NOTICE OF LICENSE
6
  *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
  * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
21
  * @category Diglin
22
  * @package Diglin_Username
23
  * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
 
27
+ /**
 
 
28
  * Create account form template
29
  *
30
  * @see Mage_Customer_Block_Form_Register
31
  */
32
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  <div class="account-create">
34
  <div class="page-title">
35
  <h1><?php echo $this->__('Create an Account') ?></h1>
195
  <?php endif; ?>
196
  //]]>
197
  </script>
198
+ </div>
 
 
app/design/frontend/{default → base}/default/template/username/customer/form/edit.phtml RENAMED
@@ -4,10 +4,10 @@
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.
@@ -21,7 +21,7 @@
21
  * @category Diglin
22
  * @package Diglin_Username
23
  * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
  */
26
  ?>
27
  <div class="page-title">
4
  *
5
  * NOTICE OF LICENSE
6
  *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
  * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
21
  * @category Diglin
22
  * @package Diglin_Username
23
  * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
27
  <div class="page-title">
app/design/frontend/base/default/template/username/customer/form/forgotpassword.phtml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@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 Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ *
26
+ * Diglin - change the strings to add 'Username' information
27
+ */
28
+ ?>
29
+ <div class="page-title">
30
+ <h1><?php echo $this->__('Forgot Your Password?') ?></h1>
31
+ </div>
32
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
33
+ <form action="<?php echo $this->getUrl('*/*/forgotpasswordpost') ?>" method="post" id="form-validate">
34
+ <div class="fieldset">
35
+ <h2 class="legend"><?php echo $this->__('Retrieve your password here') ?></h2>
36
+ <p><?php echo $this->__('Please enter your email address or username below. You will receive a link to reset your password.') ?></p>
37
+ <ul class="form-list">
38
+ <li>
39
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address/Username') ?></label>
40
+ <div class="input-box">
41
+ <input type="text" name="email" alt="email" id="email_address" class="input-text required-entry" value="<?php echo $this->htmlEscape($this->getEmailValue()) ?>" />
42
+ </div>
43
+ </li>
44
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
45
+ </ul>
46
+ </div>
47
+ <div class="buttons-set">
48
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
49
+ <p class="back-link"><a href="<?php echo $this->helper('customer')->getLoginUrl() ?>"><small>&laquo; </small><?php echo $this->__('Back to Login') ?></a></p>
50
+ <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
51
+ </div>
52
+ </form>
53
+ <script type="text/javascript">
54
+ //<![CDATA[
55
+ var dataForm = new VarienForm('form-validate', true);
56
+ //]]>
57
+ </script>
app/design/frontend/{default → base}/default/template/username/customer/form/login.phtml RENAMED
@@ -4,10 +4,10 @@
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.
@@ -21,7 +21,7 @@
21
  * @category Diglin
22
  * @package Diglin_Username
23
  * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
  */
26
  ?>
27
  <?php
4
  *
5
  * NOTICE OF LICENSE
6
  *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
  * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
  * If you did not receive a copy of the license and are unable to
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
21
  * @category Diglin
22
  * @package Diglin_Username
23
  * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
27
  <?php
app/design/frontend/base/default/template/username/customer/form/register.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@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 Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+
28
+ if(version_compare(Mage::getVersion(), '1.7.0') < 0 ) { // Magento version < 1.7.0
29
+ $version = '13';
30
+ } else { // Version Magento >= 1.7.0
31
+ $version = '17';
32
+ }
33
+
34
+ include_once dirname(__FILE__) . '/' . $version . '/register.phtml';
app/design/frontend/base/default/template/username/persistent/checkout/onepage/billing.phtml ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@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 design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ /** @var Mage_Checkout_Block_Onepage_Billing $this */
27
+ ?>
28
+ <form id="co-billing-form" action="">
29
+ <fieldset>
30
+ <ul class="form-list">
31
+ <?php if ($this->customerHasAddresses()): ?>
32
+ <li class="wide">
33
+ <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
34
+ <div class="input-box">
35
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
36
+ </div>
37
+ </li>
38
+ <?php endif; ?>
39
+ <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
40
+ <fieldset>
41
+ <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
42
+ <ul>
43
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
44
+ <li class="fields">
45
+ <div class="field">
46
+ <label for="billing:company"><?php echo $this->__('Company') ?></label>
47
+ <div class="input-box">
48
+ <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
49
+ </div>
50
+ </div>
51
+ <?php if(!$this->isCustomerLoggedIn()): ?>
52
+ <div class="field">
53
+ <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
54
+ <div class="input-box">
55
+ <input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
56
+ </div>
57
+ </div>
58
+ <?php endif; ?>
59
+ </li>
60
+ <?php if(!$this->isCustomerLoggedIn()): ?>
61
+ <li class="fields" id="register-username">
62
+ <div class="field">
63
+ <label for="billing:username" class="required"><em>*</em><?php echo $this->__('Username') ?></label>
64
+ <div class="input-box">
65
+ <input type="text" name="billing[username]" id="billing:username" value="<?php echo $this->escapeHtml($this->getAddress()->getUsername()) ?>" title="<?php echo $this->__('Username') ?>" class="input-text required-entry" />
66
+ </div>
67
+ </div>
68
+ <?php endif ?>
69
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
70
+ <li class="wide">
71
+ <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
72
+ <div class="input-box">
73
+ <input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
74
+ </div>
75
+ </li>
76
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
77
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
78
+ <li class="wide">
79
+ <div class="input-box">
80
+ <input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
81
+ </div>
82
+ </li>
83
+ <?php endfor; ?>
84
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
85
+ <li class="wide">
86
+ <label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
87
+ <div class="input-box">
88
+ <input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
89
+ </div>
90
+ </li>
91
+ <?php endif; ?>
92
+ <li class="fields">
93
+ <div class="field">
94
+ <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
95
+ <div class="input-box">
96
+ <input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
97
+ </div>
98
+ </div>
99
+ <div class="field">
100
+ <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
101
+ <div class="input-box">
102
+ <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
103
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
104
+ </select>
105
+ <script type="text/javascript">
106
+ //<![CDATA[
107
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
108
+ //]]>
109
+ </script>
110
+ <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
111
+ </div>
112
+ </div>
113
+ </li>
114
+ <li class="fields">
115
+ <div class="field">
116
+ <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
117
+ <div class="input-box">
118
+ <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
119
+ </div>
120
+ </div>
121
+ <div class="field">
122
+ <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
123
+ <div class="input-box">
124
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
125
+ </div>
126
+ </div>
127
+ </li>
128
+ <li class="fields">
129
+ <div class="field">
130
+ <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
131
+ <div class="input-box">
132
+ <input type="text" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="billing:telephone" />
133
+ </div>
134
+ </div>
135
+ <div class="field">
136
+ <label for="billing:fax"><?php echo $this->__('Fax') ?></label>
137
+ <div class="input-box">
138
+ <input type="text" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
139
+ </div>
140
+ </div>
141
+ </li>
142
+ <?php if(!$this->isCustomerLoggedIn()): ?>
143
+
144
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
145
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
146
+ <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
147
+ <li class="fields">
148
+ <?php if ($_dob->isEnabled()): ?>
149
+ <div class="field">
150
+ <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
151
+ </div>
152
+ <?php endif; ?>
153
+ <?php if ($_gender->isEnabled()): ?>
154
+ <div class="field">
155
+ <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
156
+ </div>
157
+ <?php endif ?>
158
+ </li>
159
+ <?php endif ?>
160
+
161
+ <?php if ($this->isTaxvatEnabled()):?>
162
+ <li><?php echo $this->getTaxvatHtml() ?></li>
163
+ <?php endif; ?>
164
+
165
+ <li class="fields" id="register-customer-password">
166
+ <div class="field">
167
+ <label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
168
+ <div class="input-box">
169
+ <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
170
+ </div>
171
+ </div>
172
+ <div class="field">
173
+ <label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
174
+ <div class="input-box">
175
+ <input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
176
+ </div>
177
+ </div>
178
+ </li>
179
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
180
+ <?php endif; ?>
181
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
182
+ <li class="control">
183
+ <input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
184
+ </li>
185
+ <?php else:?>
186
+ <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
187
+ <?php endif; ?>
188
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
189
+ </ul>
190
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
191
+ </fieldset>
192
+ </li>
193
+ <?php if ($this->canShip()): ?>
194
+ <li class="control">
195
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to this address') ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
196
+ <li class="control">
197
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to different address') ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
198
+ </li>
199
+ <?php endif; ?>
200
+ </ul>
201
+ <?php if (!$this->canShip()): ?>
202
+ <input type="hidden" name="billing[use_for_shipping]" value="1" />
203
+ <?php endif; ?>
204
+ <div class="buttons-set" id="billing-buttons-container">
205
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
206
+ <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
207
+ <span class="please-wait" id="billing-please-wait" style="display:none;">
208
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
209
+ </span>
210
+ </div>
211
+ </fieldset>
212
+ </form>
213
+ <script type="text/javascript">
214
+ //<![CDATA[
215
+ var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
216
+ var billingForm = new VarienForm('co-billing-form');
217
+
218
+ //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
219
+ $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
220
+
221
+ var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
222
+ if ($('onepage-guest-register-button')) {
223
+ Event.observe($('onepage-guest-register-button'), 'click', function(event) {
224
+ var billingRememberMe = $('co-billing-form').select('#remember-me-box');
225
+ if (billingRememberMe.length > 0) {
226
+ if ($('login:guest') && $('login:guest').checked) {
227
+ billingRememberMe[0].hide();
228
+ } else if ($('login:register') && ($('login:register').checked || $('login:register').type == 'hidden')) {
229
+ billingRememberMe[0].show();
230
+ }
231
+ }
232
+ });
233
+ }
234
+ //]]>
235
+ </script>
app/design/frontend/base/default/template/username/persistent/checkout/onepage/login.phtml ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@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 design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Customer onepage checkout login form template
30
+ *
31
+ * @see app/design/frontend/base/default/template/checkout/onepage/login.phtml
32
+ */
33
+ /** @var $this Mage_Checkout_Block_Onepage_Login */
34
+ ?>
35
+ <div class="col2-set">
36
+ <?php echo $this->getChildHtml('login_before')?>
37
+ <div class="col-1">
38
+ <h3><?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?><?php echo $this->__('Checkout as a Guest or Register') ?><?php else: ?><?php echo $this->__('Register to Create an Account') ?><?php endif; ?></h3>
39
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
40
+ <p><?php echo $this->__('Register with us for future convenience:') ?></p>
41
+ <?php else: ?>
42
+ <p><strong><?php echo $this->__('Register and save time!') ?></strong><br />
43
+ <?php echo $this->__('Register with us for future convenience:') ?></p>
44
+ <ul>
45
+ <li><?php echo $this->__('Fast and easy check out') ?></li>
46
+ <li><?php echo $this->__('Easy access to your order history and status') ?></li>
47
+ </ul>
48
+ <?php endif; ?>
49
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
50
+ <ul class="form-list">
51
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
52
+ <li class="control">
53
+ <input type="radio" name="checkout_method" id="login:guest" value="guest"<?php if($this->getQuote()->getCheckoutMethod()==Mage_Checkout_Model_Type_Onepage::METHOD_GUEST): ?> checked="checked"<?php endif; ?> class="radio" /><label for="login:guest"><?php echo $this->__('Checkout as Guest') ?></label>
54
+ </li>
55
+ <?php endif; ?>
56
+ <li class="control">
57
+ <input type="radio" name="checkout_method" id="login:register" value="register"<?php if($this->getQuote()->getCheckoutMethod()==Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER || !$this->getQuote()->isAllowedGuestCheckout()): ?> checked="checked"<?php endif ?> class="radio" /><label for="login:register"><?php echo $this->__('Register') ?></label>
58
+ </li>
59
+ </ul>
60
+ <h4><?php echo $this->__('Register and save time!') ?></h4>
61
+ <p><?php echo $this->__('Register with us for future convenience:') ?></p>
62
+ <ul class="ul">
63
+ <li><?php echo $this->__('Fast and easy check out') ?></li>
64
+ <li><?php echo $this->__('Easy access to your order history and status') ?></li>
65
+ </ul>
66
+ <?php else: ?>
67
+ <input type="hidden" name="checkout_method" id="login:register" value="register" checked="checked" />
68
+ <?php endif; ?>
69
+ </div>
70
+ <div class="col-2">
71
+ <h3><?php echo $this->__('Login') ?></h3>
72
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
73
+ <form id="login-form" action="<?php echo $this->getPostAction() ?>" method="post">
74
+ <fieldset>
75
+ <h4><?php echo $this->__('Already registered?') ?></h4>
76
+ <p><?php echo $this->__('Please log in below:') ?></p>
77
+ <ul class="form-list">
78
+ <li>
79
+ <label for="login-email" class="required"><em>*</em><?php echo $this->__('Email Address/Username') ?></label>
80
+ <div class="input-box">
81
+ <input type="text" class="input-text required-entry" id="login-email" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" />
82
+ </div>
83
+ </li>
84
+ <li>
85
+ <label for="login-password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
86
+ <div class="input-box">
87
+ <input type="password" class="input-text required-entry" id="login-password" name="login[password]" />
88
+ </div>
89
+ </li>
90
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
91
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
92
+ </ul>
93
+ <input name="context" type="hidden" value="checkout" />
94
+ </fieldset>
95
+ </form>
96
+ </div>
97
+ </div>
98
+ <div class="col2-set">
99
+ <div class="col-1">
100
+ <div class="buttons-set">
101
+ <p class="required">&nbsp;</p>
102
+ <?php if ($this->getQuote()->isAllowedGuestCheckout()): ?>
103
+ <button id="onepage-guest-register-button" type="button" class="button" onclick="checkout.setMethod();"><span><span><?php echo $this->__('Continue') ?></span></span></button>
104
+ <?php elseif ($this->helper('checkout')->isCustomerMustBeLogged()): ?>
105
+ <button id="onepage-guest-register-button" type="button" class="button" onclick="window.location='<?php echo $this->helper('checkout/url')->getRegistrationUrl();?>'"><span><span><?php echo $this->__('Register') ?></span></span></button>
106
+ <?php else: ?>
107
+ <form action="<?php echo $this->getUrl('persistent/index/saveMethod'); ?>">
108
+ <button id="onepage-guest-register-button" type="submit" class="button"><span><span><?php echo $this->__('Register') ?></span></span></button>
109
+ </form>
110
+ <?php endif; ?>
111
+ </div>
112
+ </div>
113
+ <div class="col-2">
114
+ <div class="buttons-set">
115
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
116
+ <a href="<?php echo $this->getUrl('customer/account/forgotpassword') ?>" class="f-left"><?php echo $this->__('Forgot your password?') ?></a>
117
+ <button type="submit" class="button" onclick="onepageLogin(this)"><span><span><?php echo $this->__('Login') ?></span></span></button>
118
+ </div>
119
+ </div>
120
+ </div>
121
+ <script type="text/javascript">
122
+ //<![CDATA[
123
+ var loginForm = new VarienForm('login-form', true);
124
+ $('login-email').observe('keypress', bindLoginPost);
125
+ $('login-password').observe('keypress', bindLoginPost);
126
+ function bindLoginPost(evt){
127
+ if (evt.keyCode == Event.KEY_RETURN) {
128
+ loginForm.submit();
129
+ }
130
+ }
131
+ function onepageLogin(button)
132
+ {
133
+ if(loginForm.validator && loginForm.validator.validate()){
134
+ button.disabled = true;
135
+ loginForm.submit();
136
+ }
137
+ }
138
+
139
+ // Diglin - Special Username
140
+ document.observe("login:setMethod", function (event){
141
+ if(event.memo.method == 'guest') {
142
+ Element.hide('register-username');
143
+ } else {
144
+ Element.show('register-username');
145
+ }
146
+ });
147
+ //]]>
148
+ </script>
149
+ <?php
150
+ $registerParam = $this->getRequest()->getParam('register');
151
+ if ($registerParam || $registerParam === ''):
152
+ ?>
153
+ <script type="text/javascript">
154
+ //<![CDATA[
155
+ document.observe("dom:loaded", function() {
156
+ if($('login:register')) {
157
+ $('login:register').checked = true;
158
+ checkout.setMethod();
159
+ }
160
+ })
161
+ //]]>
162
+ </script>
163
+ <?php endif; ?>
app/design/frontend/base/default/template/username/persistent/customer/form/login.phtml ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@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 design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Customer login form template
30
+ *
31
+ * @see app/design/frontend/base/default/template/customer/form/login.phtml
32
+ */
33
+ /** @var $this Mage_Customer_Block_Form_Login */
34
+ ?>
35
+ <div class="account-login">
36
+ <div class="page-title">
37
+ <h1><?php echo $this->__('Login or Create an Account') ?></h1>
38
+ </div>
39
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
40
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form">
41
+ <div class="col2-set">
42
+ <div class="col-1 new-users">
43
+ <div class="content">
44
+ <h2><?php echo $this->__('New Customers') ?></h2>
45
+ <p><?php echo $this->__('By creating an account with our store, you will be able to move through the checkout process faster, store multiple shipping addresses, view and track your orders in your account and more.') ?></p>
46
+ </div>
47
+ </div>
48
+ <div class="col-2 registered-users">
49
+ <div class="content">
50
+ <h2><?php echo $this->__('Registered Customers') ?></h2>
51
+ <p><?php echo $this->__('If you have an account with us, please log in.') ?></p>
52
+ <ul class="form-list">
53
+ <li>
54
+ <label for="email" class="required"><em>*</em><?php echo Mage::helper('customer')->__('Email Address/Username') ?></label>
55
+ <div class="input-box">
56
+ <input type="text" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" id="email" class="input-text required-entry" title="<?php echo Mage::helper('customer')->__('Email Address/Username') ?>" />
57
+ </div>
58
+ </li>
59
+ <li>
60
+ <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
61
+ <div class="input-box">
62
+ <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
63
+ </div>
64
+ </li>
65
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
66
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
67
+ </ul>
68
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
69
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
70
+ </div>
71
+ </div>
72
+ </div>
73
+ <div class="col2-set">
74
+ <div class="col-1 new-users">
75
+ <div class="buttons-set">
76
+ <button type="button" title="<?php echo $this->__('Create an Account') ?>" class="button" onclick="window.location='<?php echo Mage::helper('persistent')->getCreateAccountUrl($this->getCreateAccountUrl()) ?>';"><span><span><?php echo $this->__('Create an Account') ?></span></span></button>
77
+ </div>
78
+ </div>
79
+ <div class="col-2 registered-users">
80
+ <div class="buttons-set">
81
+ <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
82
+ <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
83
+ </div>
84
+ </div>
85
+ </div>
86
+ <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
87
+ <input name="context" type="hidden" value="checkout" />
88
+ <?php endif; ?>
89
+ </form>
90
+ <script type="text/javascript">
91
+ //<![CDATA[
92
+ var dataForm = new VarienForm('login-form', true);
93
+ //]]>
94
+ </script>
95
+ </div>
app/design/frontend/base/default/template/username/persistent/customer/form/register.phtml ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@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 design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Create account form template
30
+ *
31
+ * @see app/design/frontend/base/default/template/customer/form/register.phtml
32
+ */
33
+ /** @var $this Mage_Customer_Block_Form_Register */
34
+ ?>
35
+ <div class="account-create">
36
+ <div class="page-title">
37
+ <h1><?php echo $this->__('Create an Account') ?></h1>
38
+ </div>
39
+ <?php echo $this->getChildHtml('form_fields_before')?>
40
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
41
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
42
+ <div class="fieldset">
43
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
44
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
45
+ <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
46
+ <ul class="form-list">
47
+ <li class="fields">
48
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>
49
+ </li>
50
+ <li>
51
+ <div class="field">
52
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
53
+ <div class="input-box">
54
+ <input type="text" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
55
+ </div>
56
+ </div>
57
+
58
+ <div class="field">
59
+ <label for="username" class="required"><em>*</em><?php echo Mage::helper('customer')->__('Username') ?></label>
60
+ <div class="input-box">
61
+ <input type="text" name="username" id="username" value="<?php echo $this->htmlEscape($this->getFormData()->getUsername()) ?>" title="<?php echo Mage::helper('customer')->__('Username') ?>" class="input-text required-entry" />
62
+ </div>
63
+ </div>
64
+ </li>
65
+ <?php if ($this->isNewsletterEnabled()): ?>
66
+ <li class="control">
67
+ <div class="input-box">
68
+ <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
69
+ </div>
70
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
71
+ </li>
72
+ <?php endif ?>
73
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
74
+ <?php if ($_dob->isEnabled()): ?>
75
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
76
+ <?php endif ?>
77
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
78
+ <?php if ($_taxvat->isEnabled()): ?>
79
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
80
+ <?php endif ?>
81
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
82
+ <?php if ($_gender->isEnabled()): ?>
83
+ <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
84
+ <?php endif ?>
85
+ </ul>
86
+ </div>
87
+ <?php if($this->getShowAddressFields()): ?>
88
+ <div class="fieldset">
89
+ <input type="hidden" name="create_address" value="1" />
90
+ <h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
91
+ <ul class="form-list">
92
+ <li class="fields">
93
+ <div class="field">
94
+ <label for="company"><?php echo $this->__('Company') ?></label>
95
+ <div class="input-box">
96
+ <input type="text" name="company" id="company" value="<?php echo $this->escapeHtml($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
97
+ </div>
98
+ </div>
99
+ <div class="field">
100
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
101
+ <div class="input-box">
102
+ <input type="text" name="telephone" id="telephone" value="<?php echo $this->escapeHtml($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" />
103
+ </div>
104
+ </div>
105
+ </li>
106
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
107
+ <li class="wide">
108
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
109
+ <div class="input-box">
110
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" />
111
+ </div>
112
+ </li>
113
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
114
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
115
+ <li class="wide">
116
+ <div class="input-box">
117
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" />
118
+ </div>
119
+ </li>
120
+ <?php endfor; ?>
121
+ <li class="fields">
122
+ <div class="field">
123
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
124
+ <div class="input-box">
125
+ <input type="text" name="city" value="<?php echo $this->escapeHtml($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
126
+ </div>
127
+ </div>
128
+ <div class="field">
129
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
130
+ <div class="input-box">
131
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
132
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
133
+ </select>
134
+ <script type="text/javascript">
135
+ //<![CDATA[
136
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
137
+ //]]>
138
+ </script>
139
+ <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
140
+ </div>
141
+ </div>
142
+ </li>
143
+ <li class="fields">
144
+ <div class="field">
145
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
146
+ <div class="input-box">
147
+ <input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
148
+ </div>
149
+ </div>
150
+ <div class="field">
151
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
152
+ <div class="input-box">
153
+ <?php echo $this->getCountryHtmlSelect() ?>
154
+ </div>
155
+ </div>
156
+ </li>
157
+ </ul>
158
+ <input type="hidden" name="default_billing" value="1" />
159
+ <input type="hidden" name="default_shipping" value="1" />
160
+ </div>
161
+ <?php endif; ?>
162
+ <div class="fieldset">
163
+ <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
164
+ <ul class="form-list">
165
+ <li class="fields">
166
+ <div class="field">
167
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
168
+ <div class="input-box">
169
+ <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
170
+ </div>
171
+ </div>
172
+ <div class="field">
173
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
174
+ <div class="input-box">
175
+ <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
176
+ </div>
177
+ </div>
178
+ </li>
179
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
180
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
181
+ </ul>
182
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
183
+ </div>
184
+ <div class="buttons-set">
185
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
186
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
187
+ <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
188
+ </div>
189
+ <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
190
+ <input name="context" type="hidden" value="checkout" />
191
+ <?php endif; ?>
192
+ </form>
193
+ <script type="text/javascript">
194
+ //<![CDATA[
195
+ var dataForm = new VarienForm('form-validate', true);
196
+ <?php if($this->getShowAddressFields()): ?>
197
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
198
+ <?php endif; ?>
199
+ //]]>
200
+ </script>
201
+ </div>
app/design/frontend/default/default/layout/username.xml DELETED
@@ -1,62 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!--
3
- /**
4
- * Diglin
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Open Software License (OSL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
- *
16
- * DISCLAIMER
17
- *
18
- * Do not edit or add to this file if you wish to upgrade Magento to newer
19
- * versions in the future. If you wish to customize Magento for your
20
- * needs please refer to http://www.magentocommerce.com for more information.
21
- *
22
- * @category Diglin
23
- * @package Diglin_Username
24
- * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
25
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
- */
27
- -->
28
- <layout version="0.1.0">
29
-
30
- <customer_account_index>
31
- <reference name="customer_account_dashboard">
32
- <block type="customer/account_dashboard_info" name="customer_account_dashboard_info" as="info" template="username/customer/account/dashboard/info.phtml"/>
33
- </reference>
34
- </customer_account_index>
35
-
36
- <customer_account_login>
37
- <reference name="customer_form_login">
38
- <action method="setTemplate"><template>username/customer/form/login.phtml</template></action>
39
- </reference>
40
- </customer_account_login>
41
-
42
- <customer_account_edit>
43
- <reference name="customer_edit">
44
- <action method="setTemplate"><template>username/customer/form/edit.phtml</template></action>
45
- </reference>
46
- </customer_account_edit>
47
-
48
- <customer_account_create>
49
- <reference name="customer_form_register">
50
- <action method="setTemplate"><template>username/customer/form/register.phtml</template></action>
51
- </reference>
52
- </customer_account_create>
53
-
54
- <checkout_onepage_index>
55
- <reference name="checkout.onepage.billing">
56
- <action method="setTemplate"><template>username/checkout/onepage/billing.phtml</template></action>
57
- </reference>
58
- <reference name="checkout.onepage.login">
59
- <action method="setTemplate"><template>username/checkout/onepage/login.phtml</template></action>
60
- </reference>
61
- </checkout_onepage_index>
62
- </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/default/default/template/username/checkout/.DS_Store DELETED
Binary file
app/design/frontend/default/default/template/username/customer/account/dashboard/info.phtml DELETED
@@ -1,65 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@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 design
22
- * @package base_default
23
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
- ?>
27
- <div class="col2-set">
28
- <div class="col-1">
29
- <div class="box">
30
- <div class="box-title">
31
- <h3><?php echo $this->__('Contact Information') ?></h3>
32
- <a href="<?php echo $this->getUrl('customer/account/edit') ?>"><?php echo $this->__('Edit') ?></a>
33
- </div>
34
- <div class="box-content">
35
- <p>
36
- <?php echo $this->htmlEscape($this->getCustomer()->getName()) ?><br />
37
- <?php echo ($this->getCustomer()->getUsername()) ? $this->htmlEscape($this->getCustomer()->getUsername()) . '<br />' : ''; ?>
38
- <?php echo $this->htmlEscape($this->getCustomer()->getEmail()) ?><br />
39
- <a href="<?php echo $this->getChangePasswordUrl() ?>"><?php echo $this->__('Change Password') ?></a>
40
- </p>
41
- </div>
42
- </div>
43
- </div>
44
- <?php if( $this->isNewsletterEnabled() ): ?>
45
- <div class="col-2">
46
- <div class="box">
47
- <div class="box-title">
48
- <h3><?php echo $this->__('Newsletters') ?></h3>
49
- <a href="<?php echo $this->getUrl('newsletter/manage') ?>"><?php echo $this->__('Edit') ?></a>
50
- </div>
51
- <div class="box-content">
52
- <p>
53
- <?php if( $this->getIsSubscribed() ): ?>
54
- <?php echo $this->__("You are currently subscribed to 'General Subscription'.") ?>
55
- <?php else: ?>
56
- <?php echo $this->__('You are currently not subscribed to any newsletter.') ?>
57
- <?php endif; ?>
58
- </p>
59
- </div>
60
- </div>
61
- <?php /* Extensions placeholder */ ?>
62
- <?php echo $this->getChildHtml('customer.account.dashboard.info.extra')?>
63
- </div>
64
- <?php endif; ?>
65
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/Diglin_Username.xml CHANGED
@@ -1,12 +1,11 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Diglin_Username>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- <depends>
8
- <Mage_Customer />
9
- </depends>
10
- </Diglin_Username>
11
- </modules>
12
- </config>
1
+ <config>
2
+ <modules>
3
+ <Diglin_Username>
4
+ <active>true</active>
5
+ <codePool>community</codePool>
6
+ <depends>
7
+ <Mage_Customer/>
8
+ </depends>
9
+ </Diglin_Username>
10
+ </modules>
11
+ </config>
 
app/etc/modules/Hackathon_MageTrashApp.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Hackathon_MageTrashApp>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Hackathon_MageTrashApp>
8
+ </modules>
9
+ </config>
app/locale/de_DE/Diglin_Username.csv CHANGED
@@ -1,4 +1,4 @@
1
- This account is disabled.","Dieses Benutzerkonto ist deaktiviert.”
2
- Username”,"Benutzername"
3
- Email Address/Username”,"E-Mail-Adresse/Benutzername"
4
- Email/Username:”,"E-Mail-Adresse/Benutzername:"
1
+ "This account is disabled.","Dieses Benutzerkonto ist deaktiviert."
2
+ "Username","Benutzername"
3
+ "Email Address/Username","E-Mail-Adresse/Benutzername"
4
+ "Email/Username:","E-Mail-Adresse/Benutzername:"
package.xml CHANGED
@@ -1,25 +1,36 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Diglin_Username</name>
4
- <version>1.5.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Create and login to an account thanks to a username AND email address.&#xD;
10
  Allow to disable an account from backend. The user will be blocked if the option in the customer backend is set to no</summary>
11
- <description>This module allows you to:&#xD;
12
  &#xD;
13
- - login with a username or email address. it can be done from frontend during checkout or getting access to the customer account&#xD;
14
- - Username can have letters, digits, '_-' but no other special characters&#xD;
15
- - Username length is from 6 until 30 characters possible&#xD;
16
- - save a username from frontend (register account or checkout process) or from backend by editing a customer account&#xD;
17
- - check that the username doesn't already exists&#xD;
18
- - deactivate temporary customer account from Customer Management page (bonus functionnality). The user will be blocked if the option in the customer backend is set to no.&#xD;
19
- - The default template override some customer and checkout views to adapt display for login pages, checkout process and account edition in frontend. If you have a customized template, please check the layout file username.xml and compare with your template to use or adapt to your situation.&#xD;
 
 
 
 
 
 
20
  &#xD;
21
- Compatible Magento version &gt;= 1.4.2 until 1.6.2</description>
22
- <notes>- Version 1.5.0: update for Magento 1.7&#xD;
 
 
 
 
 
23
  - Version 1.4.0: fix a problem to enable and disable a customer account from Customer Management in backend&#xD;
24
  - Version 1.3.0: new features. Configurable options: display username in Manage Customer Grid, allow customer to edit or not username in frontend My Account, define maximum and minimum length of username for the forms, define what kind of validation desired (letters, digits, both or both " _-)&#xD;
25
  - Version 1.2.1: fix customer account layout &#xD;
@@ -28,10 +39,10 @@ Compatible Magento version &gt;= 1.4.2 until 1.6.2</description>
28
  - Version 1.0.2 - fix a bug with the installation&#xD;
29
  - Version 1.0.1 - fix bug in sql query during installation on prefixed tables, add german translation, do package for Magento version prior to 1.5 and version 1.5.x&#xD;
30
  - Version 1.0.0 - stable version</notes>
31
- <authors><author><name>diglin</name><user>auto-converted</user><email>sly@diglin.com</email></author></authors>
32
- <date>2012-07-19</date>
33
- <time>21:40:26</time>
34
- <contents><target name="mageetc"><dir name="modules"><file name="Diglin_Username.xml" hash="79603fae3def6dd098d4be51897e1ec6"/></dir></target><target name="magecommunity"><dir name="Diglin"><dir name="Username"><dir name="Block"><dir name="Overwrite"><dir name="Adminhtml"><dir name="Config"><dir name="Source"><file name="Hint.php" hash="6419dadae08bf316492007996b03c9b9"/></dir></dir><file name="Grid.php" hash="8cca181c48ec4121ef06cc7a71c3fc4c"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f8f4c678fdc809d2376d6b214a3136db"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Inputvalidation.php" hash="24975e73aaa2d6eaef58e4fecf2864c9"/></dir></dir><dir name="Entity"><file name="Customer.php" hash="c6b4911f86363800bf65c52a68f32f21"/><file name="Setup.php" hash="f656439839e04fc017b2580cf3b56f4d"/></dir><file name="Customer.php" hash="91c0ed4c64415c4becb4d97079035a2f"/><file name="Form.php" hash="c99df4acc8e7e7958ea87697d2b4dd6a"/><file name="Observer.php" hash="de039323ed6ab0347281f074ac3c591a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8eaa2843438b116e9d0425fcdd2ccabf"/><file name="config.xml" hash="de4b4674c3ff77d1d2ee8d74ba0d07f8"/><file name="system.xml" hash="5a88bf387b290654d0c45665e327b223"/></dir><dir name="sql"><dir name="username_setup"><file name="mysql4-install-1.0.0.php" hash="ac912748eb6e22a8044931c2b6cc53ad"/><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="4175a420b453763473b02120e80c43ac"/><file name="mysql4-upgrade-1.1.0-1.2.0.php" hash="8290f1a7337654851097223c366aeb06"/><file name="mysql4-upgrade-1.3.0-1.4.0.php" hash="5e2aecdd97a6a051327b7fd63f64c1c6"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="username"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="010140b07e8c65d430d6cd8348bf89d7"/><file name="login.phtml" hash="96f6767c7a890fb500aa5f4cdb1f5d21"/></dir><file name=".DS_Store" hash="3a0b8c30af181f66c3bee373319ea31f"/></dir><dir name="customer"><dir name="account"><dir name="dashboard"><file name="info.phtml" hash="60412f7c03ea4a83cb08a129e237f909"/></dir></dir><dir name="form"><file name="edit.phtml" hash="fd93820e2b5aaed8b81b4ce98d7e6822"/><file name="login.phtml" hash="de017b3986f6ec82e10b9bdd1e130758"/><file name="register.phtml" hash="d89c98207e74185537c271cfa06b1579"/></dir></dir></dir></dir><dir name="layout"><file name="username.xml" hash="cd4f5b85815c981f068da7408e325ba2"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_GB"><file name="Diglin_Username.csv" hash="2d18fb6bfc2c4c56f19cfe7ee6761f4b"/></dir><dir name="en_US"><file name="Diglin_Username.csv" hash="2d18fb6bfc2c4c56f19cfe7ee6761f4b"/></dir><dir name="fr_FR"><file name="Diglin_Username.csv" hash="d8d025c852649fc8e9edd2aed5ab377a"/></dir><dir name="de_DE"><file name="Diglin_Username.csv" hash="71ec3c2c428c65a3b700b5a1a12fc772"/></dir></target></contents>
35
  <compatible/>
36
- <dependencies/>
37
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Diglin_Username</name>
4
+ <version>2.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Create and login to an account thanks to a username AND email address.&#xD;
10
  Allow to disable an account from backend. The user will be blocked if the option in the customer backend is set to no</summary>
11
+ <description>## Features&#xD;
12
  &#xD;
13
+ - Login with a username and/or email, it can be done from frontend during checkout or getting access to the customer account&#xD;
14
+ - Save a username from frontend (register account or checkout process) or from backend by editing a customer account&#xD;
15
+ - Check that the username doesn't already exists&#xD;
16
+ - Allow you to deactivate temporary customer account from Customer Management page (bonus functionality from version &gt; Magento 1.4.x). The user will be blocked if the option in the customer backend is set to no.&#xD;
17
+ - The default templates override some customer and checkout views to adapt display for login pages, checkout process and account edition in frontend. If you have a customized template, please check the layout file username.xml and compare with your template to use or adapt to your situation.&#xD;
18
+ - When you have already customers in your system and you do a first install of this plugin, a username will be generated for each customer based on a part of his email and a unique id. (e.g. email address is "developer@localhost.com" -&gt; username is "developer1235467")&#xD;
19
+ - Configurable options to define what kind of username to support: only letters, only digits, both or default (digits, letters and special characters '-_')&#xD;
20
+ - Configurable options to set the maximum and minium string length&#xD;
21
+ - Display Username of each customer in the Customer Management Grid&#xD;
22
+ - Allow or not the customer to edit the username in My Account in frontend&#xD;
23
+ - Compatible and tested with Magento version &gt;=1.4.2 until 1.7.x&#xD;
24
+ - NEW - support username when a customer wants to retrieve his forgotten password thanks to the "Forgotten Password" form&#xD;
25
+ - NEW - support username into the template of the persistent module&#xD;
26
  &#xD;
27
+ Use MageTrashApp to uninstall this module correctly: https://github.com/magento-hackathon/MageTrashApp</description>
28
+ <notes>- 2.0.1:&#xD;
29
+ - Add composer, modman, MageTrashApp support to help installing and uninstalling this module&#xD;
30
+ - Move template to design base package&#xD;
31
+ - Fix several bugs like saving username from frontend, checkout process as guest, etc&#xD;
32
+ - Follow best practices for module setup&#xD;
33
+ - Version 1.5.0: update for Magento 1.7&#xD;
34
  - Version 1.4.0: fix a problem to enable and disable a customer account from Customer Management in backend&#xD;
35
  - Version 1.3.0: new features. Configurable options: display username in Manage Customer Grid, allow customer to edit or not username in frontend My Account, define maximum and minimum length of username for the forms, define what kind of validation desired (letters, digits, both or both " _-)&#xD;
36
  - Version 1.2.1: fix customer account layout &#xD;
39
  - Version 1.0.2 - fix a bug with the installation&#xD;
40
  - Version 1.0.1 - fix bug in sql query during installation on prefixed tables, add german translation, do package for Magento version prior to 1.5 and version 1.5.x&#xD;
41
  - Version 1.0.0 - stable version</notes>
42
+ <authors><author><name>diglin</name><user>diglin</user><email>sly@diglin.com</email></author></authors>
43
+ <date>2013-05-24</date>
44
+ <time>20:26:44</time>
45
+ <contents><target name="mageetc"><dir name="modules"><file name="Diglin_Username.xml" hash="f1dbe5f3627aa88f16876405ea0729a0"/><file name="Hackathon_MageTrashApp.xml" hash="247c6b5278c3681efe24f504c5b48970"/></dir></target><target name="magecommunity"><dir name="Diglin"><dir name="Username"><dir name="Block"><dir name="Overwrite"><dir name="Adminhtml"><dir name="Config"><dir name="Source"><file name="Hint.php" hash="85edae9eec85d06b63a8c259cb787b23"/></dir></dir><file name="Grid.php" hash="fa13010ac51260cf515fd8710af9abea"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="803f067b0eb5ff5629a113c6d723e54d"/></dir><dir name="Model"><dir name="Config"><file name="Share.php" hash="8258ff3fd56df05dec26529e785cf1a5"/><dir name="Source"><file name="Inputvalidation.php" hash="cfe26f69418559c14f1b8b6ca3eabc93"/></dir></dir><file name="Customer.php" hash="75c540a2fca3469c2318f4f649e1eb21"/><dir name="Entity"><file name="Customer.php" hash="2999c400148c03e5f11d075ef505211a"/><file name="Setup.php" hash="73fbe07ed6383c4bda8be73e9c43c923"/></dir><file name="Form.php" hash="38cf46fce0b128becd3c8527832586cb"/><dir name="Import"><dir name="Entity"><file name="Customer.php" hash="1cfb9b92dfeff58dffe5329aefe5beb0"/></dir></dir><file name="Observer.php" hash="5d9cf506bc69cf2d9fd36e5137968644"/></dir><dir name="controllers"><file name="AccountController.php" hash="8edbee496580e7650495861e9a3b3710"/></dir><dir name="data"><dir name="username_setup"><file name="data-install-2.0.0.php" hash="cf95f627b016974215142ec72018ef94"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8eaa2843438b116e9d0425fcdd2ccabf"/><file name="config.xml" hash="0f37948f70bd2e869f9c0e406430e378"/><file name="system.xml" hash="fadc30d87b96cf220854af18f8788f77"/><file name="uninstall.txt" hash="70ce51e6ea76f07394760ca567cd6294"/></dir><dir name="sql"><dir name="username_setup"><file name="install-2.0.0.php" hash="6c827f26e94876a82012a91f6b74370d"/><file name="mysql4-install-1.0.0.php" hash="deaa6e702bd0a6b83c41a10fbcc5cce9"/><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="fe759e361a65fc51eb6dc8a50b9605e8"/><file name="mysql4-upgrade-1.1.0-1.2.0.php" hash="21cdb85ec6ad08fac97252a604ca17ba"/><file name="mysql4-upgrade-1.3.0-1.4.0.php" hash="93f4d880243152b75ed2be2b26084e3d"/><file name="mysql4-upgrade-1.4.0-2.0.0.php" hash="cbe2c4027c846567eb45f757193f4edc"/><file name="uninstall.php" hash="379f87574ab4d0e95e3aace302bd572a"/></dir></dir></dir></dir><dir name="Hackathon"><dir name="MageTrashApp"><dir name="Adminhtml"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><dir name="Modules"><file name="MageTrashApp.php" hash="8dc018926d9478d2ee12b505033e312a"/></dir></dir></dir></dir></dir></dir></dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><dir name="Modules"><file name="MageTrashApp.php" hash="190b72529aa16a61b6bc2490774304e3"/><file name="Rewind.php" hash="6a7d8004e79fd2f5226b2ca6f1a32d48"/></dir></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="6ea1f755b3470cd8254fec25977f08bd"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Config"><file name="Data.php" hash="666da6fe6343b0bf38ac6313242871bc"/></dir></dir><file name="CoreResource.php" hash="48faa17486cbdb58b5b58e26a892bc8a"/><file name="Observer.php" hash="4edb98984908198865fd9a73fe15ccab"/><file name="PearWrapper.php" hash="5bfc49da1c0c4b8801217e1ece28b7e9"/><dir name="Resource"><file name="Resource.php" hash="ba46996c23e6c17db231fcfd7eeee1cd"/><file name="Setup.php" hash="01c3a067fb830edd7c2783b9a9b2d2bb"/></dir><file name="Uninstall.php" hash="e8fe01333bae1d1c187b7eb95568e903"/></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="71d4e2715f295ac097316e02736fc986"/></dir><dir name="Helper"><file name="DataTest.php" hash="7bfebdb2953dc220457240fd01503ab7"/></dir><dir name="Model"><file name="Observer.php" hash="fbd80ba2d0eb8c6058f1a45d00e476f5"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="indexController.php" hash="b4ea9f1b928458c1af902416b91300d0"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="29e4e7211061fb73eeceb1a6dc510dad"/><file name="config.xml" hash="767b2cd648240b07c858ef7282827571"/><file name="doc.uninstall.txt" hash="b2de80f292016c5392b0edbc21ac29f1"/><file name="system.xml" hash="ca750acb4682fc8edea2f5aa451278a5"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="username"><dir><dir name="checkout"><dir name="onepage"><dir name="13"><file name="billing.phtml" hash="e7875ec85ee418539807266e0f8d7581"/></dir><dir name="17"><file name="billing.phtml" hash="35a3604ae93631f7a6522f923d2d364d"/></dir><file name="billing.phtml" hash="3e91cd48d06ba295d367b866986ad25a"/><file name="login.phtml" hash="5db44d2a09be5d33cdbacdab2a1fa978"/></dir></dir><dir name="customer"><dir name="account"><dir name="dashboard"><file name="info.phtml" hash="4fbd87ccca20ca1c28ef64c060a13cce"/></dir></dir><dir name="form"><dir name="13"><file name="register.phtml" hash="788e9c07648371ca7eec005091a6f743"/></dir><dir name="17"><file name="register.phtml" hash="236486d1b7e9d60f686c46d3e485d793"/></dir><file name="edit.phtml" hash="9169cd9135d7f0b74ae9f973f0fd6f36"/><file name="forgotpassword.phtml" hash="2764b7f1630adeda0bf058a148f2202e"/><file name="login.phtml" hash="aaad00540adca570d18dba9afc0f1858"/><file name="register.phtml" hash="2a74a300edcf780acb804b8cd25c393e"/></dir></dir><dir name="persistent"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="02653472f632833b8bc86245ff41d33c"/><file name="login.phtml" hash="27bd60ec63fc2911458df4191fc465be"/></dir></dir><dir name="customer"><dir name="form"><file name="login.phtml" hash="959d89c5e13704e289c861a1d8fcee13"/><file name="register.phtml" hash="1763f5b002dbadf20dd97875123e2aef"/></dir></dir></dir></dir></dir></dir><dir name="layout"><file name="username.xml" hash="432ef8d9bd05bdfedfae879c981ba95c"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_GB"><file name="Diglin_Username.csv" hash="2d18fb6bfc2c4c56f19cfe7ee6761f4b"/></dir><dir name="en_US"><file name="Diglin_Username.csv" hash="2d18fb6bfc2c4c56f19cfe7ee6761f4b"/></dir><dir name="fr_FR"><file name="Diglin_Username.csv" hash="d8d025c852649fc8e9edd2aed5ab377a"/></dir><dir name="de_DE"><file name="Diglin_Username.csv" hash="7a0aa81dbdafe2ef121a08cd03c64893"/></dir></target></contents>
46
  <compatible/>
47
+ <dependencies><required><php><min>5.2.9</min><max>6.0.0</max></php></required></dependencies>
48
  </package>