products/CPSRSS

changeset 273:903be8003573

#2388: UI to remove channels
author Georges Racinet on ishtar.racinet.fr <georges@racinet.fr>
date Wed, 04 May 2011 18:35:13 +0200
parents e17c2e7590db
children 7cb19b17e28d
files CHANGES browser/channels.py browser/configure.zcml browser/manage_channels.pt i18n/all.pot i18n/custom.pot i18n/en.po i18n/fr.po skins/rss_channel_delete.png
diffstat 9 files changed, 41 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/CHANGES
     1.2 +++ b/CHANGES
     1.3 @@ -6,7 +6,7 @@
     1.4  -
     1.5  Bug fixes
     1.6  ~~~~~~~~~
     1.7 --
     1.8 +- #2388: UI to remove channels
     1.9  New internal features
    1.10  ~~~~~~~~~~~~~~~~~~~~~
    1.11  - 
     2.1 --- a/browser/channels.py
     2.2 +++ b/browser/channels.py
     2.3 @@ -79,6 +79,16 @@
     2.4      def hasContainer(self):
     2.5          return self.aqSafeGet('container') is not None
     2.6  
     2.7 +    def delChannels(self, chan_ids):
     2.8 +        chan_ids = self.request.form.get('chan_ids')
     2.9 +        if chan_ids is None:
    2.10 +            raise BadRequest("Missing channel ids to remove.")
    2.11 +        if isinstance(chan_ids, basestring):
    2.12 +            chan_ids = [chan_ids]
    2.13 +        cont = self.aqSafeGet('container')
    2.14 +        cont.manage_delObjects(chan_ids)
    2.15 +        self.redirectManageChannels()
    2.16 +
    2.17      def channels(self, with_activation=True):
    2.18          cont = self.aqSafeGet('container')
    2.19          if cont is None:
    2.20 @@ -184,7 +194,7 @@
    2.21  
    2.22      def setActivated(self):
    2.23          """Set the list of activated channels."""
    2.24 -        activated = self.request.form['activated']
    2.25 +        activated = self.request.form.get('activated', ())
    2.26          proxy = self.context
    2.27          doc = proxy.getEditableContent()
    2.28          dm = doc.getDataModel(proxy=proxy)
     3.1 --- a/browser/configure.zcml
     3.2 +++ b/browser/configure.zcml
     3.3 @@ -28,6 +28,14 @@
     3.4  
     3.5    <browser:page
     3.6      for="Products.CPSCore.interfaces.ICPSProxy"
     3.7 +    name="del_channels"
     3.8 +    permission="cps.rss.ManageChannels"
     3.9 +    class=".browser.channels.ManageChannels"
    3.10 +    attribute="delChannels"
    3.11 +    />
    3.12 +
    3.13 +  <browser:page
    3.14 +    for="Products.CPSCore.interfaces.ICPSProxy"
    3.15      name="refresh_channels"
    3.16      permission="cps.rss.ManageChannels"
    3.17      class=".browser.channels.ManageChannels"
     4.1 --- a/browser/manage_channels.pt
     4.2 +++ b/browser/manage_channels.pt
     4.3 @@ -4,7 +4,8 @@
     4.4   <body>
     4.5  
     4.6    <metal:main fill-slot="main"
     4.7 -              tal:define="channels view/channels">
     4.8 +              tal:define="channels view/channels;
     4.9 +			  base_url here/portal_url/getBaseUrl">
    4.10  
    4.11     <h1 i18n:translate="heading_manage_rss_channels">
    4.12      Gestion des flux RSS
    4.13 @@ -28,6 +29,13 @@
    4.14          <a tal:content="channel/title"
    4.15             tal:attributes="href string:${channel/absolute_url_path}/edit.html"
    4.16             />
    4.17 +	<a
    4.18 +
    4.19 +           tal:attributes="href string:${here/absolute_url_path}/del_channels?chan_ids=${channel/getId};
    4.20 +			   onclick python: 'return window.confirm(\'%s\')' % cpsmcat('confirm_channel_delete')"
    4.21 +	   tal:condition="not:channel_info/activated">
    4.22 +	 <img tal:attributes="src string:${base_url}/rss_channel_delete.png"/>
    4.23 +	</a>
    4.24          <p tal:content="channel/description"/>
    4.25         </tal:block>
    4.26        </li>
     5.1 --- a/i18n/all.pot
     5.2 +++ b/i18n/all.pot
     5.3 @@ -21,3 +21,6 @@
     5.4  
     5.5  msgid "action_manage_rss_channels"
     5.6  msgstr ""
     5.7 +
     5.8 +msgid "confirm_channel_delete"
     5.9 +msgstr ""
     6.1 --- a/i18n/custom.pot
     6.2 +++ b/i18n/custom.pot
     6.3 @@ -21,3 +21,6 @@
     6.4  
     6.5  msgid "action_manage_rss_channels"
     6.6  msgstr ""
     6.7 +
     6.8 +msgid "confirm_channel_delete"
     6.9 +msgstr ""
     7.1 --- a/i18n/en.po
     7.2 +++ b/i18n/en.po
     7.3 @@ -30,3 +30,6 @@
     7.4  
     7.5  #~ msgid "label_max_items"
     7.6  #~ msgstr "Maximum Number of Items"
     7.7 +
     7.8 +msgid "confirm_channel_delete"
     7.9 +msgstr "Do you really want to delete this channel ?"
     8.1 --- a/i18n/fr.po
     8.2 +++ b/i18n/fr.po
     8.3 @@ -30,3 +30,6 @@
     8.4  
     8.5  #~ msgid "label_max_items"
     8.6  #~ msgstr "Nombre maximum de nouvelles"
     8.7 +
     8.8 +msgid "confirm_channel_delete"
     8.9 +msgstr "Voulez-vous vraiment d├ętruire ce flux ?"
     9.1 new file mode 100644
     9.2 index 0000000000000000000000000000000000000000..1514d51a3cf1b67e1c5b9ada36f1fd474e2d214a
     9.3 GIT binary patch
     9.4 literal 655
     9.5 zc$@)`0&x9_P)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00004XF*Lt006JZ
     9.6 zHwB960000PbVXQnQ*UN;cVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU!AxT6*R5;6(
     9.7 zlj}|sQ51!ViOGr2pjL^7$dQ1=8$w$KD6I_$CeZtZUZjAurR}6mp*HFdO?(oc3q-}<
     9.8 zu+o`!I@9H@m`W`r;m1zSWX}5bthM(H02sJT)z?DT&OUcv5HmU|-dF4oa@p;T*KAHh
     9.9 zFQ6^X?4p&<LW?JRAa!4W*8^cRHn#BV<;v&k;?li;fWKno-=RgNB}6ngw>uEoyT++I
    9.10 zn$b9r%cFfhHe2K68Pk<hKq}2z2~lh9z5zadf|kv-0cZq5T=w`mb%(MY1L(c%58!zI
    9.11 zxmp(Hu69|_VhN_cj;WfM0p5Rrno6S{41>Bu*@^<$y+7xQ$wJ~;c5aBx$R=xq*41Wo
    9.12 zhwQus_VOgm0hughj}MhOvs#{>Vg09Y8WxjWUJY5Y<Msg#Hz1}_nVr{4MuGi*zXu>W
    9.13 zJ?&8eG!59Cz=|E%Ns@013KLWOLV)CObIIj_5{>{#k%TEAMs_GbdDV`x-iYsG<NRDe
    9.14 z&F<oo(+wrG4$v4ShYJ*zTAVUyCyUEKWCOJq%P2g2jKiT}-UXn|;?x~V@D+7UK%!5l
    9.15 zu+-wDffb%iu%q!uYSm;0f+3t(tT-AO#lfvX-T}~N2{oGoN+1Mj)d31iEk4tC0{b>H
    9.16 z#=Z{USAQA>NY(}X7=3{K8#<xO0&SL1U06cNFs)HoJ!v1_9b#Vw@2F?RJt3C#MxpR@
    9.17 plJ)zU4s^HK{`H%}g=4&I{RVQoq{rLsz7zle002ovPDHLkV1j2<C=vhw
    9.18