Browse Source

initial support for comments in declarations

master
Marc Poulhiès 11 years ago
parent
commit
7fdd84950d
  1. 18
      parachallenge/__init__.py
  2. 6
      php/decl-phpbb.php
  3. 6
      php/decl.php
  4. 4
      templates/declaration.cheetah
  5. 6
      templates/fiche.cheetah

18
parachallenge/__init__.py

@ -64,7 +64,10 @@ class Pilot:
return self.__unicode__().encode("utf-8")
class Declaration:
def __init__(self, pilot, date, cross, last_balise, bonus_wpts, group=1, cat=LTF12_ENB):
def __init__(self, pilot, date, cross, last_balise,
bonus_wpts, group=1, cat=LTF12_ENB,
comments=None):
self.pilot = unicode(pilot)
self.date = unicode(date)
self.cross = cross
@ -72,7 +75,7 @@ class Declaration:
self.bonus_wpts = bonus_wpts
self.distance = 0
self.points = 0
self.comments = comments
self.group = group
self.cat = cat
@ -96,7 +99,8 @@ class Declaration:
'distance' : self.distance,
'points': self.points,
'cat' : self.cat,
'group' : self.group}
'group' : self.group,
'comments' : self.comments}
return m
def __unicode__(self):
@ -318,7 +322,13 @@ def loadDeclarationFromIni(filename, cross):
else:
bonus_wpts = []
return Declaration(pilot_name, decl_date, cross[decl_cross_id], decl_last_wpt, bonus_wpts)
if config.has_option('declaration', 'comments'):
comments = config.get('declaration', 'comments')
else:
comments = None
return Declaration(pilot_name, decl_date, cross[decl_cross_id],
decl_last_wpt, bonus_wpts, comments)
def loadFichesFromIni(filename, debug=False):
config = ConfigParser.ConfigParser()

6
php/decl-phpbb.php

@ -60,7 +60,7 @@ $date = $_POST['date'];
$group = $_POST['group'];
$cat = $_POST['cat'];
$bonus = $_POST['bonus'];
$comments = $_POST['comments'];
$r = $auth->login($login, $password);
@ -88,6 +88,10 @@ $str = "[declaration] \n" .
"group : " . $group . "\n";
if ( $comments) {
$str .= "comments : " . $comments . "\n";
}
$str .= "bonus : ";
if (! empty($bonus)){

6
php/decl.php

@ -12,6 +12,7 @@ $group = $_POST['group'];
$cat = $_POST['cat'];
$bonus = $_POST['bonus'];
$comments = $_POST['comments'];
$valid = true;
@ -57,7 +58,10 @@ $str = "[declaration] \n" .
"last_balise : " . $lastb . "\n" .
"cat : " . $cat . "\n" .
"group : " . $group . "\n";
if ( $comments) {
$str .= "comments : " . $comments . "\n";
}
$str .= "bonus : ";

4
templates/declaration.cheetah

@ -194,6 +194,10 @@
</select>
</fieldset>
<fieldset>
<legend>Commentaires/Récit</legend>
<textarea rows="10" cols="55" name="comments"></textarea>
</fieldset>
<input type="submit" value="Je valide ce vol de ouf!" />
</form>
</div>

6
templates/fiche.cheetah

@ -308,6 +308,12 @@
newcontent += ' </select>';
newcontent += '</fieldset>';
newcontent += '<fieldset>';
newcontent += '<legend>Commentaires/Récit</legend>';
newcontent += '<textarea rows="10" cols="55" name="comments"></textarea>';
newcontent += '</fieldset>';
newcontent += '<input type="hidden" name="cross" value="$cross.fid" />';
newcontent += '<input type="submit" value="je déclare!" />';

Loading…
Cancel
Save