Пример #1
0
def jsondetails(context, request):
    scales = [{
        "size": size,
        "value": "@@images/image/{0}".format(name),
        "title": name,
        }
        for (name, size) in sorted(image_scales.items(), key=lambda x: x[1])
        ]

    if context.type == "image":
        thumb = request.resource_url(context) + "image/span2"
    else:
        thumb = None

    info = {
        "uid_relative_url": "resolveuid/6d4e5e43caf04d5abbab9adfe2dcca97",
        "thumb": thumb,
        "anchors": [],
        "uid_url": request.resource_url(context),
        "url": request.resource_url(context),
        "title": context.title,
        "description": context.description,
        "scales": scales,
        }
    return info
Пример #2
0
    def kottibrowser(self):

        tinymcepopup.need()
        kotti_tinymce.need()

        scales = [{
            "size": size,
            "value": name,
            "title": name,
        } for (name, size) in sorted(image_scales.items(), key=lambda x: x[1])]

        return {
            "image_selectable":
            self.context.type ==
            self.request.session["kottibrowser_requested_type"] == "image",
            "link_selectable":
            self.request.session["kottibrowser_requested_type"] != "image",
            "image_url":
            self.request.resource_url(self.context) + 'image',
            "image_scales":
            scales,
            # TODO: upload_allowed needs a better check.
            "upload_allowed":
            self.context.type == 'document',
        }
Пример #3
0
    def kottibrowser(self):

        scales = [{
            "size": size,
            "value": name,
            "title": name,
        } for (name, size) in sorted(image_scales.items(), key=lambda x: x[1])]

        return {
            "image_selectable": self.context.type == self.request.session["kottibrowser_requested_type"] == "image",
            "link_selectable": self.request.session["kottibrowser_requested_type"] != "image",
            "image_url": self.request.resource_url(self.context) + 'image',
            "image_scales": scales,
            # TODO: upload_allowed needs a better check.
            "upload_allowed": self.context.type == 'document',
        }