Skip to content

Commit

Permalink
Import Magento Release 1.3.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeSaferite committed Aug 3, 2009
1 parent 0befb41 commit 0a542b3
Show file tree
Hide file tree
Showing 223 changed files with 4,340 additions and 1,839 deletions.
4 changes: 2 additions & 2 deletions app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ final class Mage {

public static function getVersion()
{
return '1.3.2.1';
return '1.3.2.2';
}

/**
Expand Down Expand Up @@ -596,7 +596,7 @@ public static function logException(Exception $e)
return;
}
$file = Mage::getStoreConfig('dev/log/exception_file');
self::log("\n".$e->getTraceAsString(), Zend_Log::ERR, $file);
self::log("\n".(string)$e, Zend_Log::ERR, $file);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@

/**
* IP assertion for admin acl
*
*
* @category Mage
* @package Mage_Admin
* @author Magento Core Team <[email protected]>
*/
class Mage_Admin_Model_Acl_Assert_Ip implements Zend_Acl_Assert_Interface
class Mage_Admin_Model_Acl_Assert_Ip implements Zend_Acl_Assert_Interface
{
/**
* Check whether ip is allowed
Expand All @@ -46,7 +46,7 @@ class Mage_Admin_Model_Acl_Assert_Ip implements Zend_Acl_Assert_Interface
public function assert(Mage_Admin_Model_Acl $acl, Mage_Admin_Model_Acl_Role $role = null,
Mage_Admin_Model_Acl_Resource $resource = null, $privilege = null)
{
return $this->_isCleanIP($_SERVER['REMOTE_ADDR']);
return $this->_isCleanIP(Mage::helper('core/http')->getRemoteAddr());
}

protected function _isCleanIP($ip)
Expand Down
14 changes: 14 additions & 0 deletions app/code/core/Mage/Admin/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class Mage_Admin_Model_User extends Mage_Core_Model_Abstract
*/
protected $_role;

protected $_hasAvailableResources = true;

/**
* Varien constructor
*/
Expand Down Expand Up @@ -333,6 +335,18 @@ public function findFirstAvailableMenu($parent=null, $path='', $level=0)
}
}
}
$this->_hasAvailableResources = false;
return '*/*/denied';
}

