Exemplo n.º 1
0
    def doProcessRender(self, request):
        self.setLayout('public/imageEditor.html')
        try:
            imageKey = request.REQUEST['imageKey']
            image = Picture.objects.get(pk__exact=imageKey)
            if (not image.isPrivate):
                tagGroups = ImagesAPI.getImageTagGroups(image,
                                                        user=request.user,
                                                        getTags=True,
                                                        getLinks=True,
                                                        isKey=False)
                imageMetadata = ImagesAPI.getImageMetadata(image,
                                                           user=request.user,
                                                           isKey=False)

                return {
                    'imageMetadata': json.dumps(imageMetadata),
                    'tagGroups': json.dumps(tagGroups),
                    'image': image
                }
            else:
                self.setLayout('public/404Media.html')
                return {}
        except ObjectDoesNotExist:
            self.setLayout('public/404Media.html')
            return {}
        except KeyError:
            self.setLayout('public/404Media.html')
            return {}
Exemplo n.º 2
0
	def doProcessRender(self, request):
		if request.REQUEST.has_key('tagGroupKey'):
			# the key for lookup and the image it is attached to
			tagGroupKey = request.REQUEST['tagGroupKey']
			tags = ImagesAPI.getImageTags(tagGroupKey, user=request.user, isKey=True)
			self.setJsonObject(tags)
		else:
			self.setJsonObject({
				'error' : True,
				'errorMessage' : ImagesAPI.NO_TAG_GROUP_KEY
			})
Exemplo n.º 3
0
    def doProcessRender(self, request):
        renderObj = {'error': False, 'errorMessage': ImagesAPI.NO_ERROR}
        if request.REQUEST.has_key('imageKey'):
            # the key for lookup and the image it is attached to
            imageKey = request.REQUEST['imageKey']
            renderObj = ImagesAPI.getImageMetadata(imageKey, request.user)
        else:
            renderObj['error'] = True
            renderObj['errorMessage'] = ImagesAPI.NO_IMAGE_KEY

        self.setJsonObject(renderObj)
Exemplo n.º 4
0
    def doProcessRender(self, request):
        self.setLayout('admin/imageEditor.html')

        try:
            imageKey = request.REQUEST['imageKey']
            image = Picture.objects.get(pk__exact=imageKey)
            tagGroups = ImagesAPI.getImageTagGroups(image, user=request.user, getTags=True, getLinks=True, isKey=False)
            imageMetadata = ImagesAPI.getImageMetadata(image, user=request.user, isKey=False)
    
            return {
                'imageMetadata' : json.dumps(imageMetadata),
                'tagGroups' : json.dumps(tagGroups),
                'image' : image
            }
        except ObjectDoesNotExist:
            self.setLayout('public/404Media.html')
            return {}
        except KeyError:
            self.setLayout('public/404Media.html')
            return {}
Exemplo n.º 5
0
    def doProcessRender(self, request):
        self.setLayout("public/imageEditor.html")
        try:
            imageKey = request.REQUEST["imageKey"]
            image = Picture.objects.get(pk__exact=imageKey)
            if not image.isPrivate:
                tagGroups = ImagesAPI.getImageTagGroups(
                    image, user=request.user, getTags=True, getLinks=True, isKey=False
                )
                imageMetadata = ImagesAPI.getImageMetadata(image, user=request.user, isKey=False)

                return {"imageMetadata": json.dumps(imageMetadata), "tagGroups": json.dumps(tagGroups), "image": image}
            else:
                self.setLayout("public/404Media.html")
                return {}
        except ObjectDoesNotExist:
            self.setLayout("public/404Media.html")
            return {}
        except KeyError:
            self.setLayout("public/404Media.html")
            return {}
Exemplo n.º 6
0
	def doProcessRender(self, request):
		renderObj = {
			'error' : False,
			'errorMessage' : ImagesAPI.NO_ERROR
		}
		if request.REQUEST.has_key('imageKey'):
			# the key for lookup and the image it is attached to
			imageKey = request.REQUEST['imageKey']
			renderObj = ImagesAPI.getImageMetadata(imageKey, request.user)				
		else:
			renderObj['error'] = True
			renderObj['errorMessage'] = ImagesAPI.NO_IMAGE_KEY
		

		self.setJsonObject(renderObj)
Exemplo n.º 7
0
	def doProcessRender(self, request):
		renderObj = {
			'error' : False,
			'errorMessage' : ImagesAPI.NO_ERROR,
		}
		
		if request.REQUEST.has_key('imageKey'):
			# the key for lookup and the image it is attached to
			imageKey = request.REQUEST['imageKey']
			getTags = False
			if(request.REQUEST.has_key('getTags')):
				getTags = request.REQUEST['getTags'].lower() == 'true'
			
			renderObj = ImagesAPI.getImageTagGroups(imageKey, user=request.user, getTags=getTags, isKey=True)			
		else:
			renderObj['error'] = True
			renderObj['errorMessage'] = NO_IMAGE_KEY


		self.setJsonObject(renderObj)
Exemplo n.º 8
0
    def doProcessRender(self, request):
        renderObj = {
            'error': False,
            'errorMessage': ImagesAPI.NO_ERROR,
        }

        if request.REQUEST.has_key('imageKey'):
            # the key for lookup and the image it is attached to
            imageKey = request.REQUEST['imageKey']
            getTags = False
            if (request.REQUEST.has_key('getTags')):
                getTags = request.REQUEST['getTags'].lower() == 'true'

            renderObj = ImagesAPI.getImageTagGroups(imageKey,
                                                    user=request.user,
                                                    getTags=getTags,
                                                    isKey=True)
        else:
            renderObj['error'] = True
            renderObj['errorMessage'] = NO_IMAGE_KEY

        self.setJsonObject(renderObj)