Updated LoadRicoClient for asp and php, so all asp and php examples are working again...
[infodrom/rico3] / examples / php / RicoDbViewerDetail.php
1 <?php\r
2 if (!isset ($_SESSION)) session_start();\r
3 ?>\r
4 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r
5 <html>\r
6 <head>\r
7 <title>Rico-Table Detail</title>\r
8 \r
9 <link href="../demo.css" type="text/css" rel="stylesheet" />\r
10 \r
11 <?php\r
12 require "dbConnect.php";\r
13 require "LoadRicoClient.php";\r
14 \r
15 \r
16 $arColumns=array();\r
17 $columnlist="";\r
18 $colspecs="";\r
19 if (isset($_GET["id"]) && OpenDB()) {\r
20   $id=trim($_GET["id"]);\r
21   $arColumns=$oDB->GetColumnInfo($id);\r
22   for ($i=0; $i<count($arColumns); $i++) {\r
23     $coltype=$arColumns[$i]->ColType;\r
24     if ($coltype=='image' || $coltype=='text' || $coltype=='ntext') continue;\r
25     if (!empty($columnlist)) {\r
26       $columnlist.=",";\r
27       $colspecs.=",";\r
28     }\r
29     $columnlist.=$arColumns[$i]->ColName;\r
30     //$colspecs.="{Hdg:'".$coltype."'";   // for debugging\r
31     $colspecs.="{Hdg:'".$arColumns[$i]->ColName."'";\r
32     if ($coltype == "DATETIME") {\r
33       $colspecs.=",type:'datetime'";\r
34     }\r
35     $colspecs.="}";\r
36   }\r
37   $_SESSION[$id]="select ".$columnlist." from ".$id." order by ".$arColumns[0]->ColName;\r
38   CloseApp();\r
39 }\r
40 ?>\r
41 \r
42 \r
43 <script type='text/javascript'>\r
44 Rico.onLoad( function() {\r
45   var opts = {  \r
46     useUnformattedColWidth: false,\r
47     menuEvent: 'click',\r
48     highlightElem: 'cursorRow',\r
49     columnSpecs: [\r
50 <?php\r
51 echo $colspecs;\r
52 ?>\r
53     ]\r
54   };\r
55   var buffer=new Rico.Buffer.AjaxSQL('ricoQuery.php', {TimeOut:<?php print array_shift(session_get_cookie_params())/60 ?>});\r
56   var grid=new Rico.LiveGrid ('<?php echo $id; ?>', buffer, opts);\r
57   grid.menu = new Rico.GridMenu();\r
58 });\r
59 </script>\r
60 \r
61 <style type="text/css">\r
62 html { border: none; }\r
63 div.ricoLG_cell {\r
64   white-space:nowrap;\r
65 }\r
66 </style>\r
67 </head>\r
68 \r
69 \r
70 <body>\r
71 <p><strong><?php echo $id; ?></strong>\r
72 <p class="ricoBookmark"><span id='<?php echo $id; ?>_timer' class='ricoSessionTimer'></span><span id="<?php echo $id; ?>_bookmark">&nbsp;</span></p>\r
73 <div id="<?php echo $id; ?>"></div>\r
74 </body>\r
75 </html>\r
76 \r