Mercurial > p > roundup > code
comparison roundup/template_funcs.py @ 949:d435bf1ecd8d
make history() work with new Multilink journal entries
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 19 Aug 2002 00:22:47 +0000 |
| parents | 57d09949380e |
| children |
comparison
equal
deleted
inserted
replaced
| 948:8d8db618c2c3 | 949:d435bf1ecd8d |
|---|---|
| 1 # | 1 # |
| 2 # $Id: template_funcs.py,v 1.2 2002-08-15 00:40:10 richard Exp $ | 2 # $Id: template_funcs.py,v 1.3 2002-08-19 00:22:47 richard Exp $ |
| 3 # | 3 # |
| 4 import hyperdb, date, password | 4 import hyperdb, date, password |
| 5 from i18n import _ | 5 from i18n import _ |
| 6 import htmltemplate | 6 import htmltemplate |
| 7 import cgi, os, StringIO, urllib, types | 7 import cgi, os, StringIO, urllib, types |
| 616 | 616 |
| 617 if isinstance(prop, hyperdb.Multilink) and \ | 617 if isinstance(prop, hyperdb.Multilink) and \ |
| 618 len(args[k]) > 0: | 618 len(args[k]) > 0: |
| 619 ml = [] | 619 ml = [] |
| 620 for linkid in args[k]: | 620 for linkid in args[k]: |
| 621 label = classname + linkid | 621 if isinstance(linkid, type(())): |
| 622 # if we have a label property, try to use it | 622 sublabel = linkid[0] + ' ' |
| 623 # TODO: test for node existence even when | 623 linkids = linkid[1] |
| 624 # there's no labelprop! | |
| 625 try: | |
| 626 if labelprop is not None: | |
| 627 label = linkcl.get(linkid, labelprop) | |
| 628 except IndexError: | |
| 629 comments['no_link'] = _('''<strike>The | |
| 630 linked node no longer | |
| 631 exists</strike>''') | |
| 632 ml.append('<strike>%s</strike>'%label) | |
| 633 else: | 624 else: |
| 634 if hrefable: | 625 sublabel = '' |
| 635 ml.append('<a href="%s%s">%s</a>'%( | 626 linkids = [linkid] |
| 636 classname, linkid, label)) | 627 subml = [] |
| 628 for linkid in linkids: | |
| 629 label = classname + linkid | |
| 630 # if we have a label property, try to use it | |
| 631 # TODO: test for node existence even when | |
| 632 # there's no labelprop! | |
| 633 try: | |
| 634 if labelprop is not None: | |
| 635 label = linkcl.get(linkid, labelprop) | |
| 636 except IndexError: | |
| 637 comments['no_link'] = _('''<strike>The | |
| 638 linked node no longer | |
| 639 exists</strike>''') | |
| 640 subml.append('<strike>%s</strike>'%label) | |
| 637 else: | 641 else: |
| 638 ml.append(label) | 642 if hrefable: |
| 639 cell.append('%s:\n %s'%(k, ',\n '.join(ml))) | 643 subml.append('<a href="%s%s">%s</a>'%( |
| 644 classname, linkid, label)) | |
| 645 else: | |
| 646 subml.append(label) | |
| 647 ml.append(sublabel + ', '.join(subml)) | |
| 648 cell.append('%s:\n %s'%(k, ', '.join(ml))) | |
| 640 elif isinstance(prop, hyperdb.Link) and args[k]: | 649 elif isinstance(prop, hyperdb.Link) and args[k]: |
| 641 label = classname + args[k] | 650 label = classname + args[k] |
| 642 # if we have a label property, try to use it | 651 # if we have a label property, try to use it |
| 643 # TODO: test for node existence even when | 652 # TODO: test for node existence even when |
| 644 # there's no labelprop! | 653 # there's no labelprop! |
| 807 return '<a href="remove?:target=%s%s&:multilink=%s:%s">[Remove]</a>'%( | 816 return '<a href="remove?:target=%s%s&:multilink=%s:%s">[Remove]</a>'%( |
| 808 classname, nodeid, parentdesignator, mlprop) | 817 classname, nodeid, parentdesignator, mlprop) |
| 809 | 818 |
| 810 # | 819 # |
| 811 # $Log: not supported by cvs2svn $ | 820 # $Log: not supported by cvs2svn $ |
| 821 # Revision 1.2 2002/08/15 00:40:10 richard | |
| 822 # cleanup | |
| 823 # | |
| 812 # | 824 # |
| 813 # | 825 # |
| 814 # vim: set filetype=python ts=4 sw=4 et si | 826 # vim: set filetype=python ts=4 sw=4 et si |
