[data] Use correct syntax to unset CSS attributes (closes #8602446)
'default' is actually a recognized CSS cursor name (the regular
pointer). Using this value doesn't revert to whatever cursor DOM
elements have by default ('pointer' on links, 'text' on text, etc).
The proper way to unset a CSS attribute on DOM elements is to set it to
an empty string.
http://stackoverflow.com/questions/2027935/how-to-remove-css-property-using-javascript
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr## This file is part of CubicWeb.## CubicWeb is free software: you can redistribute it and/or modify it under the# terms of the GNU Lesser General Public License as published by the Free# Software Foundation, either version 2.1 of the License, or (at your option)# any later version.## CubicWeb is distributed in the hope that it will be useful, but WITHOUT# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more# details.## You should have received a copy of the GNU Lesser General Public License along# with CubicWeb. If not, see <http://www.gnu.org/licenses/>."""csv export views"""__docformat__="restructuredtext en"_=unicodefromcubicweb.schemaimportdisplay_namefromcubicweb.predicatesimportany_rset,empty_rsetfromcubicweb.uilibimportUnicodeCSVWriterfromcubicweb.viewimportEntityView,AnyRsetViewclassCSVMixIn(object):"""mixin class for CSV views"""templatable=Falsecontent_type="text/comma-separated-values"binary=True# avoid unicode assertioncsv_params={'dialect':'excel','quotechar':'"','delimiter':';','lineterminator':'\n'}defset_request_content_type(self):"""overriden to set a .csv filename"""self._cw.set_content_type(self.content_type,filename='cubicwebexport.csv')defcsvwriter(self,**kwargs):params=self.csv_params.copy()params.update(kwargs)returnUnicodeCSVWriter(self.w,self._cw.encoding,**params)classCSVRsetView(CSVMixIn,AnyRsetView):"""dumps raw result set in CSV"""__regid__='csvexport'__select__=any_rset()title=_('csv export')defcall(self):writer=self.csvwriter()writer.writerow(self.columns_labels())rset,descr=self.cw_rset,self.cw_rset.descriptioneschema=self._cw.vreg.schema.eschemaforrowindex,rowinenumerate(rset):csvrow=[]forcolindex,valinenumerate(row):etype=descr[rowindex][colindex]ifvalisnotNoneandnoteschema(etype).final:# csvrow.append(val) # val is eid in that casecontent=self._cw.view('textincontext',rset,row=rowindex,col=colindex)else:content=self._cw.view('final',rset,format='text/plain',row=rowindex,col=colindex)csvrow.append(content)writer.writerow(csvrow)classCSVEntityView(CSVMixIn,EntityView):"""dumps rset's entities (with full set of attributes) in CSV the generated CSV file will have a table per entity type found in the resultset. ('table' here only means empty lines separation between table contents) """__regid__='ecsvexport'__select__=EntityView.__select__|empty_rset()title=_('csv export (entities)')defcall(self):req=self._cwrows_by_type={}writer=self.csvwriter()rowdef_by_type={}forindexinxrange(len(self.cw_rset)):entity=self.cw_rset.complete_entity(index)ifentity.e_schemanotinrows_by_type:rowdef_by_type[entity.e_schema]=[rsforrs,atinentity.e_schema.attribute_definitions()ifat!='Bytes']rows_by_type[entity.e_schema]=[[display_name(req,rschema.type)forrschemainrowdef_by_type[entity.e_schema]]]rows=rows_by_type[entity.e_schema]rows.append([entity.printable_value(rs.type,format='text/plain')forrsinrowdef_by_type[entity.e_schema]])forrowsinrows_by_type.itervalues():writer.writerows(rows)# use two empty lines as separatorwriter.writerows([[],[]])