equal
deleted
inserted
replaced
13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
14 # details. |
14 # details. |
15 # |
15 # |
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """Specific views for entities adapting to IDownloadable""" |
18 """ |
19 |
19 Specific views for entities adapting to IDownloadable |
|
20 ===================================================== |
|
21 """ |
20 __docformat__ = "restructuredtext en" |
22 __docformat__ = "restructuredtext en" |
21 _ = unicode |
23 _ = unicode |
22 |
24 |
23 from logilab.mtconverter import BINARY_ENCODINGS, TransformError, xml_escape |
25 from logilab.mtconverter import BINARY_ENCODINGS, TransformError, xml_escape |
24 from logilab.common.deprecation import class_renamed, deprecated |
26 from logilab.common.deprecation import class_renamed, deprecated |
48 w(u'%s</div>' % footer) |
50 w(u'%s</div>' % footer) |
49 w(u'</div></div>\n') |
51 w(u'</div></div>\n') |
50 |
52 |
51 |
53 |
52 class DownloadBox(component.EntityCtxComponent): |
54 class DownloadBox(component.EntityCtxComponent): |
|
55 """add download box""" |
53 __regid__ = 'download_box' # no download box for images |
56 __regid__ = 'download_box' # no download box for images |
54 __select__ = (component.EntityCtxComponent.__select__ & |
57 __select__ = (component.EntityCtxComponent.__select__ & |
55 adaptable('IDownloadable') & ~has_mimetype('image/')) |
58 adaptable('IDownloadable') & ~has_mimetype('image/')) |
56 |
59 |
57 order = 10 |
60 order = 10 |
69 self._cw._('download icon'), |
72 self._cw._('download icon'), |
70 xml_escape(idownloadable.download_file_name()))) |
73 xml_escape(idownloadable.download_file_name()))) |
71 |
74 |
72 |
75 |
73 class DownloadView(EntityView): |
76 class DownloadView(EntityView): |
74 """this view is replacing the deprecated 'download' controller and allow |
77 """download view |
|
78 |
|
79 this view is replacing the deprecated 'download' controller and allow |
75 downloading of entities providing the necessary interface |
80 downloading of entities providing the necessary interface |
76 """ |
81 """ |
77 __regid__ = 'download' |
82 __regid__ = 'download' |
78 __select__ = one_line_rset() & adaptable('IDownloadable') |
83 __select__ = one_line_rset() & adaptable('IDownloadable') |
79 |
84 |
197 else: |
202 else: |
198 self.w(tag) |
203 self.w(tag) |
199 |
204 |
200 |
205 |
201 class ImageView(AbstractEmbeddedView): |
206 class ImageView(AbstractEmbeddedView): |
|
207 """image embedded view""" |
202 __regid__ = 'image' |
208 __regid__ = 'image' |
203 __select__ = has_mimetype('image/') |
209 __select__ = has_mimetype('image/') |
204 |
210 |
205 title = _('image') |
211 title = _('image') |
206 _embedding_tag = tags.img |
212 _embedding_tag = tags.img |
207 |
213 |
208 |
214 |
209 class EHTMLView(AbstractEmbeddedView): |
215 class EHTMLView(AbstractEmbeddedView): |
|
216 """html embedded view""" |
210 __regid__ = 'ehtml' |
217 __regid__ = 'ehtml' |
211 __select__ = has_mimetype('text/html') |
218 __select__ = has_mimetype('text/html') |
212 |
219 |
213 title = _('embedded html') |
220 title = _('embedded html') |
214 _embedding_tag = tags.iframe |
221 _embedding_tag = tags.iframe |