本文整理汇总了Python中mediatumtal.tal.getTAL函数的典型用法代码示例。如果您正苦于以下问题:Python getTAL函数的具体用法?Python getTAL怎么用?Python getTAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getTAL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tableRowButtons
def tableRowButtons(self, node):
if node.get('system.key') == node.get('key'):
# user has permission -> use users language
return tal.getTAL("workflow/workflow.html",
{'node': node,
'wfstep': self,
'lang': node.get('system.wflanguage')},
macro="workflow_buttons",
language=node.get('system.wflanguage'))
else:
# use standard language of request
return tal.getTAL("workflow/workflow.html", {'node': node, 'wfstep': self, 'lang':
getDefaultLanguage()}, macro="workflow_buttons", language=getDefaultLanguage())
示例2: getAdminFieldsHTML
def getAdminFieldsHTML(self, values={}):
return tal.getTAL("metadata/url.html",
{"valuelist": values["valuelist"],
"icons": m_url.icons,
"url_targets": m_url.targets},
macro="fieldeditor",
language=values["language"])
示例3: getSearchHTML
def getSearchHTML(self, context):
return tal.getTAL("metadata/dlist.html",
{"context": context,
"valuelist": filter(lambda x: x != "",
self.formatValues(context))},
macro="searchfield",
language=context.language)
示例4: getEditorHTML
def getEditorHTML(self, field, value="", width=400, lock=0, language=None, required=None):
context = Context(field, value=value, width=width, name=field.getName(), lock=lock, language=language)
return tal.getTAL("metadata/list.html", {"context": context,
"valuelist": filter(lambda x: x != "", self.formatValues(context)),
"required": self.is_required(required)},
macro="editorfield",
language=language)
示例5: getEditorHTML
def getEditorHTML(self, field, value="", width=400, lock=0, language=None, required=None):
# field may not be persisted as tree.Node and therefore may not have
# an attribute "get"
if hasattr(field, "get"):
enable_multilang = bool(field.get('multilang'))
else:
enable_multilang = False
if not language:
language = getDefaultLanguage()
try:
field_node_name = field.name
except:
field_node_name = None
context = {
"lock": lock,
"value": value,
"width": width,
"name": field_node_name,
"field": field,
"t": t,
"ident": str(field.id),
"current_lang": language,
"defaultlang": language, # not the systems default language
"languages": [],
"langdict": {language: value},
"language_snipper": self.language_snipper,
"value_is_multilang": 'single',
"multilang_display": 'display: none',
"enable_multilang": enable_multilang,
"expand_multilang": False,
"required": self.is_required(required)
}
if enable_multilang:
languages = config_languages
lang = [l for l in languages if l != language]
langdict = self.str2dict(value)
context.update(
{
"languages": lang,
"langdict": langdict,
"value_is_multilang": {True: 'multi', False: 'single'}[self.has_language_cutter(value)],
"multilang_display": {True: '', False: 'display: none'}[self.has_language_cutter(value)],
})
if enable_multilang and self.has_language_cutter(value):
context["expand_multilang"] = True
else:
context["expand_multilang"] = False
return tal.getTAL("metadata/memo.html",
context,
macro="editorfield",
language=language)
示例6: getSearchHTML
def getSearchHTML(self, context):
n = context.collection
valuelist = n.getAllAttributeValues(context.field.getName(), context.access)
locale.setlocale(locale.LC_COLLATE, '')
v = []
for key in sorted(valuelist.keys(), cmp=locale.strcoll):
v.append((key, valuelist[key]))
return tal.getTAL("metadata/ilist.html", {"context": context, "valuelist": v}, macro="searchfield", language=context.language)
示例7: getEditorHTML
def getEditorHTML(self, field, value="", width=40, lock=0, language=None, required=None):
return tal.getTAL("metadata/label.html", {"lock": lock,
"value": value,
"width": width,
"name": field.getName(),
"field": field},
macro="editorfield",
language=language)
示例8: getMaskEditorHTML
def getMaskEditorHTML(self, field, metadatatype=None, language=None):
value = ""
try:
if field:
value = field.getValues()
except AttributeError:
value = field
return tal.getTAL("metadata/mlist.html", {"value": value}, macro="maskeditor", language=language)
示例9: getEditorHTML
def getEditorHTML(self, field, value="", width=40, lock=0, language=None, required=None):
try:
values = field.get("valuelist").split(';')
except AttributeError:
values = field.split('\r\n')
while len(values) < 3:
values.append(u'')
return tal.getTAL("metadata/hlist.html", {"lock": lock, "startnode": values[0], "attrname": values[1], "onlylast": values[2], "value": value, "width": width, "name": field.getName(), "field": field, "required": self.is_required(required)}, macro="editorfield", language=language)
示例10: tableRowButtons
def tableRowButtons(self, node):
if node.get("system.key") == node.get("key"):
# user has permission -> use users language
return tal.getTAL(
"workflow/workflow.html",
{"node": node, "wfstep": self, "lang": node.get("system.wflanguage")},
macro="workflow_buttons",
language=node.get("system.wflanguage"),
)
else:
# use standard language of request
return tal.getTAL(
"workflow/workflow.html",
{"node": node, "wfstep": self, "lang": getDefaultLanguage()},
macro="workflow_buttons",
language=getDefaultLanguage(),
)
示例11: getEditorHTML
def getEditorHTML(self, metafield, value="", width=40, lock=0, language=None, required=None):
return tal.getTAL("metadata/treeselect.html", {"lock": lock,
"value": value,
"width": width,
"name": metafield.getName(),
"metafield": metafield,
"required": self.is_required(required)},
macro="editorfield",
language=language)
示例12: getMaskEditorHTML
def getMaskEditorHTML(self, field, metadatatype=None, language=None):
try:
value = field.getValues()
except:
value = ""
#value = ""
# if field:
# value = field.getValues()
return tal.getTAL("metadata/date.html", {"value": value, "dateoption": dateoption}, macro="maskeditor", language=language)
示例13: getMaskEditorHTML
def getMaskEditorHTML(self, field, metadatatype=None, language=None):
try:
value = field.getValues().split("\r\n")
except:
value = []
while len(value) < 5:
value.append("") # url(source), name variable, value variable
return tal.getTAL(
"metadata/dlist.html", {"value": value, "types": ["json", "list"]}, macro="maskeditor", language=language
)
示例14: getEditorHTML
def getEditorHTML(self, field, value="", width=400, lock=0, language=None, required=None):
value = value.split(";")
if len(value) < 2:
value = ["", 0, "black", 0]
return tal.getTAL("metadata/message.html", {"lock": lock,
"value": value,
"width": width,
"name": field.getName(),
"field": field,
"required": self.is_required(required)},
macro="editorfield",
language=language)
示例15: getMaskEditorHTML
def getMaskEditorHTML(self, field, metadatatype=None, language=None, required=None):
try:
values = field.get("valuelist").split(u';')
except AttributeError:
try:
values = field.split(u'\r\n')
except AttributeError:
values = []
while len(values) < 3:
values.append(u'')
return tal.getTAL("metadata/hlist.html", {"value": dict(parentnode=values[0], attrname=values[1], onlylast=values[2])}, macro="maskeditor", language=language)