}
}
//get default value for the textarea (either from selecting an item in the history, or from the current active record)
$name = $_GET['name'];
if ($_GET['init']) {
    $row = StaticField::getStaticFieldById($_GET['init']);
} else {
    $row = StaticField::getStaticFieldByName($name);
}
if ($row) {
    $initValue = restoreValue($row[2]);
}
//delete history entry
$delete = $_GET['delete'];
if ($delete) {
    StaticField::deleteStaticField($delete);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>standupweb CMS - Edit static field mode</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
<link rel="shortcut icon" href="images/favicon.ico" />

</head>
<body>
<div class="header">
<div id='options'>
	<div id='setting'>
            $staticFields = StaticField::getAllStaticFieldsByName($name);
            if (!$staticFields) {
                $result = "no record for the name={$name}";
            } else {
                foreach ($staticFields as $sf) {
                    $sfList[] = implode(",", $sf);
                }
                $result = "getAllStaticFieldsByName result:\n" . implode("<br/>", $sfList);
            }
            break;
        case 'createStaticField':
            StaticField::createStaticField($name, $value);
            $result = "static field created: name={$name}, value={$value}";
            break;
        case 'deleteStaticField':
            if (StaticField::deleteStaticField($id)) {
                $result = "static field deleted: id={$id}";
            } else {
                $result = "cannot delete field with id={$id} because it is the current static field for the name {$name}";
            }
            break;
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>simple CMS - unit static field test</title>
<link rel="shortcut icon" href="images/favicon.ico" />