当前位置: 首页>>代码示例>>Python>>正文


Python TemplateAPI.karl_client_data['text']方法代码示例

本文整理汇总了Python中karl.views.api.TemplateAPI.karl_client_data['text']方法的典型用法代码示例。如果您正苦于以下问题:Python TemplateAPI.karl_client_data['text']方法的具体用法?Python TemplateAPI.karl_client_data['text']怎么用?Python TemplateAPI.karl_client_data['text']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在karl.views.api.TemplateAPI的用法示例。


在下文中一共展示了TemplateAPI.karl_client_data['text']方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __call__

# 需要导入模块: from karl.views.api import TemplateAPI [as 别名]
# 或者: from karl.views.api.TemplateAPI import karl_client_data['text'] [as 别名]
 def __call__(self):
     page_title = 'Edit ' + self.context.title
     api = TemplateAPI(self.context, self.request, page_title)
     api.karl_client_data['text'] = dict(
             enable_imagedrawer_upload = True,
             )
     return {'api':api, 'actions':()}
开发者ID:disko,项目名称:karl,代码行数:9,代码来源:blog.py

示例2: __call__

# 需要导入模块: from karl.views.api import TemplateAPI [as 别名]
# 或者: from karl.views.api.TemplateAPI import karl_client_data['text'] [as 别名]
 def __call__(self):
     api = TemplateAPI(self.context, self.request,
                       'Add Blog Entry')
     api.karl_client_data['text'] = dict(
             enable_imagedrawer_upload = True,
             )
     return {'api':api, 'actions':()}
开发者ID:Falmarri,项目名称:karl,代码行数:9,代码来源:blog.py

示例3: __call__

# 需要导入模块: from karl.views.api import TemplateAPI [as 别名]
# 或者: from karl.views.api.TemplateAPI import karl_client_data['text'] [as 别名]
 def __call__(self):
     api = TemplateAPI(self.context, self.request,
                       'Add Wiki Page')
     api.karl_client_data['text'] = dict(
         enable_wiki_plugin=True,
         enable_imagedrawer_upload=True)
     return {'api': api, 'actions': ()}
开发者ID:lslaz1,项目名称:karl,代码行数:9,代码来源:wiki.py

示例4: __call__

# 需要导入模块: from karl.views.api import TemplateAPI [as 别名]
# 或者: from karl.views.api.TemplateAPI import karl_client_data['text'] [as 别名]
 def __call__(self):
     layout_provider = get_layout_provider(self.context, self.request)
     layout = layout_provider('community')
     api = TemplateAPI(self.context, self.request, 'Add Forum Topic')
     api.karl_client_data['text'] = dict(
             enable_imagedrawer_upload = True,
             )
     return {'api':api, 'actions':(), 'layout':layout}
开发者ID:Falmarri,项目名称:karl,代码行数:10,代码来源:forum.py

示例5: __call__

# 需要导入模块: from karl.views.api import TemplateAPI [as 别名]
# 或者: from karl.views.api.TemplateAPI import karl_client_data['text'] [as 别名]
 def __call__(self):
     page_title = 'Edit %s' % self.context.title
     api = TemplateAPI(self.context, self.request, page_title)
     # prepare client data
     api.karl_client_data['text'] = dict(
             enable_wiki_plugin = True,
             enable_imagedrawer_upload = True,
             )
     return {'api':api,
             'actions':(),
             }
开发者ID:reebalazs,项目名称:karl,代码行数:13,代码来源:wiki.py

示例6: __call__

# 需要导入模块: from karl.views.api import TemplateAPI [as 别名]
# 或者: from karl.views.api.TemplateAPI import karl_client_data['text'] [as 别名]
 def __call__(self):
     page_title = 'Edit ' + self.context.title
     api = TemplateAPI(self.context, self.request, page_title)
     # ux1
     api.karl_client_data['text'] = dict(
             enable_imagedrawer_upload = True,
             )
     # ux2
     layout = self.request.layout_manager.layout
     layout.head_data['panel_data']['tinymce'] = api.karl_client_data['text']
     return {'api':api, 'actions':()}
开发者ID:hj91,项目名称:karl,代码行数:13,代码来源:blog.py

示例7: __call__

# 需要导入模块: from karl.views.api import TemplateAPI [as 别名]
# 或者: from karl.views.api.TemplateAPI import karl_client_data['text'] [as 别名]
 def __call__(self):
     layout_provider = get_layout_provider(self.context, self.request)
     layout = layout_provider('community')
     page_title = 'Edit %s' % self.context.title
     api = TemplateAPI(self.context, self.request, page_title)
     api.karl_client_data['text'] = dict(
         enable_imagedrawer_upload=True)
     return {
         'api': api,
         'layout': layout,
         'actions': []}
开发者ID:lslaz1,项目名称:karl,代码行数:13,代码来源:forum.py

示例8: __call__

