qsos-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qsos-commits] qsos/apps/o3s Changes export_oo.php list.php me...


From: Raphaël Semeteys
Subject: [Qsos-commits] qsos/apps/o3s Changes export_oo.php list.php me...
Date: Thu, 25 Feb 2010 21:54:54 +0000

CVSROOT:        /sources/qsos
Module name:    qsos
Changes by:     Raphaël Semeteys <rsemeteys>    10/02/25 21:54:54

Modified files:
        apps/o3s       : Changes export_oo.php list.php metadata.php 
                         software.php template.zip 
Added files:
        apps/o3s       : create-db.sql favicon.ico freemind.php 
                         quadrant.php upload.php 

Log message:
        Database backend
        QSOS Quadrant
        Freemind export

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qsos/apps/o3s/Changes?cvsroot=qsos&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/qsos/apps/o3s/export_oo.php?cvsroot=qsos&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/qsos/apps/o3s/list.php?cvsroot=qsos&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/qsos/apps/o3s/metadata.php?cvsroot=qsos&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/qsos/apps/o3s/software.php?cvsroot=qsos&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/qsos/apps/o3s/template.zip?cvsroot=qsos&rev=1.2
http://cvs.savannah.gnu.org/viewcvs/qsos/apps/o3s/create-db.sql?cvsroot=qsos&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/qsos/apps/o3s/favicon.ico?cvsroot=qsos&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/qsos/apps/o3s/freemind.php?cvsroot=qsos&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/qsos/apps/o3s/quadrant.php?cvsroot=qsos&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/qsos/apps/o3s/upload.php?cvsroot=qsos&rev=1.1

Patches:
Index: Changes
===================================================================
RCS file: /sources/qsos/qsos/apps/o3s/Changes,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Changes     17 May 2009 22:35:24 -0000      1.1
+++ Changes     25 Feb 2010 21:54:54 -0000      1.2
@@ -3,4 +3,7 @@
 1.0 2007/02/02
 
 1.1 2009/05/17
-  - 
\ No newline at end of file
+  - New database backend for evaluations metadata
+  - Better localization (user can change locale from the GUI)
+  - ODF export for multiple evaluations of the same family
+  - Several bugfixes
\ No newline at end of file

Index: export_oo.php
===================================================================
RCS file: /sources/qsos/qsos/apps/o3s/export_oo.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- export_oo.php       17 May 2009 22:04:47 -0000      1.2
+++ export_oo.php       25 Feb 2010 21:54:54 -0000      1.3
@@ -51,7 +51,7 @@
   return str_replace(".", "-", $output);
 }
 
-function createCell($style, $type, $value, $formula=false) {
+function createCell($style, $type, $value, $formula=false, $validator=false) {
   global $output;
 
   //HACK: & caracter causes an error because of HTML entities
@@ -67,6 +67,10 @@
   } else {
     $cell->setAttribute("table:formula",$formula);
   }
+  if ($validator) {
+    $cell->setAttribute("table:content-validation-name",$validator);
+  }
+
   return $cell;
 }
 
@@ -132,7 +136,8 @@
     //Criterion
     $row->appendChild(createCell($style_title, "string", $title));
 
-    //Desc0, 1 and 2
+    //Desc, Desc0, 1 and 2
+    $row->appendChild(createCell($style_title, "string", 
$input->getgeneric($name, "desc")));
     $row->appendChild(createCell($style_title, "string", 
$input->getgeneric($name, "desc0")));
     $row->appendChild(createCell($style_title, "string", 
$input->getgeneric($name, "desc1")));
     $row->appendChild(createCell($style_title, "string", 
$input->getgeneric($name, "desc2")));
@@ -211,11 +216,11 @@
     $table0->appendChild($row);
     //Weight
     $weight = isset($_SESSION[$name])?$_SESSION[$name]:1;
-    $row->appendChild(createCell($style_weight, "float", $weight));
+    $row->appendChild(createCell($style_weight, "float", $weight, false, 
"val1"));
     //Scores
     foreach($ids as $id) {
       $name = getTableName($id);
-      $num = $numrow + 6;
+      $num = $numrow + 7;
       $row->appendChild(createCell($style_score, "string", null, 
"oooc:=['$name'.C$num]"));
       $table0->appendChild($row);
     }
@@ -297,7 +302,7 @@
     $score = createCell($style_score, "float", $element->score);
     $row->appendChild($score);
     //Weight
-    $num = $numrow - 6;
+    $num = $numrow - 7;
     $row->appendChild(createCell($style_weight, "float", null, 
"oooc:=['".$msg['ods_synthesis']."'.B$num]"));
     $table1->appendChild($row);
 
@@ -326,7 +331,6 @@
   global $output;
   $row = $output->createElement('table:table-row');
   $row->setAttribute("table:style-name","ro1");
-  $row->setAttribute("table:number-rows-repeated","2");
   $cell = $output->createElement('table:table-cell');
   $cell->setAttribute("table:style-name","Default");
   $cell->setAttribute("table:number-columns-repeated","4");
@@ -357,6 +361,84 @@
   return $row;
 }
 
