Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 7517)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 7518)
@@ -18,4 +18,15 @@
 
                                                  -*-*- END OF LINE -*-*-
+ 2006/02/17 Daniela Dorner
+
+   * datacenter/scripts/copyscript: 
+     - fixed path length
+
+   * datacenter/macros/fillsources.C: 
+     - added (macro to read source information from catalog files and 
+       insert it into the database)
+
+
+
  2006/02/17 Thomas Bretz
 
Index: /trunk/MagicSoft/Mars/datacenter/db/ganymed.php
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/db/ganymed.php	(revision 7517)
+++ /trunk/MagicSoft/Mars/datacenter/db/ganymed.php	(revision 7518)
@@ -38,5 +38,5 @@
 
         if (empty($_GET["fAll"]))
-            $_GET["fAll"]=$first?"On":"";
+            $_GET["fAll"]="Off";
 
     }
@@ -53,5 +53,6 @@
 
         if (empty($_GET["fRunMin"]))
-            $min = GetMin("fDataSetNumber", "DataSets", $db);
+            $min = "100";
+//            $min = GetMin("fDataSetNumber", "DataSets", $db);
         else
             $min = $_GET["fRunMin"];
@@ -169,17 +170,23 @@
             printf(" <table BORDER=\"1\">");
             printf(" <tr BGCOLOR='#C0C0C0'>\n");
-            printf(" <th colspan=\"6\"><u>DataSet#:</u> %s </th>", $datasetno);
+            printf(" <th colspan=\"6\"><u>DataSet#:</u> %s - %s </th>", $datasetno, $source);
             printf(" </tr><tr BGCOLOR='#E0E0E0' ALIGN='left'>\n");
-            printf(" <th colspan=\"6\"> %s - Wobble %s ", $comment, $wobble);
+            printf(" <th colspan=\"6\"> %s ", $comment);
+            printf(" </th></tr><tr>\n");
+
+            printf(" <td colspan=\"6\"> Wobble: %s", $wobble);
             if (!is_null($ganymed))
-                printf(", <font color='green'>ganymed done</font> ");
-            printf(" </th></tr>\n");
-
-            printf(" <tr><td colspan=\"6\"></td></tr>\n");
+                printf(", <font color='green'> ganymed done</font> ");
+
+            printf(" <tr>");
 
             if (!is_null($fillganymed))
             {
-                printf(" <tr BGCOLOR='#C0C0C0'><th colspan=\"6\">results</th></tr>");
-                printf(" <tr BGCOLOR='#E0E0E0'>\n");
+                printf("<td colspan=\"6\"></td></tr>\n");
+                printf(" <tr BGCOLOR='#C0C0C0'><th colspan=\"6\">results - ");
+                $num=sprintf("%08d",$datasetno);
+                printf(" <a href=\"http://www.astro.uni-wuerzburg.de/datacenter/ganymed/%s/%s/\">plots</a>",
+                       substr($num,0,5), $num);
+                printf(" </th></tr><tr BGCOLOR='#E0E0E0'>\n");
                 printf(" <td>excess events</td>\n");
                 printf(" <td>background events</td>\n");
@@ -197,23 +204,12 @@
             }
 
-
             if ($_GET["fAll"]=="On" && !is_null($ganymed))
             {
-                printf("</td></tr><tr><td>\n");
-
-                printf(" <table BORDER=\"1\">");
-                printf(" <tr BGCOLOR='#C0C0C0'>\n");
-                printf(" <th colspan=\"6\">plots</th>");
-                printf(" </tr>\n");
-                printf(" <tr><td colspan=\"6\">\n");
-                $num=sprintf("%08d",$datasetno);
-                printf(" <a href=\"http://www.astro.uni-wuerzburg.de/datacenter/ganymed/%s/%s/\">files</a>",
-                       substr($num,0,5), $num);
-                printf(" </tr></table>");
-
+                printf("<tr><td colspan=\"6\">\n");
+                printf(" plots (to be added) </td></tr>");
             }
+
             printf(" </table>");
             printf("</td></tr><tr><td><br></td></tr>");
-
         }
         printf("</table>\n");
Index: /trunk/MagicSoft/Mars/datacenter/db/index.html
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/db/index.html	(revision 7517)
+++ /trunk/MagicSoft/Mars/datacenter/db/index.html	(revision 7518)
@@ -43,6 +43,8 @@
 <li><A HREF="queryrbk.php">Runbook Database</A></li>
 <li><A HREF="datasetinfo.php">Dataset Information</A> 