# 需要导入模块: from karl.views.api import TemplateAPI [as 别名]
# 或者: from karl.views.api.TemplateAPI import karl_client_data['text'] [as 别名]
 def __call__(self):
     context = self.context
     request = self.request
     api = TemplateAPI(context, request, 'Add Page')
     community = find_community(context)
     layout_provider = get_layout_provider(context, request)
     if community is not None:
         layout = layout_provider('community')
     else:
         layout = layout_provider('generic')
     api.karl_client_data['text'] = dict(
             enable_imagedrawer_upload = True,
             )
     return {'api': api, 'actions': (), 'layout': layout}
开发者ID:cguardia,项目名称:karl,代码行数:16,代码来源:page.py

示例9: __call__

# 需要导入模块: from karl.views.api import TemplateAPI [as 别名]
# 或者: from karl.views.api.TemplateAPI import karl_client_data['text'] [as 别名]
    def __call__(self):
        if not lock.is_locked(self.context):
            lock.lock(self.context, self.userid)

        page_title = 'Edit %s' % self.context.title
        api = TemplateAPI(self.context, self.request, page_title)
        # prepare client data
        api.karl_client_data['text'] = dict(
                enable_wiki_plugin = True,
                enable_imagedrawer_upload = True,
                )
        return {'api':api,
                'actions':(),
                'lock_info':lock.lock_info_for_view(self.context, self.request),
                }
开发者ID:cguardia,项目名称:karl,代码行数:17,代码来源:wiki.py

示例10: __call__

# 需要导入模块: from karl.views.api import TemplateAPI [as 别名]
# 或者: from karl.views.api.TemplateAPI import karl_client_data['text'] [as 别名]
 def __call__(self):
     layout_provider = get_layout_provider(self.context, self.request)
     old_layout = layout_provider('community')
     api = TemplateAPI(self.context, self.request, 'Add Forum Topic')
     # ux1
     api.karl_client_data['text'] = dict(
             enable_imagedrawer_upload = True,
             )
     # ux2
     layout = self.request.layout_manager.layout
     layout.section_style = "none"
     layout.head_data['panel_data']['tinymce'] = api.karl_client_data['text']
     return {
         'api': api,             # deprecated UX1
         'old_layout': old_layout,   # deprecated UX1
         'actions': []}          # deprecated UX1
开发者ID:hj91,项目名称:karl,代码行数:18,代码来源:forum.py

示例11: __call__

# 需要导入模块: from karl.views.api import TemplateAPI [as 别名]
# 或者: from karl.views.api.TemplateAPI import karl_client_data['text'] [as 别名]
 def __call__(self):
     context = self.context
     request = self.request
     api = TemplateAPI(context, request, 'Add Page')
     community = find_community(context)
     layout_provider = get_layout_provider(context, request)
     if community is not None:
         old_layout = layout_provider('community')
     else:
         old_layout = layout_provider('generic')
     # ux1
     api.karl_client_data['text'] = dict(
             enable_imagedrawer_upload = True,
             )
     # ux2
     layout = self.request.layout_manager.layout
     layout.section_style = "none"
     layout.head_data['panel_data']['tinymce'] = api.karl_client_data['text']
     return {
         'api': api,             # deprecated UX1
         'actions': (),          # deprecated UX1
         'old_layout': old_layout}   # deprecated UX1
开发者ID:hj91,项目名称:karl,代码行数:24,代码来源:page.py

示例12: show_blogentry_view

# 需要导入模块: from karl.views.api import TemplateAPI [as 别名]
# 或者: from karl.views.api.TemplateAPI import karl_client_data['text'] [as 别名]

#.........这里部分代码省略.........

        newc = {}
        newc['id'] = comment.__name__
        if has_permission('edit', comment, request):
            newc['edit_url'] = resource_url(comment, request, 'edit.html')
        else:
            newc['edit_url'] = None

        if has_permission('delete', comment, request):
            newc['delete_url'] = resource_url(comment, request, 'delete.html')
        else:
            newc['delete_url'] = None

        if has_permission('administer', comment, request):
            newc['advanced_url'] = resource_url(comment, request, 'advanced.html')
        else:
            newc['advanced_url'] = None

        # Display portrait
        photo = profile.get('photo')
        if photo is not None:
            photo_url = thumb_url(photo, request, PROFILE_THUMB_SIZE)
        else:
            photo_url = api.static_url + "/images/defaultUser.gif"
        newc["portrait_url"] = photo_url

        newc['author_url'] = author_url
        newc['author_name'] = author_name

        newc['date'] = karldates(comment.created, 'longform')
        newc['timestamp'] = comment.created
        newc['text'] = comment.text

        # Fetch the attachments info
        newc['attachments'] = fetch_attachments(comment, request)
        comments.append(newc)
    comments.sort(key=lambda c: c['timestamp'])

    client_json_data = dict(
        tagbox = get_tags_client_data(context, request),
        )

    actions = []
    if has_permission('edit', context, request):
        actions.append(('Edit', 'edit.html'))
    if has_permission('edit', context, request):
        actions.append(('Delete', 'delete.html'))
    if has_permission('administer', context, request):
        actions.append(('Advanced', 'advanced.html'))

    api.is_taggable = True

    byline_info = getMultiAdapter((context, request), IBylineInfo)
    blog = find_interface(context, IBlog)
    backto = {
        'href': resource_url(blog, request),
        'title': blog.title,
        }

    # manually construct formish comment form
    controller = AddCommentFormController(context['comments'], request)
    form_schema = schemaish.Structure()
    form_fields = controller.form_fields()
    for fieldname, field in form_fields:
        form_schema.add(fieldname, field)
    form_action_url = '%sadd_comment.html' % resource_url(context['comments'],
                                                       request)
    comment_form = Form(form_schema, add_default_action=False, name='save',
                        action_url=form_action_url)
    form_defaults = controller.form_defaults()
    comment_form.defaults = form_defaults
    request.form_defaults = form_defaults

    form_actions = [FormAction('submit', 'submit'),
                    FormAction('cancel', 'cancel', validate=False)]
    for action in form_actions:
        comment_form.add_action(action.name, action.title)

    widgets = controller.form_widgets(form_fields)
    for name, widget in widgets.items():
        comment_form[name].widget = widget

    # this is for enable imagedrawer for adding blog comments
    api.karl_client_data['text'] = dict(
            enable_imagedrawer_upload = True,
            )

    return dict(
        api=api,
        actions=actions,
        comments=comments,
        attachments=fetch_attachments(
            context['attachments'], request),
        head_data=convert_to_script(client_json_data),
        comment_form=comment_form,
        post_url=post_url,
        byline_info=byline_info,
        backto=backto,
        security_states = security_states,
        )