+function createTitleRow1() {
+  global $output;
+  global $msg;
+  
+  $row = $output->createElement('table:table-row');
+  $row->setAttribute("table:style-name","ro1");
+  $cell = $output->createElement('table:table-cell');
+  $cell->setAttribute("table:style-name","ce15");
+  $cell->setAttribute("office:value-type","string");
+  $text = $output->createElement('text:p',$msg['ods_header']);
+  $cell->appendChild($text);
+  $row->appendChild($cell);
+  
+  return $row;
+}
+
+function createTitleRow2($title) {
+  global $output;
+  
+  $row = $output->createElement('table:table-row');
+  $row->setAttribute("table:style-name","ro1");
+  $cell = $output->createElement('table:table-cell');
+  $cell->setAttribute("table:style-name","ce14");
+  $cell->setAttribute("office:value-type","string");
+  $text = $output->createElement('text:p',$title);
+  $cell->appendChild($text);
+  $row->appendChild($cell);
+  
+  return $row;
+}
+
+function createTitleRow3($title) {
+  global $output;
+  
+  $row = $output->createElement('table:table-row');
+  $row->setAttribute("table:style-name","ro1");
+  $cell = $output->createElement('table:table-cell');
+  $cell->setAttribute("table:style-name","ce13");
+  $cell->setAttribute("office:value-type","string");
+  $text = $output->createElement('text:p',$title);
+  $cell->appendChild($text);
+  $row->appendChild($cell);
+  
+  return $row;
+}
+
+function createValidator() {
+  global $output;
+  global $msg;
+  
+  $validators = $output->createElement('table:content-validations');
+  
+  $validator = $output->createElement('table:content-validation');
+  $validator->setAttribute("table:name","val1");
+  
$validator->setAttribute("table:condition","oooc:cell-content-is-whole-number() 
and cell-content()>=0");
+  $validator->setAttribute("table:allow-empty-cell","false");
+  
$validator->setAttribute("table:base-cell-address",$msg['ods_synthesis']."B6");
+  
+  $help = $output->createElement('table:help-message');
+  $help->setAttribute("table:title",$msg['ods_val_title']);
+  $help->setAttribute("table:display","true");
+  $text = $output->createElement('text:p',$msg['ods_val_helpmsg']);
+  $help->appendChild($text);
+  $validator->appendChild($help);
+  
+  $error = $output->createElement('table:error-message');
+  $error->setAttribute("table:message-type","stop");
+  $error->setAttribute("table:title",$msg['ods_val_error']);
+  $error->setAttribute("table:display","true");
+  $text = $output->createElement('text:p',$msg['ods_val_errormsg']);
+  $error->appendChild($text);
+  $validator->appendChild($error);
+
+  $validators->appendChild($validator);
+
+  return $validators;
+}
+
 function createFont($fontFamily) {
   global $output;
   $font = $output->createElement('style:font-face');
@@ -391,7 +473,7 @@
   return $style;
 }
 
-function createCellStyle($name, $wrap, $backgroundColor, $textAlignSource, 
$repeatContent, $verticalALign, $textAlign, $marginLeft, $fontColor, 
$fontWeight, $border) {
+function createCellStyle($name, $wrap, $backgroundColor, $textAlignSource, 
$repeatContent, $verticalALign, $textAlign, $marginLeft, $fontColor, 
$fontWeight, $border, $fontSize, $fontStyle) {
   global $output;
   $style = $output->createElement('style:style');
   $style->setAttribute("style:name",$name);
@@ -416,10 +498,12 @@
     $style->appendChild($substyle);
   }
 
-  if (isset($fontColor) || isset($fontWeight)) {
+  if (isset($fontColor) || isset($fontWeight) || isset($fontSize) || 
isset($fontStyle)) {
     $substyle = $output->createElement('style:text-properties');
     if (isset($fontColor)) $substyle->setAttribute("fo:color",$fontColor);
     if (isset($fontWeight)) 
$substyle->setAttribute("fo:font-weight",$fontWeight);
+    if (isset($fontSize)) 
$substyle->setAttribute("fo:font-size",$fontSize."pt");
+    if (isset($fontStyle)) $substyle->setAttribute("fo:font-style",$fontStyle);
     $style->appendChild($substyle);
   }
 
@@ -445,16 +529,23 @@
     $table0->appendChild(createColumn("co0","ce7"));
   }
 
-  $table0->appendChild(createSimpleRow());
-
-  //Software family
-  
$table0->appendChild(createHeaderRow($msg['ods_softwarefamily'],$input->getkey("qsosappfamily")));
+  //Title
+  $table0->appendChild(createTitleRow1());
+  $table0->appendChild(createTitleRow2($input->getkey("qsosappfamily")));
+  $table0->appendChild(createTitleRow3($msg['ods_synthesis_title']));
 
-  //QSOS version
-  
$table0->appendChild(createHeaderRow($msg['ods_qsosversion'],$input->getkey("qsosformat")));
+  $table0->appendChild(createSimpleRow());
 
-  //Template version
-  
$table0->appendChild(createHeaderRow($msg['ods_templateversion'],$input->getkey("qsosspecificformat")));
+  //Note on weight modification
+  $row = $output->createElement('table:table-row');
+  $row->setAttribute("table:style-name","ro1");
+  $cell = $output->createElement('table:table-cell');
+  $cell->setAttribute("table:style-name","ce16");
+  $cell->setAttribute("office:value-type","string");
+  $text = $output->createElement('text:p',$msg['ods_note_weight']);
+  $cell->appendChild($text);
+  $row->appendChild($cell);
+  $table0->appendChild($row);
 
   $table0->appendChild(createSimpleRow());
 
@@ -462,7 +553,7 @@
   $row = $output->createElement('table:table-row');
   $row->setAttribute("table:style-name","ro1");
   $cell = $output->createElement('table:table-cell');
-  $cell->setAttribute("table:style-name","ce2");
+  $cell->setAttribute("table:style-name","ce11");
   $cell->setAttribute("office:value-type","string");
   $text = $output->createElement('text:p',$msg['ods_criterion']);
   $cell->appendChild($text);
@@ -470,7 +561,7 @@
   
   //Weight
   $cell = $output->createElement('table:table-cell');
-  $cell->setAttribute("table:style-name","ce5");
+  $cell->setAttribute("table:style-name","ce12");
   $cell->setAttribute("office:value-type","string");
   $text = $output->createElement('text:p',$msg['ods_weight']);
   $cell->appendChild($text);
@@ -480,7 +571,7 @@
   foreach($ids as $id) {
     $name = getTableName($id);
     $cell = $output->createElement('table:table-cell');
-    $cell->setAttribute("table:style-name","ce5");
+    $cell->setAttribute("table:style-name","ce12");
     $cell->setAttribute("office:value-type","string");
     $text = $output->createElement('text:p',$name);
     $cell->appendChild($text);
@@ -506,11 +597,14 @@
   $table0->appendChild(createColumn("co0","ce4"));
   $table0->appendChild(createColumn("co0","ce4"));
   $table0->appendChild(createColumn("co0","ce4"));
+  $table0->appendChild(createColumn("co0","ce4"));
 
-  $table0->appendChild(createSimpleRow());
+  //Title
+  $table0->appendChild(createTitleRow1());
+  $table0->appendChild(createTitleRow2($input->getkey("qsosappfamily")));
+  $table0->appendChild(createTitleRow3($msg['ods_citeria_title']));
 
-  //Software family
-  
$table0->appendChild(createHeaderRow($msg['ods_softwarefamily'],$input->getkey("qsosappfamily")));
+  $table0->appendChild(createSimpleRow());
 
   //QSOS version
   
$table0->appendChild(createHeaderRow($msg['ods_qsosversion'],$input->getkey("qsosformat")));
@@ -524,25 +618,31 @@
   $row = $output->createElement('table:table-row');
   $row->setAttribute("table:style-name","ro1");
   $cell = $output->createElement('table:table-cell');
-  $cell->setAttribute("table:style-name","ce2");
+  $cell->setAttribute("table:style-name","ce11");
   $cell->setAttribute("office:value-type","string");
   $text = $output->createElement('text:p',$msg['ods_criterion']);
   $cell->appendChild($text);
   $row->appendChild($cell);
   $cell = $output->createElement('table:table-cell');
-  $cell->setAttribute("table:style-name","ce2");
+  $cell->setAttribute("table:style-name","ce11");
+  $cell->setAttribute("office:value-type","string");
+  $text = $output->createElement('text:p',$msg['ods_desc']);
+  $cell->appendChild($text);
+  $row->appendChild($cell);
+  $cell = $output->createElement('table:table-cell');
+  $cell->setAttribute("table:style-name","ce12");
   $cell->setAttribute("office:value-type","string");
   $text = $output->createElement('text:p',$msg['ods_score0']);
   $cell->appendChild($text);
   $row->appendChild($cell);
   $cell = $output->createElement('table:table-cell');
-  $cell->setAttribute("table:style-name","ce2");
+  $cell->setAttribute("table:style-name","ce12");
   $cell->setAttribute("office:value-type","string");
   $text = $output->createElement('text:p',$msg['ods_score1']);
   $cell->appendChild($text);
   $row->appendChild($cell);
   $cell = $output->createElement('table:table-cell');
-  $cell->setAttribute("table:style-name","ce2");
+  $cell->setAttribute("table:style-name","ce12");
   $cell->setAttribute("office:value-type","string");
   $text = $output->createElement('text:p',$msg['ods_score2']);
   $cell->appendChild($text);
@@ -567,6 +667,12 @@
   $table1->appendChild(createColumn("co3","ce7"));
   $table1->appendChild(createColumn("co4","ce7"));
 
+  //Title
+  $header = $msg['ods_evaluation_title'].$input->getkey("appname")." 
".$input->getkey("release");
+  $table1->appendChild(createTitleRow1());
+  $table1->appendChild(createTitleRow2($input->getkey("qsosappfamily")));
+  $table1->appendChild(createTitleRow3($header));
+
   $table1->appendChild(createSimpleRow());
 
   //Header
@@ -576,9 +682,6 @@
   //Release
   
$table1->appendChild(createHeaderRow($msg['ods_release'],$input->getkey("release")));
 
-  //Software family
-  
$table1->appendChild(createHeaderRow($msg['ods_softwarefamily'],$input->getkey("qsosappfamily")));
-
   //License
   
$table1->appendChild(createHeaderRow($msg['ods_license'],$input->getkey("licensedesc")));
 
@@ -611,25 +714,25 @@
   $row = $output->createElement('table:table-row');
   $row->setAttribute("table:style-name","ro1");
   $cell = $output->createElement('table:table-cell');
-  $cell->setAttribute("table:style-name","ce2");
+  $cell->setAttribute("table:style-name","ce11");
   $cell->setAttribute("office:value-type","string");
   $text = $output->createElement('text:p',$msg['ods_criterion']);
   $cell->appendChild($text);
   $row->appendChild($cell);
   $cell = $output->createElement('table:table-cell');
-  $cell->setAttribute("table:style-name","ce2");
+  $cell->setAttribute("table:style-name","ce11");
   $cell->setAttribute("office:value-type","string");
   $text = $output->createElement('text:p',$msg['ods_comment']);
   $cell->appendChild($text);
   $row->appendChild($cell);
   $cell = $output->createElement('table:table-cell');
-  $cell->setAttribute("table:style-name","ce5");
+  $cell->setAttribute("table:style-name","ce12");
   $cell->setAttribute("office:value-type","string");
   $text = $output->createElement('text:p',$msg['ods_score']);
   $cell->appendChild($text);
   $row->appendChild($cell);
   $cell = $output->createElement('table:table-cell');
-  $cell->setAttribute("table:style-name","ce5");
+  $cell->setAttribute("table:style-name","ce12");
   $cell->setAttribute("office:value-type","string");
   $text = $output->createElement('text:p',$msg['ods_weight']);
   $cell->appendChild($text);
@@ -696,16 +799,22 @@
   $style->appendChild($substyle);
   $styles->appendChild($style);
   //Cell styles
-  $styles->appendChild(createCellStyle("ce1", "wrap", null, null, null, 
"middle", null, null, "#ffffff", null, null));
-  $styles->appendChild(createCellStyle("ce2", "wrap", "#2323dc", null, null, 
"middle", null, null, "#ffffff", "bold", true));
-  $styles->appendChild(createCellStyle("ce3", "wrap", "#99ccff", null, null, 
"middle", null, null, null, null, true));
-  $styles->appendChild(createCellStyle("ce4","wrap","#ccffff", null, 
null,"middle", null, null, null, null, true));
-  $styles->appendChild(createCellStyle("ce5", null, "#2323dc", "fix", "false", 
"middle", "center", "0cm", "#ffffff", "bold", true));
-  $styles->appendChild(createCellStyle("ce6", null, "#99ccff", "fix", "false", 
"middle", "center", "0cm", null, null, true));
-  $styles->appendChild(createCellStyle("ce7", null, "#ccffff", "fix", "false", 
"middle", "center", "0cm", null, null, true));
-  $styles->appendChild(createCellStyle("ce8", "wrap", null, "fix", "false", 
"middle", null, null, null, null, true));
-  $styles->appendChild(createCellStyle("ce9", null, null, "fix", "false", 
"middle", "center", "0cm", null, null, true));
-  $styles->appendChild(createCellStyle("ce10", "wrap", null, "fix", "false", 
"middle", null, null, null, null, null));
+  $styles->appendChild(createCellStyle("ce1", "wrap", null, null, null, 
"middle", null, null, "#ffffff", null, null, null, null));
+  $styles->appendChild(createCellStyle("ce2", "wrap", "#2323dc", null, null, 
"middle", null, null, "#ffffff", "bold", true, null, null));
+  $styles->appendChild(createCellStyle("ce3", "wrap", "#99ccff", null, null, 
"middle", null, null, null, null, true, null, null));
+  $styles->appendChild(createCellStyle("ce4","wrap","#ccffff", null, 
null,"middle", null, null, null, null, true, null, null));
+  $styles->appendChild(createCellStyle("ce5", null, "#2323dc", "fix", "false", 
"middle", "center", "0cm", "#ffffff", "bold", true, null, null));
+  $styles->appendChild(createCellStyle("ce6", null, "#99ccff", "fix", "false", 
"middle", "center", "0cm", null, null, true, null, null));
+  $styles->appendChild(createCellStyle("ce7", null, "#ccffff", "fix", "false", 
"middle", "center", "0cm", null, null, true, null, null));
+  $styles->appendChild(createCellStyle("ce8", "wrap", null, "fix", "false", 
"middle", null, null, null, null, true, null, null));
+  $styles->appendChild(createCellStyle("ce9", null, null, "fix", "false", 
"middle", "center", "0cm", null, null, true, null, null));
+  $styles->appendChild(createCellStyle("ce10", "wrap", null, "fix", "false", 
"middle", null, null, null, null, null, null, null));
+  $styles->appendChild(createCellStyle("ce11", "wrap", "#000000", null, null, 
"middle", null, null, "#ffffff", "bold", true, null, null));
+  $styles->appendChild(createCellStyle("ce12", "wrap", "#000000", null, null, 
"middle", "center", null, "#ffffff", "bold", true, null, null));
+  $styles->appendChild(createCellStyle("ce13", null, null, null, null, 
"middle", null, null, "#000000", "bold", null, null, null));
+  $styles->appendChild(createCellStyle("ce14", null, null, null, null, 
"middle", null, null, "#000000", "bold", null, 12, null));
+  $styles->appendChild(createCellStyle("ce15", null, null, null, null, 
"middle", null, null, "#000000", "bold", null, 14, null));
+  $styles->appendChild(createCellStyle("ce16", null, null, null, null, 
"middle", null, null, "#000000", null, null, null, "italic"));
   $document->appendChild($styles);
   
   return $document;
@@ -734,6 +843,9 @@
   $body = $output->createElement('office:body');
   $spreadsheet = $output->createElement('office:spreadsheet');
   
+  //Validator for weight values
+  $spreadsheet->appendChild(createValidator());
+  
   $IdDB = mysql_connect($db_host ,$db_user, $db_pwd);
   mysql_select_db($db_db);
   $query = "SELECT file FROM evaluations WHERE id = \"$ids[0]\"";
@@ -744,7 +856,7 @@
   //Synthesis Sheet
   $input = new QSOSDocument("$file");
   initSynthesisSheet();
-  $numrow = 8; //Reinit row counter
+  $numrow = 7; //Reinit row counter
   createTreeSynthesis($input->getTree(), $table0, 0);
   $spreadsheet->appendChild($table0);
   

Index: list.php
===================================================================
RCS file: /sources/qsos/qsos/apps/o3s/list.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- list.php    17 May 2009 22:12:27 -0000      1.1
+++ list.php    25 Feb 2010 21:54:54 -0000      1.2
@@ -75,6 +75,11 @@
   }
 }
 
+function showFreeMind() {
+    myForm.action = "freemind.php";
+    myForm.submit();
+}
+
 function exportODS() {
   if (checkboxes() == true) {
     myForm.action = "export_oo.php";
@@ -93,6 +98,15 @@
   }
 }
 
+function showQuadrant() {
+  if (checkboxes() == true) {
+    myForm.action = "quadrant.php";
+    myForm.submit();
+  } else {
+    alert("<? echo $msg['s3_err_js_no_file']; ?>");
+  }
+}
+
 function setWeights() {
   myForm.action = "set_weighting.php";
   myForm.submit();
@@ -142,6 +156,7 @@
 
 $query = "SELECT DISTINCT appname FROM evaluations WHERE qsosappfamily = 
\"$family\" AND qsosspecificformat = '$qsosspecificformat' ORDER BY appname";
 $IdReq = mysql_query($query, $IdDB);
+
 while($appname = mysql_fetch_row($IdReq)) {
   echo "<tr class='level0'><td colspan='7'>$appname[0]</td></tr>\n";
   $query2 = "SELECT id, e.release, qsosspecificformat, licensedesc,  
criteria_scored/criteria_scorable, criteria_commented/comments, file FROM 
evaluations e WHERE appname = \"$appname[0]\" ORDER BY e.release";
@@ -168,13 +183,16 @@
 echo "</table><br/>";
 echo "<input type='button' value='".$msg['s3_set_weights']."' 
onclick='setWeights()'>";
 echo "&nbsp;";
+echo "<input type='button' value='".$msg['s3_show_mindmap']."' 
onclick='showFreeMind()'>";
+echo "<br/><br/>";
 echo "<input type='button' value='".$msg['s3_format_odf']."' 
onclick='exportODS()'>";
 echo "&nbsp;";
 echo "<input type='button' value='".$msg['s3_button_next']."' 
onclick='submitForm()'>";
 echo "<br/><br/>";
 echo $msg['s3_check_svg'].
   " <input id='check' type='checkbox' name='svg' value='yes' 
onclick='toggleSVG()' svg='on' checked><br/><br/>";
-echo "<input type='button' value='".$msg['s3_graph']."' 
onclick='showGraph()'>";
+echo "<input type='button' value='".$msg['s3_graph']."' 
onclick='showGraph()'><br/><br/>";
+echo "<input type='button' value='".$msg['s3_quadrant']."' 
onclick='showQuadrant()'>";
 echo "</form></div>\n";
 
 echo "</center>\n";

Index: metadata.php
===================================================================
RCS file: /sources/qsos/qsos/apps/o3s/metadata.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- metadata.php        17 May 2009 22:13:36 -0000      1.1
+++ metadata.php        25 Feb 2010 21:54:54 -0000      1.2
@@ -25,15 +25,12 @@
 */
 
 include("config.php");
-include("locales/$lang.php");
-
-echo "<html>\n";
-echo "<head>\n";
-echo "<LINK REL=StyleSheet HREF='skins/$skin/o3s.css' TYPE='text/css'/>\n";
-echo "</head>\n";
-
+include("lang.php");
 include("libs/QSOSDocument.php");
 
+$IdDB = mysql_connect($db_host ,$db_user, $db_pwd);
+mysql_select_db($db_db);
+
 //$file: filename (or URI) of the QSOS document to load
 //Returns: array with metadata
 function getmetadata($file) {
@@ -89,25 +86,32 @@
        return (isset($array) ? $array : false);
 }
 
-$evaluations = retrieveTree($sheet, $sheet);
+echo "<html>\n";
+echo "<head>\n";
+echo "<LINK REL=StyleSheet HREF='skins/$skin/o3s.css' TYPE='text/css'/>\n";
+echo "</head>\n";
 
-$IdDB = mysql_connect($db_host ,$db_user, $db_pwd);
-mysql_select_db($db_db);
+echo "<body>\n";
+echo "<center>\n";
+echo "<img src='skins/$skin/o3s.png'/>\n";
+echo "<br/><br/>\n";
+
+echo "<div style='font-weight: bold'>Metadata repository 
update<br/><br/></div>\n";
 
+echo "Output: <div style='font-size: small; text-align: left; width: 50%; 
background-color: lightgrey'>";
 $query = "TRUNCATE TABLE evaluations";
 if ($IdReq = mysql_query($query, $IdDB)) {
-  echo "Meta données supprimées<br/>";
+  echo "Metadata deleted.<br/>";
 } else {
-  echo "Erreur lors de la suppression des meta données...<br/>";
+  echo "Error while deleting metadata...<br/>";
 }
   
+$evaluations = retrieveTree($sheet, $sheet);
+
 foreach ($evaluations as $evaluation) {
   $id = end(explode($delim, $evaluation));
-
   $m = getmetadata($evaluation);
-//   echo "<pre>";
-//   print_r($m);
-//   echo "</pre>";
+  
   $query = "INSERT INTO evaluations VALUES (\"$id\", 
   \"".$m['qsosappfamily']."\",
   \"".$m['qsosspecificformat']."\",
@@ -129,9 +133,17 @@
   ".$m['comments']['notcommented'].")";
   
   if ($IdReq = mysql_query($query, $IdDB)) {
-    echo $m['appname']." enregistré en base<br/>";
+    echo $m['appname']." proceeded.<br/>";
   } else {
-    echo "Erreur d'écriture dans la base...<br/>";
+    echo "Error while inserting in database...<br/>";
   }
 }
+
+echo "</div>";
+echo "<br/><input type='button' value='Back to o3s' 
onclick=\"window.location='index.php'\">";
+echo " <input type='button' value='Upload evaluations' 
onclick=\"window.location='upload.php'\">";
+
+echo "</center>\n";
+echo "</body>\n";
+echo "</html>\n";
 ?>
\ No newline at end of file

Index: software.php
===================================================================
RCS file: /sources/qsos/qsos/apps/o3s/software.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- software.php        8 Jul 2007 23:21:09 -0000       1.2
+++ software.php        25 Feb 2010 21:54:54 -0000      1.3
@@ -26,8 +26,7 @@
 
 session_start();
 include("config.php");
-include("fs.functions.php");
-include("locales/$lang.php");
+include("lang.php");
 
 echo "<html>\n";
 echo "<head>\n";
@@ -86,9 +85,31 @@
        }
 }
 
