示例#1
0
def getGoogleTemplate(gadgetData):
    metadata = gadgetData['metadata']
    googleContext = Context({
        'platform':
        'google',
        'gadgetUri':
        metadata['gadgetUri'],
        'gadgetTitle':
        metadata['name'],
        'gadgetVendor':
        notEmptyValueOrDefault(metadata, 'vendor', metadata['owner']),
        'gadgetMail':
        notEmptyValueOrDefault(metadata, 'email',
                               settings.DEFAULT_EZWEB_AUTHOR_EMAIL),
        'gadgetDescription':
        notEmptyValueOrDefault(metadata, 'description', metadata['name']),
        'gadgetHeight':
        notEmptyValueOrDefault(metadata, 'height',
                               settings.DEFAULT_EZWEB_GADGET_HEIGHT),
        'gadgetWidth':
        notEmptyValueOrDefault(metadata, 'width',
                               settings.DEFAULT_EZWEB_GADGET_WIDTH),
        'gadgetPersistent':
        metadata['persistent'],
        'gadgetScreens':
        gadgetData['screens']
    })
    return loader.render_to_string(
        path.join('resources', 'gadget', 'googleTemplate.xml'), googleContext)
示例#2
0
文件: views.py 项目: conwetlab/fast
    def __completeGadgetData(self, request):
        if request.POST.has_key('gadget'):
            json = simplejson.loads(request.POST['gadget'], encoding = 'utf-8')
        else:
            raise Exception ('Gadget parameter expected in screenflow json')

        gadgetData = getGadgetData(request.POST['screenflow'])

        metadata = gadgetData['metadata']
        #Gadget Data
        metadata['label'] = valueOrDefault(json, 'label', {'en-gb': 'FAST Gadget'})
        metadata['name'] = metadata['label']['en-gb']
        metadata['shortname'] =  valueOrDefault(json, 'shortname', 'FAST Gadget')
        metadata['owner'] =  notEmptyValueOrDefault(json, 'owner', 'Morfeo')
        metadata['vendor'] =  valueOrEmpty(json, 'vendor')
        metadata['version'] = notEmptyValueOrDefault(json, 'version', '1.0')
        metadata['description'] = valueOrDefault(json, 'description', {'en-gb': ''})
        metadata['description'] = metadata['description']['en-gb']
        metadata['imageURI'] = valueOrDefault(json, 'imageURI', 'http://demo.fast.morfeo-project.org/fast/images/FASTLogo.png')
        metadata['gadgetHomepage'] = valueOrEmpty(json, 'gadgetHomepage')
        metadata['height'] = valueOrEmpty(json, 'height')
        metadata['width'] = valueOrEmpty(json, 'width')
        metadata['persistent'] = valueOrDefault(json, 'persistent', 'false')[0].upper()=='T'
        #Author Data
        metadata['authorName'] =  valueOrEmpty(json, 'authorName')
        metadata['email'] = valueOrEmpty(json, 'email')
        metadata['authorHomepage'] = valueOrEmpty(json, 'authorHomepage')
        #Platforms
        metadata['platforms'] = valueOrDefault(json, 'platforms', [])

        return gadgetData
示例#3
0
文件: gadget.py 项目: conwetlab/fast
def getGoogleTemplate(gadgetData):
    metadata = gadgetData['metadata']
    googleContext = Context({'platform': 'google',
                              'gadgetUri': metadata['gadgetUri'],
                              'gadgetTitle': metadata['name'],
                              'gadgetVendor': notEmptyValueOrDefault(metadata, 'vendor', metadata['owner']),
                              'gadgetMail': notEmptyValueOrDefault(metadata, 'email', settings.DEFAULT_EZWEB_AUTHOR_EMAIL),
                              'gadgetDescription': notEmptyValueOrDefault(metadata, 'description', metadata['name']),
                              'gadgetHeight': notEmptyValueOrDefault(metadata, 'height', settings.DEFAULT_EZWEB_GADGET_HEIGHT),
                              'gadgetWidth': notEmptyValueOrDefault(metadata, 'width', settings.DEFAULT_EZWEB_GADGET_WIDTH),
                              'gadgetPersistent': metadata['persistent'],
                              'gadgetScreens': gadgetData['screens']})
    return loader.render_to_string(path.join('resources','gadget','googleTemplate.xml'), googleContext);
