diff --git a/fields/__init__.py b/fields/__init__.py index c528370..8e82907 100644 --- a/fields/__init__.py +++ b/fields/__init__.py @@ -328,8 +328,9 @@ class Field: return self.indexed and not self.isMultiValued() and not \ ((self.type == 'String') and self.isSelection()) elif usage == 'ref': - return self.type in ('Integer', 'Float', 'Boolean', 'Date') or \ - ((self.type == 'String') and (self.format == 0)) + if self.type in ('Integer', 'Float', 'Boolean', 'Date'): return True + elif self.type == 'String': + return (self.format == 0) and not self.isMultilingual(None,True) def isShowable(self, obj, layoutType): '''When displaying p_obj on a given p_layoutType, must we show this diff --git a/fields/ref.py b/fields/ref.py index 9ecf827..cc7c95a 100644 --- a/fields/ref.py +++ b/fields/ref.py @@ -189,9 +189,13 @@ class Ref(Field): (q(startNumber), q('sort'), q('sortKey'), q(refField.name), \ q('reverse'), q('**v**')))"> + var="js=ajaxBaseCall.replace('**v**', 'False')" + onclick=":'askConfirm(%s,%s,%s)' % (q('script'), q(js,False), \ + q(sortConfirm))"/> + var="js=ajaxBaseCall.replace('**v**', 'True')" + onclick=":'askConfirm(%s,%s,%s)' % (q('script'), q(js,False), \ + q(sortConfirm))"/> ''') # Shows the object number in a numbered list of tied objects. @@ -430,6 +434,7 @@ class Ref(Field): navBaseCall='askRefField(%s,%s,%s,**v**)' % \ (q(ajaxHookId), q(zobj.absolute_url()), q(innerRef)); changeOrder=mayEdit and field.getAttribute(zobj, 'changeOrder'); + sortConfirm=changeOrder and _('sort_confirm'); numbered=field.isNumbered(zobj); changeNumber=not inPickList and numbered and changeOrder and \ (totalNumber > 3); diff --git a/fields/string.py b/fields/string.py index 66844b8..ee562f7 100644 --- a/fields/string.py +++ b/fields/string.py @@ -476,10 +476,12 @@ class String(Field): res = False return res - def isMultilingual(self, obj): - '''Is this field multilingual ?.''' + def isMultilingual(self, obj, dontKnow=False): + '''Is this field multilingual ? If we don't know, say p_dontKnow.''' # In the following case, impossible to know: we say no. - if not obj and callable(self.languages): return + if not obj: + if callable(self.languages): return dontKnow + else: return len(self.languages) > 1 return len(self.getAttribute(obj, 'languages')) > 1 def getDefaultLayouts(self): diff --git a/gen/tr/Appy.pot b/gen/tr/Appy.pot index fb44412..71a0d32 100644 --- a/gen/tr/Appy.pot +++ b/gen/tr/Appy.pot @@ -83,7 +83,7 @@ msgstr "" msgid "no_ref" msgstr "" -#. Default: "Add a new one" +#. Default: "Add" msgid "add_ref" msgstr "" @@ -251,6 +251,10 @@ msgstr "" msgid "save_confirm" msgstr "" +#. Default: "Are you sure? You are going to permanently change the order of these elements, for all users." +msgid "sort_confirm" +msgstr "" + #. Default: "Go to top" msgid "goto_first" msgstr "" diff --git a/gen/tr/ar.po b/gen/tr/ar.po index dc24e50..488977d 100644 --- a/gen/tr/ar.po +++ b/gen/tr/ar.po @@ -83,7 +83,7 @@ msgstr "" msgid "no_ref" msgstr "" -#. Default: "Add a new one" +#. Default: "Add" msgid "add_ref" msgstr "" @@ -251,6 +251,10 @@ msgstr "" msgid "save_confirm" msgstr "" +#. Default: "Are you sure? You are going to permanently change the order of these elements, for all users." +msgid "sort_confirm" +msgstr "" + #. Default: "Go to top" msgid "goto_first" msgstr "" diff --git a/gen/tr/de.po b/gen/tr/de.po index aef0cb5..9b63a21 100644 --- a/gen/tr/de.po +++ b/gen/tr/de.po @@ -83,7 +83,7 @@ msgstr "Sie haben zuviele Elemente ausgewählt." msgid "no_ref" msgstr "Kein Element" -#. Default: "Add a new one" +#. Default: "Add" msgid "add_ref" msgstr "Hinzufügen" @@ -251,6 +251,10 @@ msgstr "" msgid "save_confirm" msgstr "" +#. Default: "Are you sure? You are going to permanently change the order of these elements, for all users." +msgid "sort_confirm" +msgstr "" + #. Default: "Go to top" msgid "goto_first" msgstr "Zurück zum Anfang" diff --git a/gen/tr/en.po b/gen/tr/en.po index 7f0470f..9be4290 100644 --- a/gen/tr/en.po +++ b/gen/tr/en.po @@ -84,9 +84,9 @@ msgstr "Too much elements are selected here." msgid "no_ref" msgstr "No object." -#. Default: "Add a new one" +#. Default: "Add" msgid "add_ref" -msgstr "Add a new one" +msgstr "Add" #. Default: "Available elements" msgid "selectable_objects" @@ -252,6 +252,10 @@ msgstr "Action had no effect." msgid "save_confirm" msgstr "Are you sure you want to apply this change?" +#. Default: "Are you sure? You are going to permanently change the order of these elements, for all users." +msgid "sort_confirm" +msgstr "Are you sure? You are going to permanently change the order of these elements, for all users." + #. Default: "Go to top" msgid "goto_first" msgstr "Go to top" diff --git a/gen/tr/es.po b/gen/tr/es.po index 5761396..055c8c4 100644 --- a/gen/tr/es.po +++ b/gen/tr/es.po @@ -83,7 +83,7 @@ msgstr "Demasiados elementos son seleccionados aquí." msgid "no_ref" msgstr "Ningún elemento." -#. Default: "Add a new one" +#. Default: "Add" msgid "add_ref" msgstr "Añadir" @@ -251,6 +251,10 @@ msgstr "" msgid "save_confirm" msgstr "" +#. Default: "Are you sure? You are going to permanently change the order of these elements, for all users." +msgid "sort_confirm" +msgstr "" + #. Default: "Go to top" msgid "goto_first" msgstr "Ir al inicio" diff --git a/gen/tr/fr.po b/gen/tr/fr.po index 354226a..038a0bd 100644 --- a/gen/tr/fr.po +++ b/gen/tr/fr.po @@ -84,7 +84,7 @@ msgstr "Trop d'éléments sont sélectionnés ici." msgid "no_ref" msgstr "-" -#. Default: "Add a new one" +#. Default: "Add" msgid "add_ref" msgstr "Ajouter" @@ -252,6 +252,10 @@ msgstr "L'action n'a eu aucun effet." msgid "save_confirm" msgstr "Êtes-vous sûr de vouloir appliquer ce changement?" +#. Default: "Are you sure? You are going to permanently change the order of these elements, for all users." +msgid "sort_confirm" +msgstr "Êtes-vous sûr? Vous allez changer l'ordre de ces éléments de manière permanente, pour tous les utilisateurs." + #. Default: "Go to top" msgid "goto_first" msgstr "Aller au début" diff --git a/gen/tr/it.po b/gen/tr/it.po index adc9086..98e2fd1 100644 --- a/gen/tr/it.po +++ b/gen/tr/it.po @@ -83,9 +83,9 @@ msgstr "Un numero eccessivo di elementi sono scelti" msgid "no_ref" msgstr "-" -#. Default: "Add a new one" +#. Default: "Add" msgid "add_ref" -msgstr "Aggiungi un nuovo" +msgstr "Aggiungi" #. Default: "Available elements" msgid "selectable_objects" @@ -251,6 +251,10 @@ msgstr "" msgid "save_confirm" msgstr "" +#. Default: "Are you sure? You are going to permanently change the order of these elements, for all users." +msgid "sort_confirm" +msgstr "" + #. Default: "Go to top" msgid "goto_first" msgstr "Andare all'inizio" diff --git a/gen/tr/nl.po b/gen/tr/nl.po index aabc234..f586d2e 100644 --- a/gen/tr/nl.po +++ b/gen/tr/nl.po @@ -83,7 +83,7 @@ msgstr "U hebt teveel elementen geselecteerd." msgid "no_ref" msgstr "-" -#. Default: "Add a new one" +#. Default: "Add" msgid "add_ref" msgstr "Toevoegen" @@ -251,6 +251,10 @@ msgstr "De actie heeft geen effect gehad." msgid "save_confirm" msgstr "Bent u zeker om deze wijziging door te voeren?" +#. Default: "Are you sure? You are going to permanently change the order of these elements, for all users." +msgid "sort_confirm" +msgstr "" + #. Default: "Go to top" msgid "goto_first" msgstr "Ga naar het begin"