-$tree = retrieveLocalizedTree($sheet.$delim.$family, $locale);
+$tree= retrieveTree($sheet.$delim.$family); 
 $keys = array_keys($tree);
 
+function retrieveTree($path)  {
+  global $delim;
+  
+  if (address@hidden($path)) {
+  while (($element=readdir($dir))!== false) {
+    if (is_dir($path.$delim.$element) 
+    && $element != "." 
+    && $element != ".." 
+    && $element != "CVS" 
+    && $element != "template" 
+    && $element != "templates" 
+    && $element != ".svn") {
+      $array[$element] = retrieveTree($path.$delim.$element);
+    } elseif (substr($element, -5) == ".qsos") {
+      $array[] = $element;
+    }
+  }
+  closedir($dir);
+  }
+  return (isset($array) ? $array : false);
+}
+
 echo "<div style='font-weight: bold'>".
        $msg['s3_title'].
        "<br/><br/>\n";

Index: template.zip
===================================================================
RCS file: /sources/qsos/qsos/apps/o3s/template.zip,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
Binary files /tmp/cvsG8E3CE and /tmp/cvsMS1jWD differ

Index: create-db.sql
===================================================================
RCS file: create-db.sql
diff -N create-db.sql
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ create-db.sql       25 Feb 2010 21:54:54 -0000      1.1
@@ -0,0 +1,21 @@
+CREATE TABLE `evaluations` (                      
+  `id` varchar(80) character set latin1 NOT NULL COMMENT 'UID (filename)',
+  `qsosappfamily` varchar(50) character set latin1 NOT NULL COMMENT 'software 
family',
+  `qsosspecificformat` varchar(5) character set latin1 NOT NULL,               
       
+  `qsosappname` varchar(50) character set latin1 NOT NULL default 'noname' 
COMMENT 'Short application name',
+  `release` varchar(15) character set latin1 NOT NULL default '0',             
                             
+  `appname` varchar(80) character set latin1 NOT NULL default 'noname' COMMENT 
'Long application name',     
+  `language` varchar(5) character set latin1 NOT NULL COMMENT 'Language on two 
characters',                 
+  `file` varchar(100) character set latin1 NOT NULL,                           
                             
+  `licensedesc` varchar(50) character set latin1 NOT NULL COMMENT 'License 
name',                           
+  `creation` varchar(8) character set latin1 default NULL,                     
                             
+  `validation` varchar(8) character set latin1 default NULL,                   
                             
+  `sections` tinyint(4) default NULL COMMENT 'Number of sections',             
                             
+  `criteria` tinyint(4) default NULL COMMENT 'Total number of criteria',       
                             
+  `criteria_scorable` tinyint(4) default NULL COMMENT 'Number of scorable 
criteria',                        
+  `criteria_scored` tinyint(4) default NULL COMMENT 'Number of criteria 
actually scored',                   
+  `criteria_notscored` tinyint(4) default NULL COMMENT 'Number of criteria not 
yet scored',                 
+  `comments` tinyint(4) default NULL COMMENT 'Number of criteria that could be 
commented',                  
+  `criteria_commented` tinyint(4) default NULL COMMENT 'Number of commented 
criteria',                      
+  `criteria_notcommented` tinyint(4) default NULL                              
                             
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
\ No newline at end of file

Index: favicon.ico
===================================================================
RCS file: favicon.ico
diff -N favicon.ico
Binary files /dev/null and /tmp/cvsSuK31H differ

Index: freemind.php
===================================================================
RCS file: freemind.php
diff -N freemind.php
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ freemind.php        25 Feb 2010 21:54:54 -0000      1.1
@@ -0,0 +1,114 @@
+<?php
+/*
+**  Copyright (C) 2009 Atos Origin 
+**
+**  Author: Raphael Semeteys <address@hidden>
+**
+**  This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+**  the Free Software Foundation; either version 2 of the License, or
+**  (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
+**
+**
+** O3S
+** freemind.php: show the template of a given family with FreeMind Flash Viewer
+**
+*/
+session_start();
+
+include("config.php");
+include("lang.php");
+
+$family = $_REQUEST['family'];
+$qsosspecificformat = $_REQUEST['qsosspecificformat'];
+if (!isset($family)) die("No QSOS family to process");
+
+include("config.php");
+$IdDB = mysql_connect($db_host ,$db_user, $db_pwd);
+mysql_select_db($db_db);
+?>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Mind Map Flash Viewer</title>
+<style type="text/css">
+  /* hide from ie on mac \*/
+  html {
+  height: 100%;
+  overflow: hidden;
+  }
+  #flashcontent {
+  height: 100%;
+  }
+  /* end hide */
+  body {
+  height: 100%;
+  margin: 0;
+  padding: 0;
+  background-color: #ffffff;
+  }
+</style>
+</head>
+<body>
+<?php
+$query = "SELECT DISTINCT CONCAT(qsosappfamily,qsosspecificformat) FROM 
evaluations WHERE appname <> '' AND language = '$lang'";
+$IdReq = mysql_query($query, $IdDB);
+$familiesFQDN = array();
+while($row = mysql_fetch_row($IdReq)) {
+  array_push($familiesFQDN, $row[0]);
+}
+if (!in_array($family.$qsosspecificformat,$familiesFQDN)) 
+  die ("$family $qsosspecificformat".$msg['s3_err_no_family']);
+
+$query = "SELECT file FROM evaluations WHERE qsosappfamily = \"$family\" AND 
qsosspecificformat = '$qsosspecificformat' LIMIT 0:,1";
+$IdReq = mysql_query($query, $IdDB);
+
+if ($file = mysql_fetch_row($IdReq)) {
+  # LOAD XML FILE
+  $XML = new DOMDocument();
+  $XML->load($file[0]);
+
+  # START XSLT
+  $xslt = new XSLTProcessor();
+
+  # IMPORT STYLESHEET
+  $XSL = new DOMDocument();
+  $XSL->load('xslt/template-freemind.xsl');
+  $xslt->importStylesheet($XSL);
+
+  #SAVE RESULT
+  $name = $family."-".$qsosspecificformat.".mm";
+  $filename = "mindmaps/".$name;
+  $file = fopen($filename, "w");
+  fwrite($file, $xslt->transformToXML($XML));
+  fclose($file);
+
+  #DISPLAY RESULT WITH FLASHVIEWER
+  print '<script type="text/javascript" src="mindmaps/flashobject.js"></script>
+<p style="text-align:center; font-weight:bold"><a 
href="'.$filename.'">'.$name.'</a></p>
+<div id="flashcontent"> Flash plugin or Javascript are turned off. Activate 
both  and reload to view the mindmap</div>
+<script type="text/javascript">
+// <![CDATA[
+var fo = new FlashObject("mindmaps/visorFreemind.swf", "visorFreeMind", 
"100%", "100%", 6, "");
+fo.addParam("quality", "high");
+fo.addParam("bgcolor", "#ffffff");
+fo.addVariable("initLoadFile", "'.$filename.'");
+fo.write("flashcontent");
+// ]]>
+</script>';
+
+} else {
+  print "Error: no $family ($qsosspecificformat) found in QSOS database!";
+}
+?> 
+</body>
+</html>
\ No newline at end of file

