Changeset trunk,187

Show
Ignore:
Timestamp:
02/24/10 03:02:44 (5 months ago)
Author:
Suren A. Chilingaryan <csa@dside.dyndns.org>
revision id:
csa@dside.dyndns.org-20100224030244-8lb5hmrvr777vcw5
branch-nick:
adei
Message:

Updated Katrin configuration

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/.htaccess

    r102 r187  
    1010php_value max_execution_time 300 
    1111php_value allow_url_fopen "On" 
     12 
     13<Files ~ "(auth\.php$)"> 
     14    AuthType        Basic 
     15    AuthName        "ADEI Authentication" 
     16    AuthBasicProvider file 
     17    AuthUserFile    /var/www/localhost/htdocs/adei/admin/.htpasswd 
     18    Require         valid-user 
     19</Files> 
     20<Files ~ "(auth2\.php$)"> 
     21    AuthType        Basic 
     22    AuthName        "ADEI Authentication" 
     23    AuthBasicProvider file 
     24    AuthUserFile    /var/www/localhost/htdocs/adei/admin/.htpasswd 
     25#    Require         valid-user 
     26</Files> 
  • trunk/ToDo

    r182 r187  
    1313 
    1414 - Support for Database names 
     15 
     16KATRIN 
     17====== 
     18- Quite often, on update instead of KATRIN data, the error message "MySQL 
     19  server has gone away" is displayed at KATRIN page. 
     20 
     21- Can you please, test if your PHP module is loaded and otherwise skip  
     22  loading KATRIN extensions. Basically, if module is not present you should  
     23  remove "katrin" from the list of modules in config.php ($MODULES variable) 
     24 
     25- The hangup is happening due invalid axis_id returned by your service. I 
     26  made a fix to ADEI, so it will no hang anymore in any case. However, it 
     27  is still better to fix. You are returning following properties which are 
     28  related to axis:  
     29        "axis":["counts\/sec"],"color":["black"],"name":["counts\/sec"] 
     30  However, in the "axis" array the axis id's of KNOWN axis should be 
     31  returned. Known axis are listed in config.php or can be additionally 
     32  added by the READER code, like in IPEReader. And anyway only 
     33  alpha-numeric characters are allowed in ids, no "/". 
     34  If you want just a default axis you should use '0' as an id. So, in this 
     35  case I think you just need to return 
     36         "axis":["0"],"color":["black"],"name":["counts\/sec"] 
    1537 
    1638Version 0.0.8 (DATA Handling) 
     
    102124    distributed uniformely over time. On each position the first item 
    103125    after time is displayed. The time stamp is shown on as well. 
     126 
     127VERSION 0.0.15 (Monitoring) 
     128============== 
     1291. Port conky monitoring system to web and mozilla prism 
     130    a) Lua scripts execution from cron 
     131    b) Lua + conky to html translation script 
    104132 
    105133---------------------------------------------------------------------------- 
  • trunk/setups/katrin/classes/kdbfileidentifier.php

    r171 r187  
    88{ 
    99    public $self = 0; 
    10      
    11     function __construct($arg1, $arg2 = null) 
     10 
     11    function __construct($arg1 = null, $arg2 = null) 
    1212    { 
    13         switch (func_num_args()) { 
    14         case 1: 
    15             $r = new_KDBFileIdentifier($arg1); 
    16             break; 
    17         default: 
    18             $r = new_KDBFileIdentifier($arg1->GetName() . "/" . $arg2); 
     13        if (!extension_loaded("kdbphp")) { 
     14            throw new ADEIException("KDBPhp extension is not loaded!"); 
    1915        } 
     16 
     17        $r = new_KDBFileIdentifier(); 
     18 
     19        if (func_num_args() == 1) { 
     20            KDBFileIdentifier_SetFileName($arg1); 
     21        } 
     22        elseif (func_num_args() == 2) { 
     23            KDBFileIdentifier_SetRun($arg1); 
     24            KDBFileIdentifier_SetFileName($arg2); 
     25        } 
     26 
    2027        $this->self = $r; 
    2128    } 
    22      
     29 
     30    function SetRun(KDBRunIdentifier $run) 
     31    { 
     32        KDBFileIdentifier_SetRun($this->self, $run->self); 
     33    } 
     34 
    2335    function GetRun() 
    2436    { 
     
    2638        return new KDBRunIdentifier($run); 
    2739    } 
    28      
     40 
     41    function SetFileName($filename) 
     42    { 
     43        KDBFileIdentifier_SetFileName($this->self, $filename); 
     44    } 
     45 
    2946    function GetFileName() 
    3047    { 
    3148        return KDBFileIdentifier_GetFileName($this->self); 
    3249    } 
    33      
     50 
     51    function SetFileType($type) 
     52    { 
     53        KDBFileIdentifier_SetFileType($this->self, $type); 
     54    } 
     55 
     56    function GetFileType() 
     57    { 
     58        return KDBFileIdentifier_GetFileType($this->self); 
     59    } 
     60 
    3461    function AsString() 
    3562    { 
  • trunk/setups/katrin/classes/kdbphp.php

    r171 r187  
    11<?php 
    2 // $Id: kdbphp.php 1004 2009-08-31 15:51:16Z s_voec01 $ 
     2// $Id: kdbphp.php 6292 2010-01-19 15:44:58Z s_voec01 $ 
    33// Author: Sebastian Voecking <sebastian.voecking@uni-muenster.de> 
    44 
     
    2929} 
    3030 
     31function vectord_to_array($v) 
     32{ 
     33    $a = array(); 
     34 
     35    if (is_resource($v)) { 
     36        for ($i = 0; $i < vectord_size($v); $i++) { 
     37            $a[] = vectord_get($v, $i); 
     38        } 
     39    } 
     40 
     41    return $a; 
     42} 
     43 
     44function vectord_from_array(array $a) 
     45{ 
     46    $size = count($a); 
     47    $r = new_vectord($size); 
     48    for ($i = 0; $i < $size; $i++) { 
     49        vectord_set($r, $i, $a[$i]); 
     50    } 
     51 
     52    return $r; 
     53} 
     54 
    3155class KDBPhp 
    3256{ 
     
    3559    function __construct() 
    3660    { 
     61        if (!extension_loaded("kdbphp")) { 
     62            throw new ADEIException("KDBPhp extension is not loaded!"); 
     63        } 
    3764        try { 
    3865            $this->_cPtr = KDBPhp_Self(); 
     
    73100    } 
    74101 
    75      
     102 
    76103    //function GetFileServer() 
    77104    //{ 
     
    90117            if ($file->GetRun()->IsValid()) { 
    91118                $runname = $file->GetRun()->GetName(); 
    92                 $message =  
     119                $message = 
    93120                    "File \"$filename\" does not exist for subrun $runname."; 
    94121            } 
     
    108135        readfile($path); 
    109136    } 
    110      
     137 
    111138    function GetAbsolutePath(KDBFileIdentifier $file) 
    112139    { 
     
    128155        } 
    129156    } 
     157 
     158    function HaveRuns($from, $to) 
     159    { 
     160        try { 
     161            return KDBPhp_HaveRuns($this->_cPtr, $from, $to); 
     162        } 
     163        catch (Exception $e) { 
     164            throw new ADEIException($e->getMessage()); 
     165        } 
     166    } 
     167 
     168    function HaveCountrates($from, $to) 
     169    { 
     170        try { 
     171            return KDBPhp_HaveCountrates($this->_cPtr, $from, $to); 
     172        } 
     173        catch (Exception $e) { 
     174            throw new ADEIException($e->getMessage()); 
     175        } 
     176    } 
    130177} 
    131178 
  • trunk/setups/katrin/classes/kdbrunidentifier.php

    r171 r187  
    11<?php 
    2 // $Id: kdbrunidentifier.php 1002 2009-08-31 12:18:00Z s_voec01 $ 
     2// $Id: kdbrunidentifier.php 5933 2009-11-11 20:55:40Z s_voec01 $ 
    33// Author: Sebastian Voecking <sebastian.voecking@uni-muenster.de> 
    44 
     
    66{ 
    77    public $self = 0; 
    8      
     8 
    99    function __construct($text) 
    1010    { 
     11        if (!extension_loaded("kdbphp")) { 
     12            throw new ADEIException("KDBPhp extension is not loaded!"); 
     13        } 
     14 
    1115        if (is_resource($text)) { 
    1216            $this->self = $text; 
    1317        } 
    1418        else { 
    15             $this->self = new_KDBRunIdentifier($text); 
     19            $this->self = new_RunIdentifier($text); 
    1620        } 
    1721    } 
    18      
     22 
    1923    function GetRun() 
    2024    { 
    21         return KDBRunIdentifier_GetRun($this->self); 
     25        return RunIdentifier_GetRun($this->self); 
    2226    } 
    23      
     27 
    2428    function GetSubRun() 
    2529    { 
    26         return KDBRunIdentifier_GetSubRun($this->self); 
     30        return RunIdentifier_GetSubRun($this->self); 
    2731    } 
    28      
     32 
    2933    function GetRunName() 
    3034    { 
    31         return KDBRunIdentifier_GetRunName($this->self); 
     35        return RunIdentifier_GetRunName($this->self); 
    3236    } 
    33      
     37 
    3438    function GetName() 
    3539    { 
    36         return KDBRunIdentifier_GetName($this->self); 
     40        return RunIdentifier_GetName($this->self); 
    3741    } 
    38      
     42 
    3943    function IsValid() 
    4044    { 
    41         return KDBRunIdentifier_IsValid($this->self); 
     45        return RunIdentifier_IsValid($this->self); 
    4246    } 
    4347} 
  • trunk/setups/katrin/classes/readers/katrinreader.php

    r171 r187  
    11<?php 
    2 // $Id: katrinreader.php 973 2009-08-19 09:40:28Z s_voec01 $ 
     2// $Id: katrinreader.php 6292 2010-01-19 15:44:58Z s_voec01 $ 
    33// Author: Sebastian Voecking <sebastian.voecking@uni-muenster.de> 
    44 
    5 require_once "../KDBPhp.php"
     5ADEI::RequireClass("KDBPhp", true)
    66 
    77abstract class KATRINData implements Iterator 
     
    99    public $_cPtr = NULL; 
    1010    private $iterator = NULL; 
    11      
     11 
    1212    abstract protected function create($kdb, $from, $to, $v); 
    1313 
     
    2222        $to = $ivl->GetWindowEnd(); 
    2323        $pixels = $items; 
    24          
     24 
    2525        try { 
    2626            $v = vectori_from_array(array_keys($pixels)); 
     
    4646        try { 
    4747            $r = KDBDataIter_Current($this->_cPtr); 
    48             $a = vectori_to_array($r); 
     48            $a = vectord_to_array($r); 
    4949            return $a; 
    5050        } 
     
    7373        } 
    7474    } 
    75      
     75 
    7676    function key() 
    7777    { 
     
    123123            $this->items['countrates'][] = array('name' => $name); 
    124124        } 
    125          
     125 
    126126        $this->items['runs'] = array(); 
    127127        $this->items['runs'][] = array('name' => "Run numbers"); 
    128         $this->items['runs'][] = array('name' => "Sequence numbers"); 
     128        $this->items['runs'][] = array('name' => "Run numbers (no subruns)"); 
     129        $this->items['runs'][] = array('name' => "Activity"); 
    129130 
    130131        $this->groups = array( 
     
    211212                $item['uid'] = $items[$i]['uid']; 
    212213            } 
    213              
     214 
    214215            if ($flags & REQUEST::NEED_AXISINFO) { 
    215216                if ($grp->GetGroupID() == "countrates") { 
     
    220221                } 
    221222            } 
    222              
     223 
    223224            $res[] = $item; 
    224225        } 
     
    226227        return $res; 
    227228    } 
    228      
     229 
    229230    function GetMaskList(LOGGROUP $grp = NULL, $flags = 0) 
    230231    { 
    231232        //print "KATRINReader::GetMaskList"; 
    232          
     233 
    233234        $grp = $this->CheckGroup($grp); 
    234235 
    235236        $masks = array(); 
    236          
     237 
    237238        if ($grp->GetGroupID() == "runs") { 
    238239        } 
     
    245246            } 
    246247            $masks[] = $mask; 
    247              
     248 
    248249            $mask = array(); 
    249250            $mask["id"] = "ipe"; 
     
    257258            } 
    258259            $masks[] = $mask; 
    259              
     260 
    260261            $mask = array(); 
    261262            $mask["id"] = "uw"; 
     
    268269                $mask["mask"] = implode(",", $items); 
    269270            } 
    270             $masks[] = $mask;             
    271         } 
    272          
     271            $masks[] = $mask; 
     272        } 
     273 
    273274        return array_merge(parent::GetMaskList($grp, $flags), $masks); 
    274275    } 
     
    277278        DATAFilter $filter = NULL, &$filter_data = NULL) 
    278279    { 
    279         print "KATRINReader::GetRawData\n"; 
    280         print "$from $to\n"; 
    281          
    282          
    283         if ($filter) { 
    284             var_dump($filter); 
    285         } 
    286280        $grp = $this->CheckGroup($grp); 
    287281 
    288282        $ivl = $this->CreateInterval($grp); 
    289283        $ivl->Limit($from, $to); 
    290          
     284 
    291285        if ($filter) { 
    292286            $mask = $filter->GetItemMask(); 
     
    339333    function HaveData(LOGGROUP $grp = NULL, $from = 0, $to = 0) 
    340334    { 
    341         try { 
    342             if (is_null($grp) || $grp->GetGroupID() == "runs") { 
    343                 return KDBPhp_HaveRuns($this->kdb->_cPtr, $from, $to); 
    344             } 
    345             else if ($grp->GetGroupID() == "countrates") { 
    346                 return KDBPhp_HaveCountrates($this->kdb->_cPtr, $from, $to); 
    347             } 
    348             else { 
    349                 return FALSE; 
    350             } 
    351         } 
    352         catch (Exception $e) { 
    353             throw new ADEIException($e->getMessage()); 
     335        if (is_null($grp) || $grp->GetGroupID() == "runs") { 
     336            return $this->kdb->HaveRuns($from, $to); 
     337        } 
     338        else if ($grp->GetGroupID() == "countrates") { 
     339            return $this->kdb->HaveCountrates($from, $to); 
     340        } 
     341        else { 
     342            return FALSE; 
    354343        } 
    355344    } 
  • trunk/setups/katrin/config.php

    r171 r187  
    3838            "database" => array ("katrinpse_archiv"), 
    3939            "multibase" => true, 
    40 //          "database" => array ("katrinpse_archiv_20080331", "katrinpse_archiv_20071221", "katrinpse_archiv_20070924", "katrinpse_archiv_20070710"), 
    41 //          "database" => array ("katrinpse_archiv_1", "katrinpse_archiv_2", "katrinpse_archiv_3", "katrinpse_archiv_4", "katrinpse_archiv_5", "katrinpse_archiv_6"), 
    42             "disconnected" => false 
     40//          "disconnected" => true 
    4341        ), 
    4442        "toskanadb" => array ( 
    45             "title" => _("PreSpektrometer Zeus8"), 
     43            "title" => _("PreSpektrometer/Zeus8"), 
    4644            "reader" => "ZEUS", 
    4745            "driver" => "odbc", 
    4846            "sqldrv" => "mssql", 
    4947            "subdrv" => "FreeTDS", 
    50             //"host" => "192.168.8.6", 
    51             "host" => "itpfmdb1.ka.fzk.de", 
     48            "host" => "ipepdvmssqldb1.ka.fzk.de", 
    5249            "port" => 1433, 
    5350            "user" => 'souren', 
     
    5552            "database" => array ("prespektrometer_rep"), 
    5653            "timeout" => 200000, 
    57             "ping" => true 
    58         ), 
     54            "ping" => true, 
     55//          "disconnected" => true 
     56        ), 
     57        "opcreader" => array( 
     58            "title" => _("MainSpektrometer/OPC"), 
     59            "reader" => "DBReader", 
     60            "driver" => "odbc", 
     61            "sqldrv" => "mssql", 
     62            "subdrv" => "FreeTDS", 
     63            "host" => "ipepdvmssqldb1.ka.fzk.de", 
     64            "port" => 1433, 
     65            "database" => array ("dbMagnet-archive", "dbMagnet-archive_rep", "KatrinOPCTest"), 
     66            "user" => 'souren', 
     67            "password" => '$souren$', 
     68            "multibase" => false, 
     69            "timeout" => 200000, 
     70            "ping" => true, 
     71//          "disconnected" => true 
     72       ), 
    5973        "detector" => array ( 
    6074            "title" => _("KATRIN Detector"), 
     
    6377            "sqldrv" => "mssql", 
    6478            "subdrv" => "FreeTDS", 
    65 //          "host" => "128.95.93.87", 
    66 //          "database" => array ("katrin"), 
    67 //          "timeout" => 1500000,       // us 
    68 //          "ping" => true,             // host and port should be specified 
    69             "host" => "192.168.8.6", 
     79            "host" => "ipepdvmssqldb1.ka.fzk.de", 
    7080            "database" => array ("katrin_rep"), 
    7181            "port" => 1433, 
     
    7787//          "disconnected" => true 
    7888        ), 
    79         "heiko" => array ( 
    80             "title" => _("Magnetometer (ZEUS)"), 
    81             "reader" => "ZEUS", 
    82             "driver" => "odbc", 
    83             "sqldrv" => "mssql", 
    84             "subdrv" => "FreeTDS", 
    85             "host" => "192.168.8.6", 
    86             "database" => array ("dbMagnet-archive"), 
    87             "port" => 1433, 
    88             "user" => 'souren', 
    89             "password" => '$souren$', 
    90             "multibase" => false, 
    91             "timeout" => 200000, 
    92             "ping" => true 
    93 //          "disconnected" => true 
    94         ), 
    95         "opcreader" => array( 
    96             "title" => _("Magnetometer"), 
    97             "reader" => "DBReader", 
    98             "driver" => "odbc", 
    99             "sqldrv" => "mssql", 
    100             "subdrv" => "FreeTDS", 
    101             "host" => "192.168.8.6", 
    102             "port" => 1433, 
    103             "database" => array ("dbMagnet-archive"), 
    104             "user" => 'souren', 
    105             "password" => '$souren$', 
    106             "multibase" => false, 
    107             "timeout" => 200000, 
    108             "ping" => true 
    109         ) 
    110 ); 
     89       "kdb" => array( 
     90            "title" => _("KATRIN Database"), 
     91            "reader" => "KATRINreader", 
     92            "database" => array ("kps") 
     93       ) 
     94); 
     95 
    11196 
    11297if (is_array($READER_DB)) $READER_DB = array_merge($READER_DB_KATRIN, $READER_DB); 
     
    143128            "overcome_reader_faults" => true,  // Use CACHE if connection to reader is failed  
    144129            "use_cache_timewindow" => true, 
    145             "channel_uids" => "/^4\d\d[\-_]/", 
    146130            "timestamp_channels" => true,       // Groups is prefixed with two channels with accquisition timestamps (may give a number) 
    147             "alarm_severity" => 0 
     131            "alarm_severity" => 0, 
     132            "channel_uids" => "/^5\d\d[\-_]/", 
     133            "axis" => array( 
     134                "/^522-RTP/i" => "temperature", 
     135                "/^522-RP[PV]/i" => "vacuum" 
     136            ) 
    148137); 
    149138 
     
    169158    ), 
    170159    "groups" => array( 
    171         "/^(.*)$/" => 'mda.Wt$LiveData\$${1}
     160        "/^(.*)$/" => 'mda.[Wt$LiveData\$${1}]
    172161    ), 
    173162    "columns" => array( 
    174163        "time" => "WsDateTimeTicks", 
    175         "data" => "/^Ws_/" 
     164        "data" => "/^Ws(Ch)?_/" 
    176165    ), 
    177166    "timezone" => "Europe/Berlin", 
     
    187176); 
    188177 
     178$OPTIONS["opcreader__dbMagnet-archive_rep"] = array( 
     179    "mask_table" => array( 
     180        "table" => 'mda.[Wt$ConfigData$Masks]', 
     181        "id" => "WsTID", 
     182        "gid" => "WsTable", 
     183        "properties" => array( 
     184            "name" => "WsName", 
     185            "mask" => "WsChannels" 
     186        ) 
     187    ) 
     188); 
     189 
     190$OPTIONS["opcreader__KatrinOPCTest"] = array( 
     191    "tables" => array( 
     192        "/^Wv\\\$LiveData\\\$(.*)$/" => array( 
     193            'gid' => '${1}', 
     194            'title' => '${1}' 
     195        ) 
     196    ), 
     197    "groups" => array( 
     198        "/^(.*)$/" => '[Wv$LiveData\$${1}]' 
     199    ), 
     200    "columns" => array( 
     201        "time" => "WsDateTimeTicks", 
     202        "data" => "/^\d+/" 
     203    ) 
     204); 
     205 
     206$OPTIONS["kdb"] = array( 
     207    "date_limit" => "2009-11-00 00:00:00" 
     208); 
     209 
    189210?> 
  • trunk/setups/katrin/services/katrin.php

    r171 r187  
    11<?php 
    2 // $Id: katrin.php 1037 2009-09-23 13:54:51Z s_voec01 $ 
     2// $Id: katrin.php 6273 2010-01-18 15:44:27Z s_voec01 $ 
    33// Author: Sebastian Voecking <sebastian.voecking@uni-muenster.de> 
    44 
     
    88ADEI::RequireClass("KDBFileIdentifier", true); 
    99ADEI::RequireClass("KDBPhp", true); 
    10 ADEI::RequireClass("KDBRunIdentifier", "true"); 
     10ADEI::RequireClass("KDBRunIdentifier", true); 
    1111ADEI::RequireClass("INTERVAL"); 
    1212 
     
    8686 
    8787        case 'file': 
    88             if (!isset($_GET['filename'])) 
    89                 throw new ADEIException("No filename specified"); 
    90             $filename = $_GET['filename']; 
     88            $file = new KDBFileIdentifier(); 
    9189            if (isset($_GET['run'])) { 
    9290                $identifier = new KDBRunIdentifier($_GET['run']); 
    93                 $file = new KDBFileIdentifier($identifier, $filename); 
    94                 $path = $kdb->GetAbsolutePath($file); 
    95             } 
    96             else { 
    97                 $file = new KDBFileIdentifier($filename); 
    98                 $path = $kdb->GetAbsolutePath($file); 
     91                $file->SetRun($identifier); 
    9992            } 
    10093 
    101             if (isset($_GET['download']) && $_GET['download'] == "yes") { 
    102                 $download = true; 
    103             } 
    104             else { 
    105                 $download = false; 
     94            if (isset($_GET['filename'])) { 
     95                $file->SetFilename($_GET['filename']); 
    10696            } 
    10797 
    108             PrintFile($path, $download); 
     98            if (isset($_GET['type'])) { 
     99                $type = $_GET['type']; 
     100                if ($type == "orca") { 
     101                    $file->SetFileType(kTypeOrca); 
     102                } 
     103                if ($type == "orcaroot") { 
     104                    $file->SetFileType(kTypeOrcaRoot); 
     105                } 
     106                if ($type == "crun") { 
     107                    $file->SetFileType(kTypeCrun); 
     108                } 
     109                if ($type == "header") { 
     110                    $file->SetFileType(kTypeHeader); 
     111                } 
     112                if ($type == "plot") { 
     113                    $file->SetFileType(kTypePlot); 
     114                } 
     115            } 
     116 
     117            PrintFile($kdb->GetAbsolutePath($file), $download); 
    109118            break; 
    110119 
  • trunk/setups/katrin/wiki.xml

    r171 r187  
    782782<page id="346" title="KATRIN Database  Archives">...</page> 
    783783<page id="347" title="KATRIN Database  Archives">...</page> 
    784 <page id="348" title="KATRIN Database  
     784<page id="348" title="KATRIN Database  Archives">...</page> 
     785<page id="349" title="KATRIN Database  Archives">...</page> 
     786<page id="350" title="KATRIN Database  
    785787Archives">...</page> 
    786788</pages> 
  • trunk/setups/katrin/xslt/katrin.xsl

    r171 r187  
    77</xsl:variable> 
    88 
    9 <xsl:template name="image"> 
     9<xsl:template match="image" mode="image"> 
    1010    <xsl:variable name="link"> 
    1111        <xsl:text>services/katrin.php?target=file&amp;</xsl:text> 
     12        <xsl:text>type=plot&amp;</xsl:text> 
    1213        <xsl:if test="@run">run=<xsl:value-of select="@run" />&amp;</xsl:if> 
    1314        <xsl:text>filename=</xsl:text><xsl:value-of select="@filename" /> 
    1415    </xsl:variable> 
    1516 
    16     <xsl:element name="a"> 
    17         <xsl:attribute name="href"> 
    18             <xsl:value-of select="$link" /> 
    19             <xsl:text>.png</xsl:text> 
    20         </xsl:attribute> 
    21         <xsl:attribute name="target">_blank</xsl:attribute> 
    22         <xsl:element name="img"> 
    23             <xsl:attribute name="src"> 
     17    <td> 
     18        <xsl:element name="a"> 
     19            <xsl:attribute name="href"> 
    2420                <xsl:value-of select="$link" /> 
    25                 <xsl:text>_pv.png</xsl:text> 
     21                <xsl:text>.png</xsl:text> 
    2622            </xsl:attribute> 
    27             <xsl:attribute name="border">0</xsl:attribute> 
    28             <xsl:attribute name="alt"> 
    29                 <xsl:value-of select="." /> 
    30             </xsl:attribute> 
     23            <xsl:attribute name="target">_blank</xsl:attribute> 
     24            <xsl:element name="img"> 
     25                <xsl:attribute name="src"> 
     26                    <xsl:value-of select="$link" /> 
     27                    <xsl:text>_pv.png</xsl:text> 
     28                </xsl:attribute> 
     29                <xsl:attribute name="border">0</xsl:attribute> 
     30                <xsl:attribute name="alt"> 
     31                    <xsl:value-of select="." /> 
     32                </xsl:attribute> 
     33            </xsl:element> 
    3134        </xsl:element> 
    32     </xsl:element> 
     35    </td> 
     36</xsl:template> 
     37 
     38<xsl:template match="image" mode="title"> 
     39    <th><xsl:value-of select="." /></th> 
    3340</xsl:template> 
    3441 
     
    3744        <xsl:element name="a"> 
    3845            <xsl:attribute name="href"> 
    39                 <xsl:text>services/katrin.php?target=file&amp;</xsl:text> 
     46                <xsl:text>services/katrin.php?target=file</xsl:text> 
     47                <xsl:text>&amp;download=yes</xsl:text> 
    4048                <xsl:if test="@run"> 
    41                     <xsl:text>run=</xsl:text> 
    42                     <xsl:value-of select="@run" /><xsl:text>&amp;</xsl:text> 
     49                    <xsl:text>&amp;run=</xsl:text> 
     50                    <xsl:value-of select="@run" /> 
    4351                </xsl:if> 
    44                 <xsl:text>filename=</xsl:text> 
    45                 <xsl:value-of select="@filename" /> 
    46                 <xsl:text>&amp;download=yes</xsl:text> 
     52                <xsl:if test="@type"> 
     53                    <xsl:text>&amp;type=</xsl:text> 
     54                    <xsl:value-of select="@type" /> 
     55                </xsl:if> 
     56                <xsl:if test="@filename"> 
     57                    <xsl:text>&amp;filename=</xsl:text> 
     58                    <xsl:value-of select="@filename" /> 
     59                </xsl:if> 
     60                <xsl:if test="@board"> 
     61                    <xsl:text>&amp;board=</xsl:text> 
     62                    <xsl:value-of select="@board" /> 
     63                </xsl:if> 
    4764            </xsl:attribute> 
    4865            <xsl:value-of select="." /> 
     
    5673</xsl:template> 
    5774 
     75<!-- ADEI links and images --> 
     76<xsl:template match="adei"> 
     77    <xsl:text>db_server=</xsl:text> 
     78    <xsl:value-of select="@server" /> 
     79    <xsl:text>&amp;db_name=</xsl:text> 
     80    <xsl:value-of select="@database" /> 
     81    <xsl:text>&amp;db_group=</xsl:text> 
     82    <xsl:value-of select="@group" /> 
     83    <xsl:if test="@mask"> 
     84        <xsl:text>&amp;db_mask=</xsl:text> 
     85        <xsl:value-of select="@mask" /> 
     86    </xsl:if> 
     87    <xsl:if test="@window"> 
     88        <xsl:text>&amp;window=</xsl:text> 
     89        <xsl:value-of select="@window" /> 
     90    </xsl:if> 
     91</xsl:template> 
     92 
     93<xsl:template match="adeiimage" mode="image"> 
     94    <xsl:variable name="url"> 
     95        <xsl:apply-templates select="adei" /> 
     96    </xsl:variable> 
     97    <td> 
     98        <xsl:element name="a"> 
     99            <xsl:attribute name="href"> 
     100                <xsl:text>javascript:adei.config.Load('</xsl:text> 
     101                <xsl:value-of select="$url" /> 
     102                <xsl:text>&amp;module=graph&amp;setup=katrin', true)</xsl:text> 
     103            </xsl:attribute> 
     104            <xsl:element name="img"> 
     105                <xsl:attribute name="src"> 
     106                    <xsl:text>services/getimage.php?</xsl:text> 
     107                    <xsl:value-of select="$url" /> 
     108                    <xsl:text>&amp;hide_axes=1&amp;precision=LOW&amp;width=</xsl:text> 
     109                    <xsl:value-of select="@width" /> 
     110                    <xsl:text>&amp;height=</xsl:text> 
     111                    <xsl:value-of select="@height" /> 
     112                </xsl:attribute> 
     113                <xsl:attribute name="alt"> 
     114                    <xsl:value-of select="@text" /> 
     115                </xsl:attribute> 
     116                <xsl:attribute name="width"> 
     117                    <xsl:value-of select="@width" /> 
     118                </xsl:attribute> 
     119                <xsl:attribute name="height"> 
     120                    <xsl:value-of select="@height" /> 
     121                </xsl:attribute> 
     122                <xsl:attribute name="border"> 
     123                    <xsl:text>0</xsl:text> 
     124                </xsl:attribute> 
     125            </xsl:element> 
     126        </xsl:element> 
     127    </td> 
     128</xsl:template> 
     129 
     130<xsl:template match="adeiimage" mode="title"> 
     131    <th><xsl:value-of select="@text" /></th> 
     132</xsl:template> 
     133 
    58134<xsl:template match="plots"> 
    59135    <h4><xsl:value-of select="@title" />:</h4> 
     
    61137        <table> 
    62138            <tr> 
    63                 <xsl:for-each select="image"> 
    64                     <th><xsl:value-of select="." />:</th> 
    65                 </xsl:for-each> 
     139                <xsl:apply-templates select="image" mode="title" /> 
     140                <xsl:apply-templates select="adeiimage" mode="title" /> 
    66141            </tr> 
    67142            <tr> 
    68                 <xsl:for-each select="image"> 
    69                     <td><xsl:call-template name="image" /></td> 
    70                 </xsl:for-each> 
     143                <xsl:apply-templates select="image" mode="image" /> 
     144                <xsl:apply-templates select="adeiimage" mode="image" /> 
    71145            </tr> 
    72146        </table> 
    73147    </div> 
    74     <p><xsl:apply-templates select="image" /></p> 
    75148</xsl:template> 
    76149 
     
    236309         <span class="fett"> 
    237310             <xsl:value-of select="date" /> 
    238              <xsl:text> </xsl:text> 
    239          </span> 
    240          <b>Run number: </b> 
    241          <span class="fett"> 
    242              <xsl:value-of select="identifier" /> 
    243311             <xsl:text> </xsl:text> 
    244312         </span> 
     
    260328         <b>Z: </b> 
    261329         <span class="fett"><xsl:value-of select="detector_z" />cm </span> 
    262          <b>Crate: </b> 
    263          <span class="fett"><xsl:value-of select="crate" /> </span> 
    264330     </div> 
    265331     <div class="det"> 
     
    273339     </div> 
    274340     <xsl:apply-templates select="parameters" /> 
     341     <xsl:apply-templates select="plots" /> 
    275342     <xsl:apply-templates select="downloads" /> 
    276343</xsl:template> 
     
    279346    <h4>Subrun <xsl:value-of select="identifier" /></h4> 
    280347    <div class="gen"> 
    281         <b>Subrun number: </b> 
    282         <span class="fett"> 
    283             <xsl:value-of select="identifier" /> 
    284             <xsl:text> </xsl:text> 
    285         </span> 
    286348        <b>Timestamp: </b> 
    287349        <span class="fett"> 
     
    337399        div.cmt { 
    338400        background-color: rgb(0,0,0); 
    339         color:white;  
     401        color:white; 
    340402        } 
    341403        div.pics { 
     
    356418            <xsl:apply-templates select="run" /> 
    357419            <xsl:apply-templates select="subrun" /> 
    358         </xsl:if>       
     420        </xsl:if> 
    359421    </div> 
    360422</xsl:template>