-(<A HREF="http://www.astro.uni-wuerzburg.de/~dorner/analysis/datasets.html">comments</A>, 
- <A HREF="http://www.astro.uni-wuerzburg.de/datacenter/datasets/">files</A>)</li>
+(<!--<A HREF="http://www.astro.uni-wuerzburg.de/~dorner/analysis/datasets.html">comments</A>, 
+-->
+ <A HREF="http://www.astro.uni-wuerzburg.de/datacenter/datasets/">dataset files</A>)</li>
+<li><A HREF="ganymed.php">Results of the Automatic Analysis</A> 
 </ul>
 Other queries:<p>
Index: /trunk/MagicSoft/Mars/datacenter/macros/fillsources.C
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/macros/fillsources.C	(revision 7518)
+++ /trunk/MagicSoft/Mars/datacenter/macros/fillsources.C	(revision 7518)
@@ -0,0 +1,149 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Daniela Dorner, 01/2005 <mailto:dorner@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2006
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// fillsources.C
+// ============
+//
+// Returns 0 in case of failure and 1 in case of success.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+
+#include <TEnv.h>
+
+#include <MSQLServer.h>
+#include <TSQLRow.h>
+#include <TSQLResult.h>
+
+using namespace std;
+
+Bool_t ExistStr(MSQLServer &serv, const char *column, const char *table, const char *test)
+{
+    TString query(Form("SELECT %s FROM %s WHERE %s='%s'", column, table, column, test));
+
+    cout << "query: " << query << endl;
+
+    TSQLResult *res = serv.Query(query);
+    if (!res)
+        return kFALSE;
+
+    Bool_t rc = kFALSE;
+
+    TSQLRow *row=res->Next();
+    if (row && (*row)[0])
+        rc=kTRUE;
+
+    delete res;
+    return rc;
+}
+
+
+int fillsources(TString catalog)
+{
+    TEnv env("sql.rc");
+
+    MSQLServer serv(env);
+    if (!serv.IsConnected())
+    {
+        cout << "ERROR - Connection to database failed." << endl;
+        return 0;
+    }
+    cout << "insertdate" << endl;
+    cout << "----------" << endl;
+    cout << endl;
+    cout << "Connected to " << serv.GetName() << endl;
+    cout << endl;
+
+    TString source;
+    TString RA;
+    TString Dec;
+    TString waste;
+    ifstream fin(catalog);
+    if (!fin)
+    {
+        cout << "Could not open file " << catalog << endl;
+        return 0;
+    }
+
+    while (1)
+    {
+        if (!fin)
+            break;
+
+        source.ReadToDelim(fin, ',');
+        waste.ReadToDelim(fin, ',');
+        RA.ReadToDelim(fin, ',');
+        Dec.ReadToDelim(fin, ',');
+        waste.ReadToDelim(fin, '\n');
+
+        cout << "source: " << source << endl;
+        cout << "RA: " << RA << endl;
+        cout << "Dec: " << Dec << endl;
+
+        //insert entry for date into the table SequenceBuildStatus,
+        // if entry is not yet existing
+        if (!ExistStr(serv, "fSourceName", "Source", source))
+        {
+            TString query(Form("INSERT Source SET fSourceName='%s', fRightAscension='%s', fDeclination='%s' ",
+                               source.Data(), RA.Data(), Dec.Data()));
+
+            cout << "query: " << query << endl;
+            /*
+             TSQLResult *res = serv.Query(query);
+             if (!res)
+             {
+             cout << "Error - could not insert entry" << endl;
+             return 0;
+             }
+             delete res;
+             */
+        }
+        else
+        {
+            cout << source << " already exists... do update. " << endl;
+
+            TString query(Form("Update Source SET fRightAscension='%s', fDeclination='%s' WHERE fSourceName='%s',",
+                               RA.Data(), Dec.Data(), source.Data()));
+
+            cout << "query: " << query << endl;
+            /*
+             TSQLResult *res = serv.Query(query);
+             if (!res)
+             {
+             cout << "Error - could not update entry" << endl;
+             return 0;
+             }
+             delete res;*/
+        }
+    }
+
+    return 1;
+}
+
+
Index: /trunk/MagicSoft/Mars/datacenter/scripts/copyscript
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/scripts/copyscript	(revision 7517)
+++ /trunk/MagicSoft/Mars/datacenter/scripts/copyscript	(revision 7518)
@@ -66,5 +66,5 @@
 
 transdir=/home/lapalma/transfer
-char=23
+char=24
 datetime=`date +%F-%H-%M-%S`
 lockfile=$lockpath/lock-copyscript.txt
