[+] BO : #PSFV-94 AdminGenerator is now a controller

// + now form in options.tpl is inside a block
// newly made controller are now controllerCore
// Configuration die2Exception
// added license text in newly made admin templates

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10070 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mMarinetti
2011-11-13 18:51:01 +00:00
parent 35429b0699
commit 8b46abe6de
10 changed files with 131 additions and 63 deletions
@@ -0,0 +1,85 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 9548 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{extends file="helper/options/options.tpl"}
{block name="defaultOptions"}
<form action="{$current}&amp;token={$token}" method="post" enctype="multipart/form-data">
<fieldset><legend><img src="../img/admin/htaccess.gif" alt="" />{l s='Htaccess file generation'}</legend>
<p>
<b>{l s='Warning:'}</b>
{l s='this tool can ONLY be used if you are hosted by an Apache web server. Please ask your webhost.'}
</p>
<p>
{l s='This tool will automatically generate a ".htaccess" file that will give you the ability to do URL rewriting and to catch 404 errors.'}
</p>
{if $checkConfiguration_ht}
<div class="clear">&nbsp;</div>
<label for="imageCacheControl">{l s='Optimization'}</label>
<div class="margin-form">
<input type="checkbox" name="PS_HTACCESS_CACHE_CONTROL" id="PS_HTACCESS_CACHE_CONTROL" value="1" {if $ps_htaccess_cache_control}checked="checked"{/if} />
<p>{l s='This will add directives to your .htaccess file which should improve caching and compression.'}</p>
</div>
<div class="clear">&nbsp;</div>
<label for="imageCacheControl">{l s='Friendly URL'}</label>
<div class="margin-form">
<input type="checkbox" name="PS_REWRITING_SETTINGS" id="PS_REWRITING_SETTINGS" value="1" {if $ps_rewriting_settings}checked="checked"{/if} />
<p>{l s='Enable only if your server allows URL rewriting.'}</p>
</div>
<div class="clear">&nbsp;</div>
<label for="imageCacheControl">{l s='Disable apache multiviews'}</label>
<div class="margin-form">
<input type="checkbox" name="PS_HTACCESS_DISABLE_MULTIVIEWS" id="PS_HTACCESS_DISABLE_MULTIVIEWS" value="1" {if $ps_htaccess_disable_multiviews}checked="checked"{/if} />
<p>{l s='Enable this option only if you have problems with some pages URL rewriting.'}</p>
</div>
<p class="clear" style="font-weight:bold;">{l s='Generate your ".htaccess" file by clicking on the following button:'}
<input type="submit" value="{l s='Generate .htaccess file'}" name="submitHtaccess" class="button" /></p>
<p>{l s='This will erase your'}<b> {l s='old'}</b> {l s='.htaccess file!'}</p>
{else}
<p style="color:red; font-weight:bold;">{l s='Before being able to use this tool, you need to:'}</p>
<p>{l s='- create a'} <b>'. $this->l('.htaccess').'</b> {l s='blank file in directory'} <b>'.__PS_BASE_URI__.'</b>
<br />{l s='- give it write permissions (CHMOD 666 on Unix system)'}</p>
{/if}
</p></fieldset></form>
<br /><br />
<form action="{$current}&amp;token={$token}" method="post" enctype="multipart/form-data">
<fieldset><legend><img src="../img/admin/binoculars.png" alt="" />{l s='Robots file generation'}</legend>
<p><b>{l s='Warning:'} </b>{l s='Your file robots.txt MUST be in your website\'s root directory and nowhere else.'}</p>
<p>{l s='eg: http://www.yoursite.com/robots.txt'}</p>
<p>{l s='This tool will automatically generate a "robots.txt" file that you can configure to deny access to search engines for some pages.'}</p>
{if $checkConfiguration_rb}
<p style="font-weight:bold;">{l s='Generate your "robots.txt" file by clicking on the following button:'}
<input type="submit" value="{l s='Generate robots.txt file'}" name="submitRobots" class="button" /></p>
<p>{l s='This will erase your'}<b> {l s='old'}</b> {l s='robots.txt file!'}</p>
{else}
<p style="color:red; font-weight:bold;">{l s='Before being able to use this tool, you need to:'}</p>
<p>{l s='- create a'} <b>'. $this->l('robots.txt').'</b> {l s='blank file in dir:'} <b>{$smarty.const.__PS_BASE_URI__}</b>
<br />{l s='- give it write permissions (CHMOD 666 on Unix system)'}</p>
{/if}
</p></fieldset></form>
<br />
{/block}
@@ -26,6 +26,7 @@
<script type="text/javascript">
id_language = Number({$current_id_lang});
</script>
{block name="defaultOptions"}
<form action="{$current}&submitOptions{$table}=1&token={$token}"
{if isset($categoryData['name'])} name={$categoryData['name']}{/if}
{if isset($categoryData['id'])} id={$categoryData['id']} {/if}
@@ -207,4 +208,5 @@
</fieldset><br />
{/foreach}
</form>
{/block}
{block name="after"}{/block}
@@ -1,3 +1,28 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 8971 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{extends file="helper/form/form.tpl"}
{block name="defaultForm"}
{$custom_form}
+2 -2
View File
@@ -187,7 +187,7 @@ class ConfigurationCore extends ObjectModel
static public function getMultiple($keys, $langID = NULL, $shopGroupID = NULL, $shopID = NULL)
{
if (!is_array($keys))
die(Tools::displayError());
throw new PrestashopException('keys var is not an array');
$langID = (int)$langID;
self::getShopFromContext($shopGroupID, $shopID);
@@ -497,4 +497,4 @@ class ConfigurationCore extends ObjectModel
';
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
}
}
}
+3
View File
@@ -63,6 +63,9 @@ class HelperOptionsCore extends Helper
foreach ($option_list as $category => $category_data)
{
if(!is_array($category_data))
continue;
if (!isset($category_data['image']))
$category_data['image'] = (!empty($tab['module']) && file_exists($_SERVER['DOCUMENT_ROOT']._MODULE_DIR_.$tab['module'].'/'.$tab['class_name'].'.gif') ? _MODULE_DIR_.$tab['module'].'/' : '../img/t/').$tab['class_name'].'.gif';
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
class AdminContactController extends AdminController
class AdminContactControllerCore extends AdminController
{
public function __construct()
{
@@ -25,8 +25,10 @@
* International Registered Trademark & Property of PrestaShop SA
*/
class AdminGenerator extends AdminTab
class AdminGeneratorControllerCore extends AdminController
{
protected $options = array('array for auto display');
public function __construct()
{
$this->_htFile = dirname(__FILE__).'/../../.htaccess';
@@ -36,66 +38,17 @@ class AdminGenerator extends AdminTab
return parent::__construct();
}
public function display()
public function initContent()
{
$languages = Language::getLanguages(false);
// Htaccess
echo '
<form action="'.self::$currentIndex.'&token='.$this->token.'" method="post" enctype="multipart/form-data">
<fieldset><legend><img src="../img/admin/htaccess.gif" alt="" />'.$this->l('Htaccess file generation').'</legend>
<p><b>'.$this->l('Warning:').'</b> '.$this->l('this tool can ONLY be used if you are hosted by an Apache web server. Please ask your webhost.').'</p>
<p>'.$this->l('This tool will automatically generate a ".htaccess" file that will give you the ability to do URL rewriting and to catch 404 errors.').'</p>';
$this->tpl_option_vars['checkConfiguration_ht'] = $this->_checkConfiguration($this->_htFile);
$this->tpl_option_vars['checkConfiguration_rb'] = $this->_checkConfiguration($this->_rbFile);
$this->tpl_option_vars['ps_htaccess_cache_control'] = Configuration::get('PS_HTACCESS_CACHE_CONTROL');
$this->tpl_option_vars['ps_rewriting_settings'] = Configuration::get('PS_REWRITING_SETTINGS');
$this->tpl_option_vars['ps_htaccess_disable_multiviews'] = Configuration::get('PS_HTACCESS_DISABLE_MULTIVIEWS');
if ($this->_checkConfiguration($this->_htFile))
echo '
<div class="clear">&nbsp;</div>
<label for="imageCacheControl">'.$this->l('Optimization').'</label>
<div class="margin-form">
<input type="checkbox" name="PS_HTACCESS_CACHE_CONTROL" id="PS_HTACCESS_CACHE_CONTROL" value="1" '.(Configuration::get('PS_HTACCESS_CACHE_CONTROL') == 1 ? 'checked="checked"' : '').' />
<p>'.$this->l('This will add directives to your .htaccess file which should improve caching and compression.').'</p>
</div>
<div class="clear">&nbsp;</div>
<label for="imageCacheControl">'.$this->l('Friendly URL').'</label>
<div class="margin-form">
<input type="checkbox" name="PS_REWRITING_SETTINGS" id="PS_REWRITING_SETTINGS" value="1" '.(Configuration::get('PS_REWRITING_SETTINGS') ? 'checked="checked"' : '').' />
<p>'.$this->l('Enable only if your server allows URL rewriting.').'</p>
</div>
<div class="clear">&nbsp;</div>
<label for="imageCacheControl">'.$this->l('Disable apache multiviews').'</label>
<div class="margin-form">
<input type="checkbox" name="PS_HTACCESS_DISABLE_MULTIVIEWS" id="PS_HTACCESS_CACHE_CONTROL" value="1" '.(Configuration::get('PS_HTACCESS_DISABLE_MULTIVIEWS') == 1 ? 'checked="checked"' : '').' />
<p>'.$this->l('Enable this option only if you have problems with some pages URL rewriting.').'</p>
</div>
<p class="clear" style="font-weight:bold;">'.$this->l('Generate your ".htaccess" file by clicking on the following button:').'
<input type="submit" value="'.$this->l('Generate .htaccess file').'" name="submitHtaccess" class="button" /></p>
<p>'.$this->l('This will erase your').'<b> '.$this->l('old').'</b> '.$this->l('.htaccess file!').'</p>';
else
echo '
<p style="color:red; font-weight:bold;">'.$this->l('Before being able to use this tool, you need to:').'</p>
<p>'.$this->l('- create a').' <b>'. $this->l('.htaccess').'</b> '.$this->l('blank file in directory').' <b>'.__PS_BASE_URI__.'</b>
<br />'.$this->l('- give it write permissions (CHMOD 666 on Unix system)').'</p>';
echo '</p></fieldset></form>';
// Robots
echo '<br /><br />
<form action="'.self::$currentIndex.'&token='.$this->token.'" method="post" enctype="multipart/form-data">
<fieldset><legend><img src="../img/admin/binoculars.png" alt="" />'.$this->l('Robots file generation').'</legend>
<p><b>'.$this->l('Warning:').' </b>'.$this->l('Your file robots.txt MUST be in your website\'s root directory and nowhere else.').'</p>
<p>'.$this->l('eg: http://www.yoursite.com/robots.txt').'.</p>
<p>'.$this->l('This tool will automatically generate a "robots.txt" file that you can configure to deny access to search engines for some pages.').'</p>';
if ($this->_checkConfiguration($this->_rbFile))
echo '
<p style="font-weight:bold;">'.$this->l('Generate your "robots.txt" file by clicking on the following button:').'
<input type="submit" value="'.$this->l('Generate robots.txt file').'" name="submitRobots" class="button" /></p>
<p>'.$this->l('This will erase your').'<b> '.$this->l('old').'</b> '.$this->l('robots.txt file!').'</p>';
else
echo '
<p style="color:red; font-weight:bold;">'.$this->l('Before being able to use this tool, you need to:').'</p>
<p>'.$this->l('- create a').' <b>'. $this->l('robots.txt').'</b> '.$this->l('blank file in dir:').' <b>'.__PS_BASE_URI__.'</b>
<br />'.$this->l('- give it write permissions (CHMOD 666 on Unix system)').'</p>';
echo '</p></fieldset></form>
<br />';
parent::initContent();
}
public function _checkConfiguration($file)
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
class AdminLocalizationController extends AdminController
class AdminLocalizationControllerCore extends AdminController
{
public function __construct()
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
class AdminThemesController extends AdminController
class AdminThemesControllerCore extends AdminController
{
/** This value is used in isThemeCompatible method. only version node with an
* higher version number will be used in [theme]/config.xml
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
class AdminWebserviceController extends AdminController
class AdminWebserviceControllerCore extends AdminController
{
// this will be filled later
public $fields_form = array('webservice form');