def render(self, context):
     """
     Render Boolean value for viewing.
     """
     textval = BoolCheckboxValueMapper.encode(
         get_field_view_value(context, None))
     return "<span>%s</span>" % textval
 def render(self, context):
     """
     Render import link for viewing.
     """
     val      = get_field_view_value(context, None)
     linkval  = FileUploadValueMapper.resource_name(val)
     textval  = FileUploadValueMapper.uploaded_file(val)
     return view_upload%(linkval, textval)
Example #3
0
 def render(self, context):
     """
     Render Markdown text for viewing.
     """
     textval = TextMarkdownValueMapper.encode(get_field_view_value(context, None))
     textval = apply_substitutions(context, textval)
     htmlval = markdown.markdown(textval)
     return """<span class="markdown">%s</span>"""%htmlval
Example #4
0
 def render(self, context):
     """
     Render language-tagged text for viewing.
     """
     from annalist.views.fields.render_fieldvalue import get_field_view_value
     textval = TextLanguageValueMapper.encode(get_field_view_value(context, ""))
     log.debug("text_language_view_renderer: textval %r"%(textval,))
     return '''<span>%s</span>'''%(textval)
Example #5
0
 def render(self, context):
     """
     Render Markdown text for viewing.
     """
     textval = TextMarkdownValueMapper.encode(
         get_field_view_value(context, None))
     textval = apply_substitutions(context, textval)
     htmlval = markdown.markdown(textval)
     return """<span class="markdown">%s</span>""" % htmlval
Example #6
0
 def render(self, context):
     """
     Render field placement for viewing.
     """
     placement = get_field_view_value(context, "&nbsp;")
     if placement in placement_occupancy:
         return placement_display_span(placement)
     # Not predefined value - return string in unadorned span.
     # (Without a <span ... /> with some content, the grid layout gets messed up.
     return '''<span>%s</span>''' % (placement or "(not specified)")
Example #7
0
 def render(self, context):
     """
     Render field placement for viewing.
     """
     placement = get_field_view_value(context, "&nbsp;")
     if placement in placement_occupancy:
         return placement_display_span(placement)
     # Not predefined value - return string in unadorned span.
     # (Without a <span ... /> with some content, the grid layout gets messed up.
     return '''<span>%s</span>'''%(placement or "(not specified)")
 def render(self, context):
     """
     Render link for viewing.
     """
     linkval = URILinkValueMapper.encode(get_field_view_value(context, ""))
     common_prefixes = ([
         "http://", "https://", "file:///", "file://localhost/", "file://",
         "mailto:"
     ])
     textval = linkval
     for p in common_prefixes:
         if linkval.startswith(p):
             textval = linkval[len(p):]
             break
     return '''<a href="%s" target="_blank">%s</a>''' % (linkval, textval)
Example #9
0
 def render(self, context):
     """
     Render import link for viewing.
     """
     linkval = URIImportValueMapper.encode(get_field_view_value(
         context, ""))
     common_prefixes = ([
         "http://", "https://", "file:///", "file://localhost/", "file://",
         "mailto:"
     ])
     textval = linkval
     for p in common_prefixes:
         if linkval.startswith(p):
             textval = linkval[len(p):]
             break
     return view_import % (linkval, textval)
Example #10
0
 def render(self, context):
     """
     Render import link for viewing.
     """
     linkval = URIImportValueMapper.encode(get_field_view_value(context, ""))
     common_prefixes = (
         [ "http://", "https://"
         , "file:///", "file://localhost/", "file://"
         , "mailto:"]
         )
     textval = linkval
     for p in common_prefixes:
         if linkval.startswith(p):
             textval = linkval[len(p):]
             break
     return view_import%(linkval, textval)
Example #11
0
 def render(self, context):
     """
     Render link for viewing.
     """
     linkval = URILinkValueMapper.encode(get_field_view_value(context, ""))
     common_prefixes = (
         [ "http://", "https://"
         , "file:///", "file://localhost/", "file://"
         , "mailto:"]
         )
     textval = linkval
     for p in common_prefixes:
         if linkval.startswith(p):
             textval = linkval[len(p):]
             break
     return '''<a href="%s" target="_blank">%s</a>'''%(linkval, textval)
