From 036856f07e9fb3f3f79b40fb2e29e2816e45b42c Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Tue, 15 Apr 2014 13:01:39 +0200 Subject: [PATCH] [gen] Within Ref fields, added 2 icons for moving tied objects to top or bottom + bugfixes. --- fields/calendar.py | 4 +- fields/ref.py | 50 ++++++++++++------ gen/tr/Appy.pot | 8 +++ gen/tr/ar.po | 8 +++ gen/tr/de.po | 8 +++ gen/tr/en.po | 8 +++ gen/tr/es.po | 8 +++ gen/tr/fr.po | 8 +++ gen/tr/it.po | 8 +++ gen/tr/nl.po | 8 +++ gen/ui/appy.js | 4 +- gen/ui/arrowDown.png | Bin 234 -> 234 bytes gen/ui/{arrowLeftSimple.png => arrowLeft.png} | Bin gen/ui/arrowLeftDouble.png | Bin 212 -> 0 bytes gen/ui/arrowRight.png | Bin 0 -> 229 bytes gen/ui/arrowRightDouble.png | Bin 212 -> 0 bytes gen/ui/arrowRightSimple.png | Bin 216 -> 0 bytes gen/ui/arrowsDown.png | Bin 0 -> 242 bytes gen/ui/arrowsLeft.png | Bin 0 -> 236 bytes gen/ui/arrowsRight.png | Bin 0 -> 235 bytes gen/ui/arrowsUp.png | Bin 0 -> 241 bytes gen/wrappers/ToolWrapper.py | 8 +-- gen/wrappers/__init__.py | 12 ++--- 23 files changed, 113 insertions(+), 29 deletions(-) rename gen/ui/{arrowLeftSimple.png => arrowLeft.png} (100%) delete mode 100644 gen/ui/arrowLeftDouble.png create mode 100644 gen/ui/arrowRight.png delete mode 100644 gen/ui/arrowRightDouble.png delete mode 100644 gen/ui/arrowRightSimple.png create mode 100644 gen/ui/arrowsDown.png create mode 100644 gen/ui/arrowsLeft.png create mode 100644 gen/ui/arrowsRight.png create mode 100644 gen/ui/arrowsUp.png diff --git a/fields/calendar.py b/fields/calendar.py index db42a9b..467ca93 100644 --- a/fields/calendar.py +++ b/fields/calendar.py @@ -45,7 +45,7 @@ class Calendar(Field): goForward=not endDate or (endDate.strftime(fmt) > \ grid[-1][-1].strftime(fmt))"> - @@ -58,7 +58,7 @@ class Calendar(Field): q(objUrl), q(field.name), q(defaultDateMonth))" disabled=":defaultDate.strftime(fmt)==monthDayOne.strftime(fmt)"/> - :_('month_%s' % monthDayOne.aMonth()) diff --git a/fields/ref.py b/fields/ref.py index 45c601d..c4ad141 100644 --- a/fields/ref.py +++ b/fields/ref.py @@ -78,18 +78,28 @@ class Ref(Field): # This PX displays icons for triggering actions on a given referenced object # (edit, delete, etc). pxObjectActions = Px(''' - +
-
+ q(tiedUid), q('move'), q('**v**')))"> + + + + + + @@ -107,7 +117,7 @@ class Ref(Field): + onclick=":'onDeleteObject(%s)' % q(tiedUid)"/> @@ -115,14 +125,14 @@ class Ref(Field): action='unlink'" class="clickable" title=":_('object_unlink')" src=":url(imgName)" onclick=":'onLink(%s,%s,%s,%s)' % (q(action), q(zobj.id), \ - q(field.name), q(tied.o.id))"/> + q(field.name), q(tiedUid))"/> + q(field.name), q(tiedUid))"/>
''') @@ -923,16 +933,25 @@ class Ref(Field): (obj.id, self.name, code % ('objs', 'objs'), poss) def doChangeOrder(self, obj): - '''Moves a referred object up or down.''' + '''Moves a referred object up/down/top/bottom.''' rq = obj.REQUEST - # Move the item up (-1), down (+1) ? - move = (rq['move'] == 'down') and 1 or -1 - # The UID of the referred object to move + # How to move the item? + move = rq['move'] + # Get the UID of the tied object to move uid = rq['refObjectUid'] uids = getattr(obj.aq_base, self.name) oldIndex = uids.index(uid) + # Remove the object from its previous position. uids.remove(uid) - newIndex = oldIndex + move + # Re-insert the object at its new position. + if move == 'up': + newIndex = oldIndex - 1 + elif move == 'down': + newIndex = oldIndex + 1 + elif move == 'top': + newIndex = 0 + elif move == 'bottom': + newIndex = len(uids) uids.insert(newIndex, uid) xhtmlToText = re.compile('<.*?>', re.S) @@ -959,11 +978,12 @@ class Ref(Field): res = refObject.tool.o.truncateValue(res, maxWidth) return res - def getIndexOf(self, obj, refObj): - '''Gets the position of p_refObj within this field on p_obj.''' + def getIndexOf(self, obj, tiedUid): + '''Gets the position of tied object identified by p_tiedUid within this + field on p_obj.''' uids = getattr(obj.aq_base, self.name, None) if not uids: raise IndexError() - return uids.index(refObj.o.id) + return uids.index(tiedUid) def sort(self, obj): '''Called when the user wants to sort the content of this field.''' diff --git a/gen/tr/Appy.pot b/gen/tr/Appy.pot index 76f6d27..9d9a5c8 100644 --- a/gen/tr/Appy.pot +++ b/gen/tr/Appy.pot @@ -103,6 +103,14 @@ msgstr "" msgid "move_down" msgstr "" +#. Default: "Move to top" +msgid "move_top" +msgstr "" + +#. Default: "Move to bottom" +msgid "move_bottom" +msgstr "" + #. Default: "create" msgid "query_create" msgstr "" diff --git a/gen/tr/ar.po b/gen/tr/ar.po index 9825119..e392dfb 100644 --- a/gen/tr/ar.po +++ b/gen/tr/ar.po @@ -103,6 +103,14 @@ msgstr "" msgid "move_down" msgstr "" +#. Default: "Move to top" +msgid "move_top" +msgstr "" + +#. Default: "Move to bottom" +msgid "move_bottom" +msgstr "" + #. Default: "create" msgid "query_create" msgstr "" diff --git a/gen/tr/de.po b/gen/tr/de.po index 6ac8812..0dc5b22 100644 --- a/gen/tr/de.po +++ b/gen/tr/de.po @@ -103,6 +103,14 @@ msgstr "Nach oben verschieben" msgid "move_down" msgstr "Nach unten verschieben" +#. Default: "Move to top" +msgid "move_top" +msgstr "" + +#. Default: "Move to bottom" +msgid "move_bottom" +msgstr "" + #. Default: "create" msgid "query_create" msgstr "Anfertigen" diff --git a/gen/tr/en.po b/gen/tr/en.po index 68ae252..56c4ab9 100644 --- a/gen/tr/en.po +++ b/gen/tr/en.po @@ -104,6 +104,14 @@ msgstr "Move up" msgid "move_down" msgstr "Move down" +#. Default: "Move to top" +msgid "move_top" +msgstr "Move to top" + +#. Default: "Move to bottom" +msgid "move_bottom" +msgstr "Move to bottom" + #. Default: "create" msgid "query_create" msgstr "create" diff --git a/gen/tr/es.po b/gen/tr/es.po index 2589b38..4cc7770 100644 --- a/gen/tr/es.po +++ b/gen/tr/es.po @@ -103,6 +103,14 @@ msgstr "Mueva hacia arriba" msgid "move_down" msgstr "Mueva hacia abajo" +#. Default: "Move to top" +msgid "move_top" +msgstr "" + +#. Default: "Move to bottom" +msgid "move_bottom" +msgstr "" + #. Default: "create" msgid "query_create" msgstr "Crear" diff --git a/gen/tr/fr.po b/gen/tr/fr.po index 02be750..cee996a 100644 --- a/gen/tr/fr.po +++ b/gen/tr/fr.po @@ -104,6 +104,14 @@ msgstr "Déplacer vers le haut" msgid "move_down" msgstr "Déplacer vers le bas" +#. Default: "Move to top" +msgid "move_top" +msgstr "Déplacer en première position" + +#. Default: "Move to bottom" +msgid "move_bottom" +msgstr "Déplacer en dernière position" + #. Default: "create" msgid "query_create" msgstr "Créer" diff --git a/gen/tr/it.po b/gen/tr/it.po index 9af0a27..7df20b8 100644 --- a/gen/tr/it.po +++ b/gen/tr/it.po @@ -103,6 +103,14 @@ msgstr "Su" msgid "move_down" msgstr "Giù" +#. Default: "Move to top" +msgid "move_top" +msgstr "" + +#. Default: "Move to bottom" +msgid "move_bottom" +msgstr "" + #. Default: "create" msgid "query_create" msgstr "Creazione in corso" diff --git a/gen/tr/nl.po b/gen/tr/nl.po index 5096327..a253d41 100644 --- a/gen/tr/nl.po +++ b/gen/tr/nl.po @@ -103,6 +103,14 @@ msgstr "Verplaats naar boven" msgid "move_down" msgstr "Verplaats naar beneden" +#. Default: "Move to top" +msgid "move_top" +msgstr "" + +#. Default: "Move to bottom" +msgid "move_bottom" +msgstr "" + #. Default: "create" msgid "query_create" msgstr "Aanmaken" diff --git a/gen/ui/appy.js b/gen/ui/appy.js index 31376fd..2bbde76 100644 --- a/gen/ui/appy.js +++ b/gen/ui/appy.js @@ -48,9 +48,9 @@ function len(dict) { return res; } -function switchLanguage(selectWidget) { +function switchLanguage(selectWidget, siteUrl) { var language = selectWidget.options[selectWidget.selectedIndex].value; - goto("/config/changeLanguage?language=" + language); + goto(siteUrl + '/config/changeLanguage?language=' + language); } var isIe = (navigator.appName == "Microsoft Internet Explorer"); diff --git a/gen/ui/arrowDown.png b/gen/ui/arrowDown.png index 262e0a1b359a7504f1015566d7a297c718de865d..e1a3d72df8abc1d8d5e07b95b4e2a644a2d40a69 100644 GIT binary patch delta 37 tcmaFG_=<6Y87~7vx^C2=fcEzvauyd(bhhBS$HLFW$bBl7r)*+tDgX@&4bcDq delta 37 tcmaFG_=<6Y8Skv^47yQ=0@~l(em%xA(bFdgVlSPo*MET8_`iF1B#Zfaf$gL6@8Vo7R>LV0FMhC)b2s)DLIK zifSHEp}ePyV+hCf8xCg3@&-h9I~ukQ9z{(p00i_ I>zopr0Eq%N!TFdgVlSPo*gjMFVdQ&MBb@09&9o)&Kwi diff --git a/gen/ui/arrowRightSimple.png b/gen/ui/arrowRightSimple.png deleted file mode 100644 index baec038aaa0139417c4933f9dc5098cb3ee30ade..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 216 zcmeAS@N?(olHy`uVBq!ia0vp@K+MU+3?!$B`27TN0(?STfwXSap@8=H`)V&r0Xd8% zL4Lsu4$p3+fjCLt?k)@+tg;>;{XE)7O>#CW|1qv4NHP zX`l#$Y>8_`iF1B#Zfaf$gL6@8Vo7R>LV0FMhC)b2s)DY)TQ*4J^q_J*sTeS-BV)T=JMXWLdkSK!$p{`njxgN@xNA&)YGn diff --git a/gen/ui/arrowsDown.png b/gen/ui/arrowsDown.png new file mode 100644 index 0000000000000000000000000000000000000000..11e3f153df1462c0df73cc8d47cfd1bbde4d409b GIT binary patch literal 242 zcmeAS@N?(olHy`uVBq!ia0vp@KrFz-3?w(4m0bm-7>k44ofy`glX(f`a0d8qZ?4Xn+49XK^7&MM;ofFoVOh8)+a;lDE4HLkFv@2S|B=M`SSr1Gg{;GcwGYBLNg- zFY)wsWxvP5&n0iNqDpQGP)N4KHKN2hKQ}iuuY|$5C^fMpHASI3vm`?yBqLS9-P1SV zeTr%xP@#^ei(?4K_2h&G<}fxvHa5R@4mP%B2Ury9vzP;XcvYS?Dji$E7IgMtgD3;T Y&luLk#q~dwfch9bUHx3vIVCg!07eNvt^fc4 literal 0 HcmV?d00001 diff --git a/gen/ui/arrowsLeft.png b/gen/ui/arrowsLeft.png new file mode 100644 index 0000000000000000000000000000000000000000..af7e8c48c9076075128ce60228dfca643252a95e GIT binary patch literal 236 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~k#0(_eTwE3cDaPU;cPEB*=VV@jWCDCbTp1YB zb)yaiw7>t5v$znXq9n*Kn8D%MjWiG^$=lt9p@UV{1EjpbBeIx*fm;}a85w5HkpK#^ zmw5WRvfpFj=hCz~c5l%$ppa~dYeb22er|4RUI~M9QEFmIYKlU6W=V!ZNJgrHyQgo! z`xMnYph7iI7sn8e>&XcZo}?rs1cb5*1uru&FkodhFes?9a)?YY?9d62Wyn)udAw0# R?th>T22WQ%mvv4FO#tREK9T?c literal 0 HcmV?d00001 diff --git a/gen/ui/arrowsRight.png b/gen/ui/arrowsRight.png new file mode 100644 index 0000000000000000000000000000000000000000..6e62c14d17c605655957fad2fa01a19e85110dae GIT binary patch literal 235 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~k#0(_eTwE3cDaPU;cPEB*=VV@jWCDCbTp1YB zb)yaiw7>t5v$znXq9n*Kn8D%MjWiG^$=lt9p@UV{1EjpbBeIx*fm;}a85w5HkpK#^ zmw5WRvfpFj=hEQrlb$>mC?s3r8d2h$pPQSSSHj?2l$uzQnxasiS(2d;l98(5?&%xw zK1DSTs8H3@#W95AdUAq?M?ykEM+bvYQj$Z{)~$_=jfRGdrl4r>mdKI;Vst07w)+SO5S3 literal 0 HcmV?d00001 diff --git a/gen/ui/arrowsUp.png b/gen/ui/arrowsUp.png new file mode 100644 index 0000000000000000000000000000000000000000..58b316e2e87092850e253ecfddb044e9be32d4a7 GIT binary patch literal 241 zcmeAS@N?(olHy`uVBq!ia0vp@KrFz-3?w(4m0bm-7>k44ofy`glX(f`a0d8qZ?4Xn+49XK^7&MM;ofFoVOh8)+a;lDE4HLkFv@2S|B=M`SSr1Gg{;GcwGYBLNg- zFY)wsWxvP5&n2gAlc}Tt6p}4*jVN)>&&^HED`9XhN=+ @@ -70,7 +70,7 @@ class ToolWrapper(AbstractWrapper): @@ -82,7 +82,7 @@ class ToolWrapper(AbstractWrapper): sNumber= nbOfCountedPages * batchSize" if="(startNumber != sNumber) and \ (startNumber != sNumber-batchSize)"> diff --git a/gen/wrappers/__init__.py b/gen/wrappers/__init__.py index 02efa72..21dfdc8 100644 --- a/gen/wrappers/__init__.py +++ b/gen/wrappers/__init__.py @@ -31,9 +31,9 @@ class AbstractWrapper(object): + title=":_('goto_previous')" src=":url('arrowLeft')"/> @@ -42,9 +42,9 @@ class AbstractWrapper(object): + src=":url('arrowsRight')"/> ''') pxNavigationStrip = Px(''' @@ -188,10 +188,10 @@ class AbstractWrapper(object): class="pageLink clickable">:_('app_connect') -