Index: quadrant.php
===================================================================
RCS file: quadrant.php
diff -N quadrant.php
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ quadrant.php        25 Feb 2010 21:54:54 -0000      1.1
@@ -0,0 +1,192 @@
+<?php
+/*
+**  Copyright (C) 2009 Atos Origin 
+**
+**  Author: Raphael Semeteys <address@hidden>
+**
+**  This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+**  the Free Software Foundation; either version 2 of the License, or
+**  (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
+**
+**
+** O3S
+** quadrant.php: QSOS quadrant generation (in SVG format)
+**
+*/
+session_start();
+
+include("config.php");
+include("lang.php");
+include('libs/QSOSDocument.php');
+
+//QSOS evaluations to display
+$ids = $_REQUEST['id'];
+//Weightings are stored in session
+$weights = $_SESSION;
+
+$IdDB = mysql_connect($db_host ,$db_user, $db_pwd);
+mysql_select_db($db_db);
+
+$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("<error>".$id.$msg['s4_err_no_id']."</error>");
+  $query = "SELECT file FROM evaluations WHERE id = \"$id\"";
+  $IdReq = mysql_query($query, $IdDB);
+  $result = mysql_fetch_row($IdReq);
+  array_push($files, $result[0]);
+}
+
+$myDoc = array();
+$num = count($files);
+
+header("Content-type: image/svg+xml");
+echo "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";
+
+//$x, $y: position where to draw text (and ellipsis)
+//$text: text to draw
+//$i: id of software (for link)
+//$ellipsis: shoul the texte be inserted in an ellipsis?
+function draw($x,$y,$text,$i,$ellipsis=false) {
+  echo("        <g transform='translate($x,$y)'>\n");
+  echo("<a xlink:href='show.php?lang=$lang&amp;id[]=$i&amp;svg=yes'>");
+  if ($ellipsis) {
+    echo("         <path 
style='fill:#fcdea2;fill-opacity:0.5;stroke:#000000;stroke-width:2;stroke-opacity:1'
 d='M -57,0 A 57,21 0 1 1 57,0 A 57,21 0 1 1 -57,0 z' />\n");
+    $fontSize = '10px';
+  } else $fontSize = '14px';
+  echo("         <text><tspan 
style='font-size:$fontSize;text-anchor:middle;font-family:Bitstream Vera Sans' 
y='2.7' x='0'>$text</tspan></text>\n");
+  echo("        </a>\n");
+  echo("        </g>\n");
+}
+?>
+<svg
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:xlink="http://www.w3.org/1999/xlink";
+   width="100%"
+   height="100%">
+  <defs>
+    <linearGradient
+       id="gradientBase">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0" />
+      <stop
+         style="stop-color:#a7e5e5;stop-opacity:1;"
+         offset="1" />
+    </linearGradient>
+    <marker
+       orient="270"
+       refY="0.0"
+       refX="0.0"
+       id="Arrow2Mend"
+       style="overflow:visible;">
+      <path
+         style="font-size:12;stroke-width:0.6"
+         d="M 8,4 L -2,0 L 8,-4 C 6.9,-2 7,2 8,4 z"
+         transform="scale(0.6) rotate(180) translate(0,0)" />
+    </marker>
+    <marker
+       orient="0"
+       refY="0.0"
+       refX="0.0"
+       id="Arrow2Lend"
+       style="overflow:visible;">
+      <path
+         style="font-size:12;stroke-width:0.6"
+         d="M 8,4 L -2,0 L 8,-4 C 6.9,-2 7,2 8,4 z"
+         transform="scale(0.6) rotate(180) translate(1,0)" />
+    </marker>
+    <linearGradient
+       xlink:href="#gradientBase"
+       id="gradient"
+       gradientUnits="userSpaceOnUse"
+       x1="280"
+       y1="157"
+       x2="280"
+       y2="487"
+       gradientTransform="matrix(1,0,0,1,-2,-28)" />
+  </defs>
+  <g>
+    <g
+       transform="translate(100,200)">
+      <g>
+        <rect
+           
style="opacity:1;fill:url(#gradient);fill-opacity:1;stroke:#868686;stroke-width:3;stroke-opacity:1"
+           width="500"
+           height="340"
+           x="0"
+           y="0"
+           ry="0" />
+        <rect
+           
style="opacity:1;fill:none;fill-opacity:1;stroke:#868686;stroke-width:3;stroke-dasharray:6,6"
+           width="500"
+           height="170"
+           x="0"
+           y="0"
+           ry="0" />
+        <rect
+           
style="opacity:1;fill:none;fill-opacity:1;stroke:#868686;stroke-width:3;stroke-dasharray:6,6"
+           width="250"
+           height="340"
+           x="0"
+           y="0"
+           ry="0" />
+        <g
+           transform="translate(-42,-112)">
+          <text
+             transform="matrix(0,-1,1,0,0,0)"><tspan
+               style="font-size:14px;font-family:Bitstream Vera Sans"
+               y="28"
+               x="-318"><?php echo $msg['qq_maturity']; ?></tspan></text>
+          <text><tspan
+               style="font-size:14px;font-family:Bitstream Vera Sans"
+               y="471"
+               x="196"><?php echo $msg['qq_funccoverage']; ?></tspan></text>
+          <path
+             d="M 42,452 C 570,452 570,452 570,452"
+             
style="fill-opacity:0.75;stroke:#000000;stroke-width:3;marker-end:url(#Arrow2Lend);stroke-opacity:1"
 />
+          <path
+             d="M 42,452 C 42,82 42,82 42,82"
+             
style="fill-opacity:0.75;stroke:#000000;stroke-width:3;marker-end:url(#Arrow2Mend);stroke-opacity:1"
 />
+        </g>
+<?php
+for($i=0; $i<$num; $i++) {
+  $myDoc[$i] = new QSOSDocument($files[$i]);
+  $tree = $myDoc[$i]->getWeightedTree($weights);
+  $y = 340 - (($tree[0]->score)*340/2);
+  $totalWeight = 0;
+  $sum = 0;
+  for($k=1; $k<count($tree); $k++) {
+    $name = $tree[$k]->name;
+    $weight = $weights[$name];
+    if (!isset($weight)) $weight = 1;
+    $totalWeight = $totalWeight + $weight;
+    $sum += round(($tree[$k]->score)*$weight, 2);
+  }
+  if ($totalWeight == 0) $score = 0;
+  $score = round(($sum/$totalWeight), 2);
+  $x = $score*500/2;
+  draw($x, $y, $myDoc[$i]->getkey("appname"), $ids[$i], true);
+}
+?>
+      </g>
+    </g>
+  </g>
+</svg>

Index: upload.php
===================================================================
RCS file: upload.php
diff -N upload.php
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ upload.php  25 Feb 2010 21:54:54 -0000      1.1
@@ -0,0 +1,64 @@
+<?php
+/*
+**  Copyright (C) 2007 Atos Origin 
+**
+**  Author: Raphael Semeteys <address@hidden>
+**
+**  This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+**  the Free Software Foundation; either version 2 of the License, or
+**  (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
+**
+**
+** O3S - 
+** upload.php: uploads QSOS evaluation on local filesystem
+**
+*/
+
+include("config.php");
+include("lang.php");
+
+echo "<html>\n";
+echo "<head>\n";
+echo "<LINK REL=StyleSheet HREF='skins/$skin/o3s.css' TYPE='text/css'/>\n";
+echo "</head>\n";
+
+echo "<body>\n";
+echo "<center>\n";
+echo "<img src='skins/$skin/o3s.png'/>\n";
+echo "<br/><br/>\n";
+
+if (isset($_FILES['myFile']) && $_FILES['myFile']['tmp_name'] <> "") {
+  $file = $_FILES['myFile'];
+  $destination = $sheet.$delim.basename($file['name']);
+  if (move_uploaded_file($file['tmp_name'], $destination)) {
+    chmod ($destination, 0770);
+    echo "<div style='color: red'>File ".basename($file['name'])." 
successfully uploaded<br/></div>";
+  } else {
+    echo "<div style='color: red'>Upload error: ".$file['error']."<br/></div>";
+  }
+}
+
+echo "<div style='font-weight: bold'>Upload a QSOS 
evaluation<br/><br/></div>\n";
+
+echo "<p><form id='myForm' enctype='multipart/form-data' method='POST' 
action='upload.php'>
+  <input type='file' id='myFile' name='myFile'/>
+  <input type='submit' value='Upload'/>
+</form></p>";
+echo "<input type='button' value='Update repository' 
onclick=\"window.location='metadata.php'\">";
+echo "</div>\n";
+
+echo "</center>\n";
+echo "</body>\n";
+echo "</html>\n";
+
+?>
\ No newline at end of file




reply via email to

[Prev in Thread] Current Thread [Next in Thread]