[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qsos-commits] qsos/apps/o3s show.php
From: |
Raphaël Semeteys |
Subject: |
[Qsos-commits] qsos/apps/o3s show.php |
Date: |
Sun, 17 May 2009 22:23:54 +0000 |
CVSROOT: /sources/qsos
Module name: qsos
Changes by: Raphaël Semeteys <rsemeteys> 09/05/17 22:23:54
Modified files:
apps/o3s : show.php
Log message:
Database integration
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qsos/apps/o3s/show.php?cvsroot=qsos&r1=1.1&r2=1.2
Patches:
Index: show.php
===================================================================
RCS file: /sources/qsos/qsos/apps/o3s/show.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- show.php 2 Feb 2007 07:14:33 -0000 1.1
+++ show.php 17 May 2009 22:23:54 -0000 1.2
@@ -1,6 +1,6 @@
<?php
/*
-** Copyright (C) 2007 Atos Origin
+** Copyright (C) 2007-2009 Atos Origin
**
** Author: Raphael Semeteys <address@hidden>
**
@@ -23,15 +23,16 @@
** show.php: show QSOS evaluation(s)
**
*/
-
session_start();
+
+$weights = $_SESSION;
+$is_weighted = $_SESSION["nbWeights"];
+
//Search pattern
$s = $_REQUEST['s'];
-//If there is a search pattern, no weights are to be applied
-$is_weighted = !isset($s);
include("config.php");
-include("locales/$lang.php");
+include("lang.php");
echo "<html>\n";
echo "<head>\n";
@@ -87,13 +88,15 @@
include("libs/QSOSDocument.php");
-//Software family
-$family = $_REQUEST['family'];
-//QSOS XML files to be displayed
-$files = $_REQUEST['f'];
+//Ids of QSOS XML files to be displayed
+$ids = $_REQUEST['id'];
//Are graphs to be generated in SVG?
$svg = $_REQUEST['svg'];
+function janitize($text) {
+ return str_replace("\n",'',$text);
+}
+
if (isset($s)) {
echo "<body onload=\"highlightSearchTerms('$s');\">\n";
} else {
@@ -104,17 +107,29 @@
echo "<br/><br/>\n";
echo "<div style='font-weight: bold'>".$msg['s4_title']."<br/><br/>\n";
-echo "<form id='myForm' method='POST' action='radar.php'>\n";
-
-$weights = $_SESSION;
+$IdDB = mysql_connect($db_host ,$db_user, $db_pwd);
+mysql_select_db($db_db);
-foreach($files as $file) {
- echo "<input type='hidden' name='f[]' value='$file'/>\n";
-}
-echo "<input type='hidden' name='svg' value='$svg'/>\n";
-echo "<input type='hidden' name='c' id='c' value=''/>\n";
-echo "<input type='hidden' name='family' value='$family'/>\n";
-echo "<input type='hidden' name='s' value='$s'/>\n";
+$query = "SELECT id FROM evaluations WHERE appname <> '' AND language =
'$lang'";
+$IdReq = mysql_query($query, $IdDB);
+$allIds = array();
+while($row = mysql_fetch_row($IdReq)) {
+ array_push($allIds, $row[0]);
+}
+
+$files = array();
+foreach($ids as $id) {
+ if (!(in_array($id,$allIds))) die($id.$msg['s4_err_no_id']);
+ $query = "SELECT file FROM evaluations WHERE id = \"$id\"";
+ $IdReq = mysql_query($query, $IdDB);
+ $result = mysql_fetch_row($IdReq);
+ array_push($files, $result[0]);
+}
+
+//echo "<form id='myForm' method='POST' action='radar.php'>\n";
+//echo "<input type='hidden' name='svg' value='$svg'/>\n";
+//echo "<input type='hidden' name='c' id='c' value=''/>\n";
+//echo "<input type='hidden' name='s' value='$s'/>\n";
$num = count($files);
$myDoc = array();
@@ -133,11 +148,12 @@
$i++;
}
-$familyname = $myDoc[0]->getkey("qsosappfamily");
+$family = $myDoc[0]->getkey("qsosappfamily");
+$qsosspecificformat = $myDoc[0]->getkey("qsosspecificformat");
$f = "";
-foreach($files as $file) {
- $f .= "f[]=$file&";
+foreach($ids as $id) {
+ $f .= "id[]=$id&";
}
echo "<table>\n";
@@ -158,29 +174,30 @@
border=0
onmouseover=\"return escape('Increase font size')\"/>";
echo "</a>\n";
-if ($is_weighted) {
- echo " <a href='radar.php?family=$family&".$f."svg=$svg'>";
+if (!isset($s)) {
+ echo " <a href='radar.php?lang=$lang&".$f."svg=$svg'>";
echo "<img src='skins/$skin/graph.png'
border=0 onmouseover=\"return escape('Show graph')\"/>";
echo "</a>\n";
}
echo "</td></tr>\n";
echo "<tr><td align='center'>\n";
-if ($is_weighted) {
- echo "<input type='button'
- value='".$msg['s4_button_back']
- ."'
onclick='location.href=\"software.php?family=".$family."&svg=$svg\"'><br/><br/>";
-} else {
+if (isset($s)) {
echo "<input type='button'
value='".$msg['s4_button_back_alt']
."' onclick='location.href=\"search.php?s=$s\"'><br/><br/>";
+} else {
+ echo "<input type='button'
+ value='".$msg['s4_button_back']
+ ."'
onclick='location.href=\"list.php?lang=$lang&family=".$family."&qsosspecificformat=$qsosspecificformat&svg=$svg\"'><br/><br/>";
}
+
echo "</td></tr>\n";
echo "</table>\n";
-echo "<table id='table' style='border-collapse: collapse; font-size: 12pt;
table-layout: fixed'>\n";
+echo "<table id='table' style='font-size: 12pt; table-layout: fixed'>\n";
echo "<tr class='title' style='width: 250px'>\n";
-echo "<td rowspan='2'><div style='text-align:
center'>$familyname</div></td>\n";
+echo "<td rowspan='2'><div style='text-align: center'>$family</div></td>\n";
echo "<td style='width: 30px' rowspan='2'>";
if ($is_weighted) {
echo "<img src='skins/$skin/graph.png' border='' style='cursor:
pointer' onclick='submitForm(\"\")'/>";
@@ -203,9 +220,12 @@
echo "</table>\n";
function showtree($myDoc, $trees, $depth, $idP, $weights) {
+ global $id, $f;
+ global $files;
global $svg;
global $is_weighted;
global $skin;
+ global $lang;
$new_depth = $depth + 1;
$offset = $new_depth*10;
$idF = 0;
@@ -219,12 +239,12 @@
$idF++;
if ($idP == '') {
- $id = $idF;
+ $idDOM = $idF;
} else {
- $id = $idP."-".$idF;
+ $idDOM = $idP."-".$idF;
}
- echo "<tr id='$id'
+ echo "<tr id='$idDOM'
name='$name'
class='level$depth'
onmouseover=\"this.setAttribute('class','highlight')\"
@@ -235,15 +255,8 @@
</td>\n";
echo "<td style='width: 30px'>";
if ($myDoc[0]->hassubelements($name) > 2) {
- $files = $_REQUEST['f'];
- $f = "";
- foreach($files as $file) {
- $f .= "f[]=$file&";
- }
- if ($is_weighted) {
- echo "<img src='skins/$skin/graph.png'
- border=''
- style='cursor: pointer'
onclick='submitForm(\"$name\")'/>\n";
+ if (!isset($s)) {
+ echo "<a href='radar.php?lang=$lang&".$f."c=$name&svg=$svg'><img
src='skins/$skin/graph.png' border='' style='cursor: pointer'/></a>\n";
}
}
} else {
@@ -257,7 +270,7 @@
$desc = addslashes($myDoc[$i]->getgeneric($name,
"desc".$trees[$i][$k]->score));
if ($desc != "") {
echo "<td class='score'
- style='width: 60px; cursor:help'
onmouseover=\"return escape('".$desc."')\">
+ style='width: 60px; cursor:help' onmouseover=\"return
escape('".janitize($desc)."')\">
<div style='text-align: center'>"
.$trees[$i][$k]->score
."</div></td>\n";
@@ -268,33 +281,32 @@
.$trees[$i][$k]->score
."</div></td>\n";
}
- if ($is_weighted) {
+ if (!$is_weighted) {
+ $weights[$name] = 1;
+ $_SESSION[$name] = $weights[$name];
+ }
echo "<td>
<div style='text-align: center'>"
.$weights[$name]
."</div></td>\n";
- } else {
- echo "<td>
- <div style='text-align: center'>1</div>
- </td>\n";
- }
+
echo "<td id='comment'>
<div style='width: 300px'>"
.$myDoc[$i]->getgeneric($name,
"comment")
."</div></td>\n";
}
echo "</tr>\n";
-;
+
if ($subtree) {
for($i=0; $i<count($trees); $i++) {
$subtrees[$i] = $trees[$i][$k]->children;
}
- showtree($myDoc, $subtrees, $new_depth, $id, $weights);
+ showtree($myDoc, $subtrees, $new_depth, $idDOM, $weights);
}
}
}
-echo "</form>";
+//echo "</form>";
echo "<br/>";
echo $msg['g_license_notice'];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qsos-commits] qsos/apps/o3s show.php,
Raphaël Semeteys <=