/**
* Check if user has available resources
*
* @return bool
*/
public function hasAvailableResources()
{
return $this->_hasAvailableResources;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions app/code/core/Mage/Adminhtml/Block/Backup/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ protected function _prepareColumns()

$this->addColumn('time', array(
'header' => Mage::helper('backup')->__('Time'),
'index' => 'time_formated',
'type' => 'datetime'
'index' => 'date_object',
'type' => 'datetime',
));

$this->addColumn('size', array(
Expand All @@ -74,8 +74,8 @@ protected function _prepareColumns()

$this->addColumn('type', array(
'header' => Mage::helper('backup')->__('Type'),
'filter' => 'adminhtml/backup_grid_filter_type',
'renderer' => 'adminhtml/backup_grid_renderer_type',
'type' => 'options',
'options' => array('db' => Mage::helper('backup')->__('DB')),
'index' =>'type'
));

Expand Down
18 changes: 18 additions & 0 deletions app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,22 @@ public function getEditUrl()
{
return $this->getUrl("*/catalog_category/edit", array('_current'=>true, 'store'=>null, '_query'=>false, 'id'=>null, 'parent'=>null));
}

/**
* Return ids of root categories as array
*
* @return array
*/
public function getRootIds()
{
$ids = $this->getData('root_ids');
if (is_null($ids)) {
$ids = array();
foreach (Mage::app()->getGroups() as $store) {
$ids[] = $store->getRootCategoryId();
}
$this->setData('root_ids', $ids);
}
return $ids;
}
}
18 changes: 0 additions & 18 deletions app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,6 @@ protected function _prepareLayout()
return parent::_prepareLayout();
}

/**
* Return array of root categories ids
*
* @return array
*/
public function getRootIds()
{
$ids = $this->getData('root_ids');
if (is_null($ids)) {
$ids = array();
foreach (Mage::app()->getStores() as $store) {
$ids[] = $store->getRootCategoryId();
}
$this->setData('root_ids', $ids);
}
return $ids;
}

public function getStoreConfigurationUrl()
{
$storeId = (int) $this->getRequest()->getParam('store');
Expand Down
13 changes: 0 additions & 13 deletions app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,19 +178,6 @@ public function getTreeJson($parenNodeCategory=null)
return $json;
}

public function getRootIds()
{
$ids = $this->getData('root_ids');
if (is_null($ids)) {
$ids = array();
foreach (Mage::app()->getStores() as $store) {
$ids[] = $store->getRootCategoryId();
}
$this->setData('root_ids', $ids);
}
return $ids;
}

/**
* Get JSON of array of categories, that are breadcrumbs for specified category path
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ protected function _prepareForm()
'url_key' => array(
'is_unique',
),
'status' => array(
'is_configurable'
)
);

$rewriteAttributeValue = array(
'status' => array(
'is_configurable' => 0
)
);

$fieldset = $form->addFieldset('base_fieldset',
Expand Down Expand Up @@ -385,6 +394,12 @@ protected function _prepareForm()

$form->addValues($model->getData());

if ($model->getId() && isset($rewriteAttributeValue[$model->getAttributeCode()])) {
foreach ($rewriteAttributeValue[$model->getAttributeCode()] as $field => $value) {
$form->getElement($field)->setValue($value);
}
}

$form->getElement('apply_to')->setSize(5);

if ($applyTo = $model->getApplyTo()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,10 @@ protected function _getSetData()
{
return Mage::getModel('eav/entity_attribute_set')->load( $this->_getSetId() );
}

protected function _toHtml()
{
Mage::dispatchEvent('adminhtml_catalog_product_attribute_set_main_html_before', array('block' => $this));
return parent::_toHtml();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,10 @@ protected function _getHeader()
{
return Mage::helper('catalog')->__('Manage Attribute Sets');
}

protected function _toHtml()
{
Mage::dispatchEvent('adminhtml_catalog_product_attribute_set_toolbar_main_html_before', array('block' => $this));
return parent::_toHtml();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ protected function _beforeToHtml()

protected function _toHtml()
{
$this->setCanShow(true);
Mage::dispatchEvent('adminhtml_catalog_product_edit_tab_attributes_create_html_before', array('block' => $this));
if (!$this->getCanShow()) {
return '';
}

$html = parent::_toHtml();
$html .= Mage::helper('adminhtml/js')->getScript(
"var {$this->getJsObjectName()} = new Product.Attributes('{$this->getId()}');\n"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,84 +1,88 @@
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

/**
* Adminhtml customer recent orders grid block
*
* @category Mage
* @package Mage_Adminhtml
* @author Magento Core Team <[email protected]>
*/
class Mage_Adminhtml_Block_Customer_Edit_Tab_View_Accordion extends Mage_Adminhtml_Block_Widget_Accordion
{
protected function _prepareLayout()
{
$customer = Mage::registry('current_customer');

$this->setId('customerViewAccordion');

$this->addItem('lastOrders', array(
'title' => Mage::helper('customer')->__('Recent Orders'),
'ajax' => true,
'content_url' => $this->getUrl('*/*/lastOrders', array('_current' => true)),
));

// add shopping cart block of each website
foreach (Mage::registry('current_customer')->getSharedWebsiteIds() as $websiteId) {
$website = Mage::app()->getWebsite($websiteId);

// count cart items
$cartItemsCount = Mage::getModel('sales/quote')
->setWebsite($website)->loadByCustomer($customer)
->getItemsCollection(false)->getSize();
// prepare title for cart
$title = Mage::helper('customer')->__('Shopping Cart - %d item(s)', $cartItemsCount);
if (count($customer->getSharedWebsiteIds()) > 1) {
$title = Mage::helper('customer')->__('Shopping Cart of %1$s - %2$d item(s)',
$website->getName(), $cartItemsCount
);
}

// add cart ajax accordion
$this->addItem('shopingCart' . $websiteId, array(
'title' => $title,
'ajax' => true,
'content_url' => $this->getUrl('*/*/viewCart', array('_current' => true, 'website_id' => $websiteId)),
));
}

// count wishlist items
$wishlistCount = Mage::getModel('wishlist/wishlist')->loadByCustomer($customer)
->getProductCollection()
->addStoreData()
->getSize();
// add wishlist ajax accordion
$this->addItem('wishlist', array(
'title' => Mage::helper('customer')->__('Wishlist - %d item(s)', $wishlistCount),
'ajax' => true,
'content_url' => $this->getUrl('*/*/viewWishlist', array('_current' => true)),
));
}
}
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

/**
* Adminhtml customer recent orders grid block
*
* @category Mage
* @package Mage_Adminhtml
* @author Magento Core Team <[email protected]>
*/
class Mage_Adminhtml_Block_Customer_Edit_Tab_View_Accordion extends Mage_Adminhtml_Block_Widget_Accordion
{
protected function _prepareLayout()
{
$customer = Mage::registry('current_customer');

$this->setId('customerViewAccordion');

$this->addItem('lastOrders', array(
'title' => Mage::helper('customer')->__('Recent Orders'),
'ajax' => true,
'content_url' => $this->getUrl('*/*/lastOrders', array('_current' => true)),
));

// add shopping cart block of each website
foreach (Mage::registry('current_customer')->getSharedWebsiteIds() as $websiteId) {
$website = Mage::app()->getWebsite($websiteId);

// count cart items
$cartItemsCount = Mage::getModel('sales/quote')
->setWebsite($website)->loadByCustomer($customer)
->getItemsCollection(false)
->addFieldToFilter('parent_item_id', array('null' => true))
->getSize();
// prepare title for cart
$title = Mage::helper('customer')->__('Shopping Cart - %d item(s)', $cartItemsCount);
if (count($customer->getSharedWebsiteIds()) > 1) {
$title = Mage::helper('customer')->__('Shopping Cart of %1$s - %2$d item(s)',
$website->getName(), $cartItemsCount
);
}

// add cart ajax accordion
$this->addItem('shopingCart' . $websiteId, array(
'title' => $title,
'ajax' => true,
'content_url' => $this->getUrl('*/*/viewCart', array('_current' => true, 'website_id' => $websiteId)),
));
}

// count wishlist items
$wishlist = Mage::getModel('wishlist/wishlist');
$wishlistCount = $wishlist->loadByCustomer($customer)
->setSharedStoreIds($wishlist->getSharedStoreIds(false))
->getProductCollection()
->addStoreData()
->getSize();
// add wishlist ajax accordion
$this->addItem('wishlist', array(
'title' => Mage::helper('customer')->__('Wishlist - %d item(s)', $wishlistCount),
'ajax' => true,
'content_url' => $this->getUrl('*/*/viewWishlist', array('_current' => true)),
));
}
}
Loading

0 comments on commit 0a542b3

Please sign in to comment.