Project

General

Profile

« Previous | Next » 

Revision bd6363fe

Added by Frédéric Péters almost 14 years ago

Add support for an expiration time for announces

View differences:

extra/modules/announces_ui.ptl
236 236
            pub_time = None
237 237
        form.add(DateWidget, 'publication_time', title = _('Publication Time'),
238 238
                value = pub_time)
239
        if self.announce.expiration_time:
240
            exp_time = time.strftime(misc.date_format(), self.announce.expiration_time)
241
        else:
242
            exp_time = None
243
        form.add(DateWidget, 'expiration_time', title = _('Expiration Time'),
244
                value = exp_time)
239 245
        form.add(TextWidget, 'text', title = _('Text'), required = True,
240 246
                value = self.announce.text, rows = 10, cols = 70)
241 247
        if get_cfg('misc', {}).get('announce_themes'):
......
253 259
            widget = form.get_widget(k)
254 260
            if widget:
255 261
                setattr(self.announce, k, widget.parse())
256
        widget = form.get_widget('publication_time')
257
        if widget:
258
            pub_time = widget.parse()
259
            if pub_time:
260
                self.announce.publication_time = time.strptime(pub_time, misc.date_format())
261
            else:
262
                self.announce.publication_time = None
262
        for k in ('publication_time', 'expiration_time'):
263
            widget = form.get_widget(k)
264
            if widget:
265
                wid_time = widget.parse()
266
                if wid_time:
267
                    setattr(self.announce, k, time.strptime(wid_time, misc.date_format()))
268
                else:
269
                    setattr(self.announce, k, None)
263 270
        self.announce.store()
264 271

  
265 272
    def delete [html] (self):

Also available in: Unified diff