Skip to content

Commit

Permalink
2.0.0.0-dev43
Browse files Browse the repository at this point in the history
* Implemented functional limitation that restricts max number of catalog products in the system
* Implemented cache backend library model for MongoDB
* Converted some more grids in backend from PHP implementation to declarations in layout
* Removed `app/etc/local.xml.additional` sample file, moved detailed description of possible configuration options to documentation
* Refactored `Mage_Core_Model_EntryPointAbstract` to emphasize method `processRequest()` as abstract
* Moved declaration of functional limitations to the nodes `limitations/store` and `limitations/admin_account`
* Bug fixes:
  * Fixed JavaScript and markup issues on product editing page in backend that caused erroneous sending of AJAX-queries and not rendering validation messages
  * Fixed issues of application initialization in cases when `var` directory doesn't have writable permissions. Writable directories are validated at an early stage of initialization
  * Fixed array sorting issues in test `Magento_Filesystem_Adapter_LocalTest::testGetNestedKeys()` that caused occasional failures
  • Loading branch information
magento-team committed Feb 21, 2013
1 parent b9005af commit 5b266f6
Show file tree
Hide file tree
Showing 79 changed files with 2,513 additions and 647 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
2.0.0.0-dev43
=============
* Implemented functional limitation that restricts max number of catalog products in the system
* Implemented cache backend library model for MongoDB
* Converted some more grids in backend from PHP implementation to declarations in layout
* Removed `app/etc/local.xml.additional` sample file, moved detailed description of possible configuration options to documentation
* Refactored `Mage_Core_Model_EntryPointAbstract` to emphasize method `processRequest()` as abstract
* Moved declaration of functional limitations to the nodes `limitations/store` and `limitations/admin_account`
* Bug fixes:
* Fixed JavaScript and markup issues on product editing page in backend that caused erroneous sending of AJAX-queries and not rendering validation messages
* Fixed issues of application initialization in cases when `var` directory doesn't have writable permissions. Writable directories are validated at an early stage of initialization
* Fixed array sorting issues in test `Magento_Filesystem_Adapter_LocalTest::testGetNestedKeys()` that caused occasional failures

2.0.0.0-dev42
=============
* Application initialization improvements:
Expand Down
52 changes: 1 addition & 51 deletions app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public static function getVersionInfo()
'revision' => '0',
'patch' => '0',
'stability' => 'dev',
'number' => '42',
'number' => '43',
);
}

Expand Down Expand Up @@ -796,56 +796,6 @@ public static function printException(Exception $e, $extra = '')
die();
}

/**
* Define system folder directory url by virtue of running script directory name
* Try to find requested folder by shifting to domain root directory
*
* @param string $folder
* @param boolean $exitIfNot
* @return string
*/
public static function getScriptSystemUrl($folder, $exitIfNot = false)
{
$runDirUrl = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/');
$runDir = rtrim(dirname($_SERVER['SCRIPT_FILENAME']), DS);

$baseUrl = null;
if (is_dir($runDir.'/'.$folder)) {
$baseUrl = str_replace(DS, '/', $runDirUrl);
} else {
$runDirUrlArray = explode('/', $runDirUrl);
$runDirArray = explode('/', $runDir);
$count = count($runDirArray);

for ($i=0; $i < $count; $i++) {
array_pop($runDirUrlArray);
array_pop($runDirArray);
$_runDir = implode('/', $runDirArray);
if (!empty($_runDir)) {
$_runDir .= '/';
}

if (is_dir($_runDir.$folder)) {
$_runDirUrl = implode('/', $runDirUrlArray);
$baseUrl = str_replace(DS, '/', $_runDirUrl);
break;
}
}
}

if (is_null($baseUrl)) {
$errorMessage = "Unable detect system directory: $folder";
if ($exitIfNot) {
// exit because of infinity loop
exit($errorMessage);
} else {
self::printException(new Exception(), $errorMessage);
}
}

return $baseUrl;
}

/**
* Set is downloader flag
*
Expand Down
18 changes: 11 additions & 7 deletions app/code/core/Mage/Adminhtml/Block/Catalog/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,17 @@ class Mage_Adminhtml_Block_Catalog_Product extends Mage_Adminhtml_Block_Widget_C
*/
protected function _prepareLayout()
{
$this->_addButton('add_new', array(
'id' => 'add_new_product',
'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Add Product'),
'class' => 'btn-add',
'class_name' => 'Mage_Backend_Block_Widget_Button_Split',
'options' => $this->_getAddProductButtonOptions()
));
/** @var $limitation Mage_Catalog_Model_Product_Limitation */
$limitation = Mage::getObjectManager()->get('Mage_Catalog_Model_Product_Limitation');
if (!$limitation->isCreateRestricted()) {
$this->_addButton('add_new', array(
'id' => 'add_new_product',
'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Add Product'),
'class' => 'btn-add',
'class_name' => 'Mage_Backend_Block_Widget_Button_Split',
'options' => $this->_getAddProductButtonOptions()
));
}

