instances.php 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998
  1. <?php
  2. require('include/glob.php');
  3. require('include/muoribene.php');
  4. require('include/sessionstart.php');
  5. require('include/myconn.php');
  6. require('include/getadmacc.php');
  7. if ($account['Level']=='guest')
  8. muoribene('Sorry, you are not authorized.',true);
  9. require('include/menu.php');
  10. $menu['menu']['selected']=true;
  11. $menu['menu']['submenu']['instances']['href']=null;
  12. $menu['menu']['submenu']['instances']['selected']=true;
  13. buildmenu($menu);
  14. $dbg='';
  15. $dbg.='$account: <pre>'.print_r($account,1).'</pre>'.N;
  16. use function mysqli_real_escape_string as myesc;
  17. // praticamente una macro
  18. function hspech($str) {
  19. return(htmlspecialchars($str,ENT_QUOTES|ENT_HTML5,'UTF-8'));
  20. }
  21. require('include/columns.php');
  22. $types=array('bool','int','time','text','join','joini');
  23. $fieldselopts='';
  24. $ordfieldselopts='';
  25. foreach ($cols as $key=>$arr) {
  26. if (!array_key_exists('search',$arr) || $arr['search']==true) {
  27. if ($arr['type']=='joini') {
  28. $fieldselopts.='<option value="'.$key.':'.$arr['type'].':'.$arr['subtype'].'">'.$arr['name'].'</option>';
  29. } else {
  30. $fieldselopts.='<option value="'.$key.':'.$arr['type'].':null">'.$arr['name'].'</option>';
  31. }
  32. }
  33. if (!array_key_exists('ord',$arr) || $arr['ord']==true) {
  34. if (!array_key_exists('ordname',$arr))
  35. $name=$arr['name'];
  36. else
  37. $name=$arr['ordname'];
  38. if ($arr['type']=='joini') {
  39. $ordfieldselopts.='<option value="'.$key.':'.$arr['type'].':'.$arr['subtype'].'">'.$name.'</option>';
  40. } else {
  41. $ordfieldselopts.='<option value="'.$key.':'.$arr['type'].':null">'.$name.'</option>';
  42. }
  43. }
  44. }
  45. $dbg.='$_POST: <pre>'.print_r($_POST,1).'</pre>';
  46. $page=$account['Page'];
  47. if (array_key_exists('filt',$_POST) && $_POST['filt']=='filt') {
  48. $page=0;
  49. $blocks=0;
  50. foreach ($_POST as $key=>$val)
  51. if (preg_match('/^openpar-\d+$/',$key)===1)
  52. $blocks++;
  53. $fi=0;
  54. $oi=0;
  55. $admpresques=array('DELETE FROM PresFiltCondsAdm WHERE AdmID='.$account['ID'],'DELETE FROM PresOrdCondsAdm WHERE AdmID='.$account['ID']);
  56. foreach ($_POST as $key=>$val) {
  57. if (preg_match('/^openpar-\d+$/',$key)===1) {
  58. $fi++;
  59. $admpresque='INSERT INTO PresFiltCondsAdm SET AdmID='.$account['ID'].', ';
  60. if (preg_match('/^\(+$/',$val)===1)
  61. $admpresque.='OpenPar=\''.myesc($link,$val).'\', ';
  62. else
  63. $admpresque.='OpenPar=NULL, ';
  64. }
  65. if (preg_match('/^fieldsel-\d+$/',$key)===1 && preg_match('/^(.+):(.+):(.+)$/',$val,$buf)===1) {
  66. $tagk=$buf[1];
  67. $type=$buf[2];
  68. $subtype=$buf[3];
  69. if (array_key_exists($tagk,$cols) && in_array($type,$types)) {
  70. $admpresque.='Field=\''.myesc($link,$val).'\', ';
  71. } else {
  72. muoribene($dbg.'<br>Dati POST corrotti.<br>Puoi <a href="instances.php">riprovare resettando i parametri</a> o <a href="index.php">tornare al login</a>.',true);
  73. }
  74. }
  75. if (preg_match('/^condsel-\d+$/',$key)===1) {
  76. $admpresque.='Cond=\''.myesc($link,$val).'\', ';
  77. }
  78. if (preg_match('/^valuesel-\d+$/',$key)===1) {
  79. $admpresque.='ValueSel=\''.myesc($link,$val).'\', ';
  80. }
  81. if (preg_match('/^valueinp-\d+$/',$key)===1) {
  82. $admpresque.='ValueInp=\''.myesc($link,$val).'\', ';
  83. }
  84. if (preg_match('/^closepar-\d+$/',$key)===1) {
  85. if (preg_match('/^\)+$/',$val)===1)
  86. $admpresque.='ClosePar=\''.myesc($link,$val).'\', ';
  87. else
  88. $admpresque.='ClosePar=NULL, ';
  89. }
  90. if (preg_match('/^andor-\d+$/',$key)===1 && preg_match('/^AND|OR$/',$val)===1) {
  91. if ($fi<$blocks)
  92. $admpresque.='AndOr=\''.myesc($link,$val).'\', ';
  93. else
  94. $admpresque.='AndOr=NULL, ';
  95. $admpresque.='Pos='.$fi;
  96. $admpresques[]=$admpresque;
  97. }
  98. if (preg_match('/^ordfieldsel-\d+$/',$key)===1 && preg_match('/^(.+):(.+):(.+)$/',$val,$buf)===1) {
  99. $oi++;
  100. $tagk=$buf[1];
  101. $type=$buf[2];
  102. $subtype=$buf[3];
  103. if (array_key_exists($tagk,$cols) && in_array($type,$types)) {
  104. $admpresque='INSERT INTO PresOrdCondsAdm SET AdmID='.$account['ID'].', Field=\''.myesc($link,$val).'\', ';
  105. } else {
  106. muoribene($dbg.'<br>Dati POST corrotti.<br>Puoi <a href="instances.php">riprovare resettando i parametri</a> o <a href="index.php">tornare al login</a>.',true);
  107. }
  108. }
  109. if (preg_match('/^ascdesc-\d+$/',$key)===1 && preg_match('/^ASC|DESC$/',$val)===1) {
  110. $admpresque.='Sort=\''.myesc($link,$val).'\', Pos='.$oi;
  111. $admpresques[]=$admpresque;
  112. }
  113. }
  114. $dbg.='$admpresques: <pre>'.print_r($admpresques,1).'</pre>'.N;
  115. foreach ($admpresques as $que)
  116. mysqli_query($link,$que)
  117. or muoribene(__LINE__.': '.$dbg.'<br>'.N.mysqli_error($link),true);
  118. } elseif (array_key_exists('pageselect',$_POST) && preg_match('/^[0-9]+$/',$_POST['pageselect'])===1) {
  119. $page=$_POST['pageselect']+0;
  120. mysqli_query($link,'UPDATE Admins SET Page='.$page.' WHERE ID='.$account['ID'])
  121. or muoribene(__LINE__.': '.$dbg.'<br>'.N.mysqli_error($link),true);
  122. }
  123. $fi=0;
  124. $ji=0;
  125. $oi=0;
  126. $filtordon=false;
  127. $jsaddrows='';
  128. $jssetrows='';
  129. $jsordaddrows='';
  130. $jsordsetrows='';
  131. $sels=array();
  132. $joins=array();
  133. $havings=array();
  134. $where='';
  135. $order='';
  136. $res=mysqli_query($link,'SELECT * FROM PresFiltCondsAdm WHERE AdmID='.$account['ID'].' ORDER BY Pos ASC')
  137. or muoribene(__LINE__.': '.mysqli_error($link));
  138. $blocks=mysqli_num_rows($res);
  139. if ($blocks>0) $filtordon=true;
  140. while ($row=mysqli_fetch_assoc($res)) {
  141. $fi++;
  142. if (preg_match('/^\(+$/',$row['OpenPar'])===1) {
  143. $where.=$row['OpenPar'];
  144. $jssetrows.='setrow('.$fi.','.json_encode($row['OpenPar']);
  145. } else {
  146. $jssetrows.='setrow('.$fi.',"null"';
  147. }
  148. $jsaddrows.='addrow('.$fi.',false);'.N;
  149. preg_match('/^(.+):(.+):(.+)$/',$row['Field'],$buf);
  150. $tagk=$buf[1];
  151. $type=$buf[2];
  152. $subtype=$buf[3];
  153. if (array_key_exists($tagk,$cols) && in_array($type,$types)) {
  154. ($tagk=='Instances.AdmCreatedAt') ? $inpisdate=true : $inpisdate=false;
  155. if (strpos($cols[$tagk]['field'],'%')!==false)
  156. $ji++;
  157. $where.=str_replace('%',$ji,$cols[$tagk]['field']);
  158. if ($type=='join' || $type=='joini') {
  159. foreach ($cols[$tagk]['join'] as $join) {
  160. $join=str_replace('%',$ji,$join);
  161. if (!in_array($join,$joins))
  162. $joins[]=$join;
  163. }
  164. }
  165. if (array_key_exists('havings',$cols[$tagk]) && !in_array($cols[$tagk]['havings'],$havings))
  166. $havings[]=$cols[$tagk]['havings'];
  167. if (array_key_exists('selmore',$cols[$tagk]) && !in_array($cols[$tagk]['selmore'],$sels))
  168. $sels[]=$cols[$tagk]['selmore'];
  169. $jssetrows.=','.json_encode($row['Field']);
  170. }
  171. $where.=' '.$row['Cond'].' ';
  172. $cond=$row['Cond'];
  173. $jssetrows.=','.json_encode($row['Cond']);
  174. // nel caso qui sotto, valuesel e valueinp sono entrambi disabilitati (non ci sono in $_POST), quindi li riempio di introvabile e nulla
  175. if (preg_match('/^IS NULL|IS NOT NULL$/',$row['Cond'])===1)
  176. $jssetrows.=',"NOMMITROVI!",""';
  177. if (!is_null($row['ValueSel'])) {
  178. $where.=$row['ValueSel'];
  179. $jssetrows.=','.json_encode($row['ValueSel']);
  180. $jssetrows.=',""';
  181. }
  182. if (!is_null($row['ValueInp'])) {
  183. if ($inpisdate && preg_match('/^([0-9]{1,2}) ([0-9]{1,2}) ([0-9]{4,5})$/',$row['ValueInp'],$buf)===1) {
  184. $where.=mktime(0,0,0,$buf[2]+0,$buf[1]+0,$buf[3]+0);
  185. } elseif (preg_match('/^LIKE|NOT LIKE$/',$cond)===1) {
  186. $where.='\'%'.myesc($link,$row['ValueInp']).'%\'';
  187. } else {
  188. $where.='\''.myesc($link,$row['ValueInp']).'\'';
  189. }
  190. $jssetrows.=',"NOMMITROVI!"';
  191. $jssetrows.=','.json_encode($row['ValueInp']);
  192. }
  193. if (preg_match('/^\)+$/',$row['ClosePar'])===1) {
  194. $where.=$row['ClosePar'];
  195. $jssetrows.=','.json_encode($row['ClosePar']);
  196. } else {
  197. $jssetrows.=',"null"';
  198. }
  199. if (preg_match('/^AND|OR$/',$row['AndOr'])===1) {
  200. if ($fi<$blocks)
  201. $where.=' '.$row['AndOr'].' ';
  202. $jssetrows.=','.json_encode($row['AndOr']).');'.N;
  203. } else {
  204. $jssetrows.=',"AND");'.N;
  205. }
  206. }
  207. $res=mysqli_query($link,'SELECT * FROM PresOrdCondsAdm WHERE AdmID='.$account['ID'].' ORDER BY Pos ASC')
  208. or muoribene(__LINE__.': '.mysqli_error($link));
  209. if (mysqli_num_rows($res)>0) $filtordon=true;
  210. while ($row=mysqli_fetch_assoc($res)) {
  211. preg_match('/^(.+):(.+):(.+)$/',$row['Field'],$buf);
  212. $oi++;
  213. $tagk=$buf[1];
  214. $type=$buf[2];
  215. $subtype=$buf[3];
  216. if (array_key_exists($tagk,$cols) && in_array($type,$types)) {
  217. if ($type=='join' || $type=='joini') {
  218. if (!array_key_exists('ordjoin',$cols[$tagk])) {
  219. foreach ($cols[$tagk]['join'] as $join)
  220. if (!in_array($join,$joins))
  221. $joins[]=$join;
  222. } else {
  223. foreach ($cols[$tagk]['ordjoin'] as $join)
  224. if (!in_array($join,$joins))
  225. $joins[]=$join;
  226. }
  227. }
  228. if (!array_key_exists('ordby',$cols[$tagk])) {
  229. $order.=$cols[$tagk]['field'];
  230. } else {
  231. if (!in_array($cols[$tagk]['ordselmore'],$sels))
  232. $sels[]=$cols[$tagk]['ordselmore'];
  233. $order.=$cols[$tagk]['ordby'];
  234. }
  235. if (array_key_exists('havings',$cols[$tagk]) && !in_array($cols[$tagk]['havings'],$havings))
  236. $havings[]=$cols[$tagk]['havings'];
  237. if (array_key_exists('selmore',$cols[$tagk]) && !in_array($cols[$tagk]['selmore'],$sels))
  238. $sels[]=$cols[$tagk]['selmore'];
  239. $jsordaddrows.='ordaddrow('.$oi.',false);'.N;
  240. $jsordsetrows.='ordsetrow('.$oi.','.json_encode($row['Field']);
  241. } else {
  242. muoribene($dbg.'<br>Dati db corrotti.<br>Puoi <a href="instances.php">riprovare resettando i parametri</a> o <a href="index.php">tornare al login</a>.',true);
  243. }
  244. $order.=' '.$row['Sort'].', ';
  245. $jsordsetrows.=','.json_encode($row['Sort']).');'.N;
  246. }
  247. if ($jsaddrows!='') {
  248. $jsaddrows.='document.getElementById("filbut").value="Rimuovi tutti i criteri di filtraggio";'.N;
  249. $jsaddrows.='synctai();'.N;
  250. }
  251. if ($jsordaddrows!='') {
  252. $jsordaddrows.='document.getElementById("ordbut").value="Rimuovi tutti i criteri di ordinamento";'.N;
  253. $jsordaddrows.='synctoi();'.N;
  254. }
  255. if (count($sels)>0)
  256. $sels=', '.implode(', ',$sels);
  257. else
  258. $sels='';
  259. if ($where!='')
  260. $where='WHERE '.$where;
  261. if ($order!='')
  262. $order='ORDER BY '.substr($order,0,-2);
  263. $dbg.='ORDER: '.$order.'<br>';
  264. if (count($joins)>0)
  265. $joins='LEFT JOIN '.implode(' LEFT JOIN ',$joins);
  266. else
  267. $joins='';
  268. if (count($havings)>0)
  269. $havings='HAVING '.implode(' AND ',$havings);
  270. else
  271. $havings='';
  272. $query='SELECT *, Instances.ID AS IID '.$sels.' FROM Instances '.$joins.' '.$where.' GROUP BY IID '.$havings.' '.$order;
  273. $dbg.='QUERONA: '.$query.'<br>'.N;
  274. $tini=microtime(true);
  275. $res=mysqli_query($link,$query)
  276. or muoribene($dbg.'<br>'.$query.': '.mysqli_error($link).'<br>'.'La query è fallita. <a href="instances.php">Resetta</a>.',true);
  277. $dbg.='Durata esecuzione query: '.round(microtime(true)-$tini,4).' sec.<br>'.N;
  278. $cinsts=mysqli_num_rows($res);
  279. $iperp=25;
  280. if ($page*$iperp>$cinsts)
  281. $page=0;
  282. $finst=$page*$iperp;
  283. if (mysqli_num_rows($res)<1) {
  284. $pgout='';
  285. $out='<p>Nessuna istanza da mostrare.</p>'.N;
  286. } else {
  287. // $pgout='Pag. '.($page+1).'/'.(ceil($cinsts/$iperp)-1);
  288. $pgout='<form method="post" id="pform">'.N;
  289. $pgout.='<select id="pageselect" name="pageselect" onchange="document.getElementById(\'pform\').submit()">'.N;
  290. $totp=ceil($cinsts/$iperp);
  291. for ($i=0; $i<$totp; $i++) {
  292. $lastpi=$i*$iperp+$iperp;
  293. if ($lastpi>$cinsts) $lastpi=$cinsts;
  294. ($i!=$page) ? $selected='' : $selected=' selected';
  295. $pgout.='<option value="'.$i.'"'.$selected.'>Pagina '.($i+1).'/'.$totp.' (Istanze '.($i*$iperp+1).'-'.$lastpi.'/'.$cinsts.')</option>'.N;
  296. }
  297. $pgout.='</select>'.N;
  298. $pgout.='</form>';
  299. // ---
  300. mysqli_data_seek($res,$finst);
  301. $out='';
  302. $i=$finst;
  303. $ii=0;
  304. require('include/dispinst.php');
  305. while ($row=mysqli_fetch_assoc($res)) {
  306. $i++;
  307. $ii++;
  308. if ($ii>$iperp) break;
  309. $out.=dispinst($row,$cols,$link,$dlang,$account,true,$i,$cinsts);
  310. }
  311. $out.='<div class="bigtabfoot"></div>'.N;
  312. }
  313. $presid=0;
  314. if (array_key_exists('presets',$_POST) && preg_match('/^[0-9]+$/',$_POST['presets'])===1)
  315. $presid=$_POST['presets'];
  316. $presopts='<option value="null"></option>'.N;
  317. $res=mysqli_query($link,'SELECT * FROM Presets ORDER BY LENGTH(Name) ASC, Name ASC')
  318. or muoribene(mysqli_error($link),true);
  319. while ($row=mysqli_fetch_assoc($res)) {
  320. if ($row['ID']!=$presid)
  321. $presopts.='<option value="'.$row['ID'].'">'.hspech($row['Name']).'</option>'.N;
  322. else
  323. $presopts.='<option value="'.$row['ID'].'" selected>'.hspech($row['Name']).'</option>'.N;
  324. }
  325. require('include/notifs.php');
  326. $notifs=notifs($link);
  327. mysqli_close($link);
  328. if ($filtordon) {
  329. $filtordimgoff='imgs/cerca_act_off.svg';
  330. $filtordimgon='imgs/cerca_act_on.svg';
  331. } else {
  332. $filtordimgoff='imgs/cerca_off.svg';
  333. $filtordimgon='imgs/cerca_on.svg';
  334. }
  335. ?>
  336. <!DOCTYPE HTML>
  337. <html lang="it">
  338. <head>
  339. <title>Mustard - Elenco istanze</title>
  340. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  341. <meta name="description" content="Admin pages for Mastodon Startpage">
  342. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  343. <link rel="icon" type="image/png" href="imgs/icona-32.png" sizes="32x32">
  344. <link rel="icon" type="image/png" href="imgs/icona-192.png" sizes="192x192">
  345. <link rel="icon" type="image/png" href="imgs/icona-512.png" sizes="512x512">
  346. <link rel="apple-touch-icon-precomposed" href="imgs/icona-180.png">
  347. <script language="JavaScript" src="js/menu.js?v=<?php echo($cjrand); ?>"></script>
  348. <script language="JavaScript" src="js/confirma.js?v=<?php echo($cjrand); ?>"></script>
  349. <script language="JavaScript" src="js/alerta.js?v=<?php echo($cjrand); ?>"></script>
  350. <link rel="stylesheet" type="text/css" href="theme.css?v=<?php echo($cjrand); ?>">
  351. <script language="JavaScript">
  352. <!--
  353. <?php require('js/notifs.js.php'); ?>
  354. function shideplancia() {
  355. var plancia=document.getElementById('plancia');
  356. var plctrl=document.getElementById('lente');
  357. if (plancia.style.display=='block') {
  358. plancia.style.display='none';
  359. plctrl.src='<?php echo($filtordimgoff); ?>';
  360. plctrl.title='Mostra il pannello di filtraggio e ordinamento';
  361. } else {
  362. plancia.style.display='block';
  363. plctrl.src='<?php echo($filtordimgon); ?>';
  364. plctrl.title='Nascondi il pannello di filtraggio e ordinamento';
  365. }
  366. }
  367. function hent(str) {
  368. return str.replace(/&/g,'&amp;').replace(/>/g,'&gt;').replace(/</g,'&lt;').replace(/"/g,'&quot;');
  369. }
  370. function truncsel(el) {
  371. var sel=document.getElementById(el);
  372. sel.length=0;
  373. }
  374. function inpdisif(index) {
  375. console.log('inpdisif index: '+index);
  376. var source=document.getElementById('condsel-'+index);
  377. var inp=document.getElementById('valueinp-'+index);
  378. var sel=document.getElementById('valuesel-'+index);
  379. var conds=['IS NULL','IS NOT NULL'];
  380. if (conds.includes(source.value)) {
  381. inp.disabled=true;
  382. sel.disabled=true;
  383. } else {
  384. if (inp.style.display!='none') inp.disabled=false;
  385. if (sel.style.display!='none') sel.disabled=false;
  386. }
  387. }
  388. function popusels(index,valselval) {
  389. console.log('popusels index: '+index);
  390. var key=document.getElementById('fieldsel-'+index).value;
  391. var type=key.replace(/^.*:(.*):.*$/,'$1');
  392. var subtype=key.replace(/^.*:.*:(.*)$/,'$1');
  393. key=key.replace(/^(.*):.*:.*$/,'$1');
  394. var condsel=document.getElementById('condsel-'+index);
  395. var valsel=document.getElementById('valuesel-'+index);
  396. var valinp=document.getElementById('valueinp-'+index);
  397. condsel.setAttribute('onchange','inpdisif('+index+');');
  398. if (type=='joini')
  399. type=subtype;
  400. if (type=='bool') {
  401. truncsel('condsel-'+index);
  402. condsel.add(new Option('è','IS'));
  403. truncsel('valuesel-'+index);
  404. valsel.add(new Option('vero','TRUE'));
  405. valsel.add(new Option('falso','FALSE'));
  406. valsel.add(new Option('definit@','NOT NULL'));
  407. valsel.add(new Option('non definit@','NULL'));
  408. if (valselval!==false)
  409. selind('valuesel-'+index,valselval);
  410. valinp.style.display='none';
  411. valinp.disabled=true;
  412. valsel.style.display='block';
  413. valsel.disabled=false;
  414. } else if (type=='text') {
  415. truncsel('condsel-'+index);
  416. condsel.add(new Option('contiene','LIKE'));
  417. condsel.add(new Option('non contiene','NOT LIKE'));
  418. condsel.add(new Option('è uguale a','='));
  419. condsel.add(new Option('è divers@ da','!='));
  420. condsel.add(new Option('è maggiore o uguale a','>='));
  421. condsel.add(new Option('è minore o uguale a','<='));
  422. condsel.add(new Option('è maggiore di','>'));
  423. condsel.add(new Option('è minore di','<'));
  424. condsel.add(new Option('è definit@','IS NOT NULL'));
  425. condsel.add(new Option('non è definit@','IS NULL'));
  426. valsel.style.display='none';
  427. valsel.disabled=true;
  428. valinp.style.display='block';
  429. valinp.disabled=false;
  430. } else if (type=='int' || type=='time') {
  431. truncsel('condsel-'+index);
  432. condsel.add(new Option('è maggiore o uguale a','>='));
  433. condsel.add(new Option('è minore o uguale a','<='));
  434. condsel.add(new Option('è maggiore di','>'));
  435. condsel.add(new Option('è minore di','<'));
  436. condsel.add(new Option('è uguale a','='));
  437. condsel.add(new Option('è divers@ da','!='));
  438. condsel.add(new Option('è definit@','IS NOT NULL'));
  439. condsel.add(new Option('non è definit@','IS NULL'));
  440. valsel.style.display='none';
  441. valsel.disabled=true;
  442. valinp.style.display='block';
  443. valinp.disabled=false;
  444. } else if (type=='join') {
  445. truncsel('condsel-'+index);
  446. condsel.add(new Option('è uguale a','='));
  447. condsel.add(new Option('è divers@ da','!='));
  448. condsel.add(new Option('è definit@','IS NOT NULL'));
  449. condsel.add(new Option('non è definit@','IS NULL'));
  450. valsel.style.display='block';
  451. valsel.disabled=false;
  452. valinp.style.display='none';
  453. valinp.disabled=true;
  454. truncsel('valuesel-'+index);
  455. pupwait(true);
  456. let xhr=new XMLHttpRequest();
  457. xhr.open('GET','instancesh.php?key='+key);
  458. xhr.responseType='json';
  459. xhr.send();
  460. xhr.onload=function() {
  461. let jarr=xhr.response;
  462. for (i=0; i<jarr.length; i++)
  463. valsel.add(new Option(jarr[i][1],jarr[i][0]));
  464. console.log('valsel pronto!');
  465. if (valselval!==false)
  466. selind('valuesel-'+index,valselval);
  467. pupwait(false);
  468. };
  469. xhr.onerror=function() {
  470. pupwait(false);
  471. alert('La richiesta è fallita.');
  472. };
  473. } else {
  474. alert('Attenziò: non so che farmene del tipo "'+type+'": diglielo, al programmatore.');
  475. }
  476. }
  477. function addrow(index,refresh) {
  478. var table=document.getElementById('planciafil');
  479. if (table.rows.length<9) {
  480. var newrow=table.insertRow(index);
  481. var newcell0=newrow.insertCell(0);
  482. var newcell1=newrow.insertCell(1);
  483. var newcell2=newrow.insertCell(2);
  484. var newcell3=newrow.insertCell(3);
  485. var newcell4=newrow.insertCell(4);
  486. var newcell5=newrow.insertCell(5);
  487. var newcell6=newrow.insertCell(6);
  488. var newcell7=newrow.insertCell(7);
  489. newcell0.innerHTML='<select class="openpar"><option value="null"></option><option value="(">(</option><option value="((">((</option><option value="(((">(((</option></select>';
  490. newcell1.innerHTML='<select class="fieldsel"><?php echo($fieldselopts); ?></select>';
  491. newcell2.innerHTML='<select class="condsel"></select>';
  492. newcell3.innerHTML='<select class="valuesel" style="display:none;"></select><input type="text" class="valueinp" maxlength="256" style="display:none;">';
  493. newcell4.innerHTML='<select class="closepar"><option value="null"></option><option value=")">)</option><option value="))">))</option><option value=")))">)))</option></select>';
  494. newcell5.innerHTML='<select class="andor"><option value="AND">E</option><option value="OR">O</option></select>';
  495. newcell6.innerHTML='<img class="plus" src="imgs/plus.svg" title="Aggiungi un criterio sotto questo">';
  496. newcell6.style.width='22px';
  497. newcell7.innerHTML='<img class="minus" src="imgs/minus.svg" title="Rimuovi questo criterio">';
  498. newcell7.style.width='22px';
  499. if (refresh) {
  500. synctai();
  501. popusels(index,false);
  502. }
  503. } else {
  504. alerta('Attenzione','<p>Non è possibile impostare più di 8 criteri di filtraggio.</p>');
  505. }
  506. }
  507. function ordaddrow(index,refresh) {
  508. var table=document.getElementById('planciaord');
  509. if (table.rows.length<7) {
  510. var newrow=table.insertRow(index);
  511. var newcell0=newrow.insertCell(0);
  512. var newcell1=newrow.insertCell(1);
  513. var newcell2=newrow.insertCell(2);
  514. var newcell3=newrow.insertCell(3);
  515. newcell0.style.width='97%';
  516. newcell1.style.width='1%';
  517. newcell2.style.width='1%';
  518. newcell3.style.width='1%';
  519. newcell0.innerHTML='<select class="ordfieldsel"><?php echo($ordfieldselopts); ?></select>';
  520. newcell1.innerHTML='<select class="ascdesc"><option value="ASC">Crescente</option><option value="DESC">Decrescente</option></select>';
  521. newcell2.innerHTML='<img class="plus" src="imgs/plus.svg" title="Aggiungi un criterio sotto questo">';
  522. newcell3.innerHTML='<img class="minus" src="imgs/minus.svg" title="Rimuovi questo criterio">';
  523. if (refresh)
  524. synctoi();
  525. } else {
  526. alerta('Attenzione','<p>Non è possibile impostare più di 6 criteri di ordinamento.<p>');
  527. }
  528. }
  529. function synctai() {
  530. var i=0;
  531. var table=document.getElementById('planciafil');
  532. var nodes=table.querySelectorAll('.minus');
  533. var cnodes=nodes.length;
  534. for (i=0; i<cnodes; i++)
  535. // +1 sempre per via della row iniziale
  536. nodes[i].setAttribute('onclick','remrow('+(i+1)+');');
  537. nodes=table.querySelectorAll('.plus');
  538. for (i=0; i<cnodes; i++)
  539. // +2 perché la devi aggiungere dopo la corrente
  540. nodes[i].setAttribute('onclick','addrow('+(i+2)+',true);');
  541. // da qui in poi faccio a scendere per non avere mai id e nomi duplicati
  542. cnodes--;
  543. nodes=table.querySelectorAll('.openpar');
  544. for (i=cnodes; i>-1; i--) {
  545. nodes[i].setAttribute('id','openpar-'+(i+1));
  546. nodes[i].setAttribute('name','openpar-'+(i+1));
  547. }
  548. nodes=table.querySelectorAll('.fieldsel');
  549. for (i=cnodes; i>-1; i--) {
  550. nodes[i].setAttribute('id','fieldsel-'+(i+1));
  551. nodes[i].setAttribute('name','fieldsel-'+(i+1));
  552. nodes[i].setAttribute('onchange','popusels('+(i+1)+',false);');
  553. }
  554. nodes=table.querySelectorAll('.condsel');
  555. for (i=cnodes; i>-1; i--) {
  556. nodes[i].setAttribute('id','condsel-'+(i+1));
  557. nodes[i].setAttribute('name','condsel-'+(i+1));
  558. nodes[i].setAttribute('onchange','inpdisif('+(i+1)+');');
  559. }
  560. nodes=table.querySelectorAll('.valuesel');
  561. for (i=cnodes; i>-1; i--) {
  562. nodes[i].setAttribute('id','valuesel-'+(i+1));
  563. nodes[i].setAttribute('name','valuesel-'+(i+1));
  564. }
  565. nodes=table.querySelectorAll('.valueinp');
  566. for (i=cnodes; i>-1; i--) {
  567. nodes[i].setAttribute('id','valueinp-'+(i+1));
  568. nodes[i].setAttribute('name','valueinp-'+(i+1));
  569. }
  570. nodes=table.querySelectorAll('.closepar');
  571. for (i=cnodes; i>-1; i--) {
  572. nodes[i].setAttribute('id','closepar-'+(i+1));
  573. nodes[i].setAttribute('name','closepar-'+(i+1));
  574. }
  575. nodes=table.querySelectorAll('.andor');
  576. for (i=cnodes; i>-1; i--) {
  577. nodes[i].setAttribute('id','andor-'+(i+1));
  578. nodes[i].setAttribute('name','andor-'+(i+1));
  579. nodes[i].disabled=false;
  580. }
  581. if (cnodes>=0)
  582. nodes[cnodes].disabled=true;
  583. }
  584. function synctoi() {
  585. var i=0;
  586. var table=document.getElementById('planciaord');
  587. var nodes=table.querySelectorAll('.minus');
  588. var cnodes=nodes.length;
  589. for (i=0; i<cnodes; i++)
  590. // +1 sempre per via della row iniziale
  591. nodes[i].setAttribute('onclick','ordremrow('+(i+1)+');');
  592. nodes=table.querySelectorAll('.plus');
  593. for (i=0; i<cnodes; i++)
  594. // +2 perché la devi aggiungere dopo la corrente
  595. nodes[i].setAttribute('onclick','ordaddrow('+(i+2)+',true);');
  596. // da qui in poi faccio a scendere per non avere mai id e nomi duplicati
  597. cnodes--;
  598. nodes=table.querySelectorAll('.ordfieldsel');
  599. for (i=cnodes; i>-1; i--) {
  600. nodes[i].setAttribute('id','ordfieldsel-'+(i+1));
  601. nodes[i].setAttribute('name','ordfieldsel-'+(i+1));
  602. }
  603. nodes=table.querySelectorAll('.ascdesc');
  604. for (i=cnodes; i>-1; i--) {
  605. nodes[i].setAttribute('id','ascdesc-'+(i+1));
  606. nodes[i].setAttribute('name','ascdesc-'+(i+1));
  607. }
  608. }
  609. function selind(id,val) {
  610. var el=document.getElementById(id), i=0, found=false;
  611. while (!found && i<el.length) {
  612. if (el[i].value==val) {
  613. el.selectedIndex=i;
  614. found=true;
  615. }
  616. i++;
  617. }
  618. if (!found)
  619. console.log('"'+val+'" non è stato trovato in "'+id+'"');
  620. }
  621. function setrow(index,openparv,fieldselv,condselv,valueselv,valueinpv,closeparv,andorv) {
  622. selind('openpar-'+index,openparv);
  623. selind('fieldsel-'+index,fieldselv);
  624. popusels(index,valueselv);
  625. selind('condsel-'+index,condselv);
  626. // selind('valuesel-'+index,valueselv);
  627. document.getElementById('valueinp-'+index).value=valueinpv;
  628. if (condselv=='IS NULL' || condselv=='IS NOT NULL') {
  629. document.getElementById('valueinp-'+index).disabled=true;
  630. document.getElementById('valuesel-'+index).disabled=true;
  631. }
  632. selind('closepar-'+index,closeparv);
  633. selind('andor-'+index,andorv);
  634. }
  635. function ordsetrow(index,ordfieldselv,ascdescv) {
  636. selind('ordfieldsel-'+index,ordfieldselv);
  637. selind('ascdesc-'+index,ascdescv);
  638. }
  639. function remrow(index) {
  640. var table=document.getElementById('planciafil');
  641. table.deleteRow(index);
  642. synctai();
  643. if (table.rows.length<2)
  644. document.getElementById('filbut').value='Aggiungi criteri di filtraggio';
  645. }
  646. function ordremrow(index) {
  647. var table=document.getElementById('planciaord');
  648. table.deleteRow(index);
  649. synctoi();
  650. if (table.rows.length<2)
  651. document.getElementById('ordbut').value='Aggiungi criteri di ordinamento';
  652. }
  653. function truncfil() {
  654. var table=document.getElementById('planciafil');
  655. while (table.rows.length>1)
  656. remrow(1);
  657. }
  658. function truncord() {
  659. var table=document.getElementById('planciaord');
  660. while (table.rows.length>1)
  661. ordremrow(1);
  662. }
  663. function manfil() {
  664. var filbut=document.getElementById('filbut');
  665. var table=document.getElementById('planciafil');
  666. var crows=table.rows.length;
  667. if (crows<2) {
  668. addrow(1,true);
  669. filbut.value='Rimuovi tutti i criteri di filtraggio';
  670. } else {
  671. confirma('<p>Confermi di voler rimuovere tutti i criteri di filtraggio?</p>','truncfil();filbut.value=\'Aggiungi criteri di filtraggio\'');
  672. }
  673. }
  674. function manord() {
  675. var ordbut=document.getElementById('ordbut');
  676. var table=document.getElementById('planciaord');
  677. var crows=table.rows.length;
  678. if (crows<2) {
  679. ordaddrow(1,true);
  680. ordbut.value='Rimuovi tutti i criteri di ordinamento';
  681. } else {
  682. confirma('<p>Confermi di voler rimuovere tutti i criteri di ordinamento?</p>','truncord();ordbut.value=\'Aggiungi criteri di ordinamento\'');
  683. }
  684. }
  685. function ckpar() {
  686. var i=0;
  687. var table=document.getElementById('planciafil');
  688. var nodes=table.querySelectorAll('.openpar');
  689. var cnodes=nodes.length;
  690. var opars=[];
  691. var cpars=[];
  692. for (i=0; i<cnodes; i++)
  693. opars.push(nodes[i].value);
  694. nodes=table.querySelectorAll('.closepar');
  695. for (i=0; i<cnodes; i++)
  696. cpars.push(nodes[i].value);
  697. var spars='';
  698. for (i=0; i<cnodes; i++) {
  699. if (opars[i]!='null') spars+=opars[i];
  700. if (cpars[i]!='null') spars+=cpars[i];
  701. }
  702. var opq=0, cpq=0, ok=true;
  703. for (i=0; i<spars.length; i++) {
  704. if (spars[i]=='(') {
  705. opq++;
  706. } else if (spars[i]==')') {
  707. cpq++;
  708. }
  709. if (cpq>opq)
  710. break;
  711. }
  712. if (opq!=cpq)
  713. ok=false;
  714. console.log(i+'/'+spars.length+': '+ok);
  715. return ok;
  716. }
  717. function ckf() {
  718. var emsg='';
  719. if (!ckpar()) emsg+='<p>Qualcosa non va con le parentesi!</p>';
  720. // emsg+='Comunque NO!<br>\n';
  721. if (emsg=='') {
  722. var table=document.getElementById('planciafil');
  723. var crows=table.rows.length;
  724. if (crows>1)
  725. document.getElementById('andor-'+(crows-1)).disabled=false;
  726. document.getElementById('f').submit();
  727. } else {
  728. alerta('Errore',emsg);
  729. return false;
  730. }
  731. }
  732. function pupwait(on) {
  733. var pup=document.getElementById('popup'), inpup=document.getElementById('inpopup');
  734. if (on) {
  735. if (pup.style.display!='table') {
  736. inpup.innerHTML='<div class="waitbub"><img src="imgs/loading.gif"><br>&nbsp;<br>Caricamento in corso...</div>';
  737. pup.style.display='table';
  738. } else {
  739. console.log('Sto già aspettando...');
  740. }
  741. } else {
  742. inpup.innerHTML='<div id="popupcont">...</div>';
  743. pup.style.display='none';
  744. }
  745. }
  746. //function setrow(index,openparv,fieldselv,condselv,valueselv,valueinpv,closeparv,andorv)
  747. function loadpres() {
  748. let pres=document.getElementById('presets');
  749. if (pres.value!='null') {
  750. pupwait(true);
  751. let formdata=new FormData();
  752. formdata.append('act','load');
  753. formdata.append('pid',pres.value);
  754. let xhr=new XMLHttpRequest();
  755. xhr.open('POST','loadsaverempres.php');
  756. xhr.responseType='json';
  757. xhr.send(formdata);
  758. xhr.onload=function() {
  759. let jarr=xhr.response;
  760. truncfil();
  761. for (i=0; i<jarr['f'].length; i++) {
  762. console.log(jarr['f'][i]);
  763. addrow(i+1,false);
  764. }
  765. synctai();
  766. for (i=0; i<jarr['f'].length; i++) {
  767. setrow(i+1, jarr['f'][i]['OpenPar'], jarr['f'][i]['Field'], jarr['f'][i]['Cond'], jarr['f'][i]['ValueSel'], jarr['f'][i]['ValueInp'], jarr['f'][i]['ClosePar'], jarr['f'][i]['AndOr']);
  768. }
  769. if (jarr['f'].length>0)
  770. document.getElementById('filbut').value='Rimuovi tutti i criteri di filtraggio';
  771. truncord();
  772. for (i=0; i<jarr['o'].length; i++) {
  773. console.log(jarr['o'][i]);
  774. ordaddrow(i+1,false);
  775. }
  776. synctoi();
  777. for (i=0; i<jarr['o'].length; i++) {
  778. ordsetrow(i+1, jarr['o'][i]['Field'], jarr['o'][i]['Sort']);
  779. }
  780. if (jarr['o'].length>0)
  781. document.getElementById('ordbut').value='Rimuovi tutti i criteri di ordinamento';
  782. pupwait(false);
  783. };
  784. xhr.onerror=function() {
  785. pupwait(false);
  786. alert('La richiesta è fallita.');
  787. };
  788. } else {
  789. alerta('Attenzione','<p>Non hai selezionato alcun preset ;)</p>');
  790. }
  791. }
  792. function rempres() {
  793. pupwait(true);
  794. let pres=document.getElementById('presets');
  795. let formdata=new FormData(document.forms.f);
  796. formdata.append('act','remove');
  797. formdata.append('pid',pres.value);
  798. let xhr=new XMLHttpRequest();
  799. xhr.open('POST','loadsaverempres.php');
  800. xhr.responseType='json';
  801. xhr.send(formdata);
  802. xhr.onload=function() {
  803. console.log(xhr.response);
  804. pres.remove(pres.selectedIndex);
  805. pres.selectedIndex=0;
  806. pupwait(false);
  807. };
  808. xhr.onerror=function() {
  809. pupwait(false);
  810. alert('La richiesta è fallita.');
  811. };
  812. }
  813. function savepres(txt,asnew) {
  814. pupwait(true);
  815. let pres=document.getElementById('presets');
  816. let formdata=new FormData(document.forms.f);
  817. formdata.append('act','save');
  818. formdata.append('txt',txt);
  819. if (!asnew)
  820. formdata.append('pid',pres.value);
  821. let xhr=new XMLHttpRequest();
  822. xhr.open('POST','loadsaverempres.php');
  823. xhr.responseType='json';
  824. xhr.send(formdata);
  825. xhr.onload=function() {
  826. console.log(xhr.response);
  827. if (!asnew) {
  828. pres.options[pres.selectedIndex].text=txt;
  829. } else {
  830. let jarr=xhr.response;
  831. pres.add(new Option(txt,jarr['pid']));
  832. pres.selectedIndex=pres.options.length-1;
  833. }
  834. pupwait(false);
  835. };
  836. xhr.onerror=function() {
  837. pupwait(false);
  838. alert('La richiesta è fallita.');
  839. };
  840. }
  841. function pupsavepres(asnew) {
  842. var pres=document.getElementById('presets');
  843. if (pres.value!='null' || asnew) {
  844. var pup=document.getElementById('popup'), inpup=document.getElementById('inpopup');
  845. var prestext=pres.options[pres.selectedIndex].text;
  846. var pre='<p>Se vuoi puoi modificare il nome del preset che stai per sovrascrivere</p>';
  847. if (asnew) pre='<p>Dai un nuovo nome al nuovo preset che stai per salvare</p>';
  848. inpup.innerHTML='<div class="loadsavepresbub">'+pre+'<input type="text" maxlength="256" value="'+hent(prestext)+'" id="presname"><input type="button" value="Salva" onClick="ckpresname('+asnew+');"><input type="button" value="Annulla" onClick="pupoff();"><div id="ckmsg"></div></div>';
  849. pup.style.display='table';
  850. } else {
  851. alerta('Attenzione','<p>Non hai selezionato alcun preset ;)</p>');
  852. }
  853. }
  854. function puprempres() {
  855. var pres=document.getElementById('presets');
  856. if (pres.value!='null') {
  857. var prestext=pres.options[pres.selectedIndex].text;
  858. confirma('<p>Confermi l’eliminazione del preset «'+hent(prestext)+'»?</p>','rempres()');
  859. } else {
  860. alerta('Attenzione','<p>Non hai selezionato alcun preset ;)</p>');
  861. }
  862. }
  863. function ckpresname(asnew) {
  864. var pres=document.getElementById('presets');
  865. var presname=document.getElementById('presname').value;
  866. var ckmsg=document.getElementById('ckmsg');
  867. var ok=true;
  868. var i;
  869. if (presname.trim=='') {
  870. presname='';
  871. ok=false;
  872. ckmsg.innerHTML='Non puoi salvare un preset senza nome';
  873. }
  874. if (!asnew) {
  875. for (i=0; i<pres.options.length; i++) {
  876. if (i!=pres.selectedIndex && presname==pres.options[i].text) {
  877. ok=false;
  878. ckmsg.innerHTML='<p>Esiste già un altro preset con questo nome</p>';
  879. break;
  880. }
  881. }
  882. } else {
  883. for (i=0; i<pres.options.length; i++) {
  884. if (presname==pres.options[i].text) {
  885. ok=false;
  886. ckmsg.innerHTML='<p>Esiste già un preset con questo nome</p>';
  887. break;
  888. }
  889. }
  890. }
  891. if (ok) {
  892. pupoff();
  893. savepres(presname,asnew);
  894. }
  895. }
  896. function pupoff() {
  897. var pup=document.getElementById('popup'), inpup=document.getElementById('inpopup');
  898. inpup.innerHTML='<div id="popupcont">...</div>';
  899. pup.style.display='none';
  900. }
  901. //-->
  902. </script>
  903. </head>
  904. <body>
  905. <nav>
  906. <div id="hmenu">
  907. <ul>
  908. <?php echo($menuout); ?>
  909. </ul>
  910. <div class="mtit">Elenco istanze</div>
  911. <div id="rightdiv">
  912. <img src="<?php echo($filtordimgoff); ?>" id="lente" class="rlinks" title="Mostra il pannello di filtraggio e ordinamento" onclick="shideplancia();">
  913. <img src="<?php echo($notifs['imgoff']); ?>" id="bell" class="rlinks" title="Show notifications" onclick="shidenotifs();">
  914. <img src="imgs/esci.svg" class="rlinks" title="Logout" onclick="document.location.href='logout.php';">
  915. </div>
  916. </div>
  917. </nav>
  918. <?php echo($notifs['div']); ?>
  919. <div id="popup">
  920. <div id="inpopup">
  921. <div id="popupcont">
  922. ...
  923. </div>
  924. </div>
  925. </div>
  926. <div id="footer">
  927. <?php echo($pgout); ?>
  928. </div>
  929. <div id="debug">
  930. <?php echo($dbg); ?>
  931. </div>
  932. <div id="plancia">
  933. <form method="post" id="f" onsubmit="return ckf();">
  934. <table id="planciafil" class="planciatab">
  935. <tr><td colspan="8"><input type="button" id="filbut" value="Aggiungi criteri di filtraggio" class="ctrlbut" onclick="manfil();"></td></tr>
  936. </table>
  937. <table id="planciaord" class="planciatab">
  938. <tr><td colspan="4"><input type="button" id="ordbut" value="Aggiungi criteri di ordinamento" class="ctrlbut" onclick="manord();"></td></tr>
  939. </table>
  940. <table id="planciaothers" class="planciatab">
  941. <tr><td><input type="button" id="subbut" value="Applica" class="ctrlbut" onclick="ckf();"></td></tr>
  942. </table>
  943. <table class="planciatab"><tr><td style="width:1%">Preset: </td><td style="width:95%"><select name="presets" id="presets" class="presets"><?php echo($presopts); ?></select></td><td style="width:1%"><img src="imgs/fresu.svg" class="lilbut" onclick="loadpres();" title="Carica i criteri dal preset selezionato"></td><td style="width:1%"><img src="imgs/fregiu.svg" class="lilbut" onclick="pupsavepres(false);" title="Salva i criteri impostati nel preset selezionato sovrascrivendolo (permette inoltre di rinominarlo) ..."></td><td style="width:1%"><img src="imgs/fregiuplus.svg" class="lilbut" onclick="pupsavepres(true);" title="Salva i criteri impostati come nuovo preset ..."></td><td style="width:1%"><img src="imgs/minus.svg" class="lilbut" onclick="puprempres();" title="Elimina il preset selezionato"></td></tr></table>
  944. <input type="hidden" name="filt" id="filt" value="filt">
  945. </form>
  946. </div>
  947. <script language="JavaScript">
  948. <!--
  949. <?php
  950. echo($jsaddrows);
  951. echo($jssetrows);
  952. echo($jsordaddrows);
  953. echo($jsordsetrows);
  954. ?>
  955. //-->
  956. </script>
  957. <div id="fullscreen">
  958. <div id="middlerow">
  959. <?php echo($out); ?>
  960. </div>
  961. </div>
  962. </body>
  963. </html>