Changeset 2843

Show
Ignore:
Timestamp:
01/08/12 07:58:06 (4 months ago)
Author:
paparazzia
Message:

fix #650

Location:
trunk
Files:
1 added
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/base/scripts/upgrade-v0.19.sql

    r2842 r2843  
    11#Creation de la table racespreview 
    2 DROP TABLE IF EXISTS `racepreview`; 
     2DROP TABLE IF EXISTS `racespreview`; 
    33CREATE TABLE `racespreview` ( 
    44  `idracespreview` int(11) NOT NULL auto_increment, 
  • trunk/lib/phpcommon/racesiterators.class.php

    r2439 r2843  
    2626 
    2727        function __construct() { 
    28             $this->query = "SELECT * FROM `races` ". 
     28            $this->query = "(SELECT deptime, closetime, racename, racename as description, boattype, idraces FROM `races` ". 
    2929                           "WHERE ( ( started = ". RACE_PENDING ." AND deptime > UNIX_TIMESTAMP() ) OR ( closetime > UNIX_TIMESTAMP() ) ) ". 
    30                            "AND !(racetype & ".RACE_TYPE_RECORD. ") ORDER BY started ASC, deptime ASC, closetime ASC " ; 
     30                           "AND !(racetype & ".RACE_TYPE_RECORD. ") ORDER BY started ASC, deptime ASC, closetime ASC ) ". 
     31                           "UNION ( SELECT deptime, deptime+3600 as closetime, racename, comments as description, NULL as boattype, NULL as idraces ". 
     32                           "FROM `racespreview` ". 
     33                           "WHERE deptime > UNIX_TIMESTAMP() )"; 
    3134            parent::__construct(); 
    3235        } 
     
    4952            $vevent->setProperty( 'dtend', array('timestamp' => $row['closetime']) ); 
    5053            $vevent->setProperty( 'summary', html_entity_decode($row['racename'], ENT_COMPAT, "UTF-8") ); 
    51             $vevent->setProperty( 'description', html_entity_decode($row['racename'], ENT_COMPAT, "UTF-8")." ( ".substr($row['boattype'], 5 )." ) " ); 
     54            if (!is_null($row['boattype'])) { 
     55                $vevent->setProperty( 'description', html_entity_decode($row['racename'], ENT_COMPAT, "UTF-8")." ( ".substr($row['boattype'], 5 )." ) " ); 
     56            } else { 
     57                $vevent->setProperty( 'description', html_entity_decode($row['description'], ENT_COMPAT, "UTF-8") ); 
     58            } 
    5259            //FIXME: construction de l'url ??? 
    53             $vevent->setProperty( 'url', sprintf("http://%s/ics.php?idraces=%d", $_SERVER['SERVER_NAME'],  $row['idraces'])); 
     60            if (!is_null($row['idraces'])) { 
     61                $vevent->setProperty( 'url', sprintf("http://%s/ics.php?idraces=%d", $_SERVER['SERVER_NAME'],  $row['idraces'])); 
     62            } 
    5463            $this->icalobject->setComponent ( $vevent ); // add event to calendar 
    5564        } 
     
    6574 
    6675        function __construct() { 
    67             $this->query = "SELECT * FROM races ". 
     76            $this->query = "(SELECT deptime, closetime, racename, racename as description, boattype, idraces FROM `races` ". 
    6877                           " WHERE ( deptime > (UNIX_TIMESTAMP()-2592000 ) ) AND !(racetype & ".RACE_TYPE_RECORD.") ". 
    69                            " ORDER BY started ASC, deptime ASC, closetime ASC "; 
     78                           " ORDER BY started ASC, deptime ASC, closetime ASC ) ". 
     79                           "UNION ( SELECT deptime, NULL as closetime, racename, comments as description, NULL as boattype, NULL as idraces ". 
     80                           "FROM `racespreview` ". 
     81                           "WHERE deptime > UNIX_TIMESTAMP() )"; 
     82 
     83                           ; 
    7084            parent::__construct(); 
    7185        } 
     
    8094            $jsonarray['end'] = $row['closetime']; 
    8195            $jsonarray['title'] = html_entity_decode($row['racename'], ENT_COMPAT, "UTF-8"); 
    82             $jsonarray['allDay'] = False; 
    83             $jsonarray['url'] = sprintf("http://%s/ics.php?idraces=%d", $_SERVER['SERVER_NAME'],  $row['idraces']); 
     96            $jsonarray['allDay'] = is_null($row['closetime']); 
     97            if (!is_null($row['idraces'])) $jsonarray['url'] = sprintf("http://%s/ics.php?idraces=%d", $_SERVER['SERVER_NAME'],  $row['idraces']); 
    8498            $this->jsonarray[] = $jsonarray; 
    8599        } 
  • trunk/site/admin/index.php

    r2540 r2843  
    3434 
    3535    $tablepages = Array( 
     36        "racespreview.php" => "Incoming Races - Calendar Management", 
    3637        "races_instructions.php" => "Races instructions", 
    3738        "races.php" => "Races definitions (no uploading, see below)", 
  • trunk/site/admin/races_instructions.php

    r2638 r2843  
    2020 
    2121$opts['fdd']['autoid'] = array( 
    22   'help'     => 'Unique id of the race', 
     22  'help'     => 'Unique id of the race instruction', 
    2323  'select'   => 'T', 
    2424  'input'  => 'R',