def render_uploadframe(self, request): form = """ <form method="post" enctype="multipart/form-data" action="%s"> <input type="file" name="uploaded-file" /> <input type="hidden" name="submitID" value="" /> <input type="hidden" name="callbackID" value="" /> </form>""" % helpers.url(request.node, "uploadfile") return self.getTinyTemplate() % form
def render_uploadframe(self, request): form = """ <form method="post" enctype="multipart/form-data" action="%s"> <input type="file" name="uploaded-file" /> <input type="hidden" name="submitID" value="" /> <input type="hidden" name="callbackID" value="" /> </form>""" % helpers.url(request.node, "uploadfile") return tinyTemplate % form
def render_edit(self, request): fieldName = self.fieldName() field = '<input type="hidden" name="warpform-%s" class="warpform-upload" />' % fieldName iframe = '<iframe name="%s" src="%s" width="300" height="50" id="iframe-%s"></iframe>' % ( fieldName, url(request.node, "uploadframe"), fieldName) return field + iframe
def render_edit(self, request): objID = int(request.resource.args[0]) obj = store.get(self.model, objID) return helpers.renderTemplateObj(request, self._getCrudTemplate(), obj=self.crudModel(obj), redirect=helpers.url(request.node, 'view', request.resource.args))
def render_delete(self, request): objID = int(request.resource.args[0]) obj = store.get(self.model, objID) if obj is not None: store.remove(obj) store.commit() request.redirect(helpers.url(request.node)) return "Redirecting..."
def render_delete(self, request): objID = int(request.resource.args[0]) obj = request.store.get(self.model, objID) if obj is not None: request.store.remove(obj) request.store.commit() request.redirect(helpers.url(request.node)) return "Redirecting..."
def render_view(self, request): return '<img src="%s" />' % url( request.node, "image", (self.obj.__class__.__name__, self.obj.id, self.col))
def saveRedirect(self, request): return helpers.url(request.node, 'view', request.resource.args)