Merge lp:~openerp-dev/openobject-server/trunk-kanban-document-bth into lp:openobject-server
- trunk-kanban-document-bth
- Merge into trunk
Status: | Needs review |
---|---|
Proposed branch: | lp:~openerp-dev/openobject-server/trunk-kanban-document-bth |
Merge into: | lp:openobject-server |
Diff against target: |
377 lines (+214/-10) 6 files modified
openerp/addons/base/__openerp__.py (+2/-1) openerp/addons/base/ir/ir_attachment.py (+12/-2) openerp/addons/base/ir/ir_attachment_view.xml (+80/-6) openerp/addons/base/static/src/css/attachment.css (+37/-0) openerp/addons/base/static/src/css/attachment.sass (+33/-0) openerp/addons/base/static/src/js/apps.js (+50/-1) |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-server/trunk-kanban-document-bth |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+167724@code.launchpad.net |
Commit message
Description of the change
Hello,
Add radio widget to type field and Resource Id put in technical feature.
Thanks.
- 4881. By Bhumi Thakkar (Open ERP)
-
[IMP]Renamed Url to URL,Attachment Name to Document Name,Attachment to Document in searchview.
- 4882. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge lp:openobject-server.
- 4883. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge lp:openobject-server.
- 4884. By Bhumi Thakkar (Open ERP)
-
[IMP]If record is created then displayed history.
- 4885. By Bhumi Thakkar (Open ERP)
-
[IMP]Improved attrs.
- 4886. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge lp:openobject-server.
- 4887. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge lp:openobject-server.
- 4888. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge lp:openobject-server.
- 4889. By Bhumi Thakkar (Open ERP)
-
[IMP]Description or name wise document can search.
- 4890. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge lp:openobject-server.
- 4891. By Bhumi Thakkar (Open ERP)
-
[IMP]Object_name field added and displayed in form view and search view.
- 4892. By Bhumi Thakkar (Open ERP)
-
[IMP]res_model instead of object_name in search.
- 4893. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge lp:openobject-server.
- 4894. By Bhumi Thakkar (Open ERP)
-
[IMP]Added kanban view of attachment.
- 4895. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge trunk.
- 4896. By Bhumi Thakkar (Open ERP)
-
[IMP]Improved code and add some required files.
- 4897. By Bhumi Thakkar (Open ERP)
-
[IMP]Add res model and name in search.
- 4898. By Bhumi Thakkar (Open ERP)
-
[IMP]Removed model & id.
- 4899. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge lp:openobject-server.
- 4900. By Bhumi Thakkar (Open ERP)
-
[IMP]Add res_model in listview.
- 4901. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge trunk.
- 4902. By Bhumi Thakkar (Open ERP)
-
[IMP]Added mimetypes into base.
- 4903. By Bhumi Thakkar (Open ERP)
-
[IMP]Created filetype method for extension.
- 4904. By Bhumi Thakkar (Open ERP)
-
[IMP]Add comments.
- 4905. By Bhumi Thakkar (Open ERP)
-
[IMP]Removed method and field related extension.
- 4906. By Bhumi Thakkar (Open ERP)
-
[IMP]Removed file_extension from view.
- 4907. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge trunk.
- 4908. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge trunk.
- 4909. By Sunil Sharma(OpenERP)
-
[IMP REM]:Apps and web:
- 4910. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge trunk.
- 4911. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge trunk.
- 4912. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge trunk.
- 4913. By Darshan Kalola(OpenERP)
-
[MERGE]sync with trunk.
- 4914. By Sunil Sharma(OpenERP)
-
[MRG]:Merge lp:openobject-server
- 4915. By Chirag Dodiya(OpenERP)
-
[MRG]Merge with trunk
Unmerged revisions
- 4915. By Chirag Dodiya(OpenERP)
-
[MRG]Merge with trunk
- 4914. By Sunil Sharma(OpenERP)
-
[MRG]:Merge lp:openobject-server
- 4913. By Darshan Kalola(OpenERP)
-
[MERGE]sync with trunk.
- 4912. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge trunk.
- 4911. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge trunk.
- 4910. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge trunk.
- 4909. By Sunil Sharma(OpenERP)
-
[IMP REM]:Apps and web:
- 4908. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge trunk.
- 4907. By Bhumi Thakkar (Open ERP)
-
[MERGE]Merge trunk.
- 4906. By Bhumi Thakkar (Open ERP)
-
[IMP]Removed file_extension from view.
Preview Diff
1 | === modified file 'openerp/addons/base/__openerp__.py' |
2 | --- openerp/addons/base/__openerp__.py 2014-02-09 00:37:45 +0000 |
3 | +++ openerp/addons/base/__openerp__.py 2014-03-04 12:31:31 +0000 |
4 | @@ -97,7 +97,8 @@ |
5 | ], |
6 | 'installable': True, |
7 | 'auto_install': True, |
8 | - 'css': ['static/src/css/modules.css'], |
9 | + 'css': ['static/src/css/modules.css', |
10 | + 'static/src/css/attachment.css'], |
11 | 'js': [ |
12 | 'static/src/js/apps.js', |
13 | ], |
14 | |
15 | === modified file 'openerp/addons/base/ir/ir_attachment.py' |
16 | --- openerp/addons/base/ir/ir_attachment.py 2014-02-27 16:18:19 +0000 |
17 | +++ openerp/addons/base/ir/ir_attachment.py 2014-03-04 12:31:31 +0000 |
18 | @@ -163,9 +163,18 @@ |
19 | super(ir_attachment, self).write(cr, SUPERUSER_ID, [id], {'db_datas': value, 'file_size': file_size}, context=context) |
20 | return True |
21 | |
22 | + def _get_object_name(self, cr, uid, ids, name, args, context=None): |
23 | + res = {} |
24 | + for document in self.browse(cr, uid, ids, context=context): |
25 | + res[document.id] = False |
26 | + if document.res_model: |
27 | + obj = self.pool.get(document.res_model) |
28 | + res[document.id] = obj._description |
29 | + return res |
30 | + |
31 | _name = 'ir.attachment' |
32 | _columns = { |
33 | - 'name': fields.char('Attachment Name',size=256, required=True), |
34 | + 'name': fields.char('Document Name',size=256, required=True), |
35 | 'datas_fname': fields.char('File Name',size=256), |
36 | 'description': fields.text('Description'), |
37 | 'res_name': fields.function(_name_get_resname, type='char', size=128, string='Resource Name', store=True), |
38 | @@ -176,12 +185,13 @@ |
39 | 'company_id': fields.many2one('res.company', 'Company', change_default=True), |
40 | 'type': fields.selection( [ ('url','URL'), ('binary','Binary'), ], |
41 | 'Type', help="Binary File or URL", required=True, change_default=True), |
42 | - 'url': fields.char('Url', size=1024), |
43 | + 'url': fields.char('URL', size=1024), |
44 | # al: We keep shitty field names for backward compatibility with document |
45 | 'datas': fields.function(_data_get, fnct_inv=_data_set, string='File Content', type="binary", nodrop=True), |
46 | 'store_fname': fields.char('Stored Filename', size=256), |
47 | 'db_datas': fields.binary('Database Data'), |
48 | 'file_size': fields.integer('File Size'), |
49 | + 'object_name': fields.function(_get_object_name, string="Resource Type", type='char', size=8), |
50 | } |
51 | |
52 | _defaults = { |
53 | |
54 | === modified file 'openerp/addons/base/ir/ir_attachment_view.xml' |
55 | --- openerp/addons/base/ir/ir_attachment_view.xml 2013-10-06 11:26:08 +0000 |
56 | +++ openerp/addons/base/ir/ir_attachment_view.xml 2014-03-04 12:31:31 +0000 |
57 | @@ -13,18 +13,23 @@ |
58 | </h1> |
59 | <group> |
60 | <group string="Data"> |
61 | - <field name="type"/> |
62 | + <field name="type" widget="radio"/> |
63 | <field name="datas" filename="datas_fname" attrs="{'invisible':[('type','=','url')]}"/> |
64 | <field name="datas_fname" invisible="1" attrs="{'invisible':[('type','=','url')]}" class="oe_inline oe_right"/> |
65 | <field name="url" widget="url" attrs="{'invisible':[('type','=','binary')]}"/> |
66 | </group> |
67 | <group string="Attached To"> |
68 | - <field name="res_model"/> |
69 | - <field name="res_id"/> |
70 | - <field name="res_name"/> |
71 | + <group colspan="2" attrs="{'invisible': [('object_name', '=', False)]}"> |
72 | + <field name="object_name"/> |
73 | + <label string=""></label> |
74 | + <div name="object_div"> |
75 | + <field name="res_name" nolabel="1" class="oe_inline"/> |
76 | + <span groups="base.group_no_one">(<field name="res_id" nolabel="1" class="oe_inline"/>)</span> |
77 | + </div> |
78 | + </group> |
79 | <field name="company_id" groups="base.group_multi_company" widget="selection"/> |
80 | </group> |
81 | - <group groups="base.group_no_one" string="History"> |
82 | + <group groups="base.group_no_one" string="History" attrs="{'invisible':[('create_uid','=',False)]}"> |
83 | <label for="create_uid" string="Creation"/> |
84 | <div name="creation_div"> |
85 | <field name="create_uid" readonly="1" class="oe_inline"/> on |
86 | @@ -49,6 +54,7 @@ |
87 | <field name="company_id" groups="base.group_multi_company"/> |
88 | <field name="create_uid"/> |
89 | <field name="create_date"/> |
90 | + <field name="res_model" invisible="1"/> |
91 | </tree> |
92 | </field> |
93 | </record> |
94 | @@ -56,8 +62,11 @@ |
95 | <field name="model">ir.attachment</field> |
96 | <field name="arch" type="xml"> |
97 | <search string="Attachments"> |
98 | - <field name="name" filter_domain="['|', ('name','ilike',self), ('datas_fname','ilike',self)]" string="Attachment"/> |
99 | + <field name="name" string="Document" filter_domain="['|', '|', ('name','ilike',self), ('datas_fname','ilike',self), ('description','ilike',self)]"/> |
100 | + <field name="object_name" string="Resource Type" filter_domain="[('res_model','ilike',self)]"/> |
101 | <field name="create_date"/> |
102 | + <field name="res_model" string="Resource Model"/> |
103 | + <field name="res_name" string="Resource Name"/> |
104 | <filter icon="terp-stage" |
105 | string="URL" |
106 | domain="[('type','=','url')]"/> |
107 | @@ -77,17 +86,82 @@ |
108 | <filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}" groups="base.group_no_one"/> |
109 | <filter string="Company" icon="terp-gtk-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/> |
110 | <filter string="Creation Month" icon="terp-go-month" domain="[]" context="{'group_by':'create_date'}"/> |
111 | + <filter string="Resource Type" domain="[]" context="{'group_by':'res_model'}"/> |
112 | </group> |
113 | </search> |
114 | </field> |
115 | </record> |
116 | + <record model="ir.ui.view" id="view_document_file_kanban"> |
117 | + <field name="name">ir.attachment.kanban</field> |
118 | + <field name="model">ir.attachment</field> |
119 | + <field name="priority" eval="1"/> |
120 | + <field name="arch" type="xml"> |
121 | + <kanban version="7.0"> |
122 | + <field name="name"/> |
123 | + <field name="datas"/> |
124 | + <field name="datas_fname"/> |
125 | + <field name="type"/> |
126 | + <field name="url"/> |
127 | + <templates> |
128 | + <t t-name="kanban-box"> |
129 | + <div class="oe_document"> |
130 | + <t t-if="record.type.raw_value == 'binary' and kanban_filetype(record.datas_fname.raw_value) !== 'webimage' and kanban_filetype(record.datas_fname.raw_value) !== 'url'"> |
131 | + <div class="oe_attachment"> |
132 | + <t t-if="record.datas_fname.raw_value"> |
133 | + <a target="_blank" t-att-href="kanban_download(record.id.raw_value)"> |
134 | + <img t-att-src='_s + "/base/static/src/img/mimetypes/" + kanban_filetype(record.datas_fname.raw_value) + ".png"'></img> |
135 | + <t t-if="record.datas_fname.value"> |
136 | + <div class="oe_name"><field name="datas_fname"/></div> |
137 | + </t> |
138 | + </a> |
139 | + </t> |
140 | + <t t-if="!record.datas_fname.raw_value"> |
141 | + <img t-att-src='_s + "/base/static/src/img/mimetypes/" + kanban_filetype(record.datas_fname.raw_value) + ".png"'></img> |
142 | + </t> |
143 | + </div> |
144 | + </t> |
145 | + <t t-if="record.type.raw_value == 'binary' and kanban_filetype(record.datas_fname.raw_value) === 'webimage'"> |
146 | + <div class="oe_attachment"> |
147 | + <a target="_blank" t-att-href="kanban_download(record.id.raw_value)"> |
148 | + <img t-att-src="'data:image/png;base64,'+record.datas.raw_value"></img> |
149 | + <t t-if="record.datas_fname.value"> |
150 | + <div class="oe_name"><field name="datas_fname"/></div> |
151 | + </t> |
152 | + </a> |
153 | + </div> |
154 | + </t> |
155 | + <t t-if="record.type.raw_value == 'url' and !record.datas_fname.raw_value"> |
156 | + <div class="oe_attachment"> |
157 | + <a target="_blank" t-att-href="kanban_url(record.url.value)" t-att-title="kanban_url(record.url.value)"> |
158 | + <img t-att-src='_s + "/base/static/src/img/mimetypes/url.png"'></img> |
159 | + <t t-if="record.name.value"> |
160 | + <div class="oe_name oe_kanban_ellipsis"><field name="name"/></div> |
161 | + </t> |
162 | + </a> |
163 | + </div> |
164 | + </t> |
165 | + </div> |
166 | + </t> |
167 | + </templates> |
168 | + </kanban> |
169 | + </field> |
170 | + </record> |
171 | <record id="action_attachment" model="ir.actions.act_window"> |
172 | <field name="name">Attachments</field> |
173 | <field name="type">ir.actions.act_window</field> |
174 | <field name="res_model">ir.attachment</field> |
175 | <field name="view_type">form</field> |
176 | + <field name="view_mode">tree,form,kanban</field> |
177 | <field name="view_id" eval="False"/> |
178 | <field name="search_view_id" ref="view_attachment_search"/> |
179 | + <field name="help" type="html"> |
180 | + <p class="oe_view_nocontent_create"> |
181 | + Click to create a new document. |
182 | + </p><p> |
183 | + The Documents repository gives you access to all attachments, such |
184 | + as mails, project documents, invoices etc. |
185 | + </p> |
186 | + </field> |
187 | </record> |
188 | <menuitem action="action_attachment" id="menu_action_attachment" parent="base.next_id_9"/> |
189 | |
190 | |
191 | === added file 'openerp/addons/base/static/src/css/attachment.css' |
192 | --- openerp/addons/base/static/src/css/attachment.css 1970-01-01 00:00:00 +0000 |
193 | +++ openerp/addons/base/static/src/css/attachment.css 2014-03-04 12:31:31 +0000 |
194 | @@ -0,0 +1,37 @@ |
195 | +.openerp .oe_document { |
196 | + display: block; |
197 | + position: relative; |
198 | + margin: 0px; |
199 | +} |
200 | +.openerp .oe_document .oe_attachment{ |
201 | + display: inline-block; |
202 | + width: 150px; |
203 | + margin: 4px 2px; |
204 | + min-height: 80px; |
205 | + position: relative; |
206 | + border-radius: 3px; |
207 | + text-align: center; |
208 | + vertical-align: top; |
209 | +} |
210 | +.openerp .oe_document .oe_attachment .oe_name{ |
211 | + display: inline-block; |
212 | + padding: 1px 3px; |
213 | + margin-top: 60px; |
214 | + margin-bottom: 5px; |
215 | + background: #F4F5FA; |
216 | + overflow: hidden; |
217 | + color: #4c4c4c; |
218 | + text-shadow: none; |
219 | + border-radius: 3px; |
220 | + height: 60px; |
221 | + width: 150px; |
222 | + word-wrap: break-word; |
223 | +} |
224 | +.openerp .oe_document .oe_attachment img{ |
225 | + position: absolute; |
226 | + width: 55px; |
227 | + height: 55px; |
228 | + top: 0px; |
229 | + left: 50%; |
230 | + margin-left: -24px; |
231 | +} |
232 | \ No newline at end of file |
233 | |
234 | === added file 'openerp/addons/base/static/src/css/attachment.sass' |
235 | --- openerp/addons/base/static/src/css/attachment.sass 1970-01-01 00:00:00 +0000 |
236 | +++ openerp/addons/base/static/src/css/attachment.sass 2014-03-04 12:31:31 +0000 |
237 | @@ -0,0 +1,33 @@ |
238 | +.openerp .oe_document |
239 | + display: block |
240 | + position: relative |
241 | + margin: 0px |
242 | + .oe_attachment |
243 | + display: inline-block |
244 | + width: 150px |
245 | + margin: 4px 2px |
246 | + min-height: 80px |
247 | + position: relative |
248 | + border-radius: 3px |
249 | + text-align: center |
250 | + vertical-align: top |
251 | + .oe_name |
252 | + display: inline-block |
253 | + padding: 1px 3px |
254 | + margin-top: 60px |
255 | + margin-bottom: 5px |
256 | + background: #F4F5FA |
257 | + overflow: hidden |
258 | + color: #4c4c4c |
259 | + text-shadow: none |
260 | + border-radius: 3px |
261 | + height: 60px |
262 | + width: 150px |
263 | + word-wrap: break-word |
264 | + img |
265 | + position: absolute |
266 | + width: 55px |
267 | + height: 55px |
268 | + top: 0px |
269 | + left: 50% |
270 | + margin-left: -24px |
271 | \ No newline at end of file |
272 | |
273 | === added directory 'openerp/addons/base/static/src/img/mimetypes' |
274 | === added file 'openerp/addons/base/static/src/img/mimetypes/addresses.png' |
275 | Binary files openerp/addons/base/static/src/img/mimetypes/addresses.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/addresses.png 2014-03-04 12:31:31 +0000 differ |
276 | === added file 'openerp/addons/base/static/src/img/mimetypes/archive.png' |
277 | Binary files openerp/addons/base/static/src/img/mimetypes/archive.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/archive.png 2014-03-04 12:31:31 +0000 differ |
278 | === added file 'openerp/addons/base/static/src/img/mimetypes/audio.png' |
279 | Binary files openerp/addons/base/static/src/img/mimetypes/audio.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/audio.png 2014-03-04 12:31:31 +0000 differ |
280 | === added file 'openerp/addons/base/static/src/img/mimetypes/binary.png' |
281 | Binary files openerp/addons/base/static/src/img/mimetypes/binary.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/binary.png 2014-03-04 12:31:31 +0000 differ |
282 | === added file 'openerp/addons/base/static/src/img/mimetypes/calendar.png' |
283 | Binary files openerp/addons/base/static/src/img/mimetypes/calendar.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/calendar.png 2014-03-04 12:31:31 +0000 differ |
284 | === added file 'openerp/addons/base/static/src/img/mimetypes/certificate.png' |
285 | Binary files openerp/addons/base/static/src/img/mimetypes/certificate.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/certificate.png 2014-03-04 12:31:31 +0000 differ |
286 | === added file 'openerp/addons/base/static/src/img/mimetypes/disk.png' |
287 | Binary files openerp/addons/base/static/src/img/mimetypes/disk.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/disk.png 2014-03-04 12:31:31 +0000 differ |
288 | === added file 'openerp/addons/base/static/src/img/mimetypes/document.png' |
289 | Binary files openerp/addons/base/static/src/img/mimetypes/document.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/document.png 2014-03-04 12:31:31 +0000 differ |
290 | === added file 'openerp/addons/base/static/src/img/mimetypes/font.png' |
291 | Binary files openerp/addons/base/static/src/img/mimetypes/font.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/font.png 2014-03-04 12:31:31 +0000 differ |
292 | === added file 'openerp/addons/base/static/src/img/mimetypes/html.png' |
293 | Binary files openerp/addons/base/static/src/img/mimetypes/html.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/html.png 2014-03-04 12:31:31 +0000 differ |
294 | === added file 'openerp/addons/base/static/src/img/mimetypes/image.png' |
295 | Binary files openerp/addons/base/static/src/img/mimetypes/image.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/image.png 2014-03-04 12:31:31 +0000 differ |
296 | === added file 'openerp/addons/base/static/src/img/mimetypes/presentation.png' |
297 | Binary files openerp/addons/base/static/src/img/mimetypes/presentation.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/presentation.png 2014-03-04 12:31:31 +0000 differ |
298 | === added file 'openerp/addons/base/static/src/img/mimetypes/print.png' |
299 | Binary files openerp/addons/base/static/src/img/mimetypes/print.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/print.png 2014-03-04 12:31:31 +0000 differ |
300 | === added file 'openerp/addons/base/static/src/img/mimetypes/script.png' |
301 | Binary files openerp/addons/base/static/src/img/mimetypes/script.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/script.png 2014-03-04 12:31:31 +0000 differ |
302 | === added file 'openerp/addons/base/static/src/img/mimetypes/spreadsheet.png' |
303 | Binary files openerp/addons/base/static/src/img/mimetypes/spreadsheet.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/spreadsheet.png 2014-03-04 12:31:31 +0000 differ |
304 | === added file 'openerp/addons/base/static/src/img/mimetypes/text.png' |
305 | Binary files openerp/addons/base/static/src/img/mimetypes/text.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/text.png 2014-03-04 12:31:31 +0000 differ |
306 | === added file 'openerp/addons/base/static/src/img/mimetypes/unknown.png' |
307 | Binary files openerp/addons/base/static/src/img/mimetypes/unknown.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/unknown.png 2014-03-04 12:31:31 +0000 differ |
308 | === added file 'openerp/addons/base/static/src/img/mimetypes/url.png' |
309 | Binary files openerp/addons/base/static/src/img/mimetypes/url.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/url.png 2014-03-04 12:31:31 +0000 differ |
310 | === added file 'openerp/addons/base/static/src/img/mimetypes/vector.png' |
311 | Binary files openerp/addons/base/static/src/img/mimetypes/vector.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/vector.png 2014-03-04 12:31:31 +0000 differ |
312 | === added file 'openerp/addons/base/static/src/img/mimetypes/video.png' |
313 | Binary files openerp/addons/base/static/src/img/mimetypes/video.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/video.png 2014-03-04 12:31:31 +0000 differ |
314 | === added file 'openerp/addons/base/static/src/img/mimetypes/webimage.png' |
315 | Binary files openerp/addons/base/static/src/img/mimetypes/webimage.png 1970-01-01 00:00:00 +0000 and openerp/addons/base/static/src/img/mimetypes/webimage.png 2014-03-04 12:31:31 +0000 differ |
316 | === modified file 'openerp/addons/base/static/src/js/apps.js' |
317 | --- openerp/addons/base/static/src/js/apps.js 2014-01-16 09:17:16 +0000 |
318 | +++ openerp/addons/base/static/src/js/apps.js 2014-03-04 12:31:31 +0000 |
319 | @@ -2,8 +2,57 @@ |
320 | |
321 | instance.base.apps_remote = null; |
322 | instance.base.apps_client = null; |
323 | - |
324 | + |
325 | var _t = instance.web._t; |
326 | + // returns the file type of a file based on its extension |
327 | + // As it only looks at the extension it is quite approximative. |
328 | + instance.base.filetype = function (url) { |
329 | + var url = url && url.filename || url; |
330 | + var tokens = typeof url == 'string' ? url.split('.') : []; |
331 | + if(tokens.length <= 1){ |
332 | + return 'unknown'; |
333 | + } |
334 | + var extension = tokens[tokens.length -1]; |
335 | + if(extension.length === 0){ |
336 | + return 'unknown'; |
337 | + }else{ |
338 | + extension = extension.toLowerCase(); |
339 | + } |
340 | + var filetypes = { |
341 | + 'webimage': ['png','jpg','jpeg','jpe','gif'], // those have browser preview |
342 | + 'image': ['tif','tiff','tga', |
343 | + 'bmp','xcf','psd','ppm','pbm','pgm','pnm','mng', |
344 | + 'xbm','ico','icon','exr','webp','psp','pgf','xcf', |
345 | + 'jp2','jpx','dng','djvu','dds'], |
346 | + 'vector': ['ai','svg','eps','vml','cdr','xar','cgm','odg','sxd'], |
347 | + 'print': ['dvi','pdf','ps'], |
348 | + 'document': ['doc','docx','odm','odt'], |
349 | + 'presentation': ['key','keynote','odp','pps','ppt'], |
350 | + 'font': ['otf','ttf','woff','eot'], |
351 | + 'archive': ['zip','7z','ace','apk','bzip2','cab','deb','dmg','gzip','jar', |
352 | + 'rar','tar','gz','pak','pk3','pk4','lzip','lz','rpm'], |
353 | + 'certificate': ['cer','key','pfx','p12','pem','crl','der','crt','csr'], |
354 | + 'audio': ['aiff','wav','mp3','ogg','flac','wma','mp2','aac', |
355 | + 'm4a','ra','mid','midi'], |
356 | + 'video': ['asf','avi','flv','mkv','m4v','mpeg','mpg','mpe','wmv','mp4','ogm'], |
357 | + 'text': ['txt','rtf','ass'], |
358 | + 'html': ['html','xhtml','xml','htm','css'], |
359 | + 'disk': ['iso','nrg','img','ccd','sub','cdi','cue','mds','mdx'], |
360 | + 'script': ['py','js','c','cc','cpp','cs','h','java','bat','sh', |
361 | + 'd','rb','pl','as','cmd','coffee','m','r','vbs','lisp'], |
362 | + 'spreadsheet': ['123','csv','ods','numbers','sxc','xls','vc','xlsx'], |
363 | + 'binary': ['exe','com','bin','app'], |
364 | + }; |
365 | + for(filetype in filetypes){ |
366 | + var ext_list = filetypes[filetype]; |
367 | + for(var i = 0, len = ext_list.length; i < len; i++){ |
368 | + if(extension === ext_list[i]){ |
369 | + return filetype; |
370 | + } |
371 | + } |
372 | + } |
373 | + return 'unknown'; |
374 | + } |
375 | |
376 | instance.base.Apps = instance.web.Widget.extend({ |
377 | template: 'EmptyComponent', |