Added an AgreementField widget
Displays an Agreement Document in a scrolling text field. The text of
the document can be set by modifying the 'text' property.
Patch by: Sverre Rabbelier
--- a/app/soc/views/helper/widgets.py Wed Feb 11 23:59:41 2009 +0000
+++ b/app/soc/views/helper/widgets.py Thu Feb 12 00:02:06 2009 +0000
@@ -145,3 +145,28 @@
self.rf['reference_url'] = reference_url
self.rf['filter'] = filter if filter else []
super(ReferenceField, self).__init__(*args, **kwargs)
+
+
+class AgreementField(widgets.Widget):
+ """Widget for selecting a reference to an Entity.
+ """
+
+ HTML_CODE = """
+ <span style="width:450px" colspan="4">
+ <div id="ToS" style="overflow:auto;height:200px">
+ %s
+ </div>
+ </span>
+ """
+
+ def __init__(self, *args, **kwargs):
+ self.text = "No Agreement Text Specified"
+ super(AgreementField, self).__init__(*args, **kwargs)
+
+ def render(self, name, value, attrs=None):
+ """
+ """
+
+ value = self.text.replace('\n', '<BR />')
+ result = self.HTML_CODE % value
+ return result