}
 $id = 0;
 if (isset($_GET['id']) && is_numeric($_GET['id'])) {
     $id = (int) $_GET['id'];
 }
 if (isset($_POST['id']) && is_numeric($_POST['id'])) {
     $id = (int) $_POST['id'];
 }
 if ($id <= 0) {
     $editor = new editor('entry_type', $_SERVER['PHP_SELF'] . '?editor=1');
     $editor->setHeading(__('New entrytype'));
     $editor->setSubmitTxt(__('Add'));
 } else {
     $editor = new editor('entry_type', $_SERVER['PHP_SELF'] . '?editor=1', $id);
     $editor->setHeading(__('Change entrytype'));
     $editor->setSubmitTxt(__('Change'));
 }
 $editor->setDBFieldID('entry_type_id');
 $editor->showID(TRUE);
 $editor->makeNewField('entry_type_name', __('Entrytype name'), 'text');
 $editor->makeNewField('entry_type_name_short', __('Short entrytype name'), 'text');
 $editor->makeNewField('resourcenum_length', _h('Length of resource number') . '<br />(' . _h('If zero, resource number will not be required') . ')', 'text');
 $editor->makeNewField('entry_type_inactive', _l('Inactive'), 'select');
 $editor->addChoice('entry_type_inactive', 0, _l('No'));
 $editor->addChoice('entry_type_inactive', 1, _l('Yes'));
 $editor->getDB();
 if (isset($_POST['editor_submit'])) {
     if ($editor->input($_POST)) {
         if ($editor->performDBquery()) {
             // Redirect
             header('Location: admin_entry_type.php');
    if ($redirect2 != '') {
        $redirecting .= '&amp;redirect2=' . $redirect2;
    }
    if ($redirect3 != '') {
        $redirecting .= '&amp;redirect3=' . $redirect3;
    }
}
if ($id <= 0) {
    $editor = new editor('skjermer', $_SERVER['PHP_SELF'] . $redirecting);
    $editor->setHeading('Opprett skjerm');
    $editor->setSubmitTxt('Opprett');
    $smarty->assign('tittel2', 'Opprett skjerm');
} else {
    $editor = new editor('skjermer', $_SERVER['PHP_SELF'] . $redirecting, $id);
    $editor->setHeading('Endre skjerm');
    $editor->setSubmitTxt('Endre');
    $smarty->assign('tittel2', 'Endre skjerm');
}
$editor->setDBFieldID('skjerm_id');
$editor->showID(TRUE);
## SKJERM_NAVN
$editor->makeNewField('skjerm_navn', 'Navn på skjerm', 'text');
## SKJERM_SLIDE_NR
$editor->makeNewField('skjerm_slidenr', 'Antall slides', 'text');
## SKJERM_DEFAULTSLIDE_HEADING
$editor->makeNewField('skjerm_defaultslide_heading', 'Overskrift på skjerm', 'text');
$editor->vars['skjerm_defaultslide_heading']['desc'] = 'Sett inn &lt;br&gt; for linjeskift (andre HTML-tags er også gyldige).';
## SKJERM_DEFAULTSLIDE
$editor->makeNewField('skjerm_defaultslide', 'Innhold', 'textarea', array('rows' => 30, 'cols' => 135));
$editor->getDB();
if (isset($_POST['editor_submit'])) {