Changeset 207

Show
Ignore:
Timestamp:
Fri Sep 15 21:20:07 2006
Author:
Alexander
Message:

Server: indent subtask names, improve time-scale headers

Files:

Legend:

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

    r169 r207  
    39 39 # 060708 - Brian - comment out xof parm (used in calling Data, decided it was a bad idea)  
    40 40 # 060823 - Brian - fix offset logic to adjust timescale start date  
      41 # 060902 - Alex - indent subtask names  
      42 # 060914 - Alex - use time-scale headers from Data (takes advantage of the better-looking headers in v0.7)  
    41 43  
    42 44 # 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.  
     
    57 59 convert = False  # no conversion  
    58 60  
      61 indent = " " * 3  
      62  
    59 63 debug = 1  
    60 64  
     
    609 613             ctperiod, ctfield = rct[ct].get('Name').split("/")  
    610 614             if ctfield == "Gantt":  
    611                   width = 10  
      615                 width = 24  
    611 615             else:  
    612 616                 width = rc[c].get('Width') or 40  
     
    616 620  
    617 621             # di = Data.GetColumnDate(c, 0, xof=parm_startoffset, xdate=parm_startdate)  
    618               di = Data.GetColumnDate(c, 0, xdate=OffsetDate(parm_startdate, ctperiod, parm_startoffset))  
      622             # di = Data.GetColumnDate(c, 0, xdate=OffsetDate(parm_startdate, ctperiod, parm_startoffset))  
      623             xdate = OffsetDate(parm_startdate, ctperiod, parm_startoffset)  
    619 624  
    620 625             repi = len(cnreps)  
    621 626             reptop = ""  
    622 627             for i in range(rc[c].get('Periods') or 1):  
    623                   (y, m, d) = Data.DateIndex[di].split("-")  # convert index to date  
      628                 header = Data.GetColumnHeader(c, i, xdate=xdate).splitlines()  
      629                 top, bot = header[0], header[-1]  
      630  
      631                 # (y, m, d) = Data.DateIndex[di].split("-")  # convert index to date  
    624 632                 # gantt columns are narrower, so headers are shorter  
    625                   if ctperiod in ("Day", "Week"):  
    626                       if ctfield == 'Gantt':  
    627                           top = month[int(m) - 1] + " " + str(y)  
    628                           bot = d  
    629                       else:  
    630                           top = month[int(m) - 1] + " " + y[-2:] + " " + ctfield[0:3]  
    631                           bot = d  
    632                   elif ctperiod == "Month":  
    633                       if ctfield == 'Gantt':  
    634                           top = y  
    635                           bot = m  
    636                       else:  
    637                           top = y  
    638                           bot = month[int(m) - 1]  
    639                   elif ctperiod == "Quarter":  
    640                       q = (int(m) + 2) / 3  
    641                       if ctfield == 'Gantt':  
    642                           top = y  
    643                           bot = "Q" + str(q)  
    644                       else:  
    645                           top = y  
    646                           bot = "Q" + str(q)  
    647                   else:  
    648                       top = "-"  
    649                       bot = "-"  
      633                 # if ctperiod in ("Day", "Week"):  
      634                 #     if ctfield == 'Gantt':  
      635                 #         top = month[int(m) - 1] + " " + str(y)  
      636                 #         bot = d  
      637                 #     else:  
      638                 #         top = month[int(m) - 1] + " " + y[-2:] + " " + ctfield[0:3]  
      639                 #         bot = d  
      640                 # elif ctperiod == "Month":  
      641                 #     if ctfield == 'Gantt':  
      642                 #         top = y  
      643                 #         bot = m  
      644                 #     else:  
      645                 #         top = y  
      646                 #         bot = month[int(m) - 1]  
      647                 # elif ctperiod == "Quarter":  
      648                 #     q = (int(m) + 2) / 3  
      649                 #     if ctfield == 'Gantt':  
      650                 #         top = y  
      651                 #         bot = "Q" + str(q)  
      652                 #     else:  
      653                 #         top = y  
      654                 #         bot = "Q" + str(q)  
      655                 # else:  
      656                 #     top = "-"  
      657                 #     bot = "-"  
      658  
    650 659                 cname2.append( bot )  
    651 660                 cnreps.append(1)  
     
    657 666                 else:  
    658 667                     cname1.append( top )  
    659                       reptop = top  # save this heading to check next one is dup  
      668                     # reptop = top # save this heading to check next one is dup  
      669                         # in v0.7, duplicate headers are left blank  
    660 670                     repi = len(cnreps) - 1  # remember this location  
    661 671                 columns.append( c )  
     
    664 674                 cwidth.append(width)  # what is the width?  
    665 675  
    666                   if ctperiod == "Week":  
    667                       di += 7  
    668                   elif ctperiod == "Month":  
    669                       di = Data.AddMonths(di, 1)  
    670                   elif ctperiod == "Quarter":  
    671                       di = Data.AddMonths(di, 3)  
    672                   else:  # default to days  
    673                       di += 1  
      676                 # if ctperiod == "Week":  
      677                 #     di += 7  
      678                 # elif ctperiod == "Month":  
      679                 #     di = Data.AddMonths(di, 1)  
      680                 # elif ctperiod == "Quarter":  
      681                 #     di = Data.AddMonths(di, 3)  
      682                 # else:  # default to days  
      683                 #     di += 1  
    674 684         else:  
    675 685             # create list of column headers  
     
    703 713         fp.write('<td class="head" colspan="' + str(cspan) + '"' + rspan + '>')  
    704 714         if coloffset[i] > -1:  
    705               if cspan > 3: pass  
    706               elif cspan > 1: c = c[0:4]  
    707               else: c = "&nbsp;"  
      715             ct = ctypes[i]  
      716             ctperiod, ctfield = rct[ct].get('Name').split("/")  
      717             if ctfield == "Gantt":  
      718                 if cspan < 3: c = c[:4]  
      719                 elif cspan < 2: c = c[:2]  
      720                 elif cspan < 1: c = "&nbsp;"  
    708 721         else:  
    709 722             c = c + '<br>' + cname2[i]  
     
    725 738     show = report.get('ShowHidden', False)  
    726 739  
      740     try:  
      741         rlist, rlevels = Data.GetRowLevels(self.ReportID)  
      742     except AttributeError:  
      743         rlist, rlevels = Data.GetRowList(self.ReportID), None  
      744  
    727 745     rownum = 1  
    728 746     rlist = Data.GetRowList(reportid)  
     
    780 798                     tdclass = "body"  
    781 799                 fp.write('<td class="' + tdclass + '" ' + wid + wrap + ' >')  
      800                 if ct.get('Name') == 'Name' and rlevels:  
      801                     fp.write(indent * rlevels[ri])  
    782 802                 if parm_allow_edit and rtable == editTables.get(col) and col in editColumns and parm_inplace:  
    783 803                     val = MakeString(value)