[MERGE] trunk

bzr revid: fme@openerp.com-20121105093013-31veb91zkdeiuddh
This commit is contained in:
Fabien Meghazi 2012-11-05 10:30:13 +01:00
commit 2994db89ca
17 changed files with 559 additions and 236 deletions

View File

@ -575,6 +575,20 @@ def from_elementtree(el, preserve_whitespaces=False):
res["children"] = kids res["children"] = kids
return res return res
def content_disposition(filename, req):
filename = filename.encode('utf8')
escaped = urllib2.quote(filename)
browser = req.httprequest.user_agent.browser
version = int((req.httprequest.user_agent.version or '0').split('.')[0])
if browser == 'msie' and version < 9:
return "attachment; filename=%s" % escaped
elif browser == 'safari':
return "attachment; filename=%s" % filename
else:
return "attachment; filename*=UTF-8''%s" % escaped
#---------------------------------------------------------- #----------------------------------------------------------
# OpenERP Web web Controllers # OpenERP Web web Controllers
#---------------------------------------------------------- #----------------------------------------------------------
@ -841,7 +855,7 @@ class Database(openerpweb.Controller):
} }
return req.make_response(db_dump, return req.make_response(db_dump,
[('Content-Type', 'application/octet-stream; charset=binary'), [('Content-Type', 'application/octet-stream; charset=binary'),
('Content-Disposition', 'attachment; filename="' + filename + '"')], ('Content-Disposition', content_disposition(filename, req))],
{'fileToken': int(token)} {'fileToken': int(token)}
) )
except xmlrpclib.Fault, e: except xmlrpclib.Fault, e:
@ -1520,17 +1534,6 @@ class Binary(openerpweb.Controller):
def placeholder(self, req): def placeholder(self, req):
addons_path = openerpweb.addons_manifest['web']['addons_path'] addons_path = openerpweb.addons_manifest['web']['addons_path']
return open(os.path.join(addons_path, 'web', 'static', 'src', 'img', 'placeholder.png'), 'rb').read() return open(os.path.join(addons_path, 'web', 'static', 'src', 'img', 'placeholder.png'), 'rb').read()
def content_disposition(self, filename, req):
filename = filename.encode('utf8')
escaped = urllib2.quote(filename)
browser = req.httprequest.user_agent.browser
version = int((req.httprequest.user_agent.version or '0').split('.')[0])
if browser == 'msie' and version < 9:
return "attachment; filename=%s" % escaped
elif browser == 'safari':
return "attachment; filename=%s" % filename
else:
return "attachment; filename*=UTF-8''%s" % escaped
@openerpweb.httprequest @openerpweb.httprequest
def saveas(self, req, model, field, id=None, filename_field=None, **kw): def saveas(self, req, model, field, id=None, filename_field=None, **kw):
@ -1566,7 +1569,7 @@ class Binary(openerpweb.Controller):
filename = res.get(filename_field, '') or filename filename = res.get(filename_field, '') or filename
return req.make_response(filecontent, return req.make_response(filecontent,
[('Content-Type', 'application/octet-stream'), [('Content-Type', 'application/octet-stream'),
('Content-Disposition', self.content_disposition(filename, req))]) ('Content-Disposition', content_disposition(filename, req))])
@openerpweb.httprequest @openerpweb.httprequest
def saveas_ajax(self, req, data, token): def saveas_ajax(self, req, data, token):
@ -1596,7 +1599,7 @@ class Binary(openerpweb.Controller):
filename = res.get(filename_field, '') or filename filename = res.get(filename_field, '') or filename
return req.make_response(filecontent, return req.make_response(filecontent,
headers=[('Content-Type', 'application/octet-stream'), headers=[('Content-Type', 'application/octet-stream'),
('Content-Disposition', self.content_disposition(filename, req))], ('Content-Disposition', content_disposition(filename, req))],
cookies={'fileToken': int(token)}) cookies={'fileToken': int(token)})
@openerpweb.httprequest @openerpweb.httprequest
@ -1861,7 +1864,8 @@ class Export(View):
return req.make_response(self.from_data(columns_headers, import_data), return req.make_response(self.from_data(columns_headers, import_data),
headers=[('Content-Disposition', 'attachment; filename="%s"' % self.filename(model)), headers=[('Content-Disposition',
content_disposition(self.filename(model), req)),
('Content-Type', self.content_type)], ('Content-Type', self.content_type)],
cookies={'fileToken': int(token)}) cookies={'fileToken': int(token)})
@ -1997,11 +2001,11 @@ class Reports(View):
file_name = reports.read(res_id[0], ['name'], context)['name'] file_name = reports.read(res_id[0], ['name'], context)['name']
else: else:
file_name = action['report_name'] file_name = action['report_name']
file_name = '%s.%s' % (file_name, report_struct['format'])
return req.make_response(report, return req.make_response(report,
headers=[ headers=[
# maybe we should take of what characters can appear in a file name? ('Content-Disposition', content_disposition(file_name, req)),
('Content-Disposition', 'attachment; filename="%s.%s"' % (file_name, report_struct['format'])),
('Content-Type', report_mimetype), ('Content-Type', report_mimetype),
('Content-Length', len(report))], ('Content-Length', len(report))],
cookies={'fileToken': int(token)}) cookies={'fileToken': int(token)})

View File

