2007-07-02 15:50:23 +00:00
|
|
|
<?php
|
2009-08-29 13:57:50 +00:00
|
|
|
$TABLE = $_GET["view"];
|
2013-01-31 07:40:26 +00:00
|
|
|
$row = ($TABLE == "" ? array() : view($TABLE));
|
|
|
|
$row["name"] = $TABLE;
|
|
|
|
|
|
|
|
if ($_POST) {
|
|
|
|
if (!$error) {
|
|
|
|
$name = trim($_POST["name"]);
|
|
|
|
drop_create(
|
|
|
|
"DROP VIEW " . table($TABLE),
|
|
|
|
"CREATE VIEW " . table($name) . " AS\n$_POST[select]",
|
|
|
|
"CREATE VIEW " . table($TABLE) . " AS\n$row[select]",
|
|
|
|
($_POST["drop"] ? substr(ME, 0, -1) : ME . "table=" . urlencode($name)),
|
|
|
|
lang('View has been dropped.'),
|
|
|
|
lang('View has been altered.'),
|
|
|
|
lang('View has been created.'),
|
|
|
|
$TABLE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
$row = $_POST;
|
2009-07-24 06:05:21 +00:00
|
|
|
}
|
2009-07-20 12:12:55 +00:00
|
|
|
|
2010-01-09 23:33:41 +00:00
|
|
|
page_header(($TABLE != "" ? lang('Alter view') : lang('Create view')), $error, array("table" => $TABLE), $TABLE);
|
2009-07-24 06:05:21 +00:00
|
|
|
?>
|
|
|
|
|
|
|
|
<form action="" method="post">
|
2013-01-31 05:35:51 +00:00
|
|
|
<p><?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" maxlength="64" autocapitalize="off">
|
2010-04-26 16:22:24 +00:00
|
|
|
<p><?php textarea("select", $row["select"]); ?>
|
2009-07-24 06:05:21 +00:00
|
|
|
<p>
|
|
|
|
<input type="submit" value="<?php echo lang('Save'); ?>">
|
2011-03-25 22:59:27 +00:00
|
|
|
<?php if ($_GET["view"] != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
|
2011-03-08 12:43:05 +00:00
|
|
|
<input type="hidden" name="token" value="<?php echo $token; ?>">
|
2009-07-24 06:05:21 +00:00
|
|
|
</form>
|