[*] BO : #PSFV-94 - added AdminCMSContentController, AdminCMSController, AdminCMSCategoriesController
This commit is contained in:
@@ -1,348 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* 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 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: 7300 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
|
||||
|
||||
class AdminCMS extends AdminTab
|
||||
{
|
||||
private $_category;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'cms';
|
||||
$this->className = 'CMS';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->view = true;
|
||||
$this->delete = true;
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_cms' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'link_rewrite' => array('title' => $this->l('URL'), 'width' => 200),
|
||||
'meta_title' => array('title' => $this->l('Title'), 'width' => 300, 'filter_key' => 'b!meta_title'),
|
||||
'position' => array('title' => $this->l('Position'), 'width' => 40,'filter_key' => 'position', 'align' => 'center', 'position' => 'position'),
|
||||
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
|
||||
);
|
||||
|
||||
$this->_category = AdminCMSContent::getCurrentCMSCategory();
|
||||
$this->_join = '
|
||||
LEFT JOIN `'._DB_PREFIX_.'cms_category` c ON (c.`id_cms_category` = a.`id_cms_category`)';
|
||||
$this->_select = 'a.position ';
|
||||
$this->_filter = 'AND c.id_cms_category = '.(int)($this->_category->id);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
private function _displayDraftWarning($active)
|
||||
{
|
||||
return
|
||||
'<div class="warn draft" style="'.($active ? 'display:none' : '').'">
|
||||
<p>
|
||||
<span style="float: left">
|
||||
<img src="../img/admin/warn2.png" />
|
||||
'.$this->l('Your CMS page will be saved as a draft').'
|
||||
</span>
|
||||
<input type="button" class="button" style="float: right;" value="'.$this->l('Save and preview').'" onclick="submitAddcmsAndPreview();">
|
||||
<input type="hidden" name="previewSubmitAddcmsAndPreview" id="previewSubmitAddcmsAndPreview" />
|
||||
<br class="clear" />
|
||||
</p>
|
||||
</div>';
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
parent::displayForm();
|
||||
|
||||
$obj = $this->loadObject(true);
|
||||
$divLangName = 'meta_title¤meta_description¤meta_keywords¤ccontent¤link_rewrite';
|
||||
|
||||
echo '
|
||||
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.Tools::getAdminTokenLite('AdminCMSContent').'" method="post" name="cms" id="cms">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
'.$this->_displayDraftWarning($obj->active).'
|
||||
<fieldset><legend><img src="../img/admin/cms.gif" />'.$this->l('CMS page').'</legend>';
|
||||
|
||||
// META TITLE
|
||||
echo '<label>'.$this->l('CMS Category:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_cms_category">';
|
||||
$categories = CMSCategory::getCategories($this->context->language->id, false);
|
||||
CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($obj, 'id_cms_category'));
|
||||
echo '
|
||||
</select>
|
||||
</div>
|
||||
<label>'.$this->l('Meta title').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo ' <div id="meta_title_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="40" type="text" onkeyup="copyMeta2friendlyURL();" id="name_'.$language['id_lang'].'" name="meta_title_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_title', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /><sup> *</sup>
|
||||
</div>';
|
||||
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'meta_title');
|
||||
echo ' </div><div class="clear space"> </div>';
|
||||
|
||||
// META DESCRIPTION
|
||||
echo ' <label>'.$this->l('Meta description').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo ' <div id="meta_description_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="50" type="text" name="meta_description_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'meta_description');
|
||||
echo ' </div><div class="clear space"> </div>';
|
||||
|
||||
// META KEYWORDS
|
||||
echo ' <label>'.$this->l('Meta keywords').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo ' <div id="meta_keywords_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="50" type="text" name="meta_keywords_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_keywords', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'meta_keywords');
|
||||
echo ' </div><div class="clear space"> </div>';
|
||||
|
||||
// LINK REWRITE
|
||||
echo ' <label>'.$this->l('Friendly URL').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo ' <div id="link_rewrite_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="30" type="text" id="input_link_rewrite_'.$language['id_lang'].'" name="link_rewrite_'.$language['id_lang'].'" onkeyup="this.value = str2url(this.value); updateFriendlyURL();" value="'.htmlentities($this->getFieldValue($obj, 'link_rewrite', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /><sup> *</sup>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'link_rewrite');
|
||||
echo ' </div><div class="clear space"> </div>';
|
||||
|
||||
// CONTENT
|
||||
echo ' <label>'.$this->l('Page content').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo ' <div id="ccontent_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').';float: left;">
|
||||
<textarea class="rte" cols="80" rows="30" id="content_'.$language['id_lang'].'" name="content_'.$language['id_lang'].'">'.htmlentities(stripslashes($this->getFieldValue($obj, 'content', $language['id_lang'])), ENT_COMPAT, 'UTF-8').'</textarea>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'ccontent');
|
||||
echo ' </div><div class="clear space"> </div>
|
||||
<label>'.$this->l('Enable:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" onclick="toggleDraftWarning(false);" value="1" '.($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="active" id="active_off" onclick="toggleDraftWarning(true);" value="0" '.(!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
</div>';
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
|
||||
$this->displayAssoShop();
|
||||
echo '</div>';
|
||||
}
|
||||
// SUBMIT
|
||||
echo ' <div class="margin-form space">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset><br />
|
||||
'.$this->_displayDraftWarning($obj->active).'
|
||||
</form>';
|
||||
// TinyMCE
|
||||
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$this->context->language->iso_code.'.js') ? $this->context->language->iso_code : 'en');
|
||||
$ad = dirname($_SERVER["PHP_SELF"]);
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
var iso = \''.$isoTinyMCE.'\' ;
|
||||
var pathCSS = \''._THEME_CSS_DIR_.'\' ;
|
||||
var ad = \''.$ad.'\' ;
|
||||
</script>
|
||||
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/tiny_mce/tiny_mce.js"></script>
|
||||
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/tinymce.inc.js"></script>';
|
||||
}
|
||||
|
||||
public function display($token = NULL)
|
||||
{
|
||||
|
||||
if (($id_cms_category = (int)Tools::getValue('id_cms_category')))
|
||||
self::$currentIndex .= '&id_cms_category='.$id_cms_category;
|
||||
$this->getList($this->context->language->id, !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$this->context->cookie->__get($this->table.'Orderway') ? 'ASC' : NULL);
|
||||
|
||||
if (!$id_cms_category)
|
||||
$id_cms_category = 1;
|
||||
echo '<h3>'.(!$this->_listTotal ? ($this->l('No pages found')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('pages') : $this->l('page')))).' '.
|
||||
$this->l('in category').' "'.stripslashes(CMSCategory::hideCMSCategoryPosition($this->_category->getName())).'"</h3>';
|
||||
echo '<a href="'.self::$currentIndex.'&id_cms_category='.$id_cms_category.'&add'.$this->table.'&token='.Tools::getAdminTokenLite('AdminCMSContent').'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new page').'</a>
|
||||
<div style="margin:10px;">';
|
||||
$this->displayList($token);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
public function displayList($token = NULL)
|
||||
{
|
||||
/* Display list header (filtering, pagination and column names) */
|
||||
$this->displayListHeader($token);
|
||||
if (!sizeof($this->_list))
|
||||
echo '<tr><td class="center" colspan="'.(sizeof($this->fieldsDisplay) + 2).'">'.$this->l('No items found').'</td></tr>';
|
||||
|
||||
/* Show the content of the table */
|
||||
$this->displayListContent($token);
|
||||
|
||||
/* Close list table and submit button */
|
||||
$this->displayListFooter($token);
|
||||
}
|
||||
|
||||
function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('viewcms') AND ($id_cms = (int)(Tools::getValue('id_cms'))) AND $cms = new CMS($id_cms, $this->context->language->id) AND Validate::isLoadedObject($cms))
|
||||
{
|
||||
$redir = $this->context->link->getCMSLink($cms);
|
||||
if (!$cms->active)
|
||||
{
|
||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1);
|
||||
$redir .= '?adtoken='.Tools::encrypt('PreviewCMS'.$cms->id).'&ad='.$admin_dir;
|
||||
}
|
||||
Tools::redirectAdmin($redir);
|
||||
}
|
||||
elseif (Tools::isSubmit('deletecms'))
|
||||
{
|
||||
if (Tools::getValue('id_cms') == Configuration::get('PS_CONDITIONS_CMS_ID'))
|
||||
{
|
||||
Configuration::updateValue('PS_CONDITIONS', 0);
|
||||
Configuration::updateValue('PS_CONDITIONS_CMS_ID', 0);
|
||||
}
|
||||
$cms = new CMS((int)(Tools::getValue('id_cms')));
|
||||
$cms->cleanPositions($cms->id_cms_category);
|
||||
if (!$cms->delete())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.' ('.Db::getInstance()->getMsgError().')</b>';
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_cms_category='.$cms->id_cms_category.'&conf=1&token='.Tools::getAdminTokenLite('AdminCMSContent'));
|
||||
}/* Delete multiple objects */
|
||||
elseif (Tools::getValue('submitDel'.$this->table))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (isset($_POST[$this->table.'Box']))
|
||||
{
|
||||
$cms = new CMS();
|
||||
$result = true;
|
||||
$result = $cms->deleteSelection(Tools::getValue($this->table.'Box'));
|
||||
if ($result)
|
||||
{
|
||||
$cms->cleanPositions((int)(Tools::getValue('id_cms_category')));
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCMSContent').'&id_category='.(int)(Tools::getValue('id_cms_category')));
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
elseif (Tools::isSubmit('submitAddcms') OR Tools::isSubmit('submitAddcmsAndPreview'))
|
||||
{
|
||||
parent::validateRules();
|
||||
|
||||
if (!sizeof($this->_errors))
|
||||
{
|
||||
if (!$id_cms = (int)(Tools::getValue('id_cms')))
|
||||
{
|
||||
$cms = new CMS();
|
||||
$this->copyFromPost($cms, 'cms');
|
||||
if (!$cms->add())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.' ('.Db::getInstance()->getMsgError().')</b>';
|
||||
elseif (Tools::isSubmit('submitAddcmsAndPreview'))
|
||||
{
|
||||
$preview_url = $this->context->link->getCMSLink($cms, $this->getFieldValue($object, 'link_rewrite', $this->_defaultFormLanguage), $this->context->language->id);
|
||||
if (!$cms->active)
|
||||
{
|
||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1);
|
||||
$token = Tools::encrypt('PreviewCMS'.$cms->id);
|
||||
|
||||
$preview_url .= $object->active ? '' : '&adtoken='.$token.'&ad='.$admin_dir;
|
||||
}
|
||||
Tools::redirectAdmin($preview_url);
|
||||
}
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_cms_category='.$cms->id_cms_category.'&conf=3&token='.Tools::getAdminTokenLite('AdminCMSContent'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$cms = new CMS($id_cms);
|
||||
$this->copyFromPost($cms, 'cms');
|
||||
if (!$cms->update())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.' ('.Db::getInstance()->getMsgError().')</b>';
|
||||
elseif (Tools::isSubmit('submitAddcmsAndPreview'))
|
||||
{
|
||||
$preview_url = $this->context->link->getCMSLink($cms, $this->getFieldValue($object, 'link_rewrite', $this->_defaultFormLanguage), $this->context->language->id);
|
||||
if (!$cms->active)
|
||||
{
|
||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1);
|
||||
$token = Tools::encrypt('PreviewCMS'.$cms->id);
|
||||
|
||||
$preview_url .= $object->active ? '' : '&adtoken='.$token.'&ad='.$admin_dir;
|
||||
}
|
||||
Tools::redirectAdmin($preview_url);
|
||||
}
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_cms_category='.$cms->id_cms_category.'&conf=4&token='.Tools::getAdminTokenLite('AdminCMSContent'));
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (Tools::getValue('position'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] !== '1')
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
elseif (!Validate::isLoadedObject($object = $this->loadObject()))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
elseif (!$object->updatePosition((int)(Tools::getValue('way')), (int)(Tools::getValue('position'))))
|
||||
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=4'.(($id_category = (int)(Tools::getValue('id_cms_category'))) ? ('&id_cms_category='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCMSContent'));
|
||||
}
|
||||
/* Change object statuts (active, inactive) */
|
||||
elseif (Tools::isSubmit('status') AND Tools::isSubmit($this->identifier))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()))
|
||||
{
|
||||
if ($object->toggleStatus())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=5'.((int)Tools::getValue('id_cms_category') ? '&id_cms_category='.(int)Tools::getValue('id_cms_category') : '').'&token='.Tools::getValue('token'));
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else
|
||||
parent::postProcess(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,283 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* 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 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: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
|
||||
|
||||
class AdminCMSCategories extends AdminTab
|
||||
{
|
||||
/** @var object CMSCategory() instance for navigation*/
|
||||
private $_CMSCategory;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'cms_category';
|
||||
$this->className = 'CMSCategory';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->view = true;
|
||||
$this->delete = true;
|
||||
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_cms_category' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 30),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 100, 'callback' => 'hideCMSCategoryPosition'),
|
||||
'description' => array('title' => $this->l('Description'), 'width' => 500, 'maxlength' => 90, 'orderby' => false),
|
||||
'position' => array('title' => $this->l('Position'), 'width' => 40,'filter_key' => 'position', 'align' => 'center', 'position' => 'position'),
|
||||
'active' => array('title' => $this->l('Displayed'), 'active' => 'status', 'align' => 'center', 'type' => 'bool', 'orderby' => false));
|
||||
|
||||
$this->_CMSCategory = AdminCMSContent::getCurrentCMSCategory();
|
||||
$this->_filter = 'AND `id_parent` = '.(int)($this->_CMSCategory->id);
|
||||
$this->_select = 'position ';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function displayList($token = NULL)
|
||||
{
|
||||
/* Display list header (filtering, pagination and column names) */
|
||||
$this->displayListHeader($token);
|
||||
if (!sizeof($this->_list))
|
||||
echo '<tr><td class="center" colspan="'.(sizeof($this->fieldsDisplay) + 2).'">'.$this->l('No items found').'</td></tr>';
|
||||
|
||||
/* Show the content of the table */
|
||||
$this->displayListContent($token);
|
||||
|
||||
/* Close list table and submit button */
|
||||
$this->displayListFooter($token);
|
||||
}
|
||||
|
||||
public function display($token = NULL)
|
||||
{
|
||||
$id_cms_category = (int)(Tools::getValue('id_cms_category', 1));
|
||||
|
||||
$this->getList((int)($this->context->cookie->id_lang), !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$this->context->cookie->__get($this->table.'Orderway') ? 'ASC' : NULL);
|
||||
|
||||
echo '<h3>'.(!$this->_listTotal ? ($this->l('There are no subcategories')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('subcategories') : $this->l('subCMS Category')))).' '.$this->l('in CMS Category').' "'.stripslashes(CMSCategory::hideCMSCategoryPosition($this->_CMSCategory->getName())).'"</h3>';
|
||||
echo '<a href="'.__PS_BASE_URI__.substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)).'?tab=AdminCMSContent&add'.$this->table.'&id_parent='.Tools::getValue('id_cms_category').'&token='.($token!=NULL ? $token : $this->token).'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new sub CMS Category').'</a>
|
||||
<div style="margin:10px;">';
|
||||
$this->displayList($token);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
public function postProcess($token = NULL)
|
||||
{
|
||||
$this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id);
|
||||
|
||||
if (Tools::isSubmit('submitAdd'.$this->table))
|
||||
{
|
||||
|
||||
if ($id_cms_category = (int)(Tools::getValue('id_cms_category')))
|
||||
{
|
||||
if (!CMSCategory::checkBeforeMove($id_cms_category, (int)(Tools::getValue('id_parent'))))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('CMS Category cannot be moved here');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Change object statuts (active, inactive) */
|
||||
elseif (isset($_GET['statuscms_category']) AND Tools::getValue($this->identifier))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()))
|
||||
{
|
||||
if ($object->toggleStatus())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=5'.((int)$object->id_parent ? '&id_cms_category='.(int)$object->id_parent : '').'&token='.Tools::getValue('token'));
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
/* Delete object */
|
||||
elseif (isset($_GET['delete'.$this->table]))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()) AND isset($this->fieldImageSettings))
|
||||
{
|
||||
// check if request at least one object with noZeroObject
|
||||
if (isset($object->noZeroObject) AND sizeof($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1)
|
||||
$this->_errors[] = Tools::displayError('You need at least one object.').' <b>'.$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
|
||||
else
|
||||
{
|
||||
$this->deleteImage($object->id);
|
||||
if ($this->deleted)
|
||||
{
|
||||
$object->deleted = 1;
|
||||
if ($object->update())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.Tools::getValue('token'));
|
||||
}
|
||||
elseif ($object->delete())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.Tools::getValue('token'));
|
||||
$this->_errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
elseif (isset($_GET['position']))
|
||||
{
|
||||
if ($this->tabAccess['edit'] !== '1')
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
elseif (!Validate::isLoadedObject($object = new CMSCategory((int)(Tools::getValue($this->identifier, Tools::getValue('id_cms_category_to_move', 1))))))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
elseif (!$object->updatePosition((int)(Tools::getValue('way')), (int)(Tools::getValue('position'))))
|
||||
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)(Tools::getValue($this->identifier, Tools::getValue('id_cms_category_parent', 1)))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCMSContent'));
|
||||
}
|
||||
/* Delete multiple objects */
|
||||
elseif (Tools::getValue('submitDel'.$this->table))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (isset($_POST[$this->table.'Box']))
|
||||
{
|
||||
$cms_category = new CMSCategory();
|
||||
$result = true;
|
||||
$result = $cms_category->deleteSelection(Tools::getValue($this->table.'Box'));
|
||||
if ($result)
|
||||
{
|
||||
$cms_category->cleanPositions((int)(Tools::getValue('id_cms_category')));
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCMSContent').'&id_category='.(int)(Tools::getValue('id_cms_category')));
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
parent::postProcess(true);
|
||||
}
|
||||
|
||||
public function displayForm($token=NULL)
|
||||
{
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
$active = $this->getFieldValue($obj, 'active');
|
||||
|
||||
echo '
|
||||
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.($token!=NULL ? $token : $this->token).'" method="post" enctype="multipart/form-data">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset style="width:520px"><legend><img src="../img/admin/tab-categories.gif" />'.$this->l('CMS Category').'</legend>
|
||||
<label>'.$this->l('Name:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" style="width: 260px" name="name_'.$language['id_lang'].'" id="name_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'name', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" '.((!$obj->id) ? ' onkeyup="copy2friendlyURL();"' : '').' /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<label>'.$this->l('Displayed:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" value="1" '.($active ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_on"><img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="active" id="active_off" value="0" '.(!$active ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"><img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
</div>
|
||||
<label>'.$this->l('Parent CMS Category:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_parent">';
|
||||
$categories = CMSCategory::getCategories($this->context->language->id, false);
|
||||
CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($obj, 'id_parent'));
|
||||
echo '
|
||||
</select>
|
||||
</div>
|
||||
<label>'.$this->l('Description:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<textarea name="description_'.$language['id_lang'].'" rows="5" cols="40">'.htmlentities($this->getFieldValue($obj, 'description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'</textarea>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<div class="clear"><br /></div>
|
||||
<label>'.$this->l('Meta title:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="meta_title_'.$language['id_lang'].'" id="meta_title_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_title', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<label>'.$this->l('Meta description:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="meta_description_'.$language['id_lang'].'" id="meta_description_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<label>'.$this->l('Meta keywords:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="meta_keywords_'.$language['id_lang'].'" id="meta_keywords_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_keywords', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<label>'.$this->l('Friendly URL:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="link_rewrite_'.$language['id_lang'].'" id="link_rewrite_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'link_rewrite', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" onkeyup="this.value = str2url(this.value);" /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Only letters and the minus (-) character are allowed').'<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l('Save and back to parent CMS Category').'" name="submitAdd'.$this->table.'AndBackToParent" class="button" />
|
||||
<input type="submit" class="button" name="submitAdd'.$this->table.'" value="'.$this->l('Save').'"/>
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
<p class="clear"></p>';
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* 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 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: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
|
||||
include(_PS_ADMIN_DIR_.'/tabs/AdminCMSCategories.php');
|
||||
include(_PS_ADMIN_DIR_.'/tabs/AdminCMS.php');
|
||||
|
||||
class AdminCMSContent extends AdminTab
|
||||
{
|
||||
/** @var object adminCMSCategories() instance */
|
||||
private $adminCMSCategories;
|
||||
|
||||
/** @var object adminCMS() instance */
|
||||
private $adminCMS;
|
||||
|
||||
/** @var object Category() instance for navigation*/
|
||||
private static $_category = NULL;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
/* Get current category */
|
||||
$id_cms_category = (int)(Tools::getValue('id_cms_category', Tools::getValue('id_cms_category_parent', 1)));
|
||||
self::$_category = new CMSCategory($id_cms_category);
|
||||
if (!Validate::isLoadedObject(self::$_category))
|
||||
die('Category cannot be loaded');
|
||||
|
||||
$this->table = array('cms_category', 'cms');
|
||||
$this->adminCMSCategories = new adminCMSCategories();
|
||||
$this->adminCMS = new adminCMS();
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current category
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public static function getCurrentCMSCategory()
|
||||
{
|
||||
return self::$_category;
|
||||
}
|
||||
|
||||
public function viewAccess($disable = false)
|
||||
{
|
||||
$result = parent::viewAccess($disable);
|
||||
$this->adminCMSCategories->tabAccess = $this->tabAccess;
|
||||
$this->adminCMS->tabAccess = $this->tabAccess;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('submitDelcms') OR Tools::isSubmit('previewSubmitAddcmsAndPreview') OR Tools::isSubmit('submitAddcms') OR isset($_GET['deletecms']) OR Tools::isSubmit('viewcms') OR (Tools::isSubmit('statuscms') AND Tools::isSubmit('id_cms')) OR (Tools::isSubmit('position') AND !Tools::isSubmit('id_cms_category_to_move')))
|
||||
$this->adminCMS->postProcess();
|
||||
if(Tools::isSubmit('submitDelcms_category') OR Tools::isSubmit('submitAddcms_categoryAndBackToParent') OR Tools::isSubmit('submitAddcms_category') OR isset($_GET['deletecms_category']) OR (Tools::isSubmit('statuscms_category') AND Tools::isSubmit('id_cms_category')) OR (Tools::isSubmit('position') AND Tools::isSubmit('id_cms_category_to_move')))
|
||||
$this->adminCMSCategories->postProcess();
|
||||
|
||||
}
|
||||
|
||||
public function displayErrors()
|
||||
{
|
||||
parent::displayErrors();
|
||||
$this->adminCMS->displayErrors();
|
||||
$this->adminCMSCategories->displayErrors();
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
if (((Tools::isSubmit('submitAddcms_category') OR Tools::isSubmit('submitAddcms_categoryAndStay')) AND sizeof($this->adminCMSCategories->_errors)) OR isset($_GET['updatecms_category']) OR isset($_GET['addcms_category']))
|
||||
{
|
||||
$this->adminCMSCategories->displayForm($this->token);
|
||||
echo '<br /><br /><a href="'.self::$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to list').'</a><br />';
|
||||
|
||||
}
|
||||
elseif (((Tools::isSubmit('submitAddcms') OR Tools::isSubmit('submitAddcmsAndStay')) AND sizeof($this->adminCMS->_errors)) OR isset($_GET['updatecms']) OR isset($_GET['addcms']))
|
||||
{
|
||||
$this->adminCMS->displayForm($this->token);
|
||||
echo '<br /><br /><a href="'.self::$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to list').'</a><br />';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$id_cms_category = (int)(Tools::getValue('id_cms_category'));
|
||||
if (!$id_cms_category)
|
||||
$id_cms_category = 1;
|
||||
$cms_tabs = array('cms_category', 'cms');
|
||||
// Cleaning links
|
||||
$catBarIndex = self::$currentIndex;
|
||||
foreach ($cms_tabs AS $tab)
|
||||
if (Tools::getValue($tab.'Orderby') && Tools::getValue($tab.'Orderway'))
|
||||
$catBarIndex = preg_replace('/&'.$tab.'Orderby=([a-z _]*)&'.$tab.'Orderway=([a-z]*)/i', '', self::$currentIndex);
|
||||
echo '<div class="cat_bar"><span style="color: #3C8534;">'.$this->l('Current category').' :</span> '.getPath($catBarIndex, $id_cms_category,'','','cms').'</div>';
|
||||
echo '<h2>'.$this->l('Categories').'</h2>';
|
||||
$this->adminCMSCategories->display($this->token);
|
||||
echo '<div style="margin:10px"> </div>';
|
||||
echo '<h2>'.$this->l('Pages in this category').'</h2>';
|
||||
$this->adminCMS->display($this->token);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ a.module_toggle_all{color: #268CCD;}
|
||||
.processing {overflow: auto;}
|
||||
|
||||
/*TABLE STATUS COMMANDE*/
|
||||
.table td span.color_field { font-size:11px; padding:2px 5px; border-radius:3px; text-transform:uppercase; text-shadow:0 1px 0 #fff; color:#fff; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px;}
|
||||
.table td span.color_field { font-size:11px; padding:2px 5px; border-radius:3px; text-transform:uppercase; color:#fff; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px;}
|
||||
|
||||
/*toolbarBox*/
|
||||
.toolbarBox { background-color: #F8F8F8; border: 1px solid #CCCCCC; margin-bottom:10px; padding: 10px 0; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px;}
|
||||
@@ -170,6 +170,7 @@ a.module_toggle_all{color: #268CCD;}
|
||||
.toolbarBox .process-icon-save-calendar { background-image: url(process-icon-save-calendar.png);}
|
||||
.toolbarBox .process-icon-new-module { background-image: url(process-icon-new-module.png);}
|
||||
.toolbarBox .process-icon-new-module-addon { background-image: url(process-icon-new-module-addon.png);}
|
||||
.toolbarBox .process-icon-save-and-preview { background-image: url(process-icon-preview.png);}
|
||||
|
||||
div.fix-toolbar {border-bottom: 1px solid #E0E0E0;position:fixed;top:0;opacity:0.9;z-index:1;}
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
{*
|
||||
* 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$
|
||||
* @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="script"}
|
||||
$(document).ready(function() {
|
||||
if (btn_submit.length > 0)
|
||||
{
|
||||
//get reference on save and stay link
|
||||
btn_save_and_preview = $('span[class~="process-icon-save-and-preview"]').parent();
|
||||
|
||||
//get reference on current save link label
|
||||
lbl_save = $('#desc-{$table}-save div');
|
||||
|
||||
//submit the form
|
||||
if (btn_save_and_preview)
|
||||
{
|
||||
btn_save_and_preview.click(function() {
|
||||
//add hidden input to emulate submit button click when posting the form -> field name posted
|
||||
btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'AndPreview" value="1" />');
|
||||
$('#{$table}_form').submit();
|
||||
});
|
||||
}
|
||||
}
|
||||
$('#active_on').bind('click', function(){
|
||||
toggleDraftWarning(true);
|
||||
});
|
||||
$('#active_off').bind('click', function(){
|
||||
toggleDraftWarning(false);
|
||||
});
|
||||
});
|
||||
{/block}
|
||||
|
||||
{block name="leadin"}
|
||||
<div class="warn draft" style="{if $active}display:none{/if}">
|
||||
<p>
|
||||
<span style="float: left">
|
||||
{l s='Your CMS page will be saved as a draft'}
|
||||
</span>
|
||||
<br class="clear" />
|
||||
</p>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name="start_field_block"}
|
||||
<div class="margin-form">
|
||||
{if $input.type == 'select_category'}
|
||||
<select name="{$input.name}">
|
||||
{$input.options.html}
|
||||
</select>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
{*
|
||||
* 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$
|
||||
* @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="start_field_block"}
|
||||
<div class="margin-form">
|
||||
{if $input.type == 'select_category'}
|
||||
<select name="id_parent">
|
||||
{$input.options.html}
|
||||
</select>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
{*
|
||||
* 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$
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{if isset($cms_breadcrumb)}
|
||||
<div class="cat_bar">
|
||||
<span style="color: #3C8534;">{l s='Current category'} :</span> {$cms_breadcrumb}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{$content}
|
||||
@@ -78,9 +78,10 @@
|
||||
{if isset($input.lang)}
|
||||
<div class="translatable">
|
||||
{foreach $languages as $language}
|
||||
<div class="lang_{$language.id_lang}" id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
|
||||
<div class="lang_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
|
||||
<input type="text"
|
||||
name="{$input.name}_{$language.id_lang}"
|
||||
id="{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}"
|
||||
value="{$fields_value[$input.name][$language.id_lang]}"
|
||||
{if isset($input.size)}size="{$input.size}"{/if}
|
||||
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
|
||||
|
||||
Reference in New Issue
Block a user