Skip to content

Commit

Permalink
Import Magento Release 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeSaferite committed Feb 3, 2009
1 parent aadc3fa commit 7496292
Show file tree
Hide file tree
Showing 281 changed files with 12,968 additions and 8,013 deletions.
25 changes: 16 additions & 9 deletions app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ final class Mage {

public static function getVersion()
{
return '1.2.0.3';
return '1.2.1';
}

/**
Expand Down Expand Up @@ -416,15 +416,22 @@ public static function throwException($message, $messageStorage=null)
public static function app($code = '', $type = 'store', $options=array())
{
if (null === self::$_app) {
Varien_Profiler::start('app/init');

Varien_Profiler::start('mage::app::construct');
self::$_app = new Mage_Core_Model_App();
Varien_Profiler::stop('mage::app::construct');

Mage::setRoot();
Mage::register('events', new Varien_Event_Collection());


Varien_Profiler::start('mage::app::register_config');
Mage::register('config', new Mage_Core_Model_Config());
Varien_Profiler::stop('mage::app::register_config');

Varien_Profiler::start('mage::app::init');
self::$_app->init($code, $type, $options);
Varien_Profiler::stop('mage::app::init');

self::$_app->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);
}
return self::$_app;
Expand All @@ -440,17 +447,17 @@ public static function app($code = '', $type = 'store', $options=array())
public static function run($code = '', $type = 'store', $options=array())
{
try {
Varien_Profiler::start('app');
Varien_Profiler::start('mage');

Varien_Profiler::start('app::init');
Varien_Profiler::start('mage::app');
self::app($code, $type, $options);
Varien_Profiler::stop('app::init');
Varien_Profiler::stop('mage::app');

Varien_Profiler::start('app::dispatch');
Varien_Profiler::start('mage::dispatch');
self::app()->getFrontController()->dispatch();
Varien_Profiler::stop('app::dispatch');
Varien_Profiler::stop('mage::dispatch');

Varien_Profiler::stop('app');
Varien_Profiler::stop('mage');
}
catch (Mage_Core_Model_Session_Exception $e) {
header('Location: ' . Mage::getBaseUrl());
Expand Down
37 changes: 28 additions & 9 deletions app/code/core/Mage/Admin/Model/Mysql4/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,26 @@ class Mage_Admin_Model_Mysql4_User extends Mage_Core_Model_Mysql4_Abstract
protected function _construct()
{
$this->_init('admin/user', 'user_id');
$this->_uniqueFields = array(
array('field' => 'email', 'title' => Mage::helper('adminhtml')->__('Email')),
array('field' => 'username', 'title' => Mage::helper('adminhtml')->__('User Name')),
);
}

/**
* Initialize unique fields
*
* @return Mage_Core_Model_Mysql4_Abstract
*/
protected function _initUniqueFields()
{
$this->_uniqueFields = array(
array(
'field' => 'email',
'title' => Mage::helper('adminhtml')->__('Email')
),
array(
'field' => 'username',
'title' => Mage::helper('adminhtml')->__('User Name')
),
);
return $this;
}

/**
Expand Down Expand Up @@ -144,6 +160,9 @@ public function delete(Mage_Core_Model_Abstract $user)
return true;
}

/**
* TODO: unify _saveRelations() and add() methods, they make same things
*/
public function _saveRelations(Mage_Core_Model_Abstract $user)
{
$rolesIds = $user->getRoleIds();
Expand All @@ -159,11 +178,10 @@ public function _saveRelations(Mage_Core_Model_Abstract $user)
foreach ($rolesIds as $rid) {
$rid = intval($rid);
if ($rid > 0) {
//$row = $this->load($user, $rid);
$row = Mage::getModel('admin/role')->load($rid)->getData();
} else {
$row = array('tree_level' => 0);
}
$row = array('tree_level' => 0);

$data = array(
'parent_id' => $rid,
Expand Down Expand Up @@ -197,8 +215,8 @@ public function _getRoles(Mage_Core_Model_Abstract $user)
return (($roles = $read->fetchCol($select)) ? $roles : array());
}

public function add(Mage_Core_Model_Abstract $user) {

public function add(Mage_Core_Model_Abstract $user)
{
$dbh = $this->_getWriteAdapter();

$aRoles = $this->hasAssigned2Role($user);
Expand Down Expand Up @@ -226,7 +244,8 @@ public function add(Mage_Core_Model_Abstract $user) {
return $this;
}

public function deleteFromRole(Mage_Core_Model_Abstract $user) {
public function deleteFromRole(Mage_Core_Model_Abstract $user)
{
if ( $user->getUserId() <= 0 ) {
return $this;
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Admin/Model/Roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ protected function _buildResourcesArray(Varien_Simplexml_Element $resource=null,
// return array();
//}

$resource->title = Mage::helper($module)->__((string)$resource->title);
//$resource->title = Mage::helper($module)->__((string)$resource->title);

if ( is_null($represent2Darray) ) {
$result[$resourceName]['name'] = (string)$resource->title;
$result[$resourceName]['name'] = Mage::helper($module)->__((string)$resource->title);
$result[$resourceName]['level'] = $level;
} else {
$result[] = $resourceName;
Expand Down
3 changes: 2 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ public function __construct()

protected function _prepareLayout()
{
$category = Mage::registry('current_category');
if (Mage::app()->getConfig()->getModuleConfig('Mage_GoogleOptimizer')->is('active', true)
&& Mage::helper('googleoptimizer')->isOptimizerActive()) {
&& Mage::helper('googleoptimizer')->isOptimizerActive($category->getStoreId())) {
$this->setChild('googleoptimizer_js',
$this->getLayout()->createBlock('googleoptimizer/js')->setTemplate('googleoptimizer/js.phtml')
);
Expand Down
4 changes: 3 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ protected function _prepareLayout()
'label' => Mage::helper('catalog')->__('Custom Design'),
'content' => $this->getLayout()->createBlock('adminhtml/catalog_category_tab_design')->toHtml(),
));

$category = Mage::registry('current_category');
if (Mage::app()->getConfig()->getModuleConfig('Mage_GoogleOptimizer')->is('active', true)
&& Mage::helper('googleoptimizer')->isOptimizerActive()) {
&& Mage::helper('googleoptimizer')->isOptimizerActive($category->getStoreId())) {
$this->addTab('googleoptimizer', array(
'label' => Mage::helper('googleoptimizer')->__('Category View Optimization'),
'content' => $this->getLayout()->createBlock('googleoptimizer/adminhtml_catalog_category_edit_tab_googleoptimizer')->toHtml(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,16 @@ protected function _prepareForm()
));
// }

$htmlAllowed = $fieldset->addField('is_html_allowed_on_front', 'select', array(
'name' => 'is_html_allowed_on_front',
'label' => Mage::helper('catalog')->__('Allow HTML-tags on Front-end'),
'title' => Mage::helper('catalog')->__('Allow HTML-tags on Front-end'),
'values' => $yesno,
));
if (!$model->getId()) {
$htmlAllowed->setValue(1);
}


if ($model->getId()) {
$form->getElement('attribute_code')->setDisabled(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ public function getBackordersOption()
return Mage::getSingleton('cataloginventory/source_backorders')->toOptionArray();
}

/**
* Retrieve stock option array
*
* @return array
*/
public function getStockOption()
{
return Mage::getSingleton('cataloginventory/source_stock')->toOptionArray();
}

public function getProduct()
{
return Mage::registry('product');
Expand Down
13 changes: 10 additions & 3 deletions app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser/Sku.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ class Mage_Adminhtml_Block_Promo_Widget_Chooser_Sku extends Mage_Adminhtml_Block
public function __construct($arguments=array())
{
parent::__construct($arguments);
$this->setId('skuChooserGrid_'.$this->getId());

if ($this->getRequest()->getParam('current_grid_id')) {
$this->setId($this->getRequest()->getParam('current_grid_id'));
} else {
$this->setId('skuChooserGrid_'.$this->getId());
}

$form = $this->getJsFormObject();
$this->setRowClickCallback("$form.chooserGridRowClick.bind($form)");
$this->setCheckboxCheckCallback("$form.chooserGridCheckboxCheck.bind($form)");
Expand Down Expand Up @@ -129,8 +135,9 @@ protected function _prepareColumns()
public function getGridUrl()
{
return $this->getUrl('*/*/chooser', array(
'_current' => true,
'collapse' => null
'_current' => true,
'current_grid_id' => $this->getId(),
'collapse' => null
));
}

Expand Down
22 changes: 18 additions & 4 deletions app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ public function addItemRender($type, $block, $template)
* @param string $template
* @return Mage_Adminhtml_Block_Sales_Items_Abstract
*/
public function addColumnRender($column, $block, $template)
public function addColumnRender($column, $block, $template, $type=null)
{
if (!is_null($type)) {
$column .= '_' . $type;
}
$this->_columnRenders[$column] = array(
'block' => $block,
'template' => $template,
Expand Down Expand Up @@ -127,17 +130,22 @@ public function getItemRenderer($type)
* Retrieve column renderer block
*
* @param string $column
* @param string $compositePart
* @return Mage_Core_Block_Abstract
*/
public function getColumnRenderer($column)
public function getColumnRenderer($column, $compositePart='')
{
if (isset($this->_columnRenders[$column . '_' . $compositePart])) {
$column .= '_' . $compositePart;
}
if (!isset($this->_columnRenders[$column])) {
return false;
}
if (is_null($this->_columnRenders[$column]['renderer'])) {
$this->_columnRenders[$column]['renderer'] = $this->getLayout()
->createBlock($this->_columnRenders[$column]['block'])
->setTemplate($this->_columnRenders[$column]['template']);
->setTemplate($this->_columnRenders[$column]['template'])
->setRenderedBlock($this);
}
return $this->_columnRenders[$column]['renderer'];
}
Expand Down Expand Up @@ -171,7 +179,13 @@ public function getItemHtml(Varien_Object $item)
*/
public function getColumnHtml(Varien_Object $item, $column, $field = null)
{
if ($block = $this->getColumnRenderer($column)) {
if ($item->getOrderItem()) {
$block = $this->getColumnRenderer($column, $item->getOrderItem()->getProductType());
} else {
$block = $this->getColumnRenderer($column, $item->getProductType());
}

if ($block) {
$block->setItem($item);
if (!is_null($field)) {
$block->setField($field);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?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)
*/


/**
* Sales Order items name column renderer
*
* @category Mage
* @package Mage_Adminhtml
* @author Magento Core Team <[email protected]>
*/
class Mage_Adminhtml_Block_Sales_Items_Column_Name_Grouped extends Mage_Adminhtml_Block_Sales_Items_Column_Name
{
/**
* Prepare item html
*
* This method uses renderer for real product type
*
* @return string
*/
protected function _toHtml()
{
if ($this->getItem()->getOrderItem()) {
$item = $this->getItem()->getOrderItem();
} else {
$item = $this->getItem();
}
if ($productType = $item->getRealProductType()) {
$renderer = $this->getRenderedBlock()->getColumnHtml($this->getItem(), $productType);
return $renderer;
}
return parent::_toHtml();
}
}
?>
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ protected function _prepareForm()
if ($inputType = $attribute->getFrontend()->getInputType()) {
$element = $fieldset->addField($attribute->getAttributeCode(), $inputType,
array(
'name' => $attribute->getAttributeCode(),
'label' => $attribute->getFrontend()->getLabel(),
'name' => $attribute->getAttributeCode(),
'label' => $attribute->getFrontend()->getLabel(),
'class' => $attribute->getFrontend()->getClass(),
'required' => $attribute->getIsRequired(),
)
)
->setEntityAttribute($attribute)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function getHeaderText()

$header = Mage::helper('sales')->__('Credit Memo #%s | Date %s | Status %s (%s)',
$this->getCreditmemo()->getIncrementId(),
$this->formatDate($this->getCreditmemo()->getCreatedAt(), 'medium', true),
$this->formatDate($this->getCreditmemo()->getCreatedAtDate(), 'medium', true),
$this->getCreditmemo()->getStateName(),
$emailSent
);
Expand Down
14 changes: 1 addition & 13 deletions app/code/core/Mage/Adminhtml/Block/Sales/Order/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,8 @@ public function getHeaderText()
{
$text = Mage::helper('sales')->__('Order # %s | Order Date %s',
$this->getOrder()->getRealOrderId(),
$this->formatDate($this->getOrder()->getCreatedAt(), 'medium', true)
$this->formatDate($this->getOrder()->getCreatedAtDate(), 'medium', true)
);
/*if ($this->getOrder()->getRelationParentRealId()) {
$text = Mage::helper('sales')->__('Order # %s | Order Date %s',
$this->getOrder()->getRealOrderId(),
$this->formatDate($this->getOrder()->getCreatedAt(), 'medium', true)
);
}
else {
$text = Mage::helper('sales')->__('Order # %s | Order Date %s',
$this->getOrder()->getRealOrderId(),
$this->formatDate($this->getOrder()->getCreatedAt(), 'medium', true)
);
}*/
return $text;
}

Expand Down
Loading

0 comments on commit 7496292

Please sign in to comment.