From eb82d8f9e1a13678be84f554f73595b6c7902591 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Wed, 9 Jul 2014 07:48:46 +0200 Subject: [PATCH] =?utf8?q?IHM=20pour=20d=C3=A9finir=20le=20tri=20par=20d?= =?utf8?q?=C3=A9faut.=20Fonctionne=20sans=20js=20(pour=20l'instant).?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- locales/en/LC_MESSAGES/portfolio.po | 24 +++++++-- locales/fr/LC_MESSAGES/portfolio.mo | Bin 6864 -> 7006 bytes locales/fr/LC_MESSAGES/portfolio.po | 28 +++++++--- locales/portfolio.pot | 28 +++++++--- skins/getPhotosInfos.py | 80 +++++++++++++++------------- skins/portfolio_edit_form.py | 6 +++ skins/portfolio_view.pt | 7 ++- 7 files changed, 117 insertions(+), 56 deletions(-) diff --git a/locales/en/LC_MESSAGES/portfolio.po b/locales/en/LC_MESSAGES/portfolio.po index 1109c6f..c36a5b2 100644 --- a/locales/en/LC_MESSAGES/portfolio.po +++ b/locales/en/LC_MESSAGES/portfolio.po @@ -123,7 +123,7 @@ msgstr "" msgid "refresh amount" msgstr "" -#: o/skins/my_cart_template.pt:59 o/skins/portfolio_view.pt:71 +#: o/skins/my_cart_template.pt:59 o/skins/portfolio_view.pt:81 msgid "delete" msgstr "" @@ -252,15 +252,15 @@ msgstr "" msgid "download picture" msgstr "" -#: o/skins/portfolio_edit_form.py:13 +#: o/skins/portfolio_edit_form.py:17 msgid "Photo deleted." msgstr "" -#: o/skins/portfolio_edit_form.py:15 +#: o/skins/portfolio_edit_form.py:19 msgid "Deleted photos." msgstr "" -#: o/skins/portfolio_edit_form.py:18 +#: o/skins/portfolio_edit_form.py:22 msgid "Nothing to delete." msgstr "" @@ -268,6 +268,22 @@ msgstr "" msgid "Delete presentation" msgstr "" +#: o/skins/portfolio_view.pt:74 +msgid "sorting:" +msgstr "" + +#: o/skins/portfolio_view.pt:76 +msgid "manual" +msgstr "" + +#: o/skins/portfolio_view.pt:77 +msgid "shooting" +msgstr "" + +#: o/skins/portfolio_view.pt:78 +msgid "modification" +msgstr "" + #: o/skins/save_as_lightbox_template.pt:12 msgid "Save current selection as lightbox" msgstr "" diff --git a/locales/fr/LC_MESSAGES/portfolio.mo b/locales/fr/LC_MESSAGES/portfolio.mo index eca4edf3552f52cc1c4652ae90ce3a8cc8877e48..7af8c86755bbe4b56df39a244fbda7366b4873f7 100644 GIT binary patch delta 2014 zcmYM!YiyHM9LMp0b+lu$mEBY}z;fFbnAv@6Mx-K&%nQLdcp)M_tYx&>TGDm%_M(Y# z7>pN^Cz!YwLNHn6#iFFqm?auO2vK7)d_kOvOJu=pnurNOg5u@-V<)lM>E}7;InV$6 z&;LB#RL4wbex{=6sPXBiEvNO~X?7Uj4D!Y2<6^TmJcZ?W1@Fcico&u}Hd~4{ScV%g zgx#q554rJPtfJqC3jHD$ndL3NaAB|E5^fwu1$fu_KI(ySti%Zn;~7)}7qJ9?#8RBY zX8Z${SUop2KZ@jR+pq$k!bPlaad#ty%6JHs>8KkYLt@znsKh2viGG6Yz|P|RcmX@{ zI<{gX*=eD@&MdamAH^t6VlnI6H7*qR7OI3rL{|cpcn>zX{)2cg{hg>INMi&?Q9B!V zeuSF$8LDy@QI+`KIgi@VpP1K!Mbu5DEk*5U6|xDd!`0Y=n%9fuXnRoaN)olhL%0^- z!$tUo^BgMf*QmHNsKjQG*UWB}Qhx>1wpYRuT!9-aPdK7$7M-h6*@=D$%E?N}NX4vTxk|AKdt? z>;Hy2!W*vtFHQxBMHVr}r+KmTZY`r+w>OCD_vE=yNp>TDmg7r-UPmqb4r<{sR3%Qj z`)5!){R&m`Db$WGp*A$@?$4n%ausXvChAD4_)_Kb4P0oUcGQFzK8nwvN_fIqKs|5{ zm*Es@;a^bC|Bl+oU#K`$yuqqu6H*L|qULQwRr=|L`+4)Y*vLT2IqtlSddXH+FH~kD zZl%8+x8PCKj;B!z{fsKM^&x^74J#B4^!Br-~St2D6>ga!1Gv#-=U7; zCbB6D5QXYlHEMnXsaXaeglR_nu#&!6T^B6u%|2%4b3FoDX)!`aUp^o@%%q!zdTKkEi}*H8H}yy6Q00=NI6?)6Uv*OcyKq?xvg7WaP&K3=`s%@Mpz z)H;1>@9>`>J$#lOB4J6}<$k2hz3pSL=YN*>k65dkLJDi9-HarlC zL?bQH?zZOc7XM0kb!eg2QYc#*E2&i6#Q$+~$xPaRqQ>hwm`x5PB7_|oPFOtY9n56C fLCIJV>@!f7Av>WPeB+(H~+~1l3|AqWuwU!IEmQSdG|<_WsPn9ys@P&hwn-obUOb z^W6JOZWqSxr}%n}tAX+^CH#h27p{%xhpQ!EwirLfWc(hd<1oI7w=jr5<5YZ%e*7EN ze^SE4{WMIYor4;>2z_QTE19TR8NS7X)u;igopq=ewqq(bV-j|t0_edh_$?-4KQ6){ zRA3KL{a+w4S%A(dn2eK|-*Tzw!F*K2i&2r5yZg1syVigTtQi&PE@TDPi3{;7T!QDZ z0H2^H$|OozfMG1hBHV)k=C?sA8u$__g=44ye!{nL+_g39JG7^vw%~mXVL566+nrHV zzt2&b>p^9r&v_cPpog zf1+0W0=44TsBwcF0A(x>)vp4X!YY%xHRCw3I\n" "Language-Team: Zope 3 Developers \n" @@ -160,8 +160,8 @@ msgstr "" #: o/skins/my_cart_template.pt:59 #: o/skins/my_cart_template.pt:59 -#: o/skins/portfolio_view.pt:71 -#: o/skins/portfolio_view.pt:71 +#: o/skins/portfolio_view.pt:81 +#: o/skins/portfolio_view.pt:81 msgid "delete" msgstr "" @@ -304,15 +304,15 @@ msgstr "" msgid "download picture" msgstr "" -#: o/skins/portfolio_edit_form.py:13 +#: o/skins/portfolio_edit_form.py:17 msgid "Photo deleted." msgstr "" -#: o/skins/portfolio_edit_form.py:15 +#: o/skins/portfolio_edit_form.py:19 msgid "Deleted photos." msgstr "" -#: o/skins/portfolio_edit_form.py:18 +#: o/skins/portfolio_edit_form.py:22 msgid "Nothing to delete." msgstr "" @@ -320,6 +320,22 @@ msgstr "" msgid "Delete presentation" msgstr "" +#: o/skins/portfolio_view.pt:74 +msgid "sorting:" +msgstr "" + +#: o/skins/portfolio_view.pt:76 +msgid "manual" +msgstr "" + +#: o/skins/portfolio_view.pt:77 +msgid "shooting" +msgstr "" + +#: o/skins/portfolio_view.pt:78 +msgid "modification" +msgstr "" + #: o/skins/save_as_lightbox_template.pt:12 msgid "Save current selection as lightbox" msgstr "" diff --git a/skins/getPhotosInfos.py b/skins/getPhotosInfos.py index 2d42635..985528e 100755 --- a/skins/getPhotosInfos.py +++ b/skins/getPhotosInfos.py @@ -8,11 +8,11 @@ uidtool = getToolByName(context, 'portal_uidhandler') features = {} def toggleSelection(o, selected) : - if selected : - return '%s/remove_to_selection' % o.absolute_url() - else : - return '%s/add_to_selection' % o.absolute_url() - + if selected : + return '%s/remove_to_selection' % o.absolute_url() + else : + return '%s/add_to_selection' % o.absolute_url() + features['select'] = toggleSelection features['cart'] = lambda o : '%s/get_slide_buyable_items' % o.absolute_url() @@ -23,8 +23,12 @@ if mtool.checkPermission(ModifyPortalContent, context) : req = context.REQUEST pho_start = req.get('pho_start', 0) -batch = Batch(portfolio.listNearestFolderContents(contentFilter={'portal_type' : ['Photo']}, sorted=True), - context.default_batch_size, pho_start, orphan=5, quantumleap=1, b_start_str='pho_start') +sort_on, sort_order = context.getDefaultSorting() +contentFilter = {'portal_type' : ['Photo'], + 'sort_on' : sort_on, + 'sort_order' : sort_order} +batch = Batch(portfolio.listCatalogedContents(contentFilter=contentFilter), + context.default_batch_size, pho_start, orphan=5, quantumleap=1, b_start_str='pho_start') infos = [] @@ -33,36 +37,36 @@ selDict = sd.get('objects_selection_dict', {}) cart = sd.get('cart', None) for p in batch : - className = '' - uid = getattr(p, 'cmf_uid', None) - if uid is not None : - uid = uid() - absUrl = p.absolute_url() - selected = selDict.has_key(uid) - hiddenForAnonymous = p.hiddenForAnonymous() - if pptool : - buyable = bool(pptool.getPrintingOptionsFor(p)) - if cart and cart.locked : - buyable = False - else : - buyable = False - - if selected : - className = 'selected' - if hiddenForAnonymous : - className = 'hidden-slide' - - d = {'href' : absUrl - ,'thumbUrl' : '%s/getThumbnail' % absUrl - ,'thumbSize': p.getThumbnailSize() - ,'title' : ('%s - %s' % (p.Title(), p.Description())).strip(' -') - ,'selected' : selected - ,'hiddenForAnonymous' : hiddenForAnonymous - ,'cmf_uid' : uidtool.register(p) - ,'buyable' : buyable - ,'className': className - ,'o' : p - } - infos.append(d) + className = '' + uid = getattr(p, 'cmf_uid', None) + # if uid is not None : + # uid = uid() + absUrl = p.getURL() + selected = selDict.has_key(uid) + hiddenForAnonymous = p.hiddenForAnonymous + if pptool : + buyable = bool(pptool.getPrintingOptionsFor(p)) + if cart and cart.locked : + buyable = False + else : + buyable = False + + if selected : + className = 'selected' + if hiddenForAnonymous : + className = 'hidden-slide' + + d = {'href' : absUrl + ,'thumbUrl' : '%s/getThumbnail' % absUrl + ,'thumbSize': p.getThumbnailSize + ,'title' : ('%s - %s' % (p.Title, p.Description)).strip(' -') + ,'selected' : selected + ,'hiddenForAnonymous' : hiddenForAnonymous + ,'cmf_uid' : uidtool.register(p) + ,'buyable' : buyable + ,'className': className + ,'o' : p + } + infos.append(d) return {'infos':infos, 'batch':batch, 'features':features} diff --git a/skins/portfolio_edit_form.py b/skins/portfolio_edit_form.py index cb9e93b..ad661d2 100644 --- a/skins/portfolio_edit_form.py +++ b/skins/portfolio_edit_form.py @@ -27,4 +27,10 @@ if fg('delete.x') or form.has_key('delete') : else : return '%s' % msg +if fg('set_sorting') : + context.setDefaultSorting(fg('sorting'), False) + if not fg('ajax') : + return context.setRedirect(context, 'object/view') + else : + return '' return '' \ No newline at end of file diff --git a/skins/portfolio_view.pt b/skins/portfolio_view.pt index a168fca..14bd91c 100644 --- a/skins/portfolio_view.pt +++ b/skins/portfolio_view.pt @@ -71,12 +71,15 @@ tal:define="ModifyPortalContent modules/Products/CMFCore/permissions/ModifyPortalContent" tal:condition="python:mtool.checkPermission(ModifyPortalContent, here)"> - sort: - +