def delete_items(self, sources, fields=None): if self.request.environ['REQUEST_METHOD'] != 'POST': # Only non-javascript clients should see this. # Send them to a form they can POST from. # We can't just call & return the form; octopus hijacks the output. url = '%s/delete-form/?%s' % (self.context.absolute_url(), ZTUtils.make_query(sources=sources)) self.request.response.redirect(url) return None item_type = self.request.form.get("item_type") if item_type == 'pages' and PROJ_HOME in sources: sources.remove("project-home") ids = [x.split("/")[-1] for x in sources] brains = self.catalog(id=ids, path=self.project_path) deletions, survivors = self._delete(brains, sources) # for now we'll only return the deleted obj ids. later we may return the survivors too. commands = {} for obj_id in deletions: commands[obj_id] = { 'action': 'delete' } return commands
def getCSVQuery(self): info = self.context.restrictedTraverse( '@@sort_info').getSortInfo() kw = {'Content-Type': 'text/csv'} if info['selected']: kw[info['selected']['id']] = True return ZTUtils.make_query(info['form'], kw)
def jsfactory(self): context_url = self.context.absolute_url() if not context_url.endswith('/'): context_url += '/' query, show = build_query(self.context, self.request) query_string = ZTUtils.make_query(query) #return '' return u""" function() { return new OpenLayers.Layer.Vector("%s", { protocol: new OpenLayers.Protocol.HTTP({ url: "%s@@geometry_search.kml?%s", format: new OpenLayers.Format.KML({ extractStyles: true, extractAttributes: true}) }), strategies: [new OpenLayers.Strategy.Fixed()], visibility: true, projection: cgmap.createDefaultOptions().displayProjection }); } """ % (self.context.Title().replace("'", "'"), context_url, query_string)