示例#4
0
文件: views.py 项目: conwetlab/fast
    def __completeGadgetData(self, request):
        if request.POST.has_key('gadget'):
            json = simplejson.loads(request.POST['gadget'], encoding='utf-8')
        else:
            raise Exception('Gadget parameter expected in screenflow json')

        gadgetData = getGadgetData(request.POST['screenflow'])

        metadata = gadgetData['metadata']
        #Gadget Data
        metadata['label'] = valueOrDefault(json, 'label',
                                           {'en-gb': 'FAST Gadget'})
        metadata['name'] = metadata['label']['en-gb']
        metadata['shortname'] = valueOrDefault(json, 'shortname',
                                               'FAST Gadget')
        metadata['owner'] = notEmptyValueOrDefault(json, 'owner', 'Morfeo')
        metadata['vendor'] = valueOrEmpty(json, 'vendor')
        metadata['version'] = notEmptyValueOrDefault(json, 'version', '1.0')
        metadata['description'] = valueOrDefault(json, 'description',
                                                 {'en-gb': ''})
        metadata['description'] = metadata['description']['en-gb']
        metadata['imageURI'] = valueOrDefault(
            json, 'imageURI',
            'http://demo.fast.morfeo-project.org/fast/images/FASTLogo.png')
        metadata['gadgetHomepage'] = valueOrEmpty(json, 'gadgetHomepage')
        metadata['height'] = valueOrEmpty(json, 'height')
        metadata['width'] = valueOrEmpty(json, 'width')
        metadata['persistent'] = valueOrDefault(json, 'persistent',
                                                'false')[0].upper() == 'T'
        #Author Data
        metadata['authorName'] = valueOrEmpty(json, 'authorName')
        metadata['email'] = valueOrEmpty(json, 'email')
        metadata['authorHomepage'] = valueOrEmpty(json, 'authorHomepage')
        #Platforms
        metadata['platforms'] = valueOrDefault(json, 'platforms', [])

        return gadgetData
示例#5
0
文件: gadget.py 项目: conwetlab/fast
def getEzWebTemplate(gadgetData):
    metadata = gadgetData['metadata']
    ezWebContext = Context({'gadgetUri': metadata['gadgetUri'],
                            'gadgetTitle': metadata['name'],
                            'gadgetVendor': metadata['vendor'],
                            'gadgetVersion': metadata['version'],
                            'gadgetAuthor': notEmptyValueOrDefault(metadata, 'authorName', settings.DEFAULT_EZWEB_AUTHOR_NAME),
                            'gadgetMail': notEmptyValueOrDefault(metadata, 'email', settings.DEFAULT_EZWEB_AUTHOR_EMAIL),
                            'gadgetDescription': notEmptyValueOrDefault(metadata, 'description', metadata['name']),
                            'gadgetImageURI': notEmptyValueOrDefault(metadata, 'imageURI', settings.DEFAULT_GADGET_IMAGE_URI),
                            'gadgetWikiURI': notEmptyValueOrDefault(metadata, 'gadgetHomepage', settings.DEFAULT_GADGET_HOMEPAGE_URI),
                            'gadgetHeight': notEmptyValueOrDefault(metadata, 'height', settings.DEFAULT_EZWEB_GADGET_HEIGHT),
                            'gadgetWidth': notEmptyValueOrDefault(metadata, 'width', settings.DEFAULT_EZWEB_GADGET_WIDTH),
                            'gadgetPersistent': metadata['persistent'],
                            'gadgetSlots': gadgetData['prec'],
                            'gadgetEvents': gadgetData['post']})
    return loader.render_to_string(path.join('resources','gadget','ezwebTemplate.xml'), ezWebContext);
示例#6
0
def getEzWebTemplate(gadgetData):
    metadata = gadgetData['metadata']
    ezWebContext = Context({
        'gadgetUri':
        metadata['gadgetUri'],
        'gadgetTitle':
        metadata['name'],
        'gadgetVendor':
        metadata['vendor'],
        'gadgetVersion':
        metadata['version'],
        'gadgetAuthor':
        notEmptyValueOrDefault(metadata, 'authorName',
                               settings.DEFAULT_EZWEB_AUTHOR_NAME),
        'gadgetMail':
        notEmptyValueOrDefault(metadata, 'email',
                               settings.DEFAULT_EZWEB_AUTHOR_EMAIL),
        'gadgetDescription':
        notEmptyValueOrDefault(metadata, 'description', metadata['name']),
        'gadgetImageURI':
        notEmptyValueOrDefault(metadata, 'imageURI',
                               settings.DEFAULT_GADGET_IMAGE_URI),
        'gadgetWikiURI':
        notEmptyValueOrDefault(metadata, 'gadgetHomepage',
                               settings.DEFAULT_GADGET_HOMEPAGE_URI),
        'gadgetHeight':
        notEmptyValueOrDefault(metadata, 'height',
                               settings.DEFAULT_EZWEB_GADGET_HEIGHT),
        'gadgetWidth':
        notEmptyValueOrDefault(metadata, 'width',
                               settings.DEFAULT_EZWEB_GADGET_WIDTH),
        'gadgetPersistent':
        metadata['persistent'],
        'gadgetSlots':
        gadgetData['prec'],
        'gadgetEvents':
        gadgetData['post']
    })
    return loader.render_to_string(
        path.join('resources', 'gadget', 'ezwebTemplate.xml'), ezWebContext)