Exemple #1
0
 def getForm(self, ctx, language, plugin, immutable):
     # I want to put the asset id at the top of the form in an immutable
     # field
     form = forms.Form()
     form.addField('assetId', types.String(immutable=True))
     populateFormFromPlugin(form, plugin, immutable)
     form.data = self.original.getAttributeValues(language)
     form.data['assetId'] = self.original.id
     self.updateFormAssets(plugin, form)
     return form
    def getForm(self, ctx, language, plugin, immutable):

        f = forms.Form()
        f.addField('targetUrl', types.String(immutable=True))
        populateFormFromPlugin(f, plugin, immutable)
        f.data = self.original.getAttributeValues(language)
        # Map to a key for the file upload widget
        # Make a URL for the image preview, no bigger than 160x120
        targetUrlWithVersion = plugin.application.services.getService(plugin.assetServiceName).getURLForAsset(self.original)
        targetUrlWithVersion = targetUrlWithVersion.add('size', '160x120')
        targetUrlWithVersion = targetUrlWithVersion.add('nocache', 1)
        # Make a URL that the public site will use
        targetUrlNoVersion = plugin.application.services.getService(plugin.assetServiceName).getURLForAsset(self.original,includeVersion=False)
        f.data['image'] = targetUrlWithVersion
        f.data['targetUrl'] = targetUrlNoVersion
        return f