Skip to content

Commit

Permalink
Update as of 7/26/2012
Browse files Browse the repository at this point in the history
* Implemented Magento Validator library in order to have clear solid mechanism and formal rules of input data validation
* Moved translations to module directories, so that it is much more convenient to manage module resources
* Updated inline translation mechanism to support locales inheritance
* Implemented ability to navigate through pending reviews with Prev/Next buttons, no need to switch to grid and back
* Fixed issues:
  * Unable to use shell-installer after changes in Backend area routing process
  * Incorrect redirect after entering wrong captcha on the "Forgot your user name or password?" backend page
  * Translation is absent for several strings in Sales module `guest/form.phtml` template
  * Exception during installation process, when `var` directory is not empty
  * Node `modules` is merged to all modules' config XML-files, although it must be merged to `config.xml` only
* GitHub requests:
  * [#39](#39) -- added `composer.json`, which was announced at previous update, but mistakenly omitted from publishing
  • Loading branch information
magento-team committed Jul 26, 2012
1 parent 1617a6e commit a27835b
Show file tree
Hide file tree
Showing 507 changed files with 1,809 additions and 1,368 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
Update as of 7/26/2012
=====================
* Implemented Magento Validator library in order to have clear solid mechanism and formal rules of input data validation
* Moved translations to module directories, so that it is much more convenient to manage module resources
* Updated inline translation mechanism to support locales inheritance
* Implemented ability to navigate through pending reviews with Prev/Next buttons, no need to switch to grid and back
* Fixed issues:
* Unable to use shell-installer after changes in Backend area routing process
* Incorrect redirect after entering wrong captcha on the "Forgot your user name or password?" backend page
* Translation is absent for several strings in Sales module `guest/form.phtml` template
* Exception during installation process, when `var` directory is not empty
* Node `modules` is merged to all modules' config XML-files, although it must be merged to `config.xml` only
* GitHub requests:
* [#39](https://github.com/magento/magento2/pull/39) -- added `composer.json`, which was announced at previous update, but mistakenly omitted from publishing

Update as of 7/19/2012
=====================
* Implemented inheritance of locales. Inheritance is declared in `app/locale/<locale_name>/config.xml`
Expand Down Expand Up @@ -25,7 +40,7 @@ Update as of 7/19/2012
* Other small fixes
* GitHub requests:
* [#37](https://github.com/magento/magento2/pull/37) -- fixed particular case of "HEADERS ALREADY SENT" error in WYSIWYG thumbnail
* [#39](https://github.com/magento/magento2/pull/39) -- added `composer.json`
* [#39](https://github.com/magento/magento2/pull/39) -- added `composer.json` (actually, doesn't come with this update due to a mistake in publishing process)
* [#40](https://github.com/magento/magento2/pull/40) -- fixed generation of "secret key" in backend URLs to honor `_forward` in controllers

Update as of 7/3/2012
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
41 changes: 41 additions & 0 deletions app/code/core/Mage/Adminhtml/Block/Review/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,37 @@ public function __construct()
$this->_objectId = 'id';
$this->_controller = 'review';

/** @var $actionPager Mage_Review_Helper_Action_Pager */
$actionPager = Mage::helper('Mage_Review_Helper_Action_Pager');
$actionPager->setStorageId('reviews');

$reviewId = $this->getRequest()->getParam('id');
$prevId = $actionPager->getPreviousItemId($reviewId);
$nextId = $actionPager->getNextItemId($reviewId);
if ($prevId !== false) {
$this->addButton('previous', array(
'label' => Mage::helper('Mage_Review_Helper_Data')->__('Previous'),
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/*', array('id' => $prevId)) . '\')'
), 3, 10);

$this->addButton('save_and_previous', array(
'label' => Mage::helper('Mage_Review_Helper_Data')->__('Save and Previous'),
'onclick' => 'submitAndGo(\'' . $prevId . '\')',
'class' => 'save'
), 3, 11);
}
if ($nextId !== false) {
$this->addButton('save_and_next', array(
'label' => Mage::helper('Mage_Review_Helper_Data')->__('Save and Next'),
'onclick' => 'submitAndGo(\'' . $nextId . '\')',
'class' => 'save'
), 3, 100);

$this->addButton('next', array(
'label' => Mage::helper('Mage_Review_Helper_Data')->__('Next'),
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/*', array('id' => $nextId)) . '\')'
), 3, 105);
}
$this->_updateButton('save', 'label', Mage::helper('Mage_Review_Helper_Data')->__('Save Review'));
$this->_updateButton('save', 'id', 'save_button');
$this->_updateButton('delete', 'label', Mage::helper('Mage_Review_Helper_Data')->__('Delete Review'));
Expand Down Expand Up @@ -97,6 +128,16 @@ public function __construct()
}

$this->_formInitScripts[] = '
function submitAndGo(id)
{
var nextIdElement = document.createElement("input");
nextIdElement.name = "next_item";
nextIdElement.type = "text";
nextIdElement.value = id;
document.getElementById("edit_form").appendChild(nextIdElement);
editForm.submit();
}
var review = {
updateRating: function() {
elements = [
Expand Down
88 changes: 72 additions & 16 deletions app/code/core/Mage/Adminhtml/Block/Review/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,53 @@
/**
* Adminhtml reviews grid
*
* @method int getProductId() getProductId()
* @method Mage_Adminhtml_Block_Review_Grid setProductId() setProductId(int $productId)
* @method int getCustomerId() getCustomerId()
* @method Mage_Adminhtml_Block_Review_Grid setCustomerId() setCustomerId(int $customerId)
* @method Mage_Adminhtml_Block_Review_Grid setMassactionIdFieldOnlyIndexValue() setMassactionIdFieldOnlyIndexValue(bool $onlyIndex)
*
* @category Mage
* @package Mage_Adminhtml
* @author Magento Core Team <core@magentocommerce.com>
*/
class Mage_Adminhtml_Block_Review_Grid extends Mage_Adminhtml_Block_Widget_Grid
class Mage_Adminhtml_Block_Review_Grid extends Mage_Backend_Block_Widget_Grid
{

/**
* Initialize grid
*/
public function __construct()
{
parent::__construct();
$this->setId('reviwGrid');
$this->setDefaultSort('created_at');
}

/**
* Save search results
*
* @return Mage_Backend_Block_Widget_Grid
*/
protected function _afterLoadCollection()
{
/** @var $actionPager Mage_Review_Helper_Action_Pager */
$actionPager = Mage::helper('Mage_Review_Helper_Action_Pager');
$actionPager->setStorageId('reviews');
$actionPager->setItems($this->getCollection()->getResultingIds());

return parent::_afterLoadCollection();
}

/**
* Prepare collection
*
* @return Mage_Adminhtml_Block_Review_Grid
*/
protected function _prepareCollection()
{
/** @var $model Mage_Review_Model_Review */
$model = Mage::getModel('Mage_Review_Model_Review');
/** @var $collection Mage_Review_Model_Resource_Review_Product_Collection */
$collection = $model->getProductCollection();

if ($this->getProductId() || $this->getRequest()->getParam('productId', false)) {
Expand Down Expand Up @@ -74,18 +104,25 @@ protected function _prepareCollection()
return parent::_prepareCollection();
}

/**
* Prepare grid columns
*
* @return Mage_Backend_Block_Widget_Grid
*/
protected function _prepareColumns()
{
/** @var $helper Mage_Review_Helper_Data */
$helper = Mage::helper('Mage_Review_Helper_Data');
$this->addColumn('review_id', array(
'header' => Mage::helper('Mage_Review_Helper_Data')->__('ID'),
'header' => $helper->__('ID'),
'align' => 'right',
'width' => '50px',
'filter_index' => 'rt.review_id',
'index' => 'review_id',
));

$this->addColumn('created_at', array(
'header' => Mage::helper('Mage_Review_Helper_Data')->__('Created On'),
'header' => $helper->__('Created On'),
'align' => 'left',
'type' => 'datetime',
'width' => '100px',
Expand All @@ -95,18 +132,18 @@ protected function _prepareColumns()

if( !Mage::registry('usePendingFilter') ) {
$this->addColumn('status', array(
'header' => Mage::helper('Mage_Review_Helper_Data')->__('Status'),
'header' => $helper->__('Status'),
'align' => 'left',
'type' => 'options',
'options' => Mage::helper('Mage_Review_Helper_Data')->getReviewStatuses(),
'options' => $helper->getReviewStatuses(),
'width' => '100px',
'filter_index' => 'rt.status_id',
'index' => 'status_id',
));
}

$this->addColumn('title', array(
'header' => Mage::helper('Mage_Review_Helper_Data')->__('Title'),
'header' => $helper->__('Title'),
'align' => 'left',
'width' => '100px',
'filter_index' => 'rdt.title',
Expand All @@ -117,7 +154,7 @@ protected function _prepareColumns()
));

$this->addColumn('nickname', array(
'header' => Mage::helper('Mage_Review_Helper_Data')->__('Nickname'),
'header' => $helper->__('Nickname'),
'align' => 'left',
'width' => '100px',
'filter_index' => 'rdt.nickname',
Expand All @@ -128,7 +165,7 @@ protected function _prepareColumns()
));

$this->addColumn('detail', array(
'header' => Mage::helper('Mage_Review_Helper_Data')->__('Review'),
'header' => $helper->__('Review'),
'align' => 'left',
'index' => 'detail',
'filter_index' => 'rdt.detail',
Expand All @@ -143,31 +180,31 @@ protected function _prepareColumns()
*/
if (!Mage::app()->isSingleStoreMode()) {
$this->addColumn('visible_in', array(
'header' => Mage::helper('Mage_Review_Helper_Data')->__('Visible In'),
'header' => $helper->__('Visible In'),
'index' => 'stores',
'type' => 'store',
'store_view' => true,
));
}

$this->addColumn('type', array(
'header' => Mage::helper('Mage_Review_Helper_Data')->__('Type'),
'header' => $helper->__('Type'),
'type' => 'select',
'index' => 'type',
'filter' => 'Mage_Adminhtml_Block_Review_Grid_Filter_Type',
'renderer' => 'Mage_Adminhtml_Block_Review_Grid_Renderer_Type'
));

$this->addColumn('name', array(
'header' => Mage::helper('Mage_Review_Helper_Data')->__('Product Name'),
'header' => $helper->__('Product Name'),
'align' =>'left',
'type' => 'text',
'index' => 'name',
'escape' => true
));

$this->addColumn('sku', array(
'header' => Mage::helper('Mage_Review_Helper_Data')->__('Product SKU'),
'header' => $helper->__('Product SKU'),
'align' => 'right',
'type' => 'text',
'width' => '50px',
Expand Down Expand Up @@ -204,8 +241,16 @@ protected function _prepareColumns()
return parent::_prepareColumns();
}

/**
* Prepare grid mass actions
*
* @return Mage_Backend_Block_Widget_Grid|void
*/
protected function _prepareMassaction()
{
/** @var $helper Mage_Review_Helper_Data */
$helper = Mage::helper('Mage_Review_Helper_Data');

$this->setMassactionIdField('review_id');
$this->setMassactionIdFilter('rt.review_id');
$this->setMassactionIdFieldOnlyIndexValue(true);
Expand All @@ -220,10 +265,10 @@ protected function _prepareMassaction()
'confirm' => Mage::helper('Mage_Review_Helper_Data')->__('Are you sure?')
));

$statuses = Mage::helper('Mage_Review_Helper_Data')->getReviewStatusesOptionArray();
$statuses = $helper->getReviewStatusesOptionArray();
array_unshift($statuses, array('label'=>'', 'value'=>''));
$this->getMassactionBlock()->addItem('update_status', array(
'label' => Mage::helper('Mage_Review_Helper_Data')->__('Update Status'),
'label' => $helper->__('Update Status'),
'url' => $this->getUrl(
'*/*/massUpdateStatus',
array('ret' => Mage::registry('usePendingFilter') ? 'pending' : 'index')
Expand All @@ -233,13 +278,19 @@ protected function _prepareMassaction()
'name' => 'status',
'type' => 'select',
'class' => 'required-entry',
'label' => Mage::helper('Mage_Review_Helper_Data')->__('Status'),
'label' => $helper->__('Status'),
'values' => $statuses
)
)
));
}

/**
* Get row url
*
* @param Mage_Review_Model_Review|Varien_Object $row
* @return string
*/
public function getRowUrl($row)
{
return $this->getUrl('*/catalog_product_review/edit', array(
Expand All @@ -250,6 +301,11 @@ public function getRowUrl($row)
));
}

/**
* Get grid url
*
* @return string
*/
public function getGridUrl()
{
if( $this->getProductId() || $this->getCustomerId() ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,12 @@ public function saveAction()
}
}

return $this->getResponse()->setRedirect($this->getUrl($this->getRequest()->getParam('ret') == 'pending' ? '*/*/pending' : '*/*/'));
$nextId = (int) $this->getRequest()->getParam('next_item');
$url = $this->getUrl($this->getRequest()->getParam('ret') == 'pending' ? '*/*/pending' : '*/*/');
if ($nextId) {
$url = $this->getUrl('*/*/edit', array('id' => $nextId));
}
return $this->getResponse()->setRedirect($url);
}
$this->_redirect('*/*/');
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/code/core/Mage/Captcha/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function checkUserForgotPasswordBackend($observer)
$this->_getBackendSession()->setEmail((string) $controller->getRequest()->getPost('email'));
$controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
$this->_getBackendSession()->addError(Mage::helper('Mage_Captcha_Helper_Data')->__('Incorrect CAPTCHA.'));
$controller->getResponse()->setRedirect(Mage::getUrl('*/*/forgotpassword'));
$controller->getResponse()->setRedirect($controller->getUrl('*/*/forgotpassword', array('_nosecret' => true)));
}
}
}
Expand Down
18 changes: 10 additions & 8 deletions app/code/core/Mage/Captcha/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,6 @@
</captcha>
</observers>
</controller_action_predispatch_customer_account_createpost>
<controller_action_predispatch_adminhtml_auth_forgotpassword>
<observers>
<captcha>
<class>Mage_Captcha_Model_Observer</class>
<method>checkUserForgotPasswordBackend</method>
</captcha>
</observers>
</controller_action_predispatch_adminhtml_auth_forgotpassword>
<admin_user_authenticate_before>
<observers>
<captcha>
Expand Down Expand Up @@ -154,6 +146,16 @@
</captcha>
</updates>
</layout>
<events>
<controller_action_predispatch_adminhtml_auth_forgotpassword>
<observers>
<captcha>
<class>Mage_Captcha_Model_Observer</class>
<method>checkUserForgotPasswordBackend</method>
</captcha>
</observers>
</controller_action_predispatch_adminhtml_auth_forgotpassword>
</events>
</adminhtml>
<default>
<system>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Mage_Core_Controller_Varien_Router_Standard extends Mage_Core_Controller_V
/**
* @param array $options
*
* @@SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function __construct(array $options = array())
{
Expand Down
Loading

0 comments on commit a27835b

Please sign in to comment.