diff --git a/admin-dev/themes/template/form.tpl b/admin-dev/themes/template/form.tpl index c40284455..ab8d9d74f 100644 --- a/admin-dev/themes/template/form.tpl +++ b/admin-dev/themes/template/form.tpl @@ -124,42 +124,48 @@ {if isset($input.hint)}{$input.hint} {/if} {/if} {elseif $input.type == 'select'} - + + {/foreach} + {else} + {foreach $input.options.query AS $option} + + {/foreach} + {/if} + {if isset($input.hint)}{$input.hint} {/if} + {/if} {elseif $input.type == 'radio'} {foreach $input.values as $value} 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_meta' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'page' => array('title' => $this->l('Page'), 'width' => 120), @@ -45,13 +47,14 @@ class AdminMeta extends AdminTab ); $this->_group = 'GROUP BY a.id_meta'; - $this->optionsList = array( + $this->options = array( 'general' => array( 'title' => $this->l('URLs Setup'), 'fields' => array( 'PS_REWRITING_SETTINGS' => array('title' => $this->l('Friendly URL'), 'desc' => $this->l('Enable only if your server allows URL rewriting (recommended)').'

'.$this->l('If you turn on this feature, you must').' '.$this->l('generate a .htaccess file').'

', 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CANONICAL_REDIRECT' => array('title' => $this->l('Automatically redirect to Canonical url'), 'desc' => $this->l('Recommended but your theme must be compliant'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), ), + 'submit' => array() ), 'routes' => array( 'title' => $this->l('Schema of URLs'), @@ -70,6 +73,7 @@ class AdminMeta extends AdminTab $this->addFieldRoute('cms_rule', $this->l('Route to CMS page')); $this->addFieldRoute('cms_category_rule', $this->l('Route to CMS category')); $this->addFieldRoute('module', $this->l('Route to modules')); + $this->options['routes']['submit'] = array(); } } @@ -79,7 +83,7 @@ class AdminMeta extends AdminTab foreach (Dispatcher::getInstance()->default_routes[$routeID]['keywords'] as $keyword => $data) $keywords[] = ((isset($data['param'])) ? ''.$keyword.'*' : $keyword); - $this->optionsList['routes']['fields']['PS_ROUTE_'.$routeID] = array( + $this->options['routes']['fields']['PS_ROUTE_'.$routeID] = array( 'title' => $title, 'desc' => sprintf($this->l('Keywords: %s'), implode(', ', $keywords)), 'validation' => 'isString', @@ -89,91 +93,84 @@ class AdminMeta extends AdminTab ); } - public function displayForm($isMainTab = true) + public function initForm() { - parent::displayForm(); + $files = Meta::getPages(true, ($this->object->page ? $this->object->page : false)); + $pages = array(); + foreach ($files as $file) + $pages[] = array('page' => $file); - if (!($meta = $this->loadObject(true))) - return; - $files = Meta::getPages(true, ($meta->page ? $meta->page : false)); - echo ' -
- '.($meta->id ? '' : '').' -
'.$this->l('Meta-Tags').' - -
'; - if (!sizeof($files)) - echo '

'.$this->l('There is no page available!').'

'; - else - { - echo ' - * -

'.$this->l('Name of the related page').'

'; - } - echo ' -
- -
'; - foreach ($this->_languages as $language) - echo ' -
- - '.$this->l('Invalid characters:').' <>;=#{}  -

'.$this->l('Title of this page').'

-
'; - $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'title¤description¤keywords¤url_rewrite', 'title'); - echo '
-
 
- -
'; - foreach ($this->_languages as $language) - echo ' -
- - '.$this->l('Invalid characters:').' <>;=#{}  -

'.$this->l('A short description').'

-
'; - $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'title¤description¤keywords¤url_rewrite', 'description'); - echo '
-
 
- -
'; - foreach ($this->_languages as $language) - echo ' -
- - '.$this->l('Invalid characters:').' <>;=#{}  -

'.$this->l('List of keywords').'

-
'; - $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'title¤description¤keywords¤url_rewrite', 'keywords'); - echo '
-
 
- -
'; - foreach ($this->_languages as $language) - echo ' -
- - '.$this->l('Invalid characters:').' <>;=#{}  -

'.$this->l('Example : "contacts" for http://mysite.com/shop/contacts to redirect to http://mysite.com/shop/contact-form.php').'

-
'; - $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'title¤description¤keywords¤url_rewrite', 'url_rewrite'); - echo '
-
 
-
- -
-
* '.$this->l('Required field').'
-
-
'; + $this->fields_form = array( + 'legend' => array( + 'title' => $this->l('Meta-Tags'), + 'image' => '../img/admin/metatags.gif' + ), + 'input' => array( + array( + 'type' => 'hidden', + 'name' => 'id_meta', + ), + array( + 'type' => 'select', + 'label' => $this->l('Page:'), + 'name' => 'page', + 'options' => array( + 'query' => $pages, + 'id' => 'page', + 'name' => 'page', + ), + 'p' => $this->l('Name of the related page'), + 'required' => true, + 'empty_message' => '

'.$this->l('There is no page available!').'

', + 'size' => 30 + ), + array( + 'type' => 'text', + 'label' => $this->l('Page\'s title:'), + 'name' => 'title', + 'lang' => true, + 'attributeLang' => 'title', + 'hint' => $this->l('Invalid characters:').' <>;=#{}', + 'p' => $this->l('Title of this page'), + 'size' => 30 + ), + array( + 'type' => 'text', + 'label' => $this->l('Meta description:'), + 'name' => 'description', + 'lang' => true, + 'attributeLang' => 'description', + 'hint' => $this->l('Invalid characters:').' <>;=#{}', + 'p' => $this->l('A short description'), + 'size' => 50 + ), + array( + 'type' => 'text', + 'label' => $this->l('Meta keywords:'), + 'name' => 'keywords', + 'lang' => true, + 'attributeLang' => 'keywords', + 'hint' => $this->l('Invalid characters:').' <>;=#{}', + 'p' => $this->l('List of keywords'), + 'size' => 50 + ), + array( + 'type' => 'text', + 'label' => $this->l('Rewritten URL:'), + 'name' => 'url_rewrite', + 'lang' => true, + 'attributeLang' => 'url_rewrite', + 'hint' => $this->l('Invalid characters:').' <>;=#{}', + 'p' => $this->l('Example : "contacts" for http://mysite.com/shop/contacts to redirect to http://mysite.com/shop/contact-form.php'), + 'size' => 50 + ), + ), + 'submit' => array( + 'title' => $this->l(' Save '), + 'class' => 'button' + ) + ); + return parent::initForm(); } public function postProcess()