[gen] Ref field: added a confirmation popup when the user wants to sort the ref. Indeed, most users think it is like sorting query results: they are not conscious it is a permanent change in the database, with effect for all users.
This commit is contained in:
parent
c2676c9cf8
commit
a16871f4b5
|
@ -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
|
||||
|
|
|
@ -189,9 +189,13 @@ class Ref(Field):
|
|||
(q(startNumber), q('sort'), q('sortKey'), q(refField.name), \
|
||||
q('reverse'), q('**v**')))">
|
||||
<img class="clickable" src=":url('sortAsc')"
|
||||
onclick=":ajaxBaseCall.replace('**v**', 'False')"/>
|
||||
var="js=ajaxBaseCall.replace('**v**', 'False')"
|
||||
onclick=":'askConfirm(%s,%s,%s)' % (q('script'), q(js,False), \
|
||||
q(sortConfirm))"/>
|
||||
<img class="clickable" src=":url('sortDesc')"
|
||||
onclick=":ajaxBaseCall.replace('**v**', 'True')"/>
|
||||
var="js=ajaxBaseCall.replace('**v**', 'True')"
|
||||
onclick=":'askConfirm(%s,%s,%s)' % (q('script'), q(js,False), \
|
||||
q(sortConfirm))"/>
|
||||
</x>''')
|
||||
|
||||
# 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);
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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 ""
|
||||
|
|
|
@ -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 ""
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue