';
- }
-
- 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.').' '.$this->table.' '.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.').' '.$this->table.' '.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.').' '.$this->table.' '.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.').' '.$this->table.' '.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 '
-
- ';
- }
-}
diff --git a/admin-dev/themes/default/admin.css b/admin-dev/themes/default/admin.css
index b434063a8..f9bf18b9a 100644
--- a/admin-dev/themes/default/admin.css
+++ b/admin-dev/themes/default/admin.css
@@ -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;}
diff --git a/admin-dev/themes/template/cms/form.tpl b/admin-dev/themes/template/cms/form.tpl
new file mode 100644
index 000000000..e2f0a5d60
--- /dev/null
+++ b/admin-dev/themes/template/cms/form.tpl
@@ -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
+* @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('');
+ $('#{$table}_form').submit();
+ });
+ }
+ }
+ $('#active_on').bind('click', function(){
+ toggleDraftWarning(true);
+ });
+ $('#active_off').bind('click', function(){
+ toggleDraftWarning(false);
+ });
+ });
+{/block}
+
+{block name="leadin"}
+
+
+
+ {l s='Your CMS page will be saved as a draft'}
+
+
+
+
+{/block}
+
+{block name="start_field_block"}
+
+ {if $input.type == 'select_category'}
+
+ {/if}
+{/block}
+
diff --git a/admin-dev/themes/template/cms_categories/form.tpl b/admin-dev/themes/template/cms_categories/form.tpl
new file mode 100644
index 000000000..e162197cb
--- /dev/null
+++ b/admin-dev/themes/template/cms_categories/form.tpl
@@ -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
+* @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"}
+
+ {if $input.type == 'select_category'}
+
+ {/if}
+{/block}
+
diff --git a/admin-dev/themes/template/cms_content/content.tpl b/admin-dev/themes/template/cms_content/content.tpl
new file mode 100644
index 000000000..acc115010
--- /dev/null
+++ b/admin-dev/themes/template/cms_content/content.tpl
@@ -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
+* @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)}
+
language->id;
-
+
//recursivity for subcategories
$children = array();
if (($maxDepth == 0 OR $currentDepth < $maxDepth) AND $subcats = $this->getSubCategories($id_lang, true) AND sizeof($subcats))
@@ -229,8 +229,8 @@ class CMSCategoryCore extends ObjectModel
$html .= self::recurseCMSCategory($categories, $categories[$id_cms_category][$key], $key, $id_selected, $is_html);
return $html;
}
-
-
+
+
/**
* Recursively add specified CMSCategory childs to $toDelete array
@@ -257,7 +257,7 @@ class CMSCategoryCore extends ObjectModel
public function delete()
{
if ($this->id == 1) return false;
-
+
$this->clearCache();
/* Get childs categories */
@@ -271,7 +271,7 @@ class CMSCategoryCore extends ObjectModel
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'cms_category_lang` WHERE `id_cms_category` IN ('.$list.')');
self::cleanPositions($this->id_parent);
-
+
/* Delete pages which are in categories to delete */
$result = Db::getInstance()->executeS('
SELECT `id_cms`
@@ -285,7 +285,7 @@ class CMSCategoryCore extends ObjectModel
}
return true;
}
-
+
/**
* Delete several categories from database
*
@@ -530,9 +530,9 @@ class CMSCategoryCore extends ObjectModel
return Db::getInstance()->getRow('
SELECT c.*, cl.*
FROM `'._DB_PREFIX_.'cms_category` c
- LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (c.`id_cms_category` = cl.`id_cms_category` AND `id_lang` = '.(int)($id_lang).')
- WHERE `name` LIKE \''.pSQL($CMSCategory_name).'\'
- AND c.`id_cms_category` != 1
+ LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (c.`id_cms_category` = cl.`id_cms_category` AND `id_lang` = '.(int)($id_lang).')
+ WHERE `name` LIKE \''.pSQL($CMSCategory_name).'\'
+ AND c.`id_cms_category` != 1
AND c.`id_parent` = '.(int)($id_parent_CMSCategory));
}
@@ -565,20 +565,20 @@ class CMSCategoryCore extends ObjectModel
$idCurrent = $result[0]['id_parent'];
}
}
-
+
public function updatePosition($way, $position)
- {
+ {
if (!$res = Db::getInstance()->executeS('
- SELECT cp.`id_cms_category`, cp.`position`, cp.`id_parent`
+ SELECT cp.`id_cms_category`, cp.`position`, cp.`id_parent`
FROM `'._DB_PREFIX_.'cms_category` cp
- WHERE cp.`id_parent` = '.(int)$this->id_parent.'
+ WHERE cp.`id_parent` = '.(int)$this->id_parent.'
ORDER BY cp.`position` ASC'
))
return false;
foreach ($res AS $category)
if ((int)($category['id_cms_category']) == (int)($this->id))
$movedCategory = $category;
-
+
if (!isset($movedCategory) || !isset($position))
return false;
// < and > statements rather than BETWEEN operator
@@ -586,8 +586,8 @@ class CMSCategoryCore extends ObjectModel
return (Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'cms_category`
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
- WHERE `position`
- '.($way
+ WHERE `position`
+ '.($way
? '> '.(int)($movedCategory['position']).' AND `position` <= '.(int)($position)
: '< '.(int)($movedCategory['position']).' AND `position` >= '.(int)($position)).'
AND `id_parent`='.(int)($movedCategory['id_parent']))
@@ -597,7 +597,7 @@ class CMSCategoryCore extends ObjectModel
WHERE `id_parent` = '.(int)($movedCategory['id_parent']).'
AND `id_cms_category`='.(int)($movedCategory['id_cms_category'])));
}
-
+
public static function cleanPositions($id_category_parent)
{
$result = Db::getInstance()->executeS('
@@ -616,7 +616,7 @@ class CMSCategoryCore extends ObjectModel
}
return true;
}
-
+
public static function getLastPosition($id_category_parent)
{
return (Db::getInstance()->getValue('SELECT MAX(position)+1 FROM `'._DB_PREFIX_.'cms_category` WHERE `id_parent` = '.(int)($id_category_parent)));
diff --git a/cms.php b/cms.php
index 1d469e923..889987af6 100644
--- a/cms.php
+++ b/cms.php
@@ -1,6 +1,6 @@
+* @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
+*/
+
+class AdminCMSCategoriesControllerCore extends AdminController
+{
+ /** @var object CMSCategory() instance for navigation*/
+ private $_CMSCategory;
+
+ public function __construct()
+ {
+ $this->table = 'cms_category';
+ $this->className = 'CMSCategory';
+ $this->lang = true;
+ $this->addRowAction('view');
+ $this->addRowAction('edit');
+ $this->addRowAction('delete');
+ $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
+
+ $this->fieldsDisplay = array(
+ 'id_cms_category' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 30),
+ 'name' => array('title' => $this->l('Name'), 'width' => 'auto', 'callback' => 'hideCMSCategoryPosition', 'callback_object' => 'CMSCategory'),
+ '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'), 'width' => 25, 'active' => 'status', 'align' => 'center', 'type' => 'bool', 'orderby' => false));
+
+ $this->_CMSCategory = AdminCMSContentController::getCurrentCMSCategory();
+ $this->_filter = 'AND `id_parent` = '.(int)($this->_CMSCategory->id);
+ $this->_select = 'position ';
+
+ parent::__construct();
+ }
+
+ public function initList()
+ {
+ $this->initToolbar();
+ return parent::initList();
+ }
+
+ /**
+ * Modifying initial getList method to display position feature (drag and drop)
+ */
+ public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
+ {
+ if ($order_by && $this->context->cookie->__get($this->table.'Orderby'))
+ $order_by = $this->context->cookie->__get($this->table.'Orderby');
+ else
+ $order_by = 'position';
+
+ parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
+ }
+
+ public function postProcess($token = NULL)
+ {
+ $this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id);
+ if (Tools::isSubmit('submitAdd'.$this->table))
+ {
+ $this->action = 'save';
+ 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.').' '.$this->table.' '.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.').' '.$this->table.' '.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.').' '.$this->table.' '.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.').' '.$this->table.' '.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 initForm()
+ {
+ $this->display = 'edit';
+ $this->initToolbar();
+ if (!$this->loadObject(true))
+ return;
+
+ $categories = CMSCategory::getCategories($this->context->language->id, false);
+ $html_categories = CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($this->object, 'id_parent'), 1);
+
+ $this->fields_form = array(
+ 'legend' => array(
+ 'title' => $this->l('CMS Category'),
+ 'image' => '../img/admin/tab-categories.gif'
+ ),
+ 'input' => array(
+ array(
+ 'type' => 'text',
+ 'label' => $this->l('Name:'),
+ 'name' => 'name',
+ 'required' => true,
+ 'lang' => true,
+ 'class' => 'copy2friendlyUrl',
+ 'hint' => $this->l('Invalid characters:').' <>;=#{}'
+ ),
+ array(
+ 'type' => 'radio',
+ 'label' => $this->l('Displayed:'),
+ 'name' => 'active',
+ 'required' => false,
+ 'class' => 't',
+ 'is_bool' => true,
+ 'values' => array(
+ array(
+ 'id' => 'active_on',
+ 'value' => 1,
+ 'label' => $this->l('Enabled')
+ ),
+ array(
+ 'id' => 'active_off',
+ 'value' => 0,
+ 'label' => $this->l('Disabled')
+ )
+ ),
+ ),
+ // custom template
+ array(
+ 'type' => 'select_category',
+ 'label' => $this->l('Parent CMS Category:'),
+ 'name' => 'id_parent',
+ 'options' => array(
+ 'html' => $html_categories,
+ ),
+ ),
+ array(
+ 'type' => 'textarea',
+ 'label' => $this->l('Name:'),
+ 'name' => 'description',
+ 'lang' => true,
+ 'rows' => 5,
+ 'cols' => 40,
+ 'hint' => $this->l('Invalid characters:').' <>;=#{}'
+ ),
+ array(
+ 'type' => 'text',
+ 'label' => $this->l('Meta title:'),
+ 'name' => 'meta_title',
+ 'lang' => true,
+ 'hint' => $this->l('Invalid characters:').' <>;=#{}'
+ ),
+ array(
+ 'type' => 'text',
+ 'label' => $this->l('Meta description:'),
+ 'name' => 'meta_description',
+ 'lang' => true,
+ 'hint' => $this->l('Invalid characters:').' <>;=#{}'
+ ),
+ array(
+ 'type' => 'text',
+ 'label' => $this->l('Meta keywords:'),
+ 'name' => 'meta_keywords',
+ 'lang' => true,
+ 'hint' => $this->l('Invalid characters:').' <>;=#{}'
+ ),
+ array(
+ 'type' => 'text',
+ 'label' => $this->l('Friendly URL:'),
+ 'name' => 'link_rewrite',
+ 'required' => true,
+ 'lang' => true,
+ 'hint' => $this->l('Only letters and the minus (-) character are allowed')
+ ),
+ ),
+ 'submit' => array(
+ 'title' => $this->l(' Save '),
+ 'class' => 'button'
+ )
+ );
+
+ return parent::initForm();
+ }
+}
diff --git a/admin-dev/tabs/AdminCMSContent.php b/controllers/admin/AdminCMSContentController.php
similarity index 53%
rename from admin-dev/tabs/AdminCMSContent.php
rename to controllers/admin/AdminCMSContentController.php
index 4d65a6b2b..215137c7d 100644
--- a/admin-dev/tabs/AdminCMSContent.php
+++ b/controllers/admin/AdminCMSContentController.php
@@ -1,6 +1,6 @@
* @copyright 2007-2011 PrestaShop SA
-* @version Release: $Revision: 6844 $
+* @version Release: $Revision$
* @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
+class AdminCMSContentControllerCore extends AdminController
{
/** @var object adminCMSCategories() instance */
private $adminCMSCategories;
@@ -49,8 +45,8 @@ class AdminCMSContent extends AdminTab
die('Category cannot be loaded');
$this->table = array('cms_category', 'cms');
- $this->adminCMSCategories = new adminCMSCategories();
- $this->adminCMS = new adminCMS();
+ $this->adminCMSCategories = new AdminCMSCategoriesController();
+ $this->adminCMS = new AdminCMSController();
parent::__construct();
}
@@ -73,14 +69,6 @@ class AdminCMSContent extends AdminTab
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()
{
@@ -89,39 +77,72 @@ class AdminCMSContent extends AdminTab
$this->adminCMSCategories->displayErrors();
}
- public function display()
+ public function initContent()
{
- 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 '
'.$this->l('Back to list').' ';
-
- }
- 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 '