<?php
session_start();
$user_ID=$_SESSION[user_ID];
if (!$user_ID || $user_ID=='0')
{
header('location: index.php');
die('Login failed');
}
require("util.php");
$sql = new MySQL_class;
$sql->Create("generator");
$esql = new MySQL_class;
$esql->Create("generator");
if ($_GET[screen]) { $_SESSION[var_screen] = $_GET[screen]; }
if ($_GET[project]) { $_SESSION[var_project] = $_GET[project]; }
if ($_GET[part]) { $_SESSION[var_part] = $_GET[part]; }
$screen=$_SESSION[var_screen];
$project=$_SESSION[var_project];
$part=$_SESSION[var_part];
?>
<html>
<head>
<link href="list.css" type="text/css" rel=stylesheet>
<meta content="text/css" http-equiv="Content-Style-Type">
<title>Screen generator Scherm: Screen</title>
</head>
<script type="text/javascript" src="handlers.js" language="JavaScript">
alert ("no code");
</script>
<body>
<?php
include 'menu.php';
include 'makemenu.php';
makeMenu(0, 2, '');
?>
<div id="content">
<?php
$sql->QueryItem("SELECT screen.name as F446, screen.title as F447, screen.class as F511, `T732`.`title` as F732_1, screen.helpfile as F769 FROM `screen`
LEFT JOIN `screen` AS T732 ON screen.parent=T732.screen
WHERE `screen`.`screen` = '$screen'
LIMIT 1");
$name = htmlspecialchars($sql->data['F446']);
$stitle = htmlspecialchars($sql->data['F447']);
$class = htmlspecialchars($sql->data['F511']);
$title_732=htmlspecialchars($sql->data[F732_1]);
$parent = "$title_732";
$helpfile = htmlspecialchars($sql->data['F769']);
echo ('<table class=record>');
echo ("<tr><th>Name</th>
<td>$name</td>");
echo ("</tr>");
echo ("<tr><th>Title</th>
<td>$stitle</td>");
echo ("</tr>");
echo ("<tr><th>Class</th>
<td>$class</td>");
echo ("</tr>");
echo ("<tr><th>Parent</th>
<td>$parent</td>");
echo ("</tr>");
echo ("<tr><th>Help file</th>
<td>$helpfile</td>");
echo ("</tr>");
echo ('</table>');
?>
<p><input type=button value="Edit Screen" onClick="javascript: window.open('editscreen.php?screen=<?php echo $screen; ?>','','width=500,height=270,location=no,menubar=no,scrollbars=yes,status=no,resizable=yes'); return false;">
<?php
if ($_GET[order62]<>'') {
$sql->QueryItem("DELETE FROM user_selection WHERE user=$user_ID and field='sort_62'");
$sql->QueryItem("INSERT INTO user_selection VALUES ('$user_ID', 'sort_62','$_GET[order62]'");
}
$lastid=$_SESSION[last_62];
$lastfilter62=$_SESSION[filter62];
$_SESSION[last_62]='';
if ($_GET[filter62]) { $filter62 =$_GET[filter62]; } else { $filter62=$_POST[filter62];}
if ($_GET[page62]) { $page=$_GET[page62]; } else { $page=$_POST[page62]; }
if ($filter62!=$lastfilter62) {
$_SESSION[filter62]=$filter62;
$page=0;
}
if ($_GET[full_62]=='Fullpage') {
$_SESSION[fullpage_62]='f';
}
if ($_GET[full_62]=='Pages') {
$_SESSION[fullpage_62]='';
}
if ($filter62!='')
{
$qfilter62 = quote('%'.$filter62.'%');
$query = ("
FROM `part`
LEFT JOIN `table` AS T453 ON part.table=T453.table
LEFT JOIN `screen` AS T454 ON part.link=T454.screen
WHERE (T453.name LIKE $qfilter62
OR T454.name LIKE $qfilter62
OR part.`title` LIKE $qfilter62
) AND `part`.`screen`='$screen'
");
}
else
{
$query = ("
FROM `part`
LEFT JOIN `table` AS T453 ON part.table=T453.table
LEFT JOIN `screen` AS T454 ON part.link=T454.screen
WHERE 1 AND `part`.`screen`='$screen'
");
}
$lastrec=-1;
$sql->QueryItem("SELECT COUNT(*) AS records$query");
$records=$sql->data[records];
$sortorder=$sql->QueryItem("SELECT value FROM user_selection WHERE user=$user_ID and field='sort_62'");
if ($lastid=='') {$fromrec=20*$page;} else {
$fromrec=0;
$sql->Query("SELECT `part`.`part` AS id $query");
for ($r=0; $r<$sql->rows; $r++) {
$sql->Fetch($r);
if ($sql->data[id]==$lastid) {
$fromrec=$r-10;
if($fromrec<0) $fromrec=0;
$lastrec=$r-$fromrec;
break;
}
}
}
$sql->Query("SELECT part.part as F495, part.screen as F450, part.type as F452, `T453`.`name` as F453_1, `T454`.`name` as F454_1, part.title as F456, part.code as F457, part.order as F515$query".
($_SESSION[fullpage_62]==''?"LIMIT $fromrec, 20":''));
if (($part_rights['18/nofilter']==0)) {
echo "<form action=\"\" method=get name=Filter62>";
echo "<p class=filter>";
echo "Records: $records ";
$maxpage=(int) (($records+19)/20);
if ($maxpage>1) {
if ($_SESSION[fullpage_62]=='') {
echo "Page: ";
echo "<select name=\"page62\" OnChange=\"Filter62.submit();\">\n";
for ($i = 0; $i < $maxpage; $i++)
{
$nr=$i+1;
if ($i==$page) {$sel=" selected";} else {$sel="";}
echo "<option value=$i$sel>$nr van $maxpage</option>\n";
}
echo "</select>\n";
echo "<input type=submit name=full_62 value=\"Fullpage\">";
} else {
echo "<input type=submit name=full_62 value=\"Pages\">";
}
}
echo "<input type=text name=\"filter62\" size=25 value=\"$filter62\">";
echo "<input type=submit value=\"Search\">";
echo "<input type=button value=\"Add Part\" onClick=\"javascript: window.open('addpart.php?part=$part&screen=$screen','','width=500,height=500,location=no,menubar=no,scrollbars=yes,status=no,resizable=yes'); return false;\">";
echo "</p>";
echo "</form>";
}
?>
<table class=list>
<tr>
<th></th>
<th width=70px>Type</th>
<th width=175px>Table</th>
<th width=175px>Link</th>
<th width=175px>Title</th>
<th width=245px>Code</th>
<th width=0px>Order</th>
</tr>
<?php
for ($i = 0; $i < $sql->rows; $i++)
{
$sql->Fetch($i);
$part = $sql->data['F495'];
$type = htmlspecialchars($sql->data['F452']);
$name_453=htmlspecialchars($sql->data[F453_1]);
$table_lup = "$name_453";
$name_454=htmlspecialchars($sql->data[F454_1]);
$link_lup = "$name_454";
$title = htmlspecialchars($sql->data['F456']);
$code = htmlspecialchars($sql->data['F457']);
$order = htmlspecialchars($sql->data['F515']);
if ($lastrec==$i) {$color="style=\"background-color: #aaaaff;\"";} else {$color="";}
echo ("
<tr $color onMouseOver=\"ChangeColor(this)\" onMouseOut=\"ChangeColorBack(this)\" onClick=\"window.open('editpart.php?part=$part&screen=$screen','wijzigen','width=500,height=500,location=no,menubar=no,scrollbars=yes,status=no,resizable=yes')\">
<td onClick=\"window.open('addpart.php?order=$order','add','width=500,height=500,location=no,menubar=no,scrollbars=yes,status=no,resizable=yes'); no_bubble(event);\"><b>Add</b></td>
<td>$type</td>
<td>$table_lup</td>
<td>$link_lup</td>
<td>$title</td>
<td>$code</td>
<td>$order</td>
</tr>");
}
?>
</table>
</div></body>
</html>