Changeset 168

Show
Ignore:
Timestamp:
Wed Aug 23 19:17:27 2006
Author:
Brian
Message:

fix web page offset logic to adjust timescale start date

Files:

Legend:

Unmodified
Added
Removed
Modified
  • server/trunk/update/server/HTML.py

    r165 r168  
    1 1 # Export as HTML.py  
    2   # Copyright 2004, 2005 by Brian C. Christensen  
      2 # Copyright 2004, 2005, 2006 by Brian C. Christensen  
    2 2  
    3 3 #    This file is part of GanttPV.  
     
    38 38 # 060404 - Brian - InPlace editing works  
    39 39 # 060708 - Brian - comment out xof parm (used in calling Data, decided it was a bad idea)  
      40 # 060823 - Brian - fix offset logic to adjust timescale start date  
    40 41  
    41 42 # Note: The fonts used in this script are larger than in GanttPV. To reduce font size to more closely match GanttPV, change the "font-size" lines in the header strings.  
     
    184 185     ct = rc[c]['ColumnTypeID']  
    185 186     return MakeString(rc[c].get("Label") or rct[ct].get("Label") or rct[ct].get("Name") or "--")  
    186                
      187  
      188 def OffsetDate(date, period, offset):  # offset date by number of periods  
      189 #    rc = Data.Database['ReportColumn']  
      190 #    rct = Data.Database['ColumnType']  
      191 #    ct = rc[c]['ColumnTypeID']  
      192 #    type = rct[ct].get('AccessType')  
      193 #    if (type == 's'):  
      194 #        period, ctfield = rct[ct].get('Name').split("/")  
      195     d = Data.StringToDate(date)  
      196     newd = Data.AddPeriod(d, period, offset)  
      197     return Data.DateToString(newd)  
      198 #    else:  
      199 #        return date  
      200  
    187 201 def GetWebEditColumns(clist):  
    188 202     rc = Data.Database['ReportColumn']  
     
    601 615  
    602 616             # di = Data.GetColumnDate(c, 0, xof=parm_startoffset, xdate=parm_startdate)  
    603               di = Data.GetColumnDate(c, 0, xdate=parm_startdate)  
      617             di = Data.GetColumnDate(c, 0, xdate=OffsetDate(parm_startdate, ctperiod, parm_startoffset))  
    603 617  
    604 618             repi = len(cnreps)  
     
    823 837                 else:  # table name, field name, time period, and record id  
    824 838                     # value, source = Data.GetCellValue(rid, col, of, xof=parm_startoffset, xdate=parm_startdate, source=True)  
    825                       value, source = Data.GetCellValue(rid, col, of, xdate=parm_startdate, source=True)  
      839                     parm_offset_startdate = OffsetDate(parm_startdate, ctperiod, parm_startoffset)  
      840                     value, source = Data.GetCellValue(rid, col, of, xdate=parm_offset_startdate, source=True)  
    826 841                     if value == None: value = ''  
    827 842                     cl = "non"  
     
    829 844                     if parm_allow_edit and rtable == editTables.get(col) and parm_inplace and col in editColumns:  
    830 845                         # coldate  = Data.DateIndex[Data.GetColumnDate(col, of, xof=parm_startoffset, xdate=parm_startdate)]  
    831                           coldate  = Data.DateIndex[Data.GetColumnDate(col, of, xdate=parm_startdate)]  
      846                         coldate  = Data.DateIndex[Data.GetColumnDate(col, of, xdate=parm_offset_startdate)]  
    831 846                         val = MakeString(value)  
    832 847                         # fp.write(str(coldate) + ' ' + str(EditPeriod(col, coldate)))