开发者ID:disko,项目名称:karl,代码行数:104,代码来源:blog.py

示例13: show_forum_topic_view

# 需要导入模块: from karl.views.api import TemplateAPI [as 别名]
# 或者: from karl.views.api.TemplateAPI import karl_client_data['text'] [as 别名]

#.........这里部分代码省略.........
            newc['delete_url'] = resource_url(comment, request, 'delete.html')
        else:
            newc['delete_url'] = None

        if has_permission('administer', comment, request):
            newc['advanced_url'] = resource_url(comment, request, 'advanced.html')
        else:
            newc['advanced_url'] = None

        # Display portrait
        photo = profile.get('photo')
        photo_url = {}
        if photo is not None:
            photo_url = thumb_url(photo, request, PROFILE_THUMB_SIZE)
        else:
            photo_url = api.static_url + "/images/defaultUser.gif"
        newc["portrait_url"] = photo_url

        newc['author_url'] = author_url
        newc['author_name'] = author_name

        newc['date'] = karldates(comment.created, 'longform')
        newc['timestamp'] = comment.created
        newc['text'] = comment.text

        # Fetch the attachments info
        newc['attachments'] = fetch_attachments(comment, request)
        comments.append(newc)
    comments.sort(key=lambda x: x['timestamp'])

    byline_info = getMultiAdapter((context, request), IBylineInfo)
    forum = find_interface(context, IForum)
    backto = {
        'href': resource_url(forum, request),
        'title': forum.title,
        }

    # provide client data for rendering current tags in the tagbox
    client_json_data = dict(
        tagbox = get_tags_client_data(context, request),
        )

    # Get a layout
    layout_provider = get_layout_provider(context, request)
    old_layout = layout_provider('community')

    if support_attachments(context):
        attachments = fetch_attachments(context['attachments'], request)
    else:
        attachments = ()

    # manually construct formish comment form
    controller = AddCommentFormController(context['comments'], request)
    form_schema = schemaish.Structure()
    form_fields = controller.form_fields()
    for fieldname, field in form_fields:
        form_schema.add(fieldname, field)
    form_action_url = '%sadd_comment.html' % resource_url(context['comments'],
                                                       request)
    comment_form = Form(form_schema, add_default_action=False, name='save',
                        action_url=form_action_url)
    form_defaults = controller.form_defaults()
    comment_form.defaults = form_defaults
    request.form_defaults = form_defaults

    form_actions = [FormAction('submit', 'submit'),
                    FormAction('cancel', 'cancel', validate=False)]
    for action in form_actions:
        comment_form.add_action(action.name, action.title)

    widgets = controller.form_widgets(form_fields)
    for name, widget in widgets.items():
        comment_form[name].widget = widget

    # enable imagedrawer for adding forum replies (comments)
    api.karl_client_data['text'] = dict(
            enable_imagedrawer_upload = True,
            )
    # ux2
    layout = request.layout_manager.layout
    layout.section_style = "none"
    layout.head_data['panel_data']['tinymce'] = api.karl_client_data['text']
    layout.head_data['panel_data']['tagbox'] = client_json_data['tagbox']
    layout.add_portlet('tagbox')

    return render_to_response(
        'templates/show_forum_topic.pt',
        dict(api=api,
             actions=actions,
             comments=comments,
             attachments=attachments,
             formfields=api.formfields,
             post_url=post_url,
             byline_info=byline_info,
             head_data=convert_to_script(client_json_data),
             backto=backto,
             old_layout=old_layout,
             comment_form=comment_form),
        request=request,
        )
开发者ID:hj91,项目名称:karl,代码行数:104,代码来源:forum.py


注:本文中的karl.views.api.TemplateAPI.karl_client_data['text']方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。