Skip to content

Commit

Permalink
Import Magento 1.4.0.0-beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeSaferite committed Dec 31, 2009
1 parent 84a1ea6 commit 788d81f
Show file tree
Hide file tree
Showing 2,567 changed files with 72,992 additions and 77,069 deletions.
3 changes: 2 additions & 1 deletion .htaccess.sample
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
############################################
## adjust memory limit

php_value memory_limit 64M
# php_value memory_limit 64M
php_value memory_limit 128M
php_value max_execution_time 18000

############################################
Expand Down
52 changes: 19 additions & 33 deletions app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ public static function getVersionInfo()
'minor' => '4',
'revision' => '0',
'patch' => '0',
'stability' => 'alpha',
'number' => '3',
'stability' => 'beta',
'number' => '1',
);
}

Expand Down Expand Up @@ -551,7 +551,7 @@ public static function throwException($message, $messageStorage = null)
}

/**
* Initialize and retrieve application
* Get initialized application object.
*
* @param string $code
* @param string $type
Expand All @@ -561,22 +561,14 @@ public static function throwException($message, $messageStorage = null)
public static function app($code = '', $type = 'store', $options = array())
{
if (null === self::$_app) {
Varien_Profiler::start('self::app::construct');
self::$_app = new Mage_Core_Model_App();
Varien_Profiler::stop('self::app::construct');

self::setRoot();
self::$_events = new Varien_Event_Collection();


Varien_Profiler::start('self::app::register_config');
self::$_config = new Mage_Core_Model_Config();
Varien_Profiler::stop('self::app::register_config');

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

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

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

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

self::setRoot();
self::$_app = new Mage_Core_Model_App();
self::$_events = new Varien_Event_Collection();
self::$_config = new Mage_Core_Model_Config();
self::$_app->run(array(
'scope_code' => $code,
'scope_type' => $type,
'options' => $options,
));
Varien_Profiler::stop('mage');
}
catch (Mage_Core_Model_Session_Exception $e) {
} catch (Mage_Core_Model_Session_Exception $e) {
header('Location: ' . self::getBaseUrl());
die();
}
catch (Mage_Core_Model_Store_Exception $e) {
$baseUrl = self::getScriptSystemUrl('404');
} catch (Mage_Core_Model_Store_Exception $e) {
$baseUrl = rtrim(self::getScriptSystemUrl('404'), '/') . '/404/';
if (!headers_sent()) {
header('Location: ' . rtrim($baseUrl, '/').'/404/');
header('Location: ' . $baseUrl);
} else {
print '<script type="text/javascript">';
print "window.location.href = '{$baseUrl}';";
print '</script>';
}
die();
}
catch (Exception $e) {
} catch (Exception $e) {
if (self::isInstalled() || self::$_isDownloader) {
self::printException($e);
exit();
Expand All @@ -631,8 +620,7 @@ public static function run($code = '', $type = 'store', $options=array())
} else {
self::printException($e);
}
}
catch (Exception $ne) {
} catch (Exception $ne) {
self::printException($ne, $e->getMessage());
}
}
Expand All @@ -650,9 +638,7 @@ public static function isInstalled($options = array())
self::setRoot();

if (is_string($options)) {
$options = array(
'etc_dir' => $options
);
$options = array('etc_dir' => $options);
}
$etcDir = 'etc';
if (!empty($options['etc_dir'])) {
Expand Down
16 changes: 16 additions & 0 deletions app/code/core/Mage/Admin/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,20 @@ public function getAdminhtmlConfig()
{
return $this->_adminhtmlConfig;
}

/**
* Get menu item label by item path
*
* @param string $path
* @return string
*/
public function getMenuItemLabel($path)
{
$moduleName = 'adminhtml';
$menuNode = $this->getAdminhtmlConfig()->getNode('menu/' . str_replace('/', '/children/', trim($path, '/')));
if ($menuNode->getAttribute('module')) {
$moduleName = (string)$menuNode->getAttribute('module');
}
return Mage::helper($moduleName)->__((string)$menuNode->title);
}
}
2 changes: 1 addition & 1 deletion app/code/core/Mage/Admin/Model/Mysql4/Rules/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getByRoles($id)

