Changeset 2508
- Timestamp:
- 07/22/07 13:14:04 (1 year ago)
- Files:
-
- calendarplugin/0.10/azcalendar/azcalendar.py (modified) (6 diffs)
- calendarplugin/0.10/azcalendar/caltools.py (added)
- calendarplugin/0.10/azcalendar/templates/azweekcal.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
calendarplugin/0.10/azcalendar/azcalendar.py
r2235 r2508 12 12 import time 13 13 import calendar 14 import caltools 14 15 import cal_layout 15 16 … … 39 40 def process_add(self, req): 40 41 add_stylesheet (req, 'hw/css/azcalendar.css') 42 41 43 if req.method == 'GET' and req.args.has_key('date'): 42 44 req.hdf['azcalendar.time_begin'] = time.strftime("%Y/%m/%d",(time.strptime(req.args['date'],"%Y%m%d"))) 43 45 req.hdf['azcalendar.time_end'] = time.strftime("%Y/%m/%d",(time.strptime(req.args['date'],"%Y%m%d"))) 44 46 return 'add_event.cs', None 47 45 48 elif req.method == 'GET' and req.args.has_key('new_event'): 46 begin_t = int(time.mktime(time.strptime(req.args['time_begin'],"%Y/%m/%d %H:%M"))) 47 end_t = int(time.mktime(time.strptime(req.args['time_end'],"%Y/%m/%d %H:%M"))) 48 date = time.strftime("%Y%m%d",(time.strptime(req.args['time_begin'],"%Y/%m/%d %H:%M"))) 49 begin_time, end_time, begin_stamp, end_stamp \ 50 = caltools.parse_time_begin_end(req.args['time_begin'], req.args['time_end']) 51 52 date = time.strftime("%Y%m%d", begin_time) 49 53 req.hdf['redir_url'] = str(self.env.href.azcalendar()) + "?date=%s" % date 50 current_time = int(time.time()) 51 #id = 0 -> its autocreated by DB 54 55 current_stamp = int(time.time()) 56 57 # Events with id 0 are created automatically by a DB layer. 52 58 author = req.authname 53 evt = Event(0,author,current_time, current_time, begin_t, end_t, 54 req.args['type'], req.args['priority'], req.args['title']) 55 return evt.save( self.env, req ) 59 evt = Event(0, author, current_stamp, current_stamp, begin_stamp, end_stamp, 60 req.args['type'], req.args['priority'], req.args['title']) 61 62 return evt.save(self.env, req) 56 63 57 64 def process_show(self, req): … … 250 257 if req.args.has_key('id'): 251 258 import re 252 xid = req.args['id'] ;259 xid = req.args['id'] 253 260 if not re.match (r"[0-9]+", xid): 254 261 return self.process_invalid(req) … … 271 278 req.hdf['azcalendar.last_update'] = time.strftime("%Y/%m/%d %H:%M:%S",time.localtime(evt.get_time_update())) 272 279 return 'azevent.cs', None 280 273 281 elif req.method == 'GET' and req.args.has_key('update_event'): 282 begin_time, end_time, begin_stamp, end_stamp \ 283 = caltools.parse_time_begin_end(req.args['time_begin'], req.args['time_end']) 284 274 285 evt = Event.get_event(self.env,req.args['evid']) 275 286 #evt.set_author(req.authname) … … 277 288 evt.set_priority(req.args['priority']) 278 289 evt.set_time_update(int(time.time())) 279 evt.set_time_begin( int(time.mktime(time.strptime(req.args['time_begin'],"%Y/%m/%d %H:%M"))))280 evt.set_time_end( int(time.mktime(time.strptime(req.args['time_end'],"%Y/%m/%d %H:%M"))))290 evt.set_time_begin(begin_stamp) 291 evt.set_time_end(end_stamp) 281 292 evt.set_title(req.args['title']) 282 date = time.strftime("%Y%m%d", (time.strptime(req.args['time_begin'],"%Y/%m/%d %H:%M")))293 date = time.strftime("%Y%m%d", begin_time) 283 294 req.hdf['redir_url'] = str(self.env.href.azcalendar()) + "?date=%s" % date 284 295 return evt.update(self.env, req) 296 285 297 elif req.method == 'GET' and req.args.has_key('delete_event'): 298 begin_time, end_time, begin_stamp, end_stamp \ 299 = caltools.parse_time_begin_end(req.args['time_begin'], req.args['time_end']) 300 286 301 evt = Event.get_event(self.env,req.args['evid']) 287 date = time.strftime("%Y%m%d", (time.strptime(req.args['time_begin'],"%Y/%m/%d %H:%M")))302 date = time.strftime("%Y%m%d", time_begin) 288 303 req.hdf['redir_url'] = str(self.env.href.azcalendar()) + "?date=%s" % date 289 304 return evt.delete(self.env) … … 298 313 KEY = "/azcalendar" 299 314 query = req.path_info[req.path_info.index (KEY):] 300 315 301 316 import re 302 317 if not re.match ("%s(/add|/delete|/event)?($|\?.*)" % KEY, query): calendarplugin/0.10/azcalendar/templates/azweekcal.cs
r2230 r2508 20 20 set:tmp.urlbase = urlbase + '/event?id=' + event.id ?><?cs 21 21 set:tmp.span = event.brd_end - event.brd_begin ?><?cs 22 23 if:event.title == '' ?><?cs 24 set:event.title = '(no title)' ?><?cs 25 /if ?><?cs 26 22 27 if:tmp.span >= 4 ?><?cs 23 28 set:tmp.show = event.title ?><?cs