$this->setChild(
'grid',
Expand Down
50 changes: 35 additions & 15 deletions app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,27 +304,36 @@ protected function _getSaveSplitButtonOptions()
'default' => true,
);
}
$options[] = array(
'id' => 'new-button',
'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Save & New'),
'data_attribute' => array(
'mage-init' => array(
'button' => array('event' => 'saveAndNew', 'target' => '#product-edit-form'),
),
),
);
if (!$this->getRequest()->getParam('popup') && $this->getProduct()->isDuplicable()) {

/** @var $limitation Mage_Catalog_Model_Product_Limitation */
$limitation = Mage::getObjectManager()->get('Mage_Catalog_Model_Product_Limitation');
if ($this->_isProductNew()) {
$showAddNewButtons = !$limitation->isCreateRestricted(2);
} else {
$showAddNewButtons = !$limitation->isCreateRestricted();
}
if ($showAddNewButtons) {
$options[] = array(
'id' => 'duplicate-button',
'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Save & Duplicate'),
'id' => 'new-button',
'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Save & New'),
'data_attribute' => array(
'mage-init' => array(
'button' => array('event' => '', 'target' => '#product-edit-form'),
'button' => array('event' => 'saveAndNew', 'target' => '#product-edit-form'),
),
),
'onclick' => $this->getRequest()->getActionName() == 'new' ? ''
: 'setLocation(\'' . $this->getDuplicateUrl() . '\')',
);
if (!$this->getRequest()->getParam('popup') && $this->getProduct()->isDuplicable()) {
$options[] = array(
'id' => 'duplicate-button',
'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Save & Duplicate'),
'data_attribute' => array(
'mage-init' => array(
'button' => array('event' => '', 'target' => '#product-edit-form'),
),
),
'onclick' => $this->_isProductNew() ? '' : 'setLocation(\'' . $this->getDuplicateUrl() . '\')',
);
}
}
$options[] = array(
'id' => 'close-button',
Expand All @@ -337,4 +346,15 @@ protected function _getSaveSplitButtonOptions()
);
return $options;
}

/**
* Check whether new product is being created
*
* @return bool
*/
protected function _isProductNew()
{
$product = $this->getProduct();
return !$product || !$product->getId();
}
}
13 changes: 0 additions & 13 deletions app/code/core/Mage/Adminhtml/Block/System/Cache/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,6 @@ public function initForm()
));
}

$fieldset = $form->addFieldset('beta_cache_enable', array(
'legend' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Cache Control (beta)')
));

foreach (Mage::helper('Mage_Core_Helper_Data')->getCacheBetaTypes() as $type=>$label) {
$fieldset->addField('beta_enable_'.$type, 'checkbox', array(
'name'=>'beta['.$type.']',
'label'=>Mage::helper('Mage_Adminhtml_Helper_Data')->__($label),
'value'=>1,
'checked'=>(int)Mage::app()->useCache($type),
));
}

$this->setForm($form);

return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ public function indexAction()
{
$this->_title($this->__('Catalog'))
->_title($this->__('Manage Products'));

/** @var $limitation Mage_Catalog_Model_Product_Limitation */
$limitation = Mage::getObjectManager()->get('Mage_Catalog_Model_Product_Limitation');
if ($limitation->isCreateRestricted()) {
$this->_getSession()->addNotice($limitation->getCreateRestrictedMessage());
}
$this->loadLayout();
$this->renderLayout();
}
Expand Down Expand Up @@ -243,6 +247,12 @@ public function newAction()
*/
public function editAction()
{
/** @var $limitation Mage_Catalog_Model_Product_Limitation */
$limitation = Mage::getObjectManager()->get('Mage_Catalog_Model_Product_Limitation');
if ($limitation->isCreateRestricted()) {
$this->_getSession()->addNotice($limitation->getCreateRestrictedMessage());
}

$productId = (int) $this->getRequest()->getParam('id');
$product = $this->_initProduct();

Expand Down
17 changes: 2 additions & 15 deletions app/code/core/Mage/Adminhtml/view/adminhtml/admin/page.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,7 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
<?php /*{
"label":"Root page layout",
"type":"Mage_Core_Block_Template",
"children":{
"header":{ "label":"Header", "type":"Mage_Adminhtml_Block_Page_Header" },
"menu":{ "label":"Top navigation", "type":"Mage_Backend_Block_Menu" },
"breadcrumbs":{ "label":"Breadcrumbs", "type":"Mage_Adminhtml_Block_Widget_Breadcrumbs" },
"content":{ "label":"Content block", "type":"Mage_Core_Block_Template" },
"left":{ "label":"Left navigation", "type":"Mage_Core_Block_Template" },
"footer":{ "label":"Footer", "type":"Mage_Adminhtml_Block_Page_Footer" }
},
"vars":{}
}*/ ?>

<?php /** @var $this Mage_Adminhtml_Block_Page */ ?>
<!doctype html>
<html lang="<?php echo $this->getLang() ?>" class="no-js">

Expand All @@ -55,7 +42,7 @@

<section class="page-content" id="anchor-content">
<?php echo $this->getChildHtml('main-top'); ?>
<div class="messages">
<div id="messages" class="messages">
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
</div>

Expand Down
Loading

0 comments on commit 5b266f6

Please sign in to comment.