示例#1
0
    def __init__(self, obj=[], g_id="NaN", title=""):
        self._images = list()
        self.id = g_id
        self.title = title
        self.obj = obj

        if ISlideshow.providedBy(obj):
            if g_id == "NaN":
                self.id = obj.UID()
            if title == "":
                self.title = obj.Title()
            self.addSlideshow(obj)
        elif IImage.providedBy(obj):
            self.addImage(obj)
        else:
            for image in obj:
                if IImage.providedBy(image):
                    self.addImage(image)
示例#2
0
    def __init__(self, obj=[], g_id="NaN", title=""):
        self._images = list()
        self.id = g_id
        self.title=title
        self.obj = obj

        if ISlideshow.providedBy(obj):
            if g_id=="NaN":
                self.id = obj.UID()
            if title=="":
                self.title = obj.Title()
            self.addSlideshow(obj)
        elif IImage.providedBy(obj):
            self.addImage(obj)
        else:
            for image in obj:
                if IImage.providedBy(image):
                    self.addImage(image)
示例#3
0
    def gallery(self):
        """return a single rfasite.slideshow as a PhotoGallery associated with the article"""

        #slideshows are embedded via the Layout Tab, so we must journey into cp_container to find it.
        cp = getattr(self.obj, 'cp_container', None)
        if cp is None:
            return None

        if self._gallery is not None:
            return self._gallery

        slots = cp.filled_slots.values()
        for slot in slots:
            for elem in slot.values():
                obj = elem.getTarget()
                if ISlideshow.providedBy(obj):
                    #be lazy.  The first gallery you find is all you get!
                    self._gallery = PhotoGallery(obj)

        return self._gallery
示例#4
0
    def gallery(self):
        """return a single rfasite.slideshow as a PhotoGallery associated with the article"""

        #slideshows are embedded via the Layout Tab, so we must journey into cp_container to find it.
        cp = getattr(self.obj, 'cp_container', None)
        if cp is None:
            return None

        if self._gallery is not None:
            return self._gallery

        slots = cp.filled_slots.values()
        for slot in slots:
            for elem in slot.values():
                obj = elem.getTarget()
                if ISlideshow.providedBy(obj):
                    #be lazy.  The first gallery you find is all you get!
                    self._gallery = PhotoGallery(obj)

        return self._gallery