added new function selectGenerator to simplify the drop down menus in html forms

parent 496e7dd3
......@@ -697,6 +697,30 @@ function selectEntry($name, $defValue, $currentValue = '', $attr = 'selected')
return '';
}
}
/**
*
* @param string $name
* @param array $values
* @param array $lang
* @param string|integer $current_value
* @param string $selected
* @return array
*/
function selectGenerator($name, array $values, array $lang, $current_value = '', $selected = 'selected') {
$array = array();
if (count($values) == count($lang)) {
$c_array = count($values);
for ($i = 0; $i < $c_array; ++$i) {
$array[] = array(
'value' => $values[$i],
'id' => ($selected == 'checked' ? $name . '-' . $values[$i] : ''),
$selected => selectEntry($name, $values[$i], $current_value, $selected),
'lang' => $lang[$i]
);
}
}
return $array;
}
/**
* Kürzt einen String, welcher im UTF-8-Charset vorliegt
* auf eine bestimmte Länge
......
......@@ -86,23 +86,14 @@ if (isset($_POST['submit']) === true) {
}
if (isset($_POST['submit']) === false || isset($errors) === true && is_array($errors) === true) {
if ($access_to_menus === true) {
$options = array();
$options[0]['name'] = 'create';
$options[0]['checked'] = selectEntry('create', '1', '0', 'checked');
$options[0]['lang'] = ACP3_CMS::$lang->t('articles', 'create_menu_item');
ACP3_CMS::$view->assign('options', $options);
$lang_options = array(ACP3_CMS::$lang->t('articles', 'create_menu_item'));
ACP3_CMS::$view->assign('options', selectGenerator('create', array(1), $lang_options, 0, 'checked'));
// Block
ACP3_CMS::$view->assign('blocks', menusDropdown());
$display = array();
$display[0]['value'] = 1;
$display[0]['selected'] = selectEntry('display', 1, 1, 'checked');
$display[0]['lang'] = ACP3_CMS::$lang->t('system', 'yes');
$display[1]['value'] = 0;
$display[1]['selected'] = selectEntry('display', '0', '', 'checked');
$display[1]['lang'] = ACP3_CMS::$lang->t('system', 'no');
ACP3_CMS::$view->assign('display', $display);
$lang_display = array(ACP3_CMS::$lang->t('system', 'yes'), ACP3_CMS::$lang->t('system', 'no'));
ACP3_CMS::$view->assign('display', selectGenerator('display', array(1, 0), $lang_display, 1, 'checked'));
ACP3_CMS::$view->assign('pages_list', menuItemsList());
}
......
......@@ -24,11 +24,11 @@
</div>
{if isset($options)}
<div class="control-group">
<label for="{$options.0.name}" class="control-label">{lang t="system|options"}</label>
<label for="{$options.0.id}" class="control-label">{lang t="system|options"}</label>
<div class="controls">
{foreach $options as $row}
<label for="{$row.name}" class="checkbox">
<input type="checkbox" name="{$row.name}" id="{$row.name}" value="1"{$row.checked}>
<label for="{$row.id}" class="checkbox">
<input type="checkbox" name="create" id="{$row.id}" value="1"{$row.checked}>
{$row.lang}
</label>
{/foreach}
......@@ -61,12 +61,12 @@
</div>
</div>
<div class="control-group">
<label for="display-1" class="control-label">{lang t="menus|display_item"}</label>
<label for="{$display.0.id}" class="control-label">{lang t="menus|display_item"}</label>
<div class="controls">
<div class="btn-group" data-toggle="radio">
{foreach $display as $row}
<input type="radio" name="display" id="display-{$row.value}" value="{$row.value}"{$row.selected}>
<label for="display-{$row.value}" class="btn">{$row.lang}</label>
<input type="radio" name="display" id="{$row.id}" value="{$row.value}"{$row.checked}>
<label for="{$row.id}" class="btn">{$row.lang}</label>
{/foreach}
</div>
</div>
......
......@@ -41,14 +41,8 @@ if (isset($_POST['submit']) === false || isset($errors) === true && is_array($er
// Emoticons erlauben
if ($emoticons_active === true) {
$allow_emoticons = array();
$allow_emoticons[0]['value'] = '1';
$allow_emoticons[0]['checked'] = selectEntry('emoticons', '1', $settings['emoticons'], 'checked');
$allow_emoticons[0]['lang'] = ACP3_CMS::$lang->t('system', 'yes');
$allow_emoticons[1]['value'] = '0';
$allow_emoticons[1]['checked'] = selectEntry('emoticons', '0', $settings['emoticons'], 'checked');
$allow_emoticons[1]['lang'] = ACP3_CMS::$lang->t('system', 'no');
ACP3_CMS::$view->assign('allow_emoticons', $allow_emoticons);
$lang_allow_emoticons = array(ACP3_CMS::$lang->t('system', 'yes'), ACP3_CMS::$lang->t('system', 'no'));
ACP3_CMS::$view->assign('allow_emoticons', selectGenerator('emoticons', array(1, 0), $lang_allow_emoticons, $settings['emoticons'], 'checked'));
}
ACP3_CMS::$session->generateFormToken();
......
......@@ -14,12 +14,12 @@
</div>
{if isset($allow_emoticons)}
<div class="control-group">
<label for="emoticons-1" class="control-label">{lang t="comments|allow_emoticons"}</label>
<label for="{$allow_emoticons.0.id}" class="control-label">{lang t="comments|allow_emoticons"}</label>
<div class="controls">
<div class="btn-group" data-toggle="radio">
{foreach $allow_emoticons as $row}
<input type="radio" name="emoticons" id="emoticons-{$row.value}" value="{$row.value}"{$row.checked}>
<label for="emoticons-{$row.value}" class="btn">{$row.lang}</label>
<input type="radio" name="emoticons" id="{$row.id}" value="{$row.value}"{$row.checked}>
<label for="{$row.id}" class="btn">{$row.lang}</label>
{/foreach}
</div>
</div>
......
......@@ -36,14 +36,12 @@ if (isset($_POST['submit']) === false || isset($errors) === true && is_array($er
$settings = ACP3_Config::getSettings('feeds');
$feed_types = array();
$feed_types[0]['value'] = 'RSS 1.0';
$feed_types[0]['selected'] = selectEntry('feed_type', $feed_types[0]['value'], $settings['feed_type']);
$feed_types[1]['value'] = 'RSS 2.0';
$feed_types[1]['selected'] = selectEntry('feed_type', $feed_types[1]['value'], $settings['feed_type']);
$feed_types[2]['value'] = 'ATOM';
$feed_types[2]['selected'] = selectEntry('feed_type', $feed_types[2]['value'], $settings['feed_type']);
ACP3_CMS::$view->assign('feed_types', $feed_types);
$feed_type = array(
'RSS 1.0',
'RSS 2.0',
'ATOM'
);
ACP3_CMS::$view->assign('feed_types', selectGenerator('feed_type', $feed_type, $feed_type, $settings['feed_type']));
ACP3_CMS::$view->assign('form', isset($_POST['submit']) ? $_POST : $settings);
......
......@@ -14,7 +14,7 @@
<div class="controls">
<select name="feed_type" id="feed-type">
{foreach $feed_types as $row}
<option value="{$row.value}"{$row.selected}>{$row.value}</option>
<option value="{$row.value}"{$row.selected}>{$row.lang}</option>
{/foreach}
</select>
</div>
......
......@@ -83,18 +83,8 @@ if (isset($_POST['submit']) === false || isset($errors) === true && is_array($er
// Datumsauswahl
ACP3_CMS::$view->assign('publication_period', ACP3_CMS::$date->datepicker(array('start', 'end')));
$units = array();
$units[0]['value'] = 'Byte';
$units[0]['selected'] = selectEntry('unit', 'Byte');
$units[1]['value'] = 'KiB';
$units[1]['selected'] = selectEntry('unit', 'KiB');
$units[2]['value'] = 'MiB';
$units[2]['selected'] = selectEntry('unit', 'MiB');
$units[3]['value'] = 'GiB';
$units[3]['selected'] = selectEntry('unit', 'GiB');
$units[4]['value'] = 'TiB';
$units[4]['selected'] = selectEntry('unit', 'TiB');
ACP3_CMS::$view->assign('units', $units);
$units = array('Byte', 'KiB', 'MiB', 'GiB', 'TiB');
ACP3_CMS::$view->assign('units', selectGenerator('units', $units, $units, ''));
// Formularelemente
ACP3_CMS::$view->assign('categories', categoriesList('files', '', true));
......
......@@ -102,20 +102,8 @@ if (ACP3_Validate::isNumber(ACP3_CMS::$uri->id) === true &&
// Datumsauswahl
ACP3_CMS::$view->assign('publication_period', ACP3_CMS::$date->datepicker(array('start', 'end'), array($dl['start'], $dl['end'])));
$unit = trim(strrchr($dl['size'], ' '));
$units = array();
$units[0]['value'] = 'Byte';
$units[0]['selected'] = selectEntry('unit', 'Byte', $unit);
$units[1]['value'] = 'KiB';
$units[1]['selected'] = selectEntry('unit', 'KiB', $unit);
$units[2]['value'] = 'MiB';
$units[2]['selected'] = selectEntry('unit', 'MiB', $unit);
$units[3]['value'] = 'GiB';
$units[3]['selected'] = selectEntry('unit', 'GiB', $unit);
$units[4]['value'] = 'TiB';
$units[4]['selected'] = selectEntry('unit', 'TiB', $unit);
ACP3_CMS::$view->assign('units', $units);
$units = array('Byte', 'KiB', 'MiB', 'GiB', 'TiB');
ACP3_CMS::$view->assign('units', selectGenerator('units', $units, $units, trim(strrchr($dl['size'], ' '))));
$dl['filesize'] = substr($dl['size'], 0, strpos($dl['size'], ' '));
......
......@@ -41,14 +41,8 @@ if (isset($_POST['submit']) === false || isset($errors) === true && is_array($er
$settings = ACP3_Config::getSettings('files');
if ($comments_active === true) {
$comments = array();
$comments[0]['value'] = '1';
$comments[0]['checked'] = selectEntry('comments', '1', $settings['comments'], 'checked');
$comments[0]['lang'] = ACP3_CMS::$lang->t('system', 'yes');
$comments[1]['value'] = '0';
$comments[1]['checked'] = selectEntry('comments', '0', $settings['comments'], 'checked');
$comments[1]['lang'] = ACP3_CMS::$lang->t('system', 'no');
ACP3_CMS::$view->assign('comments', $comments);
$lang_comments = array(ACP3_CMS::$lang->t('system', 'yes'), ACP3_CMS::$lang->t('system', 'no'));
ACP3_CMS::$view->assign('comments', selectGenerator('comments', array(1, 0), $lang_comments, $settings['comments'], 'checked'));
}
ACP3_CMS::$view->assign('dateformat', ACP3_CMS::$date->dateformatDropdown($settings['dateformat']));
......
......@@ -24,12 +24,12 @@
</div>
{if isset($comments)}
<div class="control-group">
<label for="comments-1" class="control-label">{lang t="system|allow_comments"}</label>
<label for="{$comments.0.id}" class="control-label">{lang t="system|allow_comments"}</label>
<div class="controls">
<div class="btn-group" data-toggle="radio">
{foreach $comments as $row}
<input type="radio" name="comments" id="comments-{$row.value}" value="{$row.value}"{$row.checked}>
<label for="comments-{$row.value}" class="btn">{$row.lang}</label>
<input type="radio" name="comments" id="{$row.id}" value="{$row.value}"{$row.checked}>
<label for="{$row.id}" class="btn">{$row.lang}</label>
{/foreach}
</div>
</div>
......
......@@ -65,24 +65,12 @@ if (isset($_POST['submit']) === true) {
}
if (isset($_POST['submit']) === false || isset($errors) === true && is_array($errors) === true) {
if ($comments_active === true) {
$comments = array();
$comments[0]['value'] = '1';
$comments[0]['checked'] = selectEntry('comments', '1', $settings['comments'], 'checked');
$comments[0]['lang'] = ACP3_CMS::$lang->t('system', 'yes');
$comments[1]['value'] = '0';
$comments[1]['checked'] = selectEntry('comments', '0', $settings['comments'], 'checked');
$comments[1]['lang'] = ACP3_CMS::$lang->t('system', 'no');
ACP3_CMS::$view->assign('comments', $comments);
$lang_comments = array(ACP3_CMS::$lang->t('system', 'yes'), ACP3_CMS::$lang->t('system', 'no'));
ACP3_CMS::$view->assign('comments', selectGenerator('comments', array(1, 0), $lang_comments, $settings['comments'], 'checked'));
}
$overlay = array();
$overlay[0]['value'] = '1';
$overlay[0]['checked'] = selectEntry('overlay', '1', $settings['overlay'], 'checked');
$overlay[0]['lang'] = ACP3_CMS::$lang->t('system', 'yes');
$overlay[1]['value'] = '0';
$overlay[1]['checked'] = selectEntry('overlay', '0', $settings['overlay'], 'checked');
$overlay[1]['lang'] = ACP3_CMS::$lang->t('system', 'no');
ACP3_CMS::$view->assign('overlay', $overlay);
$lang_overlay = array(ACP3_CMS::$lang->t('system', 'yes'), ACP3_CMS::$lang->t('system', 'no'));
ACP3_CMS::$view->assign('overlay', selectGenerator('overlay', array(1, 0), $lang_overlay, $settings['overlay'], 'checked'));
ACP3_CMS::$view->assign('dateformat', ACP3_CMS::$date->dateformatDropdown($settings['dateformat']));
......
......@@ -42,12 +42,12 @@ $(document).ready(function() {
</div>
</div>
<div class="control-group">
<label for="overlay-1" class="control-label">{lang t="gallery|use_overlay"}</label>
<label for="{$overlay.0.id}" class="control-label">{lang t="gallery|use_overlay"}</label>
<div class="controls">
<div class="btn-group" data-toggle="radio">
{foreach $overlay as $row}
<input type="radio" name="overlay" id="overlay-{$row.value}" value="{$row.value}"{$row.checked}>
<label for="overlay-{$row.value}" class="btn">{$row.lang}</label>
<input type="radio" name="overlay" id="{$row.id}" value="{$row.value}"{$row.checked}>
<label for="{$row.id}" class="btn">{$row.lang}</label>
{/foreach}
</div>
<p class="help-block">{lang t="gallery|use_overlay_description"}</p>
......@@ -55,12 +55,12 @@ $(document).ready(function() {
</div>
{if isset($comments)}
<div id="comments-container" class="control-group">
<label for="comments-1" class="control-label">{lang t="system|allow_comments"}</label>
<label for="{$comments.0.id}" class="control-label">{lang t="system|allow_comments"}</label>
<div class="controls">
<div class="btn-group" data-toggle="radio">
{foreach $comments as $row}
<input type="radio" name="comments" id="comments-{$row.value}" value="{$row.value}"{$row.checked}>
<label for="comments-{$row.value}" class="btn">{$row.lang}</label>
<input type="radio" name="comments" id="{$row.id}" value="{$row.value}"{$row.checked}>
<label for="{$row.id}" class="btn">{$row.lang}</label>
{/foreach}
</div>
</div>
......
......@@ -52,49 +52,26 @@ if (isset($_POST['submit']) === false || isset($errors) === true && is_array($er
ACP3_CMS::$view->assign('dateformat', ACP3_CMS::$date->dateformatDropdown($settings['dateformat']));
$notify = array();
$notify[0]['value'] = '0';
$notify[0]['selected'] = selectEntry('notify', '0', $settings['notify']);
$notify[0]['lang'] = ACP3_CMS::$lang->t('guestbook', 'no_notification');
$notify[1]['value'] = '1';
$notify[1]['selected'] = selectEntry('notify', '1', $settings['notify']);
$notify[1]['lang'] = ACP3_CMS::$lang->t('guestbook', 'notify_on_new_entry');
$notify[2]['value'] = '2';
$notify[2]['selected'] = selectEntry('notify', '2', $settings['notify']);
$notify[2]['lang'] = ACP3_CMS::$lang->t('guestbook', 'notify_and_enable');
ACP3_CMS::$view->assign('notify', $notify);
$lang_notify = array(
ACP3_CMS::$lang->t('guestbook', 'no_notification'),
ACP3_CMS::$lang->t('guestbook', 'notify_on_new_entry'),
ACP3_CMS::$lang->t('guestbook', 'notify_and_enable')
);
ACP3_CMS::$view->assign('notify', selectGenerator('notify', array(0, 1, 2), $lang_notify, $settings['notify']));
$overlay = array();
$overlay[0]['value'] = '1';
$overlay[0]['checked'] = selectEntry('overlay', '1', $settings['overlay'], 'checked');
$overlay[0]['lang'] = ACP3_CMS::$lang->t('system', 'yes');
$overlay[1]['value'] = '0';
$overlay[1]['checked'] = selectEntry('overlay', '0', $settings['overlay'], 'checked');
$overlay[1]['lang'] = ACP3_CMS::$lang->t('system', 'no');
ACP3_CMS::$view->assign('overlay', $overlay);
$lang_overlay = array(ACP3_CMS::$lang->t('system', 'yes'), ACP3_CMS::$lang->t('system', 'no'));
ACP3_CMS::$view->assign('overlay', selectGenerator('overlay', array(1, 0), $lang_overlay, $settings['overlay'], 'checked'));
// Emoticons erlauben
if ($emoticons_active === true) {
$allow_emoticons = array();
$allow_emoticons[0]['value'] = '1';
$allow_emoticons[0]['checked'] = selectEntry('emoticons', '1', $settings['emoticons'], 'checked');
$allow_emoticons[0]['lang'] = ACP3_CMS::$lang->t('system', 'yes');
$allow_emoticons[1]['value'] = '0';
$allow_emoticons[1]['checked'] = selectEntry('emoticons', '0', $settings['emoticons'], 'checked');
$allow_emoticons[1]['lang'] = ACP3_CMS::$lang->t('system', 'no');
ACP3_CMS::$view->assign('allow_emoticons', $allow_emoticons);
$lang_allow_emoticons = array(ACP3_CMS::$lang->t('system', 'yes'), ACP3_CMS::$lang->t('system', 'no'));
ACP3_CMS::$view->assign('allow_emoticons', selectGenerator('emoticons', array(1, 0), $lang_allow_emoticons, $settings['emoticons'], 'checked'));
}
// In Newsletter integrieren
if ($newsletter_active === true) {
$newsletter_integration = array();
$newsletter_integration[0]['value'] = '1';
$newsletter_integration[0]['checked'] = selectEntry('newsletter_integration', '1', $settings['newsletter_integration'], 'checked');
$newsletter_integration[0]['lang'] = ACP3_CMS::$lang->t('system', 'yes');
$newsletter_integration[1]['value'] = '0';
$newsletter_integration[1]['checked'] = selectEntry('newsletter_integration', '0', $settings['newsletter_integration'], 'checked');
$newsletter_integration[1]['lang'] = ACP3_CMS::$lang->t('system', 'no');
ACP3_CMS::$view->assign('newsletter_integration', $newsletter_integration);
$lang_newsletter_integration = array(ACP3_CMS::$lang->t('system', 'yes'), ACP3_CMS::$lang->t('system', 'no'));
ACP3_CMS::$view->assign('newsletter_integration', selectGenerator('newsletter_integration', array(1, 0), $lang_newsletter_integration, $settings['newsletter_integration'], 'checked'));
}
ACP3_CMS::$view->assign('form', isset($_POST['submit']) ? $_POST : array('notify_email' => $settings['notify_email']));
......
......@@ -39,24 +39,24 @@ $(document).ready(function() {
<div class="controls"><input type="text" name="notify_email" id="notify-email" value="{$form.notify_email}"></div>
</div>
<div class="control-group">
<label for="overlay-1" class="control-label">{lang t="guestbook|use_overlay"}</label>
<label for="{$overlay.0.id}" class="control-label">{lang t="guestbook|use_overlay"}</label>
<div class="controls">
<div class="btn-group" data-toggle="radio">
{foreach $overlay as $row}
<input type="radio" name="overlay" id="overlay-{$row.value}" value="{$row.value}"{$row.checked}>
<label for="overlay-{$row.value}" class="btn">{$row.lang}</label>
<input type="radio" name="overlay" id="{$row.id}" value="{$row.value}"{$row.checked}>
<label for="{$row.id}" class="btn">{$row.lang}</label>
{/foreach}
</div>
</div>
</div>
{if isset($allow_emoticons)}
<div class="control-group">
<label for="emoticons-1" class="control-label">{lang t="guestbook|allow_emoticons"}</label>
<label for="{$allow_emoticons.0.id}" class="control-label">{lang t="guestbook|allow_emoticons"}</label>
<div class="controls">
<div class="btn-group" data-toggle="radio">
{foreach $allow_emoticons as $row}
<input type="radio" name="emoticons" id="emoticons-{$row.value}" value="{$row.value}"{$row.checked}>
<label for="emoticons-{$row.value}" class="btn">{$row.lang}</label>
<input type="radio" name="emoticons" id="{$row.id}" value="{$row.value}"{$row.checked}>
<label for="{$row.id}" class="btn">{$row.lang}</label>
{/foreach}
</div>
</div>
......@@ -64,12 +64,12 @@ $(document).ready(function() {
{/if}
{if isset($newsletter_integration)}
<div class="control-group">
<label for="newsletter-integration-1" class="control-label">{lang t="guestbook|newsletter_integration"}</label>
<label for="{$newsletter_integration.0.id}" class="control-label">{lang t="guestbook|newsletter_integration"}</label>
<div class="controls">
<div class="btn-group" data-toggle="radio">
{foreach $newsletter_integration as $row}
<input type="radio" name="newsletter_integration" id="newsletter-integration-{$row.value}" value="{$row.value}"{$row.checked}>
<label for="newsletter-integration-{$row.value}" class="btn">{$row.lang}</label>
<input type="radio" name="newsletter_integration" id="{$row.id}" value="{$row.value}"{$row.checked}>
<label for="{$row.id}" class="btn">{$row.lang}</label>
{/foreach}
</div>
</div>
......
......@@ -82,22 +82,17 @@ if (isset($_POST['submit']) === true) {
}
if (isset($_POST['submit']) === false || isset($errors) === true && is_array($errors) === true) {
// Seitentyp
$mode = array();
$mode[0]['value'] = 1;
$mode[0]['selected'] = selectEntry('mode', '1');
$mode[0]['lang'] = ACP3_CMS::$lang->t('menus', 'module');
$mode[1]['value'] = 2;
$mode[1]['selected'] = selectEntry('mode', '2');
$mode[1]['lang'] = ACP3_CMS::$lang->t('menus', 'dynamic_page');
$mode[2]['value'] = 3;
$mode[2]['selected'] = selectEntry('mode', '3');
$mode[2]['lang'] = ACP3_CMS::$lang->t('menus', 'hyperlink');
$values_mode = array(1, 2, 3);
$lang_mode = array(
ACP3_CMS::$lang->t('menus', 'module'),
ACP3_CMS::$lang->t('menus', 'dynamic_page'),
ACP3_CMS::$lang->t('menus', 'hyperlink')
);
if (ACP3_Modules::isActive('articles')) {
$mode[3]['value'] = 4;
$mode[3]['selected'] = selectEntry('mode', '4');
$mode[3]['lang'] = ACP3_CMS::$lang->t('menus', 'article');
$values_mode[] = 4;
$lang_mode[] = ACP3_CMS::$lang->t('menus', 'article');
}
ACP3_CMS::$view->assign('mode', $mode);
ACP3_CMS::$view->assign('mode', selectGenerator('mode', $values_mode, $lang_mode));
// Menus
ACP3_CMS::$view->assign('blocks', menusDropdown());
......@@ -110,23 +105,11 @@ if (isset($_POST['submit']) === false || isset($errors) === true && is_array($er
ACP3_CMS::$view->assign('modules', $modules);
// Ziel des Hyperlinks
$target = array();
$target[0]['value'] = 1;
$target[0]['selected'] = selectEntry('target', '1');
$target[0]['lang'] = ACP3_CMS::$lang->t('system', 'window_self');
$target[1]['value'] = 2;
$target[1]['selected'] = selectEntry('target', '2');
$target[1]['lang'] = ACP3_CMS::$lang->t('system', 'window_blank');
ACP3_CMS::$view->assign('target', $target);
$display = array();
$display[0]['value'] = 1;
$display[0]['selected'] = selectEntry('display', '1', '1', 'checked');
$display[0]['lang'] = ACP3_CMS::$lang->t('system', 'yes');
$display[1]['value'] = 0;
$display[1]['selected'] = selectEntry('display', '0', '', 'checked');
$display[1]['lang'] = ACP3_CMS::$lang->t('system', 'no');
ACP3_CMS::$view->assign('display', $display);
$lang_target = array(ACP3_CMS::$lang->t('system', 'window_self'), ACP3_CMS::$lang->t('system', 'window_blank'));
ACP3_CMS::$view->assign('target', selectGenerator('target', array(1, 2), $lang_target));
$lang_display = array(ACP3_CMS::$lang->t('system', 'yes'), ACP3_CMS::$lang->t('system', 'no'));
ACP3_CMS::$view->assign('display', selectGenerator('display', array(1, 0), $lang_display, 1, 'checked'));
if (ACP3_Modules::check('articles', 'functions') === true) {
require_once MODULES_DIR . 'articles/functions.php';
......
......@@ -86,22 +86,17 @@ if (ACP3_Validate::isNumber(ACP3_CMS::$uri->id) === true &&
}
if (isset($_POST['submit']) === false || isset($errors) === true && is_array($errors) === true) {
// Seitentyp
$mode = array();
$mode[0]['value'] = 1;
$mode[0]['selected'] = selectEntry('mode', '1', $page['mode']);
$mode[0]['lang'] = ACP3_CMS::$lang->t('menus', 'module');
$mode[1]['value'] = 2;
$mode[1]['selected'] = selectEntry('mode', '2', $page['mode']);
$mode[1]['lang'] = ACP3_CMS::$lang->t('menus', 'dynamic_page');
$mode[2]['value'] = 3;
$mode[2]['selected'] = selectEntry('mode', '3', $page['mode']);
$mode[2]['lang'] = ACP3_CMS::$lang->t('menus', 'hyperlink');
$values_mode = array(1, 2, 3);
$lang_mode = array(
ACP3_CMS::$lang->t('menus', 'module'),
ACP3_CMS::$lang->t('menus', 'dynamic_page'),
ACP3_CMS::$lang->t('menus', 'hyperlink')
);
if (ACP3_Modules::isActive('articles')) {
$mode[3]['value'] = 4;
$mode[3]['selected'] = selectEntry('mode', '4', $page['mode']);
$mode[3]['lang'] = ACP3_CMS::$lang->t('menus', 'article');
$values_mode[] = 4;
$lang_mode[] = ACP3_CMS::$lang->t('menus', 'article');
}
ACP3_CMS::$view->assign('mode', $mode);
ACP3_CMS::$view->assign('mode', selectGenerator('mode', $values_mode, $lang_mode, $page['mode']));
// Block
ACP3_CMS::$view->assign('blocks', menusDropdown($page['block_id']));
......@@ -114,23 +109,11 @@ if (ACP3_Validate::isNumber(ACP3_CMS::$uri->id) === true &&
ACP3_CMS::$view->assign('modules', $modules);
// Ziel des Hyperlinks
$target = array();
$target[0]['value'] = 1;
$target[0]['selected'] = selectEntry('target', '1', $page['target']);
$target[0]['lang'] = ACP3_CMS::$lang->t('system', 'window_self');
$target[1]['value'] = 2;
$target[1]['selected'] = selectEntry('target', '2', $page['target']);
$target[1]['lang'] = ACP3_CMS::$lang->t('system', 'window_blank');
ACP3_CMS::$view->assign('target', $target);
$display = array();
$display[0]['value'] = 1;
$display[0]['selected'] = selectEntry('display', '1', $page['display'], 'checked');
$display[0]['lang'] = ACP3_CMS::$lang->t('system', 'yes');
$display[1]['value'] = 0;
$display[1]['selected'] = selectEntry('display', '0', $page['display'], 'checked');
$display[1]['lang'] = ACP3_CMS::$lang->t('system', 'no');
ACP3_CMS::$view->assign('display', $display);
$lang_target = array(ACP3_CMS::$lang->t('system', 'window_self'), ACP3_CMS::$lang->t('system', 'window_blank'));
ACP3_CMS::$view->assign('target', selectGenerator('target', array(1, 2), $lang_target, $page['target']));
$lang_display = array(ACP3_CMS::$lang->t('system', 'yes'), ACP3_CMS::$lang->t('system', 'no'));
ACP3_CMS::$view->assign('display', selectGenerator('display', array(1, 0), $lang_display, $page['display'], 'checked'));
if (ACP3_Modules::check('articles', 'functions') === true) {
require_once MODULES_DIR . 'articles/functions.php';
......
......@@ -51,12 +51,12 @@
</div>
</div>
<div class="control-group">
<label for="display-1" class="control-label">{lang t="menus|display_item"}</label>
<label for="{$display.0.id}" class="control-label">{lang t="menus|display_item"}</label>
<div class="controls">
<div class="btn-group" data-toggle="radio">
{foreach $display as $row}
<input type="radio" name="display" id="display-{$row.value}" value="{$row.value}"{$row.selected}>
<label for="display-{$row.value}" class="btn">{$row.lang}</label>
<input type="radio" name="display" id="{$row.id}" value="{$row.value}"{$row.checked}>
<label for="{$row.id}" class="btn">{$row.lang}</label>
{/foreach}
</div>
</div>
......
......@@ -51,12 +51,12 @@
</div>
</div>
<div class="control-group">
<label for="display-1" class="control-label">{lang t="menus|display_item"}</label>
<label for="{$display.0.id}" class="control-label">{lang t="menus|display_item"}</label>
<div class="controls">
<div class="btn-group" data-toggle="radio">
{foreach $display as $row}
<input type="radio" name="display" id="display-{$row.value}" value="{$row.value}"{$row.selected}>
<label for="display-{$row.value}" class="btn">{$row.lang}</label>
<input type="radio" name="display" id="{$row.id}" value="{$row.value}"{$row.checked}>
<label for="{$row.id}" class="btn">{$row.lang}</label>
{/foreach}
</div>
</div>
......
......@@ -86,14 +86,8 @@ if (isset($_POST['submit']) === false || isset($errors) === true && is_array($er
}
// Linkziel
$target = array();
$target[0]['value'] = '1';
$target[0]['selected'] = selectEntry('target', '1');
$target[0]['lang'] = ACP3_CMS::$lang->t('system', 'window_self');
$target[1]['value'] = '2';
$target[1]['selected'] = selectEntry('target', '2');
$target[1]['lang'] = ACP3_CMS::$lang->t('system', 'window_blank');
ACP3_CMS::$view->assign('target', $target);
$lang_target = array(ACP3_CMS::$lang->t('system', 'window_self'), ACP3_CMS::$lang->t('system', 'window_blank'));
ACP3_CMS::$view->assign('target', selectGenerator('target', array(1, 2), $lang_target));
ACP3_CMS::$view->assign('SEO_FORM_FIELDS', ACP3_SEO::formFields());
......
......@@ -92,14 +92,8 @@ if (ACP3_Validate::isNumber(ACP3_CMS::$uri->id) === true &&
}
// Linkziel
$target = array();
$target[0]['value'] = '1';
$target[0]['selected'] = selectEntry('target', '1', $news['target']);
$target[0]['lang'] = ACP3_CMS::$lang->t('system', 'window_self');
$target[1]['value'] = '2';
$target[1]['selected'] = selectEntry('target', '2', $news['target']);
$target[1]['lang'] = ACP3_CMS::$lang->t('system', 'window_blank');
ACP3_CMS::$view->assign('target', $target);
$lang_target = array(ACP3_CMS::$lang->t('system', 'window_self'), ACP3_CMS::$lang->t('system', 'window_blank'));
ACP3_CMS::$view->assign('target', selectGenerator('target', array(1, 2), $lang_target, $news['target']));
ACP3_CMS::$view->assign('SEO_FORM_FIELDS', ACP3_SEO::formFields('news/details/id_' . ACP3_CMS::$uri->id));
......
......@@ -51,38 +51,20 @@ if (isset($_POST['submit']) === false || isset($errors) === true && is_array($er
ACP3_CMS::$view->assign('dateformat', ACP3_CMS::$date->dateformatDropdown($settings['dateformat']));
$readmore = array();
$readmore[0]['value'] = '1';
$readmore[0]['checked'] = selectEntry('readmore', '1', $settings['readmore'], 'checked');
$readmore[0]['lang'] = ACP3_CMS::$lang->t('system', 'yes');
$readmore[1]['value'] = '0';
$readmore[1]['checked'] = selectEntry('readmore', '0', $settings['readmore'], 'checked');
$readmore[1]['lang'] = ACP3_CMS::$lang->t('system', 'no');
ACP3_CMS::$view->assign('readmore', $readmore);
$lang_readmore = array(ACP3_CMS::$lang->t('system', 'yes'), ACP3_CMS::$lang->t('system', 'no'));
ACP3_CMS::$view->assign('readmore', selectGenerator('readmore', array(1, 0), $lang_readmore, $settings['readmore'], 'checked'));
ACP3_CMS::$view->assign('readmore_chars', isset($_POST['submit']) ? $_POST['readmore_chars'] : $settings['readmore_chars']);
if ($comments_active === true) {
$allow_comments = array();
$allow_comments[0]['value'] = '1';
$allow_comments[0]['checked'] = selectEntry('comments', '1', $settings['comments'], 'checked');
$allow_comments[0]['lang'] = ACP3_CMS::$lang->t('system', 'yes');
$allow_comments[1]['value'] = '0';
$allow_comments[1]['checked'] = selectEntry('comments', '0', $settings['comments'], 'checked');
$allow_comments[1]['lang'] = ACP3_CMS::$lang->t('system', 'no');
ACP3_CMS::$view->assign('allow_comments', $allow_comments);
$lang_allow_comments = array(ACP3_CMS::$lang->t('system', 'yes'), ACP3_CMS::$lang->t('system', 'no'));
ACP3_CMS::$view->assign('allow_comments', selectGenerator('comments', array(1, 0), $lang_allow_comments, $settings['comments'], 'checked'));
}
ACP3_CMS::$view->assign('sidebar_entries', recordsPerPage((int) $settings['sidebar'], 1, 10));
$category_in_breadcrumb = array();
$category_in_breadcrumb[0]['value'] = '1';
$category_in_breadcrumb[0]['checked'] = selectEntry('category_in_breadcrumb', '1', $settings['category_in_breadcrumb'], 'checked');
$category_in_breadcrumb[0]['lang'] = ACP3_CMS::$lang->t('system', 'yes');
$category_in_breadcrumb[1]['value'] = '0';
$category_in_breadcrumb[1]['checked'] = selectEntry('category_in_breadcrumb', '0', $settings['category_in_breadcrumb'], 'checked');
$category_in_breadcrumb[1]['lang'] = ACP3_CMS::$lang->t('system', 'no');
ACP3_CMS::$view->assign('category_in_breadcrumb', $category_in_breadcrumb);