@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: openerp-web\n" "Project-Id-Version: openerp-web\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-07-02 09:06+0200\n" "POT-Creation-Date: 2012-07-02 09:06+0200\n"
"PO-Revision-Date: 2012-10-23 14:30+0000\n" "PO-Revision-Date: 2012-11-01 12:07+0000\n"
"Last-Translator: Chertykov Denis <chertykov@gmail.com>\n" "Last-Translator: Chertykov Denis <chertykov@gmail.com>\n"
"Language-Team: Russian <ru@li.org>\n" "Language-Team: Russian <ru@li.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-10-24 05:20+0000\n" "X-Launchpad-Export-Date: 2012-11-02 05:20+0000\n"
"X-Generator: Launchpad (build 16179)\n" "X-Generator: Launchpad (build 16218)\n"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/chrome.js:176 #: addons/web/static/src/js/chrome.js:176
@ -306,7 +306,7 @@ msgstr "Группировать по: %s"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/search.js:1132 #: addons/web/static/src/js/search.js:1132
msgid "GroupBy" msgid "GroupBy"
msgstr "" msgstr "Группировать по"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/search.js:1267 #: addons/web/static/src/js/search.js:1267
@ -535,7 +535,7 @@ msgstr "Удалить"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:762 #: addons/web/static/src/xml/base.xml:762
msgid "Duplicate" msgid "Duplicate"
msgstr "Клонировать" msgstr "Дублировать"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/view_form.js:133 #: addons/web/static/src/js/view_form.js:133
@ -867,13 +867,13 @@ msgstr "Удалить"
#: addons/web/static/src/xml/base.xml:166 #: addons/web/static/src/xml/base.xml:166
#: addons/web/static/src/xml/base.xml:329 #: addons/web/static/src/xml/base.xml:329
msgid "Backup" msgid "Backup"
msgstr "Резервное копирование" msgstr "Резервная копия"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:195 #: addons/web/static/src/xml/base.xml:195
#: addons/web/static/src/xml/base.xml:330 #: addons/web/static/src/xml/base.xml:330
msgid "Restore" msgid "Restore"
msgstr "Востановить" msgstr "Восстановить"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:332 #: addons/web/static/src/xml/base.xml:332
@ -908,7 +908,7 @@ msgstr "Язык по умолчанию:"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:91 #: addons/web/static/src/xml/base.xml:91
msgid "Admin password:" msgid "Admin password:"
msgstr "Пароль Администратора:" msgstr "Пароль администратора:"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:95 #: addons/web/static/src/xml/base.xml:95
@ -1080,7 +1080,7 @@ msgstr "Изменить действие"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:486 #: addons/web/static/src/xml/base.xml:486
msgid "Edit Workflow" msgid "Edit Workflow"
msgstr "Редактировать Процесс" msgstr "Редактировать процесс"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:491 #: addons/web/static/src/xml/base.xml:491
@ -1222,7 +1222,7 @@ msgstr "При изменении:"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:981 #: addons/web/static/src/xml/base.xml:981
msgid "Relation:" msgid "Relation:"
msgstr "Отношение:" msgstr "Связь:"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:985 #: addons/web/static/src/xml/base.xml:985
@ -1411,12 +1411,12 @@ msgstr "Применить"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:1509 #: addons/web/static/src/xml/base.xml:1509
msgid "Save & New" msgid "Save & New"
msgstr "Сохранить и Создать" msgstr "Сохранить и создать"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:1510 #: addons/web/static/src/xml/base.xml:1510
msgid "Save & Close" msgid "Save & Close"
msgstr "Сохранить и Закрыть" msgstr "Сохранить и закрыть"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:1617 #: addons/web/static/src/xml/base.xml:1617
@ -1556,7 +1556,7 @@ msgid ""
"For use if CSV files have titles on multiple lines, skips more than a single " "For use if CSV files have titles on multiple lines, skips more than a single "
"line during import" "line during import"
msgstr "" msgstr ""
"Применимо если в CSV файле заголовки расположены в нескольких строках и из " "Применимо если в CSV файле заголовки расположены в нескольких строках и их "
"необходимо пропустить" "необходимо пропустить"
#. openerp-web #. openerp-web
@ -1669,9 +1669,6 @@ msgstr "Предпросмотр файла, который система не
#~ msgid "Activate the developper mode" #~ msgid "Activate the developper mode"
#~ msgstr "Активировать режим разработчика" #~ msgstr "Активировать режим разработчика"
#~ msgid "Notebook Page \""
#~ msgstr "Страница Блокнота \""
#~ msgid "Filter disabled due to invalid syntax" #~ msgid "Filter disabled due to invalid syntax"
#~ msgstr "Фильтр отключен из-за неверного синтаксиса" #~ msgstr "Фильтр отключен из-за неверного синтаксиса"
@ -1686,3 +1683,6 @@ msgstr "Предпросмотр файла, который система не
#~ msgid "Advanced Filters" #~ msgid "Advanced Filters"
#~ msgstr "Расширенные фильтры" #~ msgstr "Расширенные фильтры"
#~ msgid "Notebook Page \""
#~ msgstr "Страница блокнота \""

View File

@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: openerp-web\n" "Project-Id-Version: openerp-web\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-07-02 09:06+0200\n" "POT-Creation-Date: 2012-07-02 09:06+0200\n"
"PO-Revision-Date: 2012-01-31 06:25+0000\n" "PO-Revision-Date: 2012-11-01 16:38+0000\n"
"Last-Translator: ERP Basing <erp@basing.si>\n" "Last-Translator: Dusan Laznik <laznik@mentis.si>\n"
"Language-Team: Slovenian <sl@li.org>\n" "Language-Team: Slovenian <sl@li.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-10-21 05:02+0000\n" "X-Launchpad-Export-Date: 2012-11-02 05:20+0000\n"
"X-Generator: Launchpad (build 16165)\n" "X-Generator: Launchpad (build 16218)\n"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/chrome.js:176 #: addons/web/static/src/js/chrome.js:176
@ -129,62 +129,62 @@ msgstr "OpenERP-Community Version"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/coresetup.js:619 #: addons/web/static/src/js/coresetup.js:619
msgid "less than a minute ago" msgid "less than a minute ago"
msgstr "" msgstr "manj kot minuto nazaj"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/coresetup.js:620 #: addons/web/static/src/js/coresetup.js:620
msgid "about a minute ago" msgid "about a minute ago"
msgstr "" msgstr "približno pred minuto"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/coresetup.js:621 #: addons/web/static/src/js/coresetup.js:621
#, python-format #, python-format
msgid "%d minutes ago" msgid "%d minutes ago"
msgstr "" msgstr "pred %d minutami"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/coresetup.js:622 #: addons/web/static/src/js/coresetup.js:622
msgid "about an hour ago" msgid "about an hour ago"
msgstr "" msgstr "pred približno eno uro"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/coresetup.js:623 #: addons/web/static/src/js/coresetup.js:623
#, python-format #, python-format
msgid "%d hours ago" msgid "%d hours ago"
msgstr "" msgstr "Pred %d urami"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/coresetup.js:624 #: addons/web/static/src/js/coresetup.js:624
msgid "a day ago" msgid "a day ago"
msgstr "" msgstr "pred enim dnevom"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/coresetup.js:625 #: addons/web/static/src/js/coresetup.js:625
#, python-format #, python-format
msgid "%d days ago" msgid "%d days ago"
msgstr "" msgstr "pred %d dnevi"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/coresetup.js:626 #: addons/web/static/src/js/coresetup.js:626
msgid "about a month ago" msgid "about a month ago"
msgstr "" msgstr "približno pred enim mesecem"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/coresetup.js:627 #: addons/web/static/src/js/coresetup.js:627
#, python-format #, python-format
msgid "%d months ago" msgid "%d months ago"
msgstr "" msgstr "pred %d meseci"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/coresetup.js:628 #: addons/web/static/src/js/coresetup.js:628
msgid "about a year ago" msgid "about a year ago"
msgstr "" msgstr "približno pred enim letom"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/coresetup.js:629 #: addons/web/static/src/js/coresetup.js:629
#, python-format #, python-format
msgid "%d years ago" msgid "%d years ago"
msgstr "" msgstr "Pred %d leti"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/data_export.js:6 #: addons/web/static/src/js/data_export.js:6
@ -293,13 +293,13 @@ msgstr ""
#. openerp-web #. openerp-web
#: addons/web/static/src/js/search.js:999 #: addons/web/static/src/js/search.js:999
msgid "Filter" msgid "Filter"
msgstr "" msgstr "Filter:"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/search.js:1108 #: addons/web/static/src/js/search.js:1108
#, python-format #, python-format
msgid "Group by: %s" msgid "Group by: %s"
msgstr "" msgstr "Združi po: %s"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/search.js:1132 #: addons/web/static/src/js/search.js:1132
@ -347,7 +347,7 @@ msgstr "Filtri"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/search.js:1762 #: addons/web/static/src/js/search.js:1762
msgid "Advanced" msgid "Advanced"
msgstr "" msgstr "Napredeno"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/search.js:1853 #: addons/web/static/src/js/search.js:1853
@ -632,7 +632,7 @@ msgstr "Dodaj: "
#. openerp-web #. openerp-web
#: addons/web/static/src/js/view_form.js:4230 #: addons/web/static/src/js/view_form.js:4230
msgid "Save As..." msgid "Save As..."
msgstr "" msgstr "Shrani kot ..."
#. openerp-web #. openerp-web
#: addons/web/static/src/js/view_form.js:4230 #: addons/web/static/src/js/view_form.js:4230
@ -669,7 +669,7 @@ msgstr "Skupina"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/view_list.js:549 #: addons/web/static/src/js/view_list.js:549
msgid "Do you really want to remove these records?" msgid "Do you really want to remove these records?"
msgstr "" msgstr "Res želite odstraniti te zapise?"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/views.js:925 #: addons/web/static/src/js/views.js:925
@ -679,7 +679,7 @@ msgstr "Opozorilo"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/view_list.js:716 #: addons/web/static/src/js/view_list.js:716
msgid "You must select at least one record." msgid "You must select at least one record."
msgstr "" msgstr "Izbrati morate vsaj en zapis"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/view_list.js:1243 #: addons/web/static/src/js/view_list.js:1243
@ -727,17 +727,17 @@ msgstr ""
#. openerp-web #. openerp-web
#: addons/web/static/src/js/views.js:716 #: addons/web/static/src/js/views.js:716
msgid "Print" msgid "Print"
msgstr "" msgstr "Tiskanje"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/views.js:717 #: addons/web/static/src/js/views.js:717
msgid "Attachment" msgid "Attachment"
msgstr "" msgstr "Priponka"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/views.js:718 addons/web/static/src/xml/base.xml:276 #: addons/web/static/src/js/views.js:718 addons/web/static/src/xml/base.xml:276
msgid "More" msgid "More"
msgstr "" msgstr "Dodatno"
#. openerp-web #. openerp-web
#: addons/web/static/src/js/views.js:810 #: addons/web/static/src/js/views.js:810
@ -757,7 +757,7 @@ msgstr "Izbrati morate vsaj en zapis."
#. openerp-web #. openerp-web
#: addons/web/static/src/js/views.js:875 #: addons/web/static/src/js/views.js:875
msgid "Uploading..." msgid "Uploading..."
msgstr "" msgstr "Pošiljanje ..."
#. openerp-web #. openerp-web
#: addons/web/static/src/js/views.js:885 #: addons/web/static/src/js/views.js:885
@ -963,7 +963,7 @@ msgstr ""
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:327 #: addons/web/static/src/xml/base.xml:327
msgid "Log out" msgid "Log out"
msgstr "" msgstr "Odjava"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:333 #: addons/web/static/src/xml/base.xml:333
@ -1028,7 +1028,7 @@ msgstr "Potrditev gesla:"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:390 #: addons/web/static/src/xml/base.xml:390
msgid "Open" msgid "Open"
msgstr "" msgstr "Odpri"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:390 #: addons/web/static/src/xml/base.xml:390
@ -1123,18 +1123,18 @@ msgstr ""
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:527 #: addons/web/static/src/xml/base.xml:527
msgid "Add..." msgid "Add..."
msgstr "" msgstr "Dodaj ..."
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:622 #: addons/web/static/src/xml/base.xml:622
#: addons/web/static/src/xml/base.xml:687 #: addons/web/static/src/xml/base.xml:687
msgid "or" msgid "or"
msgstr "" msgstr "ali"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:687 #: addons/web/static/src/xml/base.xml:687
msgid "Discard" msgid "Discard"
msgstr "" msgstr "Opusti"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:806 #: addons/web/static/src/xml/base.xml:806
@ -1220,7 +1220,7 @@ msgstr ""
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:981 #: addons/web/static/src/xml/base.xml:981
msgid "Relation:" msgid "Relation:"
msgstr "" msgstr "Relacija:"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:985 #: addons/web/static/src/xml/base.xml:985
@ -1235,7 +1235,7 @@ msgstr "Odpri vir"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:1063 #: addons/web/static/src/xml/base.xml:1063
msgid "Select date" msgid "Select date"
msgstr "" msgstr "Izberi datum"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:948 #: addons/web/static/src/xml/base.xml:948
@ -1298,7 +1298,7 @@ msgstr ""
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:1260 #: addons/web/static/src/xml/base.xml:1260
msgid "Button Type:" msgid "Button Type:"
msgstr "" msgstr "Vrsta tipke:"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:1264 #: addons/web/static/src/xml/base.xml:1264
@ -1318,7 +1318,7 @@ msgstr "Polje"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:1205 #: addons/web/static/src/xml/base.xml:1205
msgid "Advanced Search..." msgid "Advanced Search..."
msgstr "" msgstr "Napredno iskanje ..."
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:1287 #: addons/web/static/src/xml/base.xml:1287
@ -1363,7 +1363,7 @@ msgstr ""
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:1381 #: addons/web/static/src/xml/base.xml:1381
msgid "Filter name" msgid "Filter name"
msgstr "" msgstr "Ime filtra"
#. openerp-web #. openerp-web
#: addons/web/static/src/xml/base.xml:1383 #: addons/web/static/src/xml/base.xml:1383