public function addSortByLength()
{
$this->getSelect()->from('', array('length' => 'LENGTH(resource_id)'))
$this->getSelect()->columns(array('length' => 'LENGTH(resource_id)'))
->order('length desc');
return $this;
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Admin/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public function actionPreDispatchAdmin($event)
if (!$user || !$user->getId()) {
if ($request->getPost('login')) {
$postLogin = $request->getPost('login');
$username = $postLogin['username'];
$password = $postLogin['password'];
$username = isset($postLogin['username']) ? $postLogin['username'] : '';
$password = isset($postLogin['password']) ? $postLogin['password'] : '';
$user = $session->login($username, $password, $request);
$request->setPost('login', null);
}
Expand Down
6 changes: 5 additions & 1 deletion app/code/core/Mage/Admin/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,14 @@ public function getAclRole()
*/
public function authenticate($username, $password)
{
$config = Mage::getStoreConfigFlag('admin/security/use_case_sensitive_login');
$result = false;

try {
$this->loadByUsername($username);
if ($this->getId() && Mage::helper('core')->validateHash($password, $this->getPassword())) {
$sensitive = ($config) ? $username==$this->getUsername() : true;

if ($sensitive && $this->getId() && Mage::helper('core')->validateHash($password, $this->getPassword())) {
if ($this->getIsActive() != '1') {
Mage::throwException(Mage::helper('adminhtml')->__('This account is inactive.'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,11 @@ public function getRootByIds($ids)
$root = $tree->getNodeById($rootId);
if ($root && $rootId != Mage_Catalog_Model_Category::TREE_ROOT_ID) {
$root->setIsVisible(true);
}
elseif($root && $root->getId() == Mage_Catalog_Model_Category::TREE_ROOT_ID) {
} else if($root && $root->getId() == Mage_Catalog_Model_Category::TREE_ROOT_ID) {
$root->setName(Mage::helper('catalog')->__('Root'));
}

$tree->addCollectionData($this->getCategoryCollection());
Mage::register('root', $root);
}
return $root;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getElementHtml()
$html .= 'onclick="toggleValueElements(this, this.parentNode);" class="checkbox" type="checkbox">';

$html .= ' <label for="'.$htmlId.'" class="normal">'
. Mage::helper('adminhtml')->__('Use Config Settings').'</label>';
. Mage::helper('adminhtml')->__('Use All Available Attributes').'</label>';
$html .= '<script type="text/javascript">toggleValueElements($(\''.$htmlId.'\'), $(\''.$htmlId.'\').parentNode);</script>';

return $html;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ public function __construct() {
$this->setShowGlobalIcon(true);
}

/**
* Load Wysiwyg on demand and Prepare layout
*/
protected function _prepareLayout()
{
parent::_prepareLayout();
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
}
}

/**
* Prepare form before rendering HTML
*
Expand Down Expand Up @@ -137,7 +148,8 @@ protected function _prepareForm() {
protected function _getAdditionalElementTypes()
{
return array(
'image' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_category_helper_image')
'image' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_category_helper_image'),
'textarea' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_helper_form_wysiwyg')
);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function prepareElementHtml(Varien_Data_Form_Element_Abstract $element)
$uniqId = Mage::helper('core')->uniqHash($element->getId());
$sourceUrl = $this->getUrl('*/catalog_category_widget/chooser', array('uniq_id' => $uniqId, 'use_massaction' => false));

$chooser = $this->getLayout()->createBlock('adminhtml/cms_widget_chooser')
$chooser = $this->getLayout()->createBlock('widget/adminhtml_widget_chooser')
->setElement($element)
->setTranslationHelper($this->getTranslationHelper())
->setConfig($this->getConfig())
Expand Down
65 changes: 65 additions & 0 deletions app/code/core/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?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) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

/**
* Catalog textarea attribute WYSIWYG button
*
* @category Mage
* @package Mage_Adminhtml
* @author Magento Core Team <[email protected]>
*/
class Mage_Adminhtml_Block_Catalog_Helper_Form_Wysiwyg extends Varien_Data_Form_Element_Textarea
{
/**
* Retrieve additional html and put it at the end of element html
*
* @return string
*/
public function getAfterElementHtml()
{
$html = parent::getAfterElementHtml();
if ($this->getIsWysiwygEnabled()) {
$html .= Mage::getSingleton('core/layout')
->createBlock('adminhtml/widget_button', '', array(
'label' => Mage::helper('catalog')->__('WYSIWYG Editor'),
'type' => 'button',
'onclick' => 'catalogWysiwygEditor.open(\''.Mage::helper('adminhtml')->getUrl('*/*/wysiwyg').'\', \''.$this->getHtmlId().'\')'
))->toHtml();
}
return $html;
}

/**
* Check whether wysiwyg enabled or not
*
* @return boolean
*/
public function getIsWysiwygEnabled()
{
return (bool)(Mage::getSingleton('cms/wysiwyg_config')->isEnabled() && $this->getEntityAttribute()->getIsWysiwygEnabled());
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?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) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

/**
* Textarea attribute WYSIWYG content
*
* @category Mage
* @package Mage_Adminhtml
* @author Magento Core Team <[email protected]>
*/
class Mage_Adminhtml_Block_Catalog_Helper_Form_Wysiwyg_Content
extends Mage_Adminhtml_Block_Widget_Form
{
/**
* Prepare form.
* Adding editor field to render
*
* @return Mage_Adminhtml_Block_Catalog_Helper_Form_Wysiwyg_Content
*/
protected function _prepareForm()
{
$form = new Varien_Data_Form(array('id' => 'wysiwyg_edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
$form->addField($this->getData('editor_element_id'), 'editor', array(
'name' => 'content',
'style' => 'width:725px;height:460px',
'required' => true,
'force_load' => true,
'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig()
));
$this->setForm($form);
return parent::_prepareForm();
}
}
Loading

0 comments on commit 788d81f

Please sign in to comment.