Example #12
0
 def render(self, context):
     """
     Render link for viewing.
     """
     # try:
     linkval = URILinkValueMapper.encode(get_field_view_value(context, ""))
     log.info("uri_link_view_renderer: linkval %r (orig)"%(linkval,))
     common_prefixes = (
         [ "http://", "https://"
         , "file:///", "file://localhost/", "file://"
         , "mailto:"]
         )
     textval = linkval
     for p in common_prefixes:
         if isinstance(linkval, (str, unicode)) and linkval.startswith(p):
             textval = linkval[len(p):]
             break
     if ":" in linkval:
         link_pref, link_path = linkval.split(":", 1)
         if "collection" not in context:
             log.warning("uri_link_view_renderer: no key 'collection' in context")
             # log.error("@@@@@@@@@@@@@@@@@@@@@")
             # for k in context.flatten():
             #     hidden_fields = (
             #         [ "fields", "row_bound_fields", "repeat_bound_fields"
             #         , "help_text", "help_markdown"
             #         , "forloop", "f", "block", "view_choices"
             #         , "LANGUAGES"
             #         ])
             #     if k not in hidden_fields:
             #         log.error("    @@@ %s: %r"%(k, context[k]))
         else:
             link_vocab = context["collection"].cache_get_vocab(link_pref)
             if link_vocab:
                 linkval = link_vocab.get_uri() + link_path
     log.info("uri_link_view_renderer: linkval %r (final)"%(linkval,))
     return '''<a href="%s" target="_blank">%s</a>'''%(linkval, textval)
Example #13
0
 def render(self, context):
     """
     Render link for viewing.
     """
     linkval = URILinkValueMapper.encode(get_field_view_value(context, ""))
     # log.info("uri_link_view_renderer: linkval %r (orig)"%(linkval,))
     common_prefixes = (
         [ "http://", "https://"
         , "file:///", "file://localhost/", "file://"
         , "mailto:"]
         )
     textval = linkval
     for p in common_prefixes:
         if is_string(linkval) and linkval.startswith(p):
             textval = linkval[len(p):]
             break
     if ":" in linkval:
         link_pref, link_path = linkval.split(":", 1)
         if "collection" not in context:
             log.warning("uri_link_view_renderer: no key 'collection' in context")
             # log.error("@@@@@@@@@@@@@@@@@@@@@")
             # for k in context.flatten():
             #     hidden_fields = (
             #         [ "fields", "row_bound_fields", "repeat_bound_fields"
             #         , "help_text", "help_markdown"
             #         , "forloop", "f", "block", "view_choices"
             #         , "LANGUAGES"
             #         ])
             #     if k not in hidden_fields:
             #         log.error("    @@@ %s: %r"%(k, context[k]))
         else:
             link_vocab = context["collection"].cache_get_vocab(link_pref)
             if link_vocab:
                 linkval = link_vocab.get_uri() + link_path
     # log.info("uri_link_view_renderer: linkval %r (final)"%(linkval,))
     return '''<a href="%s" target="_blank">%s</a>'''%(linkval, textval)
Example #14
0
 def render(self, context):
     """
     Render Boolean value for viewing.
     """
     textval = BoolCheckboxValueMapper.encode(get_field_view_value(context, None))
     return "<span>%s</span>"%textval
Example #15
0
 def render(self, context):
     """
     Render token list for viewing.
     """
     tokenset = get_field_view_value(context, None)
     return TokenSetValueMapper.encode(tokenset) if tokenset else "&nbsp;"
Example #16
0
 def render(self, context):
     """
     Render token list for viewing.
     """
     tokenset = get_field_view_value(context, None)
     return TokenSetValueMapper.encode(tokenset) if tokenset else "&nbsp;"