View File

@ -295,7 +295,12 @@
// Bind the window resize event when the width or height is auto or % // Bind the window resize event when the width or height is auto or %
if (/auto|%/.test("" + options.width + options.height)) if (/auto|%/.test("" + options.width + options.height))
$(window).resize(function() {refresh(editor);}); $(window).resize(function() {
// CHM Note MonkeyPatch: if the DOM is not remove, refresh the cleditor
if(editor.$main.parent().parent().size()) {
refresh(editor);
}
});
// Create the iframe and resize the controls // Create the iframe and resize the controls
refresh(editor); refresh(editor);
@ -562,7 +567,7 @@
//================== //==================
// Private Functions // Private Functions
//================== //==================
// checksum - returns a checksum using the Adler-32 method // checksum - returns a checksum using the Adler-32 method
function checksum(text) function checksum(text)
{ {

View File

@ -217,7 +217,7 @@
background-clip: padding-box; background-clip: padding-box;
} }
.openerp.ui-dialog .ui-dialog-content { .openerp.ui-dialog .ui-dialog-content {
padding: 0px; padding: 0;
} }
.openerp.ui-dialog .ui-dialog-titlebar, .openerp.ui-dialog .ui-dialog-content, .openerp.ui-dialog .ui-dialog-buttonpane { .openerp.ui-dialog .ui-dialog-titlebar, .openerp.ui-dialog .ui-dialog-content, .openerp.ui-dialog .ui-dialog-buttonpane {
padding: 16px; padding: 16px;
@ -1186,7 +1186,7 @@
color: white; color: white;
padding: 2px 4px; padding: 2px 4px;
margin: 1px 6px 0 0; margin: 1px 6px 0 0;
border: 1px solid lightgrey; border: 1px solid lightGray;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
-moz-border-radius: 4px; -moz-border-radius: 4px;
-webkit-border-radius: 4px; -webkit-border-radius: 4px;
@ -1211,7 +1211,7 @@
transform: scale(1.1); transform: scale(1.1);
} }
.openerp .oe_secondary_submenu .oe_active { .openerp .oe_secondary_submenu .oe_active {
border-top: 1px solid lightgrey; border-top: 1px solid lightGray;
border-bottom: 1px solid #dedede; border-bottom: 1px solid #dedede;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
-moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 -1px 3px rgba(40, 40, 40, 0.2); -moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 -1px 3px rgba(40, 40, 40, 0.2);
@ -2060,10 +2060,11 @@
padding-bottom: 0; padding-bottom: 0;
} }
.openerp .oe_form div.oe_chatter { .openerp .oe_form div.oe_chatter {
box-sizing: border-box;
min-width: 682px; min-width: 682px;
max-width: 892px; max-width: 892px;
margin: 0 auto; margin: 0 auto;
padding: 16px 0 48px; padding: 16px 16px 48px;
} }
.openerp .oe_form div.oe_form_configuration p, .openerp .oe_form div.oe_form_configuration ul, .openerp .oe_form div.oe_form_configuration ol { .openerp .oe_form div.oe_form_configuration p, .openerp .oe_form div.oe_form_configuration ul, .openerp .oe_form div.oe_form_configuration ol {
color: #aaaaaa; color: #aaaaaa;
@ -2135,7 +2136,7 @@
} }
.openerp .oe_form .oe_form_label_help[for] span, .openerp .oe_form .oe_form_label[for] span { .openerp .oe_form .oe_form_label_help[for] span, .openerp .oe_form .oe_form_label[for] span {
font-size: 80%; font-size: 80%;
color: darkgreen; color: darkGreen;
vertical-align: top; vertical-align: top;
position: relative; position: relative;
top: -4px; top: -4px;
@ -2566,11 +2567,9 @@
.openerp .oe_list_editable .oe_list_content td.oe_list_field_cell { .openerp .oe_list_editable .oe_list_content td.oe_list_field_cell {
padding: 4px 6px 3px 6px; padding: 4px 6px 3px 6px;
} }
.openerp .oe_list.oe_list_editable td.oe_list_record_delete {
position: absolute;
}
.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) { .openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) {
color: transparent; color: transparent;
text-shadow: none;
} }
.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) * { .openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) * {
visibility: hidden; visibility: hidden;
@ -2877,6 +2876,78 @@
color: #333333; color: #333333;
} }
.openerp .oe_fileupload {
display: inline-block;
clear: both;
width: 100%;
}
.openerp .oe_fileupload .oe_add {
float: left;
position: relative;
width: 100%;
left: 2px;
top: 7px;
}
.openerp .oe_fileupload .oe_add button {
display: inline;
height: 24px;
font-size: 12px;
line-height: 12px;
vertical-align: middle;
}
.openerp .oe_fileupload .oe_add button.oe_attach {
width: 24px;
overflow: hidden;
width: 24px;
overflow: hidden;
background: transparent;
color: #7c7bad;
box-shadow: none;
border: none;
text-shadow: none;
}
.openerp .oe_fileupload .oe_add button.oe_attach .oe_e {
position: relative;
top: -1px;
left: -9px;
}
.openerp .oe_fileupload .oe_add input.oe_form_binary_file {
display: inline-block;
margin-left: -5px;
height: 28px;
width: 52px;
margin-top: -26px;
}
.openerp .oe_fileupload .oe_add .oe_attach_label {
color: #7c7bad;
margin-left: -3px;
}
.openerp .oe_fileupload .oe_attachments {
margin-bottom: 4px;
margin-right: 0px;
font-size: 12px;
border-radius: 2px;
border: solid 1px rgba(124, 123, 173, 0.14);
}
.openerp .oe_fileupload .oe_attachments .oe_attachment {
padding: 2px;
padding-left: 4px;
padding-right: 4px;
}
.openerp .oe_fileupload .oe_attachments .oe_attachment .oe_e {
font-size: 23px;
margin-top: -5px;
}
.openerp .oe_fileupload .oe_attachments .oe_attachment .oe_e:hover {
text-decoration: none;
}
.openerp .oe_fileupload .oe_attachments .oe_attachment:nth-child(odd) {
background: white;
}
.openerp .oe_fileupload .oe_attachments .oe_attachment:nth-child(even) {
background: #f4f5fa;
}
.kitten-mode-activated { .kitten-mode-activated {
background-image: url(http://placekitten.com/g/1365/769); background-image: url(http://placekitten.com/g/1365/769);
background-size: cover; background-size: cover;

View File

@ -258,6 +258,7 @@ $sheet-padding: 16px
// so remove position:relative // so remove position:relative
.ui-tabs .ui-tabs
position: static position: static
// Modal box // Modal box
&.ui-dialog &.ui-dialog
display: none display: none
@ -271,7 +272,7 @@ $sheet-padding: 16px
@include box-shadow(0 1px 12px rgba(0, 0, 0, 0.6)) @include box-shadow(0 1px 12px rgba(0, 0, 0, 0.6))
@include background-clip() @include background-clip()
.ui-dialog-content .ui-dialog-content
padding: 0px padding: 0
.ui-dialog-titlebar, .ui-dialog-content, .ui-dialog-buttonpane .ui-dialog-titlebar, .ui-dialog-content, .ui-dialog-buttonpane
padding: 16px padding: 16px
.ui-dialog-titlebar .ui-dialog-titlebar
@ -1636,10 +1637,11 @@ $sheet-padding: 16px
width: 400px width: 400px
padding-bottom: 0 padding-bottom: 0
div.oe_chatter div.oe_chatter
box-sizing: border-box
min-width: $sheet-min-width + 2* $sheet-padding min-width: $sheet-min-width + 2* $sheet-padding
max-width: $sheet-max-width + 2* $sheet-padding max-width: $sheet-max-width + 2* $sheet-padding
margin: 0 auto margin: 0 auto
padding: 16px 0 48px padding: 16px 16px 48px
div.oe_form_configuration div.oe_form_configuration
p, ul, ol p, ul, ol
color: #aaa color: #aaa
@ -2032,14 +2034,12 @@ $sheet-padding: 16px
.oe_list_content .oe_list_content
td.oe_list_field_cell td.oe_list_field_cell
padding: 4px 6px 3px 6px padding: 4px 6px 3px 6px
.oe_list.oe_list_editable
td.oe_list_record_delete
position: absolute
.oe_list.oe_list_editable.oe_editing .oe_list.oe_list_editable.oe_editing
.oe_edition .oe_list_field_cell:not(.oe_readonly) .oe_edition .oe_list_field_cell:not(.oe_readonly)
* *
visibility: hidden visibility: hidden
color: transparent color: transparent
text-shadow: none
.oe_m2o_drop_down_button .oe_m2o_drop_down_button
top: 5px top: 5px
.oe_m2o_cm_button .oe_m2o_cm_button
@ -2278,6 +2278,67 @@ $sheet-padding: 16px
float: right float: right
color: #333 color: #333
// }}} // }}}
.openerp
.oe_fileupload
display: inline-block
clear: both
width: 100%
.oe_add
float: left
position: relative
width: 100%
left: +2px
top: +7px
button
display: inline
height: 24px
font-size: 12px
line-height: 12px
vertical-align: middle
button.oe_attach
width: 24px
overflow: hidden
width: 24px
overflow: hidden
background: transparent
color: #7C7BAD
box-shadow: none
border: none
text-shadow: none
.oe_e
position: relative
top: -1px
left: -9px
input.oe_form_binary_file
display: inline-block
margin-left: -5px
height: 28px
width: 52px
margin-top: -26px
.oe_attach_label
color: #7C7BAD
margin-left: -3px
.oe_attachments
margin-bottom: 4px
margin-right: 0px
font-size: 12px
border-radius: 2px
border: solid 1px rgba(124,123,173,0.14)
.oe_attachment
padding: 2px
padding-left: 4px
padding-right: 4px
.oe_e
font-size: 23px
margin-top: -5px
.oe_e:hover
text-decoration: none
.oe_attachment:nth-child(odd)
background: white
.oe_attachment:nth-child(even)
background: #F4F5FA
// Kitten Mode {{{ // Kitten Mode {{{
.kitten-mode-activated .kitten-mode-activated
background-image: url(http://placekitten.com/g/1365/769) background-image: url(http://placekitten.com/g/1365/769)

View File

@ -471,7 +471,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
default_get: function(fields, options) { default_get: function(fields, options) {
options = options || {}; options = options || {};
return this._model.call('default_get', return this._model.call('default_get',
[fields], {context: this._model.context(options.context)}); [fields], {context: this.get_context(options.context)});
}, },
/** /**
* Creates a new record in db * Creates a new record in db
@ -480,7 +480,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @returns {$.Deferred} * @returns {$.Deferred}
*/ */
create: function(data) { create: function(data) {
return this._model.call('create', [data], {context: this._model.context()}); return this._model.call('create', [data], {context: this.get_context()});
}, },
/** /**
* Saves the provided data in an existing db record * Saves the provided data in an existing db record
@ -493,7 +493,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
*/ */
write: function (id, data, options) { write: function (id, data, options) {
options = options || {}; options = options || {};
return this._model.call('write', [[id], data], {context: this._model.context(options.context)}).done(this.trigger('dataset_changed', id, data, options)); return this._model.call('write', [[id], data], {context: this.get_context(options.context)}).done(this.trigger('dataset_changed', id, data, options));
}, },
/** /**
* Deletes an existing record from the database * Deletes an existing record from the database
@ -501,7 +501,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @param {Number|String} ids identifier of the record to delete * @param {Number|String} ids identifier of the record to delete
*/ */
unlink: function(ids) { unlink: function(ids) {
return this._model.call('unlink', [ids], {context: this._model.context()}).done(this.trigger('dataset_changed', ids)); return this._model.call('unlink', [ids], {context: this.get_context()}).done(this.trigger('dataset_changed', ids));
}, },
/** /**
* Calls an arbitrary RPC method * Calls an arbitrary RPC method
@ -532,7 +532,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @returns {$.Deferred} * @returns {$.Deferred}
*/ */
name_get: function(ids) { name_get: function(ids) {
return this._model.call('name_get', [ids], {context: this._model.context()}); return this._model.call('name_get', [ids], {context: this.get_context()});
}, },
/** /**
* *
@ -556,7 +556,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @param name * @param name
*/ */
name_create: function(name) { name_create: function(name) {
return this._model.call('name_create', [name], {context: this._model.context()}); return this._model.call('name_create', [name], {context: this.get_context()});
}, },
exec_workflow: function (id, signal) { exec_workflow: function (id, signal) {
return this._model.exec_workflow(id, signal); return this._model.exec_workflow(id, signal);
@ -606,7 +606,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
return instance.session.rpc('/web/dataset/resequence', { return instance.session.rpc('/web/dataset/resequence', {
model: this.model, model: this.model,
ids: ids, ids: ids,
context: this._model.context(options.context), context: this.get_context(options.context),
}).then(function (results) { }).then(function (results) {
return results; return results;
}); });

View File

@ -427,7 +427,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
var onchange = _.str.trim(on_change); var onchange = _.str.trim(on_change);
var call = onchange.match(/^\s?(.*?)\((.*?)\)\s?$/); var call = onchange.match(/^\s?(.*?)\((.*?)\)\s?$/);
if (!call) { if (!call) {
return null; throw new Error("Wrong on change format: " + onchange);
} }
var method = call[1]; var method = call[1];
@ -494,71 +494,59 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
var self = this; var self = this;
return this.on_change_mutex.exec(function() { return this.on_change_mutex.exec(function() {
try { try {
var response = {}, can_process_onchange = $.Deferred(); var def;
processed = processed || []; processed = processed || [];
processed.push(widget.name); processed.push(widget.name);
var on_change = widget.node.attrs.on_change; var on_change = widget.node.attrs.on_change;
if (on_change) { if (on_change) {
var change_spec = self.parse_on_change(on_change, widget); var change_spec = self.parse_on_change(on_change, widget);
if (change_spec) { def = self.rpc('/web/dataset/onchange', {
var ajax = { model: self.dataset.model,
url: '/web/dataset/onchange', method: change_spec.method,
async: false args: [(self.datarecord.id == null ? [] : [self.datarecord.id])].concat(change_spec.args),
}; context_id: change_spec.context_index == undefined ? null : change_spec.context_index + 1
can_process_onchange = self.rpc(ajax, { });
model: self.dataset.model, } else {
method: change_spec.method, def = $.when({});
args: [(self.datarecord.id == null ? [] : [self.datarecord.id])].concat(change_spec.args),
context_id: change_spec.context_index == undefined ? null : change_spec.context_index + 1
}).done(function(r) {
_.extend(response, r);
});
} else {
console.warn("Wrong on_change format", on_change);
}
}
// fail if onchange failed
if (can_process_onchange.state() === 'rejected') {
return can_process_onchange;
} }
return def.then(function(response) {
if (widget.field['change_default']) {
var fieldname = widget.name
var value_;
if (response.value && (fieldname in response.value)) {
// Use value from onchange if onchange executed
value_ = response.value[fieldname];
} else {
// otherwise get form value for field
value_ = self.fields[fieldname].get_value();
}
var condition = fieldname + '=' + value_;
if (widget.field['change_default']) { if (value_) {
var fieldname = widget.name, value_; return self.rpc('/web/dataset/call', {
if (response.value && (fieldname in response.value)) { model: 'ir.values',
// Use value from onchange if onchange executed method: 'get_defaults',
value_ = response.value[fieldname]; args: [self.model, condition]
} else { }).then(function (results) {
// otherwise get form value for field if (!results.length) {
value_ = self.fields[fieldname].get_value(); return response;
}
if (!response.value) {
response.value = {};
}
for(var i=0; i<results.length; ++i) {
// [whatever, key, value]
var triplet = results[i];
response.value[triplet[1]] = triplet[2];
}
return response;
});
}
} }
var condition = fieldname + '=' + value_; return response;
}).then(function(response) {
if (value_) { return self.on_processed_onchange(response, processed);
can_process_onchange = self.rpc({ });
url: '/web/dataset/call',
async: false
}, {
model: 'ir.values',
method: 'get_defaults',
args: [self.model, condition]
}).done(function (results) {
if (!results.length) { return; }
if (!response.value) {
response.value = {};
}
for(var i=0; i<results.length; ++i) {
// [whatever, key, value]
var triplet = results[i];
response.value[triplet[1]] = triplet[2];
}
});
}
}
if (can_process_onchange.state() === 'rejected') {
return can_process_onchange;
}
return self.on_processed_onchange(response, processed);
} catch(e) { } catch(e) {
console.error(e); console.error(e);
instance.webclient.crashmanager.show_message(e); instance.webclient.crashmanager.show_message(e);
@ -2962,7 +2950,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
self.uned_def = $.Deferred(); self.uned_def = $.Deferred();
var ed_delay = 200; var ed_delay = 200;
var ed_duration = 15000; var ed_duration = 15000;
var anyoneLoosesFocus = function() { var anyoneLoosesFocus = function (e) {
var used = false; var used = false;
if (self.floating) { if (self.floating) {
if (self.last_search.length > 0) { if (self.last_search.length > 0) {
@ -2986,7 +2974,10 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
self.ed_def = $.Deferred(); self.ed_def = $.Deferred();
self.ed_def.done(function() { self.ed_def.done(function() {
self.show_error_displayer(); self.show_error_displayer();
ignore_blur = false;
self.trigger('focused');
}); });
ignore_blur = true;
setTimeout(function() { setTimeout(function() {
self.ed_def.resolve(); self.ed_def.resolve();
self.uned_def.reject(); self.uned_def.reject();
@ -3316,7 +3307,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
e.cancel = true; e.cancel = true;
}); });
_(controller.columns).find(function (column) { _(controller.columns).find(function (column) {
if (!column instanceof instance.web.list.Handle) { if (!(column instanceof instance.web.list.Handle)) {
return false; return false;
} }
column.modifiers.invisible = true; column.modifiers.invisible = true;
@ -4869,6 +4860,132 @@ instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({
} }
}); });
/**
* Widget for (one2many field) to upload one or more file in same time and display in list.
* The user can delete his files.
* Options on attribute ; "blockui" {Boolean} block the UI or not
* during the file is uploading
*/
instance.web.form.FieldOne2ManyBinaryMultiFiles = instance.web.form.AbstractField.extend({
template: "FieldBinaryFileUploader",
init: function(field_manager, node) {
this._super(field_manager, node);
this.field_manager = field_manager;
this.node = node;
if(this.field.type != "one2many" || this.field.relation != 'ir.attachment') {
throw "The type of the field '"+this.field.string+"' must be a one2many field with a relation to 'ir.attachment' model.";
}
this.ds_file = new instance.web.DataSetSearch(this, 'ir.attachment');
this.fileupload_id = _.uniqueId('oe_fileupload_temp');
$(window).on(this.fileupload_id, _.bind(this.on_file_loaded, this));
},
start: function() {
this._super(this);
this.$el.on('change', 'input.oe_form_binary_file', this.on_file_change );
},
get_value: function() {
return _.map(this.get('value'), function (value) { return commands.link_to( value.id ); });
},
get_file_url: function (attachment) {
return instance.origin + '/web/binary/saveas?session_id=' + this.session.session_id + '&model=ir.attachment&field=datas&filename_field=datas_fname&id=' + attachment['id'];
},
render_value: function () {
var render = $(instance.web.qweb.render('FieldBinaryFileUploader.files', {'widget': this}));
render.on('click', '.oe_delete', _.bind(this.on_file_delete, this));
this.$('.oe_placeholder_files, .oe_attachments').replaceWith( render );
// reinit input type file
var $input = this.$('input.oe_form_binary_file');
$input.after($input.clone(true)).remove();
this.$(".oe_fileupload").show();
},
on_file_change: function (event) {
event.stopPropagation();
var self = this;
var $target = $(event.target);
if ($target.val() !== '') {
var filename = $target.val().replace(/.*[\\\/]/,'');
// if the files is currently uploded, don't send again
if( !isNaN(_.find(this.get('value'), function (file) { return (file.filename || file.name) == filename && file.upload; } )) ) {
return false;
}
// block UI or not
if(this.node.attrs.blockui) {
instance.web.blockUI();
}
// if the files exits for this answer, delete the file before upload
var files = _.filter(this.get('value'), function (file) {
if((file.filename || file.name) == filename) {
self.ds_file.unlink([file.id]);
return false;
} else {
return true;
}
});
// TODO : unactivate send on wizard and form
// submit file
this.$('form.oe_form_binary_form').submit();
this.$(".oe_fileupload").hide();
// add file on result
files.push({
'id': 0,
'name': filename,
'filename': filename,
'url': '',
'upload': true
});
this.set({'value': files});
}
},
on_file_loaded: function (event, result) {
// unblock UI
if(this.node.attrs.blockui) {
instance.web.unblockUI();
}
// TODO : activate send on wizard and form
var files = this.get('value');
for(var i in files){
if(files[i].filename == result.filename && files[i].upload) {
files[i] = {
'id': result.id,
'name': result.name,
'filename': result.filename,
'url': this.get_file_url(result)
};
}
}
this.set({'value': files});
this.render_value()
},
on_file_delete: function (event) {
event.stopPropagation();
var file_id=$(event.target).data("id");
if (file_id) {
var files=[];
for(var i in this.get('value')){
if(file_id != this.get('value')[i].id){
files.push(this.get('value')[i]);
}
else {
this.ds_file.unlink([file_id]);
}
}
this.set({'value': files});
}
},
});
instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({
template: "FieldStatus", template: "FieldStatus",
init: function(field_manager, node) { init: function(field_manager, node) {
@ -5021,6 +5138,7 @@ instance.web.form.widgets = new instance.web.Registry({
'progressbar': 'instance.web.form.FieldProgressBar', 'progressbar': 'instance.web.form.FieldProgressBar',
'image': 'instance.web.form.FieldBinaryImage', 'image': 'instance.web.form.FieldBinaryImage',
'binary': 'instance.web.form.FieldBinaryFile', 'binary': 'instance.web.form.FieldBinaryFile',
'one2many_binary': 'instance.web.form.FieldOne2ManyBinaryMultiFiles',
'statusbar': 'instance.web.form.FieldStatus', 'statusbar': 'instance.web.form.FieldStatus',
'monetary': 'instance.web.form.FieldMonetary', 'monetary': 'instance.web.form.FieldMonetary',
}); });

View File

@ -1100,7 +1100,6 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
}, this); }, this);
if (!this.$current) { return; } if (!this.$current) { return; }
this.$current.remove(); this.$current.remove();
this.$current = null;
}, },
get_records: function () { get_records: function () {
return this.records.map(function (record) { return this.records.map(function (record) {

View File

@ -252,9 +252,10 @@ openerp.web.list_editable = function (instance) {
var position = $cell.position(); var position = $cell.position();
field.set_dimensions($cell.outerHeight(), $cell.outerWidth()); field.set_dimensions($cell.outerHeight(), $cell.outerWidth());
field.$el.css({ field.$el.position({
top: position.top, my: 'left top',
left: position.left, at: 'left top',
of: $cell
}); });
}, },
/** /**
@ -410,15 +411,15 @@ openerp.web.list_editable = function (instance) {
}); });
this.editor.$el.on('keyup keydown', function (e) { this.editor.$el.on('keyup keydown', function (e) {
if (!self.editor.is_editing()) { return; } if (!self.editor.is_editing()) { return true; }
var key = _($.ui.keyCode).chain() var key = _($.ui.keyCode).chain()
.map(function (v, k) { return {name: k, code: v}; }) .map(function (v, k) { return {name: k, code: v}; })
.find(function (o) { return o.code === e.which; }) .find(function (o) { return o.code === e.which; })
.value(); .value();
if (!key) { return; } if (!key) { return true; }
var method = e.type + '_' + key.name; var method = e.type + '_' + key.name;
if (!(method in self)) { return; } if (!(method in self)) { return true; }
self[method](e); return self[method](e);
}); });
}, },
/** /**
@ -446,7 +447,10 @@ openerp.web.list_editable = function (instance) {
keyup_ENTER: function () { keyup_ENTER: function () {
return this._next(); return this._next();
}, },
keyup_ESCAPE: function () { keydown_ESCAPE: function (e) {
return false;
},
keyup_ESCAPE: function (e) {
return this.cancel_edition(); return this.cancel_edition();
}, },
/** /**

View File

@ -1169,11 +1169,54 @@
<input type="hidden" name="session_id" value=""/> <input type="hidden" name="session_id" value=""/>
<input type="hidden" name="callback" t-att-value="fileupload_id"/> <input type="hidden" name="callback" t-att-value="fileupload_id"/>
<t t-raw="__content__"/> <t t-raw="__content__"/>
<input type="file" class="oe_form_binary_file" name="ufile"/> <input type="file" class="oe_form_binary_file" name="ufile" t-if="widget.widget!='image'"/>
<input type="file" class="oe_form_binary_file" name="ufile" accept="image/*" t-if="widget.widget=='image'"/>
</form> </form>
<iframe t-att-id="fileupload_id" t-att-name="fileupload_id" style="display: none"/> <iframe t-att-id="fileupload_id" t-att-name="fileupload_id" style="display: none"/>
</div> </div>
</t> </t>
<t t-name="FieldBinaryFileUploader.files">
<div class="oe_attachments">
<t t-if="!widget.get('effective_readonly')" t-foreach="widget.get('value')" t-as="file">
<div class="oe_attachment">
<span t-if="(file.upload or file.percent_loaded&lt;100)" t-attf-title="{(file.name || file.filename) + (file.date?' \n('+file.date+')':'' )}" t-attf-name="{file.name || file.filename}">
<span class="oe_fileuploader_in_process">...Upload in progress...</span>
<t t-raw="file.name || file.filename"/>
</span>
<a t-if="(!file.upload or file.percent_loaded&gt;=100)" t-att-href="file.url" t-attf-title="{(file.name || file.filename) + (file.date?' \n('+file.date+')':'' )}">
<t t-raw="file.name || file.filename"/>
</a>
<t t-if="(!file.upload or file.percent_loaded&gt;=100)">
<a class="oe_right oe_delete oe_e" title="Delete this file" t-attf-data-id="{file.id}">[</a>
</t>
</div>
</t>
<t t-if="widget.get('effective_readonly')" t-foreach="widget.get('value')" t-as="file">
<div>
<a t-att-href="file.url" t-attf-title="{(file.name || file.filename) + (file.date?' \n('+file.date+')':'' )}">
<t t-raw="file.name || file.filename"/>
</a>
</div>
</t>
</div>
</t>
<t t-name="FieldBinaryFileUploader">
<div t-att-style="widget.node.attrs.style" t-attf-class="oe_fileupload #{widget.node.attrs.class ? widget.node.attrs.class :''}">
<div class="oe_placeholder_files"/>
<div class="oe_add" t-if="!widget.get('effective_readonly')">
<!-- uploader of file -->
<button class="oe_attach"><span class="oe_e">'</span></button>
<span class='oe_attach_label'>File</span>
<t t-call="HiddenInputFile">
<t t-set="fileupload_id" t-value="widget.fileupload_id"/>
<t t-set="fileupload_action">/web/binary/upload_attachment</t>
<input type="hidden" name="model" t-att-value="widget.view.model"/>
<input type="hidden" name="id" value="0"/>
<input type="hidden" name="session_id" t-att-value="widget.session.session_id"/>
</t>
</div>
</div>
</t>
<t t-name="WidgetButton"> <t t-name="WidgetButton">
<button type="button" class="oe_button oe_form_button" <button type="button" class="oe_button oe_form_button"
t-att-style="widget.node.attrs.style" t-att-style="widget.node.attrs.style"

View File

@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: openerp-web\n" "Project-Id-Version: openerp-web\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-07-02 09:06+0200\n" "POT-Creation-Date: 2012-07-02 09:06+0200\n"
"PO-Revision-Date: 2012-01-30 17:43+0000\n" "PO-Revision-Date: 2012-11-01 18:19+0000\n"
"Last-Translator: ERP Basing <erp@basing.si>\n" "Last-Translator: Dusan Laznik <laznik@mentis.si>\n"
"Language-Team: Slovenian <sl@li.org>\n" "Language-Team: Slovenian <sl@li.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-10-21 05:03+0000\n" "X-Launchpad-Export-Date: 2012-11-02 05:20+0000\n"
"X-Generator: Launchpad (build 16165)\n" "X-Generator: Launchpad (build 16218)\n"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:11 #: addons/web_calendar/static/src/js/calendar.js:11
@ -25,114 +25,114 @@ msgstr "Koledar"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:70 #: addons/web_calendar/static/src/js/calendar.js:70
msgid "Filter" msgid "Filter"
msgstr "" msgstr "Filter:"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:144 #: addons/web_calendar/static/src/js/calendar.js:144
msgid "Today" msgid "Today"
msgstr "" msgstr "Danes"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:145 #: addons/web_calendar/static/src/js/calendar.js:145
msgid "Day" msgid "Day"
msgstr "" msgstr "Dan"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:146 #: addons/web_calendar/static/src/js/calendar.js:146
msgid "Week" msgid "Week"
msgstr "" msgstr "Teden"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:147 #: addons/web_calendar/static/src/js/calendar.js:147
msgid "Month" msgid "Month"
msgstr "" msgstr "Mesec"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:148 #: addons/web_calendar/static/src/js/calendar.js:148
msgid "New event" msgid "New event"
msgstr "" msgstr "Nov dogodek"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:149 #: addons/web_calendar/static/src/js/calendar.js:149
msgid "Save" msgid "Save"
msgstr "" msgstr "Shrani"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:150 #: addons/web_calendar/static/src/js/calendar.js:150
msgid "Cancel" msgid "Cancel"
msgstr "" msgstr "Prekliči"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:151 #: addons/web_calendar/static/src/js/calendar.js:151
msgid "Details" msgid "Details"
msgstr "" msgstr "Podrobnosti"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:152 #: addons/web_calendar/static/src/js/calendar.js:152
msgid "Edit" msgid "Edit"
msgstr "" msgstr "Uredi"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:153 #: addons/web_calendar/static/src/js/calendar.js:153
msgid "Delete" msgid "Delete"
msgstr "" msgstr "Izbriši"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:155 #: addons/web_calendar/static/src/js/calendar.js:155
msgid "Event will be deleted permanently, are you sure?" msgid "Event will be deleted permanently, are you sure?"
msgstr "" msgstr "Dogodek bo trajno izbrisan. Ste prepričani?"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:156 #: addons/web_calendar/static/src/js/calendar.js:156
#: addons/web_calendar/static/src/js/calendar.js:169 #: addons/web_calendar/static/src/js/calendar.js:169
msgid "Description" msgid "Description"
msgstr "" msgstr "Opis"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:157 #: addons/web_calendar/static/src/js/calendar.js:157
msgid "Time period" msgid "Time period"
msgstr "" msgstr "Obdobje"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:158 #: addons/web_calendar/static/src/js/calendar.js:158
msgid "Full day" msgid "Full day"
msgstr "" msgstr "Cel dan"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:161 #: addons/web_calendar/static/src/js/calendar.js:161
msgid "Do you want to edit the whole set of repeated events?" msgid "Do you want to edit the whole set of repeated events?"
msgstr "" msgstr "Želite urediti celotno zbirko ponavljajočih dogodkov?"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:162 #: addons/web_calendar/static/src/js/calendar.js:162
msgid "Repeat event" msgid "Repeat event"
msgstr "" msgstr "Ponavljajoč dogodek"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:163 #: addons/web_calendar/static/src/js/calendar.js:163
msgid "Disabled" msgid "Disabled"
msgstr "" msgstr "Onemogočeno"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:164 #: addons/web_calendar/static/src/js/calendar.js:164
msgid "Enabled" msgid "Enabled"
msgstr "" msgstr "Omogočeno"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:167 #: addons/web_calendar/static/src/js/calendar.js:167
#: addons/web_calendar/static/src/js/calendar.js:175 #: addons/web_calendar/static/src/js/calendar.js:175
msgid "Agenda" msgid "Agenda"
msgstr "" msgstr "Dnevni red"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:168 #: addons/web_calendar/static/src/js/calendar.js:168
msgid "Date" msgid "Date"
msgstr "" msgstr "Datum"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/js/calendar.js:172 #: addons/web_calendar/static/src/js/calendar.js:172
msgid "Year" msgid "Year"
msgstr "" msgstr "Leto"
#. openerp-web #. openerp-web
#: addons/web_calendar/static/src/xml/web_calendar.xml:5 #: addons/web_calendar/static/src/xml/web_calendar.xml:5

View File

@ -22,6 +22,7 @@ instance.web.DiagramView = instance.web.View.extend({
this.context = {}; this.context = {};
this.ids = this.dataset.ids; this.ids = this.dataset.ids;
this.on('view_loaded', self, self.load_diagram); this.on('view_loaded', self, self.load_diagram);
this.on('pager_action_executed', self, self.pager_action_trigger);
}, },
start: function() { start: function() {
var self = this; var self = this;
@ -59,12 +60,7 @@ instance.web.DiagramView = instance.web.View.extend({
self.$el.find('.oe_diagram_header').append(html_label); self.$el.find('.oe_diagram_header').append(html_label);
}) })
this.$el.find('div.oe_diagram_pager button[data-pager-action]').click(function() { this.init_pager();
var action = $(this).data('pager-action');
self.execute_pager_action(action);
});
this.do_update_pager();
// New Node,Edge // New Node,Edge
this.$el.find('#new_node.oe_diagram_button_new').click(function(){self.add_node();}); this.$el.find('#new_node.oe_diagram_button_new').click(function(){self.add_node();});
@ -366,36 +362,65 @@ instance.web.DiagramView = instance.web.View.extend({
form_controller.fields[self.connectors.attrs.destination].dirty = true; form_controller.fields[self.connectors.attrs.destination].dirty = true;
}); });
}, },
execute_pager_action: function(action) { do_hide: function () {
switch (action) { if (this.$pager) {
case 'first': this.$pager.hide();
this.dataset.index = 0;
break;
case 'previous':
this.dataset.previous();
break;
case 'next':
this.dataset.next();
break;
case 'last':
this.dataset.index = this.dataset.ids.length - 1;
break;
} }
this._super();
},
init_pager: function() {
var self = this;
if (this.$pager)
this.$pager.remove();
this.$pager = $(QWeb.render("DiagramView.pager", {'widget':self})).hide();
if (this.options.$pager) {
this.$pager.appendTo(this.options.$pager);
} else {
this.$el.find('.oe_diagram_pager').replaceWith(this.$pager);
}
this.$pager.on('click','a[data-pager-action]',function() {
var action = $(this).data('pager-action');
self.execute_pager_action(action);
});
this.do_update_pager();
},
pager_action_trigger: function(){
var loaded = this.dataset.read_index(_.keys(this.fields_view.fields)) var loaded = this.dataset.read_index(_.keys(this.fields_view.fields))
.then(this.on_diagram_loaded); .then(this.on_diagram_loaded);
this.do_update_pager(); this.do_update_pager();
return loaded; return loaded;
}, },
execute_pager_action: function(action) {
switch (action) {
case 'first':
this.dataset.index = 0;
break;
case 'previous':
this.dataset.previous();
break;
case 'next':
this.dataset.next();
break;
case 'last':
this.dataset.index = this.dataset.ids.length - 1;
break;
}
this.trigger('pager_action_executed');
},
do_update_pager: function(hide_index) { do_update_pager: function(hide_index) {
var $pager = this.$el.find('div.oe_diagram_pager'); this.$pager.toggle(this.dataset.ids.length > 1);
var index = hide_index ? '-' : this.dataset.index + 1; if (hide_index) {
if(!this.dataset.count) { $(".oe_diagram_pager_state", this.$pager).html("");
this.dataset.count = this.dataset.ids.length; } else {
$(".oe_diagram_pager_state", this.$pager).html(_.str.sprintf(_t("%d / %d"), this.dataset.index + 1, this.dataset.ids.length));
} }
$pager.find('span.oe_pager_index').html(index);
$pager.find('span.oe_pager_count').html(this.dataset.count);
}, },
do_show: function() { do_show: function() {

View File

@ -1,18 +1,19 @@
<template> <template>
<t t-name="DiagramView.pager">
<div class="oe_diagram_pager">
<t t-if="widget.options.pager !== false" t-call="ViewPager">
<span class="oe_diagram_pager_state"></span>
</t>
</div>
</t>
<t t-name="DiagramView"> <t t-name="DiagramView">
<div class="oe_diagram_header" t-att-id="widget.element_id + '_header'"> <div class="oe_diagram_header" t-att-id="widget.element_id + '_header'">
<h3 class="oe_diagram_title"/> <h3 class="oe_diagram_title"/>
<div t-if="widget.is_action_enabled('create')" class="oe_diagram_buttons"> <div t-if="widget.is_action_enabled('create')" class="oe_diagram_buttons">
<button type="button" id="new_node" class="oe_button oe_diagram_button_new">New Node</button> <button type="button" id="new_node" class="oe_button oe_diagram_button_new">New Node</button>
</div> </div>
<div class="oe_diagram_pager">
<t t-call="ViewPager">
<span class="oe_pager_index">0</span> / <span class="oe_pager_count">0</span>
</t>
</div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="diagram-container"> <div class="diagram-container">
<div class="oe_diagram_diagram"/> <div class="oe_diagram_diagram"/>
</div> </div>

View File

@ -257,16 +257,16 @@ instance.web_graph.GraphView = instance.web.View.extend({
var tree = $($.parseXML(view_get['arch'])); var tree = $($.parseXML(view_get['arch']));
var pos = 0; var pos = 0;
var xaxis = group_by || []; var xaxis = _.clone(group_by || []);
var yaxis = []; var yaxis = [];
tree.find("field").each(function() { tree.find("field").each(function() {
var field = $(this); var field = $(this);
if (! field.attr("name")) if (! field.attr("name"))
return; return;
if ((group_by.length == 0) && ((! pos) || field.attr('group'))) { if ((group_by.length == 0) && ((! pos) || instance.web.py_eval(field.attr('group') || "false"))) {
xaxis.push(field.attr('name')); xaxis.push(field.attr('name'));
} }
if (pos && ! field.attr('group')) { if (pos && ! instance.web.py_eval(field.attr('group') || "false")) {
yaxis.push(field.attr('name')); yaxis.push(field.attr('name'));
} }
pos += 1; pos += 1;
@ -340,8 +340,7 @@ instance.web_graph.GraphView = instance.web.View.extend({
var defs = []; var defs = [];
_.each(axis, function(x) { _.each(axis, function(x) {
var key = x[xaxis[0]] var key = x[xaxis[0]]
defs.push(obj.call("read_group", [new instance.web.CompoundDomain(domain, [[xaxis[0], '=' ,_convert_key(xaxis[0], key)]]), defs.push(obj.call("read_group", [domain, yaxis.concat(xaxis.slice(1, 2)), xaxis.slice(1, 2)], {context: context}).then(function(res) {
yaxis.concat(xaxis.slice(1, 2)), xaxis.slice(1, 2)], {context: context}).then(function(res) {
return [x, key, res]; return [x, key, res];
})); }));
}); });

View File

@ -1,20 +1,14 @@
.openerp .oe_view_editor { .openerp .oe_view_editor {
width: 100%; width: 100%;
border-collapse: collapse;
margin-left: -12px; margin-left: -12px;
width: 100%;
background-color: white;
border-spacing: 0;
} }
.openerp .oe_view_editor td { .openerp .oe_view_editor td {
text-align: center;
white-space: nowrap;
border: 1px solid #d8d8d8; border: 1px solid #d8d8d8;
cursor: pointer; cursor: pointer;
font-size: 90%;
} }
.openerp .oe_view_editor_field td { .openerp .oe_view_editor td *{
border: 0px !important; border: 0px !important;
color : #404040;
} }
.openerp .oe_view_editor tr:hover { .openerp .oe_view_editor tr:hover {
background-color: #ecebf2; background-color: #ecebf2;

View File

@ -18,11 +18,10 @@ instance.web.ViewManagerAction.include({
return this._super.apply(this,arguments); return this._super.apply(this,arguments);
} }
} }
}) });
instance.web_view_editor.ViewEditor = instance.web.Widget.extend({ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({
init: function(parent, element_id, dataset, view, options) { init: function(parent, element_id, dataset, view, options) {
this._super(parent); this._super(parent);
this.element_id = element_id;
this.parent = parent; this.parent = parent;
this.dataset = new instance.web.DataSetSearch(this, 'ir.ui.view', null, null), this.dataset = new instance.web.DataSetSearch(this, 'ir.ui.view', null, null),
this.model = dataset.model; this.model = dataset.model;
@ -74,12 +73,12 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({
$.when(this.action_manager.do_action(action)).done(function() { $.when(this.action_manager.do_action(action)).done(function() {
var viewmanager = self.action_manager.inner_widget; var viewmanager = self.action_manager.inner_widget;
var controller = viewmanager.views[viewmanager.active_view].controller; var controller = viewmanager.views[viewmanager.active_view].controller;
controller.on('view_loaded', function(){ controller.on('view_loaded', self, function(){
$(controller.groups).bind({ $(controller.groups).bind({
'selected': function(e, ids, records) { 'selected': function(e, ids, records) {
self.main_view_id = ids[0]; self.main_view_id = ids[0];
} }
}) });
}); });
}); });
}, },